PageSourceSearch

https://firmus.co/_next/static/chunks/0gntdstuy2cxm.js?dpl=dpl_FPqNKqDTd1VYjejVQb3rY4QiJ2yX

js firmus.co collected 2026-10-04 00:27:44 UTC 2,669,845 bytes, 8,261 lines download raw bytes

1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,351853,(e,t,i)=>{var r=0/0,s=/^\s+|\s+$/g,a=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,h=/^0o[0-7]+$/i,c=parseInt,d=e.g&&e.g.Object===Object&&e.g,u="object"==typeof self&&self&&self.Object===Object&&self,p=d||u||Function("return this")(),f=Object.prototype.toString,m=Math.max,g=Math.min,v=function(){return p.Date.now()};function y(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function x(e){if("number"==typeof e)return e;if("symbol"==typeof(t=e)||t&&"object"==typeof t&&"[object Symbol]"==f.call(t))return r;if(y(e)){var t,i="function"==typeof e.valueOf?e.valueOf():e;e=y(i)?i+"":i}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(s,"");var d=o.test(e);return d||h.test(e)?c(e.slice(2),d?2:8):a.test(e)?r:+e}t.exports=function(e,t,i){var r,s,a,o,h,c,d=0,u=!1,p=!1,f=!0;if("function"!=typeof e)throw TypeError("Expected a function");function b(t){var i=r,a=s;return r=s=void 0,d=t,o=e.apply(a,i)}function w(e){var i=e-c,r=e-d;return void 0===c||i>=t||i<0||p&&r>=a}function _(){var e,i,r,s=v();if(w(s))return S(s);h=setTimeout(_,(e=s-c,i=s-d,r=t-e,p?g(r,a-i):r))}function S(e){return(h=void 0,f&&r)?b(e):(r=s=void 0,o)}function C(){var e,i=v(),a=w(i);if(r=arguments,s=this,c=i,a){if(void 0===h)return d=e=c,h=setTimeout(_,t),u?b(e):o;if(p)return h=setTimeout(_,t),b(c)}return void 0===h&&(h=setTimeout(_,t)),o}return t=x(t)||0,y(i)&&(u=!!i.leading,a=(p="maxWait"in i)?m(x(i.maxWait)||0,t):a,f="trailing"in i?!!i.trailing:f),C.cancel=function(){void 0!==h&&clearTimeout(h),d=0,r=c=s=h=void 0},C.flush=function(){return void 0===h?o:S(v())},C}},47997,e=>{e.v({Animation:"Animation-module-scss-module__VbiEVq__Animation"})},588610,e=>{"use strict";let t,i,r,s,a,o,h,c,d,u,p,f,m,g,v,y,x,b,w,_,S,C,M,E,A,T,P,D,O,L,I,R,k,B,z,N,F,j,U,V,W,H,G,q,X,Y,Q,Z,K,J,$,ee,et,ei,er,es,ea,en,eo,el,eh,ec,ed,eu,ep,ef,em,eg,ev,ey,ex,eb,ew,e_,eS,eC,eM,eE,eA,eT,eP,eD,eO,eL,eI,eR,ek,eB,ez,eN,eF,ej,eU,eV,eW,eH,eG,eq,eX,eY,eQ,eZ,eK,eJ,e$,e0,e1,e2,e3,e4,e5,e6,e8,e9,e7,te,tt,ti,tr,ts,ta,tn,to,tl;var th,tc,td=e.i(395633),tu=e.i(7284),tp=e.i(131173),tf=e.i(103308),tm=e.i(512533),tg=Object.create,tv=Object.defineProperty,ty=Object.getOwnPropertyDescriptor,tx=Object.getOwnPropertyNames,tb=Object.getPrototypeOf,tw=Object.prototype.hasOwnProperty,t_=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),tS=(e,t,i)=>(i=null!=e?tg(tb(e)):{},((e,t,i,r)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let s of tx(t))tw.call(e,s)||s===i||tv(e,s,{get:()=>t[s],enumerable:!(r=ty(t,s))||r.enumerable});return e})(!t&&e&&e.__esModule?i:tv(i,"default",{value:e,enumerable:!0}),e)),tC=(e,t,i)=>{let r;return(r="symbol"!=typeof t?t+"":t)in e?tv(e,r,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[r]=i,i},tM=t_((t,i)=>{var r;let s;r=function(){return e.importState=function(t){var i=new e;return i.importState(t),i},e;function e(){return function(e){var t,i,r=0,s=0,a=0,o=1;0==e.length&&(e=[+new Date]);var h=(t=0xefc8249d,(i=function(e){e=e.toString();for(var i=0;i<e.length;i++){var r=.02519603282416938*(t+=e.charCodeAt(i));t=r>>>0,r-=t,r*=t,t=r>>>0,r-=t,t+=0x100000000*r}return(t>>>0)*23283064365386963e-26}).version="Mash 0.9",i);r=h(" "),s=h(" "),a=h(" ");for(var c=0;c<e.length;c++)(r-=h(e[c]))<0&&(r+=1),(s-=h(e[c]))<0&&(s+=1),(a-=h(e[c]))<0&&(a+=1);h=null;var d=function(){var e=2091639*r+23283064365386963e-26*o;return r=s,s=a,a=e-(o=0|e)};return d.next=d,d.uint32=function(){return 0x100000000*d()},d.fract53=function(){return d()+(2097152*d()|0)*11102230246251565e-32},d.version="Alea 0.9",d.args=e,d.exportState=function(){return[r,s,a,o]},d.importState=function(e){r=+e[0]||0,s=+e[1]||0,a=+e[2]||0,o=+e[3]||0},d}(Array.prototype.slice.call(arguments))}},"object"==typeof t?i.exports=r():"function"==typeof define&&define.amd?void 0!==(s=r(e.r,exports,module))&&e.v(s):t.Alea=r()}),tE=t_((t,i)=>{var r,s;let a;r=t,s=function(e){e.SVD=function(e,t,i,r,s){if(t=void 0===t||t,i=void 0===i||i,s=1e-64/(r=r||2220446049250313e-31),!e)throw TypeError("Matrix a is not defined");var a,o,h,c,d,u,p,f,m,g,v,y,x=e[0].length,b=e.length;
1if(b<x)throw TypeError("Invalid matrix: m < n");for(var w=[],_=[],S=[],C="f"===t?b:x,M=g=p=0;M<b;M++)_[M]=Array(C).fill(0);for(M=0;M<x;M++)S[M]=Array(x).fill(0);var E,A=Array(x).fill(0);for(M=0;M<b;M++)for(a=0;a<x;a++)_[M][a]=e[M][a];for(M=0;M<x;M++){for(w[M]=p,m=0,h=M+1,a=M;a<b;a++)m+=Math.pow(_[a][M],2);if(m<s)p=0;else for(f=(u=_[M][M])*(p=u<0?Math.sqrt(m):-Math.sqrt(m))-m,_[M][M]=u-p,a=h;a<x;a++){for(m=0,o=M;o<b;o++)m+=_[o][M]*_[o][a];for(u=m/f,o=M;o<b;o++)_[o][a]=_[o][a]+u*_[o][M]}for(A[M]=p,m=0,a=h;a<x;a++)m+=Math.pow(_[M][a],2);if(m<s)p=0;else{for(f=(u=_[M][M+1])*(p=u<0?Math.sqrt(m):-Math.sqrt(m))-m,_[M][M+1]=u-p,a=h;a<x;a++)w[a]=_[M][a]/f;for(a=h;a<b;a++){for(m=0,o=h;o<x;o++)m+=_[a][o]*_[M][o];for(o=h;o<x;o++)_[a][o]=_[a][o]+m*w[o]}}g<(v=Math.abs(A[M])+Math.abs(w[M]))&&(g=v)}if(i)for(M=x-1;0<=M;M--){if(0!==p){for(f=_[M][M+1]*p,a=h;a<x;a++)S[a][M]=_[M][a]/f;for(a=h;a<x;a++){for(m=0,o=h;o<x;o++)m+=_[M][o]*S[o][a];for(o=h;o<x;o++)S[o][a]=S[o][a]+m*S[o][M]}}for(a=h;a<x;a++)S[M][a]=0,S[a][M]=0;S[M][M]=1,p=w[M],h=M}if(t){if("f"===t)for(M=x;M<b;M++){for(a=x;a<b;a++)_[M][a]=0;_[M][M]=1}for(M=x-1;0<=M;M--){for(h=M+1,p=A[M],a=h;a<C;a++)_[M][a]=0;if(0!==p){for(f=_[M][M]*p,a=h;a<C;a++){for(m=0,o=h;o<b;o++)m+=_[o][M]*_[o][a];for(u=m/f,o=M;o<b;o++)_[o][a]=_[o][a]+u*_[o][M]}for(a=M;a<b;a++)_[a][M]=_[a][M]/p}else for(a=M;a<b;a++)_[a][M]=0;_[M][M]=_[M][M]+1}}for(r*=g,o=x-1;0<=o;o--)for(var T=0;T<50;T++){for(E=!1,h=o;0<=h;h--){if(Math.abs(w[h])<=r){E=!0;break}if(Math.abs(A[h-1])<=r)break}if(!E){for(d=0,c=h-(m=1),M=h;M<o+1&&(u=m*w[M],w[M]=d*w[M],!(Math.abs(u)<=r));M++)if(p=A[M],A[M]=Math.sqrt(u*u+p*p),d=p/(f=A[M]),m=-u/f,t)for(a=0;a<b;a++)v=_[a][c],y=_[a][M],_[a][c]=v*d+y*m,_[a][M]=-v*m+y*d}if(y=A[o],h===o){if(y<0&&(A[o]=-y,i))for(a=0;a<x;a++)S[a][o]=-S[a][o];break}for(g=A[h],p=Math.sqrt((u=(((v=A[o-1])-y)*(v+y)+((p=w[o-1])-(f=w[o]))*(p+f))/(2*f*v))*u+1),u=((g-y)*(g+y)+f*(v/(u<0?u-p:u+p)-f))/g,M=h+(m=d=1);M<o+1;M++){if(p=w[M],v=A[M],f=m*p,p*=d,y=Math.sqrt(u*u+f*f),u=g*(d=u/(w[M-1]=y))+p*(m=f/y),p=-g*m+p*d,f=v*m,v*=d,i)for(a=0;a<x;a++)g=S[a][M-1],y=S[a][M],S[a][M-1]=g*d+y*m,S[a][M]=-g*m+y*d;if(y=Math.sqrt(u*u+f*f),u=(d=u/(A[M-1]=y))*p+(m=f/y)*v,g=-m*p+d*v,t)for(a=0;a<b;a++)v=_[a][M-1],y=_[a][M],_[a][M-1]=v*d+y*m,_[a][M]=-v*m+y*d}w[h]=0,w[o]=u,A[o]=g}for(M=0;M<x;M++)A[M]<r&&(A[M]=0);return{u:_,q:A,v:S}},e.VERSION="1.1.1",Object.defineProperty(e,"__esModule",{value:!0})},"object"==typeof t&&"u">typeof i?s(t):"function"==typeof define&&define.amd?void 0!==(a=s(exports))&&e.v(a):s((r="u">typeof globalThis?globalThis:r||self).SVDJS={})}),tA=t_((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(e){if(null===e||!0===e||!1===e)return NaN;var t=Number(e);return isNaN(t)?t:t<0?Math.ceil(t):Math.floor(t)},t.exports=e.default}),tT=t_((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(e){var t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),e.getTime()-t.getTime()},t.exports=e.default}),tP=t_((e,t)=>{function i(e,t,r,s){this.message=e,this.expected=t,this.found=r,this.location=s,this.name="SyntaxError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,i)}function r(){this.constructor=i}r.prototype=Error.prototype,i.prototype=new r,i.buildMessage=function(e,t){var i={literal:function(e){return'"'+s(e.text)+'"'},class:function(e){var t,i="";for(t=0;t<e.parts.length;t++)i+=e.parts[t]instanceof Array?a(e.parts[t][0])+"-"+a(e.parts[t][1]):a(e.parts[t]);return"["+(e.inverted?"^":"")+i+"]"},any:function(e){return"any character"},end:function(e){return"end of input"},other:function(e){return e.description}};function r(e){return e.charCodeAt(0).toString(16).toUpperCase()}function s(e){return e.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(e){return"\\x0"+r(e)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(e){return"\\x"+r(e)})}function a(e){return e.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(e){return"\\x0"+r(e)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(e){return"\\x"+r(e)})}return"Expected "+function(e){var t,r,s,a=Array(e.length);for(r=0;r<e.length;r++)a[r]=i[(t=e[r]).type](t);if(a.sort(),a.length>0){for(r=1,s=1;r<a.length;r++)a[r-1]!==a[r]&&(a[s]=a[r],s++);a.length=s}switch(a.length){case 1:return a[0];
vendor: 4,233 bytes, lines 1-2
1case 2:return a[0]+" or "+a[1];default:return a.slice(0,-1).join(", ")+", or "+a[a.length-1]}}(e)+" but "+(t?'"'+s(t)+'"':"end of input")+" found."},t.exports={SyntaxError:i,parse:function(e,t){t=void 0!==t?t:{};var r,s,a,o,h={},c={svg_path:ea},d=ea,u=function(e){if(!e)return[];for(var t=[],i=0;i<e.length;i++)t=t.concat.apply(t,e[i]);var r=t[0];return r&&"m"==r.code&&(delete r.relative,r.code="M"),t},p=function(e,t){var i=e,r=t;if(!r)return[i];for(var s=[i],a=0,o=r.length;a<o;a++)s[a+1]=r[a][1];return s},f=/^[Mm]/,m=et(["M","m"],!1,!1),g=function(e,t,i){var r=eA(e,[t]);return i&&(r=r.concat(eA("M"==e?"L":"l",i[1]))),r},v=/^[Zz]/,y=et(["Z","z"],!1,!1),x=/^[Ll]/,b=et(["L","l"],!1,!1),w=function(e,t){return eA(e,t)},_=/^[Hh]/,S=et(["H","h"],!1,!1),C=/^[Vv]/,M=et(["V","v"],!1,!1),E=/^[Cc]/,A=et(["C","c"],!1,!1),T=/^[Ss]/,P=et(["S","s"],!1,!1),D=/^[Qq]/,O=et(["Q","q"],!1,!1),L=/^[Tt]/,I=et(["T","t"],!1,!1),R=/^[Aa]/,k=et(["A","a"],!1,!1),B=/^[01]/,z=et(["0","1"],!1,!1),N=function(){return""},F=ee(",",!1),j=function(e){return e.join("")},U=ee(".",!1),V=/^[eE]/,W=et(["e","E"],!1,!1),H=/^[+\-]/,G=et(["+","-"],!1,!1),q=/^[0-9]/,X=et([["0","9"]],!1,!1),Y=/^[ \t\n\r]/,Q=et([" ","	",`
2`,"\r"],!1,!1),Z=0,K=[{line:1,column:1}],J=0,$=[];if("startRule"in t){if(!(t.startRule in c))throw Error("Can't start parsing from rule \""+t.startRule+'".');d=c[t.startRule]}function ee(e,t){return{type:"literal",text:e,ignoreCase:t}}function et(e,t,i){return{type:"class",parts:e,inverted:t,ignoreCase:i}}function ei(t){var i,r=K[t];if(r)return r;for(i=t-1;!K[i];)i--;for(r={line:(r=K[i]).line,column:r.column};i<t;)10===e.charCodeAt(i)?(r.line++,r.column=1):r.column++,i++;return K[t]=r,r}function er(e,t){var i=ei(e),r=ei(t);return{start:{offset:e,line:i.line,column:i.column},end:{offset:t,line:r.line,column:r.column}}}function es(e){Z<J||(Z>J&&(J=Z,$=[]),$.push(e))}function ea(){var e,t,i,r,s;for(e=Z,t=[],i=eC();i!==h;)t.push(i),i=eC();if(t!==h)if((i=function(){var e,t,i,r,s,a;if(e=Z,(t=en())!==h){for(i=[],r=Z,s=[],a=eC();a!==h;)s.push(a),a=eC();for(s!==h&&(a=en())!==h?r=s=[s,a]:(Z=r,r=h);r!==h;){for(i.push(r),r=Z,s=[],a=eC();a!==h;)s.push(a),a=eC();s!==h&&(a=en())!==h?r=s=[s,a]:(Z=r,r=h)}i!==h?e=t=p(t,i):(Z=e,e=h)}else Z=e,e=h;return e}())===h&&(i=null),i!==h){for(r=[],s=eC();s!==h;)r.push(s),s=eC();r!==h?e=t=u(i):(Z=e,e=h)}else Z=e,e=h;else Z=e,e=h;return e}function en(){var t,i,r,s,a,o;if(t=Z,(i=function(){var t,i,r,s,a,o,c;if(t=Z,f.test(e.charAt(Z))?(i=e.charAt(Z),Z++):(i=h,es(m)),i!==h){for(r=[],s=eC();s!==h;)r.push(s),s=eC();r!==h&&(s=ef())!==h?(a=Z,(o=ey())===h&&(o=null),o!==h&&(c=el())!==h?a=o=[o,c]:(Z=a,a=h),a===h&&(a=null),a!==h?t=i=g(i,s,a):(Z=t,t=h)):(Z=t,t=h)}else Z=t,t=h;return t}())!==h){for(r=[],s=Z,a=[],o=eC();o!==h;)a.push(o),o=eC();for(a!==h&&(o=eo())!==h?s=a=[a,o]:(Z=s,s=h);s!==h;){for(r.push(s),s=Z,a=[],o=eC();o!==h;)a.push(o),o=eC();a!==h&&(o=eo())!==h?s=a=[a,o]:(Z=s,s=h)}r!==h?t=i=p(i,r):(Z=t,t=h)}else Z=t,t=h;return t}function eo(){var t,i;return v.test(e.charAt(Z))?(i=e.charAt(Z),Z++):(i=h,es(y)),i!==h&&(i=eA("Z")),(t=i)===h&&(t=function(){var t,i,r,s;if(t=Z,x.test(e.charAt(Z))?(i=e.charAt(Z),Z++):(i=h,es(b)),i!==h){for(r=[],s=eC();s!==h;)r.push(s),s=eC();r!==h&&(s=el())!==h?t=i=w(i,s):(Z=t,t=h)}else Z=t,t=h;return t}())===h&&(t=function(){var t,i,r,s;if(t=Z,_.test(e.charAt(Z))?(i=e.charAt(Z),Z++):(i=h,es(S)),i!==h){for(r=[],s=eC();s!==h;)r.push(s),s=eC();r!==h&&(s=eh())!==h?t=i=eA(i,s.map(function(e){return{x:e}})):(Z=t,t=h)}else Z=t,t=h;return t}())===h&&(t=function(){var t,i,r,s;if(t=Z,C.test(e.charAt(Z))?(i=e.charAt(Z),Z++):(i=h,es(M)),i!==h){for(r=[],s=eC();s!==h;)r.push(s),s=eC();r!==h&&(s=eh())!==h?t=i=eA(i,s.map(function(e){return{y:e}})):(Z=t,t=h)}else Z=t,t=h;return t}())===h&&(t=function(){var t,i,r,s;if(t=Z,E.test(e.charAt(Z))?(i=e.charAt(Z),Z++):(i=h,es(A)),i!==h){for(r=[],s=eC();s!==h;)r.push(s),s=eC();r!==h&&(s=function(){var e,t,i,r,s,a;if(e=Z,(t=ec())!==h){for(i=[],r=Z,(s=ey())===h&&(s=null),s!==h&&(a=ec())!==h?r=s=[s,a]:(Z=r,r=h);r!==h;)i.push(r),r=Z,(s=ey())===h&&(s=null),s!==h&&(a=ec())!==h?r=s=[s,a]:(Z=r,r=h);i!==h?e=t=p(t,i):(Z=e,e=h)}else Z=e,e=h;return e}())!==h?t=i=w(i,s):(Z=t,t=h)}else Z=t,t=h;return t}())===h&&(t=function(){var t,i,r,s;
2if(t=Z,T.test(e.charAt(Z))?(i=e.charAt(Z),Z++):(i=h,es(P)),i!==h){for(r=[],s=eC();s!==h;)r.push(s),s=eC();r!==h&&(s=function(){var e,t,i,r,s,a;if(e=Z,(t=ed())!==h){for(i=[],r=Z,(s=ey())===h&&(s=null),s!==h&&(a=ed())!==h?r=s=[s,a]:(Z=r,r=h);r!==h;)i.push(r),r=Z,(s=ey())===h&&(s=null),s!==h&&(a=ed())!==h?r=s=[s,a]:(Z=r,r=h);i!==h?e=t=p(t,i):(Z=e,e=h)}else Z=e,e=h;return e}())!==h?t=i=w(i,s):(Z=t,t=h)}else Z=t,t=h;return t}())===h&&(t=function(){var t,i,r,s;if(t=Z,D.test(e.charAt(Z))?(i=e.charAt(Z),Z++):(i=h,es(O)),i!==h){for(r=[],s=eC();s!==h;)r.push(s),s=eC();r!==h&&(s=function(){var e,t,i,r,s,a;if(e=Z,(t=eu())!==h){for(i=[],r=Z,(s=ey())===h&&(s=null),s!==h&&(a=eu())!==h?r=s=[s,a]:(Z=r,r=h);r!==h;)i.push(r),r=Z,(s=ey())===h&&(s=null),s!==h&&(a=eu())!==h?r=s=[s,a]:(Z=r,r=h);i!==h?e=t=p(t,i):(Z=e,e=h)}else Z=e,e=h;return e}())!==h?t=i=w(i,s):(Z=t,t=h)}else Z=t,t=h;return t}())===h&&(t=function(){var t,i,r,s;if(t=Z,L.test(e.charAt(Z))?(i=e.charAt(Z),Z++):(i=h,es(I)),i!==h){for(r=[],s=eC();s!==h;)r.push(s),s=eC();r!==h&&(s=function(){var e,t,i,r,s,a;if(e=Z,(t=ef())!==h){for(i=[],r=Z,(s=ey())===h&&(s=null),s!==h&&(a=ef())!==h?r=s=[s,a]:(Z=r,r=h);r!==h;)i.push(r),r=Z,(s=ey())===h&&(s=null),s!==h&&(a=ef())!==h?r=s=[s,a]:(Z=r,r=h);i!==h?e=t=p(t,i):(Z=e,e=h)}else Z=e,e=h;return e}())!==h?t=i=w(i,s):(Z=t,t=h)}else Z=t,t=h;return t}())===h&&(t=function(){var t,i,r,s;if(t=Z,R.test(e.charAt(Z))?(i=e.charAt(Z),Z++):(i=h,es(k)),i!==h){for(r=[],s=eC();s!==h;)r.push(s),s=eC();r!==h&&(s=function(){var e,t,i,r,s,a;if(e=Z,(t=ep())!==h){for(i=[],r=Z,(s=ey())===h&&(s=null),s!==h&&(a=ep())!==h?r=s=[s,a]:(Z=r,r=h);r!==h;)i.push(r),r=Z,(s=ey())===h&&(s=null),s!==h&&(a=ep())!==h?r=s=[s,a]:(Z=r,r=h);i!==h?e=t=p(t,i):(Z=e,e=h)}else Z=e,e=h;return e}())!==h?t=i=w(i,s):(Z=t,t=h)}else Z=t,t=h;return t}()),t}function el(){var e,t,i,r,s,a;if(e=Z,(t=ef())!==h){for(i=[],r=Z,(s=ey())===h&&(s=null),s!==h&&(a=ef())!==h?r=s=[s,a]:(Z=r,r=h);r!==h;)i.push(r),r=Z,(s=ey())===h&&(s=null),s!==h&&(a=ef())!==h?r=s=[s,a]:(Z=r,r=h);i!==h?e=t=p(t,i):(Z=e,e=h)}else Z=e,e=h;return e}function eh(){var e,t,i,r,s,a;if(e=Z,(t=eg())!==h){for(i=[],r=Z,(s=ey())===h&&(s=null),s!==h&&(a=eg())!==h?r=s=[s,a]:(Z=r,r=h);r!==h;)i.push(r),r=Z,(s=ey())===h&&(s=null),s!==h&&(a=eg())!==h?r=s=[s,a]:(Z=r,r=h);i!==h?e=t=p(t,i):(Z=e,e=h)}else Z=e,e=h;return e}function ec(){var e,t,i,r,s,a,o,c,d;return e=Z,(t=ef())!==h?((i=ey())===h&&(i=null),i!==h&&(r=ef())!==h?((s=ey())===h&&(s=null),s!==h&&(a=ef())!==h?(o=t,c=r,d=a,e=t={x1:o.x,y1:o.y,x2:c.x,y2:c.y,x:d.x,y:d.y}):(Z=e,e=h)):(Z=e,e=h)):(Z=e,e=h),e}function ed(){var e,t,i,r,s,a;return e=Z,(t=ef())!==h?((i=ey())===h&&(i=null),i!==h&&(r=ef())!==h?(s=t,a=r,e=t={x2:s.x,y2:s.y,x:a.x,y:a.y}):(Z=e,e=h)):(Z=e,e=h),e}function eu(){var e,t,i,r,s,a;return e=Z,(t=ef())!==h?((i=ey())===h&&(i=null),i!==h&&(r=ef())!==h?(s=t,a=r,e=t={x1:s.x,y1:s.y,x:a.x,y:a.y}):(Z=e,e=h)):(Z=e,e=h),e}function ep(){var e,t,i,r,s,a,o,c,d,u,p,f;return e=Z,(t=em())!==h?((i=ey())===h&&(i=null),i!==h&&(r=em())!==h?((s=ey())===h&&(s=null),s!==h&&(a=eg())!==h&&ey()!==h&&(o=ev())!==h?((c=ey())===h&&(c=null),c!==h&&(d=ev())!==h?((u=ey())===h&&(u=null),u!==h&&(p=ef())!==h?e=t={rx:t,ry:r,xAxisRotation:a,largeArc:o,sweep:d,x:(f=p).x,y:f.y}:(Z=e,e=h)):(Z=e,e=h)):(Z=e,e=h)):(Z=e,e=h)):(Z=e,e=h),e}function ef(){var e,t,i,r;return e=Z,(t=eg())!==h?((i=ey())===h&&(i=null),i!==h&&(r=eg())!==h?e=t={x:t,y:r}:(Z=e,e=h)):(Z=e,e=h),e}function em(){var e;return(e=eb())===h&&(e=eS()),e!==h&&(e*=1),e}function eg(){var e,t,i;return e=Z,(t=e_())===h&&(t=null),t!==h&&(i=eb())!==h?e=t=[t,i]:(Z=e,e=h),e===h&&(e=Z,(t=e_())===h&&(t=null),t!==h&&(i=eS())!==h?e=t=[t,i]:(Z=e,e=h)),e!==h&&(e=+e.join("")),e}function ev(){var t;return B.test(e.charAt(Z))?(t=e.charAt(Z),Z++):(t=h,es(z)),t!==h&&(t="1"==t),t}function ey(){var e,t,i,r,s;if(e=Z,t=[],(i=eC())!==h)for(;i!==h;)t.push(i),i=eC();else t=h;if(t!==h)if((i=ex())===h&&(i=null),i!==h){for(r=[],s=eC();s!==h;)r.push(s),s=eC();r!==h?e=t=[t,i,r]:(Z=e,e=h)}else Z=e,e=h;else Z=e,e=h;if(e===h){if(e=Z,t=Z,(i=ex())!==h){for(r=[],s=eC();s!==h;)r.push(s),s=eC();r!==h?t=i=[i,r]:(Z=t,t=h)}else Z=t,t=h;
vendor: 7,919 bytes, line 2
2t!==h&&(t=N()),e=t}return e}function ex(){var t;return 44===e.charCodeAt(Z)?(t=",",Z++):(t=h,es(F)),t}function eb(){var t,i,r,s,a,o,c;return t=Z,(s=Z,(a=eS())===h&&(a=null),a!==h?(46===e.charCodeAt(Z)?(o=".",Z++):(o=h,es(U)),o!==h&&(c=eS())!==h?s=a=[a,o,c]:(Z=s,s=h)):(Z=s,s=h),s===h&&(s=Z,(a=eS())!==h?(46===e.charCodeAt(Z)?(o=".",Z++):(o=h,es(U)),o!==h?s=a=[a,o]:(Z=s,s=h)):(Z=s,s=h)),s!==h&&(s=j(s)),(i=s)!==h)?((r=ew())===h&&(r=null),r!==h?t=i=[i,r]:(Z=t,t=h)):(Z=t,t=h),t===h&&(t=Z,(i=eS())!==h&&(r=ew())!==h?t=i=[i,r]:(Z=t,t=h)),t!==h&&(t=j(t)),t}function ew(){var t,i,r,s;return t=Z,V.test(e.charAt(Z))?(i=e.charAt(Z),Z++):(i=h,es(W)),i!==h?((r=e_())===h&&(r=null),r!==h&&(s=eS())!==h?t=i=[i,r,s]:(Z=t,t=h)):(Z=t,t=h),t!==h&&(t=j(t)),t}function e_(){var t;return H.test(e.charAt(Z))?(t=e.charAt(Z),Z++):(t=h,es(G)),t}function eS(){var t,i;if(t=[],q.test(e.charAt(Z))?(i=e.charAt(Z),Z++):(i=h,es(X)),i!==h)for(;i!==h;)t.push(i),q.test(e.charAt(Z))?(i=e.charAt(Z),Z++):(i=h,es(X));else t=h;return t!==h&&(t=t.join("")),t}function eC(){var t;return Y.test(e.charAt(Z))?(t=e.charAt(Z),Z++):(t=h,es(Q)),t!==h&&(t=N()),t}var eM={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 eE in eM)eM[eE.toUpperCase()]=eM[eE];function eA(e,t){t||(t=[{}]);for(var i=t.length;i--;){var r={code:e,command:eM[e]};for(var s in e==e.toLowerCase()&&(r.relative=!0),t[i])r[s]=t[i][s];t[i]=r}return t}if((o=d())!==h&&Z===e.length)return o;throw o!==h&&Z<e.length&&es({type:"end"}),r=$,s=J<e.length?e.charAt(J):null,a=J<e.length?er(J,J+1):er(J,J),new i(i.buildMessage(r,s),r,s,a)}}}),tD=t_((e,t)=>{var i=tP().parse;i.parseSVG=i,i.makeAbsolute=function(e){var t,i={x:0,y:0},r={x:"x0",y:"y0",x1:"x0",y1:"y0",x2:"x0",y2:"y0"};return e.forEach(function(e){for(var s in"moveto"===e.command&&(t=e),e.x0=i.x,e.y0=i.y,r)s in e&&(e[s]+=e.relative?e[r[s]]:0);"x"in e||(e.x=i.x),"y"in e||(e.y=i.y),e.relative=!1,e.code=e.code.toUpperCase(),"closepath"==e.command&&(e.x=t.x,e.y=t.y),i=e}),e},t.exports=i}),tO=t_((e,t)=>{t.exports=function(e,t){for(var i=e.split("."),r=t.split("."),s=0;s<3;s++){var a=Number(i[s]),o=Number(r[s]);if(a>o)return 1;if(o>a)return -1;if(!isNaN(a)&&isNaN(o))return 1;if(isNaN(a)&&!isNaN(o))return -1}return 0}}),tL="srgb",tI="srgb-linear",tR="300 es",tk=class{addEventListener(e,t){void 0===this._listeners&&(this._listeners={});let i=this._listeners;void 0===i[e]&&(i[e]=[]),-1===i[e].indexOf(t)&&i[e].push(t)}hasEventListener(e,t){if(void 0===this._listeners)return!1;let i=this._listeners;return void 0!==i[e]&&-1!==i[e].indexOf(t)}removeEventListener(e,t){if(void 0===this._listeners)return;let i=this._listeners[e];if(void 0!==i){let e=i.indexOf(t);-1!==e&&i.splice(e,1)}}dispatchEvent(e){if(void 0===this._listeners)return;let t=this._listeners[e.type];if(void 0!==t){e.target=this;let i=t.slice(0);for(let t=0,r=i.length;t<r;t++)i[t].call(this,e);e.target=null}}},tB=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"],tz=1234567,tN=Math.PI/180,tF=180/Math.PI;function tj(){let e=0xffffffff*Math.random()|0,t=0xffffffff*Math.random()|0,i=0xffffffff*Math.random()|0,r=0xffffffff*Math.random()|0;return(tB[255&e]+tB[e>>8&255]+tB[e>>16&255]+tB[e>>24&255]+"-"+tB[255&t]+tB[t>>8&255]+"-"+tB[t>>16&15|64]+tB[t>>24&255]+"-"+tB[63&i|128]+tB[i>>8&255]+"-"+tB[i>>16&255]+tB[i>>24&255]+tB[255&r]+tB[r>>8&255]+tB[r>>16&255]+tB[r>>24&255]).toLowerCase()}function tU(e,t,i){return Math.max(t,Math.min(i,e))}function tV(e,t){return(e%t+t)%t}function tW(e,t,i){return(1-i)*e+i*t}function tH(e){return(e&e-1)==0&&0!==e}function tG(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))}function tq(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))}function tX(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 Error("Invalid component type.")}}function tY(e,t){switch(t.constructor){case Float32Array:return e;case Uint16Array:return Math.round(65535*e);case Uint8Array:return Math.round(255*e);case Int16Array:return Math.round(32767*e);case Int8Array:return Math.round(127*e);default:throw Error("Invalid component type.")}}var tQ=Object.freeze({__proto__:null,DEG2RAD:tN,RAD2DEG:tF,ceilPowerOfTwo:tG,clamp:tU,damp:function(e,t,i,r){return tW(e,t,1-Math.exp(-i*r))},degToRad:function(e){return e*tN},denormalize:tX,euclideanModulo:tV,floorPowerOfTwo:tq,generateUUID:tj,inverseLerp:function(e,t,i){return e!==t?(i-e)/(t-e):0},isPowerOfTwo:tH,lerp:tW,mapLinear:function(e,t,i,r,s){return r+(e-t)*(s-r)/(i-t)},normalize:tY,pingpong:function(e,t=1){return t-Math.abs(tV(e,2*t)-t)},radToDeg:function(e){return e*tF},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},seededRandom:function(e){void 0!==e&&(tz=e);let t=tz+=0x6d2b79f5;return t=Math.imul(t^t>>>15,1|t),(((t^=t+Math.imul(t^t>>>7,61|t))^t>>>14)>>>0)/0x100000000},setQuaternionFromProperEuler:function(e,t,i,r,s){let a=Math.cos,o=Math.sin,h=a(i/2),c=o(i/2),d=a((t+r)/2),u=o((t+r)/2),p=a((t-r)/2),f=o((t-r)/2),m=a((r-t)/2),g=o((r-t)/2);switch(s){case"XYX":e.set(h*u,c*p,c*f,h*d);break;case"YZY":e.set(c*f,h*u,c*p,h*d);break;case"ZXZ":e.set(c*p,c*f,h*u,h*d);break;case"XZX":e.set(h*u,c*g,c*m,h*d);break;case"YXY":e.set(c*m,h*u,c*g,h*d);break;case"ZYZ":e.set(c*g,c*m,h*u,h*d);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+s)}},smootherstep:function(e,t,i){return e<=t?0:e>=i?1:(e=(e-t)/(i-t))*e*e*(e*(6*e-15)+10)},smoothstep:function(e,t,i){return e<=t?0:e>=i?1:(e=(e-t)/(i-t))*e*(3-2*e)}}),tZ=class{constructor(e=0,t=0){tZ.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 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 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: 5,859 bytes, line 2
2sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){let t=this.x,i=this.y,r=e.elements;return this.x=r[0]*t+r[3]*i+r[6],this.y=r[1]*t+r[4]*i+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){let i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,i=this.y-e.y;return t*t+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let i=Math.cos(t),r=Math.sin(t),s=this.x-e.x,a=this.y-e.y;return this.x=s*i-a*r+e.x,this.y=s*r+a*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}},tK=class{constructor(){tK.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1]}set(e,t,i,r,s,a,o,h,c){let d=this.elements;return d[0]=e,d[1]=r,d[2]=o,d[3]=t,d[4]=s,d[5]=h,d[6]=i,d[7]=a,d[8]=c,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],o=i[3],h=i[6],c=i[1],d=i[4],u=i[7],p=i[2],f=i[5],m=i[8],g=r[0],v=r[3],y=r[6],x=r[1],b=r[4],w=r[7],_=r[2],S=r[5],C=r[8];return s[0]=a*g+o*x+h*_,s[3]=a*v+o*b+h*S,s[6]=a*y+o*w+h*C,s[1]=c*g+d*x+u*_,s[4]=c*v+d*b+u*S,s[7]=c*y+d*w+u*C,s[2]=p*g+f*x+m*_,s[5]=p*v+f*b+m*S,s[8]=p*y+f*w+m*C,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],o=e[5],h=e[6],c=e[7],d=e[8];return t*a*d-t*o*c-i*s*d+i*o*h+r*s*c-r*a*h}invert(){let e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],a=e[4],o=e[5],h=e[6],c=e[7],d=e[8],u=d*a-o*c,p=o*h-d*s,f=c*s-a*h,m=t*u+i*p+r*f;if(0===m)return this.set(0,0,0,0,0,0,0,0,0);let g=1/m;return e[0]=u*g,e[1]=(r*c-d*i)*g,e[2]=(o*i-r*a)*g,e[3]=p*g,e[4]=(d*t-r*h)*g,e[5]=(r*s-o*t)*g,e[6]=f*g,e[7]=(i*h-c*t)*g,e[8]=(a*t-i*s)*g,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,o){let h=Math.cos(s),c=Math.sin(s);return this.set(i*h,i*c,-i*(h*a+c*o)+a+e,-r*c,r*h,-r*(-c*a+h*o)+o+t,0,0,1),this}scale(e,t){return this.premultiply(tJ.makeScale(e,t)),this}rotate(e){return this.premultiply(tJ.makeRotation(-e)),this}translate(e,t){return this.premultiply(tJ.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 e=0;e<9;e++)if(t[e]!==i[e])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)}},tJ=new tK;function t$(e){for(let t=e.length-1;t>=0;--t)if(e[t]>=65535)return!0;return!1}var t0={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function t1(e,t){return new t0[e](t)}function t2(e){return document.createElementNS("http://www.w3.org/1999/xhtml",e)}function t3(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}
2function t4(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}var t5={[tL]:{[tI]:t3},[tI]:{[tL]:t4}},t6={legacyMode:!0,get workingColorSpace(){return tI},set workingColorSpace(n){console.warn("THREE.ColorManagement: .workingColorSpace is readonly.")},convert:function(e,t,i){if(this.legacyMode||t===i||!t||!i)return e;if(t5[t]&&void 0!==t5[t][i]){let r=t5[t][i];return e.r=r(e.r),e.g=r(e.g),e.b=r(e.b),e}throw 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)}},t8={aliceblue:0xf0f8ff,antiquewhite:0xfaebd7,aqua:65535,aquamarine:8388564,azure:0xf0ffff,beige:0xf5f5dc,bisque:0xffe4c4,black:0,blanchedalmond:0xffebcd,blue:255,blueviolet:9055202,brown:0xa52a2a,burlywood:0xdeb887,cadetblue:6266528,chartreuse:8388352,chocolate:0xd2691e,coral:0xff7f50,cornflowerblue:6591981,cornsilk:0xfff8dc,crimson:0xdc143c,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:0xb8860b,darkgray:0xa9a9a9,darkgreen:25600,darkgrey:0xa9a9a9,darkkhaki:0xbdb76b,darkmagenta:9109643,darkolivegreen:5597999,darkorange:0xff8c00,darkorchid:0x9932cc,darkred:9109504,darksalmon:0xe9967a,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:0xff1493,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:0xb22222,floralwhite:0xfffaf0,forestgreen:2263842,fuchsia:0xff00ff,gainsboro:0xdcdcdc,ghostwhite:0xf8f8ff,gold:0xffd700,goldenrod:0xdaa520,gray:8421504,green:32768,greenyellow:0xadff2f,grey:8421504,honeydew:0xf0fff0,hotpink:0xff69b4,indianred:0xcd5c5c,indigo:4915330,ivory:0xfffff0,khaki:0xf0e68c,lavender:0xe6e6fa,lavenderblush:0xfff0f5,lawngreen:8190976,lemonchiffon:0xfffacd,lightblue:0xadd8e6,lightcoral:0xf08080,lightcyan:0xe0ffff,lightgoldenrodyellow:0xfafad2,lightgray:0xd3d3d3,lightgreen:9498256,lightgrey:0xd3d3d3,lightpink:0xffb6c1,lightsalmon:0xffa07a,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:0xb0c4de,lightyellow:0xffffe0,lime:65280,limegreen:3329330,linen:0xfaf0e6,magenta:0xff00ff,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:0xba55d3,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:0xc71585,midnightblue:1644912,mintcream:0xf5fffa,mistyrose:0xffe4e1,moccasin:0xffe4b5,navajowhite:0xffdead,navy:128,oldlace:0xfdf5e6,olive:8421376,olivedrab:7048739,orange:0xffa500,orangered:0xff4500,orchid:0xda70d6,palegoldenrod:0xeee8aa,palegreen:0x98fb98,paleturquoise:0xafeeee,palevioletred:0xdb7093,papayawhip:0xffefd5,peachpuff:0xffdab9,peru:0xcd853f,pink:0xffc0cb,plum:0xdda0dd,powderblue:0xb0e0e6,purple:8388736,rebeccapurple:6697881,red:0xff0000,rosybrown:0xbc8f8f,royalblue:4286945,saddlebrown:9127187,salmon:0xfa8072,sandybrown:0xf4a460,seagreen:3050327,seashell:0xfff5ee,sienna:0xa0522d,silver:0xc0c0c0,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:0xfffafa,springgreen:65407,steelblue:4620980,tan:0xd2b48c,teal:32896,thistle:0xd8bfd8,tomato:0xff6347,turquoise:4251856,violet:0xee82ee,wheat:0xf5deb3,white:0xffffff,whitesmoke:0xf5f5f5,yellow:0xffff00,yellowgreen:0x9acd32},t9={r:0,g:0,b:0},t7={h:0,s:0,l:0},ie={h:0,s:0,l:0};function it(e,t,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?e+(t-e)*6*i:i<.5?t:i<2/3?e+(t-e)*6*(2/3-i):e}function ii(e,t){return t.r=e.r,t.g=e.g,t.b=e.b,t}var ir=class{constructor(e,t,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,void 0===t&&void 0===i?this.set(e):this.setRGB(e,t,i)}set(e){return e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e),this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=tL){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,t6.toWorkingColorSpace(this,t),this}setRGB(e,t,i,r=t6.workingColorSpace){return this.r=e,this.g=t,this.b=i,t6.toWorkingColorSpace(this,r),this}setHSL(e,t,i,r=t6.workingColorSpace){if(e=tV(e,1),t=tU(t,0,1),i=tU(i,0,1),0===t)this.r=this.g=this.b=i;else{let r=i<=.5?i*(1+t):i+t-i*t,s=2*i-r;this.r=it(s,r,e+1/3),this.g=it(s,r,e),this.b=it(s,r,e-1/3)}return t6.toWorkingColorSpace(this,r),this}setStyle(e,t=tL){let i;function r(t){void 0!==t&&1>parseFloat(t)&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}if(i=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(e)){let e,s=i[1],a=i[2];switch(s){case"rgb":case"rgba":if(e=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return this.r=Math.min(255,parseInt(e[1],10))/255,this.g=Math.min(255,parseInt(e[2],10))/255,this.b=Math.min(255,parseInt(e[3],10))/255,t6.toWorkingColorSpace(this,t),r(e[4]),this;if(e=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return this.r=Math.min(100,parseInt(e[1],10))/100,this.g=Math.min(100,parseInt(e[2],10))/100,this.b=Math.min(100,parseInt(e[3],10))/100,t6.toWorkingColorSpace(this,t),r(e[4]),this;break;case"hsl":case"hsla":if(e=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a)){let i=parseFloat(e[1])/360,s=parseFloat(e[2])/100,a=parseFloat(e[3])/100;return r(e[4]),this.setHSL(i,s,a,t)}}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){let e=i[1],r=e.length;if(3===r)return this.r=parseInt(e.charAt(0)+e.charAt(0),16)/255,this.g=parseInt(e.charAt(1)+e.charAt(1),16)/255,this.b=parseInt(e.charAt(2)+e.charAt(2),16)/255,t6.toWorkingColorSpace(this,t),this;if(6===r)return this.r=parseInt(e.charAt(0)+e.charAt(1),16)/255,this.g=parseInt(e.charAt(2)+e.charAt(3),16)/255,this.b=parseInt(e.charAt(4)+e.charAt(5),16)/255,t6.toWorkingColorSpace(this,t),this}return e&&e.length>0?this.setColorName(e,t):this}setColorName(e,t=tL){let i=t8[e.toLowerCase()];return void 0!==i?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=t3(e.r),this.g=t3(e.g),this.b=t3(e.b),this}copyLinearToSRGB(e){return this.r=t4(e.r),this.g=t4(e.g),this.b=t4(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=tL){return t6.fromWorkingColorSpace(ii(this,t9),e),tU(255*t9.r,0,255)<<16^tU(255*t9.g,0,255)<<8^tU(255*t9.b,0,255)}getHexString(e=tL){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=t6.workingColorSpace){t6.fromWorkingColorSpace(ii(this,t9),t);let i=t9.r,r=t9.g,s=t9.b,a=Math.max(i,r,s),o=Math.min(i,r,s),h,c,d=(o+a)/2;if(o===a)h=0,c=0;else{let e=a-o;switch(c=d<=.5?e/(a+o):e/(2-a-o),a){case i:h=(r-s)/e+6*(r<s);break;case r:h=(s-i)/e+2;break;case s:h=(i-r)/e+4}h/=6}return e.h=h,e.s=c,e.l=d,e}getRGB(e,t=t6.workingColorSpace){return t6.fromWorkingColorSpace(ii(this,t9),t),e.r=t9.r,e.g=t9.g,e.b
2=t9.b,e}getStyle(e=tL){return t6.fromWorkingColorSpace(ii(this,t9),e),e!==tL?`color(${e} ${t9.r} ${t9.g} ${t9.b})`:`rgb(${255*t9.r|0},${255*t9.g|0},${255*t9.b|0})`}offsetHSL(e,t,i){return this.getHSL(t7),t7.h+=e,t7.s+=t,t7.l+=i,this.setHSL(t7.h,t7.s,t7.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(t7),e.getHSL(ie);let i=tW(t7.h,ie.h,t),r=tW(t7.s,ie.s,t),s=tW(t7.l,ie.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}};ir.NAMES=t8;var is,ia=class{static getDataURL(e){let t;if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;if(e instanceof HTMLCanvasElement)t=e;else{void 0===is&&(is=t2("canvas")),is.width=e.width,is.height=e.height;let i=is.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),t=is}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("u">typeof HTMLImageElement&&e instanceof HTMLImageElement||"u">typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"u">typeof ImageBitmap&&e instanceof ImageBitmap){let t=t2("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 e=0;e<s.length;e++)s[e]=255*t3(s[e]/255);return i.putImageData(r,0,0),t}if(!e.data)return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e;{let t=e.data.slice(0);for(let e=0;e<t.length;e++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[e]=Math.floor(255*t3(t[e]/255)):t[e]=t3(t[e]);return{data:t,width:e.width,height:e.height}}}},io=class{constructor(e=null){this.isSource=!0,this.uuid=tj(),this.data=e,this.version=0}set needsUpdate(e){!0===e&&this.version++}toJSON(e){let t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.images[this.uuid])return e.images[this.uuid];let i={uuid:this.uuid,url:""},r=this.data;if(null!==r){let e;if(Array.isArray(r)){e=[];for(let t=0,i=r.length;t<i;t++)r[t].isDataTexture?e.push(il(r[t].image)):e.push(il(r[t]))}else e=il(r);i.url=e}return t||(e.images[this.uuid]=i),i}};function il(e){return"u">typeof HTMLImageElement&&e instanceof HTMLImageElement||"u">typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"u">typeof ImageBitmap&&e instanceof ImageBitmap?ia.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 ih=0,ic=class extends tk{constructor(e=ic.DEFAULT_IMAGE,t=ic.DEFAULT_MAPPING,i=1001,r=1001,s=1006,a=1008,o=1023,h=1009,c=ic.DEFAULT_ANISOTROPY,d=3e3){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:ih++}),this.uuid=tj(),this.name="",this.source=new io(e),this.mipmaps=[],this.mapping=t,this.wrapS=i,this.wrapT=r,this.magFilter=s,this.minFilter=a,this.anisotropy=c,this.format=o,this.internalFormat=null,this.type=h,this.offset=new tZ(0,0),this.repeat=new tZ(1,1),this.center=new tZ(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new tK,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=d,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=void 0===e||"string"==typeof e;if(!t&&void 0!==e.textures[this.uuid])return e.textures[this.uuid];let i={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,type:this.t
2ype,encoding:this.encoding,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(i.userData=this.userData),t||(e.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(300!==this.mapping)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case 1e3:e.x=e.x-Math.floor(e.x);break;case 1001:e.x=e.x<0?0:1;break;case 1002:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case 1e3:e.y=e.y-Math.floor(e.y);break;case 1001:e.y=e.y<0?0:1;break;case 1002:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y)}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){!0===e&&(this.version++,this.source.needsUpdate=!0)}};ic.DEFAULT_IMAGE=null,ic.DEFAULT_MAPPING=300,ic.DEFAULT_ANISOTROPY=1;var id=class{constructor(e=0,t=0,i=0,r=1){id.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 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 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=void 0!==e.w?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,o=a[0],h=a[4],c=a[8],d=a[1],u=a[5],p=a[9],f=a[2],m=a[6],g=a[10];if(.01>Math.abs(h-d)&&.01>Math.abs(c-f)&&.01>Math.abs(p-m)){if(.1>Math.abs(h+d)&&.1>Math.abs(c+f)&&.1>Math.abs(p+m)&&.1>Math.abs(o+u+g-3))return this.set(1,0,0,0),this;t=Math.PI;let e=(o+1)/2,a=(u+1)/2,v=(g+1)/2,y=(h+d)/4,x=(c+f)/4,b=(p+m)/4;return e>a&&e>v?e<.01?(i=0,r=.707106781,s=.707106781):(r=y/(i=Math.sqrt(e)),s=x/i):a>v?a<.01?(i=.707106781,r=0,s=.707106781):(i=y/(r=Math.sqrt(a)),s=b/r):v<.01?(i=.707106781,r=.707106781,s=0):(i=x/(s=Math.sqrt(v)),r=b/s),this.set(i,r,s,t),this}let v=Math.sqrt((m-p)*(m-p)+(c-f)*(c-f)+(d-h)*(d-h));return .001>Math.abs(v)&&(v=1),this.x=(m-p)/v,this.y=(c-f)/v,this.z=(d-h)/v,this.w=Math.acos((o+u+g-1)/2),this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){let i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}
vendor: 7,726 bytes, line 2
2round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this.w=e.w+(t.w-e.w)*i,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}},iu=class extends tk{constructor(e=1,t=1,i={}){super(),this.isWebGLRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new id(0,0,e,t),this.scissorTest=!1,this.viewport=new id(0,0,e,t),this.texture=new ic({width:e,height:t,depth:1},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=void 0!==i.generateMipmaps&&i.generateMipmaps,this.texture.internalFormat=void 0!==i.internalFormat?i.internalFormat:null,this.texture.minFilter=void 0!==i.minFilter?i.minFilter:1006,this.depthBuffer=void 0===i.depthBuffer||i.depthBuffer,this.stencilBuffer=void 0!==i.stencilBuffer&&i.stencilBuffer,this.depthTexture=void 0!==i.depthTexture?i.depthTexture:null,this.samples=void 0!==i.samples?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 io(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,null!==e.depthTexture&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}},ip=class extends ic{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=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}},im=class extends ic{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=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}},ig=class extends iu{constructor(e=1,t=1,i=1,r={}){super(e,t,r),this.isWebGLMultipleRenderTargets=!0;let s=this.texture;this.texture=[];for(let e=0;e<i;e++)this.texture[e]=s.clone(),this.texture[e].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,null!==e.depthTexture&&(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}},iv=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,o){let h=i[r+0],c=i[r+1],d=i[r+2],u=i[r+3],p=s[a+0],f=s[a+1],m=s[a+2],g=s[a+3];if(0===o){e[t+0]=h,e[t+1]=c,e[t+2]=d,e[t+3]=u;return}if(1===o){e[t+0]=p,e[t+1]=f,e[t+2]=m,e[t+3]=g;return}if(u!==g||h!==p||c!==f||d!==m){let e=1-o,t=h*p+c*f+d*m+u*g,i=t>=0?1:-1,r=1-t*t;if(r>Number.EPSILON){let s=Math.sqrt(r),a=Math.atan2(s,t*i);e=Math.sin(e*a)/s,o=Math.sin(o*a)/s}let s=o*i;if(h=h*e+p*s,c=c*e+f*s,d=d*e+m*s,u=u*e+g*s,e===1-o){let e=1/Math.sqrt(h*h+c*c+d*d+u*u);h*=e,c*=e,d*=e,u*=e}}e[t]=h,e[t+1]=c,e[t+2]=d,e[t+3]=u}static multiplyQuaternionsFlat(e,t,i,r,s,a){let o=i[r],h=i[r+1],c=i[r+2],d=i[r+3],u=s[a],p=s[a+1],f=s[a+2],m=s[a+3];return e[t]=o*m+d*u+h*f-c*p,e[t+1]=h*m+d*p+c*u-o*f,e[t+2]=c*m+d*f+o*p-h*u,e[t+3]=d*m-o*u-h*p-c*f,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,o=Math.cos,h=Math.sin,c=o(i/2),d=o(r/2),u=o(s/2),p=h(i/2),f=h(r/2),m=h(s/2);switch(a){case"XYZ":this._x=p*d*u+c*f*m,this._y=c*f*u-p*d*m,this._z=c*d*m+p*f*u,this._w=c*d*u-p*f*m;break;case"YXZ":this._x=p*d*u+c*f*m,this._y=c*f*u-p*d*m,this._z=c*d*m-p*f*u,this._w=c*d*u+p*f*m;break;case"ZXY":this._x=p*d*u-c*f*m,this._y=c*f*u+p*d*m,this._z=c*d*m+p*f*u,this._w=c*d*u-p*f*m;break;case"ZYX":this._x=p*d*u-c*f*m,this._y=c*f*u+p*d*m,this._z=c*d*m-p*f*u,this._w=c*d*u+p*f*m;break;case"YZX":this._x=p*d*u+c*f*m,this._y=c*f*u+p*d*m,this._z=c*d*m-p*f*u,this._w=c*d*u-p*f*m;break;case"XZY":this._x=p*d*u-c*f*m,this._y=c*f*u-p*d*m,this._z=c*d*m+p*f*u,this._w=c*d*u+p*f*m;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return!1!==t&&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],o=t[5],h=t[9],c=t[2],d=t[6],u=t[10],p=i+o+u;if(p>0){let e=.5/Math.sqrt(p+1);this._w=.25/e,this._x=(d-h)*e,this._y=(s-c)*e,this._z=(a-r)*e}else if(i>o&&i>u){let e=2*Math.sqrt(1+i-o-u);this._w=(d-h)/e,this._x=.25*e,this._y=(r+a)/e,this._z=(s+c)/e}else if(o>u){let e=2*Math.sqrt(1+o-i-u);this._w=(s-c)/e,this._x=(r+a)/e,this._y=.25*e,this._z=(h+d)/e}else{let e=2*Math.sqrt(1+u-i-o);this._w=(a-r)/e,this._x=(s+c)/e,this._y=(h+d)/e,this._z=.25*e}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let i=e.dot(t)+1;return i<Number.EPSILON?(i=0,Math.abs(e.x)>
vendor: 12,050 bytes, line 2
2Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0):(this._x=0,this._y=-e.z,this._z=e.y)):(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(tU(this.dot(e),-1,1)))}rotateTowards(e,t){let i=this.angleTo(e);if(0===i)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 0===e?(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,o=t._x,h=t._y,c=t._z,d=t._w;return this._x=i*d+a*o+r*c-s*h,this._y=r*d+a*h+s*o-i*c,this._z=s*d+a*c+i*h-r*o,this._w=a*d-i*o-r*h-s*c,this._onChangeCallback(),this}slerp(e,t){if(0===t)return this;if(1===t)return this.copy(e);let i=this._x,r=this._y,s=this._z,a=this._w,o=a*e._w+i*e._x+r*e._y+s*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=a,this._x=i,this._y=r,this._z=s,this;let h=1-o*o;if(h<=Number.EPSILON){let e=1-t;return this._w=e*a+t*this._w,this._x=e*i+t*this._x,this._y=e*r+t*this._y,this._z=e*s+t*this._z,this.normalize(),this._onChangeCallback(),this}let c=Math.sqrt(h),d=Math.atan2(c,o),u=Math.sin((1-t)*d)/c,p=Math.sin(t*d)/c;return this._w=a*u+this._w*p,this._x=i*u+this._x*p,this._y=r*u+this._y*p,this._z=s*u+this._z*p,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}},iy=class{constructor(e=0,t=0,i=0){iy.prototype.isVector3=!0,this.x=e,this.y=t,this.z=i}set(e,t,i){return void 0===i&&(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 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 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(ib.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(ib.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}applyQuaternion(e){let t=this.x,i=this.y,r=this.z,s=e.x,a=e.y,o=e.z,h=e.w,c=h*t+a*r-o*i,d=h*i+o*t-s*r,u=h*r+s*i-a*t,p=-s*t-a*i-o*r;return this.x=c*h+-(p*s)+-(d*o)- -(u*a),this.y=d*h+-(p*a)+-(u*s)- -(c*o),this.z=u*h+-(p*o)+-(c*a)- -(d*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,o=t.y,h=t.z;return this.x=r*h-s*o,this.y=s*a-i*h,this.z=i*o-r*a,this}projectOnVector(e){let t=e.lengthSq();if(0===t)return this.set(0,0,0);let i=e.dot(this)/t;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return ix.copy(this).projectOnVector(e),this.sub(ix)}reflect(e){return this.sub(ix.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());return 0===t?Math.PI/2:Math.acos(tU(this.dot(e)/t,-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,4*t)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,3*t)}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}},ix=new iy,ib=new iv,iw=class{constructor(e=new iy(1/0,1/0,1/0),t=new iy(-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,o=-1/0;for(let h=0,c=e.length;h<c;h+=3){let c=e[h],d=e[h+1],u=e[h+2];c<t&&(t=c),d<i&&(i=d),u<r&&(r=u),c>s&&(s=c),d>a&&(a=d),u>o&&(o=u)}return this.min.set(t,i,r),this.max.set(s,a,o),this}setFromBufferAttribute(e){let t=1/0,i=1/0,r=1/0,s=-1/0,a=-1/0,o=-1/0;for(let h=0,c=e.count;h<c;h++){let c=e.getX(h),d=e.getY(h),u=e.getZ(h);c<t&&(t=c),d<i&&(i=d),u<r&&(r=u),c>s&&(s=c),d>a&&(a=d),u>o&&(o=u)}return this.min.set(t,i,r),this.max.set(s,a,o),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=iS.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(void 0!==i)if(t&&null!=i.attributes&&void 0!==i.attributes.position){let t=i.attributes.position;for(let i=0,r=t.count;i<r;i++)iS.fromBufferAttribute(t,i).applyMatrix4(e.matrixWorld),this.expandByPoint(iS)}else null===i.boundingBox&&i.computeBoundingBox(),iC.copy(i.boundingBox),iC.applyMatrix4(e.matrixWorld),this.union(iC);let r=e.children;for(let e=0,i=r.length;e<i;e++)this.expandByObject(r[e],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,iS),iS.distanceToSquared(e.center)<=e.radius*e.radiu
2s}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(iO),iL.subVectors(this.max,iO),iM.subVectors(e.a,iO),iE.subVectors(e.b,iO),iA.subVectors(e.c,iO),iT.subVectors(iE,iM),iP.subVectors(iA,iE),iD.subVectors(iM,iA);let t=[0,-iT.z,iT.y,0,-iP.z,iP.y,0,-iD.z,iD.y,iT.z,0,-iT.x,iP.z,0,-iP.x,iD.z,0,-iD.x,-iT.y,iT.x,0,-iP.y,iP.x,0,-iD.y,iD.x,0];return!!ik(t,iM,iE,iA,iL)&&!!ik(t=[1,0,0,0,1,0,0,0,1],iM,iE,iA,iL)&&(iI.crossVectors(iT,iP),ik(t=[iI.x,iI.y,iI.z],iM,iE,iA,iL))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return iS.copy(e).clamp(this.min,this.max).sub(e).length()}getBoundingSphere(e){return this.getCenter(e.center),e.radius=.5*this.getSize(iS).length(),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()||(i_[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),i_[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),i_[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),i_[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),i_[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),i_[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),i_[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),i_[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(i_)),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)}},i_=[new iy,new iy,new iy,new iy,new iy,new iy,new iy,new iy],iS=new iy,iC=new iw,iM=new iy,iE=new iy,iA=new iy,iT=new iy,iP=new iy,iD=new iy,iO=new iy,iL=new iy,iI=new iy,iR=new iy;function ik(e,t,i,r,s){for(let a=0,o=e.length-3;a<=o;a+=3){iR.fromArray(e,a);let o=s.x*Math.abs(iR.x)+s.y*Math.abs(iR.y)+s.z*Math.abs(iR.z),h=t.dot(iR),c=i.dot(iR),d=r.dot(iR);if(Math.max(-Math.max(h,c,d),Math.min(h,c,d))>o)return!1}return!0}var iB=new iw,iz=new iy,iN=new iy,iF=class{constructor(e=new iy,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;void 0!==t?i.copy(t):iB.setFromPoints(e).getCenter(i);let r=0;for(let t=0,s=e.length;t<s;t++)r=Math.max(r,i.distanceToSquared(e[t]));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.set(this.center,this.center),e.expandByScalar(this.radius)),e}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;iz.subVectors(e,this.center);let t=iz.lengthSq();if(t>this.radius*this.radius){let e=Math.sqrt(t),i=(e-this.radius)*.5;this.center.addScaledVector(iz,i/e),this.radius+=i}return this}union(e){return e.isEmpty()||(this.isEmpty()?this.copy(e):!0===this.center.equals(e.center)?this.radius=Math.max(this.radius,e.radius):(iN.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(iz.copy(e.center).add(iN)),this.expandByPoint(iz.copy(e.center).sub(iN)))),this}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}},ij=new iy,iU=new iy,iV=new iy,iW=new iy,iH=new iy,iG=new iy,iq=new iy,iX=class{constructor(e=new iy,t=new iy(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,ij)),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=ij.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(ij.copy(this.direction).multiplyScalar(t).add(this.origin),ij.distanceToSquared(e))}distanceSqToSegment(e,t,i,r){iU.copy(e).add(t).multiplyScalar(.5),iV.copy(t).sub(e).normalize(),iW.copy(this.origin).sub(iU);let s=.5*e.distanceTo(t),a=-this.direction.dot(iV),o=iW.dot(this.direction),h=-iW.dot(iV),c=iW.lengthSq(),d=Math.abs(1-a*a),u,p,f,m;if(d>0)if(u=a*h-o,p=a*o-h,m=s*d,u>=0)if(p>=-m)if(p<=m){let e=1/d;u*=e,p*=e,f=u*(u+a*p+2*o)+p*(a*u+p+2*h)+c}else f=-(u=Math.max(0,-(a*(p=s)+o)))*u+p*(p+2*h)+c;else f=-(u=Math.max(0,-(a*(p=-s)+o)))*u+p*(p+2*h)+c;else p<=-m?(p=(u=Math.max(0,-(-a*s+o)))>0?-s:Math.min(Math.max(-s,-h),s),f=-u*u+p*(p+2*h)+c):p<=m?(u=0,f=(p=Math.min(Math.max(-s,-h),s))*(p+2*h)+c):(p=(u=Math.max(0,-(a*s+o)))>0?s:Math.min(Math.max(-s,-h),s),f=-u*u+p*(p+2*h)+c);else p=a>0?-s:s,f=-(u=Math.max(0,-(a*p+o)))*u+p*(p+2*h)+c;
vendor: 4,217 bytes, line 2
2return i&&i.copy(this.direction).multiplyScalar(u).add(this.origin),r&&r.copy(iV).multiplyScalar(p).add(iU),f}intersectSphere(e,t){ij.subVectors(e.center,this.origin);let i=ij.dot(this.direction),r=ij.dot(ij)-i*i,s=e.radius*e.radius;if(r>s)return null;let a=Math.sqrt(s-r),o=i-a,h=i+a;return o<0&&h<0?null:o<0?this.at(h,t):this.at(o,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?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 null===i?null:this.at(i,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);return 0===t||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let i,r,s,a,o,h,c=1/this.direction.x,d=1/this.direction.y,u=1/this.direction.z,p=this.origin;return c>=0?(i=(e.min.x-p.x)*c,r=(e.max.x-p.x)*c):(i=(e.max.x-p.x)*c,r=(e.min.x-p.x)*c),d>=0?(s=(e.min.y-p.y)*d,a=(e.max.y-p.y)*d):(s=(e.max.y-p.y)*d,a=(e.min.y-p.y)*d),i>a||s>r||((s>i||isNaN(i))&&(i=s),(a<r||isNaN(r))&&(r=a),u>=0?(o=(e.min.z-p.z)*u,h=(e.max.z-p.z)*u):(o=(e.max.z-p.z)*u,h=(e.min.z-p.z)*u),i>h||o>r)||((o>i||i!=i)&&(i=o),(h<r||r!=r)&&(r=h),r<0)?null:this.at(i>=0?i:r,t)}intersectsBox(e){return null!==this.intersectBox(e,ij)}intersectTriangle(e,t,i,r,s){iH.subVectors(t,e),iG.subVectors(i,e),iq.crossVectors(iH,iG);let a=this.direction.dot(iq),o;if(a>0){if(r)return null;o=1}else{if(!(a<0))return null;o=-1,a=-a}iW.subVectors(this.origin,e);let h=o*this.direction.dot(iG.crossVectors(iW,iG));if(h<0)return null;let c=o*this.direction.dot(iH.cross(iW));if(c<0||h+c>a)return null;let d=-o*iW.dot(iq);return d<0?null:this.at(d/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)}},iY=class{constructor(){iY.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,o,h,c,d,u,p,f,m,g,v){let y=this.elements;return y[0]=e,y[4]=t,y[8]=i,y[12]=r,y[1]=s,y[5]=a,y[9]=o,y[13]=h,y[2]=c,y[6]=d,y[10]=u,y[14]=p,y[3]=f,y[7]=m,y[11]=g,y[15]=v,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 iY().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/iQ.setFromMatrixColumn(e,0).length(),s=1/iQ.setFromMatrixColumn(e,1).length(),a=1/iQ.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),o=Math.sin(i),h=Math.cos(r),c=Math.sin(r),d=Math.cos(s),u=Math.sin(s);if("XYZ"===e.order){let e=a*d,i=a*u,r=o*d,s=o*u;t[0]=h*d,t[4]=-h*u,t[8]=c,t[1]=i+r*c,t[5]=e-s*c,t[9]=-o*h,t[2]=s-e*c,t[6]=r+i*c,t[10]=a*h}else if("YXZ"===e.order){let e=h*d,i=h*u,r=c*d,s=c*u;t[0]=e+s*o,t[4]=r*o-i,t[8]=a*c,t[1]=a*u,t[5]=a*d,t[9]=-o,t[2]=i*o-r,t[6]=s+e*o,t[10]=a*h}else if("ZXY"===e.order){let e=h*d,i=h*u,r=c*d,s=c*u;t[0]=e-s*o,t[4]=-a*u,t[8]=r+i*o,t[1]=i+r*o,t[5]=a*d,t[9]=s-e*o,t[2]=-a*c,t[6]=o,t[10]=a*h}else if("ZYX"===e.order){let e=a*d,i=a*u,r=o*d,s=o*u;t[0]=h*d,t[4]=r*c-i,t[8]=e*c+s,t[1]=h*u,t[5]=s*c+e,t[9]=i*c-r,t[2]=-c,t[6]=o*h,t[10]=a*h}else if("YZX"===e.order){let e=a*h,i=a*c,r=o*h,s=o*c;t[0]=h*d,t[4]=s-e*u,t[8]=r*u+i,t[1]=u,t[5]=a*d,t[9]=-o*d,t[2]=-c*d,t[6]=i*u+r,t[10]=e-s*u}
vendor: 5,221 bytes, line 2
2else if("XZY"===e.order){let e=a*h,i=a*c,r=o*h,s=o*c;t[0]=h*d,t[4]=-u,t[8]=c*d,t[1]=e*u+s,t[5]=a*d,t[9]=i*u-r,t[2]=r*u-i,t[6]=o*d,t[10]=s*u+e}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(iK,e,iJ)}lookAt(e,t,i){let r=this.elements;return i1.subVectors(e,t),0===i1.lengthSq()&&(i1.z=1),i1.normalize(),i$.crossVectors(i,i1),0===i$.lengthSq()&&(1===Math.abs(i.z)?i1.x+=1e-4:i1.z+=1e-4,i1.normalize(),i$.crossVectors(i,i1)),i$.normalize(),i0.crossVectors(i1,i$),r[0]=i$.x,r[4]=i0.x,r[8]=i1.x,r[1]=i$.y,r[5]=i0.y,r[9]=i1.y,r[2]=i$.z,r[6]=i0.z,r[10]=i1.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],o=i[4],h=i[8],c=i[12],d=i[1],u=i[5],p=i[9],f=i[13],m=i[2],g=i[6],v=i[10],y=i[14],x=i[3],b=i[7],w=i[11],_=i[15],S=r[0],C=r[4],M=r[8],E=r[12],A=r[1],T=r[5],P=r[9],D=r[13],O=r[2],L=r[6],I=r[10],R=r[14],k=r[3],B=r[7],z=r[11],N=r[15];return s[0]=a*S+o*A+h*O+c*k,s[4]=a*C+o*T+h*L+c*B,s[8]=a*M+o*P+h*I+c*z,s[12]=a*E+o*D+h*R+c*N,s[1]=d*S+u*A+p*O+f*k,s[5]=d*C+u*T+p*L+f*B,s[9]=d*M+u*P+p*I+f*z,s[13]=d*E+u*D+p*R+f*N,s[2]=m*S+g*A+v*O+y*k,s[6]=m*C+g*T+v*L+y*B,s[10]=m*M+g*P+v*I+y*z,s[14]=m*E+g*D+v*R+y*N,s[3]=x*S+b*A+w*O+_*k,s[7]=x*C+b*T+w*L+_*B,s[11]=x*M+b*P+w*I+_*z,s[15]=x*E+b*D+w*R+_*N,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],o=e[5],h=e[9],c=e[13],d=e[2],u=e[6],p=e[10],f=e[14];return e[3]*(s*h*u-r*c*u-s*o*p+i*c*p+r*o*f-i*h*f)+e[7]*(t*h*f-t*c*p+s*a*p-r*a*f+r*c*d-s*h*d)+e[11]*(t*c*u-t*o*f-s*a*u+i*a*f+s*o*d-i*c*d)+e[15]*(-r*o*d-t*h*u+t*o*p+r*a*u-i*a*p+i*h*d)}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],o=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],f=e[11],m=e[12],g=e[13],v=e[14],y=e[15],x=u*v*c-g*p*c+g*h*f-o*v*f-u*h*y+o*p*y,b=m*p*c-d*v*c-m*h*f+a*v*f+d*h*y-a*p*y,w=d*g*c-m*u*c+m*o*f-a*g*f-d*o*y+a*u*y,_=m*u*h-d*g*h-m*o*p+a*g*p+d*o*v-a*u*v,S=t*x+i*b+r*w+s*_;if(0===S)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let C=1/S;return e[0]=x*C,e[1]=(g*p*s-u*v*s-g*r*f+i*v*f+u*r*y-i*p*y)*C,e[2]=(o*v*s-g*h*s+g*r*c-i*v*c-o*r*y+i*h*y)*C,e[3]=(u*h*s-o*p*s-u*r*c+i*p*c+o*r*f-i*h*f)*C,e[4]=b*C,e[5]=(d*v*s-m*p*s+m*r*f-t*v*f-d*r*y+t*p*y)*C,e[6]=(m*h*s-a*v*s-m*r*c+t*v*c+a*r*y-t*h*y)*C,e[7]=(a*p*s-d*h*s+d*r*c-t*p*c-a*r*f+t*h*f)*C,e[8]=w*C,e[9]=(m*u*s-d*g*s-m*i*f+t*g*f+d*i*y-t*u*y)*C,e[10]=(a*g*s-m*o*s+m*i*c-t*g*c-a*i*y+t*o*y)*C,e[11]=(d*o*s-a*u*s-d*i*c+t*u*c+a*i*f-t*o*f)*C,e[12]=_*C,e[13]=(d*g*r-m*u*r+m*i*p-t*g*p-d*i*v+t*u*v)*C,e[14]=(m*o*r-a*g*r-m*i*h+t*g*h+a*i*v-t*o*v)*C,e[15]=(a*u*r-d*o*r+d*i*h-t*u*h-a*i*p+t*o*p)*C,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;return Math.sqrt(Math.max(e[0]*e[0]+e[1]*e[1]+e[2]*e[2],e[4]*e[4]+e[5]*e[5]+e[6]*e[6],e[8]*e[8]+e[9]*e[9]+e[10]*e[10]))}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,o=e.y,h=e.z,c=s*a,d=s*o;return this.set(c*a+i,c*o-r*h,c*h+r*o,0,c*o+r*h,d*o+i,d*h-r*a,0,c*h-r*o,d*h+r*a,s*h*h+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,o=t._z,h=t._w,c=s+s,d=a+a,u=o+o,p=s*c,f=s*d,m=s*u,g=a*d,v=a*u,y=o*u,x=h*c,b=h*d,w=h*u,_=i.x,S=i.y,C=i.z;return r[0]=(1-(g+y))*_,r[1]=(f+w)*_,r[2]=(m-b)*_,r[3]=0,r[4]=(f-w)*S,r[5]=(1-(p+y))*S,r[6]=(v+x)*S,r[7]=0,r[8]=(m+b)*C,r[9]=(v-x)*C,r[10]=(1-(p+g))*C,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=iQ.set(r[0],r[1],r[2]).length(),a=iQ.set(r[4],r[5],r[6]).length(),o=iQ.set(r[8],r[9],r[10]).length();0>this.determinant()&&(s=-s),e.x=r[12],e.y=r[13],e.z=r[14],iZ.copy(this);let h=1/s,c=1/a,d=1/o;return iZ.elements[0]*=h,iZ.elements[1]*=h,iZ.elements[2]*=h,iZ.elements[4]*=c,iZ.elements[5]*=c,iZ.elements[6]*=c,iZ.elements[8]*=d,iZ.elements[9]*=d,iZ.elements[10]*=d,t.setFromRotationMatrix(iZ),i.x=s,i.y=a,i.z=o,this}makePerspective(e,t,i,r,s,a){let o=this.elements;return o[0]=2*s/(t-e),o[4]=0,o[8]=(t+e)/(t-e),o[12]=0,o[1]=0,o[5]=2*s/(i-r),o[9]=(i+r)/(i-r),o[13]=0,o[2]=0,o[6]=0,o[10]=-(a+s)/(a-s),o[14]=-2*a
vendor: 5,235 bytes, line 2
2*s/(a-s),o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this}makeOrthographic(e,t,i,r,s,a){let o=this.elements,h=1/(t-e),c=1/(i-r),d=1/(a-s);return o[0]=2*h,o[4]=0,o[8]=0,o[12]=-((t+e)*h),o[1]=0,o[5]=2*c,o[9]=0,o[13]=-((i+r)*c),o[2]=0,o[6]=0,o[10]=-2*d,o[14]=-((a+s)*d),o[3]=0,o[7]=0,o[11]=0,o[15]=1,this}equals(e){let t=this.elements,i=e.elements;for(let e=0;e<16;e++)if(t[e]!==i[e])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}},iQ=new iy,iZ=new iY,iK=new iy(0,0,0),iJ=new iy(1,1,1),i$=new iy,i0=new iy,i1=new iy,i2=new iY,i3=new iv,i4=class{constructor(e=0,t=0,i=0,r=i4.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],o=r[8],h=r[1],c=r[5],d=r[9],u=r[2],p=r[6],f=r[10];switch(t){case"XYZ":this._y=Math.asin(tU(o,-1,1)),.9999999>Math.abs(o)?(this._x=Math.atan2(-d,f),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(p,c),this._z=0);break;case"YXZ":this._x=Math.asin(-tU(d,-1,1)),.9999999>Math.abs(d)?(this._y=Math.atan2(o,f),this._z=Math.atan2(h,c)):(this._y=Math.atan2(-u,s),this._z=0);break;case"ZXY":this._x=Math.asin(tU(p,-1,1)),.9999999>Math.abs(p)?(this._y=Math.atan2(-u,f),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(h,s));break;case"ZYX":this._y=Math.asin(-tU(u,-1,1)),.9999999>Math.abs(u)?(this._x=Math.atan2(p,f),this._z=Math.atan2(h,s)):(this._x=0,this._z=Math.atan2(-a,c));break;case"YZX":this._z=Math.asin(tU(h,-1,1)),.9999999>Math.abs(h)?(this._x=Math.atan2(-d,c),this._y=Math.atan2(-u,s)):(this._x=0,this._y=Math.atan2(o,f));break;case"XZY":this._z=Math.asin(-tU(a,-1,1)),.9999999>Math.abs(a)?(this._x=Math.atan2(p,c),this._y=Math.atan2(o,s)):(this._x=Math.atan2(-d,f),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,!0===i&&this._onChangeCallback(),this}setFromQuaternion(e,t,i){return i2.makeRotationFromQuaternion(e),this.setFromRotationMatrix(i2,t,i)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return i3.setFromEuler(this),this.setFromQuaternion(i3,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],void 0!==e[3]&&(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}};i4.DEFAULT_ORDER="XYZ";var i5=class{constructor(){this.mask=1}set(e){this.mask=1<<e>>>0}enable(e){this.mask|=1<<e}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e}disable(e){this.mask&=~(1<<e)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!=0}isEnabled(e){return(this.mask&1<<e)!=0}},i6=0,i8=new iy,i9=new iv,i7=new iY,re=new iy,rt=new iy,ri=new iy,rr=new iv,rs=new iy(1,0,0),ra=new iy(0,1,0),rn=new iy(0,0,1),ro={type:"added"},rl={type:"removed"},rh=class extends tk{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:i6++}),this.uuid=tj(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=rh.DEFAULT_UP.clone();let e=new iy,t=new i4,i=new iv,r=new iy(1,1,1);t._onChange(function(){i.setFromEuler(t,!1)}),i._onChange(function(){t.setFromQuaternion(i,void 0,!1)}),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 iY},normalMatrix:{value:new tK}}),this.matrix=new iY,this.matrixWorld=new iY,this.matrixAutoUpdate=rh.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.matrixWorldAutoUpdate=rh.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.layers=new i5,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)}
2setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return i9.setFromAxisAngle(e,t),this.quaternion.multiply(i9),this}rotateOnWorldAxis(e,t){return i9.setFromAxisAngle(e,t),this.quaternion.premultiply(i9),this}rotateX(e){return this.rotateOnAxis(rs,e)}rotateY(e){return this.rotateOnAxis(ra,e)}rotateZ(e){return this.rotateOnAxis(rn,e)}translateOnAxis(e,t){return i8.copy(e).applyQuaternion(this.quaternion),this.position.add(i8.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(rs,e)}translateY(e){return this.translateOnAxis(ra,e)}translateZ(e){return this.translateOnAxis(rn,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(i7.copy(this.matrixWorld).invert())}lookAt(e,t,i){e.isVector3?re.copy(e):re.set(e,t,i);let r=this.parent;this.updateWorldMatrix(!0,!1),rt.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?i7.lookAt(rt,re,this.up):i7.lookAt(re,rt,this.up),this.quaternion.setFromRotationMatrix(i7),r&&(i7.extractRotation(r.matrixWorld),i9.setFromRotationMatrix(i7),this.quaternion.premultiply(i9.invert()))}add(e){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return e===this?console.error("THREE.Object3D.add: object can't be added as a child of itself.",e):e&&e.isObject3D?(null!==e.parent&&e.parent.remove(e),e.parent=this,this.children.push(e),e.dispatchEvent(ro)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this}remove(e){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.remove(arguments[e]);return this}let t=this.children.indexOf(e);return -1!==t&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(rl)),this}removeFromParent(){let e=this.parent;return null!==e&&e.remove(this),this}clear(){for(let e=0;e<this.children.length;e++){let t=this.children[e];t.parent=null,t.dispatchEvent(rl)}return this.children.length=0,this}attach(e){return this.updateWorldMatrix(!0,!1),i7.copy(this.matrixWorld).invert(),null!==e.parent&&(e.parent.updateWorldMatrix(!0,!1),i7.multiply(e.parent.matrixWorld)),e.applyMatrix4(i7),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 r=this.children[i].getObjectByProperty(e,t);if(void 0!==r)return r}}getObjectsByProperty(e,t){let i=[];this[e]===t&&i.push(this);for(let r=0,s=this.children.length;r<s;r++){let s=this.children[r].getObjectsByProperty(e,t);s.length>0&&(i=i.concat(s))}return i}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(rt,e,ri),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(rt,rr,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(!1===this.visible)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;null!==t&&(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)&&(null===this.parent?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 r=t[i];(!0===r.matrixWorldAutoUpdate||!0===e)&&r.updateMatrixWorld(e)}}updateWorldMatrix(e,t){let i=this.parent;if(!0===e&&null!==i&&!0===i.matrixWorldAutoUpdate&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),null===this.parent?this.matrixWorld.copy(this.matrix
vendor: 4,260 bytes, line 2
2):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),!0===t){let e=this.children;for(let t=0,i=e.length;t<i;t++){let i=e[t];!0===i.matrixWorldAutoUpdate&&i.updateWorldMatrix(!1,!0)}}}toJSON(e){let t=void 0===e||"string"==typeof e,i={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},i.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});let r={};function s(t,i){return void 0===t[i.uuid]&&(t[i.uuid]=i.toJSON(e)),i.uuid}if(r.uuid=this.uuid,r.type=this.type,""!==this.name&&(r.name=this.name),!0===this.castShadow&&(r.castShadow=!0),!0===this.receiveShadow&&(r.receiveShadow=!0),!1===this.visible&&(r.visible=!1),!1===this.frustumCulled&&(r.frustumCulled=!1),0!==this.renderOrder&&(r.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),!1===this.matrixAutoUpdate&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(r.instanceColor=this.instanceColor.toJSON())),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&&!0!==this.environment.isRenderTargetTexture&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=s(e.geometries,this.geometry);let t=this.geometry.parameters;if(void 0!==t&&void 0!==t.shapes){let i=t.shapes;if(Array.isArray(i))for(let t=0,r=i.length;t<r;t++){let r=i[t];s(e.shapes,r)}else s(e.shapes,i)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(s(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){let t=[];for(let i=0,r=this.material.length;i<r;i++)t.push(s(e.materials,this.material[i]));r.material=t}else r.material=s(e.materials,this.material);if(this.children.length>0){r.children=[];for(let t=0;t<this.children.length;t++)r.children.push(this.children[t].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let t=0;t<this.animations.length;t++){let i=this.animations[t];r.animations.push(s(e.animations,i))}}if(t){let t=a(e.geometries),r=a(e.materials),s=a(e.textures),o=a(e.images),h=a(e.shapes),c=a(e.skeletons),d=a(e.animations),u=a(e.nodes);t.length>0&&(i.geometries=t),r.length>0&&(i.materials=r),s.length>0&&(i.textures=s),o.length>0&&(i.images=o),h.length>0&&(i.shapes=h),c.length>0&&(i.skeletons=c),d.length>0&&(i.animations=d),u.length>0&&(i.nodes=u)}return i.object=r,i;function a(e){let t=[];for(let i in e){let r=e[i];delete r.metadata,t.push(r)}return t}}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)),!0===t)for(let t=0;t<e.children.length;t++){let i=e.children[t];this.add(i.clone())}return this}};rh.DEFAULT_UP=new iy(0,1,0),rh.DEFAULT_MATRIX_AUTO_UPDATE=!0,rh.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;var rc=new iy,rd=new iy,ru=new iy,rp=new iy,rf=new iy,rm=new iy,rg=new iy,rv=new iy,ry=new iy,rx=new iy,rb=class{constructor(e=new iy,t=new iy,i=new iy){this.a=e,this.b=t,this.c=i}static getNormal(e,t,i,r){r.subVectors(i,t),rc.subVectors(e,t),r.cross(rc);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){rc.subVectors(r,t),rd.subVectors(i,t),ru.subVectors(e,t);let a=rc.dot(rc),o=rc.dot(rd),h=rc.dot(ru),c=rd.dot(rd),d=rd.dot(ru),u=a*c-o*o;if(0===u)return s.set(-2,-1,-1);
vendor: 15,995 bytes, line 2
2let p=1/u,f=(c*h-o*d)*p,m=(a*d-o*h)*p;return s.set(1-f-m,m,f)}static containsPoint(e,t,i,r){return this.getBarycoord(e,t,i,r,rp),rp.x>=0&&rp.y>=0&&rp.x+rp.y<=1}static getUV(e,t,i,r,s,a,o,h){return this.getBarycoord(e,t,i,r,rp),h.set(0,0),h.addScaledVector(s,rp.x),h.addScaledVector(a,rp.y),h.addScaledVector(o,rp.z),h}static isFrontFacing(e,t,i,r){return rc.subVectors(i,t),rd.subVectors(e,t),0>rc.cross(rd).dot(r)}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 rc.subVectors(this.c,this.b),rd.subVectors(this.a,this.b),.5*rc.cross(rd).length()}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return rb.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return rb.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,i,r,s){return rb.getUV(e,this.a,this.b,this.c,t,i,r,s)}containsPoint(e){return rb.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return rb.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,o;rf.subVectors(r,i),rm.subVectors(s,i),rv.subVectors(e,i);let h=rf.dot(rv),c=rm.dot(rv);if(h<=0&&c<=0)return t.copy(i);ry.subVectors(e,r);let d=rf.dot(ry),u=rm.dot(ry);if(d>=0&&u<=d)return t.copy(r);let p=h*u-d*c;if(p<=0&&h>=0&&d<=0)return a=h/(h-d),t.copy(i).addScaledVector(rf,a);rx.subVectors(e,s);let f=rf.dot(rx),m=rm.dot(rx);if(m>=0&&f<=m)return t.copy(s);let g=f*c-h*m;if(g<=0&&c>=0&&m<=0)return o=c/(c-m),t.copy(i).addScaledVector(rm,o);let v=d*m-f*u;if(v<=0&&u-d>=0&&f-m>=0)return rg.subVectors(s,r),o=(u-d)/(u-d+(f-m)),t.copy(r).addScaledVector(rg,o);let y=1/(v+g+p);return a=g*y,o=p*y,t.copy(i).addScaledVector(rf,a).addScaledVector(rm,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}},rw=0,r_=class extends tk{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:rw++}),this.uuid=tj(),this.name="",this.type="Material",this.blending=1,this.side=0,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=100,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=7680,this.stencilZFail=7680,this.stencilZPass=7680,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(void 0!==e)for(let t in e){let i=e[t];if(void 0===i){console.warn("THREE.Material: '"+t+"' parameter is undefined.");continue}let r=this[t];if(void 0===r){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=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{}});let i={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};function r(e){let t=[];for(let i in e){let r=e[i];delete r.metadata,t.push(r)}return t}if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),void 0!==this.roughness&&(i.roughness=this.roughness),void 0!==this.metalness&&(i.metalness=this.metalness),void 0!==this.sheen&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity&&1!==this.emissiveIntensity&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(i.shininess=this.shininess),void 0!==this.clearcoat&&(i.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(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()),void 0!==this.iridescence&&(i.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(i.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(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,void 0!==this.combine&&(i.combine=this.combine)),void 0!==this.envMapIntensity&&(i.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(i.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(e).uuid),void 0!==this.transmission&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(e).uuid),void 0!==this.thickness&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(e).uuid),void 0!==this.attenuationDistance&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(i.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(i.size=this.size),null!==this.shadowSide&&(i.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(i.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(i.blending=this.blending),0!==this.side&&(i.side=this.side),this.vertexColors&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),!0===this.transparent&&(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,void 0!==this.rotation&&0!==this.rotation&&(i.rotation=this.rotation),!0===this.polygonOffset&&(i.polygonOffset=!0),0!==this.polygonOffsetFactor&&(i.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(i.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(i.linewidth=this.linewidth),void 0!==this.dashSize&&(i.dashSize=this.dashSize),void 0!==this.gapSize&&(i.gapSize=this.gapSize),void 0!==this.scale&&(i.scale=this.scale),!0===this.dithering&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),!0===this.alphaToCoverage&&(i.alphaToCoverage=this.alphaToCoverage),!0===this.premultipliedAlpha&&(i.premultipliedAlpha=this.premultipliedAlpha),!0===this.forceSinglePass&&(i.forceSinglePass=this.forceSinglePass),!0===this.wireframe&&(i.wireframe=this.wireframe),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(i.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(i.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(i.flatShading=this.flatShading),!1===this.visible&&(i.visible=!1),!1===this.toneMapped&&(i.toneMapped=!1),!1===this.fog&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData),t){let t=r(e.textures),s=r(e.images);t.length>0&&(i.textures=t),s.length>0&&(i.images=s)}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(null!==t){let e=t.length;i=Array(e);for(let r=0;r!==e;++r)i[r]=t[r].clone()}return this.clippingPlanes=i,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){!0===e&&this.version++}},rS=class extends r_{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new ir(0xffffff),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=0,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}},rC=new iy,rM=new tZ,rE=class{constructor(e,t,i=!1){if(Array.isArray(e))throw TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=void 0!==e?e.length/t:0,this.normalized=i,this.usage=35044,this.updateRange={offset:0,count:-1},this.version=0}onUploadCallback(){}set needsUpdate(e){!0===e&&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(2===this.itemSize)for(let t=0,i=this.count;t<i;t++)rM.fromBufferAttribute(this,t),rM.applyMatrix3(e),this.setXY(t,rM.x,rM.y);else if(3===this.itemSize)for(let t=0,i=this.count;t<i;t++)rC.fromBufferAttribute(this,t),rC.applyMatrix3(e),this.setXYZ(t,rC.x,rC.y,rC.z);return this}applyMatrix4(e){for(let t=0,i=this.count;t<i;t++)rC.fromBufferAttribute(this,t),rC.applyMatrix4(e),this.setXYZ(t,rC.x,rC.y,rC.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)rC.fromBufferAttribute(this,t),rC.applyNormalMatrix(e),this.setXYZ(t,rC.x,rC.y,rC.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)rC.fromBufferAttribute(this,t),rC.transformDirection(e),this.setXYZ(t,rC.x,rC.y,rC.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=tX(t,this.array)),t}setX(e,t){return this.normalized&&(t=tY(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=tX(t,this.array)),t}setY(e,t){return this.normalized&&(t=tY(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=tX(t,this.array)),t}setZ(e,t){return this.normalized&&(t=tY(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=tX(t,this.array)),t}setW(e,t){return this.normalized&&(t=tY(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,i){return e*=this.itemSize,this.normalized&&(t=tY(t,this.array),i=tY(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=tY(t,this.array),i=tY(i,this.array),r=tY(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=tY(t,this.array),i=tY(i,this.array),r=tY(r,this.array),s=tY(s,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=r,this.array[e+3]=s,this}
2onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return""!==this.name&&(e.name=this.name),35044!==this.usage&&(e.usage=this.usage),(0!==this.updateRange.offset||-1!==this.updateRange.count)&&(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.")}},rA=class extends rE{constructor(e,t,i){super(new Uint16Array(e),t,i)}},rT=class extends rE{constructor(e,t,i){super(new Uint32Array(e),t,i)}},rP=class extends rE{constructor(e,t,i){super(new Float32Array(e),t,i)}},rD=0,rO=new iY,rL=new rh,rI=new iy,rR=new iw,rk=new iw,rB=new iy,rz=class extends tk{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:rD++}),this.uuid=tj(),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(t$(e)?rT:rA)(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 void 0!==this.attributes[e]}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;void 0!==t&&(t.applyMatrix4(e),t.needsUpdate=!0);let i=this.attributes.normal;if(void 0!==i){let t=new tK().getNormalMatrix(e);i.applyNormalMatrix(t),i.needsUpdate=!0}let r=this.attributes.tangent;return void 0!==r&&(r.transformDirection(e),r.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}applyQuaternion(e){return rO.makeRotationFromQuaternion(e),this.applyMatrix4(rO),this}rotateX(e){return rO.makeRotationX(e),this.applyMatrix4(rO),this}rotateY(e){return rO.makeRotationY(e),this.applyMatrix4(rO),this}rotateZ(e){return rO.makeRotationZ(e),this.applyMatrix4(rO),this}translate(e,t,i){return rO.makeTranslation(e,t,i),this.applyMatrix4(rO),this}scale(e,t,i){return rO.makeScale(e,t,i),this.applyMatrix4(rO),this}lookAt(e){return rL.lookAt(e),rL.updateMatrix(),this.applyMatrix4(rL.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(rI).negate(),this.translate(rI.x,rI.y,rI.z),this}setFromPoints(e){let t=[];for(let i=0,r=e.length;i<r;i++){let r=e[i];t.push(r.x,r.y,r.z||0)}return this.setAttribute("position",new rP(t,3)),this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new iw);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error('THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "fal
2se".',this),this.boundingBox.set(new iy(-1/0,-1/0,-1/0),new iy(1/0,1/0,1/0));return}if(void 0!==e){if(this.boundingBox.setFromBufferAttribute(e),t)for(let e=0,i=t.length;e<i;e++){let i=t[e];rR.setFromBufferAttribute(i),this.morphTargetsRelative?(rB.addVectors(this.boundingBox.min,rR.min),this.boundingBox.expandByPoint(rB),rB.addVectors(this.boundingBox.max,rR.max),this.boundingBox.expandByPoint(rB)):(this.boundingBox.expandByPoint(rR.min),this.boundingBox.expandByPoint(rR.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(){null===this.boundingSphere&&(this.boundingSphere=new iF);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error('THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "fal
2se".',this),this.boundingSphere.set(new iy,1/0);return}if(e){let i=this.boundingSphere.center;if(rR.setFromBufferAttribute(e),t)for(let e=0,i=t.length;e<i;e++){let i=t[e];rk.setFromBufferAttribute(i),this.morphTargetsRelative?(rB.addVectors(rR.min,rk.min),rR.expandByPoint(rB),rB.addVectors(rR.max,rk.max),rR.expandByPoint(rB)):(rR.expandByPoint(rk.min),rR.expandByPoint(rk.max))}rR.getCenter(i);let r=0;for(let t=0,s=e.count;t<s;t++)rB.fromBufferAttribute(e,t),r=Math.max(r,i.distanceToSquared(rB));if(t)for(let s=0,a=t.length;s<a;s++){let a=t[s],o=this.morphTargetsRelative;for(let t=0,s=a.count;t<s;t++)rB.fromBufferAttribute(a,t),o&&(rI.fromBufferAttribute(e,t),rB.add(rI)),r=Math.max(r,i.distanceToSquared(rB))}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(null===e||void 0===t.position||void 0===t.normal||void 0===t.uv)return void console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");let i=e.array,r=t.position.array,s=t.normal.array,a=t.uv.array,o=r.length/3;!1===this.hasAttribute("tangent")&&this.setAttribute("tangent",new rE(new Float32Array(4*o),4));let h=this.getAttribute("tangent").array,c=[],d=[];for(let e=0;e<o;e++)c[e]=new iy,d[e]=new iy;let u=new iy,p=new iy,f=new iy,m=new tZ,g=new tZ,v=new tZ,y=new iy,x=new iy,b=this.groups;0===b.length&&(b=[{start:0,count:i.length}]);for(let e=0,t=b.length;e<t;++e){let t=b[e],s=t.start,o=t.count;for(let e=s,t=s+o;e<t;e+=3)!function(e,t,i){u.fromArray(r,3*e),p.fromArray(r,3*t),f.fromArray(r,3*i),m.fromArray(a,2*e),g.fromArray(a,2*t),v.fromArray(a,2*i),p.sub(u),f.sub(u),g.sub(m),v.sub(m);let s=1/(g.x*v.y-v.x*g.y);isFinite(s)&&(y.copy(p).multiplyScalar(v.y).addScaledVector(f,-g.y).multiplyScalar(s),x.copy(f).multiplyScalar(g.x).addScaledVector(p,-v.x).multiplyScalar(s),c[e].add(y),c[t].add(y),c[i].add(y),d[e].add(x),d[t].add(x),d[i].add(x))}(i[e+0],i[e+1],i[e+2])}let w=new iy,_=new iy,S=new iy,C=new iy;function M(e){S.fromArray(s,3*e),C.copy(S);let t=c[e];w.copy(t),w.sub(S.multiplyScalar(S.dot(t))).normalize(),_.crossVectors(C,t);let i=0>_.dot(d[e])?-1:1;h[4*e]=w.x,h[4*e+1]=w.y,h[4*e+2]=w.z,h[4*e+3]=i}for(let e=0,t=b.length;e<t;++e){let t=b[e],r=t.start,s=t.count;for(let e=r,t=r+s;e<t;e+=3)M(i[e+0]),M(i[e+1]),M(i[e+2])}}computeVertexNormals(){let e=this.index,t=this.getAttribute("position");if(void 0!==t){let i=this.getAttribute("normal");if(void 0===i)i=new rE(new Float32Array(3*t.count),3),this.setAttribute("normal",i);else for(let e=0,t=i.count;e<t;e++)i.setXYZ(e,0,0,0);let r=new iy,s=new iy,a=new iy,o=new iy,h=new iy,c=new iy,d=new iy,u=new iy;if(e)for(let p=0,f=e.count;p<f;p+=3){let f=e.getX(p+0),m=e.getX(p+1),g=e.getX(p+2);r.fromBufferAttribute(t,f),s.fromBufferAttribute(t,m),a.fromBufferAttribute(t,g),d.subVectors(a,s),u.subVectors(r,s),d.cross(u),o.fromBufferAttribute(i,f),h.fromBufferAttribute(i,m),c.fromBufferAttribute(i,g),o.add(d),h.add(d),c.add(d),i.setXYZ(f,o.x,o.y,o.z),i.setXYZ(m,h.x,h.y,h.z),i.setXYZ(g,c.x,c.y,c.z)}else for(let e=0,o=t.count;e<o;e+=3)r.fromBufferAttribute(t,e+0),s.fromBufferAttribute(t,e+1),a.fromBufferAttribute(t,e+2),d.subVectors(a,s),u.subVectors(r,s),d.cross(u),i.setXYZ(e+0,d.x,d.y,d.z),i.setXYZ(e+1,d.x,d.y,d.z),i.setXYZ(e+2,d.x,d.y,d.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++)rB.fromBufferAttribute(e,t),rB.normalize(),e.setXYZ(t,rB.x,rB.y,rB.z)}toNonIndexed(){function e(e,t){let i=e.array,r=e.itemSize,s=e.normalized,a=new i.constructor(t.length*r),o=0,h=0;for(let s=0,c=t.length;s<c;s++){o=e.isInterleavedBufferAttribute?t[s]*e.data.stride+e.offset:t[s]*r;for(let e=0;e<r;e++)a[h++]=i[o++]}return new rE(a,r,s)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let t=new rz,i=this.index.array,r=this.attributes;for(let s in r){let a=e(r[s],i);t.setAttribute(s,a)}let s=this.morphAttributes;for(let r in s){let a=[],o=s[r];for(let t=0,r=o.length;t<r;t++){let r=e(o[t],i);a.push(r)}t.morphAttributes[r]=a}t.morphTargetsRelative=this.morphTargetsRelative;let a=this.groups;for(let e=0,i=a.length;e<i;e++){let i=a[e];t.addGroup(i.start,i.count,i.materialIndex)}return t}toJSON(){let e={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};
vendor: 4,139 bytes, line 2
2if(e.uuid=this.uuid,e.type=this.type,""!==this.name&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),void 0!==this.parameters){let t=this.parameters;for(let i in t)void 0!==t[i]&&(e[i]=t[i]);return e}e.data={attributes:{}};let t=this.index;null!==t&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});let i=this.attributes;for(let t in i){let r=i[t];e.data.attributes[t]=r.toJSON(e.data)}let r={},s=!1;for(let t in this.morphAttributes){let i=this.morphAttributes[t],a=[];for(let t=0,r=i.length;t<r;t++){let r=i[t];a.push(r.toJSON(e.data))}a.length>0&&(r[t]=a,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 o=this.boundingSphere;return null!==o&&(e.data.boundingSphere={center:o.center.toArray(),radius:o.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;null!==i&&this.setIndex(i.clone(t));let r=e.attributes;for(let e in r){let i=r[e];this.setAttribute(e,i.clone(t))}let s=e.morphAttributes;for(let e in s){let i=[],r=s[e];for(let e=0,s=r.length;e<s;e++)i.push(r[e].clone(t));this.morphAttributes[e]=i}this.morphTargetsRelative=e.morphTargetsRelative;let a=e.groups;for(let e=0,t=a.length;e<t;e++){let t=a[e];this.addGroup(t.start,t.count,t.materialIndex)}let o=e.boundingBox;null!==o&&(this.boundingBox=o.clone());let h=e.boundingSphere;return null!==h&&(this.boundingSphere=h.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,void 0!==e.parameters&&(this.parameters=Object.assign({},e.parameters)),this}dispose(){this.dispatchEvent({type:"dispose"})}},rN=new iY,rF=new iX,rj=new iF,rU=new iy,rV=new iy,rW=new iy,rH=new iy,rG=new iy,rq=new tZ,rX=new tZ,rY=new tZ,rQ=new iy,rZ=new iy,rK=class extends rh{constructor(e=new rz,t=new rS){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),void 0!==e.morphTargetInfluences&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),void 0!==e.morphTargetDictionary&&(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(void 0!==i){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=i.length;e<t;e++){let t=i[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}getVertexPosition(e,t){let i=this.geometry,r=i.attributes.position,s=i.morphAttributes.position,a=i.morphTargetsRelative;t.fromBufferAttribute(r,e);let o=this.morphTargetInfluences;if(s&&o){rG.set(0,0,0);for(let i=0,r=s.length;i<r;i++){let r=o[i],h=s[i];0!==r&&(rH.fromBufferAttribute(h,e),a?rG.addScaledVector(rH,r):rG.addScaledVector(rH.sub(t),r))}t.add(rG)}return this.isSkinnedMesh&&this.boneTransform(e,t),t}raycast(e,t){let i=this.geometry,r=this.material,s=this.matrixWorld;if(void 0===r||(null===i.boundingSphere&&i.computeBoundingSphere(),rj.copy(i.boundingSphere),rj.applyMatrix4(s),!1===e.ray.intersectsSphere(rj))||(rN.copy(s).invert(),rF.copy(e.ray).applyMatrix4(rN),null!==i.boundingBox&&!1===rF.intersectsBox(i.boundingBox)))return;let a,o=i.index,h=i.attributes.position,c=i.attributes.uv,d=i.attributes.uv2,u=i.groups,p=i.drawRange;if(null!==o)if(Array.isArray(r))for(let i=0,s=u.length;i<s;i++){let s=u[i],h=r[s.materialIndex],f=Math.max(s.start,p.start),m=Math.min(o.count,Math.min(s.start+s.count,p.start+p.count));for(let i=f;i<m;i+=3)(a=rJ(this,h,e,rF,c,d,o.getX(i),o.getX(i+1),o.getX(i+2)))&&(a.faceIndex=Math.floor(i/3),a.face.materialIndex=s.materialIndex,t.push(a))}else{let i=Math.max(0,p.start),s=Math.min(o.count,p.start+p.count);for(let h=i;h<s;h+=3)(a=rJ(this,r,e,rF,c,d,o.getX(h),o.getX(h+1),o.getX(h+2)))&&(a.faceIndex=Math.floor(h/3),t.pu
2sh(a))}else if(void 0!==h)if(Array.isArray(r))for(let i=0,s=u.length;i<s;i++){let s=u[i],o=r[s.materialIndex],f=Math.max(s.start,p.start),m=Math.min(h.count,Math.min(s.start+s.count,p.start+p.count));for(let i=f;i<m;i+=3)(a=rJ(this,o,e,rF,c,d,i,i+1,i+2))&&(a.faceIndex=Math.floor(i/3),a.face.materialIndex=s.materialIndex,t.push(a))}else{let i=Math.max(0,p.start),s=Math.min(h.count,p.start+p.count);for(let o=i;o<s;o+=3)(a=rJ(this,r,e,rF,c,d,o,o+1,o+2))&&(a.faceIndex=Math.floor(o/3),t.push(a))}}};function rJ(e,t,i,r,s,a,o,h,c){e.getVertexPosition(o,rU),e.getVertexPosition(h,rV),e.getVertexPosition(c,rW);let d=function(e,t,i,r,s,a,o,h){if(null===(1===t.side?r.intersectTriangle(o,a,s,!0,h):r.intersectTriangle(s,a,o,0===t.side,h)))return null;rZ.copy(h),rZ.applyMatrix4(e.matrixWorld);let c=i.ray.origin.distanceTo(rZ);return c<i.near||c>i.far?null:{distance:c,point:rZ.clone(),object:e}}(e,t,i,r,rU,rV,rW,rQ);if(d){s&&(rq.fromBufferAttribute(s,o),rX.fromBufferAttribute(s,h),rY.fromBufferAttribute(s,c),d.uv=rb.getUV(rQ,rU,rV,rW,rq,rX,rY,new tZ)),a&&(rq.fromBufferAttribute(a,o),rX.fromBufferAttribute(a,h),rY.fromBufferAttribute(a,c),d.uv2=rb.getUV(rQ,rU,rV,rW,rq,rX,rY,new tZ));let e={a:o,b:h,c:c,normal:new iy,materialIndex:0};rb.getNormal(rU,rV,rW,e.normal),d.face=e}return d}var r$=class extends rz{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 o=this;r=Math.floor(r),s=Math.floor(s);let h=[],c=[],d=[],u=[],p=0,f=0;function m(e,t,i,r,s,a,m,g,v,y,x){let b=a/v,w=m/y,_=a/2,S=m/2,C=g/2,M=v+1,E=y+1,A=0,T=0,P=new iy;for(let a=0;a<E;a++){let o=a*w-S;for(let h=0;h<M;h++){let p=h*b-_;P[e]=p*r,P[t]=o*s,P[i]=C,c.push(P.x,P.y,P.z),P[e]=0,P[t]=0,P[i]=g>0?1:-1,d.push(P.x,P.y,P.z),u.push(h/v),u.push(1-a/y),A+=1}}for(let e=0;e<y;e++)for(let t=0;t<v;t++){let i=p+t+M*e,r=p+t+M*(e+1),s=p+(t+1)+M*(e+1),a=p+(t+1)+M*e;h.push(i,r,a),h.push(r,s,a),T+=6}o.addGroup(f,T,x),f+=T,p+=A}m("z","y","x",-1,-1,i,t,e,a=Math.floor(a),s,0),m("z","y","x",1,-1,i,t,-e,a,s,1),m("x","z","y",1,1,e,i,t,r,a,2),m("x","z","y",1,-1,e,i,-t,r,a,3),m("x","y","z",1,-1,e,t,i,r,s,4),m("x","y","z",-1,-1,e,t,-i,r,s,5),this.setIndex(h),this.setAttribute("position",new rP(c,3)),this.setAttribute("normal",new rP(d,3)),this.setAttribute("uv",new rP(u,2))}static fromJSON(e){return new r$(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}};function r0(e){let t={};for(let i in e)for(let r in t[i]={},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 r1(e){let t={};for(let i=0;i<e.length;i++){let r=r0(e[i]);for(let e in r)t[e]=r[e]}return t}function r2(e){return null===e.getRenderTarget()&&3001===e.outputEncoding?tL:tI}var r3=`void main() {
3	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
4}`,r4=`void main() {
5	gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
6}`,r5=class extends r_{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=r3,this.fragmentShader=r4,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,void 0!==e&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=r0(e.uniforms),this.uniformsGroups=function(e){let t=[];for(let i=0;i<e.length;i++)t.push(e[i].clone());return t}(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);for(let i in t.glslVersion=this.glslVersion,t.uniforms={},this.uniforms){let r=this.uniforms[i].value;r&&r.isTexture?t.uniforms[i]={type:"t",value:r.toJSON(e).uuid}:r&&r.isColor?t.uniforms[i]={type:"c",value:r.getHex()}:r&&r.isVector2?t.uniforms[i]={type:"v2",value:r.toArray()}:r&&r.isVector3?t.uniforms[i]={type:"v3",value:r.toArray()}:r&&r.isVector4?t.uniforms[i]={type:"v4",value:r.toArray()}:r&&r.isMatrix3?t.uniforms[i]={type:"m3",value:r.toArray()}:r&&r.isMatrix4?t.uniforms[i]={type:"m4",value:r.toArray()}:t.uniforms[i]={value:r}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader;let i={};for(let e in this.extensions)!0===this.extensions[e]&&(i[e]=!0);return Object.keys(i).length>0&&(t.extensions=i),t}},r6=class extends rh{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new iY,this.projectionMatrix=new iY,this.projectionMatrixInverse=new iY}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)}},r8=class extends r6{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=null===e.view?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){let t=.5*this.getFilmHeight()/e;this.fov=2*tF*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan(.5*tN*this.fov);return .5*this.getFilmHeight()/e}
6getEffectiveFOV(){return 2*tF*Math.atan(Math.tan(.5*tN*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,null===this.view&&(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(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=this.near,t=e*Math.tan(.5*tN*this.fov)/this.zoom,i=2*t,r=this.aspect*i,s=-.5*r,a=this.view;if(null!==this.view&&this.view.enabled){let e=a.fullWidth,o=a.fullHeight;s+=a.offsetX*r/e,t-=a.offsetY*i/o,r*=a.width/e,i*=a.height/o}let o=this.filmOffset;0!==o&&(s+=e*o/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,null!==this.view&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}},r9=class extends rh{constructor(e,t,i){super(),this.type="CubeCamera",this.renderTarget=i;let r=new r8(-90,1,e,t);r.layers=this.layers,r.up.set(0,1,0),r.lookAt(1,0,0),this.add(r);let s=new r8(-90,1,e,t);s.layers=this.layers,s.up.set(0,1,0),s.lookAt(-1,0,0),this.add(s);let a=new r8(-90,1,e,t);a.layers=this.layers,a.up.set(0,0,-1),a.lookAt(0,1,0),this.add(a);let o=new r8(-90,1,e,t);o.layers=this.layers,o.up.set(0,0,1),o.lookAt(0,-1,0),this.add(o);let h=new r8(-90,1,e,t);h.layers=this.layers,h.up.set(0,1,0),h.lookAt(0,0,1),this.add(h);let c=new r8(-90,1,e,t);c.layers=this.layers,c.up.set(0,1,0),c.lookAt(0,0,-1),this.add(c)}update(e,t){null===this.parent&&this.updateMatrixWorld();let i=this.renderTarget,[r,s,a,o,h,c]=this.children,d=e.getRenderTarget(),u=e.toneMapping,p=e.xr.enabled;e.toneMapping=0,e.xr.enabled=!1;let f=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,o),e.setRenderTarget(i,4),e.render(t,h),i.texture.generateMipmaps=f,e.setRenderTarget(i,5),e.render(t,c),e.setRenderTarget(d),e.toneMapping=u,e.xr.enabled=p,i.texture.needsPMREMUpdate=!0}},r7=class extends ic{constructor(e,t,i,r,s,a,o,h,c,d){super(e=void 0!==e?e:[],t=void 0!==t?t:301,i,r,s,a,o,h,c,d),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}},se=class extends iu{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;let i={width:e,height:e,depth:1};this.texture=new r7([i,i,i,i,i,i],t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.encoding),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=void 0!==t.generateMipmaps&&t.generateMipmaps,this.texture.minFilter=void 0!==t.minFilter?t.minFilter:1006}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.encoding=t.encoding,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;let i={uniforms:{tEquirect:{value:null}},vertexShader:`
7
8				varying vec3 vWorldDirection;
9
10				vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
11
12					return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
13
14				}
15
16				void main() {
17
18					vWorldDirection = transformDirection( position, modelMatrix );
19
20					#include <begin_vertex>
21					#include <project_vertex>
22
23				}
24			`,fragmentShader:`
25
26				uniform sampler2D tEquirect;
27
28				varying vec3 vWorldDirection;
29
30				#include <common>
31
32				void main() {
33
34					vec3 direction = normalize( vWorldDirection );
35
36					vec2 sampleUV = equirectUv( direction );
37
38					gl_FragColor = texture2D( tEquirect, sampleUV );
39
40				}
41			`},r=new r$(5,5,5),s=new r5({name:"CubemapFromEquirect",uniforms:r0(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:1,blending:0});s.uniforms.tEquirect.value=t;let a=new rK(r,s),o=t.minFilter;return 1008===t.minFilter&&(t.minFilter=1006),new r9(1,10,this).update(e,a),t.minFilter=o,a.geometry.dispose(),a.material.dispose(),this}clear(e,t,i,r){let s=e.getRenderTarget();for(let s=0;s<6;s++)e.setRenderTarget(this,s),e.clear(t,i,r);e.setRenderTarget(s)}},st=new iy,si=new iy,sr=new tK,ss=class{constructor(e=new iy(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}
41setFromCoplanarPoints(e,t,i){let r=st.subVectors(i,t).cross(si.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(st),r=this.normal.dot(i);if(0===r)return 0===this.distanceToPoint(e.start)?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||sr.getNormalMatrix(e),r=this.coplanarPoint(st).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)}},sa=new iF,sn=new iy,so=class{constructor(e=new ss,t=new ss,i=new ss,r=new ss,s=new ss,a=new ss){this.planes=[e,t,i,r,s,a]}set(e,t,i,r,s,a){let o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(i),o[3].copy(r),o[4].copy(s),o[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],o=i[3],h=i[4],c=i[5],d=i[6],u=i[7],p=i[8],f=i[9],m=i[10],g=i[11],v=i[12],y=i[13],x=i[14],b=i[15];return t[0].setComponents(o-r,u-h,g-p,b-v).normalize(),t[1].setComponents(o+r,u+h,g+p,b+v).normalize(),t[2].setComponents(o+s,u+c,g+f,b+y).normalize(),t[3].setComponents(o-s,u-c,g-f,b-y).normalize(),t[4].setComponents(o-a,u-d,g-m,b-x).normalize(),t[5].setComponents(o+a,u+d,g+m,b+x).normalize(),this}intersectsObject(e){let t=e.geometry;return null===t.boundingSphere&&t.computeBoundingSphere(),sa.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(sa)}intersectsSprite(e){return sa.center.set(0,0,0),sa.radius=.7071067811865476,sa.applyMatrix4(e.matrixWorld),this.intersectsSphere(sa)}intersectsSphere(e){let t=this.planes,i=e.center,r=-e.radius;for(let e=0;e<6;e++)if(t[e].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(sn.x=r.normal.x>0?e.max.x:e.min.x,sn.y=r.normal.y>0?e.max.y:e.min.y,sn.z=r.normal.z>0?e.max.z:e.min.z,0>r.distanceToPoint(sn))return!1}return!0}containsPoint(e){let t=this.planes;for(let i=0;i<6;i++)if(0>t[i].distanceToPoint(e))return!1;return!0}clone(){return new this.constructor().copy(this)}};function sl(){let e=null,t=!1,i=null,r=null;function s(t,a){i(t,a),r=e.requestAnimationFrame(s)}return{start:function(){!0!==t&&null!==i&&(r=e.requestAnimationFrame(s),t=!0)},stop:function(){e.cancelAnimationFrame(r),t=!1},setAnimationLoop:function(e){i=e},setContext:function(t){e=t}}}function sh(e,t){let i=t.isWebGL2,r=new WeakMap;return{get:function(e){return e.isInterleavedBufferAttribute&&(e=e.data),r.get(e)},remove:function(t){t.isInterleavedBufferAttribute&&(t=t.data);let i=r.get(t);i&&(e.deleteBuffer(i.buffer),r.delete(t))},update:function(t,s){var a,o;let h,c;if(t.isGLBufferAttribute){let e=r.get(t);(!e||e.version<t.version)&&r.set(t,{buffer:t.buffer,type:t.type,bytesPerElement:t.elementSize,version:t.version});return}t.isInterleavedBufferAttribute&&(t=t.data);let d=r.get(t);void 0===d?r.set(t,function(t,r){let s,a=t.array,o=t.usage,h=e.createBuffer();if(e.bindBuffer(r,h),e.bufferData(r,a,o),t.onUploadCallback(),a instanceof Float32Array)s=5126;else if(a instanceof Uint16Array)if(t.isFloat16BufferAttribute)if(i)s=5131;else throw Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");else s=5123;else if(a instanceof Int16Array)s=5122;else if(a instanceof Uint32Array)s=5125;else if(a instanceof Int32Array)s=5124;else if(a instanceof Int8Array)s=5120;else if(a instanceof Uint8Array)s=5121;else if(a instanceof Uint8ClampedArray)s=5121;else throw Error("THREE.WebGLAttributes: Unsupported buffer data format: "+a);return{buffer:h,type:s,bytesPerElement:a.BYTES_PER_ELEMENT,version:t.version}}(t,s)):d.version<t.version&&(a=d.buffer,h=(o=t).array,c=o.updateRange,e.bindBuffer(s,a),-1===c.count?e.bufferSubData(s,0,h):(i?e.bufferSubData(s,c.offset*h.BYTES_PER_ELEMENT,h,c.offset,c.c
vendor: 4,118 bytes, lines 41-106
41ount):e.bufferSubData(s,c.offset*h.BYTES_PER_ELEMENT,h.subarray(c.offset,c.offset+c.count)),c.count=-1),o.onUploadCallback(),d.version=t.version)}}}var sc=class extends rz{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,o=Math.floor(i),h=Math.floor(r),c=o+1,d=h+1,u=e/o,p=t/h,f=[],m=[],g=[],v=[];for(let e=0;e<d;e++){let t=e*p-a;for(let i=0;i<c;i++){let r=i*u-s;m.push(r,-t,0),g.push(0,0,1),v.push(i/o),v.push(1-e/h)}}for(let e=0;e<h;e++)for(let t=0;t<o;t++){let i=t+c*e,r=t+c*(e+1),s=t+1+c*(e+1),a=t+1+c*e;f.push(i,r,a),f.push(r,s,a)}this.setIndex(f),this.setAttribute("position",new rP(m,3)),this.setAttribute("normal",new rP(g,3)),this.setAttribute("uv",new rP(v,2))}static fromJSON(e){return new sc(e.width,e.height,e.widthSegments,e.heightSegments)}},sd={alphamap_fragment:`#ifdef USE_ALPHAMAP
42	diffuseColor.a *= texture2D( alphaMap, vUv ).g;
43#endif`,alphamap_pars_fragment:`#ifdef USE_ALPHAMAP
44	uniform sampler2D alphaMap;
45#endif`,alphatest_fragment:`#ifdef USE_ALPHATEST
46	if ( diffuseColor.a < alphaTest ) discard;
47#endif`,alphatest_pars_fragment:`#ifdef USE_ALPHATEST
48	uniform float alphaTest;
49#endif`,aomap_fragment:`#ifdef USE_AOMAP
50	float ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;
51	reflectedLight.indirectDiffuse *= ambientOcclusion;
52	#if defined( USE_ENVMAP ) && defined( STANDARD )
53		float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );
54		reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
55	#endif
56#endif`,aomap_pars_fragment:`#ifdef USE_AOMAP
57	uniform sampler2D aoMap;
58	uniform float aoMapIntensity;
59#endif`,begin_vertex:"vec3 transformed = vec3( position );",beginnormal_vertex:`vec3 objectNormal = vec3( normal );
60#ifdef USE_TANGENT
61	vec3 objectTangent = vec3( tangent.xyz );
62#endif`,bsdfs:`vec3 BRDF_Lambert( const in vec3 diffuseColor ) {
63	return RECIPROCAL_PI * diffuseColor;
64}
65vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
66	float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
67	return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
68}
69float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
70	float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
71	return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
72}
73vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {
74    float x = clamp( 1.0 - dotVH, 0.0, 1.0 );
75    float x2 = x * x;
76    float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );
77    return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );
78}
79float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {
80	float a2 = pow2( alpha );
81	float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
82	float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
83	return 0.5 / max( gv + gl, EPSILON );
84}
85float D_GGX( const in float alpha, const in float dotNH ) {
86	float a2 = pow2( alpha );
87	float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;
88	return RECIPROCAL_PI * a2 / pow2( denom );
89}
90vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 f0, const in float f90, const in float roughness ) {
91	float alpha = pow2( roughness );
92	vec3 halfDir = normalize( lightDir + viewDir );
93	float dotNL = saturate( dot( normal, lightDir ) );
94	float dotNV = saturate( dot( normal, viewDir ) );
95	float dotNH = saturate( dot( normal, halfDir ) );
96	float dotVH = saturate( dot( viewDir, halfDir ) );
97	vec3 F = F_Schlick( f0, f90, dotVH );
98	float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
99	float D = D_GGX( alpha, dotNH );
100	return F * ( V * D );
101}
102#ifdef USE_IRIDESCENCE
103	vec3 BRDF_GGX_Iridescence( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 f0, const in float f90, const in float iridescence, const in vec3 iridescenceFresnel, const in float roughness ) {
104		float alpha = pow2( roughness );
105		vec3 halfDir = normalize( lightDir + viewDir );
106		float dotNL = saturate( dot( normal, lightDir ) );
107		float dotNV = saturate( dot( normal, viewDir ) );
108		float dotNH = saturate( dot( normal, halfDir ) );
109		float dotVH = saturate( dot( viewDir, halfDir ) );
110		vec3 F = mix( F_Schlick( f0, f90, dotVH ), iridescenceFresnel, iridescence );
111		float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
112		float D = D_GGX( alpha, dotNH );
113		return F * ( V * D );
114	}
115#endif
116vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {
117	const float LUT_SIZE = 64.0;
118	const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
119	const float LUT_BIAS = 0.5 / LUT_SIZE;
120	float dotNV = saturate( dot( N, V ) );
121	vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );
122	uv = uv * LUT_SCALE + LUT_BIAS;
123	return uv;
124}
125float LTC_ClippedSphereFormFactor( const in vec3 f ) {
126	float l = length( f );
127	return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );
128}
129vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {
130	float x = dot( v1, v2 );
131	float y = abs( x );
132	float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;
133	float b = 3.4175940 + ( 4.1616724 + y ) * y;
134	float v = a / b;
135	float theta_sintheta = ( x >
135 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;
136	return cross( v1, v2 ) * theta_sintheta;
137}
138vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {
139	vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];
140	vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];
141	vec3 lightNormal = cross( v1, v2 );
142	if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );
143	vec3 T1, T2;
144	T1 = normalize( V - N * dot( V, N ) );
145	T2 = - cross( N, T1 );
146	mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );
147	vec3 coords[ 4 ];
148	coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );
149	coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );
150	coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );
151	coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );
152	coords[ 0 ] = normalize( coords[ 0 ] );
153	coords[ 1 ] = normalize( coords[ 1 ] );
154	coords[ 2 ] = normalize( coords[ 2 ] );
155	coords[ 3 ] = normalize( coords[ 3 ] );
156	vec3 vectorFormFactor = vec3( 0.0 );
157	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );
158	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );
159	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );
160	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );
161	float result = LTC_ClippedSphereFormFactor( vectorFormFactor );
162	return vec3( result );
163}
164float G_BlinnPhong_Implicit( ) {
165	return 0.25;
166}
167float D_BlinnPhong( const in float shininess, const in float dotNH ) {
168	return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );
169}
170vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {
171	vec3 halfDir = normalize( lightDir + viewDir );
172	float dotNH = saturate( dot( normal, halfDir ) );
173	float dotVH = saturate( dot( viewDir, halfDir ) );
174	vec3 F = F_Schlick( specularColor, 1.0, dotVH );
175	float G = G_BlinnPhong_Implicit( );
176	float D = D_BlinnPhong( shininess, dotNH );
177	return F * ( G * D );
178}
179#if defined( USE_SHEEN )
180float D_Charlie( float roughness, float dotNH ) {
181	float alpha = pow2( roughness );
182	float invAlpha = 1.0 / alpha;
183	float cos2h = dotNH * dotNH;
184	float sin2h = max( 1.0 - cos2h, 0.0078125 );
185	return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );
186}
187float V_Neubelt( float dotNV, float dotNL ) {
188	return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );
189}
190vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {
191	vec3 halfDir = normalize( lightDir + viewDir );
192	float dotNL = saturate( dot( normal, lightDir ) );
193	float dotNV = saturate( dot( normal, viewDir ) );
194	float dotNH = saturate( dot( normal, halfDir ) );
195	float D = D_Charlie( sheenRoughness, dotNH );
196	float V = V_Neubelt( dotNV, dotNL );
197	return sheenColor * ( D * V );
198}
199#endif`,iridescence_fragment:`#ifdef USE_IRIDESCENCE
200	const mat3 XYZ_TO_REC709 = mat3(
201		 3.2404542, -0.9692660,  0.0556434,
202		-1.5371385,  1.8760108, -0.2040259,
203		-0.4985314,  0.0415560,  1.0572252
204	);
205	vec3 Fresnel0ToIor( vec3 fresnel0 ) {
206		vec3 sqrtF0 = sqrt( fresnel0 );
207		return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );
208	}
209	vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {
210		return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );
211	}
212	float IorToFresnel0( float transmittedIor, float incidentIor ) {
213		return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));
214	}
215	vec3 evalSensitivity( float OPD, vec3 shift ) {
216		float phase = 2.0 * PI * OPD * 1.0e-9;
217		vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );
218		vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );
219		vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );
220		vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );
221		xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );
222		xyz /= 1.0685e-7;
223		vec3 rgb = XYZ_TO_REC709 * xyz;
224		return rgb;
225	}
226	vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {
227		vec3 I;
228		float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );
229		float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );
230		float cosTheta2Sq = 1.0 - sinTheta2Sq;
231		if ( cosTheta2Sq < 0.0 ) {
232			 return vec3( 1.0 );
233		}
234		float cosTheta2 = sqrt( cosTheta2Sq );
235		float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
236		float R12 = F_Schlick( R0, 1.0, cosTheta1 );
237		float R21 = R12;
238		float T121 = 1.0 - R12;
239		float phi12 = 0.0;
240		if ( iridescenceIOR < outsideIOR ) phi12 = PI;
241		float phi21 = PI - phi12;
242		vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );		vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );
243		vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );
244		vec3 phi23 = vec3( 0.0 );
245		if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;
246		if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;
247		if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;
248		float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;
249		vec3 phi = vec3( phi21 ) + phi23;
250		vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );
251		vec3 r123 = sqrt( R123 );
252		vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );
253		vec3 C0 = R12 + Rs;
254		I = C0;
255		vec3 Cm = Rs - T121;
256		for ( int m = 1; m <= 2; ++ m ) {
257			Cm *= r123;
258			vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );
259			I += Cm * Sm;
260		}
261		return max( I, vec3( 0.0 ) );
262	}
263#endif`,bumpmap_pars_fragment:`#ifdef USE_BUMPMAP
264	uniform sampler2D bumpMap;
265	uniform float bumpScale;
266	vec2 dHdxy_fwd() {
267		vec2 dSTdx = dFdx( vUv );
268		vec2 dSTdy = dFdy( vUv );
269		float Hll = bumpScale * texture2D( bumpMap, vUv ).x;
270		float dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;
271		float dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;
272		return vec2( dBx, dBy );
273	}
274	vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {
275		vec3 vSigmaX = dFdx( surf_pos.xyz );
276		vec3 vSigmaY = dFdy( surf_pos.xyz );
277		vec3 vN = surf_norm;
278		vec3 R1 = cross( vSigmaY, vN );
279		vec3 R2 = cross( vN, vSigmaX );
280		float fDet = dot( vSigmaX, R1 ) * faceDirection;
281		vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
282		return normalize( abs( fDet ) * surf_norm - vGrad );
283	}
284#endif`,clipping_planes_fragment:`#if NUM_CLIPPING_PLANES > 0
285	vec4 plane;
286	#pragma unroll_loop_start
287	for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
288		plane = clippingPlanes[ i ];
289		if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;
290	}
291	#pragma unroll_loop_end
292	#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
293		bool clipped = true;
294		#pragma unroll_loop_start
295		for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
296			plane = clippingPlanes[ i ];
297			clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;
298		}
299		#pragma unroll_loop_end
300		if ( clipped ) discard;
301	#endif
302#endif`,clipping_planes_pars_fragment:`#if NUM_CLIPPING_PLANES > 0
303	varying vec3 vClipPosition;
304	uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
305#endif`,clipping_planes_pars_vertex:`#if NUM_CLIPPING_PLANES > 0
306	varying vec3 vClipPosition;
307#endif`,clipping_planes_vertex:`#if NUM_CLIPPING_PLANES > 0
308	vClipPosition = - mvPosition.xyz;
309#endif`,color_fragment:`#if defined( USE_COLOR_ALPHA )
310	diffuseColor *= vColor;
311#elif defined( USE_COLOR )
312	diffuseColor.rgb *= vColor;
313#endif`,color_pars_fragment:`#if defined( USE_COLOR_ALPHA )
314	varying vec4 vColor;
315#elif defined( USE_COLOR )
316	varying vec3 vColor;
317#endif`,color_pars_vertex:`#if defined( USE_COLOR_ALPHA )
318	varying vec4 vColor;
319#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )
320	varying vec3 vColor;
321#endif`,color_vertex:`#if defined( USE_COLOR_ALPHA )
322	vColor = vec4( 1.0 );
323#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )
324	vColor = vec3( 1.0 );
325#endif
326#ifdef USE_COLOR
327	vColor *= color;
328#endif
329#ifdef USE_INSTANCING_COLOR
330	vColor.xyz *= instanceColor.xyz;
331#endif`,common:`#define PI 3.141592653589793
332#define PI2 6.283185307179586
333#define PI_HALF 1.5707963267948966
334#define RECIPROCAL_PI 0.3183098861837907
335#define RECIPROCAL_PI2 0.15915494309189535
336#define EPSILON 1e-6
337#ifndef saturate
338#define saturate( a ) clamp( a, 0.0, 1.0 )
339#endif
340#define whiteComplement( a ) ( 1.0 - saturate( a ) )
341float pow2( const in float x ) { return x*x; }
342vec3 pow2( const in vec3 x ) { return x*x; }
343float pow3( const in float x ) { return x*x*x; }
344float pow4( const in float x ) { float x2 = x*x; return x2*x2; }
345float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }
346float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }
347highp float rand( const in vec2 uv ) {
348	const highp float a = 12.9898, b = 78.233, c = 43758.5453;
349	highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
350	return fract( sin( sn ) * c );
351}
352#ifdef HIGH_PRECISION
353	float precisionSafeLength( vec3 v ) { return length( v ); }
354#else
355	float precisionSafeLength( vec3 v ) {
356		float maxComponent = max3( abs( v ) );
357		return length( v / maxComponent ) * maxComponent;
358	}
359#endif
360struct IncidentLight {
361	vec3 color;
362	vec3 direction;
363	bool visible;
364};
365struct ReflectedLight {
366	vec3 directDiffuse;
367	vec3 directSpecular;
368	vec3 indirectDiffuse;
369	vec3 indirectSpecular;
370};
371struct GeometricContext {
372	vec3 position;
373	vec3 normal;
374	vec3 viewDir;
375#ifdef USE_CLEARCOAT
376	vec3 clearcoatNormal;
377#endif
378};
379vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
380	return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
381}
382vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {
383	return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );
384}
385mat3 transposeMat3( const in mat3 m ) {
386	mat3 tmp;
387	tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );
388	tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );
389	tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );
390	return tmp;
391}
392float luminance( const in vec3 rgb ) {
393	const vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 );
394	return dot( weights, rgb );
395}
396bool isPerspectiveMatrix( mat4 m ) {
397	return m[ 2 ][ 3 ] == - 1.0;
398}
399vec2 equirectUv( in vec3 dir ) {
400	float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;
401	float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;
402	return vec2( u, v );
403}`,cube_uv_reflection_fragment:`#ifdef ENVMAP_TYPE_CUBE_UV
404	#define cubeUV_minMipLevel 4.0
405	#define cubeUV_minTileSize 16.0
406	float getFace( vec3 direction ) {
407		vec3 absDirection = abs( direction );
408		float face = - 1.0;
409		if ( absDirection.x > absDirection.z ) {
410			if ( absDirection.x > absDirection.y )
411				face = direction.x > 0.0 ? 0.0 : 3.0;
412			else
413				face = direction.y > 0.0 ? 1.0 : 4.0;
414		} else {
415			if ( absDirection.z > absDirection.y )
416				face = direction.z > 0.0 ? 2.0 : 5.0;
417			else
418				face = direction.y > 0.0 ? 1.0 : 4.0;
419		}
420		return face;
421	}
422	vec2 getUV( vec3 direction, float face ) {
423		vec2 uv;
424		if ( face == 0.0 ) {
425			uv = vec2( direction.z, direction.y ) / abs( direction.x );
426		} else if ( face == 1.0 ) {
427			uv = vec2( - direction.x, - direction.z ) / abs( direction.y );
428		} else if ( face == 2.0 ) {
429			uv = vec2( - direction.x, direction.y ) / abs( direction.z );
430		} else if ( face == 3.0 ) {
431			uv = vec2( - direction.z, direction.y ) / abs( direction.x );
432		} else if ( face == 4.0 ) {
433			uv = vec2( - direction.x, direction.z ) / abs( direction.y );
434		} else {
435			uv = vec2( direction.x, direction.y ) / abs( direction.z );
436		}
437		return 0.5 * ( uv + 1.0 );
438	}
439	vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {
440		float face = getFace( direction );
441		float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );
442		mipInt = max( mipInt, cubeUV_minMipLevel );
443		float faceSize = exp2( mipInt );
444		highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;
445		if ( face > 2.0 ) {
446			uv.y += faceSize;
447			face -= 3.0;
448		}
449		uv.x += face * faceSize;
450		uv.x += filterInt * 3.0 * cubeUV_minTileSize;
451		uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );
452		uv.x *= CUBEUV_TEXEL_WIDTH;
453		uv.y *= CUBEUV_TEXEL_HEIGHT;
454		#ifdef texture2DGradEXT
455			return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;
456		#else
457			return texture2D( envMap, uv ).rgb;
458		#endif
459	}
460	#define cubeUV_r0 1.0
461	#define cubeUV_v0 0.339
462	#define cubeUV_m0 - 2.0
463	#define cubeUV_r1 0.8
464	#define cubeUV_v1 0.276
465	#define cubeUV_m1 - 1.0
466	#define cubeUV_r4 0.4
467	#define cubeUV_v4 0.046
468	#define cubeUV_m4 2.0
469	#define cubeUV_r5 0.305
470	#define cubeUV_v5 0.016
471	#define cubeUV_m5 3.0
472	#define cubeUV_r6 0.21
473	#define cubeUV_v6 0.0038
474	#define cubeUV_m6 4.0
475	float roughnessToMip( float roughness ) {
476		float mip = 0.0;
477		if ( roughness >= cubeUV_r1 ) {
478			mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;
479		} else if ( roughness >= cubeUV_r4 ) {
480			mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;
481		} else if ( roughness >= cubeUV_r5 ) {
482			mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;
483		} else if ( roughness >= cubeUV_r6 ) {
484			mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;
485		} else {
486			mip = - 2.0 * log2( 1.16 * roughness );		}
487		return mip;
488	}
489	vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {
490		float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );
491		float mipF = fract( mip );
492		float mipInt = floor( mip );
493		vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );
494		if ( mipF == 0.0 ) {
495			return vec4( color0, 1.0 );
496		} else {
497			vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );
498			return vec4( mix( color0, color1, mipF ), 1.0 );
499		}
500	}
501#endif`,defaultnormal_vertex:`vec3 transformedNormal = objectNormal;
502#ifdef USE_INSTANCING
503	mat3 m = mat3( instanceMatrix );
504	transformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );
505	transformedNormal = m * transformedNormal;
506#endif
507transformedNormal = normalMatrix * transformedNormal;
508#ifdef FLIP_SIDED
509	transformedNormal = - transformedNormal;
510#endif
511#ifdef USE_TANGENT
512	vec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;
513	#ifdef FLIP_SIDED
514		transformedTangent = - transformedTangent;
515	#endif
516#endif`,displacementmap_pars_vertex:`#ifdef USE_DISPLACEMENTMAP
517	uniform sampler2D displacementMap;
518	uniform float displacementScale;
519	uniform float displacementBias;
520#endif`,displacementmap_vertex:`#ifdef USE_DISPLACEMENTMAP
521	transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );
522#endif`,emissivemap_fragment:`#ifdef USE_EMISSIVEMAP
523	vec4 emissiveColor = texture2D( emissiveMap, vUv );
524	totalEmissiveRadiance *= emissiveColor.rgb;
525#endif`,emissivemap_pars_fragment:`#ifdef USE_EMISSIVEMAP
526	uniform sampler2D emissiveMap;
527#endif`,encodings_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",encodings_pars_fragment:`vec4 LinearToLinear( in vec4 value ) {
528	return value;
529}
530vec4 LinearTosRGB( in vec4 value ) {
531	return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );
532}`,envmap_fragment:`#ifdef USE_ENVMAP
533	#ifdef ENV_WORLDPOS
534		vec3 cameraToFrag;
535		if ( isOrthographic ) {
536			cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
537		} else {
538			cameraToFrag = normalize( vWorldPosition - cameraPosition );
539		}
540		vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
541		#ifdef ENVMAP_MODE_REFLECTION
542			vec3 reflectVec = reflect( cameraToFrag, worldNormal );
543		#else
544			vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );
545		#endif
546	#else
547		vec3 reflectVec = vReflect;
548	#endif
549	#ifdef ENVMAP_TYPE_CUBE
550		vec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );
551	#else
552		vec4 envColor = vec4( 0.0 );
553	#endif
554	#ifdef ENVMAP_BLENDING_MULTIPLY
555		outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
556	#elif defined( ENVMAP_BLENDING_MIX )
557		outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );
558	#elif defined( ENVMAP_BLENDING_ADD )
559		outgoingLight += envColor.xyz * specularStrength * reflectivity;
560	#endif
561#endif`,envmap_common_pars_fragment:`#ifdef USE_ENVMAP
562	uniform float envMapIntensity;
563	uniform float flipEnvMap;
564	#ifdef ENVMAP_TYPE_CUBE
565		uniform samplerCube envMap;
566	#else
567		uniform sampler2D envMap;
568	#endif
569	
570#endif`,envmap_pars_fragment:`#ifdef USE_ENVMAP
571	uniform float reflectivity;
572	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
573		#define ENV_WORLDPOS
574	#endif
575	#ifdef ENV_WORLDPOS
576		varying vec3 vWorldPosition;
577		uniform float refractionRatio;
578	#else
579		varying vec3 vReflect;
580	#endif
581#endif`,envmap_pars_vertex:`#ifdef USE_ENVMAP
582	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
583		#define ENV_WORLDPOS
584	#endif
585	#ifdef ENV_WORLDPOS
586		
587		varying vec3 vWorldPosition;
588	#else
589		varying vec3 vReflect;
590		uniform float refractionRatio;
591	#endif
592#endif`,envmap_physical_pars_fragment:`#if defined( USE_ENVMAP )
593	vec3 getIBLIrradiance( const in vec3 normal ) {
594		#if defined( ENVMAP_TYPE_CUBE_UV )
595			vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
596			vec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );
597			return PI * envMapColor.rgb * envMapIntensity;
598		#else
599			return vec3( 0.0 );
600		#endif
601	}
602	vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {
603		#if defined( ENVMAP_TYPE_CUBE_UV )
604			vec3 reflectVec = reflect( - viewDir, normal );
605			reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );
606			reflectVec = inverseTransformDirection( reflectVec, viewMatrix );
607			vec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );
608			return envMapColor.rgb * envMapIntensity;
609		#else
610			return vec3( 0.0 );
611		#endif
612	}
613#endif`,envmap_vertex:`#ifdef USE_ENVMAP
614	#ifdef ENV_WORLDPOS
615		vWorldPosition = worldPosition.xyz;
616	#else
617		vec3 cameraToVertex;
618		if ( isOrthographic ) {
619			cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
620		} else {
621			cameraToVertex = normalize( worldPosition.xyz - cameraPosition );
622		}
623		vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
624		#ifdef ENVMAP_MODE_REFLECTION
625			vReflect = reflect( cameraToVertex, worldNormal );
626		#else
627			vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
628		#endif
629	#endif
630#endif`,fog_vertex:`#ifdef USE_FOG
631	vFogDepth = - mvPosition.z;
632#endif`,fog_pars_vertex:`#ifdef USE_FOG
633	varying float vFogDepth;
634#endif`,fog_fragment:`#ifdef USE_FOG
635	#ifdef FOG_EXP2
636		float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
637	#else
638		float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
639	#endif
640	gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
641#endif`,fog_pars_fragment:`#ifdef USE_FOG
642	uniform vec3 fogColor;
643	varying float vFogDepth;
644	#ifdef FOG_EXP2
645		uniform float fogDensity;
646	#else
647		uniform float fogNear;
648		uniform float fogFar;
649	#endif
650#endif`,gradientmap_pars_fragment:`#ifdef USE_GRADIENTMAP
651	uniform sampler2D gradientMap;
652#endif
653vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
654	float dotNL = dot( normal, lightDirection );
655	vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );
656	#ifdef USE_GRADIENTMAP
657		return vec3( texture2D( gradientMap, coord ).r );
658	#else
659		vec2 fw = fwidth( coord ) * 0.5;
660		return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
661	#endif
662}`,lightmap_fragment:`#ifdef USE_LIGHTMAP
663	vec4 lightMapTexel = texture2D( lightMap, vUv2 );
664	vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
665	reflectedLight.indirectDiffuse += lightMapIrradiance;
666#endif`,lightmap_pars_fragment:`#ifdef USE_LIGHTMAP
667	uniform sampler2D lightMap;
668	uniform float lightMapIntensity;
669#endif`,lights_lambert_fragment:`LambertMaterial material;
670material.diffuseColor = diffuseColor.rgb;
671material.specularStrength = specularStrength;`,lights_lambert_pars_fragment:`varying vec3 vViewPosition;
672struct LambertMaterial {
673	vec3 diffuseColor;
674	float specularStrength;
675};
676void RE_Direct_Lambert( const in IncidentLight directLight, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
677	float dotNL = saturate( dot( geometry.normal, directLight.direction ) );
678	vec3 irradiance = dotNL * directLight.color;
679	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
680}
681void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
682	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
683}
684#define RE_Direct				RE_Direct_Lambert
685#define RE_IndirectDiffuse		RE_IndirectDiffuse_Lambert`,lights_pars_begin:`uniform bool receiveShadow;
686uniform vec3 ambientLightColor;
687uniform vec3 lightProbe[ 9 ];
688vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {
689	float x = normal.x, y = normal.y, z = normal.z;
690	vec3 result = shCoefficients[ 0 ] * 0.886227;
691	result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;
692	result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;
693	result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;
694	result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;
695	result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;
696	result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );
697	result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;
698	result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );
699	return result;
700}
701vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {
702	vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
703	vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );
704	return irradiance;
705}
706vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
707	vec3 irradiance = ambientLightColor;
708	return irradiance;
709}
710float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {
711	#if defined ( PHYSICALLY_CORRECT_LIGHTS )
712		float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );
713		if ( cutoffDistance > 0.0 ) {
714			distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );
715		}
716		return distanceFalloff;
717	#else
718		if ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {
719			return pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );
720		}
721		return 1.0;
722	#endif
723}
724float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {
725	return smoothstep( coneCosine, penumbraCosine, angleCosine );
726}
727#if NUM_DIR_LIGHTS > 0
728	struct DirectionalLight {
729		vec3 direction;
730		vec3 color;
731	};
732	uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];
733	void getDirectionalLightInfo( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight light ) {
734		light.color = directionalLight.color;
735		light.direction = directionalLight.direction;
736		light.visible = true;
737	}
738#endif
739#if NUM_POINT_LIGHTS > 0
740	struct PointLight {
741		vec3 position;
742		vec3 color;
743		float distance;
744		float decay;
745	};
746	uniform PointLight pointLights[ NUM_POINT_LIGHTS ];
747	void getPointLightInfo( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight light ) {
748		vec3 lVector = pointLight.position - geometry.position;
749		light.direction = normalize( lVector );
750		float lightDistance = length( lVector );
751		light.color = pointLight.color;
752		light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );
753		light.visible = ( light.color != vec3( 0.0 ) );
754	}
755#endif
756#if NUM_SPOT_LIGHTS > 0
757	struct SpotLight {
758		vec3 position;
759		vec3 direction;
760		vec3 color;
761		float distance;
762		float decay;
763		float coneCos;
764		float penumbraCos;
765	};
766	uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];
767	void getSpotLightInfo( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight light ) {
768		vec3 lVector = spotLight.position - geometry.position;
769		light.direction = normalize( lVector );
770		float angleCos = dot( light.direction, spotLight.direction );
771		float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );
772		if ( spotAttenuation > 0.0 ) {
773			float lightDistance = length( lVector );
774			light.color = spotLight.color * spotAttenuation;
775			light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );
776			light.visible = ( light.color != vec3( 0.0 ) );
777		} else {
778			light.color = vec3( 0.0 );
779			light.visible = false;
780		}
781	}
782#endif
783#if NUM_RECT_AREA_LIGHTS > 0
784	struct RectAreaLight {
785		vec3 color;
786		vec3 position;
787		vec3 halfWidth;
788		vec3 halfHeight;
789	};
790	uniform sampler2D ltc_1;	uniform sampler2D ltc_2;
791	uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];
792#endif
793#if NUM_HEMI_LIGHTS > 0
794	struct HemisphereLight {
795		vec3 direction;
796		vec3 skyColor;
797		vec3 groundColor;
798	};
799	uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];
800	vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {
801		float dotNL = dot( normal, hemiLight.direction );
802		float hemiDiffuseWeight = 0.5 * dotNL + 0.5;
803		vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
804		return irradiance;
805	}
806#endif`,lights_toon_fragment:`ToonMaterial material;
807material.diffuseColor = diffuseColor.rgb;`,lights_toon_pars_fragment:`varying vec3 vViewPosition;
808struct ToonMaterial {
809	vec3 diffuseColor;
810};
811void RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
812	vec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;
813	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
814}
815void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
816	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
817}
818#define RE_Direct				RE_Direct_Toon
819#define RE_IndirectDiffuse		RE_IndirectDiffuse_Toon`,lights_phong_fragment:`BlinnPhongMaterial material;
820material.diffuseColor = diffuseColor.rgb;
821material.specularColor = specular;
822material.specularShininess = shininess;
823material.specularStrength = specularStrength;`,lights_phong_pars_fragment:`varying vec3 vViewPosition;
824struct BlinnPhongMaterial {
825	vec3 diffuseColor;
826	vec3 specularColor;
827	float specularShininess;
828	float specularStrength;
829};
830void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
831	float dotNL = saturate( dot( geometry.normal, directLight.direction ) );
832	vec3 irradiance = dotNL * directLight.color;
833	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
834	reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularShininess ) * material.specularStrength;
835}
836void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
837	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
838}
839#define RE_Direct				RE_Direct_BlinnPhong
840#define RE_IndirectDiffuse		RE_IndirectDiffuse_BlinnPhong`,lights_physical_fragment:`PhysicalMaterial material;
841material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );
842vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );
843float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
844material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;
845material.roughness = min( material.roughness, 1.0 );
846#ifdef IOR
847	material.ior = ior;
848	#ifdef SPECULAR
849		float specularIntensityFactor = specularIntensity;
850		vec3 specularColorFactor = specularColor;
851		#ifdef USE_SPECULARINTENSITYMAP
852			specularIntensityFactor *= texture2D( specularIntensityMap, vUv ).a;
853		#endif
854		#ifdef USE_SPECULARCOLORMAP
855			specularColorFactor *= texture2D( specularColorMap, vUv ).rgb;
856		#endif
857		material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );
858	#else
859		float specularIntensityFactor = 1.0;
860		vec3 specularColorFactor = vec3( 1.0 );
861		material.specularF90 = 1.0;
862	#endif
863	material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );
864#else
865	material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );
866	material.specularF90 = 1.0;
867#endif
868#ifdef USE_CLEARCOAT
869	material.clearcoat = clearcoat;
870	material.clearcoatRoughness = clearcoatRoughness;
871	material.clearcoatF0 = vec3( 0.04 );
872	material.clearcoatF90 = 1.0;
873	#ifdef USE_CLEARCOATMAP
874		material.clearcoat *= texture2D( clearcoatMap, vUv ).x;
875	#endif
876	#ifdef USE_CLEARCOAT_ROUGHNESSMAP
877		material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y;
878	#endif
879	material.clearcoat = saturate( material.clearcoat );	material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );
880	material.clearcoatRoughness += geometryRoughness;
881	material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );
882#endif
883#ifdef USE_IRIDESCENCE
884	material.iridescence = iridescence;
885	material.iridescenceIOR = iridescenceIOR;
886	#ifdef USE_IRIDESCENCEMAP
887		material.iridescence *= texture2D( iridescenceMap, vUv ).r;
888	#endif
889	#ifdef USE_IRIDESCENCE_THICKNESSMAP
890		material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vUv ).g + iridescenceThicknessMinimum;
891	#else
892		material.iridescenceThickness = iridescenceThicknessMaximum;
893	#endif
894#endif
895#ifdef USE_SHEEN
896	material.sheenColor = sheenColor;
897	#ifdef USE_SHEENCOLORMAP
898		material.sheenColor *= texture2D( sheenColorMap, vUv ).rgb;
899	#endif
900	material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );
901	#ifdef USE_SHEENROUGHNESSMAP
902		material.sheenRoughness *= texture2D( sheenRoughnessMap, vUv ).a;
903	#endif
904#endif`,lights_physical_pars_fragment:`struct PhysicalMaterial {
905	vec3 diffuseColor;
906	float roughness;
907	vec3 specularColor;
908	float specularF90;
909	#ifdef USE_CLEARCOAT
910		float clearcoat;
911		float clearcoatRoughness;
912		vec3 clearcoatF0;
913		float clearcoatF90;
914	#endif
915	#ifdef USE_IRIDESCENCE
916		float iridescence;
917		float iridescenceIOR;
918		float iridescenceThickness;
919		vec3 iridescenceFresnel;
920		vec3 iridescenceF0;
921	#endif
922	#ifdef USE_SHEEN
923		vec3 sheenColor;
924		float sheenRoughness;
925	#endif
926	#ifdef IOR
927		float ior;
928	#endif
929	#ifdef USE_TRANSMISSION
930		float transmission;
931		float transmissionAlpha;
932		float thickness;
933		float attenuationDistance;
934		vec3 attenuationColor;
935	#endif
936};
937vec3 clearcoatSpecular = vec3( 0.0 );
938vec3 sheenSpecular = vec3( 0.0 );
939float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
940	float dotNV = saturate( dot( normal, viewDir ) );
941	float r2 = roughness * roughness;
942	float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;
943	float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;
944	float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );
945	return saturate( DG * RECIPROCAL_PI );
946}
947vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
948	float dotNV = saturate( dot( normal, viewDir ) );
949	const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );
950	const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );
951	vec4 r = roughness * c0 + c1;
952	float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;
953	vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;
954	return fab;
955}
956vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {
957	vec2 fab = DFGApprox( normal, viewDir, roughness );
958	return specularColor * fab.x + specularF90 * fab.y;
959}
960#ifdef USE_IRIDESCENCE
961void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
962#else
963void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
964#endif
965	vec2 fab = DFGApprox( normal, viewDir, roughness );
966	#ifdef USE_IRIDESCENCE
967		vec3 Fr = mix( specularColor, iridescenceF0, iridescence );
968	#else
969		vec3 Fr = specularColor;
970	#endif
971	vec3 FssEss = Fr * fab.x + specularF90 * fab.y;
972	float Ess = fab.x + fab.y;
973	float Ems = 1.0 - Ess;
974	vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;	vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );
975	singleScatter += FssEss;
976	multiScatter += Fms * Ems;
977}
978#if NUM_RECT_AREA_LIGHTS > 0
979	void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
980		vec3 normal = geometry.normal;
981		vec3 viewDir = geometry.viewDir;
982		vec3 position = geometry.position;
983		vec3 lightPos = rectAreaLight.position;
984		vec3 halfWidth = rectAreaLight.halfWidth;
985		vec3 halfHeight = rectAreaLight.halfHeight;
986		vec3 lightColor = rectAreaLight.color;
987		float roughness = material.roughness;
988		vec3 rectCoords[ 4 ];
989		rectCoords[ 0 ] = lightPos + halfWidth - halfHeight;		rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;
990		rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;
991		rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;
992		vec2 uv = LTC_Uv( normal, viewDir, roughness );
993		vec4 t1 = texture2D( ltc_1, uv );
994		vec4 t2 = texture2D( ltc_2, uv );
995		mat3 mInv = mat3(
996			vec3( t1.x, 0, t1.y ),
997			vec3(    0, 1,    0 ),
998			vec3( t1.z, 0, t1.w )
999		);
1000		vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );
1001		reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );
1002		reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );
1003	}
1004#endif
1005void RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
1006	float dotNL = saturate( dot( geometry.normal, directLight.direction ) );
1007	vec3 irradiance = dotNL * directLight.color;
1008	#ifdef USE_CLEARCOAT
1009		float dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );
1010		vec3 ccIrradiance = dotNLcc * directLight.color;
1011		clearcoatSpecular += ccIrradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
1012	#endif
1013	#ifdef USE_SHEEN
1014		sheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness );
1015	#endif
1016	#ifdef USE_IRIDESCENCE
1017		reflectedLight.directSpecular += irradiance * BRDF_GGX_Iridescence( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness );
1018	#else
1019		reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.roughness );
1020	#endif
1021	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
1022}
1023void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
1024	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
1025}
1026void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {
1027	#ifdef USE_CLEARCOAT
1028		clearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
1029	#endif
1030	#ifdef USE_SHEEN
1031		sheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometry.normal, geometry.viewDir, material.sheenRoughness );
1032	#endif
1033	vec3 singleScattering = vec3( 0.0 );
1034	vec3 multiScattering = vec3( 0.0 );
1035	vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
1036	#ifdef USE_IRIDESCENCE
1037		computeMultiscatteringIridescence( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );
1038	#else
1039		computeMultiscattering( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );
1040	#endif
1041	vec3 totalScattering = singleScattering + multiScattering;
1042	vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );
1043	reflectedLight.indirectSpecular += radiance * singleScattering;
1044	reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;
1045	reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;
1046}
1047#define RE_Direct				RE_Direct_Physical
1048#define RE_Direct_RectArea		RE_Direct_RectArea_Physical
1049#define RE_IndirectDiffuse		RE_IndirectDiffuse_Physical
1050#define RE_IndirectSpecular		RE_IndirectSpecular_Physical
1051float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
1052	return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
1053}`,lights_fragment_begin:`
1054GeometricContext geometry;
1055geometry.position = - vViewPosition;
1056geometry.normal = normal;
1057geometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
1058#ifdef USE_CLEARCOAT
1059	geometry.clearcoatNormal = clearcoatNormal;
1060#endif
1061#ifdef USE_IRIDESCENCE
1062	float dotNVi = saturate( dot( normal, geometry.viewDir ) );
1063	if ( material.iridescenceThickness == 0.0 ) {
1064		material.iridescence = 0.0;
1065	} else {
1066		material.iridescence = saturate( material.iridescence );
1067	}
1068	if ( material.iridescence > 0.0 ) {
1069		material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );
1070		material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );
1071	}
1072#endif
1073IncidentLight directLight;
1074#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )
1075	PointLight pointLight;
1076	#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0
1077	PointLightShadow pointLightShadow;
1078	#endif
1079	#pragma unroll_loop_start
1080	for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
1081		pointLight = pointLights[ i ];
1082		getPointLightInfo( pointLight, geometry, directLight );
1083		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )
1084		pointLightShadow = pointLightShadows[ i ];
1085		directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
1086		#endif
1087		RE_Direct( directLight, geometry, material, reflectedLight );
1088	}
1089	#pragma unroll_loop_end
1090#endif
1091#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
1092	SpotLight spotLight;
1093	vec4 spotColor;
1094	vec3 spotLightCoord;
1095	bool inSpotLightMap;
1096	#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0
1097	SpotLightShadow spotLightShadow;
1098	#endif
1099	#pragma unroll_loop_start
1100	for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
1101		spotLight = spotLights[ i ];
1102		getSpotLightInfo( spotLight, geometry, directLight );
1103		#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
1104		#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX
1105		#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
1106		#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS
1107		#else
1108		#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
1109		#endif
1110		#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )
1111			spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;
1112			inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );
1113			spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );
1114			directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;
1115		#endif
1116		#undef SPOT_LIGHT_MAP_INDEX
1117		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
1118		spotLightShadow = spotLightShadows[ i ];
1119		directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
1120		#endif
1121		RE_Direct( directLight, geometry, material, reflectedLight );
1122	}
1123	#pragma unroll_loop_end
1124#endif
1125#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )
1126	DirectionalLight directionalLight;
1127	#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0
1128	DirectionalLightShadow directionalLightShadow;
1129	#endif
1130	#pragma unroll_loop_start
1131	for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
1132		directionalLight = directionalLights[ i ];
1133		getDirectionalLightInfo( directionalLight, geometry, directLight );
1134		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
1135		directionalLightShadow = directionalLightShadows[ i ];
1136		directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
1137		#endif
1138		RE_Direct( directLight, geometry, material, reflectedLight );
1139	}
1140	#pragma unroll_loop_end
1141#endif
1142#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )
1143	RectAreaLight rectAreaLight;
1144	#pragma unroll_loop_start
1145	for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
1146		rectAreaLight = rectAreaLights[ i ];
1147		RE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );
1148	}
1149	#pragma unroll_loop_end
1150#endif
1151#if defined( RE_IndirectDiffuse )
1152	vec3 iblIrradiance = vec3( 0.0 );
1153	vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
1154	irradiance += getLightProbeIrradiance( lightProbe, geometry.normal );
1155	#if ( NUM_HEMI_LIGHTS > 0 )
1156		#pragma unroll_loop_start
1157		for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
1158			irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );
1159		}
1160		#pragma unroll_loop_end
1161	#endif
1162#endif
1163#if defined( RE_IndirectSpecular )
1164	vec3 radiance = vec3( 0.0 );
1165	vec3 clearcoatRadiance = vec3( 0.0 );
1166#endif`,lights_fragment_maps:`#if defined( RE_IndirectDiffuse )
1167	#ifdef USE_LIGHTMAP
1168		vec4 lightMapTexel = texture2D( lightMap, vUv2 );
1169		vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
1170		irradiance += lightMapIrradiance;
1171	#endif
1172	#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )
1173		iblIrradiance += getIBLIrradiance( geometry.normal );
1174	#endif
1175#endif
1176#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
1177	radiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness );
1178	#ifdef USE_CLEARCOAT
1179		clearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness );
1180	#endif
1181#endif`,lights_fragment_end:`#if defined( RE_IndirectDiffuse )
1182	RE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );
1183#endif
1184#if defined( RE_IndirectSpecular )
1185	RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );
1186#endif`,logdepthbuf_fragment:`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )
1187	gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
1188#endif`,logdepthbuf_pars_fragment:`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )
1189	uniform float logDepthBufFC;
1190	varying float vFragDepth;
1191	varying float vIsPerspective;
1192#endif`,logdepthbuf_pars_vertex:`#ifdef USE_LOGDEPTHBUF
1193	#ifdef USE_LOGDEPTHBUF_EXT
1194		varying float vFragDepth;
1195		varying float vIsPerspective;
1196	#else
1197		uniform float logDepthBufFC;
1198	#endif
1199#endif`,logdepthbuf_vertex:`#ifdef USE_LOGDEPTHBUF
1200	#ifdef USE_LOGDEPTHBUF_EXT
1201		vFragDepth = 1.0 + gl_Position.w;
1202		vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
1203	#else
1204		if ( isPerspectiveMatrix( projectionMatrix ) ) {
1205			gl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;
1206			gl_Position.z *= gl_Position.w;
1207		}
1208	#endif
1209#endif`,map_fragment:`#ifdef USE_MAP
1210	vec4 sampledDiffuseColor = texture2D( map, vUv );
1211	#ifdef DECODE_VIDEO_TEXTURE
1212		sampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );
1213	#endif
1214	diffuseColor *= sampledDiffuseColor;
1215#endif`,map_pars_fragment:`#ifdef USE_MAP
1216	uniform sampler2D map;
1217#endif`,map_particle_fragment:`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
1218	vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;
1219#endif
1220#ifdef USE_MAP
1221	diffuseColor *= texture2D( map, uv );
1222#endif
1223#ifdef USE_ALPHAMAP
1224	diffuseColor.a *= texture2D( alphaMap, uv ).g;
1225#endif`,map_particle_pars_fragment:`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
1226	uniform mat3 uvTransform;
1227#endif
1228#ifdef USE_MAP
1229	uniform sampler2D map;
1230#endif
1231#ifdef USE_ALPHAMAP
1232	uniform sampler2D alphaMap;
1233#endif`,metalnessmap_fragment:`float metalnessFactor = metalness;
1234#ifdef USE_METALNESSMAP
1235	vec4 texelMetalness = texture2D( metalnessMap, vUv );
1236	metalnessFactor *= texelMetalness.b;
1237#endif`,metalnessmap_pars_fragment:`#ifdef USE_METALNESSMAP
1238	uniform sampler2D metalnessMap;
1239#endif`,morphcolor_vertex:`#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE )
1240	vColor *= morphTargetBaseInfluence;
1241	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1242		#if defined( USE_COLOR_ALPHA )
1243			if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];
1244		#elif defined( USE_COLOR )
1245			if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
1246		#endif
1247	}
1248#endif`,morphnormal_vertex:`#ifdef USE_MORPHNORMALS
1249	objectNormal *= morphTargetBaseInfluence;
1250	#ifdef MORPHTARGETS_TEXTURE
1251		for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1252			if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
1253		}
1254	#else
1255		objectNormal += morphNormal0 * morphTargetInfluences[ 0 ];
1256		objectNormal += morphNormal1 * morphTargetInfluences[ 1 ];
1257		objectNormal += morphNormal2 * morphTargetInfluences[ 2 ];
1258		objectNormal += morphNormal3 * morphTargetInfluences[ 3 ];
1259	#endif
1260#endif`,morphtarget_pars_vertex:`#ifdef USE_MORPHTARGETS
1261	uniform float morphTargetBaseInfluence;
1262	#ifdef MORPHTARGETS_TEXTURE
1263		uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
1264		uniform sampler2DArray morphTargetsTexture;
1265		uniform ivec2 morphTargetsTextureSize;
1266		vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {
1267			int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;
1268			int y = texelIndex / morphTargetsTextureSize.x;
1269			int x = texelIndex - y * morphTargetsTextureSize.x;
1270			ivec3 morphUV = ivec3( x, y, morphTargetIndex );
1271			return texelFetch( morphTargetsTexture, morphUV, 0 );
1272		}
1273	#else
1274		#ifndef USE_MORPHNORMALS
1275			uniform float morphTargetInfluences[ 8 ];
1276		#else
1277			uniform float morphTargetInfluences[ 4 ];
1278		#endif
1279	#endif
1280#endif`,morphtarget_vertex:`#ifdef USE_MORPHTARGETS
1281	transformed *= morphTargetBaseInfluence;
1282	#ifdef MORPHTARGETS_TEXTURE
1283		for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1284			if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
1285		}
1286	#else
1287		transformed += morphTarget0 * morphTargetInfluences[ 0 ];
1288		transformed += morphTarget1 * morphTargetInfluences[ 1 ];
1289		transformed += morphTarget2 * morphTargetInfluences[ 2 ];
1290		transformed += morphTarget3 * morphTargetInfluences[ 3 ];
1291		#ifndef USE_MORPHNORMALS
1292			transformed += morphTarget4 * morphTargetInfluences[ 4 ];
1293			transformed += morphTarget5 * morphTargetInfluences[ 5 ];
1294			transformed += morphTarget6 * morphTargetInfluences[ 6 ];
1295			transformed += morphTarget7 * morphTargetInfluences[ 7 ];
1296		#endif
1297	#endif
1298#endif`,normal_fragment_begin:`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
1299#ifdef FLAT_SHADED
1300	vec3 fdx = dFdx( vViewPosition );
1301	vec3 fdy = dFdy( vViewPosition );
1302	vec3 normal = normalize( cross( fdx, fdy ) );
1303#else
1304	vec3 normal = normalize( vNormal );
1305	#ifdef DOUBLE_SIDED
1306		normal = normal * faceDirection;
1307	#endif
1308	#ifdef USE_TANGENT
1309		vec3 tangent = normalize( vTangent );
1310		vec3 bitangent = normalize( vBitangent );
1311		#ifdef DOUBLE_SIDED
1312			tangent = tangent * faceDirection;
1313			bitangent = bitangent * faceDirection;
1314		#endif
1315		#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )
1316			mat3 vTBN = mat3( tangent, bitangent, normal );
1317		#endif
1318	#endif
1319#endif
1320vec3 geometryNormal = normal;`,normal_fragment_maps:`#ifdef OBJECTSPACE_NORMALMAP
1321	normal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;
1322	#ifdef FLIP_SIDED
1323		normal = - normal;
1324	#endif
1325	#ifdef DOUBLE_SIDED
1326		normal = normal * faceDirection;
1327	#endif
1328	normal = normalize( normalMatrix * normal );
1329#elif defined( TANGENTSPACE_NORMALMAP )
1330	vec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;
1331	mapN.xy *= normalScale;
1332	#ifdef USE_TANGENT
1333		normal = normalize( vTBN * mapN );
1334	#else
1335		normal = perturbNormal2Arb( - vViewPosition, normal, mapN, faceDirection );
1336	#endif
1337#elif defined( USE_BUMPMAP )
1338	normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
1339#endif`,normal_pars_fragment:`#ifndef FLAT_SHADED
1340	varying vec3 vNormal;
1341	#ifdef USE_TANGENT
1342		varying vec3 vTangent;
1343		varying vec3 vBitangent;
1344	#endif
1345#endif`,normal_pars_vertex:`#ifndef FLAT_SHADED
1346	varying vec3 vNormal;
1347	#ifdef USE_TANGENT
1348		varying vec3 vTangent;
1349		varying vec3 vBitangent;
1350	#endif
1351#endif`,normal_vertex:`#ifndef FLAT_SHADED
1352	vNormal = normalize( transformedNormal );
1353	#ifdef USE_TANGENT
1354		vTangent = normalize( transformedTangent );
1355		vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
1356	#endif
1357#endif`,normalmap_pars_fragment:`#ifdef USE_NORMALMAP
1358	uniform sampler2D normalMap;
1359	uniform vec2 normalScale;
1360#endif
1361#ifdef OBJECTSPACE_NORMALMAP
1362	uniform mat3 normalMatrix;
1363#endif
1364#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )
1365	vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection ) {
1366		vec3 q0 = dFdx( eye_pos.xyz );
1367		vec3 q1 = dFdy( eye_pos.xyz );
1368		vec2 st0 = dFdx( vUv.st );
1369		vec2 st1 = dFdy( vUv.st );
1370		vec3 N = surf_norm;
1371		vec3 q1perp = cross( q1, N );
1372		vec3 q0perp = cross( N, q0 );
1373		vec3 T = q1perp * st0.x + q0perp * st1.x;
1374		vec3 B = q1perp * st0.y + q0perp * st1.y;
1375		float det = max( dot( T, T ), dot( B, B ) );
1376		float scale = ( det == 0.0 ) ? 0.0 : faceDirection * inversesqrt( det );
1377		return normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z );
1378	}
1379#endif`,clearcoat_normal_fragment_begin:`#ifdef USE_CLEARCOAT
1380	vec3 clearcoatNormal = geometryNormal;
1381#endif`,clearcoat_normal_fragment_maps:`#ifdef USE_CLEARCOAT_NORMALMAP
1382	vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;
1383	clearcoatMapN.xy *= clearcoatNormalScale;
1384	#ifdef USE_TANGENT
1385		clearcoatNormal = normalize( vTBN * clearcoatMapN );
1386	#else
1387		clearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN, faceDirection );
1388	#endif
1389#endif`,clearcoat_pars_fragment:`#ifdef USE_CLEARCOATMAP
1390	uniform sampler2D clearcoatMap;
1391#endif
1392#ifdef USE_CLEARCOAT_ROUGHNESSMAP
1393	uniform sampler2D clearcoatRoughnessMap;
1394#endif
1395#ifdef USE_CLEARCOAT_NORMALMAP
1396	uniform sampler2D clearcoatNormalMap;
1397	uniform vec2 clearcoatNormalScale;
1398#endif`,iridescence_pars_fragment:`#ifdef USE_IRIDESCENCEMAP
1399	uniform sampler2D iridescenceMap;
1400#endif
1401#ifdef USE_IRIDESCENCE_THICKNESSMAP
1402	uniform sampler2D iridescenceThicknessMap;
1403#endif`,output_fragment:`#ifdef OPAQUE
1404diffuseColor.a = 1.0;
1405#endif
1406#ifdef USE_TRANSMISSION
1407diffuseColor.a *= material.transmissionAlpha + 0.1;
1408#endif
1409gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,packing:`vec3 packNormalToRGB( const in vec3 normal ) {
1410	return normalize( normal ) * 0.5 + 0.5;
1411}
1412vec3 unpackRGBToNormal( const in vec3 rgb ) {
1413	return 2.0 * rgb.xyz - 1.0;
1414}
1415const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;
1416const vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );
1417const vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );
1418const float ShiftRight8 = 1. / 256.;
1419vec4 packDepthToRGBA( const in float v ) {
1420	vec4 r = vec4( fract( v * PackFactors ), v );
1421	r.yzw -= r.xyz * ShiftRight8;	return r * PackUpscale;
1422}
1423float unpackRGBAToDepth( const in vec4 v ) {
1424	return dot( v, UnpackFactors );
1425}
1426vec2 packDepthToRG( in highp float v ) {
1427	return packDepthToRGBA( v ).yx;
1428}
1429float unpackRGToDepth( const in highp vec2 v ) {
1430	return unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) );
1431}
1432vec4 pack2HalfToRGBA( vec2 v ) {
1433	vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );
1434	return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );
1435}
1436vec2 unpackRGBATo2Half( vec4 v ) {
1437	return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );
1438}
1439float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {
1440	return ( viewZ + near ) / ( near - far );
1441}
1442float orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {
1443	return linearClipZ * ( near - far ) - near;
1444}
1445float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {
1446	return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );
1447}
1448float perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {
1449	return ( near * far ) / ( ( far - near ) * invClipZ - far );
1450}`,premultiplied_alpha_fragment:`#ifdef PREMULTIPLIED_ALPHA
1451	gl_FragColor.rgb *= gl_FragColor.a;
1452#endif`,project_vertex:`vec4 mvPosition = vec4( transformed, 1.0 );
1453#ifdef USE_INSTANCING
1454	mvPosition = instanceMatrix * mvPosition;
1455#endif
1456mvPosition = modelViewMatrix * mvPosition;
1457gl_Position = projectionMatrix * mvPosition;`,dithering_fragment:`#ifdef DITHERING
1458	gl_FragColor.rgb = dithering( gl_FragColor.rgb );
1459#endif`,dithering_pars_fragment:`#ifdef DITHERING
1460	vec3 dithering( vec3 color ) {
1461		float grid_position = rand( gl_FragCoord.xy );
1462		vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
1463		dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
1464		return color + dither_shift_RGB;
1465	}
1466#endif`,roughnessmap_fragment:`float roughnessFactor = roughness;
1467#ifdef USE_ROUGHNESSMAP
1468	vec4 texelRoughness = texture2D( roughnessMap, vUv );
1469	roughnessFactor *= texelRoughness.g;
1470#endif`,roughnessmap_pars_fragment:`#ifdef USE_ROUGHNESSMAP
1471	uniform sampler2D roughnessMap;
1472#endif`,shadowmap_pars_fragment:`#if NUM_SPOT_LIGHT_COORDS > 0
1473  varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
1474#endif
1475#if NUM_SPOT_LIGHT_MAPS > 0
1476  uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];
1477#endif
1478#ifdef USE_SHADOWMAP
1479	#if NUM_DIR_LIGHT_SHADOWS > 0
1480		uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
1481		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
1482		struct DirectionalLightShadow {
1483			float shadowBias;
1484			float shadowNormalBias;
1485			float shadowRadius;
1486			vec2 shadowMapSize;
1487		};
1488		uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
1489	#endif
1490	#if NUM_SPOT_LIGHT_SHADOWS > 0
1491		uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
1492		struct SpotLightShadow {
1493			float shadowBias;
1494			float shadowNormalBias;
1495			float shadowRadius;
1496			vec2 shadowMapSize;
1497		};
1498		uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
1499	#endif
1500	#if NUM_POINT_LIGHT_SHADOWS > 0
1501		uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
1502		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
1503		struct PointLightShadow {
1504			float shadowBias;
1505			float shadowNormalBias;
1506			float shadowRadius;
1507			vec2 shadowMapSize;
1508			float shadowCameraNear;
1509			float shadowCameraFar;
1510		};
1511		uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
1512	#endif
1513	float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {
1514		return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );
1515	}
1516	vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {
1517		return unpackRGBATo2Half( texture2D( shadow, uv ) );
1518	}
1519	float VSMShadow (sampler2D shadow, vec2 uv, float compare ){
1520		float occlusion = 1.0;
1521		vec2 distribution = texture2DDistribution( shadow, uv );
1522		float hard_shadow = step( compare , distribution.x );
1523		if (hard_shadow != 1.0 ) {
1524			float distance = compare - distribution.x ;
1525			float variance = max( 0.00000, distribution.y * distribution.y );
1526			float softness_probability = variance / (variance + distance * distance );			softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );			occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );
1527		}
1528		return occlusion;
1529	}
1530	float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
1531		float shadow = 1.0;
1532		shadowCoord.xyz /= shadowCoord.w;
1533		shadowCoord.z += shadowBias;
1534		bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
1535		bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
1536		if ( frustumTest ) {
1537		#if defined( SHADOWMAP_TYPE_PCF )
1538			vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
1539			float dx0 = - texelSize.x * shadowRadius;
1540			float dy0 = - texelSize.y * shadowRadius;
1541			float dx1 = + texelSize.x * shadowRadius;
1542			float dy1 = + texelSize.y * shadowRadius;
1543			float dx2 = dx0 / 2.0;
1544			float dy2 = dy0 / 2.0;
1545			float dx3 = dx1 / 2.0;
1546			float dy3 = dy1 / 2.0;
1547			shadow = (
1548				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +
1549				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +
1550				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +
1551				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +
1552				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +
1553				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +
1554				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +
1555				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +
1556				texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +
1557				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +
1558				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +
1559				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +
1560				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +
1561				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +
1562				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +
1563				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +
1564				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )
1565			) * ( 1.0 / 17.0 );
1566		#elif defined( SHADOWMAP_TYPE_PCF_SOFT )
1567			vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
1568			float dx = texelSize.x;
1569			float dy = texelSize.y;
1570			vec2 uv = shadowCoord.xy;
1571			vec2 f = fract( uv * shadowMapSize + 0.5 );
1572			uv -= f * texelSize;
1573			shadow = (
1574				texture2DCompare( shadowMap, uv, shadowCoord.z ) +
1575				texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +
1576				texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +
1577				texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +
1578				mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),
1579					 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),
1580					 f.x ) +
1581				mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),
1582					 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),
1583					 f.x ) +
1584				mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),
1585					 texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),
1586					 f.y ) +
1587				mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),
1588					 texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),
1589					 f.y ) +
1590				mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),
1591						  texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),
1592						  f.x ),
1593					 mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),
1594						  texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),
1595						  f.x ),
1596					 f.y )
1597			) * ( 1.0 / 9.0 );
1598		#elif defined( SHADOWMAP_TYPE_VSM )
1599			shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );
1600		#else
1601			shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );
1602		#endif
1603		}
1604		return shadow;
1605	}
1606	vec2 cubeToUV( vec3 v, float texelSizeY ) {
1607		vec3 absV = abs( v );
1608		float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );
1609		absV *= scaleToCube;
1610		v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );
1611		vec2 planar = v.xy;
1612		float almostATexel = 1.5 * texelSizeY;
1613		float almostOne = 1.0 - almostATexel;
1614		if ( absV.z >= almostOne ) {
1615			if ( v.z > 0.0 )
1616				planar.x = 4.0 - v.x;
1617		} else if ( absV.x >= almostOne ) {
1618			float signX = sign( v.x );
1619			planar.x = v.z * signX + 2.0 * signX;
1620		} else if ( absV.y >= almostOne ) {
1621			float signY = sign( v.y );
1622			planar.x = v.x + 2.0 * signY + 2.0;
1623			planar.y = v.z * signY - 2.0;
1624		}
1625		return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );
1626	}
1627	float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
1628		vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );
1629		vec3 lightToPosition = shadowCoord.xyz;
1630		float dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );		dp += shadowBias;
1631		vec3 bd3D = normalize( lightToPosition );
1632		#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )
1633			vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;
1634			return (
1635				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +
1636				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +
1637				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +
1638				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +
1639				texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +
1640				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +
1641				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +
1642				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +
1643				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )
1644			) * ( 1.0 / 9.0 );
1645		#else
1646			return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );
1647		#endif
1648	}
1649#endif`,shadowmap_pars_vertex:`#if NUM_SPOT_LIGHT_COORDS > 0
1650  uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
1651  varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
1652#endif
1653#ifdef USE_SHADOWMAP
1654	#if NUM_DIR_LIGHT_SHADOWS > 0
1655		uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];
1656		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
1657		struct DirectionalLightShadow {
1658			float shadowBias;
1659			float shadowNormalBias;
1660			float shadowRadius;
1661			vec2 shadowMapSize;
1662		};
1663		uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
1664	#endif
1665	#if NUM_SPOT_LIGHT_SHADOWS > 0
1666		struct SpotLightShadow {
1667			float shadowBias;
1668			float shadowNormalBias;
1669			float shadowRadius;
1670			vec2 shadowMapSize;
1671		};
1672		uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
1673	#endif
1674	#if NUM_POINT_LIGHT_SHADOWS > 0
1675		uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];
1676		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
1677		struct PointLightShadow {
1678			float shadowBias;
1679			float shadowNormalBias;
1680			float shadowRadius;
1681			vec2 shadowMapSize;
1682			float shadowCameraNear;
1683			float shadowCameraFar;
1684		};
1685		uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
1686	#endif
1687#endif`,shadowmap_vertex:`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
1688	vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
1689	vec4 shadowWorldPosition;
1690#endif
1691#if defined( USE_SHADOWMAP )
1692	#if NUM_DIR_LIGHT_SHADOWS > 0
1693		#pragma unroll_loop_start
1694		for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
1695			shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );
1696			vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;
1697		}
1698		#pragma unroll_loop_end
1699	#endif
1700	#if NUM_POINT_LIGHT_SHADOWS > 0
1701		#pragma unroll_loop_start
1702		for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
1703			shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );
1704			vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;
1705		}
1706		#pragma unroll_loop_end
1707	#endif
1708#endif
1709#if NUM_SPOT_LIGHT_COORDS > 0
1710	#pragma unroll_loop_start
1711	for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {
1712		shadowWorldPosition = worldPosition;
1713		#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
1714			shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;
1715		#endif
1716		vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
1717	}
1718	#pragma unroll_loop_end
1719#endif`,shadowmask_pars_fragment:`float getShadowMask() {
1720	float shadow = 1.0;
1721	#ifdef USE_SHADOWMAP
1722	#if NUM_DIR_LIGHT_SHADOWS > 0
1723	DirectionalLightShadow directionalLight;
1724	#pragma unroll_loop_start
1725	for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
1726		directionalLight = directionalLightShadows[ i ];
1727		shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
1728	}
1729	#pragma unroll_loop_end
1730	#endif
1731	#if NUM_SPOT_LIGHT_SHADOWS > 0
1732	SpotLightShadow spotLight;
1733	#pragma unroll_loop_start
1734	for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
1735		spotLight = spotLightShadows[ i ];
1736		shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
1737	}
1738	#pragma unroll_loop_end
1739	#endif
1740	#if NUM_POINT_LIGHT_SHADOWS > 0
1741	PointLightShadow pointLight;
1742	#pragma unroll_loop_start
1743	for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
1744		pointLight = pointLightShadows[ i ];
1745		shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
1746	}
1747	#pragma unroll_loop_end
1748	#endif
1749	#endif
1750	return shadow;
1751}`,skinbase_vertex:`#ifdef USE_SKINNING
1752	mat4 boneMatX = getBoneMatrix( skinIndex.x );
1753	mat4 boneMatY = getBoneMatrix( skinIndex.y );
1754	mat4 boneMatZ = getBoneMatrix( skinIndex.z );
1755	mat4 boneMatW = getBoneMatrix( skinIndex.w );
1756#endif`,skinning_pars_vertex:`#ifdef USE_SKINNING
1757	uniform mat4 bindMatrix;
1758	uniform mat4 bindMatrixInverse;
1759	uniform highp sampler2D boneTexture;
1760	uniform int boneTextureSize;
1761	mat4 getBoneMatrix( const in float i ) {
1762		float j = i * 4.0;
1763		float x = mod( j, float( boneTextureSize ) );
1764		float y = floor( j / float( boneTextureSize ) );
1765		float dx = 1.0 / float( boneTextureSize );
1766		float dy = 1.0 / float( boneTextureSize );
1767		y = dy * ( y + 0.5 );
1768		vec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );
1769		vec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );
1770		vec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );
1771		vec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );
1772		mat4 bone = mat4( v1, v2, v3, v4 );
1773		return bone;
1774	}
1775#endif`,skinning_vertex:`#ifdef USE_SKINNING
1776	vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
1777	vec4 skinned = vec4( 0.0 );
1778	skinned += boneMatX * skinVertex * skinWeight.x;
1779	skinned += boneMatY * skinVertex * skinWeight.y;
1780	skinned += boneMatZ * skinVertex * skinWeight.z;
1781	skinned += boneMatW * skinVertex * skinWeight.w;
1782	transformed = ( bindMatrixInverse * skinned ).xyz;
1783#endif`,skinnormal_vertex:`#ifdef USE_SKINNING
1784	mat4 skinMatrix = mat4( 0.0 );
1785	skinMatrix += skinWeight.x * boneMatX;
1786	skinMatrix += skinWeight.y * boneMatY;
1787	skinMatrix += skinWeight.z * boneMatZ;
1788	skinMatrix += skinWeight.w * boneMatW;
1789	skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
1790	objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;
1791	#ifdef USE_TANGENT
1792		objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
1793	#endif
1794#endif`,specularmap_fragment:`float specularStrength;
1795#ifdef USE_SPECULARMAP
1796	vec4 texelSpecular = texture2D( specularMap, vUv );
1797	specularStrength = texelSpecular.r;
1798#else
1799	specularStrength = 1.0;
1800#endif`,specularmap_pars_fragment:`#ifdef USE_SPECULARMAP
1801	uniform sampler2D specularMap;
1802#endif`,tonemapping_fragment:`#if defined( TONE_MAPPING )
1803	gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
1804#endif`,tonemapping_pars_fragment:`#ifndef saturate
1805#define saturate( a ) clamp( a, 0.0, 1.0 )
1806#endif
1807uniform float toneMappingExposure;
1808vec3 LinearToneMapping( vec3 color ) {
1809	return toneMappingExposure * color;
1810}
1811vec3 ReinhardToneMapping( vec3 color ) {
1812	color *= toneMappingExposure;
1813	return saturate( color / ( vec3( 1.0 ) + color ) );
1814}
1815vec3 OptimizedCineonToneMapping( vec3 color ) {
1816	color *= toneMappingExposure;
1817	color = max( vec3( 0.0 ), color - 0.004 );
1818	return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );
1819}
1820vec3 RRTAndODTFit( vec3 v ) {
1821	vec3 a = v * ( v + 0.0245786 ) - 0.000090537;
1822	vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;
1823	return a / b;
1824}
1825vec3 ACESFilmicToneMapping( vec3 color ) {
1826	const mat3 ACESInputMat = mat3(
1827		vec3( 0.59719, 0.07600, 0.02840 ),		vec3( 0.35458, 0.90834, 0.13383 ),
1828		vec3( 0.04823, 0.01566, 0.83777 )
1829	);
1830	const mat3 ACESOutputMat = mat3(
1831		vec3(  1.60475, -0.10208, -0.00327 ),		vec3( -0.53108,  1.10813, -0.07276 ),
1832		vec3( -0.07367, -0.00605,  1.07602 )
1833	);
1834	color *= toneMappingExposure / 0.6;
1835	color = ACESInputMat * color;
1836	color = RRTAndODTFit( color );
1837	color = ACESOutputMat * color;
1838	return saturate( color );
1839}
1840vec3 CustomToneMapping( vec3 color ) { return color; }`,transmission_fragment:`#ifdef USE_TRANSMISSION
1841	material.transmission = transmission;
1842	material.transmissionAlpha = 1.0;
1843	material.thickness = thickness;
1844	material.attenuationDistance = attenuationDistance;
1845	material.attenuationColor = attenuationColor;
1846	#ifdef USE_TRANSMISSIONMAP
1847		material.transmission *= texture2D( transmissionMap, vUv ).r;
1848	#endif
1849	#ifdef USE_THICKNESSMAP
1850		material.thickness *= texture2D( thicknessMap, vUv ).g;
1851	#endif
1852	vec3 pos = vWorldPosition;
1853	vec3 v = normalize( cameraPosition - pos );
1854	vec3 n = inverseTransformDirection( normal, viewMatrix );
1855	vec4 transmission = getIBLVolumeRefraction(
1856		n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,
1857		pos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness,
1858		material.attenuationColor, material.attenuationDistance );
1859	material.transmissionAlpha = mix( material.transmissionAlpha, transmission.a, material.transmission );
1860	totalDiffuse = mix( totalDiffuse, transmission.rgb, material.transmission );
1861#endif`,transmission_pars_fragment:`#ifdef USE_TRANSMISSION
1862	uniform float transmission;
1863	uniform float thickness;
1864	uniform float attenuationDistance;
1865	uniform vec3 attenuationColor;
1866	#ifdef USE_TRANSMISSIONMAP
1867		uniform sampler2D transmissionMap;
1868	#endif
1869	#ifdef USE_THICKNESSMAP
1870		uniform sampler2D thicknessMap;
1871	#endif
1872	uniform vec2 transmissionSamplerSize;
1873	uniform sampler2D transmissionSamplerMap;
1874	uniform mat4 modelMatrix;
1875	uniform mat4 projectionMatrix;
1876	varying vec3 vWorldPosition;
1877	vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {
1878		vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );
1879		vec3 modelScale;
1880		modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );
1881		modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );
1882		modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );
1883		return normalize( refractionVector ) * thickness * modelScale;
1884	}
1885	float applyIorToRoughness( const in float roughness, const in float ior ) {
1886		return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );
1887	}
1888	vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {
1889		float framebufferLod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );
1890		#ifdef texture2DLodEXT
1891			return texture2DLodEXT( transmissionSamplerMap, fragCoord.xy, framebufferLod );
1892		#else
1893			return texture2D( transmissionSamplerMap, fragCoord.xy, framebufferLod );
1894		#endif
1895	}
1896	vec3 applyVolumeAttenuation( const in vec3 radiance, const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {
1897		if ( isinf( attenuationDistance ) ) {
1898			return radiance;
1899		} else {
1900			vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;
1901			vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );			return transmittance * radiance;
1902		}
1903	}
1904	vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,
1905		const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,
1906		const in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,
1907		const in vec3 attenuationColor, const in float attenuationDistance ) {
1908		vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );
1909		vec3 refractedRayExit = position + transmissionRay;
1910		vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
1911		vec2 refractionCoords = ndcPos.xy / ndcPos.w;
1912		refractionCoords += 1.0;
1913		refractionCoords /= 2.0;
1914		vec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );
1915		vec3 attenuatedColor = applyVolumeAttenuation( transmittedLight.rgb, length( transmissionRay ), attenuationColor, attenuationDistance );
1916		vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );
1917		return vec4( ( 1.0 - F ) * attenuatedColor * diffuseColor, transmittedLight.a );
1918	}
1919#endif`,uv_pars_fragment:`#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )
1920	varying vec2 vUv;
1921#endif`,uv_pars_vertex:`#ifdef USE_UV
1922	#ifdef UVS_VERTEX_ONLY
1923		vec2 vUv;
1924	#else
1925		varying vec2 vUv;
1926	#endif
1927	uniform mat3 uvTransform;
1928#endif`,uv_vertex:`#ifdef USE_UV
1929	vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
1930#endif`,uv2_pars_fragment:`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )
1931	varying vec2 vUv2;
1932#endif`,uv2_pars_vertex:`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )
1933	attribute vec2 uv2;
1934	varying vec2 vUv2;
1935	uniform mat3 uv2Transform;
1936#endif`,uv2_vertex:`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )
1937	vUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;
1938#endif`,worldpos_vertex:`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_L
1938IGHT_COORDS > 0
1939	vec4 worldPosition = vec4( transformed, 1.0 );
1940	#ifdef USE_INSTANCING
1941		worldPosition = instanceMatrix * worldPosition;
1942	#endif
1943	worldPosition = modelMatrix * worldPosition;
1944#endif`,background_vert:`varying vec2 vUv;
1945uniform mat3 uvTransform;
1946void main() {
1947	vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
1948	gl_Position = vec4( position.xy, 1.0, 1.0 );
1949}`,background_frag:`uniform sampler2D t2D;
1950uniform float backgroundIntensity;
1951varying vec2 vUv;
1952void main() {
1953	vec4 texColor = texture2D( t2D, vUv );
1954	#ifdef DECODE_VIDEO_TEXTURE
1955		texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );
1956	#endif
1957	texColor.rgb *= backgroundIntensity;
1958	gl_FragColor = texColor;
1959	#include <tonemapping_fragment>
1960	#include <encodings_fragment>
1961}`,backgroundCube_vert:`varying vec3 vWorldDirection;
1962#include <common>
1963void main() {
1964	vWorldDirection = transformDirection( position, modelMatrix );
1965	#include <begin_vertex>
1966	#include <project_vertex>
1967	gl_Position.z = gl_Position.w;
1968}`,backgroundCube_frag:`#ifdef ENVMAP_TYPE_CUBE
1969	uniform samplerCube envMap;
1970#elif defined( ENVMAP_TYPE_CUBE_UV )
1971	uniform sampler2D envMap;
1972#endif
1973uniform float flipEnvMap;
1974uniform float backgroundBlurriness;
1975uniform float backgroundIntensity;
1976varying vec3 vWorldDirection;
1977#include <cube_uv_reflection_fragment>
1978void main() {
1979	#ifdef ENVMAP_TYPE_CUBE
1980		vec4 texColor = textureCube( envMap, vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );
1981	#elif defined( ENVMAP_TYPE_CUBE_UV )
1982		vec4 texColor = textureCubeUV( envMap, vWorldDirection, backgroundBlurriness );
1983	#else
1984		vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );
1985	#endif
1986	texColor.rgb *= backgroundIntensity;
1987	gl_FragColor = texColor;
1988	#include <tonemapping_fragment>
1989	#include <encodings_fragment>
1990}`,cube_vert:`varying vec3 vWorldDirection;
1991#include <common>
1992void main() {
1993	vWorldDirection = transformDirection( position, modelMatrix );
1994	#include <begin_vertex>
1995	#include <project_vertex>
1996	gl_Position.z = gl_Position.w;
1997}`,cube_frag:`uniform samplerCube tCube;
1998uniform float tFlip;
1999uniform float opacity;
2000varying vec3 vWorldDirection;
2001void main() {
2002	vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );
2003	gl_FragColor = texColor;
2004	gl_FragColor.a *= opacity;
2005	#include <tonemapping_fragment>
2006	#include <encodings_fragment>
2007}`,depth_vert:`#include <common>
2008#include <uv_pars_vertex>
2009#include <displacementmap_pars_vertex>
2010#include <morphtarget_pars_vertex>
2011#include <skinning_pars_vertex>
2012#include <logdepthbuf_pars_vertex>
2013#include <clipping_planes_pars_vertex>
2014varying vec2 vHighPrecisionZW;
2015void main() {
2016	#include <uv_vertex>
2017	#include <skinbase_vertex>
2018	#ifdef USE_DISPLACEMENTMAP
2019		#include <beginnormal_vertex>
2020		#include <morphnormal_vertex>
2021		#include <skinnormal_vertex>
2022	#endif
2023	#include <begin_vertex>
2024	#include <morphtarget_vertex>
2025	#include <skinning_vertex>
2026	#include <displacementmap_vertex>
2027	#include <project_vertex>
2028	#include <logdepthbuf_vertex>
2029	#include <clipping_planes_vertex>
2030	vHighPrecisionZW = gl_Position.zw;
2031}`,depth_frag:`#if DEPTH_PACKING == 3200
2032	uniform float opacity;
2033#endif
2034#include <common>
2035#include <packing>
2036#include <uv_pars_fragment>
2037#include <map_pars_fragment>
2038#include <alphamap_pars_fragment>
2039#include <alphatest_pars_fragment>
2040#include <logdepthbuf_pars_fragment>
2041#include <clipping_planes_pars_fragment>
2042varying vec2 vHighPrecisionZW;
2043void main() {
2044	#include <clipping_planes_fragment>
2045	vec4 diffuseColor = vec4( 1.0 );
2046	#if DEPTH_PACKING == 3200
2047		diffuseColor.a = opacity;
2048	#endif
2049	#include <map_fragment>
2050	#include <alphamap_fragment>
2051	#include <alphatest_fragment>
2052	#include <logdepthbuf_fragment>
2053	float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;
2054	#if DEPTH_PACKING == 3200
2055		gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );
2056	#elif DEPTH_PACKING == 3201
2057		gl_FragColor = packDepthToRGBA( fragCoordZ );
2058	#endif
2059}`,distanceRGBA_vert:`#define DISTANCE
2060varying vec3 vWorldPosition;
2061#include <common>
2062#include <uv_pars_vertex>
2063#include <displacementmap_pars_vertex>
2064#include <morphtarget_pars_vertex>
2065#include <skinning_pars_vertex>
2066#include <clipping_planes_pars_vertex>
2067void main() {
2068	#include <uv_vertex>
2069	#include <skinbase_vertex>
2070	#ifdef USE_DISPLACEMENTMAP
2071		#include <beginnormal_vertex>
2072		#include <morphnormal_vertex>
2073		#include <skinnormal_vertex>
2074	#endif
2075	#include <begin_vertex>
2076	#include <morphtarget_vertex>
2077	#include <skinning_vertex>
2078	#include <displacementmap_vertex>
2079	#include <project_vertex>
2080	#include <worldpos_vertex>
2081	#include <clipping_planes_vertex>
2082	vWorldPosition = worldPosition.xyz;
2083}`,distanceRGBA_frag:`#define DISTANCE
2084uniform vec3 referencePosition;
2085uniform float nearDistance;
2086uniform float farDistance;
2087varying vec3 vWorldPosition;
2088#include <common>
2089#include <packing>
2090#include <uv_pars_fragment>
2091#include <map_pars_fragment>
2092#include <alphamap_pars_fragment>
2093#include <alphatest_pars_fragment>
2094#include <clipping_planes_pars_fragment>
2095void main () {
2096	#include <clipping_planes_fragment>
2097	vec4 diffuseColor = vec4( 1.0 );
2098	#include <map_fragment>
2099	#include <alphamap_fragment>
2100	#include <alphatest_fragment>
2101	float dist = length( vWorldPosition - referencePosition );
2102	dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
2103	dist = saturate( dist );
2104	gl_FragColor = packDepthToRGBA( dist );
2105}`,equirect_vert:`varying vec3 vWorldDirection;
2106#include <common>
2107void main() {
2108	vWorldDirection = transformDirection( position, modelMatrix );
2109	#include <begin_vertex>
2110	#include <project_vertex>
2111}`,equirect_frag:`uniform sampler2D tEquirect;
2112varying vec3 vWorldDirection;
2113#include <common>
2114void main() {
2115	vec3 direction = normalize( vWorldDirection );
2116	vec2 sampleUV = equirectUv( direction );
2117	gl_FragColor = texture2D( tEquirect, sampleUV );
2118	#include <tonemapping_fragment>
2119	#include <encodings_fragment>
2120}`,linedashed_vert:`uniform float scale;
2121attribute float lineDistance;
2122varying float vLineDistance;
2123#include <common>
2124#include <color_pars_vertex>
2125#include <fog_pars_vertex>
2126#include <morphtarget_pars_vertex>
2127#include <logdepthbuf_pars_vertex>
2128#include <clipping_planes_pars_vertex>
2129void main() {
2130	vLineDistance = scale * lineDistance;
2131	#include <color_vertex>
2132	#include <morphcolor_vertex>
2133	#include <begin_vertex>
2134	#include <morphtarget_vertex>
2135	#include <project_vertex>
2136	#include <logdepthbuf_vertex>
2137	#include <clipping_planes_vertex>
2138	#include <fog_vertex>
2139}`,linedashed_frag:`uniform vec3 diffuse;
2140uniform float opacity;
2141uniform float dashSize;
2142uniform float totalSize;
2143varying float vLineDistance;
2144#include <common>
2145#include <color_pars_fragment>
2146#include <fog_pars_fragment>
2147#include <logdepthbuf_pars_fragment>
2148#include <clipping_planes_pars_fragment>
2149void main() {
2150	#include <clipping_planes_fragment>
2151	if ( mod( vLineDistance, totalSize ) > dashSize ) {
2152		discard;
2153	}
2154	vec3 outgoingLight = vec3( 0.0 );
2155	vec4 diffuseColor = vec4( diffuse, opacity );
2156	#include <logdepthbuf_fragment>
2157	#include <color_fragment>
2158	outgoingLight = diffuseColor.rgb;
2159	#include <output_fragment>
2160	#include <tonemapping_fragment>
2161	#include <encodings_fragment>
2162	#include <fog_fragment>
2163	#include <premultiplied_alpha_fragment>
2164}`,meshbasic_vert:`#include <common>
2165#include <uv_pars_vertex>
2166#include <uv2_pars_vertex>
2167#include <envmap_pars_vertex>
2168#include <color_pars_vertex>
2169#include <fog_pars_vertex>
2170#include <morphtarget_pars_vertex>
2171#include <skinning_pars_vertex>
2172#include <logdepthbuf_pars_vertex>
2173#include <clipping_planes_pars_vertex>
2174void main() {
2175	#include <uv_vertex>
2176	#include <uv2_vertex>
2177	#include <color_vertex>
2178	#include <morphcolor_vertex>
2179	#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )
2180		#include <beginnormal_vertex>
2181		#include <morphnormal_vertex>
2182		#include <skinbase_vertex>
2183		#include <skinnormal_vertex>
2184		#include <defaultnormal_vertex>
2185	#endif
2186	#include <begin_vertex>
2187	#include <morphtarget_vertex>
2188	#include <skinning_vertex>
2189	#include <project_vertex>
2190	#include <logdepthbuf_vertex>
2191	#include <clipping_planes_vertex>
2192	#include <worldpos_vertex>
2193	#include <envmap_vertex>
2194	#include <fog_vertex>
2195}`,meshbasic_frag:`uniform vec3 diffuse;
2196uniform float opacity;
2197#ifndef FLAT_SHADED
2198	varying vec3 vNormal;
2199#endif
2200#include <common>
2201#include <dithering_pars_fragment>
2202#include <color_pars_fragment>
2203#include <uv_pars_fragment>
2204#include <uv2_pars_fragment>
2205#include <map_pars_fragment>
2206#include <alphamap_pars_fragment>
2207#include <alphatest_pars_fragment>
2208#include <aomap_pars_fragment>
2209#include <lightmap_pars_fragment>
2210#include <envmap_common_pars_fragment>
2211#include <envmap_pars_fragment>
2212#include <fog_pars_fragment>
2213#include <specularmap_pars_fragment>
2214#include <logdepthbuf_pars_fragment>
2215#include <clipping_planes_pars_fragment>
2216void main() {
2217	#include <clipping_planes_fragment>
2218	vec4 diffuseColor = vec4( diffuse, opacity );
2219	#include <logdepthbuf_fragment>
2220	#include <map_fragment>
2221	#include <color_fragment>
2222	#include <alphamap_fragment>
2223	#include <alphatest_fragment>
2224	#include <specularmap_fragment>
2225	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
2226	#ifdef USE_LIGHTMAP
2227		vec4 lightMapTexel = texture2D( lightMap, vUv2 );
2228		reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;
2229	#else
2230		reflectedLight.indirectDiffuse += vec3( 1.0 );
2231	#endif
2232	#include <aomap_fragment>
2233	reflectedLight.indirectDiffuse *= diffuseColor.rgb;
2234	vec3 outgoingLight = reflectedLight.indirectDiffuse;
2235	#include <envmap_fragment>
2236	#include <output_fragment>
2237	#include <tonemapping_fragment>
2238	#include <encodings_fragment>
2239	#include <fog_fragment>
2240	#include <premultiplied_alpha_fragment>
2241	#include <dithering_fragment>
2242}`,meshlambert_vert:`#define LAMBERT
2243varying vec3 vViewPosition;
2244#include <common>
2245#include <uv_pars_vertex>
2246#include <uv2_pars_vertex>
2247#include <displacementmap_pars_vertex>
2248#include <envmap_pars_vertex>
2249#include <color_pars_vertex>
2250#include <fog_pars_vertex>
2251#include <normal_pars_vertex>
2252#include <morphtarget_pars_vertex>
2253#include <skinning_pars_vertex>
2254#include <shadowmap_pars_vertex>
2255#include <logdepthbuf_pars_vertex>
2256#include <clipping_planes_pars_vertex>
2257void main() {
2258	#include <uv_vertex>
2259	#include <uv2_vertex>
2260	#include <color_vertex>
2261	#include <morphcolor_vertex>
2262	#include <beginnormal_vertex>
2263	#include <morphnormal_vertex>
2264	#include <skinbase_vertex>
2265	#include <skinnormal_vertex>
2266	#include <defaultnormal_vertex>
2267	#include <normal_vertex>
2268	#include <begin_vertex>
2269	#include <morphtarget_vertex>
2270	#include <skinning_vertex>
2271	#include <displacementmap_vertex>
2272	#include <project_vertex>
2273	#include <logdepthbuf_vertex>
2274	#include <clipping_planes_vertex>
2275	vViewPosition = - mvPosition.xyz;
2276	#include <worldpos_vertex>
2277	#include <envmap_vertex>
2278	#include <shadowmap_vertex>
2279	#include <fog_vertex>
2280}`,meshlambert_frag:`#define LAMBERT
2281uniform vec3 diffuse;
2282uniform vec3 emissive;
2283uniform float opacity;
2284#include <common>
2285#include <packing>
2286#include <dithering_pars_fragment>
2287#include <color_pars_fragment>
2288#include <uv_pars_fragment>
2289#include <uv2_pars_fragment>
2290#include <map_pars_fragment>
2291#include <alphamap_pars_fragment>
2292#include <alphatest_pars_fragment>
2293#include <aomap_pars_fragment>
2294#include <lightmap_pars_fragment>
2295#include <emissivemap_pars_fragment>
2296#include <envmap_common_pars_fragment>
2297#include <envmap_pars_fragment>
2298#include <fog_pars_fragment>
2299#include <bsdfs>
2300#include <lights_pars_begin>
2301#include <normal_pars_fragment>
2302#include <lights_lambert_pars_fragment>
2303#include <shadowmap_pars_fragment>
2304#include <bumpmap_pars_fragment>
2305#include <normalmap_pars_fragment>
2306#include <specularmap_pars_fragment>
2307#include <logdepthbuf_pars_fragment>
2308#include <clipping_planes_pars_fragment>
2309void main() {
2310	#include <clipping_planes_fragment>
2311	vec4 diffuseColor = vec4( diffuse, opacity );
2312	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
2313	vec3 totalEmissiveRadiance = emissive;
2314	#include <logdepthbuf_fragment>
2315	#include <map_fragment>
2316	#include <color_fragment>
2317	#include <alphamap_fragment>
2318	#include <alphatest_fragment>
2319	#include <specularmap_fragment>
2320	#include <normal_fragment_begin>
2321	#include <normal_fragment_maps>
2322	#include <emissivemap_fragment>
2323	#include <lights_lambert_fragment>
2324	#include <lights_fragment_begin>
2325	#include <lights_fragment_maps>
2326	#include <lights_fragment_end>
2327	#include <aomap_fragment>
2328	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
2329	#include <envmap_fragment>
2330	#include <output_fragment>
2331	#include <tonemapping_fragment>
2332	#include <encodings_fragment>
2333	#include <fog_fragment>
2334	#include <premultiplied_alpha_fragment>
2335	#include <dithering_fragment>
2336}`,meshmatcap_vert:`#define MATCAP
2337varying vec3 vViewPosition;
2338#include <common>
2339#include <uv_pars_vertex>
2340#include <color_pars_vertex>
2341#include <displacementmap_pars_vertex>
2342#include <fog_pars_vertex>
2343#include <normal_pars_vertex>
2344#include <morphtarget_pars_vertex>
2345#include <skinning_pars_vertex>
2346#include <logdepthbuf_pars_vertex>
2347#include <clipping_planes_pars_vertex>
2348void main() {
2349	#include <uv_vertex>
2350	#include <color_vertex>
2351	#include <morphcolor_vertex>
2352	#include <beginnormal_vertex>
2353	#include <morphnormal_vertex>
2354	#include <skinbase_vertex>
2355	#include <skinnormal_vertex>
2356	#include <defaultnormal_vertex>
2357	#include <normal_vertex>
2358	#include <begin_vertex>
2359	#include <morphtarget_vertex>
2360	#include <skinning_vertex>
2361	#include <displacementmap_vertex>
2362	#include <project_vertex>
2363	#include <logdepthbuf_vertex>
2364	#include <clipping_planes_vertex>
2365	#include <fog_vertex>
2366	vViewPosition = - mvPosition.xyz;
2367}`,meshmatcap_frag:`#define MATCAP
2368uniform vec3 diffuse;
2369uniform float opacity;
2370uniform sampler2D matcap;
2371varying vec3 vViewPosition;
2372#include <common>
2373#include <dithering_pars_fragment>
2374#include <color_pars_fragment>
2375#include <uv_pars_fragment>
2376#include <map_pars_fragment>
2377#include <alphamap_pars_fragment>
2378#include <alphatest_pars_fragment>
2379#include <fog_pars_fragment>
2380#include <normal_pars_fragment>
2381#include <bumpmap_pars_fragment>
2382#include <normalmap_pars_fragment>
2383#include <logdepthbuf_pars_fragment>
2384#include <clipping_planes_pars_fragment>
2385void main() {
2386	#include <clipping_planes_fragment>
2387	vec4 diffuseColor = vec4( diffuse, opacity );
2388	#include <logdepthbuf_fragment>
2389	#include <map_fragment>
2390	#include <color_fragment>
2391	#include <alphamap_fragment>
2392	#include <alphatest_fragment>
2393	#include <normal_fragment_begin>
2394	#include <normal_fragment_maps>
2395	vec3 viewDir = normalize( vViewPosition );
2396	vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
2397	vec3 y = cross( viewDir, x );
2398	vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;
2399	#ifdef USE_MATCAP
2400		vec4 matcapColor = texture2D( matcap, uv );
2401	#else
2402		vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );
2403	#endif
2404	vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;
2405	#include <output_fragment>
2406	#include <tonemapping_fragment>
2407	#include <encodings_fragment>
2408	#include <fog_fragment>
2409	#include <premultiplied_alpha_fragment>
2410	#include <dithering_fragment>
2411}`,meshnormal_vert:`#define NORMAL
2412#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )
2413	varying vec3 vViewPosition;
2414#endif
2415#include <common>
2416#include <uv_pars_vertex>
2417#include <displacementmap_pars_vertex>
2418#include <normal_pars_vertex>
2419#include <morphtarget_pars_vertex>
2420#include <skinning_pars_vertex>
2421#include <logdepthbuf_pars_vertex>
2422#include <clipping_planes_pars_vertex>
2423void main() {
2424	#include <uv_vertex>
2425	#include <beginnormal_vertex>
2426	#include <morphnormal_vertex>
2427	#include <skinbase_vertex>
2428	#include <skinnormal_vertex>
2429	#include <defaultnormal_vertex>
2430	#include <normal_vertex>
2431	#include <begin_vertex>
2432	#include <morphtarget_vertex>
2433	#include <skinning_vertex>
2434	#include <displacementmap_vertex>
2435	#include <project_vertex>
2436	#include <logdepthbuf_vertex>
2437	#include <clipping_planes_vertex>
2438#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )
2439	vViewPosition = - mvPosition.xyz;
2440#endif
2441}`,meshnormal_frag:`#define NORMAL
2442uniform float opacity;
2443#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )
2444	varying vec3 vViewPosition;
2445#endif
2446#include <packing>
2447#include <uv_pars_fragment>
2448#include <normal_pars_fragment>
2449#include <bumpmap_pars_fragment>
2450#include <normalmap_pars_fragment>
2451#include <logdepthbuf_pars_fragment>
2452#include <clipping_planes_pars_fragment>
2453void main() {
2454	#include <clipping_planes_fragment>
2455	#include <logdepthbuf_fragment>
2456	#include <normal_fragment_begin>
2457	#include <normal_fragment_maps>
2458	gl_FragColor = vec4( packNormalToRGB( normal ), opacity );
2459	#ifdef OPAQUE
2460		gl_FragColor.a = 1.0;
2461	#endif
2462}`,meshphong_vert:`#define PHONG
2463varying vec3 vViewPosition;
2464#include <common>
2465#include <uv_pars_vertex>
2466#include <uv2_pars_vertex>
2467#include <displacementmap_pars_vertex>
2468#include <envmap_pars_vertex>
2469#include <color_pars_vertex>
2470#include <fog_pars_vertex>
2471#include <normal_pars_vertex>
2472#include <morphtarget_pars_vertex>
2473#include <skinning_pars_vertex>
2474#include <shadowmap_pars_vertex>
2475#include <logdepthbuf_pars_vertex>
2476#include <clipping_planes_pars_vertex>
2477void main() {
2478	#include <uv_vertex>
2479	#include <uv2_vertex>
2480	#include <color_vertex>
2481	#include <morphcolor_vertex>
2482	#include <beginnormal_vertex>
2483	#include <morphnormal_vertex>
2484	#include <skinbase_vertex>
2485	#include <skinnormal_vertex>
2486	#include <defaultnormal_vertex>
2487	#include <normal_vertex>
2488	#include <begin_vertex>
2489	#include <morphtarget_vertex>
2490	#include <skinning_vertex>
2491	#include <displacementmap_vertex>
2492	#include <project_vertex>
2493	#include <logdepthbuf_vertex>
2494	#include <clipping_planes_vertex>
2495	vViewPosition = - mvPosition.xyz;
2496	#include <worldpos_vertex>
2497	#include <envmap_vertex>
2498	#include <shadowmap_vertex>
2499	#include <fog_vertex>
2500}`,meshphong_frag:`#define PHONG
2501uniform vec3 diffuse;
2502uniform vec3 emissive;
2503uniform vec3 specular;
2504uniform float shininess;
2505uniform float opacity;
2506#include <common>
2507#include <packing>
2508#include <dithering_pars_fragment>
2509#include <color_pars_fragment>
2510#include <uv_pars_fragment>
2511#include <uv2_pars_fragment>
2512#include <map_pars_fragment>
2513#include <alphamap_pars_fragment>
2514#include <alphatest_pars_fragment>
2515#include <aomap_pars_fragment>
2516#include <lightmap_pars_fragment>
2517#include <emissivemap_pars_fragment>
2518#include <envmap_common_pars_fragment>
2519#include <envmap_pars_fragment>
2520#include <fog_pars_fragment>
2521#include <bsdfs>
2522#include <lights_pars_begin>
2523#include <normal_pars_fragment>
2524#include <lights_phong_pars_fragment>
2525#include <shadowmap_pars_fragment>
2526#include <bumpmap_pars_fragment>
2527#include <normalmap_pars_fragment>
2528#include <specularmap_pars_fragment>
2529#include <logdepthbuf_pars_fragment>
2530#include <clipping_planes_pars_fragment>
2531void main() {
2532	#include <clipping_planes_fragment>
2533	vec4 diffuseColor = vec4( diffuse, opacity );
2534	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
2535	vec3 totalEmissiveRadiance = emissive;
2536	#include <logdepthbuf_fragment>
2537	#include <map_fragment>
2538	#include <color_fragment>
2539	#include <alphamap_fragment>
2540	#include <alphatest_fragment>
2541	#include <specularmap_fragment>
2542	#include <normal_fragment_begin>
2543	#include <normal_fragment_maps>
2544	#include <emissivemap_fragment>
2545	#include <lights_phong_fragment>
2546	#include <lights_fragment_begin>
2547	#include <lights_fragment_maps>
2548	#include <lights_fragment_end>
2549	#include <aomap_fragment>
2550	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
2551	#include <envmap_fragment>
2552	#include <output_fragment>
2553	#include <tonemapping_fragment>
2554	#include <encodings_fragment>
2555	#include <fog_fragment>
2556	#include <premultiplied_alpha_fragment>
2557	#include <dithering_fragment>
2558}`,meshphysical_vert:`#define STANDARD
2559varying vec3 vViewPosition;
2560#ifdef USE_TRANSMISSION
2561	varying vec3 vWorldPosition;
2562#endif
2563#include <common>
2564#include <uv_pars_vertex>
2565#include <uv2_pars_vertex>
2566#include <displacementmap_pars_vertex>
2567#include <color_pars_vertex>
2568#include <fog_pars_vertex>
2569#include <normal_pars_vertex>
2570#include <morphtarget_pars_vertex>
2571#include <skinning_pars_vertex>
2572#include <shadowmap_pars_vertex>
2573#include <logdepthbuf_pars_vertex>
2574#include <clipping_planes_pars_vertex>
2575void main() {
2576	#include <uv_vertex>
2577	#include <uv2_vertex>
2578	#include <color_vertex>
2579	#include <morphcolor_vertex>
2580	#include <beginnormal_vertex>
2581	#include <morphnormal_vertex>
2582	#include <skinbase_vertex>
2583	#include <skinnormal_vertex>
2584	#include <defaultnormal_vertex>
2585	#include <normal_vertex>
2586	#include <begin_vertex>
2587	#include <morphtarget_vertex>
2588	#include <skinning_vertex>
2589	#include <displacementmap_vertex>
2590	#include <project_vertex>
2591	#include <logdepthbuf_vertex>
2592	#include <clipping_planes_vertex>
2593	vViewPosition = - mvPosition.xyz;
2594	#include <worldpos_vertex>
2595	#include <shadowmap_vertex>
2596	#include <fog_vertex>
2597#ifdef USE_TRANSMISSION
2598	vWorldPosition = worldPosition.xyz;
2599#endif
2600}`,meshphysical_frag:`#define STANDARD
2601#ifdef PHYSICAL
2602	#define IOR
2603	#define SPECULAR
2604#endif
2605uniform vec3 diffuse;
2606uniform vec3 emissive;
2607uniform float roughness;
2608uniform float metalness;
2609uniform float opacity;
2610#ifdef IOR
2611	uniform float ior;
2612#endif
2613#ifdef SPECULAR
2614	uniform float specularIntensity;
2615	uniform vec3 specularColor;
2616	#ifdef USE_SPECULARINTENSITYMAP
2617		uniform sampler2D specularIntensityMap;
2618	#endif
2619	#ifdef USE_SPECULARCOLORMAP
2620		uniform sampler2D specularColorMap;
2621	#endif
2622#endif
2623#ifdef USE_CLEARCOAT
2624	uniform float clearcoat;
2625	uniform float clearcoatRoughness;
2626#endif
2627#ifdef USE_IRIDESCENCE
2628	uniform float iridescence;
2629	uniform float iridescenceIOR;
2630	uniform float iridescenceThicknessMinimum;
2631	uniform float iridescenceThicknessMaximum;
2632#endif
2633#ifdef USE_SHEEN
2634	uniform vec3 sheenColor;
2635	uniform float sheenRoughness;
2636	#ifdef USE_SHEENCOLORMAP
2637		uniform sampler2D sheenColorMap;
2638	#endif
2639	#ifdef USE_SHEENROUGHNESSMAP
2640		uniform sampler2D sheenRoughnessMap;
2641	#endif
2642#endif
2643varying vec3 vViewPosition;
2644#include <common>
2645#include <packing>
2646#include <dithering_pars_fragment>
2647#include <color_pars_fragment>
2648#include <uv_pars_fragment>
2649#include <uv2_pars_fragment>
2650#include <map_pars_fragment>
2651#include <alphamap_pars_fragment>
2652#include <alphatest_pars_fragment>
2653#include <aomap_pars_fragment>
2654#include <lightmap_pars_fragment>
2655#include <emissivemap_pars_fragment>
2656#include <bsdfs>
2657#include <iridescence_fragment>
2658#include <cube_uv_reflection_fragment>
2659#include <envmap_common_pars_fragment>
2660#include <envmap_physical_pars_fragment>
2661#include <fog_pars_fragment>
2662#include <lights_pars_begin>
2663#include <normal_pars_fragment>
2664#include <lights_physical_pars_fragment>
2665#include <transmission_pars_fragment>
2666#include <shadowmap_pars_fragment>
2667#include <bumpmap_pars_fragment>
2668#include <normalmap_pars_fragment>
2669#include <clearcoat_pars_fragment>
2670#include <iridescence_pars_fragment>
2671#include <roughnessmap_pars_fragment>
2672#include <metalnessmap_pars_fragment>
2673#include <logdepthbuf_pars_fragment>
2674#include <clipping_planes_pars_fragment>
2675void main() {
2676	#include <clipping_planes_fragment>
2677	vec4 diffuseColor = vec4( diffuse, opacity );
2678	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
2679	vec3 totalEmissiveRadiance = emissive;
2680	#include <logdepthbuf_fragment>
2681	#include <map_fragment>
2682	#include <color_fragment>
2683	#include <alphamap_fragment>
2684	#include <alphatest_fragment>
2685	#include <roughnessmap_fragment>
2686	#include <metalnessmap_fragment>
2687	#include <normal_fragment_begin>
2688	#include <normal_fragment_maps>
2689	#include <clearcoat_normal_fragment_begin>
2690	#include <clearcoat_normal_fragment_maps>
2691	#include <emissivemap_fragment>
2692	#include <lights_physical_fragment>
2693	#include <lights_fragment_begin>
2694	#include <lights_fragment_maps>
2695	#include <lights_fragment_end>
2696	#include <aomap_fragment>
2697	vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;
2698	vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;
2699	#include <transmission_fragment>
2700	vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;
2701	#ifdef USE_SHEEN
2702		float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );
2703		outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecular;
2704	#endif
2705	#ifdef USE_CLEARCOAT
2706		float dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );
2707		vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );
2708		outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat;
2709	#endif
2710	#include <output_fragment>
2711	#include <tonemapping_fragment>
2712	#include <encodings_fragment>
2713	#include <fog_fragment>
2714	#include <premultiplied_alpha_fragment>
2715	#include <dithering_fragment>
2716}`,meshtoon_vert:`#define TOON
2717varying vec3 vViewPosition;
2718#include <common>
2719#include <uv_pars_vertex>
2720#include <uv2_pars_vertex>
2721#include <displacementmap_pars_vertex>
2722#include <color_pars_vertex>
2723#include <fog_pars_vertex>
2724#include <normal_pars_vertex>
2725#include <morphtarget_pars_vertex>
2726#include <skinning_pars_vertex>
2727#include <shadowmap_pars_vertex>
2728#include <logdepthbuf_pars_vertex>
2729#include <clipping_planes_pars_vertex>
2730void main() {
2731	#include <uv_vertex>
2732	#include <uv2_vertex>
2733	#include <color_vertex>
2734	#include <morphcolor_vertex>
2735	#include <beginnormal_vertex>
2736	#include <morphnormal_vertex>
2737	#include <skinbase_vertex>
2738	#include <skinnormal_vertex>
2739	#include <defaultnormal_vertex>
2740	#include <normal_vertex>
2741	#include <begin_vertex>
2742	#include <morphtarget_vertex>
2743	#include <skinning_vertex>
2744	#include <displacementmap_vertex>
2745	#include <project_vertex>
2746	#include <logdepthbuf_vertex>
2747	#include <clipping_planes_vertex>
2748	vViewPosition = - mvPosition.xyz;
2749	#include <worldpos_vertex>
2750	#include <shadowmap_vertex>
2751	#include <fog_vertex>
2752}`,meshtoon_frag:`#define TOON
2753uniform vec3 diffuse;
2754uniform vec3 emissive;
2755uniform float opacity;
2756#include <common>
2757#include <packing>
2758#include <dithering_pars_fragment>
2759#include <color_pars_fragment>
2760#include <uv_pars_fragment>
2761#include <uv2_pars_fragment>
2762#include <map_pars_fragment>
2763#include <alphamap_pars_fragment>
2764#include <alphatest_pars_fragment>
2765#include <aomap_pars_fragment>
2766#include <lightmap_pars_fragment>
2767#include <emissivemap_pars_fragment>
2768#include <gradientmap_pars_fragment>
2769#include <fog_pars_fragment>
2770#include <bsdfs>
2771#include <lights_pars_begin>
2772#include <normal_pars_fragment>
2773#include <lights_toon_pars_fragment>
2774#include <shadowmap_pars_fragment>
2775#include <bumpmap_pars_fragment>
2776#include <normalmap_pars_fragment>
2777#include <logdepthbuf_pars_fragment>
2778#include <clipping_planes_pars_fragment>
2779void main() {
2780	#include <clipping_planes_fragment>
2781	vec4 diffuseColor = vec4( diffuse, opacity );
2782	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
2783	vec3 totalEmissiveRadiance = emissive;
2784	#include <logdepthbuf_fragment>
2785	#include <map_fragment>
2786	#include <color_fragment>
2787	#include <alphamap_fragment>
2788	#include <alphatest_fragment>
2789	#include <normal_fragment_begin>
2790	#include <normal_fragment_maps>
2791	#include <emissivemap_fragment>
2792	#include <lights_toon_fragment>
2793	#include <lights_fragment_begin>
2794	#include <lights_fragment_maps>
2795	#include <lights_fragment_end>
2796	#include <aomap_fragment>
2797	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
2798	#include <output_fragment>
2799	#include <tonemapping_fragment>
2800	#include <encodings_fragment>
2801	#include <fog_fragment>
2802	#include <premultiplied_alpha_fragment>
2803	#include <dithering_fragment>
2804}`,points_vert:`uniform float size;
2805uniform float scale;
2806#include <common>
2807#include <color_pars_vertex>
2808#include <fog_pars_vertex>
2809#include <morphtarget_pars_vertex>
2810#include <logdepthbuf_pars_vertex>
2811#include <clipping_planes_pars_vertex>
2812void main() {
2813	#include <color_vertex>
2814	#include <morphcolor_vertex>
2815	#include <begin_vertex>
2816	#include <morphtarget_vertex>
2817	#include <project_vertex>
2818	gl_PointSize = size;
2819	#ifdef USE_SIZEATTENUATION
2820		bool isPerspective = isPerspectiveMatrix( projectionMatrix );
2821		if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
2822	#endif
2823	#include <logdepthbuf_vertex>
2824	#include <clipping_planes_vertex>
2825	#include <worldpos_vertex>
2826	#include <fog_vertex>
2827}`,points_frag:`uniform vec3 diffuse;
2828uniform float opacity;
2829#include <common>
2830#include <color_pars_fragment>
2831#include <map_particle_pars_fragment>
2832#include <alphatest_pars_fragment>
2833#include <fog_pars_fragment>
2834#include <logdepthbuf_pars_fragment>
2835#include <clipping_planes_pars_fragment>
2836void main() {
2837	#include <clipping_planes_fragment>
2838	vec3 outgoingLight = vec3( 0.0 );
2839	vec4 diffuseColor = vec4( diffuse, opacity );
2840	#include <logdepthbuf_fragment>
2841	#include <map_particle_fragment>
2842	#include <color_fragment>
2843	#include <alphatest_fragment>
2844	outgoingLight = diffuseColor.rgb;
2845	#include <output_fragment>
2846	#include <tonemapping_fragment>
2847	#include <encodings_fragment>
2848	#include <fog_fragment>
2849	#include <premultiplied_alpha_fragment>
2850}`,shadow_vert:`#include <common>
2851#include <fog_pars_vertex>
2852#include <morphtarget_pars_vertex>
2853#include <skinning_pars_vertex>
2854#include <shadowmap_pars_vertex>
2855void main() {
2856	#include <beginnormal_vertex>
2857	#include <morphnormal_vertex>
2858	#include <skinbase_vertex>
2859	#include <skinnormal_vertex>
2860	#include <defaultnormal_vertex>
2861	#include <begin_vertex>
2862	#include <morphtarget_vertex>
2863	#include <skinning_vertex>
2864	#include <project_vertex>
2865	#include <worldpos_vertex>
2866	#include <shadowmap_vertex>
2867	#include <fog_vertex>
2868}`,shadow_frag:`uniform vec3 color;
2869uniform float opacity;
2870#include <common>
2871#include <packing>
2872#include <fog_pars_fragment>
2873#include <bsdfs>
2874#include <lights_pars_begin>
2875#include <shadowmap_pars_fragment>
2876#include <shadowmask_pars_fragment>
2877void main() {
2878	gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
2879	#include <tonemapping_fragment>
2880	#include <encodings_fragment>
2881	#include <fog_fragment>
2882}`,sprite_vert:`uniform float rotation;
2883uniform vec2 center;
2884#include <common>
2885#include <uv_pars_vertex>
2886#include <fog_pars_vertex>
2887#include <logdepthbuf_pars_vertex>
2888#include <clipping_planes_pars_vertex>
2889void main() {
2890	#include <uv_vertex>
2891	vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );
2892	vec2 scale;
2893	scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );
2894	scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );
2895	#ifndef USE_SIZEATTENUATION
2896		bool isPerspective = isPerspectiveMatrix( projectionMatrix );
2897		if ( isPerspective ) scale *= - mvPosition.z;
2898	#endif
2899	vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;
2900	vec2 rotatedPosition;
2901	rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
2902	rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
2903	mvPosition.xy += rotatedPosition;
2904	gl_Position = projectionMatrix * mvPosition;
2905	#include <logdepthbuf_vertex>
2906	#include <clipping_planes_vertex>
2907	#include <fog_vertex>
2908}`,sprite_frag:`uniform vec3 diffuse;
2909uniform float opacity;
2910#include <common>
2911#include <uv_pars_fragment>
2912#include <map_pars_fragment>
2913#include <alphamap_pars_fragment>
2914#include <alphatest_pars_fragment>
2915#include <fog_pars_fragment>
2916#include <logdepthbuf_pars_fragment>
2917#include <clipping_planes_pars_fragment>
2918void main() {
2919	#include <clipping_planes_fragment>
2920	vec3 outgoingLight = vec3( 0.0 );
2921	vec4 diffuseColor = vec4( diffuse, opacity );
2922	#include <logdepthbuf_fragment>
2923	#include <map_fragment>
2924	#include <alphamap_fragment>
2925	#include <alphatest_fragment>
2926	outgoingLight = diffuseColor.rgb;
2927	#include <output_fragment>
2928	#include <tonemapping_fragment>
2929	#include <encodings_fragment>
2930	#include <fog_fragment>
2931}`},su={common:{diffuse:{value:new ir(0xffffff)},opacity:{value:1},map:{value:null},uvTransform:{value:new tK},uv2Transform:{value:new tK}
vendor: 4,239 bytes, line 2931
2931,alphaMap:{value:null},alphaTest:{value:0}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new tZ(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 ir(0xffffff)}},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 ir(0xffffff)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new tK}},sprite:{diffuse:{value:new ir(0xffffff)},opacity:{value:1},center:{value:new tZ(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new tK}}},sp={basic:{uniforms:r1([su.common,su.specularmap,su.envmap,su.aomap,su.lightmap,su.fog]),vertexShader:sd.meshbasic_vert,fragmentShader:sd.meshbasic_frag},lambert:{uniforms:r1([su.common,su.specularmap,su.envmap,su.aomap,su.lightmap,su.emissivemap,su.bumpmap,su.normalmap,su.displacementmap,su.fog,su.lights,{emissive:{value:new ir(0)}}]),vertexShader:sd.meshlambert_vert,fragmentShader:sd.meshlambert_frag},phong:{uniforms:r1([su.common,su.specularmap,su.envmap,su.aomap,su.lightmap,su.emissivemap,su.bumpmap,su.normalmap,su.displacementmap,su.fog,su.lights,{emissive:{value:new ir(0)},specular:{value:new ir(1118481)},shininess:{value:30}}]),vertexShader:sd.meshphong_vert,fragmentShader:sd.meshphong_frag},standard:{uniforms:r1([su.common,su.envmap,su.aomap,su.lightmap,su.emissivemap,su.bumpmap,su.normalmap,su.displacementmap,su.roughnessmap,su.metalnessmap,su.fog,su.lights,{emissive:{value:new ir(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:sd.meshphysical_vert,fragmentShader:sd.meshphysical_frag},toon:{uniforms:r1([su.common,su.aomap,su.lightmap,su.emissivemap,su.bumpmap,su.normalmap,su.displacementmap,su.gradientmap,su.fog,su.lights,{emissive:{value:new ir(0)}}]),vertexShader:sd.meshtoon_vert,fragmentShader:sd.meshtoon_frag},matcap:{uniforms:r1([su.common,su.bumpmap,su.normalmap,su.displacementmap,su.fog,{matcap:{value:null}}]),vertexShader:sd.meshmatcap_vert,fragmentShader:sd.meshmatcap_frag},points:{uniforms:r1([su.points,su.fog]),vertexShader:sd.points_vert,fragmentShader:sd.points_frag},dashed:{uniforms:r1([su.common,su.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:sd.linedashed_vert,fragmentShader:sd.linedashed_frag},depth:{uniforms:r1([su.common,su.displacementmap]),vertexShader:sd.depth_vert,fragmentShader:sd.depth_frag},normal:{uniforms:r1([su.common,su.bumpmap,su.normalmap,su.displacementmap,{opacity:{value:1}}]),vertexShader:sd.meshnormal_vert,fragmentShader:sd.meshnormal_frag}
2931,sprite:{uniforms:r1([su.sprite,su.fog]),vertexShader:sd.sprite_vert,fragmentShader:sd.sprite_frag},background:{uniforms:{uvTransform:{value:new tK},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:sd.background_vert,fragmentShader:sd.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1}},vertexShader:sd.backgroundCube_vert,fragmentShader:sd.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:sd.cube_vert,fragmentShader:sd.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:sd.equirect_vert,fragmentShader:sd.equirect_frag},distanceRGBA:{uniforms:r1([su.common,su.displacementmap,{referencePosition:{value:new iy},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:sd.distanceRGBA_vert,fragmentShader:sd.distanceRGBA_frag},shadow:{uniforms:r1([su.lights,su.fog,{color:{value:new ir(0)},opacity:{value:1}}]),vertexShader:sd.shadow_vert,fragmentShader:sd.shadow_frag}};sp.physical={uniforms:r1([sp.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new tZ(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 ir(0)},sheenColorMap:{value:null},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},transmission:{value:0},transmissionMap:{value:null},transmissionSamplerSize:{value:new tZ},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},attenuationDistance:{value:0},attenuationColor:{value:new ir(0)},specularIntensity:{value:1},specularIntensityMap:{value:null},specularColor:{value:new ir(1,1,1)},specularColorMap:{value:null}}]),vertexShader:sd.meshphysical_vert,fragmentShader:sd.meshphysical_frag};var sf={r:0,b:0,g:0};function sm(e,t,i,r,s,a,o){let h=new ir(0),c=+(!0!==a),d,u,p=null,f=0,m=null;function g(t,i){t.getRGB(sf,r2(e)),r.buffers.color.setClear(sf.r,sf.g,sf.b,i,o)}return{getClearColor:function(){return h},setClearColor:function(e,t=1){h.set(e),g(h,c=t)},getClearAlpha:function(){return c},setClearAlpha:function(e){g(h,c=e)},render:function(r,a){let o=!1,v=!0===a.isScene?a.background:null;
2931v&&v.isTexture&&(v=(a.backgroundBlurriness>0?i:t).get(v));let y=e.xr,x=y.getSession&&y.getSession();x&&"additive"===x.environmentBlendMode&&(v=null),null===v?g(h,c):v&&v.isColor&&(g(v,1),o=!0),(e.autoClear||o)&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),v&&(v.isCubeTexture||306===v.mapping)?(void 0===u&&((u=new rK(new r$(1,1,1),new r5({name:"BackgroundCubeMaterial",uniforms:r0(sp.backgroundCube.uniforms),vertexShader:sp.backgroundCube.vertexShader,fragmentShader:sp.backgroundCube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),u.geometry.deleteAttribute("uv"),u.onBeforeRender=function(e,t,i){this.matrixWorld.copyPosition(i.matrixWorld)},Object.defineProperty(u.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),s.update(u)),u.material.uniforms.envMap.value=v,u.material.uniforms.flipEnvMap.value=v.isCubeTexture&&!1===v.isRenderTargetTexture?-1:1,u.material.uniforms.backgroundBlurriness.value=a.backgroundBlurriness,u.material.uniforms.backgroundIntensity.value=a.backgroundIntensity,u.material.toneMapped=3001!==v.encoding,(p!==v||f!==v.version||m!==e.toneMapping)&&(u.material.needsUpdate=!0,p=v,f=v.version,m=e.toneMapping),u.layers.enableAll(),r.unshift(u,u.geometry,u.material,0,0,null)):v&&v.isTexture&&(void 0===d&&((d=new rK(new sc(2,2),new r5({name:"BackgroundMaterial",uniforms:r0(sp.background.uniforms),vertexShader:sp.background.vertexShader,fragmentShader:sp.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),Object.defineProperty(d.material,"map",{get:function(){return this.uniforms.t2D.value}}),s.update(d)),d.material.uniforms.t2D.value=v,d.material.uniforms.backgroundIntensity.value=a.backgroundIntensity,d.material.toneMapped=3001!==v.encoding,!0===v.matrixAutoUpdate&&v.updateMatrix(),d.material.uniforms.uvTransform.value.copy(v.matrix),(p!==v||f!==v.version||m!==e.toneMapping)&&(d.material.needsUpdate=!0,p=v,f=v.version,m=e.toneMapping),d.layers.enableAll(),r.unshift(d,d.geometry,d.material,0,0,null))}}}function sg(e,t,i,r){let s=e.getParameter(34921),a=r.isWebGL2?null:t.get("OES_vertex_array_object"),o=r.isWebGL2||null!==a,h={},c=m(null),d=c,u=!1;function p(t){return r.isWebGL2?e.bindVertexArray(t):a.bindVertexArrayOES(t)}function f(t){return r.isWebGL2?e.deleteVertexArray(t):a.deleteVertexArrayOES(t)}function m(e){let t=[],i=[],r=[];for(let e=0;e<s;e++)t[e]=0,i[e]=0,r[e]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:t,enabledAttributes:i,attributeDivisors:r,object:e,attributes:{},index:null}}function g(){let e=d.newAttributes;for(let t=0,i=e.length;t<i;t++)e[t]=0}function v(e){y(e,0)}function y(i,s){let a=d.newAttributes,o=d.enabledAttributes,h=d.attributeDivisors;a[i]=1,0===o[i]&&(e.enableVertexAttribArray(i),o[i]=1),h[i]!==s&&((r.isWebGL2?e:t.get("ANGLE_instanced_arrays"))[r.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](i,s),h[i]=s)}function x(){let t=d.newAttributes,i=d.enabledAttributes;for(let r=0,s=i.length;r<s;r++)i[r]!==t[r]&&(e.disableVertexAttribArray(r),i[r]=0)}function b(t,i,s,a,o,h){!0===r.isWebGL2&&(5124===s||5125===s)?e.vertexAttribIPointer(t,i,s,o,h):e.vertexAttribPointer(t,i,s,a,o,h)}function w(){_(),u=!0,d!==c&&p((d=c).object)}function _(){c.geometry=null,c.program=null,c.wireframe=!1}return{setup:function(s,c,f,w,_){let S=!1;if(o){var C,M;let t,i,o,u,g=(C=w,M=f,t=!0===c.wireframe,void 0===(i=h[C.id])&&(i={},h[C.id]=i),void 0===(o=i[M.id])&&(o={},i[M.id]=o),void 0===(u=o[t])&&(u=m(r.isWebGL2?e.createVertexArray():a.createVertexArrayOES()),o[t]=u),u);d!==g&&p((d=g).object),(S=function(e,t,i,r){let s=d.attributes,a=t.attributes,o=0,h=i.getAttributes();for(let t in h)if(h[t].location>=0){let i=s[t],r=a[t];if(void 0===r&&("instanceMatrix"===t&&e.instanceMatrix&&(r=e.instanceMatrix),"instanceColor"===t&&e.instanceColor&&(r=e.instanceColor)),void 0===i||i.attribute!==r||r&&i.data!==r.data)return!0;o++}return d.attributesNum!==o||d.index!==r}(s,w,f,_))&&function(e,t,i,r){let s={},a=t.attributes,o=0,h=i.getAttributes();for(let t in h)if(h[t].location>=0){let i=a[t];void 0===i&&("instanceMatrix"===t&&e.instanceMatrix&&(i=e.instanceMatrix),"instanceColor"===t&&e.instanceColor&&(i=e.instanceColor));let r={};r.attribute=i,i&&i.data&&(r.data=i.data),s[t]=r,o++}d.attributes=s,d.attributesNum=o,d.index=r}(s,w,f,_)}else{let e=!0===c.wireframe;
2931(d.geometry!==w.id||d.program!==f.id||d.wireframe!==e)&&(d.geometry=w.id,d.program=f.id,d.wireframe=e,S=!0)}null!==_&&i.update(_,34963),(S||u)&&(u=!1,function(s,a,o,h){if(!1===r.isWebGL2&&(s.isInstancedMesh||h.isInstancedBufferGeometry)&&null===t.get("ANGLE_instanced_arrays"))return;g();let c=h.attributes,d=o.getAttributes(),u=a.defaultAttributeValues;for(let t in d){let r=d[t];if(r.location>=0){let a=c[t];if(void 0===a&&("instanceMatrix"===t&&s.instanceMatrix&&(a=s.instanceMatrix),"instanceColor"===t&&s.instanceColor&&(a=s.instanceColor)),void 0!==a){let t=a.normalized,o=a.itemSize,c=i.get(a);if(void 0===c)continue;let d=c.buffer,u=c.type,p=c.bytesPerElement;if(a.isInterleavedBufferAttribute){let i=a.data,c=i.stride,f=a.offset;if(i.isInstancedInterleavedBuffer){for(let e=0;e<r.locationSize;e++)y(r.location+e,i.meshPerAttribute);!0!==s.isInstancedMesh&&void 0===h._maxInstanceCount&&(h._maxInstanceCount=i.meshPerAttribute*i.count)}else for(let e=0;e<r.locationSize;e++)v(r.location+e);e.bindBuffer(34962,d);for(let e=0;e<r.locationSize;e++)b(r.location+e,o/r.locationSize,u,t,c*p,(f+o/r.locationSize*e)*p)}else{if(a.isInstancedBufferAttribute){for(let e=0;e<r.locationSize;e++)y(r.location+e,a.meshPerAttribute);!0!==s.isInstancedMesh&&void 0===h._maxInstanceCount&&(h._maxInstanceCount=a.meshPerAttribute*a.count)}else for(let e=0;e<r.locationSize;e++)v(r.location+e);e.bindBuffer(34962,d);for(let e=0;e<r.locationSize;e++)b(r.location+e,o/r.locationSize,u,t,o*p,o/r.locationSize*e*p)}}else if(void 0!==u){let i=u[t];if(void 0!==i)switch(i.length){case 2:e.vertexAttrib2fv(r.location,i);break;case 3:e.vertexAttrib3fv(r.location,i);break;case 4:e.vertexAttrib4fv(r.location,i);break;default:e.vertexAttrib1fv(r.location,i)}}}}x()}(s,c,f,w),null!==_&&e.bindBuffer(34963,i.get(_).buffer))},reset:w,resetDefaultState:_,dispose:function(){for(let e in w(),h){let t=h[e];for(let e in t){let i=t[e];for(let e in i)f(i[e].object),delete i[e];delete t[e]}delete h[e]}},releaseStatesOfGeometry:function(e){if(void 0===h[e.id])return;let t=h[e.id];for(let e in t){let i=t[e];for(let e in i)f(i[e].object),delete i[e];delete t[e]}delete h[e.id]},releaseStatesOfProgram:function(e){for(let t in h){let i=h[t];if(void 0===i[e.id])continue;let r=i[e.id];for(let e in r)f(r[e].object),delete r[e];delete i[e.id]}},initAttributes:g,enableAttribute:v,disableUnusedAttributes:x}}function sv(e,t,i,r){let s=r.isWebGL2,a;this.setMode=function(e){a=e},this.render=function(t,r){e.drawArrays(a,t,r),i.update(r,a,1)},this.renderInstances=function(r,o,h){let c,d;if(0!==h){if(s)c=e,d="drawArraysInstanced";else if(c=t.get("ANGLE_instanced_arrays"),d="drawArraysInstancedANGLE",null===c)return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");c[d](a,r,o,h),i.update(o,a,h)}}}function sy(e,t,i){let r;function s(t){if("highp"===t){if(e.getShaderPrecisionFormat(35633,36338).precision>0&&e.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";t="mediump"}return"mediump"===t&&e.getShaderPrecisionFormat(35633,36337).precision>0&&e.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}let a="u">typeof WebGL2RenderingContext&&e instanceof WebGL2RenderingContext,o=void 0!==i.precision?i.precision:"highp",h=s(o);h!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",h,"instead."),o=h);let c=a||t.has("WEBGL_draw_buffers"),d=!0===i.logarithmicDepthBuffer,u=e.getParameter(34930),p=e.getParameter(35660),f=e.getParameter(3379),m=e.getParameter(34076),g=e.getParameter(34921),v=e.getParameter(36347),y=e.getParameter(36348),x=e.getParameter(36349),b=p>0,w=a||t.has("OES_texture_float"),_=a?e.getParameter(36183):0;return{isWebGL2:a,drawBuffers:c,getMaxAnisotropy:function(){if(void 0!==r)return r;if(!0===t.has("EXT_texture_filter_anisotropic")){let i=t.get("EXT_texture_filter_anisotropic");r=e.getParameter(i.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r},getMaxPrecision:s,precision:o,logarithmicDepthBuffer:d,maxTextures:u,maxVertexTextures:p,maxTextureSize:f,maxCubemapSize:m,maxAttributes:g,maxVertexUniforms:v,maxVaryings:y,maxFragmentUniforms:x,vertexTextures:b,floatFragmentTextures:w,floatVertexTextures:b&&w,maxSamples:_}}function sx(e){let t=this,i=null,r=0,s=!1,a=!1,o=new ss,h=new tK,c={value:null,needsUpdate:!1};function d(e,i,r,s){let a=null!==e?e.length:0,d=null;if(0!==a){if(d=c.value,!0!==s||null===d){let t=r+4*a,s=i.matrixWorldInverse;
2931h.getNormalMatrix(s),(null===d||d.length<t)&&(d=new Float32Array(t));for(let t=0,i=r;t!==a;++t,i+=4)o.copy(e[t]).applyMatrix4(s,h),o.normal.toArray(d,i),d[i+3]=o.constant}c.value=d,c.needsUpdate=!0}return t.numPlanes=a,t.numIntersection=0,d}this.uniform=c,this.numPlanes=0,this.numIntersection=0,this.init=function(e,t){let i=0!==e.length||t||0!==r||s;return s=t,r=e.length,i},this.beginShadows=function(){a=!0,d(null)},this.endShadows=function(){a=!1},this.setGlobalState=function(e,t){i=d(e,t,0)},this.setState=function(o,h,u){let p=o.clippingPlanes,f=o.clipIntersection,m=o.clipShadows,g=e.get(o);if(s&&null!==p&&0!==p.length&&(!a||m)){let e=a?0:r,t=4*e,s=g.clippingState||null;c.value=s,s=d(p,h,t,u);for(let e=0;e!==t;++e)s[e]=i[e];g.clippingState=s,this.numIntersection=f?this.numPlanes:0,this.numPlanes+=e}else a?d(null):(c.value!==i&&(c.value=i,c.needsUpdate=r>0),t.numPlanes=r,t.numIntersection=0)}}function sb(e){let t=new WeakMap;function i(e,t){return 303===t?e.mapping=301:304===t&&(e.mapping=302),e}function r(e){let i=e.target;i.removeEventListener("dispose",r);let s=t.get(i);void 0!==s&&(t.delete(i),s.dispose())}return{get:function(s){if(s&&s.isTexture&&!1===s.isRenderTargetTexture){let a=s.mapping;if(303===a||304===a)if(t.has(s))return i(t.get(s).texture,s.mapping);else{let a=s.image;if(!a||!(a.height>0))return null;{let o=new se(a.height/2);return o.fromEquirectangularTexture(e,s),t.set(s,o),s.addEventListener("dispose",r),i(o.texture,s.mapping)}}}return s},dispose:function(){t=new WeakMap}}}var sw=class extends r6{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=null===e.view?null:Object.assign({},e.view),this}setViewOffset(e,t,i,r,s,a){null===this.view&&(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(){null!==this.view&&(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,o=r+t,h=r-t;if(null!==this.view&&this.view.enabled){let e=(this.right-this.left)/this.view.fullWidth/this.zoom,t=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=e*this.view.offsetX,a=s+e*this.view.width,o-=t*this.view.offsetY,h=o-t*this.view.height}this.projectionMatrix.makeOrthographic(s,a,o,h,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,null!==this.view&&(t.object.view=Object.assign({},this.view)),t}},s_=[.125,.215,.35,.446,.526,.582],sS=new sw,sC=new ir,sM=null,sE=(1+Math.sqrt(5))/2,sA=1/sE,sT=[new iy(1,1,1),new iy(-1,1,1),new iy(1,1,-1),new iy(-1,1,-1),new iy(0,sE,sA),new iy(0,sE,-sA),new iy(sA,0,sE),new iy(-sA,0,sE),new iy(sE,sA,0),new iy(-sE,sA,0)],sP=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){sM=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(){null===this._cubemapMaterial&&(this._cubemapMaterial=sI(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=sL(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}_cleanup(e){this._renderer.setRenderTarget(sM),e.scissorTest=!1,sO(e,0,0,e.width,e.height)}_fromTexture(e,t){301===e.mapping||302===e.mapping?this._setSize(0===e.image.length?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),sM=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:1006,minFilter:1006,generateMipmaps:!1,type:1016,format:1023,encoding:3e3,depthBuffer:!1},r=sD(e,t,i);if(null===this._pingPongRenderTarget||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){var s;null!==this._pingPongRenderTarget&&this._dispose(),this._pingPongRenderTarget=sD(e,t,i);let{_lodMax:r}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}
2931=function(e){let t=[],i=[],r=[],s=e,a=e-4+1+s_.length;for(let o=0;o<a;o++){let a=Math.pow(2,s);i.push(a);let h=1/a;o>e-4?h=s_[o-e+4-1]:0===o&&(h=0),r.push(h);let c=1/(a-2),d=-c,u=1+c,p=[d,d,u,d,u,u,d,d,u,u,d,u],f=new Float32Array(108),m=new Float32Array(72),g=new Float32Array(36);for(let e=0;e<6;e++){let t=e%3*2/3-1,i=e>2?0:-1,r=[t,i,0,t+2/3,i,0,t+2/3,i+1,0,t,i,0,t+2/3,i+1,0,t,i+1,0];f.set(r,18*e),m.set(p,12*e);let s=[e,e,e,e,e,e];g.set(s,6*e)}let v=new rz;v.setAttribute("position",new rE(f,3)),v.setAttribute("uv",new rE(m,2)),v.setAttribute("faceIndex",new rE(g,1)),t.push(v),s>4&&s--}return{lodPlanes:t,sizeLods:i,sigmas:r}}(r)),this._blurMaterial=(s=r,new r5({name:"SphericalGaussianBlur",defines:{n:20,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${s}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:new Float32Array(20)},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:new iy(0,1,0)}},vertexShader:sR(),fragmentShader:`
2932
2933			precision mediump float;
2934			precision mediump int;
2935
2936			varying vec3 vOutputDirection;
2937
2938			uniform sampler2D envMap;
2939			uniform int samples;
2940			uniform float weights[ n ];
2941			uniform bool latitudinal;
2942			uniform float dTheta;
2943			uniform float mipInt;
2944			uniform vec3 poleAxis;
2945
2946			#define ENVMAP_TYPE_CUBE_UV
2947			#include <cube_uv_reflection_fragment>
2948
2949			vec3 getSample( float theta, vec3 axis ) {
2950
2951				float cosTheta = cos( theta );
2952				// Rodrigues' axis-angle rotation
2953				vec3 sampleDirection = vOutputDirection * cosTheta
2954					+ cross( axis, vOutputDirection ) * sin( theta )
2955					+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );
2956
2957				return bilinearCubeUV( envMap, sampleDirection, mipInt );
2958
2959			}
2960
2961			void main() {
2962
2963				vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );
2964
2965				if ( all( equal( axis, vec3( 0.0 ) ) ) ) {
2966
2967					axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );
2968
2969				}
2970
2971				axis = normalize( axis );
2972
2973				gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
2974				gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );
2975
2976				for ( int i = 1; i < n; i++ ) {
2977
2978					if ( i >= samples ) {
2979
2980						break;
2981
2982					}
2983
2984					float theta = dTheta * float( i );
2985					gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );
2986					gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );
2987
2988				}
2989
2990			}
2991		`,blending:0,depthTest:!1,depthWrite:!1}))}return r}_compileMaterial(e){let t=new rK(this._lodPlanes[0],e);this._renderer.compile(t,sS)}_sceneToCubeUV(e,t,i,r){let s=new r8(90,1,t,i),a=[1,-1,1,1,1,1],o=[1,1,1,-1,-1,-1],h=this._renderer,c=h.autoClear,d=h.toneMapping;h.getClearColor(sC),h.toneMapping=0,h.autoClear=!1;
2991let u=new rS({name:"PMREM.Background",side:1,depthWrite:!1,depthTest:!1}),p=new rK(new r$,u),f=!1,m=e.background;m?m.isColor&&(u.color.copy(m),e.background=null,f=!0):(u.color.copy(sC),f=!0);for(let t=0;t<6;t++){let i=t%3;0===i?(s.up.set(0,a[t],0),s.lookAt(o[t],0,0)):1===i?(s.up.set(0,0,a[t]),s.lookAt(0,o[t],0)):(s.up.set(0,a[t],0),s.lookAt(0,0,o[t]));let c=this._cubeSize;sO(r,i*c,t>2?c:0,c,c),h.setRenderTarget(r),f&&h.render(p,s),h.render(e,s)}p.geometry.dispose(),p.material.dispose(),h.toneMapping=d,h.autoClear=c,e.background=m}_textureToCubeUV(e,t){let i=this._renderer,r=301===e.mapping||302===e.mapping;r?(null===this._cubemapMaterial&&(this._cubemapMaterial=sI()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===e.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=sL());let s=r?this._cubemapMaterial:this._equirectMaterial,a=new rK(this._lodPlanes[0],s);s.uniforms.envMap.value=e;let o=this._cubeSize;sO(t,0,0,3*o,2*o),i.setRenderTarget(t),i.render(a,sS)}_applyPMREM(e){let t=this._renderer,i=t.autoClear;t.autoClear=!1;for(let t=1;t<this._lodPlanes.length;t++){let i=Math.sqrt(this._sigmas[t]*this._sigmas[t]-this._sigmas[t-1]*this._sigmas[t-1]),r=sT[(t-1)%sT.length];this._blur(e,t-1,t,i,r)}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,o){let h=this._renderer,c=this._blurMaterial;"latitudinal"!==a&&"longitudinal"!==a&&console.error("blur direction must be either latitudinal or longitudinal!");let d=new rK(this._lodPlanes[r],c),u=c.uniforms,p=this._sizeLods[i]-1,f=isFinite(s)?Math.PI/(2*p):2*Math.PI/39,m=s/f,g=isFinite(s)?1+Math.floor(3*m):20;g>20&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${g} samples when the maximum is set to 20`);let v=[],y=0;for(let e=0;e<20;++e){let t=e/m,i=Math.exp(-t*t/2);v.push(i),0===e?y+=i:e<g&&(y+=2*i)}for(let e=0;e<v.length;e++)v[e]=v[e]/y;u.envMap.value=e.texture,u.samples.value=g,u.weights.value=v,u.latitudinal.value="latitudinal"===a,o&&(u.poleAxis.value=o);let{_lodMax:x}=this;u.dTheta.value=f,u.mipInt.value=x-i;let b=this._sizeLods[r],w=4*(this._cubeSize-b);sO(t,3*b*(r>x-4?r-x+4:0),w,3*b,2*b),h.setRenderTarget(t),h.render(d,sS)}};function sD(e,t,i){let r=new iu(e,t,i);return r.texture.mapping=306,r.texture.name="PMREM.cubeUv",r.scissorTest=!0,r}function sO(e,t,i,r,s){e.viewport.set(t,i,r,s),e.scissor.set(t,i,r,s)}function sL(){return new r5({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:sR(),fragmentShader:`
2992
2993			precision mediump float;
2994			precision mediump int;
2995
2996			varying vec3 vOutputDirection;
2997
2998			uniform sampler2D envMap;
2999
3000			#include <common>
3001
3002			void main() {
3003
3004				vec3 outputDirection = normalize( vOutputDirection );
3005				vec2 uv = equirectUv( outputDirection );
3006
3007				gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
3008
3009			}
3010		`,blending:0,depthTest:!1,depthWrite:!1})}function sI(){return new r5({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:sR(),fragmentShader:`
3011
3012			precision mediump float;
3013			precision mediump int;
3014
3015			uniform float flipEnvMap;
3016
3017			varying vec3 vOutputDirection;
3018
3019			uniform samplerCube envMap;
3020
3021			void main() {
3022
3023				gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
3024
3025			}
3026		`,blending:0,depthTest:!1,depthWrite:!1})}function sR(){return`
3027
3028		precision mediump float;
3029		precision mediump int;
3030
3031		attribute float faceIndex;
3032
3033		varying vec3 vOutputDirection;
3034
3035		// RH coordinate system; PMREM face-indexing convention
3036		vec3 getDirection( vec2 uv, float face ) {
3037
3038			uv = 2.0 * uv - 1.0;
3039
3040			vec3 direction = vec3( uv, 1.0 );
3041
3042			if ( face == 0.0 ) {
3043
3044				direction = direction.zyx; // ( 1, v, u ) pos x
3045
3046			} else if ( face == 1.0 ) {
3047
3048				direction = direction.xzy;
3049				direction.xz *= -1.0; // ( -u, 1, -v ) pos y
3050
3051			} else if ( face == 2.0 ) {
3052
3053				direction.x *= -1.0; // ( -u, v, 1 ) pos z
3054
3055			} else if ( face == 3.0 ) {
3056
3057				direction = direction.zyx;
3058				direction.xz *= -1.0; // ( -1, v, -u ) neg x
3059
3060			} else if ( face == 4.0 ) {
3061
3062				direction = direction.xzy;
3063				direction.xy *= -1.0; // ( -u, -1, v ) neg y
3064
3065			} else if ( face == 5.0 ) {
3066
3067				direction.z *= -1.0; // ( u, v, -1 ) neg z
3068
3069			}
3070
3071			return direction;
3072
3073		}
3074
3075		void main() {
3076
3077			vOutputDirection = getDirection( uv, faceIndex );
3078			gl_Position = vec4( position, 1.0 );
3079
3080		}
3081	`}function sk(e){let t=new WeakMap,i=null;function r(e){let i=e.target;i.removeEventListener("dispose",r);let s=t.get(i);void 0!==s&&(t.delete(i),s.dispose())}return{get:function(s){if(s&&s.isTexture){let a=s.mapping,o=303===a||304===a,h=301===a||302===a;if(o||h)if(s.isRenderTargetTexture&&!0===s.needsPMREMUpdate){s.needsPMREMUpdate=!1;let r=t.get(s);return null===i&&(i=new sP(e)),r=o?i.fromEquirectangular(s,r):i.fromCubemap(s,r),t.set(s,r),r.texture}else{if(t.has(s))return t.get(s).texture;{let a=s.image;if(!(o&&a&&a.height>0||h&&a&&function(e){let t=0;for(let i=0;i<6;i++)void 0!==e[i]&&t++;return 6===t}(a)))return null;{null===i&&(i=new sP(e));let a=o?i.fromEquirectangular(s):i.fromCubemap(s);return t.set(s,a),s.addEventListener("dispose",r),a.texture}}}}return s},dispose:function(){t=new WeakMap,null!==i&&(i.dispose(),i=null)}}}function sB(e){let t={};function i(i){let r;if(void 0!==t[i])return t[i];switch(i){case"WEBGL_depth_texture":r=e.getExtension("WEBGL_depth_texture")||e.getExtension("MOZ_WEBGL_depth_texture")||e.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":r=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":r=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":r=e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:r=e.getExtension(i)}return t[i]=r,r}return{has:function(e){return null!==i(e)},init:function(e){e.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(e){let t=i(e);return null===t&&console.warn("THREE.WebGLRenderer: "+e+" extension not supported."),t}}}function sz(e,t,i,r){let s={},a=new WeakMap;function o(e){let h=e.target;for(let e in null!==h.index&&t.remove(h.index),h.attributes)t.remove(h.attributes[e]);h.removeEventListener("dispose",o),delete s[h.id];let c=a.get(h);c&&(t.remove(c),a.delete(h)),r.releaseStatesOfGeometry(h),!0===h.isInstancedBufferGeometry&&delete h._maxInstanceCount,i.memory.geometries--}function h(e){let i=[],r=e.index,s=e.attributes.position,o=0;if(null!==r){let e=r.array;o=r.version;for(let t=0,r=e.length;t<r;t+=3){let r=e[t+0],s=e[t+1],a=e[t+2];i.push(r,s,s,a,a,r)}}else{let e=s.array;o=s.version;for(let t=0,r=e.length/3-1;t<r;t+=3){let e=t+0,r=t+1,s=t+2;i.push(e,r,r,s,s,e)}}let h=new(t$(i)?rT:rA)(i,1);h.version=o;let c=a.get(e);c&&t.remove(c),a.set(e,h)}return{get:function(e,t){return!0===s[t.id]||(t.addEventListener("dispose",o),s[t.id]=!0,i.memory.geometries++),t},update:function(e){let i=e.attributes;for(let e in i)t.update(i[e],34962);let r=e.morphAttributes;for(let e in r){let i=r[e];for(let e=0,r=i.length;e<r;e++)t.update(i[e],34962)}},getWireframeAttribute:function(e){let t=a.get(e);if(t){let i=e.index;null!==i&&t.version<i.version&&h(e)}else h(e);return a.get(e)}}}function sN(e,t,i,r){let s,a,o=r.isWebGL2,h;this.setMode=function(e){h=e},this.setIndex=function(e){s=e.type,a=e.bytesPerElement},this.render=function(t,r){e.drawElements(h,r,s,t*a),i.update(r,h,1)},this.renderInstances=function(r,c,d){let u,p;if(0!==d){if(o)u=e,p="drawElementsInstanced";else if(u=t.get("ANGLE_instanced_arrays"),p="drawElementsInstancedANGLE",
vendor: 10,208 bytes, line 3081
3081null===u)return void console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");u[p](h,c,s,r*a,d),i.update(c,h,d)}}}function sF(e){let t={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:t,programs:null,autoReset:!0,reset:function(){t.frame++,t.calls=0,t.triangles=0,t.points=0,t.lines=0},update:function(e,i,r){switch(t.calls++,i){case 4:t.triangles+=e/3*r;break;case 1:t.lines+=e/2*r;break;case 3:t.lines+=r*(e-1);break;case 2:t.lines+=r*e;break;case 0:t.points+=r*e;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",i)}}}}function sj(e,t){return e[0]-t[0]}function sU(e,t){return Math.abs(t[1])-Math.abs(e[1])}function sV(e,t,i){let r={},s=new Float32Array(8),a=new WeakMap,o=new id,h=[];for(let e=0;e<8;e++)h[e]=[e,0];return{update:function(c,d,u,p){let f=c.morphTargetInfluences;if(!0===t.isWebGL2){let r=d.morphAttributes.position||d.morphAttributes.normal||d.morphAttributes.color,s=void 0!==r?r.length:0,h=a.get(d);if(void 0===h||h.count!==s){let e=function(){x.dispose(),a.delete(d),d.removeEventListener("dispose",e)};void 0!==h&&h.texture.dispose();let i=void 0!==d.morphAttributes.position,r=void 0!==d.morphAttributes.normal,c=void 0!==d.morphAttributes.color,u=d.morphAttributes.position||[],p=d.morphAttributes.normal||[],f=d.morphAttributes.color||[],m=0;!0===i&&(m=1),!0===r&&(m=2),!0===c&&(m=3);let g=d.attributes.position.count*m,v=1;g>t.maxTextureSize&&(v=Math.ceil(g/t.maxTextureSize),g=t.maxTextureSize);let y=new Float32Array(g*v*4*s),x=new ip(y,g,v,s);x.type=1015,x.needsUpdate=!0;let b=4*m;for(let e=0;e<s;e++){let t=u[e],s=p[e],a=f[e],h=g*v*4*e;for(let e=0;e<t.count;e++){let d=e*b;!0===i&&(o.fromBufferAttribute(t,e),y[h+d+0]=o.x,y[h+d+1]=o.y,y[h+d+2]=o.z,y[h+d+3]=0),!0===r&&(o.fromBufferAttribute(s,e),y[h+d+4]=o.x,y[h+d+5]=o.y,y[h+d+6]=o.z,y[h+d+7]=0),!0===c&&(o.fromBufferAttribute(a,e),y[h+d+8]=o.x,y[h+d+9]=o.y,y[h+d+10]=o.z,y[h+d+11]=4===a.itemSize?o.w:1)}}h={count:s,texture:x,size:new tZ(g,v)},a.set(d,h),d.addEventListener("dispose",e)}let c=0;for(let e=0;e<f.length;e++)c+=f[e];let u=d.morphTargetsRelative?1:1-c;p.getUniforms().setValue(e,"morphTargetBaseInfluence",u),p.getUniforms().setValue(e,"morphTargetInfluences",f),p.getUniforms().setValue(e,"morphTargetsTexture",h.texture,i),p.getUniforms().setValue(e,"morphTargetsTextureSize",h.size)}else{let t=void 0===f?0:f.length,i=r[d.id];if(void 0===i||i.length!==t){i=[];for(let e=0;e<t;e++)i[e]=[e,0];r[d.id]=i}for(let e=0;e<t;e++){let t=i[e];t[0]=e,t[1]=f[e]}i.sort(sU);for(let e=0;e<8;e++)e<t&&i[e][1]?(h[e][0]=i[e][0],h[e][1]=i[e][1]):(h[e][0]=Number.MAX_SAFE_INTEGER,h[e][1]=0);h.sort(sj);let a=d.morphAttributes.position,o=d.morphAttributes.normal,c=0;for(let e=0;e<8;e++){let t=h[e],i=t[0],r=t[1];i!==Number.MAX_SAFE_INTEGER&&r?(a&&d.getAttribute("morphTarget"+e)!==a[i]&&d.setAttribute("morphTarget"+e,a[i]),o&&d.getAttribute("morphNormal"+e)!==o[i]&&d.setAttribute("morphNormal"+e,o[i]),s[e]=r,c+=r):(a&&!0===d.hasAttribute("morphTarget"+e)&&d.deleteAttribute("morphTarget"+e),o&&!0===d.hasAttribute("morphNormal"+e)&&d.deleteAttribute("morphNormal"+e),s[e]=0)}let u=d.morphTargetsRelative?1:1-c;p.getUniforms().setValue(e,"morphTargetBaseInfluence",u),p.getUniforms().setValue(e,"morphTargetInfluences",s)}}}}function sW(e,t,i,r){let s=new WeakMap;function a(e){let t=e.target;t.removeEventListener("dispose",a),i.remove(t.instanceMatrix),null!==t.instanceColor&&i.remove(t.instanceColor)}return{update:function(e){let o=r.render.frame,h=e.geometry,c=t.get(e,h);return s.get(c)!==o&&(t.update(c),s.set(c,o)),e.isInstancedMesh&&(!1===e.hasEventListener("dispose",a)&&e.addEventListener("dispose",a),i.update(e.instanceMatrix,34962),null!==e.instanceColor&&i.update(e.instanceColor,34962)),c},dispose:function(){s=new WeakMap}}}var sH=new ic,sG=new ip,sq=new im,sX=new r7,sY=[],sQ=[],sZ=new Float32Array(16),sK=new Float32Array(9),sJ=new Float32Array(4);function s$(e,t,i){let r=e[0];if(null==r||r<=0||r>0)return e;let s=t*i,a=sY[s];if(void 0===a&&(a=new Float32Array(s),sY[s]=a),0!==t){r.toArray(a,0);for(let r=1,s=0;r!==t;++r)s+=i,e[r].toArray(a,s)}return a}function s0(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 s1(e,t){for(let i=0,r=t.length;i<r;i++)e[i]=t[i]}function s2(e,t){let i=sQ[t];void 0===i&&(i=new Int32Array(t),sQ[t]=i);for(let r=0;r!==t;++r)i[r]=e.allocateTextureUnit();return i}function s3(e,t){let i=this.cache;i[0]!==t&&(e.uniform1f(this.addr,t),i[0]=t)}function s4(e,t){let i=this.cache;if(void 0!==t.x)(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(s0(i,t))return;e.uniform2fv(this.addr,t),s1(i,t)}}function s5(e,t){let i=this.cache;if(void 0!==t.x)(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(void 0!==t.r)(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(s0(i,t))return;e.uniform3fv(this.addr,t),s1(i,t)}}function s6(e,t){let i=this.cache;if(void 0!==t.x)(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(s0(i,t))return;e.uniform4fv(this.addr,t),s1(i,t)}}function s8(e,t){let i=this.cache,r=t.elements;if(void 0===r){if(s0(i,t))return;e.uniformMatrix2fv(this.addr,!1,t),s1(i,t)}else{if(s0(i,r))return;sJ.set(r),e.uniformMatrix2fv(this.addr,!1,sJ),s1(i,r)}}function s9(e,t){let i=this.cache,r=t.elements;if(void 0===r){if(s0(i,t))return;e.uniformMatrix3fv(this.addr,!1,t),s1(i,t)}else{if(s0(i,r))return;sK.set(r),e.uniformMatrix3fv(this.addr,!1,sK),s1(i,r)}}function s7(e,t){let i=this.cache,r=t.elements;if(void 0===r){if(s0(i,t))return;e.uniformMatrix4fv(this.addr,!1,t),s1(i,t)}else{if(s0(i,r))return;sZ.set(r),e.uniformMatrix4fv(this.addr,!1,sZ),s1(i,r)}}function ae(e,t){let i=this.cache;i[0]!==t&&(e.uniform1i(this.addr,t),i[0]=t)}function at(e,t){let i=this.cache;if(void 0!==t.x)(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(s0(i,t))return;e.uniform2iv(this.addr,t),s1(i,t)}}function ai(e,t){let i=this.cache;if(void 0!==t.x)(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(s0(i,t))return;e.uniform3iv(this.addr,t),s1(i,t)}}function ar(e,t){let i=this.cache;if(void 0!==t.x)(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(s0(i,t))return;e.uniform4iv(this.addr,t),s1(i,t)}}function as(e,t){let i=this.cache;i[0]!==t&&(e.uniform1ui(this.addr,t),i[0]=t)}function aa(e,t){let i=this.cache;if(void 0!==t.x)(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(s0(i,t))return;e.uniform2uiv(this.addr,t),s1(i,t)}}function an(e,t){let i=this.cache;if(void 0!==t.x)(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(s0(i,t))return;e.uniform3uiv(this.addr,t),s1(i,t)}}function ao(e,t){let i=this.cache;if(void 0!==t.x)(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(s0(i,t))return;e.uniform4uiv(this.addr,t),s1(i,t)}}function al(e,t,i){let r=this.cache,s=i.allocateTextureUnit();r[0]!==s&&(e.uniform1i(this.addr,s),r[0]=s),i.setTexture2D(t||sH,s)}function ah(e,t,i){let r=this.cache,s=i.allocateTextureUnit();r[0]!==s&&(e.uniform1i(this.addr,s),r[0]=s),i.setTexture3D(t||sq,s)}function ac(e,t,i){let r=this.cache,s=i.allocateTextureUnit();r[0]!==s&&(e.uniform1i(this.addr,s),r[0]=s),i.setTextureCube(t||sX,s)}function ad(e,t,i){let r=this.cache,s=i.allocateTextureUnit();r[0]!==s&&(e.uniform1i(this.addr,s),r[0]=s),i.setTexture2DArray(t||sG,s)}function au(e,t){e.uniform1fv(this.addr,t)}function ap(e,t){let i=s$(t,this.size,2);e.uniform2fv(this.addr,i)}function af(e,t){let i=s$(t,this.size,3);e.uniform3fv(this.addr,i)}function am(e,t){let i=s$(t,this.size,4);e.uniform4fv(this.addr,i)}function ag(e,t){let i=s$(t,this.size,4);e.uniformMatrix2fv(this.addr,!1,i)}function av(e,t){let i=s$(t,this.size,9);e.uniformMatrix3fv(this.addr,!1,i)}function ay(e,t){let i=s$(t,this.size,16);e.uniformMatrix4fv(this.addr,!1,i)}function ax(e,t){e.uniform1iv(this.addr,t)}function ab(e,t){e.uniform2iv(this.addr,t)}function aw(e,t){e.uniform3iv(this.addr,t)}function a_(e,t){e.uniform4iv(this.addr,t)}function aS(e,t){e.uniform1uiv(this.addr,t)}function aC(e,t){e.uniform2uiv(this.addr,t)}function aM(e,t){e.uniform3uiv(this.addr,t)}function aE(e,t){e.uniform4uiv(this.addr,t)}function aA(e,t,i){let r=this.cache,s=t.length,a=s2(i,s);s0(r,a)||(e.uniform1iv(this.addr,a),s1(r,a));for(let e=0;e!==s;++e)i.setTexture2D(t[e]||sH,a[e])}function aT(e,t,i){let r=this.cache,s=t.length,a=s2(i,s);s0(r,a)||(e.uniform1iv(this.addr,a),s1(r,a));for(let e=0;e!==s;++e)i.setTexture3D(t[e]||sq,a[e])}function aP(e,t,i){let r=this.cache,s=t.length,a=s2(i,s);s0(r,a)||(e.uniform1iv(this.addr,a),s1(r,a));for(let e=0;e!==s;++e)i.setTextureCube(t[e]||sX,a[e])}function aD(e,t,i){let r=this.cache,s=t.length,a=s2(i,s);s0(r,a)||(e.uniform1iv(this.addr,a),s1(r,a));for(let e=0;e!==s;++e)i.setTexture2DArray(t[e]||sG,a[e])}var aO=class{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.setValue=function(e){switch(e){case 5126:return s3;case 35664:return s4;case 35665:return s5;case 35666:return s6;case 35674:return s8;case 35675:return s9;case 35676:return s7;case 5124:case 35670:return ae;case 35667:case 35671:return at;case 35668:case 35672:return ai;case 35669:case 35673:return ar;case 5125:return as;case 36294:return aa;case 36295:return an;case 36296:return ao;case 35678:case 36198:case 36298:case 36306:case 35682:return al;case 35679:case 36299:case 36307:return ah;case 35680:case 36300:case 36308:case 36293:return ac;case 36289:case 36303:case 36311:case 36292:return ad}}(t.type)}},aL=class{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.size=t.size,this.setValue=function(e){switch(e){case 5126:return au;case 35664:return ap;case 35665:return af;
3081case 35666:return am;case 35674:return ag;case 35675:return av;case 35676:return ay;case 5124:case 35670:return ax;case 35667:case 35671:return ab;case 35668:case 35672:return aw;case 35669:case 35673:return a_;case 5125:return aS;case 36294:return aC;case 36295:return aM;case 36296:return aE;case 35678:case 36198:case 36298:case 36306:case 35682:return aA;case 35679:case 36299:case 36307:return aT;case 35680:case 36300:case 36308:case 36293:return aP;case 36289:case 36303:case 36311:case 36292:return aD}}(t.type)}},aI=class{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,i){if(void 0===t)return;let r=this.seq;for(let s=0,a=r.length;s!==a;++s){let a=r[s];a.setValue(e,t[a.id],i)}}},aR=/(\w+)(\])?(\[|\.)?/g;function ak(e,t){e.seq.push(t),e.map[t.id]=t}var aB=class{constructor(e,t){this.seq=[],this.map={};let i=e.getProgramParameter(t,35718);for(let r=0;r<i;++r){let i=e.getActiveUniform(t,r),s=e.getUniformLocation(t,i.name);!function(e,t,i){let r=e.name,s=r.length;for(aR.lastIndex=0;;){let a=aR.exec(r),o=aR.lastIndex,h=a[1],c="]"===a[2],d=a[3];if(c&&(h|=0),void 0===d||"["===d&&o+2===s){ak(i,void 0===d?new aO(h,e,t):new aL(h,e,t));break}{let e=i.map[h];void 0===e&&ak(i,e=new aI(h)),i=e}}}(i,s,this)}}setValue(e,t,i,r){let s=this.map[t];void 0!==s&&s.setValue(e,i,r)}setOptional(e,t,i){let r=t[i];void 0!==r&&this.setValue(e,i,r)}static upload(e,t,i,r){for(let s=0,a=t.length;s!==a;++s){let a=t[s],o=i[a.id];!1!==o.needsUpdate&&a.setValue(e,o.value,r)}}static seqWithValue(e,t){let i=[];for(let r=0,s=e.length;r!==s;++r){let s=e[r];s.id in t&&i.push(s)}return i}};function az(e,t,i){let r=e.createShader(t);return e.shaderSource(r,i),e.compileShader(r),r}var aN=0;function aF(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)return s;{let r=parseInt(a[1]);return i.toUpperCase()+`
3082
3083`+s+`
3084
3085`+function(e,t){let i=e.split(`
3086`),r=[],s=Math.max(t-6,0),a=Math.min(t+6,i.length);for(let e=s;e<a;e++){let s=e+1;r.push(`${s===t?">":" "} ${s}: ${i[e]}`)}return r.join(`
3087`)}(e.getShaderSource(t),r)}}function aj(e){return""!==e}function aU(e,t){let i=t.numSpotLightShadows+t.numSpotLightMaps-t.numSpotLightShadowsWithMaps;return e.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/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 aV(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}var aW=/^[ \t]*#include +<([\w\d./]+)>/gm;function aH(e){return e.replace(aW,aG)}function aG(e,t){let i=sd[t];if(void 0===i)throw Error("Can not resolve #include <"+t+">");return aH(i)}var aq=/#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 aX(e){return e.replace(aq,aY)}function aY(e,t,i,r){let s="";for(let e=parseInt(t);e<parseInt(i);e++)s+=r.replace(/\[\s*i\s*\]/g,"[ "+e+" ]").replace(/UNROLLED_LOOP_INDEX/g,e);return s}function aQ(e){let t="precision "+e.precision+` float;
3088precision `+e.precision+" int;";return"highp"===e.precision?t+=`
3089#define HIGH_PRECISION`:"mediump"===e.precision?t+=`
3090#define MEDIUM_PRECISION`:"lowp"===e.precision&&(t+=`
3091#define LOW_PRECISION`),t}function aZ(e,t,i,r){let s,a,o,h,c,d=e.getContext(),u=i.defines,p=i.vertexShader,f=i.fragmentShader,m=(s="SHADOWMAP_TYPE_BASIC",1===i.shadowMapType?s="SHADOWMAP_TYPE_PCF":2===i.shadowMapType?s="SHADOWMAP_TYPE_PCF_SOFT":3===i.shadowMapType&&(s="SHADOWMAP_TYPE_VSM"),s),g=function(e){let t="ENVMAP_TYPE_CUBE";if(e.envMap)switch(e.envMapMode){case 301:case 302:t="ENVMAP_TYPE_CUBE";break;case 306:t="ENVMAP_TYPE_CUBE_UV"}return t}(i),v=(a="ENVMAP_MODE_REFLECTION",i.envMap&&302===i.envMapMode&&(a="ENVMAP_MODE_REFRACTION"),a),y=function(e){let t="ENVMAP_BLENDING_NONE";if(e.envMap)switch(e.combine){case 0:t="ENVMAP_BLENDING_MULTIPLY";break;case 1:t="ENVMAP_BLENDING_MIX";break;case 2:t="ENVMAP_BLENDING_ADD"}return t}(i),x=function(e){let t=e.envMapCubeUVHeight;if(null===t)return null;let i=Math.log2(t)-2;return{texelWidth:1/(3*Math.max(Math.pow(2,i),112)),texelHeight:1/t,maxMip:i}}
3091(i),b=i.isWebGL2?"":[i.extensionDerivatives||i.envMapCubeUVHeight||i.bumpMap||i.tangentSpaceNormalMap||i.clearcoatNormalMap||i.flatShading||"physical"===i.shaderID?"#extension GL_OES_standard_derivatives : enable":"",(i.extensionFragDepth||i.logarithmicDepthBuffer)&&i.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",i.extensionDrawBuffers&&i.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(i.extensionShaderTextureLOD||i.envMap||i.transmission)&&i.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(aj).join(`
3092`),w=function(e){let t=[];for(let i in e){let r=e[i];!1!==r&&t.push("#define "+i+" "+r)}return t.join(`
3093`)}(u),_=d.createProgram(),S,C,M=i.glslVersion?"#version "+i.glslVersion+`
3094`:"";i.isRawShaderMaterial?((S=[w].filter(aj).join(`
3095`)).length>0&&(S+=`
3096`),(C=[b,w].filter(aj).join(`
3097`)).length>0&&(C+=`
3098`)):(S=[aQ(i),"#define SHADER_NAME "+i.shaderName,w,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 "+v:"",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&&!1===i.flatShading?"#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 "+m:"",i.sizeAttenuation?"#define USE_SIZEATTENUATION":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",i.logarithmicDepthBuffer&&i.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","	attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","	attribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT","	attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","	attribute vec4 color;","#elif defined( USE_COLOR )","	attribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )","	attribute vec3 morphTarget0;","	attribute vec3 morphTarget1;","	attribute vec3 morphTarget2;","	attribute vec3 morphTarget3;","	#ifdef USE_MORPHNORMALS","		attribute vec3 morphNormal0;","		attribute vec3 morphNormal1;","		attribute vec3 morphNormal2;","		attribute vec3 morphNormal3;","	#else","		attribute vec3 morphTarget4;","		attribute vec3 morphTarget5;","		attribute vec3 morphTarget6;","		attribute vec3 morphTarget7;","	#endif","#endif","#ifdef USE_SKINNING","	attribute vec4 skinIndex;","	attribute vec4 skinWeight;","#endif",`
3099`].filter(aj).join(`
3100`),C=[b,aQ(i),"#define SHADER_NAME "+i.shaderName,w,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 "+g:"",i.envMap?"#define "+v:"",i.envMap?"#define "+y:"",x?"#define CUBEUV_TEXEL_WIDTH "+x.texelWidth:"",x?"#define CUBEUV_TEXEL_HEIGHT "+x.texelHeight:"",x?"#define CUBEUV_MAX_MIP "+x.maxMip+".0":"",i.lightMap?"#define USE_LIGHTMAP":"",i.aoMap?"#define USE_AOMAP":"",i.emissiveMap?"#define USE_EMISSIVEMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.normalMap&&i.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",i.normalMap&&i.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",i.clearcoat?"#define USE_CLEARCOAT":"",i.clearcoatMap?"#define USE_CLEARCOATMAP":"",i.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",i.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",i.iridescence?"#define USE_IR
3100IDESCENCE":"",i.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",i.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",i.specularColorMap?"#define USE_SPECULARCOLORMAP":"",i.roughnessMap?"#define USE_ROUGHNESSMAP":"",i.metalnessMap?"#define USE_METALNESSMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.alphaTest?"#define USE_ALPHATEST":"",i.sheen?"#define USE_SHEEN":"",i.sheenColorMap?"#define USE_SHEENCOLORMAP":"",i.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",i.transmission?"#define USE_TRANSMISSION":"",i.transmissionMap?"#define USE_TRANSMISSIONMAP":"",i.thicknessMap?"#define USE_THICKNESSMAP":"",i.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",i.vertexTangents?"#define USE_TANGENT":"",i.vertexColors||i.instancingColor?"#define USE_COLOR":"",i.vertexAlphas?"#define USE_COLOR_ALPHA":"",i.vertexUvs?"#define USE_UV":"",i.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",i.gradientMap?"#define USE_GRADIENTMAP":"",i.flatShading?"#define FLAT_SHADED":"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"",i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+m:"",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;",0!==i.toneMapping?"#define TONE_MAPPING":"",0!==i.toneMapping?sd.tonemapping_pars_fragment:"",0!==i.toneMapping?function(e,t){let i;switch(t){case 1:i="Linear";break;case 2:i="Reinhard";break;case 3:i="OptimizedCineon";break;case 4:i="ACESFilmic";break;case 5:i="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",t),i="Linear"}return"vec3 "+e+"( vec3 color ) { return "+i+"ToneMapping( color ); }"}("toneMapping",i.toneMapping):"",i.dithering?"#define DITHERING":"",i.opaque?"#define OPAQUE":"",sd.encodings_pars_fragment,"vec4 linearToOutputTexel( vec4 value ) { return LinearTo"+(o=function(e){switch(e){case 3e3:return["Linear","( value )"];case 3001:return["sRGB","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported encoding:",e),["Linear","( value )"]}}(i.outputEncoding))[0]+o[1]+"; }",i.useDepthPacking?"#define DEPTH_PACKING "+i.depthPacking:"",`
3101`].filter(aj).join(`
3102`)),p=aV(p=aU(p=aH(p),i),i),f=aV(f=aU(f=aH(f),i),i),p=aX(p),f=aX(f),i.isWebGL2&&!0!==i.isRawShaderMaterial&&(M=`#version 300 es
3103`,S=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join(`
3104`)+`
3105`+S,C=["#define varying in",i.glslVersion===tR?"":"layout(location = 0) out highp vec4 pc_fragColor;",i.glslVersion===tR?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(`
3106`)+`
3107`+C);let E=M+S+p,A=M+C+f,T=az(d,35633,E),P=az(d,35632,A);if(d.attachShader(_,T),d.attachShader(_,P),void 0!==i.index0AttributeName?d.bindAttribLocation(_,0,i.index0AttributeName):!0===i.morphTargets&&d.bindAttribLocation(_,0,"position"),d.linkProgram(_),e.debug.checkShaderErrors){let e=d.getProgramInfoLog(_).trim(),t=d.getShaderInfoLog(T).trim(),i=d.getShaderInfoLog(P).trim(),r=!0,s=!0;if(!1===d.getProgramParameter(_,35714)){r=!1;let t=aF(d,T,"vertex"),i=aF(d,P,"fragment");console.error("THREE.WebGLProgram: Shader Error "+d.getError()+" - VALIDATE_STATUS "+d.getProgramParameter(_,35715
3107)+`
3108
3109Program Info Log: `+e+`
3110`+t+`
3111`+i)}else""!==e?console.warn("THREE.WebGLProgram: Program Info Log:",e):(""===t||""===i)&&(s=!1);s&&(this.diagnostics={runnable:r,programLog:e,vertexShader:{log:t,prefix:S},fragmentShader:{log:i,prefix:C}})}return d.deleteShader(T),d.deleteShader(P),this.getUniforms=function(){return void 0===h&&(h=new aB(d,_)),h},this.getAttributes=function(){return void 0===c&&(c=function(e,t){let i={},r=e.getProgramParameter(t,35721);for(let s=0;s<r;s++){let r=e.getActiveAttrib(t,s),a=r.name,o=1;35674===r.type&&(o=2),35675===r.type&&(o=3),35676===r.type&&(o=4),i[a]={type:r.type,location:e.getAttribLocation(t,a),locationSize:o}}return i}(d,_)),c},this.destroy=function(){r.releaseStatesOfProgram(this),d.deleteProgram(_),this.program=void 0},this.name=i.shaderName,this.id=aN++,this.cacheKey=t,this.usedTimes=1,this.program=_,this.vertexShader=T,this.fragmentShader=P,this}var aK=0,aJ=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!1===a.has(r)&&(a.add(r),r.usedTimes++),!1===a.has(s)&&(a.add(s),s.usedTimes++),this}remove(e){for(let t of this.materialCache.get(e))t.usedTimes--,0===t.usedTimes&&this.shaderCache.delete(t.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 void 0===i&&(i=new Set,t.set(e,i)),i}_getShaderStage(e){let t=this.shaderCache,i=t.get(e);return void 0===i&&(i=new a$(e),t.set(e,i)),i}},a$=class{constructor(e){this.id=aK++,this.code=e,this.usedTimes=0}};function a0(e,t,i,r,s,a,o){let h=new i5,c=new aJ,d=[],u=s.isWebGL2,p=s.logarithmicDepthBuffer,f=s.vertexTextures,m=s.precision,g={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"};return{getParameters:function(a,h,d,v,y){let x,b,w,_,S=v.fog,C=y.geometry,M=a.isMeshStandardMaterial?v.environment:null,E=(a.isMeshStandardMaterial?i:t).get(a.envMap||M),A=E&&306===E.mapping?E.image.height:null,T=g[a.type];null!==a.precision&&(m=s.getMaxPrecision(a.precision))!==a.precision&&console.warn("THREE.WebGLProgram.getParameters:",a.precision,"not supported, using",m,"instead.");let P=C.morphAttributes.position||C.morphAttributes.normal||C.morphAttributes.color,D=void 0!==P?P.length:0,O=0;if(void 0!==C.morphAttributes.position&&(O=1),void 0!==C.morphAttributes.normal&&(O=2),void 0!==C.morphAttributes.color&&(O=3),T){let e=sp[T];x=e.vertexShader,b=e.fragmentShader}else x=a.vertexShader,b=a.fragmentShader,c.update(a),w=c.getVertexShaderID(a),_=c.getFragmentShaderID(a);let L=e.getRenderTarget(),I=a.alphaTest>0,R=a.clearcoat>0,k=a.iridescence>0;return{isWebGL2:u,shaderID:T,shaderName:a.type,vertexShader:x,fragmentShader:b,defines:a.defines,customVertexShaderID:w,customFragmentShaderID:_,isRawShaderMaterial:!0===a.isRawShaderMaterial,glslVersion:a.glslVersion,precision:m,instancing:!0===y.isInstancedMesh,instancingColor:!0===y.isInstancedMesh&&null!==y.instanceColor,supportsVertexTextures:f,outputEncoding:null===L?e.outputEncoding:!0===L.isXRRenderTarget?L.texture.encoding:3e3,map:!!a.map,matcap:!!a.matcap,envMap:!!E,envMapMode:E&&E.mapping,envMapCubeUVHeight:A,lightMap:!!a.lightMap,aoMap:!!a.aoMap,emissiveMap:!!a.emissiveMap,bumpMap:!!a.bumpMap,normalMap:!!a.normalMap,objectSpaceNormalMap:1===a.normalMapType,tangentSpaceNormalMap:0===a.normalMapType,decodeVideoTexture:!!a.map&&!0===a.map.isVideoTexture&&3001===a.map.encoding,clearcoat:R,clearcoatMap:R&&!!a.clearcoatMap,clearcoatRoughnessMap:R&&!!a.clearcoatRoughnessMap,clearcoatNormalMap:R&&!!a.clearcoatNormalMap,iridescence:k,iridescenceMap:k&&!!a.iridescenceMap,iridescenceThicknessMap:k&&!!a.iridescenceThicknessMap,displacementMap:!!a.displacementMap,roughnessMap:!!a.roughnessMap,metalnessMap:!!a.metalnessMap,specularMap:!!a.specularMap,specularIntensityMap:!!a.specularIntensityMap,specularColorMap:!!a.specularColorMap,opaque:!1===a.transparent&&1===a.blending,alphaMap:!!a.alphaMap,alphaTest:I,gradientMap:!!a.gradientMap,sheen:a.sheen>0,sheenColorMap:!!a.sheenColorMap,sheenRoughnessMap:!!a.sheenRoughnessMap,transmission:a.transmission>0,transmissionMap:!!a.transmissionMap,thicknessMap:!!a.thicknessMap,combine:a.combine,vertexTangents:!!a.normalMap&&!!C.attributes.tangent,vertexColors:a.vertexColors,vertexAlphas:!0===a.vertexColors&&!!C.attributes.color&&4===C.attributes.color.itemSize,vertexUvs:!!a.map||!!a.bumpMap||!!a.normalMap||!!a.specularMap||!!a.alphaMap||!!a.emissiveMap||!!a.roughnessMap||!!a.metalnessMap||!!a.clearcoatMap||!!a.clearcoatRoughnessMap||!!a.clearcoatNormalMap||!!a.iridescenceMap||!!a.iridescenceThicknessMap||!!a.displacementMap||!!a.transmissionMap||!!a.thicknessMap||!!a.specularIntensityMap||!!a.specularColorMap||!!a.sheenColorMap||!!a.sheenRoughnessMap,uvsVertexOnly:!(a.map||a.bumpMap||a.normalMap||a.specularMap||a.alphaMap||a.emissiveMap||a.roughnessMap||a.metalnessMap||a.clearcoatNormalMap||a.iridescenceMap||a.iridescenceThicknessMap||a.transmission>0||a.transmissionMap||a.thicknessMap||a.specularIntensityMap||a.specularColorMap||a.sheen>0||a.sheenColorMap||a.sheenRoughnessMap)&&!!a.displacementMap,fog:!!S,useFog:!0===a.fog,fogExp2:S&&S.isFogExp2,flatShading:!!a.flatShading,sizeAttenuation:a.sizeAttenuation,logarithmicDepthBuffer:p,skinning:!0===y.isSkinnedMesh,morphTargets:void 0!==C.morphAttributes.position,morphNormals:void 0!==C.morphAttributes.normal,morphColors:void 0!==C.morphAttributes.color,morphTargetsCount:D,morphTextureStride:O,numDirLights:h.directional.length,numPointLights:h.point.length,numSpotLights:h.spot.length,numSpotLightMaps:h.spotLightMap.length,numRectAreaLights:h.rectArea.length,numHemiLights:h.hemi.length,numDirLightShadows:h.directionalShadowMap.length,numPointLightShadows:h.pointShadowMap.length,numSpotLightShadows:h.spotShadowMap.length,numSpotLightShadowsWithMaps:h.numSpotLightShadowsWithMaps,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:a.dithering,shadowMapEnabled:e.shadowMap.enabled&&d.length>0,shadowMapType:e.shadowMap.type,toneMapping:a.toneMapped?e.toneMapping:0,physicallyCorrectLights:e.physicallyCorrectLights,premultipliedAlpha:a.premultipliedAlpha,doubleSided:2===a.side,flipSided:1===a.side,useDepthPacking:!!a.depthPacking,depthPacking:a.depthPacking||0,index0AttributeName:a.index0AttributeName,extensionDerivatives:a.extensions&&a.extensions.derivatives,extensionFragDepth:a.extensions&&a.extensions.fragDepth,extensionDrawBuffers:a.extensions&&a.extensions.drawBuffers,extensionShaderTextureLOD:a.extensions&&a.extensions.shaderTextureLOD,rendererExtensionFragDepth:u||r.has("EXT_frag_depth"),rendererExtensionDrawBuffers:u||r.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:u||r.has("EXT_shader_texture_lod"),customProgramCacheKey:a.customProgramCacheKey()}},getProgramCacheKey:function(t){var i,r,s,a;let o=[];if(t.shaderID?o.push(t.shaderID):(o.push(t.customVertexShaderID),o.push(t.customFragmentShaderID)),void 0!==t.defines)for(let e in t.defines)o.push(e),o.push(t.defines[e]);return!1===t.isRawShaderMaterial&&(i=o,r=t,i.push(r.precision),i.push(r.outputEncoding),i.push(r.envMapMode),i.push(r.envMapCubeUVHeight),i.push(r.combine),i.push(r.vertexUvs),i.push(r.fogExp2),i.push(r.sizeAttenuation),i.push(r.morphTargetsCount),i.push(r.morphAttributeCount),i.push(r.numDirLights),i.push(r.numPointLights),i.push(r.numSpotLights),i.push(r.numSpotLightMaps),i.push(r.numHemiLights),i.push(r.numRectAreaLights),i.push(r.numDirLightShadows),i.push(r.numPointLightShadows),i.push(r.numSpotLightShadows),i.push(r.numSpotLightShadowsWithMaps),i.push(r.shadowMapType),i.push(r.toneMapping),i.push(r.numClippingPlanes),i.push(r.numClipIntersection),i.push(r.depthPacking),s=o,a=t,h.disableAll(),a.isWebG
3111L2&&h.enable(0),a.supportsVertexTextures&&h.enable(1),a.instancing&&h.enable(2),a.instancingColor&&h.enable(3),a.map&&h.enable(4),a.matcap&&h.enable(5),a.envMap&&h.enable(6),a.lightMap&&h.enable(7),a.aoMap&&h.enable(8),a.emissiveMap&&h.enable(9),a.bumpMap&&h.enable(10),a.normalMap&&h.enable(11),a.objectSpaceNormalMap&&h.enable(12),a.tangentSpaceNormalMap&&h.enable(13),a.clearcoat&&h.enable(14),a.clearcoatMap&&h.enable(15),a.clearcoatRoughnessMap&&h.enable(16),a.clearcoatNormalMap&&h.enable(17),a.iridescence&&h.enable(18),a.iridescenceMap&&h.enable(19),a.iridescenceThicknessMap&&h.enable(20),a.displacementMap&&h.enable(21),a.specularMap&&h.enable(22),a.roughnessMap&&h.enable(23),a.metalnessMap&&h.enable(24),a.gradientMap&&h.enable(25),a.alphaMap&&h.enable(26),a.alphaTest&&h.enable(27),a.vertexColors&&h.enable(28),a.vertexAlphas&&h.enable(29),a.vertexUvs&&h.enable(30),a.vertexTangents&&h.enable(31),a.uvsVertexOnly&&h.enable(32),s.push(h.mask),h.disableAll(),a.fog&&h.enable(0),a.useFog&&h.enable(1),a.flatShading&&h.enable(2),a.logarithmicDepthBuffer&&h.enable(3),a.skinning&&h.enable(4),a.morphTargets&&h.enable(5),a.morphNormals&&h.enable(6),a.morphColors&&h.enable(7),a.premultipliedAlpha&&h.enable(8),a.shadowMapEnabled&&h.enable(9),a.physicallyCorrectLights&&h.enable(10),a.doubleSided&&h.enable(11),a.flipSided&&h.enable(12),a.useDepthPacking&&h.enable(13),a.dithering&&h.enable(14),a.specularIntensityMap&&h.enable(15),a.specularColorMap&&h.enable(16),a.transmission&&h.enable(17),a.transmissionMap&&h.enable(18),a.thicknessMap&&h.enable(19),a.sheen&&h.enable(20),a.sheenColorMap&&h.enable(21),a.sheenRoughnessMap&&h.enable(22),a.decodeVideoTexture&&h.enable(23),a.opaque&&h.enable(24),s.push(h.mask),o.push(e.outputEncoding)),o.push(t.customProgramCacheKey),o.join()},getUniforms:function(e){let t=g[e.type],i;return i=t?r0(sp[t].uniforms):e.uniforms},acquireProgram:function(t,i){let r;for(let e=0,t=d.length;e<t;e++){let t=d[e];if(t.cacheKey===i){r=t,++r.usedTimes;break}}return void 0===r&&(r=new aZ(e,i,t,a),d.push(r)),r},releaseProgram:function(e){if(0==--e.usedTimes){let t=d.indexOf(e);d[t]=d[d.length-1],d.pop(),e.destroy()}},releaseShaderCache:function(e){c.remove(e)},programs:d,dispose:function(){c.dispose()}}}function a1(){let e=new WeakMap;return{get:function(t){let i=e.get(t);return void 0===i&&(i={},e.set(t,i)),i},remove:function(t){e.delete(t)},update:function(t,i,r){e.get(t)[i]=r},dispose:function(){e=new WeakMap}}}function a2(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 a3(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 a4(){let e=[],t=0,i=[],r=[],s=[];function a(i,r,s,a,o,h){let c=e[t];return void 0===c?(c={id:i.id,object:i,geometry:r,material:s,groupOrder:a,renderOrder:i.renderOrder,z:o,group:h},e[t]=c):(c.id=i.id,c.object=i,c.geometry=r,c.material=s,c.groupOrder=a,c.renderOrder=i.renderOrder,c.z=o,c.group=h),t++,c}return{opaque:i,transmissive:r,transparent:s,init:function(){t=0,i.length=0,r.length=0,s.length=0},push:function(e,t,o,h,c,d){let u=a(e,t,o,h,c,d);o.transmission>0?r.push(u):!0===o.transparent?s.push(u):i.push(u)},unshift:function(e,t,o,h,c,d){let u=a(e,t,o,h,c,d);o.transmission>0?r.unshift(u):!0===o.transparent?s.unshift(u):i.unshift(u)},finish:function(){for(let i=t,r=e.length;i<r;i++){let t=e[i];if(null===t.id)break;t.id=null,t.object=null,t.geometry=null,t.material=null,t.group=null}},sort:function(e,t){i.length>1&&i.sort(e||a2),r.length>1&&r.sort(t||a3),s.length>1&&s.sort(t||a3)}}}function a5(){let e=new WeakMap;return{get:function(t,i){let r=e.get(t),s;return void 0===r?(s=new a4,e.set(t,[s])):i>=r.length?(s=new a4,r.push(s)):s=r[i],s},dispose:function(){e=new WeakMap}}}function a6(){let e={};return{get:function(t){let i;if(void 0!==e[t.id])return e[t.id];switch(t.type){case"DirectionalLight":i={direction:new iy,color:new ir};break;case"SpotLight":i={position:new iy,direction:new iy,color:new ir,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":i={position:new iy,color:new ir,distance:0,decay:0};break;case"HemisphereLight":i={direction:new iy,skyColor:new ir,groundColor:new ir};break;case"RectAreaLight":i={color:new ir,position:new iy,halfWidth:new iy,halfHeight:new iy}}return e[t.id]=i,i}}}var a8=0;function a9(e,t){return 2*!!t.castShadow-2*!!e.castShadow+ +!!t.map-!!e.map}function a7(e,t){let i,r=new a6,s=(i={},{get:function(e){let t;if(void 0!==i[e.id])return i[e.id];switch(e.type){case"DirectionalLight":case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new tZ};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new tZ,shadowCameraNear:1,shadowCameraFar:1e3}}return i[e.id]=t,t}}),a={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 e=0;e<9;e++)a.probe.push(new iy);let o=new iy,h=new iY,c=new iY;return{setup:function(i,o){let h=0,c=0,d=0;for(let e=0;e<9;e++)a.probe[e].set(0,0,0);let u=0,p=0,f=0,m=0,g=0,v=0,y=0,x=0,b=0,w=0;i.sort(a9);let _=!0!==o?Math.PI:1;for(let e=0,t=i.length;e<t;e++){let t=i[e],o=t.color,S=t.intensity,C=t.distance,M=t.shadow&&t.shadow.map?t.shadow.map.texture:null;if(t.isAmbientLight)h+=o.r*S*_,c+=o.g*S*_,d+=o.b*S*_;else if(t.isLightProbe)for(let e=0;e<9;e++)a.probe[e].addScaledVector(t.sh.coefficients[e],S);else if(t.isDirectionalLight){let e=r.get(t);if(e.color.copy(t.color).multiplyScalar(t.intensity*_),t.castShadow){let e=t.shadow,i=s.get(t);
vendor: 3,436 bytes, line 3111
3111i.shadowBias=e.bias,i.shadowNormalBias=e.normalBias,i.shadowRadius=e.radius,i.shadowMapSize=e.mapSize,a.directionalShadow[u]=i,a.directionalShadowMap[u]=M,a.directionalShadowMatrix[u]=t.shadow.matrix,v++}a.directional[u]=e,u++}else if(t.isSpotLight){let e=r.get(t);e.position.setFromMatrixPosition(t.matrixWorld),e.color.copy(o).multiplyScalar(S*_),e.distance=C,e.coneCos=Math.cos(t.angle),e.penumbraCos=Math.cos(t.angle*(1-t.penumbra)),e.decay=t.decay,a.spot[f]=e;let i=t.shadow;if(t.map&&(a.spotLightMap[b]=t.map,b++,i.updateMatrices(t),t.castShadow&&w++),a.spotLightMatrix[f]=i.matrix,t.castShadow){let e=s.get(t);e.shadowBias=i.bias,e.shadowNormalBias=i.normalBias,e.shadowRadius=i.radius,e.shadowMapSize=i.mapSize,a.spotShadow[f]=e,a.spotShadowMap[f]=M,x++}f++}else if(t.isRectAreaLight){let e=r.get(t);e.color.copy(o).multiplyScalar(S),e.halfWidth.set(.5*t.width,0,0),e.halfHeight.set(0,.5*t.height,0),a.rectArea[m]=e,m++}else if(t.isPointLight){let e=r.get(t);if(e.color.copy(t.color).multiplyScalar(t.intensity*_),e.distance=t.distance,e.decay=t.decay,t.castShadow){let e=t.shadow,i=s.get(t);i.shadowBias=e.bias,i.shadowNormalBias=e.normalBias,i.shadowRadius=e.radius,i.shadowMapSize=e.mapSize,i.shadowCameraNear=e.camera.near,i.shadowCameraFar=e.camera.far,a.pointShadow[p]=i,a.pointShadowMap[p]=M,a.pointShadowMatrix[p]=t.shadow.matrix,y++}a.point[p]=e,p++}else if(t.isHemisphereLight){let e=r.get(t);e.skyColor.copy(t.color).multiplyScalar(S*_),e.groundColor.copy(t.groundColor).multiplyScalar(S*_),a.hemi[g]=e,g++}}m>0&&(t.isWebGL2||!0===e.has("OES_texture_float_linear")?(a.rectAreaLTC1=su.LTC_FLOAT_1,a.rectAreaLTC2=su.LTC_FLOAT_2):!0===e.has("OES_texture_half_float_linear")?(a.rectAreaLTC1=su.LTC_HALF_1,a.rectAreaLTC2=su.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),a.ambient[0]=h,a.ambient[1]=c,a.ambient[2]=d;let S=a.hash;(S.directionalLength!==u||S.pointLength!==p||S.spotLength!==f||S.rectAreaLength!==m||S.hemiLength!==g||S.numDirectionalShadows!==v||S.numPointShadows!==y||S.numSpotShadows!==x||S.numSpotMaps!==b)&&(a.directional.length=u,a.spot.length=f,a.rectArea.length=m,a.point.length=p,a.hemi.length=g,a.directionalShadow.length=v,a.directionalShadowMap.length=v,a.pointShadow.length=y,a.pointShadowMap.length=y,a.spotShadow.length=x,a.spotShadowMap.length=x,a.directionalShadowMatrix.length=v,a.pointShadowMatrix.length=y,a.spotLightMatrix.length=x+b-w,a.spotLightMap.length=b,a.numSpotLightShadowsWithMaps=w,S.directionalLength=u,S.pointLength=p,S.spotLength=f,S.rectAreaLength=m,S.hemiLength=g,S.numDirectionalShadows=v,S.numPointShadows=y,S.numSpotShadows=x,S.numSpotMaps=b,a.version=a8++)},setupView:function(e,t){let i=0,r=0,s=0,d=0,u=0,p=t.matrixWorldInverse;for(let t=0,f=e.length;t<f;t++){let f=e[t];if(f.isDirectionalLight){let e=a.directional[i];e.direction.setFromMatrixPosition(f.matrixWorld),o.setFromMatrixPosition(f.target.matrixWorld),e.direction.sub(o),e.direction.transformDirection(p),i++}else if(f.isSpotLight){let e=a.spot[s];e.position.setFromMatrixPosition(f.matrixWorld),e.position.applyMatrix4(p),e.direction.setFromMatrixPosition(f.matrixWorld),o.setFromMatrixPosition(f.target.matrixWorld),e.direction.sub(o),e.direction.transformDirection(p),s++}else if(f.isRectAreaLight){let e=a.rectArea[d];e.position.setFromMatrixPosition(f.matrixWorld),e.position.applyMatrix4(p),c.identity(),h.copy(f.matrixWorld),h.premultiply(
3111p),c.extractRotation(h),e.halfWidth.set(.5*f.width,0,0),e.halfHeight.set(0,.5*f.height,0),e.halfWidth.applyMatrix4(c),e.halfHeight.applyMatrix4(c),d++}else if(f.isPointLight){let e=a.point[r];e.position.setFromMatrixPosition(f.matrixWorld),e.position.applyMatrix4(p),r++}else if(f.isHemisphereLight){let e=a.hemi[u];e.direction.setFromMatrixPosition(f.matrixWorld),e.direction.transformDirection(p),u++}}},state:a}}function ne(e,t){let i=new a7(e,t),r=[],s=[];return{init:function(){r.length=0,s.length=0},state:{lightsArray:r,shadowsArray:s,lights:i},setupLights:function(e){i.setup(r,e)},setupLightsView:function(e){i.setupView(r,e)},pushLight:function(e){r.push(e)},pushShadow:function(e){s.push(e)}}}function nt(e,t){let i=new WeakMap;return{get:function(r,s=0){let a=i.get(r),o;return void 0===a?(o=new ne(e,t),i.set(r,[o])):s>=a.length?(o=new ne(e,t),a.push(o)):o=a[s],o},dispose:function(){i=new WeakMap}}}var ni=class extends r_{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=3200,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}},nr=class extends r_{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.referencePosition=new iy,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}},ns=`void main() {
3112	gl_Position = vec4( position, 1.0 );
3113}`,na=`uniform sampler2D shadow_pass;
3114uniform vec2 resolution;
3115uniform float radius;
3116#include <packing>
3117void main() {
3118	const float samples = float( VSM_SAMPLES );
3119	float mean = 0.0;
3120	float squared_mean = 0.0;
3121	float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );
3122	float uvStart = samples <= 1.0 ? 0.0 : - 1.0;
3123	for ( float i = 0.0; i < samples; i ++ ) {
3124		float uvOffset = uvStart + i * uvStride;
3125		#ifdef HORIZONTAL_PASS
3126			vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );
3127			mean += distribution.x;
3128			squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;
3129		#else
3130			float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );
3131			mean += depth;
3132			squared_mean += depth * depth;
3133		#endif
3134	}
3135	mean = mean / samples;
3136	squared_mean = squared_mean / samples;
3137	float std_dev = sqrt( squared_mean - mean * mean );
3138	gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
3139}`;function nn(e,t,i){let r=new so,s=new tZ,a=new tZ,o=new id,h=new ni({depthPacking:3201}),c=new nr,d={},u=i.maxTextureSize,p={0:1,1:0,2:2},f=new r5({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new tZ},radius:{value:4}},vertexShader:ns,fragmentShader:na}),m=f.clone();m.defines.HORIZONTAL_PASS=1;let g=new rz;g.setAttribute("position",new rE(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let v=new rK(g,f),y=this;function x(t,i,r,s,a,o){let u=null,f=!0===r.isPointLight?t.customDistanceMaterial:t.customDepthMaterial;if(void 0!==f)u=f;else if(u=!0===r.isPointLight?c:h,e.localClippingEnabled&&!0===i.clipShadows&&Array.isArray(i.clippingPlanes)&&0!==i.clippingPlanes.length||i.displacementMap&&0!==i.displacementScale||i.alphaMap&&i.alphaTest>0||i.map&&i.alphaTest>0){let e=u.uuid,t=i.uuid,r=d[e];void 0===r&&(r={},d[e]=r);let s=r[t];void 0===s&&(s=u.clone(),r[t]=s),u=s}return u.visible=i.visible,u.wireframe=i.wireframe,3===o?u.side=null!==i.shadowSide?i.shadowSide:i.side:u.side=null!==i.shadowSide?i.shadowSide:p[i.side],u.alphaMap=i.alphaMap,u.alphaTest=i.alphaTest,u.map=i.map,u.clipShadows=i.clipShadows,u.clippingPlanes=i.clippingPlanes,u.clipIntersection=i.clipIntersection,u.displacementMap=i.displacementMap,u.displacementScale=i.displacementScale,u.displacementBias=i.displacementBias,u.wireframeLinewidth=i.wireframeLinewidth,u.linewidth=i.linewidth,!0===r.isPointLight&&!0===u.isMeshDistanceMaterial&&(u.referencePosition.setFromMatrixPosition(r.matrixWorld),u.nearDistance=s,u.farDistance=a),u}this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=1,this.render=function(i,h,c){if(!1===y.enabled||!1===y.autoUpdate&&!1===y.needsUpdate||0===i.length)return;let d=e.getRenderTarget(),p=e.getActiveCubeFace(),g=e.getActiveMipmapLevel(),b=e.state;b.setBlending(0),b.buffers.color.setClear(1,1,1,1),b.buffers.depth.setTest(!0),b.setScissorTest(!1);for(let d=0,p=i.length;d<p;d++){let p=i[d],g=p.shadow;if(void 0===g){console.warn("THREE.WebGLShadowMap:",p,"has no shadow.");continue}if(!1===g.autoUpdate&&!1===g.needsUpdate)continue;s.copy(g.mapSize);let y=g.getFrameExtents();if(s.multiply(y),a.copy(g.mapSize),(s.x>u||s.y>u)&&(s.x>u&&(a.x=Math.floor(u/y.x),s.x=a.x*y.x,g.mapSize.x=a.x),s.y>u&&(a.y=Math.floor(u/y.y),s.y=a.y*y.y,g.mapSize.y=a.y)),null===g.map){let e=3!==this.type?{minFilter:1003,magFilter:1003}:{};g.map=new iu(s.x,s.y,e),g.map.texture.name=p.name+".shadowMap",g.camera.updateProjectionMatrix()}e.setRenderTarget(g.map),e.clear();let w=g.getViewportCount();for(let i=0;i<w;i++){let s=g.getViewport(i);o.set(a.x*s.x,a.y*s.y,a.x*s.z,a.y*s.w),b.viewport(o),g.updateMatrices(p,i),r=g.getFrustum(),function i(s,a,o,h,c){if(!1===s.visible)return;if(s.layers.test(a.layers)&&(s.isMesh||s.isLine||s.isPoints)&&(s.castShadow||s.receiveShadow&&3===c)&&(!s.frustumCulled||r.intersectsObject(s))){s.modelViewMatrix.multiplyMatrices(o.matrixWorldInverse,s.matrixWorld);let i=t.update(s),r=s.material;if(Array.isArray(r)){let t=i.groups;for(let a=0,d=t.length;a<d;a++){let d=t[a],u=r[d.materialIndex];if(u&&u.visible){let t=x(s,u,h,o.near,o.far,c);e.renderBufferDirect(o,null,i,t,s,d)}}}else if(r.visible){let t=x(s,r,h,o.near,o.far,c);e.renderBufferDirect(o,null,i,t,s,null)}}let d=s.children;for(let e=0,t=d.length;e<t;e++)i(d[e],a,o,h,c)}(h,c,g.camera,p,this.type)}!0!==g.isPointLightShadow&&3===this.type&&function(i,r){let a=t.update(v);f.defines.VSM_SAMPLES!==i.blurSamples&&(f.defines.VSM_SAMPLES=i.blurSamples,m.defines.VSM_SAMPLES=i.blurSamples,f.needsUpdate=!0,m.needsUpdate=!0),null===i.mapPass&&(i.mapPass=new iu(s.x,s.y)),f.uniforms.shadow_pass.value=i.map.texture,f.uniforms.resolution.value=i.mapSize,f.uniforms.radius.value=i.radius,e.setRenderTarget(i.mapPass),e.clear(),e.renderBufferDirect(r,null,a,f,v,null),m.uniforms.shadow_pass.value=i.mapPass.texture,m.uniforms.resolution.value=i.mapSize,m.uniforms.radius.value=i.radius,e.setRenderTarget(i.map),e.clear(),e.renderBufferDirect(r,null,a,m,v,null)}(g,c),g.needsUpdate=!1}y.needsUpdate=!1,e.setRenderTarget(d,p,g)}}
3139function no(e,t,i){let r=i.isWebGL2,s=new function(){let t=!1,i=new id,r=null,s=new id(0,0,0,0);return{setMask:function(i){r===i||t||(e.colorMask(i,i,i,i),r=i)},setLocked:function(e){t=e},setClear:function(t,r,a,o,h){!0===h&&(t*=o,r*=o,a*=o),i.set(t,r,a,o),!1===s.equals(i)&&(e.clearColor(t,r,a,o),s.copy(i))},reset:function(){t=!1,r=null,s.set(-1,0,0,0)}}},a=new function(){let t=!1,i=null,r=null,s=null;return{setTest:function(e){e?U(2929):V(2929)},setMask:function(r){i===r||t||(e.depthMask(r),i=r)},setFunc:function(t){if(r!==t){switch(t){case 0:e.depthFunc(512);break;case 1:e.depthFunc(519);break;case 2:e.depthFunc(513);break;case 3:default:e.depthFunc(515);break;case 4:e.depthFunc(514);break;case 5:e.depthFunc(518);break;case 6:e.depthFunc(516);break;case 7:e.depthFunc(517)}r=t}},setLocked:function(e){t=e},setClear:function(t){s!==t&&(e.clearDepth(t),s=t)},reset:function(){t=!1,i=null,r=null,s=null}}},o=new function(){let t=!1,i=null,r=null,s=null,a=null,o=null,h=null,c=null,d=null;return{setTest:function(e){t||(e?U(2960):V(2960))},setMask:function(r){i===r||t||(e.stencilMask(r),i=r)},setFunc:function(t,i,o){(r!==t||s!==i||a!==o)&&(e.stencilFunc(t,i,o),r=t,s=i,a=o)},setOp:function(t,i,r){(o!==t||h!==i||c!==r)&&(e.stencilOp(t,i,r),o=t,h=i,c=r)},setLocked:function(e){t=e},setClear:function(t){d!==t&&(e.clearStencil(t),d=t)},reset:function(){t=!1,i=null,r=null,s=null,a=null,o=null,h=null,c=null,d=null}}},h=new WeakMap,c=new WeakMap,d={},u={},p=new WeakMap,f=[],m=null,g=!1,v=null,y=null,x=null,b=null,w=null,_=null,S=null,C=!1,M=null,E=null,A=null,T=null,P=null,D=e.getParameter(35661),O=!1,L=e.getParameter(7938);-1!==L.indexOf("WebGL")?O=parseFloat(/^WebGL (\d)/.exec(L)[1])>=1:-1!==L.indexOf("OpenGL ES")&&(O=parseFloat(/^OpenGL ES (\d)/.exec(L)[1])>=2);let I=null,R={},k=e.getParameter(3088),B=e.getParameter(2978),z=new id().fromArray(k),N=new id().fromArray(B);function F(t,i,r){let s=new Uint8Array(4),a=e.createTexture();e.bindTexture(t,a),e.texParameteri(t,10241,9728),e.texParameteri(t,10240,9728);for(let t=0;t<r;t++)e.texImage2D(i+t,0,6408,1,1,0,6408,5121,s);return a}let j={};function U(t){!0!==d[t]&&(e.enable(t),d[t]=!0)}function V(t){!1!==d[t]&&(e.disable(t),d[t]=!1)}j[3553]=F(3553,3553,1),j[34067]=F(34067,34069,6),s.setClear(0,0,0,1),a.setClear(1),o.setClear(0),U(2929),a.setFunc(3),q(!1),X(1),U(2884),G(0);let W={100:32774,101:32778,102:32779};if(r)W[103]=32775,W[104]=32776;else{let e=t.get("EXT_blend_minmax");null!==e&&(W[103]=e.MIN_EXT,W[104]=e.MAX_EXT)}let H={200:0,201:1,202:768,204:770,210:776,208:774,206:772,203:769,205:771,209:775,207:773};function G(t,i,r,s,a,o,h,c){if(0===t){!0===g&&(V(3042),g=!1);return}if(!1===g&&(U(3042),g=!0),5!==t){if(t!==v||c!==C){if((100!==y||100!==w)&&(e.blendEquation(32774),y=100,w=100),c)switch(t){case 1:e.blendFuncSeparate(1,771,1,771);break;case 2:e.blendFunc(1,1);break;case 3:e.blendFuncSeparate(0,769,0,1);break;case 4:e.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",t)}else switch(t){case 1:e.blendFuncSeparate(770,771,1,771);break;case 2:e.blendFunc(770,1);break;case 3:e.blendFuncSeparate(0,769,0,1);break;case 4:e.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",t)}x=null,b=null,_=null,S=null,v=t,C=c}return}a=a||i,o=o||r,h=h||s,(i!==y||a!==w)&&(e.blendEquationSeparate(W[i],W[a]),y=i,w=a),(r!==x||s!==b||o!==_||h!==S)&&(e.blendFuncSeparate(H[r],H[s],H[o],H[h]),x=r,b=s,_=o,S=h),v=t,C=!1}function q(t){M!==t&&(t?e.frontFace(2304):e.frontFace(2305),M=t)}function X(t){0!==t?(U(2884),t!==E&&(1===t?e.cullFace(1029):2===t?e.cullFace(1028):e.cullFace(1032))):V(2884),E=t}function Y(t,i,r){t?(U(32823),(T!==i||P!==r)&&(e.polygonOffset(i,r),T=i,P=r)):V(32823)}return{buffers:{color:s,depth:a,stencil:o},enable:U,disable:V,bindFramebuffer:function(t,i){return u[t]!==i&&(e.bindFramebuffer(t,i),u[t]=i,r&&(36009===t&&(u[36160]=i),36160===t&&(u[36009]=i)),!0)},drawBuffers:function(r,s){let a=f,o=!1;if(r)if(void 0===(a=p.get(s))&&(a=[],p.set(s,a)),r.isWebGLMultipleRenderTargets){let e=r.texture;if(a.length!==e.length||36064!==a[0]){for(let t=0,i=e.length;t<i;t++)a[t]=36064+t;a.length=e.length,o=!0}}else 36064!==a[0]&&(a[0]=36064,o=!0);else 1029!==a[0]&&(a[0]=1029,o=!0);
3139o&&(i.isWebGL2?e.drawBuffers(a):t.get("WEBGL_draw_buffers").drawBuffersWEBGL(a))},useProgram:function(t){return m!==t&&(e.useProgram(t),m=t,!0)},setBlending:G,setMaterial:function(e,t){2===e.side?V(2884):U(2884);let i=1===e.side;t&&(i=!i),q(i),1===e.blending&&!1===e.transparent?G(0):G(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha,e.premultipliedAlpha),a.setFunc(e.depthFunc),a.setTest(e.depthTest),a.setMask(e.depthWrite),s.setMask(e.colorWrite);let r=e.stencilWrite;o.setTest(r),r&&(o.setMask(e.stencilWriteMask),o.setFunc(e.stencilFunc,e.stencilRef,e.stencilFuncMask),o.setOp(e.stencilFail,e.stencilZFail,e.stencilZPass)),Y(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits),!0===e.alphaToCoverage?U(32926):V(32926)},setFlipSided:q,setCullFace:X,setLineWidth:function(t){t!==A&&(O&&e.lineWidth(t),A=t)},setPolygonOffset:Y,setScissorTest:function(e){e?U(3089):V(3089)},activeTexture:function(t){void 0===t&&(t=33984+D-1),I!==t&&(e.activeTexture(t),I=t)},bindTexture:function(t,i,r){void 0===r&&(r=null===I?33984+D-1:I);let s=R[r];void 0===s&&(s={type:void 0,texture:void 0},R[r]=s),(s.type!==t||s.texture!==i)&&(I!==r&&(e.activeTexture(r),I=r),e.bindTexture(t,i||j[t]),s.type=t,s.texture=i)},unbindTexture:function(){let t=R[I];void 0!==t&&void 0!==t.type&&(e.bindTexture(t.type,null),t.type=void 0,t.texture=void 0)},compressedTexImage2D:function(){try{e.compressedTexImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},compressedTexImage3D:function(){try{e.compressedTexImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texImage2D:function(){try{e.texImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texImage3D:function(){try{e.texImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},updateUBOMapping:function(t,i){let r=c.get(i);void 0===r&&(r=new WeakMap,c.set(i,r));let s=r.get(t);void 0===s&&(s=e.getUniformBlockIndex(i,t.name),r.set(t,s))},uniformBlockBinding:function(t,i){let r=c.get(i).get(t);h.get(i)!==r&&(e.uniformBlockBinding(i,r,t.__bindingPointIndex),h.set(i,r))},texStorage2D:function(){try{e.texStorage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texStorage3D:function(){try{e.texStorage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texSubImage2D:function(){try{e.texSubImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texSubImage3D:function(){try{e.texSubImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},compressedTexSubImage2D:function(){try{e.compressedTexSubImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},compressedTexSubImage3D:function(){try{e.compressedTexSubImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},scissor:function(t){!1===z.equals(t)&&(e.scissor(t.x,t.y,t.z,t.w),z.copy(t))},viewport:function(t){!1===N.equals(t)&&(e.viewport(t.x,t.y,t.z,t.w),N.copy(t))},reset:function(){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(0xffffffff),e.stencilFunc(519,0,0xffffffff),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),!0===r&&(e.bindFramebuffer(36009,null),e.bindFramebuffer(36008,null)),e.useProgram(null),e.lineWidth(1),e.scissor(0,0,e.canvas.width,e.canvas.height),e.viewport(0,0,e.canvas.width,e.canvas.height),d={},I=null,R={},u={},p=new WeakMap,f=[],m=null,g=!1,v=null,y=null,x=null,b=null,w=null,_=null,S=null,C=!1,M=null,E=null,A=null,T=null,P=null,z.set(0,0,e.canvas.width,e.canvas.height),N.set(0,0,e.canvas.width,e.canvas.height),s.reset(),a.reset(),o.reset()}}}function nl(e,t,i,r,s,a,o){let h=s.isWebGL2,c=s.maxTextures,d=s.maxCubemapSize,u=s.maxTextureSize,p=s.maxSamples,f=t.has("WEBGL_multisampled_render_to_texture")?t.get("WEBGL_multisampled_render_to_texture"):null,m=!(typeof navigator>"u")&&/OculusBrowser/g.test(navigator.userAgent),g=new WeakMap,v,y=new WeakMap,x=!1;try{x="u">typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch{}function b(e,t){return x?new OffscreenCanvas(e,t):t2("canvas")}function w(e,t,i,r){let s=1;if((e.width>r||e.height>r)&&(s=r/Math.max(e.width,e.height)),s<1||!0===t)if(!("u">typeof HTMLImageElement&&e instanceof HTMLImageElement||"u">typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"u">typeof ImageBitmap&&e instanceof ImageBitmap))return"data"in e&&c
3139onsole.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+e.width+"x"+e.height+")."),e;else{let r=t?tq:Math.floor,a=r(s*e.width),o=r(s*e.height);void 0===v&&(v=b(a,o));let h=i?b(a,o):v;return h.width=a,h.height=o,h.getContext("2d").drawImage(e,0,0,a,o),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+e.width+"x"+e.height+") to ("+a+"x"+o+")."),h}return e}function _(e){return tH(e.width)&&tH(e.height)}function S(e,t){return e.generateMipmaps&&t&&1003!==e.minFilter&&1006!==e.minFilter}function C(t){e.generateMipmap(t)}function M(i,r,s,a,o=!1){if(!1===h)return r;if(null!==i){if(void 0!==e[i])return e[i];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+i+"'")}let c=r;return 6403===r&&(5126===s&&(c=33326),5131===s&&(c=33325),5121===s&&(c=33321)),33319===r&&(5126===s&&(c=33328),5131===s&&(c=33327),5121===s&&(c=33323)),6408===r&&(5126===s&&(c=34836),5131===s&&(c=34842),5121===s&&(c=3001===a&&!1===o?35907:32856),32819===s&&(c=32854),32820===s&&(c=32855)),(33325===c||33326===c||33327===c||33328===c||34842===c||34836===c)&&t.get("EXT_color_buffer_float"),c}function E(e,t,i){return!0===S(e,i)||e.isFramebufferTexture&&1003!==e.minFilter&&1006!==e.minFilter?Math.log2(Math.max(t.width,t.height))+1:void 0!==e.mipmaps&&e.mipmaps.length>0?e.mipmaps.length:e.isCompressedTexture&&Array.isArray(e.image)?t.mipmaps.length:1}function A(e){return 1003===e||1004===e||1005===e?9728:9729}function T(e){let t=e.target;t.removeEventListener("dispose",T),function(e){let t=r.get(e);if(void 0===t.__webglInit)return;let i=e.source,s=y.get(i);if(s){let r=s[t.__cacheKey];r.usedTimes--,0===r.usedTimes&&D(e),0===Object.keys(s).length&&y.delete(i)}r.remove(e)}(t),t.isVideoTexture&&g.delete(t)}function P(t){let i=t.target;i.removeEventListener("dispose",P),function(t){let i=t.texture,s=r.get(t),a=r.get(i);if(void 0!==a.__webglTexture&&(e.deleteTexture(a.__webglTexture),o.memory.textures--),t.depthTexture&&t.depthTexture.dispose(),t.isWebGLCubeRenderTarget)for(let t=0;t<6;t++)e.deleteFramebuffer(s.__webglFramebuffer[t]),s.__webglDepthbuffer&&e.deleteRenderbuffer(s.__webglDepthbuffer[t]);else{if(e.deleteFramebuffer(s.__webglFramebuffer),s.__webglDepthbuffer&&e.deleteRenderbuffer(s.__webglDepthbuffer),s.__webglMultisampledFramebuffer&&e.deleteFramebuffer(s.__webglMultisampledFramebuffer),s.__webglColorRenderbuffer)for(let t=0;t<s.__webglColorRenderbuffer.length;t++)s.__webglColorRenderbuffer[t]&&e.deleteRenderbuffer(s.__webglColorRenderbuffer[t]);s.__webglDepthRenderbuffer&&e.deleteRenderbuffer(s.__webglDepthRenderbuffer)}if(t.isWebGLMultipleRenderTargets)for(let t=0,s=i.length;t<s;t++){let s=r.get(i[t]);s.__webglTexture&&(e.deleteTexture(s.__webglTexture),o.memory.textures--),r.remove(i[t])}r.remove(i),r.remove(t)}(i)}function D(t){let i=r.get(t);e.deleteTexture(i.__webglTexture);let s=t.source,a=y.get(s);delete a[i.__cacheKey],o.memory.textures--}let O=0;function L(e,t){var s;let a,h=r.get(e);if(e.isVideoTexture&&(s=e,a=o.render.frame,g.get(s)!==a&&(g.set(s,a),s.update())),!1===e.isRenderTargetTexture&&e.version>0&&h.__version!==e.version){let i=e.image;if(null===i)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else{if(!1!==i.complete)return void z(h,e,t);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}i.bindTexture(3553,h.__webglTexture,33984+t)}let I={1e3:10497,1001:33071,1002:33648},R={1003:9728,1004:9984,1005:9986,1006:9729,1007:9985,1008:9987};function k(i,a,o){if(o?(e.texParameteri(i,10242,I[a.wrapS]),e.texParameteri(i,10243,I[a.wrapT]),(32879===i||35866===i)&&e.texParameteri(i,32882,I[a.wrapR]),e.texParameteri(i,10240,R[a.magFilter]),e.texParameteri(i,10241,R[a.minFilter])):(e.texParameteri(i,10242,33071),e.texParameteri(i,10243,33071),(32879===i||35866===i)&&e.texParameteri(i,32882,33071),(1001!==a.wrapS||1001!==a.wrapT)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),e.texParameteri(i,10240,A(a.magFilter)),e.texParameteri(i,10241,A(a.minFilter)),1003!==a.minFilter&&1006!==a.minFilter&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),!0===t.has("EXT_texture_filter_anisotropic")){let o=t.get("EXT_texture_filter_anisotropic");1003!==a.magFilter&&(1005===a.minFilter||1008===a.minFilter)&&(1015!==a.type||!1!==t.has("OES_texture_float_linear"))&&(!1!==h||1016!==a.type||!1!==t.has("OES_texture_half_float_linear"))&&(a.anisotropy>1||r.get(a).__currentAnisotropy)&&(e.texParameterf(i,o.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,s.getMaxAnisotropy())),r.get(a).__currentAnisotropy=a.anisotropy)}}function B(t,i){let r,s=!1;void 0===t.__webglInit&&(t.__webglInit=!0,i.addEventListener("dispose",T));let a=i.source,h=y.get(a);void 0===h&&(h={},y.set(a,h));let c=((r=[]).push(i.wrapS),r.push(i.wrapT),r.push(i.wrapR||0),r.push(i.magFilter),r.push(i.minFilter),r.push(i.anisotropy),r.push(i.internalFormat),r.push(i.format),r.push(i.type),r.push(i.generateMipmaps),r.push(i.premultiplyAlpha),r.push(i.flipY),r.push(i.unpackAlignment),r.push(i.encoding),r.join());if(c!==t.__cacheKey){void 0===h[c]&&(h[c]={texture:e.createTexture(),usedTimes:0},o.memory.textures++,s=!0),h[c].usedTimes++;let r=h[t.__cacheKey];void 0!==r&&(h[t.__cacheKey].usedTimes--,0===r.usedTimes&&D(i)),t.__cacheKey=c,t.__webglTexture=h[c].texture}return s}function z(t,s,o){let c=3553;(s.isDataArrayTexture||s.isCompressedArrayTexture)&&(c=35866),s.isData3DTexture&&(c=32879);let d=B(t,s),p=s.source;i.bindTexture(c,t.__webglTexture,33984+o);let f=r.get(p);if(p.version!==f.__version||!0===d){i.activeTexture(33984+o),e.pixelStorei(37440,s.flipY),e.pixelStorei(37441,s.premultiplyAlpha),e.pixelStorei(3317,s.unpackAlignment),e.pixelStorei(37443,0);let t=!h&&(1001!==s.wrapS||1001!==s.wrapT||1003!==s.minFilter&&1006!==s.minFilter)&&!1===_(s.image),r=w(s.image,t,!1,u),m=_(r=W(s,r))||h,g=a.convert(s.format,s.encoding),v=a.convert(s.type),y=M(s.internalFormat,g,v,s.encoding,s.isVideoTexture);k(c,s,m);let x,b=s.mipmaps,A=h&&!0!==s.isVideoTexture,T=void 0===f.__version||!0===d,P=E(s,r,m);if(s.isDepthTexture)y=6402,h?y=1015===s.type?36012:1014===s.type?33190:1020===s.type?35056:33189:1015===s.type&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),1026===s.format&&6402===y&&1012!==s.type&&1014!==s.type&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),s.type=1014,v=a.convert(s.type)),1027===s.format&&6402===y&&(y=34041,1020!==s.t
3139ype&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),s.type=1020,v=a.convert(s.type))),T&&(A?i.texStorage2D(3553,1,y,r.width,r.height):i.texImage2D(3553,0,y,r.width,r.height,0,g,v,null));else if(s.isDataTexture)if(b.length>0&&m){A&&T&&i.texStorage2D(3553,P,y,b[0].width,b[0].height);for(let e=0,t=b.length;e<t;e++)x=b[e],A?i.texSubImage2D(3553,e,0,0,x.width,x.height,g,v,x.data):i.texImage2D(3553,e,y,x.width,x.height,0,g,v,x.data);s.generateMipmaps=!1}else A?(T&&i.texStorage2D(3553,P,y,r.width,r.height),i.texSubImage2D(3553,0,0,0,r.width,r.height,g,v,r.data)):i.texImage2D(3553,0,y,r.width,r.height,0,g,v,r.data);else if(s.isCompressedTexture)if(s.isCompressedArrayTexture){A&&T&&i.texStorage3D(35866,P,y,b[0].width,b[0].height,r.depth);for(let e=0,t=b.length;e<t;e++)x=b[e],1023!==s.format?null!==g?A?i.compressedTexSubImage3D(35866,e,0,0,0,x.width,x.height,r.depth,g,x.data,0,0):i.compressedTexImage3D(35866,e,y,x.width,x.height,r.depth,0,x.data,0,0):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):A?i.texSubImage3D(35866,e,0,0,0,x.width,x.height,r.depth,g,v,x.data):i.texImage3D(35866,e,y,x.width,x.height,r.depth,0,g,v,x.data)}else{A&&T&&i.texStorage2D(3553,P,y,b[0].width,b[0].height);for(let e=0,t=b.length;e<t;e++)x=b[e],1023!==s.format?null!==g?A?i.compressedTexSubImage2D(3553,e,0,0,x.width,x.height,g,x.data):i.compressedTexImage2D(3553,e,y,x.width,x.height,0,x.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):A?i.texSubImage2D(3553,e,0,0,x.width,x.height,g,v,x.data):i.texImage2D(3553,e,y,x.width,x.height,0,g,v,x.data)}else if(s.isDataArrayTexture)A?(T&&i.texStorage3D(35866,P,y,r.width,r.height,r.depth),i.texSubImage3D(35866,0,0,0,0,r.width,r.height,r.depth,g,v,r.data)):i.texImage3D(35866,0,y,r.width,r.height,r.depth,0,g,v,r.data);else if(s.isData3DTexture)A?(T&&i.texStorage3D(32879,P,y,r.width,r.height,r.depth),i.texSubImage3D(32879,0,0,0,0,r.width,r.height,r.depth,g,v,r.data)):i.texImage3D(32879,0,y,r.width,r.height,r.depth,0,g,v,r.data);else if(s.isFramebufferTexture){if(T)if(A)i.texStorage2D(3553,P,y,r.width,r.height);else{let e=r.width,t=r.height;for(let r=0;r<P;r++)i.texImage2D(3553,r,y,e,t,0,g,v,null),e>>=1,t>>=1}}else if(b.length>0&&m){A&&T&&i.texStorage2D(3553,P,y,b[0].width,b[0].height);for(let e=0,t=b.length;e<t;e++)x=b[e],A?i.texSubImage2D(3553,e,0,0,g,v,x):i.texImage2D(3553,e,y,g,v,x);s.generateMipmaps=!1}else A?(T&&i.texStorage2D(3553,P,y,r.width,r.height),i.texSubImage2D(3553,0,0,0,g,v,r)):i.texImage2D(3553,0,y,g,v,r);S(s,m)&&C(c),f.__version=p.version,s.onUpdate&&s.onUpdate(s)}t.__version=s.version}function N(t,s,o,h,c){let d=a.convert(o.format,o.encoding),u=a.convert(o.type),p=M(o.internalFormat,d,u,o.encoding);r.get(s).__hasExternalTextures||(32879===c||35866===c?i.texImage3D(c,0,p,s.width,s.height,s.depth,0,d,u,null):i.texImage2D(c,0,p,s.width,s.height,0,d,u,null)),i.bindFramebuffer(36160,t),V(s)?f.framebufferTexture2DMultisampleEXT(36160,h,c,r.get(o).__webglTexture,0,U(s)):(3553===c||c>=34069&&c<=34074)&&e.framebufferTexture2D(36160,h,c,r.get(o).__webglTexture,0),i.bindFramebuffer(36160,null)}function F(t,i,r){if(e.bindRenderbuffer(36161,t),i.depthBuffer&&!i.stencilBuffer){let s=33189;if(r||V(i)){let t=i.depthTexture;t&&t.isDepthTexture&&(1015===t.type?s=36012:1014===t.type&&(s=33190));let r=U(i);V(i)?f.renderbufferStorageMultisampleEXT(36161,r,s,i.width,i.height):e.renderbufferStorageMultisample(36161,r,s,i.width,i.height)}else e.renderbufferStorage(36161,s,i.width,i.height);e.framebufferRenderbuffer(36160,36096,36161,t)}else if(i.depthBuffer&&i.stencilBuffer){let s=U(i);r&&!1===V(i)?e.renderbufferStorageMultisample(36161,s,35056,i.width,i.height):V(i)?f.renderbufferStorageMultisampleEXT(36161,s,35056,i.width,i.height):e.renderbufferStorage(36161,34041,i.width,i.height),e.framebufferRenderbuffer(36160,33306,36161,t)}else{let t=!0===i.isWebGLMultipleRenderTargets?i.texture:[i.texture];for(let s=0;s<t.length;s++){let o=t[s],h=a.convert(o.format,o.encoding),c=a.convert(o.type),d=M(o.internalFormat,h,c,o.encoding),u=U(i);r&&!1===V(i)?e.renderbufferStorageMultisample(36161,u,d,i.width,i.height):V(i)?f.renderbufferStorageMultisampleEXT(36161,u,d,i.width,i.height):e.renderbufferStorage(36161,d,i.width,i.height)}}e.bindRenderbuffer(36161,null)}
3139function j(t){let s=r.get(t),a=!0===t.isWebGLCubeRenderTarget;if(t.depthTexture&&!s.__autoAllocateDepthBuffer){if(a)throw Error("target.depthTexture not supported in Cube render targets");var o=s.__webglFramebuffer;if(t&&t.isWebGLCubeRenderTarget)throw Error("Depth Texture with cube render targets is not supported");if(i.bindFramebuffer(36160,o),!(t.depthTexture&&t.depthTexture.isDepthTexture))throw Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");r.get(t.depthTexture).__webglTexture&&t.depthTexture.image.width===t.width&&t.depthTexture.image.height===t.height||(t.depthTexture.image.width=t.width,t.depthTexture.image.height=t.height,t.depthTexture.needsUpdate=!0),L(t.depthTexture,0);let h=r.get(t.depthTexture).__webglTexture,c=U(t);if(1026===t.depthTexture.format)V(t)?f.framebufferTexture2DMultisampleEXT(36160,36096,3553,h,0,c):e.framebufferTexture2D(36160,36096,3553,h,0);else if(1027===t.depthTexture.format)V(t)?f.framebufferTexture2DMultisampleEXT(36160,33306,3553,h,0,c):e.framebufferTexture2D(36160,33306,3553,h,0);else throw Error("Unknown depthTexture format")}else if(a){s.__webglDepthbuffer=[];for(let r=0;r<6;r++)i.bindFramebuffer(36160,s.__webglFramebuffer[r]),s.__webglDepthbuffer[r]=e.createRenderbuffer(),F(s.__webglDepthbuffer[r],t,!1)}else i.bindFramebuffer(36160,s.__webglFramebuffer),s.__webglDepthbuffer=e.createRenderbuffer(),F(s.__webglDepthbuffer,t,!1);i.bindFramebuffer(36160,null)}function U(e){return Math.min(p,e.samples)}function V(e){let i=r.get(e);return h&&e.samples>0&&!0===t.has("WEBGL_multisampled_render_to_texture")&&!1!==i.__useRenderToTexture}function W(e,i){let r=e.encoding,s=e.format,a=e.type;return!0===e.isCompressedTexture||!0===e.isVideoTexture||1035===e.format||3e3!==r&&(3001===r?!1===h?!0===t.has("EXT_sRGB")&&1023===s?(e.format=1035,e.minFilter=1006,e.generateMipmaps=!1):i=ia.sRGBToLinear(i):(1023!==s||1009!==a)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture encoding:",r)),i}this.allocateTextureUnit=function(){let e=O;return e>=c&&console.warn("THREE.WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+c),O+=1,e},this.resetTextureUnits=function(){O=0},this.setTexture2D=L,this.setTexture2DArray=function(e,t){let s=r.get(e);e.version>0&&s.__version!==e.version?z(s,e,t):i.bindTexture(35866,s.__webglTexture,33984+t)},this.setTexture3D=function(e,t){let s=r.get(e);e.version>0&&s.__version!==e.version?z(s,e,t):i.bindTexture(32879,s.__webglTexture,33984+t)},this.setTextureCube=function(t,s){let o=r.get(t);t.version>0&&o.__version!==t.version?function(t,s,o){if(6!==s.image.length)return;let c=B(t,s),u=s.source;i.bindTexture(34067,t.__webglTexture,33984+o);let p=r.get(u);if(u.version!==p.__version||!0===c){let t;i.activeTexture(33984+o),e.pixelStorei(37440,s.flipY),e.pixelStorei(37441,s.premultiplyAlpha),e.pixelStorei(3317,s.unpackAlignment),e.pixelStorei(37443,0);let r=s.isCompressedTexture||s.image[0].isCompressedTexture,f=s.image[0]&&s.image[0].isDataTexture,m=[];for(let e=0;e<6;e++)r||f?m[e]=f?s.image[e].image:s.image[e]:m[e]=w(s.image[e],!1,!0,d),m[e]=W(s,m[e]);let g=m[0],v=_(g)||h,y=a.convert(s.format,s.encoding),x=a.convert(s.type),b=M(s.internalFormat,y,x,s.encoding),A=h&&!0!==s.isVideoTexture,T=void 0===p.__version||!0===c,P=E(s,g,v);if(k(34067,s,v),r){A&&T&&i.texStorage2D(34067,P,b,g.width,g.height);for(let e=0;e<6;e++){t=m[e].mipmaps;for(let r=0;r<t.length;r++){let a=t[r];1023!==s.format?null!==y?A?i.compressedTexSubImage2D(34069+e,r,0,0,a.width,a.height,y,a.data):i.compressedTexImage2D(34069+e,r,b,a.width,a.height,0,a.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):A?i.texSubImage2D(34069+e,r,0,0,a.width,a.height,y,x,a.data):i.texImage2D(34069+e,r,b,a.width,a.height,0,y,x,a.data)}}}else{t=s.mipmaps,A&&T&&(t.length>0&&P++,i.texStorage2D(34067,P,b,m[0].width,m[0].height));for(let e=0;e<6;e++)if(f){A?i.texSubImage2D(34069+e,0,0,0,m[e].width,m[e].height,y,x,m[e].data):i.texImage2D(34069+e,0,b,m[e].width,m[e].height,0,y,x,m[e].data);for(let r=0;r<t.length;r++){let s=t[r].image[e].image;A?i.texSubImage2D(34069+e,r+1,0,0,s.width,s.height,y,x,s.data):i.texImage2D(34069+e,r+1,b,s.width,s.height,0,y,x,s.data)}}else{A?i.texSubImage2D(34069+e,0,0,0,y,x,m[e]):i.texImage2D(34069+e,0,b,y,x,m[e]);for(let r=0;r<t.length;r++){let s=t[r];A?i.texSubImage2D(34069+e,r+1,0,0,y,x,s.image[e]):i.texImage2D(34069+e,r+1,b,y,x,s.image[e])}}}
vendor: 3,199 bytes, line 3139
3139S(s,v)&&C(34067),p.__version=u.version,s.onUpdate&&s.onUpdate(s)}t.__version=s.version}(o,t,s):i.bindTexture(34067,o.__webglTexture,33984+s)},this.rebindTextures=function(e,t,i){let s=r.get(e);void 0!==t&&N(s.__webglFramebuffer,e,e.texture,36064,3553),void 0!==i&&j(e)},this.setupRenderTarget=function(t){let c=t.texture,d=r.get(t),u=r.get(c);t.addEventListener("dispose",P),!0!==t.isWebGLMultipleRenderTargets&&(void 0===u.__webglTexture&&(u.__webglTexture=e.createTexture()),u.__version=c.version,o.memory.textures++);let p=!0===t.isWebGLCubeRenderTarget,f=!0===t.isWebGLMultipleRenderTargets,m=_(t)||h;if(p){d.__webglFramebuffer=[];for(let t=0;t<6;t++)d.__webglFramebuffer[t]=e.createFramebuffer()}else{if(d.__webglFramebuffer=e.createFramebuffer(),f)if(s.drawBuffers){let i=t.texture;for(let t=0,s=i.length;t<s;t++){let s=r.get(i[t]);void 0===s.__webglTexture&&(s.__webglTexture=e.createTexture(),o.memory.textures++)}}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");if(h&&t.samples>0&&!1===V(t)){let r=f?c:[c];d.__webglMultisampledFramebuffer=e.createFramebuffer(),d.__webglColorRenderbuffer=[],i.bindFramebuffer(36160,d.__webglMultisampledFramebuffer);for(let i=0;i<r.length;i++){let s=r[i];d.__webglColorRenderbuffer[i]=e.createRenderbuffer(),e.bindRenderbuffer(36161,d.__webglColorRenderbuffer[i]);let o=a.convert(s.format,s.encoding),h=a.convert(s.type),c=M(s.internalFormat,o,h,s.encoding,!0===t.isXRRenderTarget),u=U(t);e.renderbufferStorageMultisample(36161,u,c,t.width,t.height),e.framebufferRenderbuffer(36160,36064+i,36161,d.__webglColorRenderbuffer[i])}e.bindRenderbuffer(36161,null),t.depthBuffer&&(d.__webglDepthRenderbuffer=e.createRenderbuffer(),F(d.__webglDepthRenderbuffer,t,!0)),i.bindFramebuffer(36160,null)}}if(p){i.bindTexture(34067,u.__webglTexture),k(34067,c,m);for(let e=0;e<6;e++)N(d.__webglFramebuffer[e],t,c,36064,34069+e);S(c,m)&&C(34067),i.unbindTexture()}else if(f){let e=t.texture;for(let s=0,a=e.length;s<a;s++){let a=e[s],o=r.get(a);i.bindTexture(3553,o.__webglTexture),k(3553,a,m),N(d.__webglFramebuffer,t,a,36064+s,3553),S(a,m)&&C(3553)}i.unbindTexture()}else{let e=3553;(t.isWebGL3DRenderTarget||t.isWebGLArrayRenderTarget)&&(h?e=t.isWebGL3DRenderTarget?32879:35866:console.error("THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.")),i.bindTexture(e,u.__webglTexture),k(e,c,m),N(d.__webglFramebuffer,t,c,36064,e),S(c,m)&&C(e),i.unbindTexture()}t.depthBuffer&&j(t)},this.updateRenderTargetMipmap=function(e){let t=_(e)||h,s=!0===e.isWebGLMultipleRenderTargets?e.texture:[e.texture];for(let a=0,o=s.length;a<o;a++){let o=s[a];if(S(o,t)){let t=e.isWebGLCubeRenderTarget?34067:3553,s=r.get(o).__webglTexture;i.bindTexture(t,s),C(t),i.unbindTexture()}}},this.updateMultisampleRenderTarget=function(t){if(h&&t.samples>0&&!1===V(t)){let s=t.isWebGLMultipleRenderTargets?t.texture:[t.texture],a=t.width,o=t.height,h=16384,c=[],d=t.stencilBuffer?33306:36096,u=r.get(t),p=!0===t.isWebGLMultipleRenderTargets;if(p)for(let t=0;t<s.length;t++)i.bindFramebuffer(36160,u.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(36160,36064+t,3
31396161,null),i.bindFramebuffer(36160,u.__webglFramebuffer),e.framebufferTexture2D(36009,36064+t,3553,null,0);i.bindFramebuffer(36008,u.__webglMultisampledFramebuffer),i.bindFramebuffer(36009,u.__webglFramebuffer);for(let i=0;i<s.length;i++){c.push(36064+i),t.depthBuffer&&c.push(d);let f=void 0!==u.__ignoreDepthValues&&u.__ignoreDepthValues;if(!1===f&&(t.depthBuffer&&(h|=256),t.stencilBuffer&&(h|=1024)),p&&e.framebufferRenderbuffer(36008,36064,36161,u.__webglColorRenderbuffer[i]),!0===f&&(e.invalidateFramebuffer(36008,[d]),e.invalidateFramebuffer(36009,[d])),p){let t=r.get(s[i]).__webglTexture;e.framebufferTexture2D(36009,36064,3553,t,0)}e.blitFramebuffer(0,0,a,o,0,0,a,o,h,9728),m&&e.invalidateFramebuffer(36008,c)}if(i.bindFramebuffer(36008,null),i.bindFramebuffer(36009,null),p)for(let t=0;t<s.length;t++){i.bindFramebuffer(36160,u.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(36160,36064+t,36161,u.__webglColorRenderbuffer[t]);let a=r.get(s[t]).__webglTexture;i.bindFramebuffer(36160,u.__webglFramebuffer),e.framebufferTexture2D(36009,36064+t,3553,a,0)}i.bindFramebuffer(36009,u.__webglMultisampledFramebuffer)}},this.setupDepthRenderbuffer=j,this.setupFrameBufferTexture=N,this.useMultisampledRTT=V}function nh(e,t,i){let r=i.isWebGL2;return{convert:function(i,s=null){let a;if(1009===i)return 5121;if(1017===i)return 32819;if(1018===i)return 32820;if(1010===i)return 5120;if(1011===i)return 5122;if(1012===i)return 5123;if(1013===i)return 5124;if(1014===i)return 5125;if(1015===i)return 5126;if(1016===i)return r?5131:null!==(a=t.get("OES_texture_half_float"))?a.HALF_FLOAT_OES:null;if(1021===i)return 6406;if(1023===i)return 6408;if(1024===i)return 6409;if(1025===i)return 6410;if(1026===i)return 6402;if(1027===i)return 34041;if(1035===i)return null!==(a=t.get("EXT_sRGB"))?a.SRGB_ALPHA_EXT:null;if(1028===i)return 6403;if(1029===i)return 36244;if(1030===i)return 33319;if(1031===i)return 33320;if(1033===i)return 36249;if(33776===i||33777===i||33778===i||33779===i)if(3001===s)if(null===(a=t.get("WEBGL_compressed_texture_s3tc_srgb")))return null;else{if(33776===i)return a.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(33777===i)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(33778===i)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(33779===i)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{if(null===(a=t.get("WEBGL_compressed_texture_s3tc")))return null;if(33776===i)return a.COMPRESSED_RGB_S3TC_DXT1_EXT;if(33777===i)return a.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(33778===i)return a.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(33779===i)return a.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(35840===i||35841===i||35842===i||35843===i)if(null===(a=t.get("WEBGL_compressed_texture_pvrtc")))return null;else{if(35840===i)return a.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(35841===i)return a.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(35842===i)return a.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(35843===i)return a.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(36196===i)return null!==(a=t.get("WEBGL_compressed_texture_etc1"))?a.COMPRESSED_RGB_ETC1_WEBGL:null;if(37492===i||37496===i)if(null===(a=t.get("WEBGL_compressed_texture_etc")))return null;else{if(37492===i)return 3001===s?a.COMPRESSED_SRGB8_ETC2:a.COMPRESSED_RGB8_ETC2;if(37496===i)return 3001===s?a.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:a.COMPRESSED_RGBA8_ETC2_EAC}if(37808===i||37809===i||37810===i||37811===i||37812===i||37813===i||37814===i||37815===i||37816===i||37817===i||37818===i||37819===i||37820===i||37821===i)if(null===(a=t.get("WEBGL_compressed_texture_astc")))return null;else{if(37808===i)return 3001===s?a.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:a.COMPRESSED_RGBA_ASTC_4x4_KHR;if(37809===i)return 3001===s?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:a.COMPRESSED_RGBA_ASTC_5x4_KHR;if(37810===i)return 3001===s?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:a.COMPRESSED_RGBA_ASTC_5x5_KHR;if(37811===i)return 3001===s?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:a.COMPRESSED_RGBA_ASTC_6x5_KHR;if(37812===i)return 3001===s?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:a.COMPRESSED_RGBA_ASTC_6x6_KHR;if(37813===i)return 3001===s?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:a.COMPRESSED_RGBA_ASTC_8x5_KHR;if(37814===i)return 3001===s?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:a.COMPRESSED_RGBA_ASTC_8x6_KHR;if(37815===i)return 3001===s?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:a.COMPRESSED_RGBA_ASTC_8x8_KHR;if(37816===i)return 3001===s?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:a.COMPRESSED_RGBA_ASTC_10x5_KHR;if(37817===i)return 3001===s?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:a.COMPRESSED_RGBA_ASTC_10x6_KHR;if(37818===i)return 3001===s?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:a.COMPRESSED_RGBA_ASTC_10x8_KHR;if(37819===i)return 3001===s?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:a.COMPRESSED_RGBA_ASTC_10x10_KHR;if(37820===i)return 3001===s?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:a.COMPRESSED_RGBA_ASTC_12x10_KHR;if(37821===i)return 3001===s?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:a.COMPRESSED_RGBA_ASTC_12x12_KHR}if(36492===i){if(null===(a=t.get("EXT_texture_compression_bptc")))return null;else if(36492===i)return 3001===s?a.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:a.COMPRESSED_RGBA_BPTC_UNORM_EXT}if(36283===i||36284===i||36285===i||36286===i)if(null===(a=t.get("EXT_texture_compression_rgtc")))return null;
3139else{if(36492===i)return a.COMPRESSED_RED_RGTC1_EXT;if(36284===i)return a.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(36285===i)return a.COMPRESSED_RED_GREEN_RGTC2_EXT;if(36286===i)return a.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}return 1020===i?r?34042:null!==(a=t.get("WEBGL_depth_texture"))?a.UNSIGNED_INT_24_8_WEBGL:null:void 0!==e[i]?e[i]:null}}}var nc=class extends r8{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}},nd=class extends rh{constructor(){super(),this.isGroup=!0,this.type="Group"}},nu={type:"move"},np=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return null===this._hand&&(this._hand=new nd,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return null===this._targetRay&&(this._targetRay=new nd,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new iy,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new iy),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new nd,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new iy,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new iy),this._grip}dispatchEvent(e){return null!==this._targetRay&&this._targetRay.dispatchEvent(e),null!==this._grip&&this._grip.dispatchEvent(e),null!==this._hand&&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}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this}update(e,t,i){let r=null,s=null,a=null,o=this._targetRay,h=this._grip,c=this._hand;if(e&&"visible-blurred"!==t.session.visibilityState){if(c&&e.hand){for(let r of(a=!0,e.hand.values())){let e=t.getJointPose(r,i),s=this._getHandJoint(c,r);null!==e&&(s.matrix.fromArray(e.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),s.jointRadius=e.radius),s.visible=null!==e}let r=c.joints["index-finger-tip"],s=c.joints["thumb-tip"],o=r.position.distanceTo(s.position);c.inputState.pinching&&o>.025?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&o<=.015&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else null!==h&&e.gripSpace&&null!==(s=t.getPose(e.gripSpace,i))&&(h.matrix.fromArray(s.transform.matrix),h.matrix.decompose(h.position,h.rotation,h.scale),s.linearVelocity?(h.hasLinearVelocity=!0,h.linearVelocity.copy(s.linearVelocity)):h.hasLinearVelocity=!1,s.angularVelocity?(h.hasAngularVelocity=!0,h.angularVelocity.copy(s.angularVelocity)):h.hasAngularVelocity=!1);null!==o&&(null===(r=t.getPose(e.targetRaySpace,i))&&null!==s&&(r=s),null!==r&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(nu)))}return null!==o&&(o.visible=null!==r),null!==h&&(h.visible=null!==s),null!==c&&(c.visible=null!==a),this}_getHandJoint(e,t){if(void 0===e.joints[t.jointName]){let i=new nd;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[t.jointName]=i,e.add(i)}return e.joints[t.jointName]}},nf=class extends ic{constructor(e,t,i,r,s,a,o,h,c,d){if(1026!==(d=void 0!==d?d:1026)&&1027!==d)throw Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===i&&1026===d&&(i=1014),void 0===i&&1027===d&&(i=1020),super(null,r,s,a,o,h,d,i,c),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=void 0!==o?o:1003,this.minFilter=void 0!==h?h:1003,this.flipY=!1,this.generateMipmaps=!1}},nm=class extends tk{constructor(e,t){super();let i=this,r=null,s=1,a=null,o="local-floor",h=1,c=null,d=null,u=null,p=null,f=null,m=null,g=t.getContextAttributes(),v=null,y=null,x=[],b=[],w=new Set,_=new Map,S=new r8;S.layers.enable(1),S.viewport=new id;let C=new r8;C.layers.enable(2),C.viewport=new id;let M=[S,C],E=new nc;E.layers.enable(1),E.layers.enable(2);let A=null,T=null;function P(e){let t=b.indexOf(e.inputSource);if(-1===t)return;let i=x[t];void 0!==i&&i.dispatchEvent({type:e.type,data:e.inputSource})}function D(){r.removeEventListener("select",P),r.removeEventListener("selectstart",P),r.removeEventListener("selectend",P),r.removeEventListener("squeeze",P),r.removeEventListener("squeezestart",P),r.removeEventListener("squeezeend",P),r.removeEventListener("end",D),r.removeEventListener("inputsourceschange",O);for(let e=0;e<x.length;e++){let t=b[e];null!==t&&(b[e]=null,x[e].disconnect(t))}A=null,T=null,e.setRenderTarget(v),f=null,p=null,u=null,r=null,y=null,B.stop(),i.isPresenting=!1,i.dispatchEvent({type:"sessionend"})}function O(e){for(let t=0;t<e.removed.length;t++){let i=e.removed[t],r=b.indexOf(i);r>=0&&(b[r]=null,x[r].disconnect(i))}for(let t=0;t<e.added.length;t++){let i=e.added[t],r=b.indexOf(i);if(-1===r){for(let e=0;e<x.length;e++)if(e>=b.length){b.push(i),r=e;break}else if(null===b[e]){b[e]=i,r=e;break}if(-1===r)break}let s=x[r];s&&s.connect(i)}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(e){let t=x[e];return void 0===t&&(t=new np,x[e]=t),t.getTargetRaySpace()},this.getControllerGrip=function(e){let t=x[e];return void 0===t&&(t=new np,x[e]=t),t.getGripSpace()},this.getHand=function(e){let t=x[e];return void 0===t&&(t=new np,x[e]=t),t.getHandSpace()},this.setFramebufferScaleFactor=function(e){s=e,!0===i.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(e){o=e,!0===i.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||a},this.setReferenceSpace=function(e){c=e},this.getBaseLayer=function(){return null!==p?p:f},this.getBinding=function(){return u},this.getFrame=function(){return m}
3139,this.getSession=function(){return r},this.setSession=async function(d){if(null!==(r=d)){if(v=e.getRenderTarget(),r.addEventListener("select",P),r.addEventListener("selectstart",P),r.addEventListener("selectend",P),r.addEventListener("squeeze",P),r.addEventListener("squeezestart",P),r.addEventListener("squeezeend",P),r.addEventListener("end",D),r.addEventListener("inputsourceschange",O),!0!==g.xrCompatible&&await t.makeXRCompatible(),void 0===r.renderState.layers||!1===e.capabilities.isWebGL2){let i={antialias:void 0!==r.renderState.layers||g.antialias,alpha:g.alpha,depth:g.depth,stencil:g.stencil,framebufferScaleFactor:s};f=new XRWebGLLayer(r,t,i),r.updateRenderState({baseLayer:f}),y=new iu(f.framebufferWidth,f.framebufferHeight,{format:1023,type:1009,encoding:e.outputEncoding,stencilBuffer:g.stencil})}else{let i=null,a=null,o=null;g.depth&&(o=g.stencil?35056:33190,i=g.stencil?1027:1026,a=g.stencil?1020:1014);let h={colorFormat:32856,depthFormat:o,scaleFactor:s};p=(u=new XRWebGLBinding(r,t)).createProjectionLayer(h),r.updateRenderState({layers:[p]}),y=new iu(p.textureWidth,p.textureHeight,{format:1023,type:1009,depthTexture:new nf(p.textureWidth,p.textureHeight,a,void 0,void 0,void 0,void 0,void 0,void 0,i),stencilBuffer:g.stencil,encoding:e.outputEncoding,samples:4*!!g.antialias}),e.properties.get(y).__ignoreDepthValues=p.ignoreDepthValues}y.isXRRenderTarget=!0,this.setFoveation(h),c=null,a=await r.requestReferenceSpace(o),B.setContext(r),B.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}};let L=new iy,I=new iy;function R(e,t){null===t?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.copy(e.matrixWorld).invert()}this.updateCamera=function(e){let t,i,s,a,o,h,c,d,u,p,f,m,g;if(null===r)return;E.near=C.near=S.near=e.near,E.far=C.far=S.far=e.far,(A!==E.near||T!==E.far)&&(r.updateRenderState({depthNear:E.near,depthFar:E.far}),A=E.near,T=E.far);let v=e.parent,y=E.cameras;R(E,v);for(let e=0;e<y.length;e++)R(y[e],v);E.matrixWorld.decompose(E.position,E.quaternion,E.scale),e.matrix.copy(E.matrix),e.matrix.decompose(e.position,e.quaternion,e.scale);let x=e.children;for(let e=0,t=x.length;e<t;e++)x[e].updateMatrixWorld(!0);2===y.length?(L.setFromMatrixPosition(S.matrixWorld),I.setFromMatrixPosition(C.matrixWorld),t=L.distanceTo(I),i=S.projectionMatrix.elements,s=C.projectionMatrix.elements,a=i[14]/(i[10]-1),o=i[14]/(i[10]+1),h=(i[9]+1)/i[5],c=(i[9]-1)/i[5],f=-((p=t/(-(d=(i[8]-1)/i[0])+(u=(s[8]+1)/s[0])))*d),S.matrixWorld.decompose(E.position,E.quaternion,E.scale),E.translateX(f),E.translateZ(p),E.matrixWorld.compose(E.position,E.quaternion,E.scale),E.matrixWorldInverse.copy(E.matrixWorld).invert(),m=a+p,g=o+p,E.projectionMatrix.makePerspective(a*d-f,a*u+(t-f),h*o/g*m,c*o/g*m,m,g)):E.projectionMatrix.copy(S.projectionMatrix)},this.getCamera=function(){return E},this.getFoveation=function(){if(null!==p||null!==f)return h},this.setFoveation=function(e){h=e,null!==p&&(p.fixedFoveation=e),null!==f&&void 0!==f.fixedFoveation&&(f.fixedFoveation=e)},this.getPlanes=function(){return w};let k=null,B=new sl;B.setAnimationLoop(function(t,r){if(d=r.getViewerPose(c||a),m=r,null!==d){let t=d.views;null!==f&&(e.setRenderTargetFramebuffer(y,f.framebuffer),e.setRenderTarget(y));let i=!1;t.length!==E.cameras.length&&(E.cameras.length=0,i=!0);for(let r=0;r<t.length;r++){let s=t[r],a=null;if(null!==f)a=f.getViewport(s);else{let t=u.getViewSubImage(p,s);a=t.viewport,0===r&&(e.setRenderTargetTextures(y,t.colorTexture,p.ignoreDepthValues?void 0:t.depthStencilTexture),e.setRenderTarget(y))}let o=M[r];void 0===o&&((o=new r8).layers.enable(r),o.viewport=new id,M[r]=o),o.matrix.fromArray(s.transform.matrix),o.projectionMatrix.fromArray(s.projectionMatrix),o.viewport.set(a.x,a.y,a.width,a.height),0===r&&E.matrix.copy(o.matrix),!0===i&&E.cameras.push(o)}}for(let e=0;e<x.length;e++){let t=b[e],i=x[e];null!==t&&void 0!==i&&i.update(t,r,c||a)}if(k&&k(t,r),r.detectedPlanes){i.dispatchEvent({type:"planesdetected",data:r.detectedPlanes});let e=null;for(let t of w)r.detectedPlanes.has(t)||(null===e&&(e=[]),e.push(t));if(null!==e)for(let t of e)w.delete(t),_.delete(t),i.dispatchEvent({type:"planeremoved",data:t});for(let e of r.detectedPlanes)if(w.has(e)){let t=_.get(e);e.lastChangedTime>t&&(_.set(e,e.lastChangedTime),i.dispatchEvent({type:"planechanged",data:e}))}else w.add(e),_.set(e,r.lastChangedTime),i.dispatchEvent({type:"planeadded",data:e})}m=null}),this.setAnimationLoop=function(e){k=e},this.dispose=function(){}}};function ng(e,t){function i(i,r){let s,a;i.opacity.value=r.opacity,r.color&&i.diffuse.value.copy(r.color),r.emissive&&i.emissive.value.copy(r.emissive).multiplyScalar(r.emissiveIntensity),r.map&&(i.map.value=r.map),r.alphaMap&&(i.alphaMap.value=r.alphaMap),r.bumpMap&&(i.bumpMap.value=r.bumpMap,i.bumpScale.value=r.bumpScale,1===r.side&&(i.bumpScale.value*=-1)),r.displacementMap&&(i.displacementMap.value=r.displacementMap,i.displacementScale.value=r.displacementScale,i.displacementBias.value=r.displacementBias),r.emissiveMap&&(i.emissiveMap.value=r.emissiveMap),r.normalMap&&(i.normalMap.value=r.normalMap,i.normalScale.value.copy(r.normalScale),1===r.side&&i.normalScale.value.negate()),r.specularMap&&(i.specularMap.value=r.specularMap),r.alphaTest>0&&(i.alphaTest.value=r.alphaTest);let o=t.get(r).envMap;if(o&&(i.envMap.value=o,i.flipEnvMap.value=o.isCubeTexture&&!1===o.isRenderTargetTexture?-1:1,i.reflectivity.value=r.reflectivity,i.ior.value=r.
3139ior,i.refractionRatio.value=r.refractionRatio),r.lightMap){i.lightMap.value=r.lightMap;let t=!0!==e.physicallyCorrectLights?Math.PI:1;i.lightMapIntensity.value=r.lightMapIntensity*t}r.aoMap&&(i.aoMap.value=r.aoMap,i.aoMapIntensity.value=r.aoMapIntensity),r.map?s=r.map:r.specularMap?s=r.specularMap:r.displacementMap?s=r.displacementMap:r.normalMap?s=r.normalMap:r.bumpMap?s=r.bumpMap:r.roughnessMap?s=r.roughnessMap:r.metalnessMap?s=r.metalnessMap:r.alphaMap?s=r.alphaMap:r.emissiveMap?s=r.emissiveMap:r.clearcoatMap?s=r.clearcoatMap:r.clearcoatNormalMap?s=r.clearcoatNormalMap:r.clearcoatRoughnessMap?s=r.clearcoatRoughnessMap:r.iridescenceMap?s=r.iridescenceMap:r.iridescenceThicknessMap?s=r.iridescenceThicknessMap:r.specularIntensityMap?s=r.specularIntensityMap:r.specularColorMap?s=r.specularColorMap:r.transmissionMap?s=r.transmissionMap:r.thicknessMap?s=r.thicknessMap:r.sheenColorMap?s=r.sheenColorMap:r.sheenRoughnessMap&&(s=r.sheenRoughnessMap),void 0!==s&&(s.isWebGLRenderTarget&&(s=s.texture),!0===s.matrixAutoUpdate&&s.updateMatrix(),i.uvTransform.value.copy(s.matrix)),r.aoMap?a=r.aoMap:r.lightMap&&(a=r.lightMap),void 0!==a&&(a.isWebGLRenderTarget&&(a=a.texture),!0===a.matrixAutoUpdate&&a.updateMatrix(),i.uv2Transform.value.copy(a.matrix))}return{refreshFogUniforms:function(t,i){i.color.getRGB(t.fogColor.value,r2(e)),i.isFog?(t.fogNear.value=i.near,t.fogFar.value=i.far):i.isFogExp2&&(t.fogDensity.value=i.density)},refreshMaterialUniforms:function(e,r,s,a,o){var h,c,d,u,p,f,m,g,v,y,x,b,w,_,S,C,M,E,A,T,P,D,O;let L,I;r.isMeshBasicMaterial||r.isMeshLambertMaterial?i(e,r):r.isMeshToonMaterial?(i(e,r),h=e,(c=r).gradientMap&&(h.gradientMap.value=c.gradientMap)):r.isMeshPhongMaterial?(i(e,r),d=e,u=r,d.specular.value.copy(u.specular),d.shininess.value=Math.max(u.shininess,1e-4)):r.isMeshStandardMaterial?(i(e,r),p=e,f=r,p.roughness.value=f.roughness,p.metalness.value=f.metalness,f.roughnessMap&&(p.roughnessMap.value=f.roughnessMap),f.metalnessMap&&(p.metalnessMap.value=f.metalnessMap),t.get(f).envMap&&(p.envMapIntensity.value=f.envMapIntensity),r.isMeshPhysicalMaterial&&(m=e,g=r,v=o,m.ior.value=g.ior,g.sheen>0&&(m.sheenColor.value.copy(g.sheenColor).multiplyScalar(g.sheen),m.sheenRoughness.value=g.sheenRoughness,g.sheenColorMap&&(m.sheenColorMap.value=g.sheenColorMap),g.sheenRoughnessMap&&(m.sheenRoughnessMap.value=g.sheenRoughnessMap)),g.clearcoat>0&&(m.clearcoat.value=g.clearcoat,m.clearcoatRoughness.value=g.clearcoatRoughness,g.clearcoatMap&&(m.clearcoatMap.value=g.clearcoatMap),g.clearcoatRoughnessMap&&(m.clearcoatRoughnessMap.value=g.clearcoatRoughnessMap),g.clearcoatNormalMap&&(m.clearcoatNormalScale.value.copy(g.clearcoatNormalScale),m.clearcoatNormalMap.value=g.clearcoatNormalMap,1===g.side&&m.clearcoatNormalScale.value.negate())),g.iridescence>0&&(m.iridescence.value=g.iridescence,m.iridescenceIOR.value=g.iridescenceIOR,m.iridescenceThicknessMinimum.value=g.iridescenceThicknessRange[0],m.iridescenceThicknessMaximum.value=g.iridescenceThicknessRange[1],g.iridescenceMap&&(m.iridescenceMap.value=g.iridescenceMap),g.iridescenceThicknessMap&&(m.iridescenceThicknessMap.value=g.iridescenceThicknessMap)),g.transmission>0&&(m.transmission.value=g.transmission,m.transmissionSamplerMap.value=v.texture,m.transmissionSamplerSize.value.set(v.width,v.height),g.transmissionMap&&(m.transmissionMap.value=g.transmissionMap),m.thickness.value=g.thickness,g.thicknessMap&&(m.thicknessMap.value=g.thicknessMap),m.attenuationDistance.value=g.attenuationDistance,m.attenuationColor.value.copy(g.attenuationColor)),m.specularIntensity.value=g.specularIntensity,m.specularColor.value.copy(g.specularColor),g.specularIntensityMap&&(m.specularIntensityMap.value=g.specularIntensityMap),g.specularColorMap&&(m.specularColorMap.value=g.specularColorMap))):r.isMeshMatcapMaterial?(i(e,r),y=e,(x=r).matcap&&(y.matcap.value=x.matcap)):r.isMeshDepthMaterial?i(e,r):r.isMeshDistanceMaterial?(i(e,r),b=e,w=r,b.referencePosition.value.copy(w.referencePosition),b.nearDistance.value=w.nearDistance,b.farDistance.value=w.farDistance):r.isMeshNormalMaterial?i(e,r):r.isLineBasicMaterial?(_=e,S=r,_.diffuse.value.copy(S.color),_.opacity.value=S.opacity,r.isLineDashedMaterial&&(C=e,M=r,C.dashSize.value=M.dashSize,C.totalSize.value=M.dashSize
3139+M.gapSize,C.scale.value=M.scale)):r.isPointsMaterial?(E=e,A=r,T=s,P=a,E.diffuse.value.copy(A.color),E.opacity.value=A.opacity,E.size.value=A.size*T,E.scale.value=.5*P,A.map&&(E.map.value=A.map),A.alphaMap&&(E.alphaMap.value=A.alphaMap),A.alphaTest>0&&(E.alphaTest.value=A.alphaTest),A.map?L=A.map:A.alphaMap&&(L=A.alphaMap),void 0!==L&&(!0===L.matrixAutoUpdate&&L.updateMatrix(),E.uvTransform.value.copy(L.matrix))):r.isSpriteMaterial?(D=e,O=r,D.diffuse.value.copy(O.color),D.opacity.value=O.opacity,D.rotation.value=O.rotation,O.map&&(D.map.value=O.map),O.alphaMap&&(D.alphaMap.value=O.alphaMap),O.alphaTest>0&&(D.alphaTest.value=O.alphaTest),O.map?I=O.map:O.alphaMap&&(I=O.alphaMap),void 0!==I&&(!0===I.matrixAutoUpdate&&I.updateMatrix(),D.uvTransform.value.copy(I.matrix))):r.isShadowMaterial?(e.color.value.copy(r.color),e.opacity.value=r.opacity):r.isShaderMaterial&&(r.uniformsNeedUpdate=!1)}}}function nv(e,t,i,r){let s={},a={},o=[],h=i.isWebGL2?e.getParameter(35375):0;function c(e){let t={boundary:0,storage:0};return"number"==typeof e?(t.boundary=4,t.storage=4):e.isVector2?(t.boundary=8,t.storage=8):e.isVector3||e.isColor?(t.boundary=16,t.storage=12):e.isVector4?(t.boundary=16,t.storage=16):e.isMatrix3?(t.boundary=48,t.storage=48):e.isMatrix4?(t.boundary=64,t.storage=64):e.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",e),t}function d(t){let i=t.target;i.removeEventListener("dispose",d);let r=o.indexOf(i.__bindingPointIndex);o.splice(r,1),e.deleteBuffer(s[i.id]),delete s[i.id],delete a[i.id]}return{bind:function(e,t){let i=t.program;r.uniformBlockBinding(e,i)},update:function(i,u){var p;let f,m,g,v,y=s[i.id];void 0===y&&(function(e){let t=e.uniforms,i=0,r=0;for(let e=0,s=t.length;e<s;e++){let s=t[e],a={boundary:0,storage:0},o=Array.isArray(s.value)?s.value:[s.value];for(let e=0,t=o.length;e<t;e++){let t=c(o[e]);a.boundary+=t.boundary,a.storage+=t.storage}if(s.__data=new Float32Array(a.storage/Float32Array.BYTES_PER_ELEMENT),s.__offset=i,e>0){let e=16-(r=i%16);0!==r&&e-a.boundary<0&&(s.__offset=i+=16-r)}i+=a.storage}(r=i%16)>0&&(i+=16-r),e.__size=i,e.__cache={}}(i),(p=i).__bindingPointIndex=f=function(){for(let e=0;e<h;e++)if(-1===o.indexOf(e))return o.push(e),e;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}(),m=e.createBuffer(),g=p.__size,v=p.usage,e.bindBuffer(35345,m),e.bufferData(35345,g,v),e.bindBuffer(35345,null),e.bindBufferBase(35345,f,m),y=m,s[i.id]=y,i.addEventListener("dispose",d));let x=u.program;r.updateUBOMapping(i,x);let b=t.render.frame;a[i.id]!==b&&(function(t){let i=s[t.id],r=t.uniforms,a=t.__cache;e.bindBuffer(35345,i);for(let t=0,i=r.length;t<i;t++){let i=r[t];if(!0===function(e,t,i){let r=e.value;if(void 0===i[t]){if("number"==typeof r)i[t]=r;else{let e=Array.isArray(r)?r:[r],s=[];for(let t=0;t<e.length;t++)s.push(e[t].clone());i[t]=s}return!0}if("number"==typeof r){if(i[t]!==r)return i[t]=r,!0}else{let e=Array.isArray(i[t])?i[t]:[i[t]],s=Array.isArray(r)?r:[r];for(let t=0;t<e.length;t++){let i=e[t];if(!1===i.equals(s[t]))return i.copy(s[t]),!0}}return!1}(i,t,a)){let t=i.__offset,r=Array.isArray(i.value)?i.value:[i.value],s=0;for(let a=0;a<r.length;a++){let o=r[a],h=c(o);"number"==typeof o?(i.__data[0]=o,e.bufferSubData(35345,t+s,i.__data)):o.isMatrix3?(i.__data[0]=o.elements[0],i.__data[1]=o.elements[1],i.__data[2]=o.elements[2],i.__data[3]=o.elements[0],i.__data[4]=o.elements[3],i.__data[5]=o.elements[4],i.__data[6]=o.elements[5],i.__data[7]=o.elements[0],i.__data[8]=o.elements[6],i.__data[9]=o.elements[7],i.__data[10]=o.elements[8],i.__data[11]=o.elements[0]):(o.toArray(i.__data,s),s+=h.storage/Float32Array.BYTES_PER_ELEMENT)}e.bufferSubData(35345,t,i.__data)}}e.bindBuffer(35345,null)}(i),a[i.id]=b)},dispose:function(){for(let t in s)e.deleteBuffer(s[t]);o=[],s={},a={}}}}function ny(e={}){let t,i,r,s,a,o,h,c,d,u,p,f,m,g,v,y,x,b,w,_,S,C,M,E,A;this.isWebGLRenderer=!0;let T=void 0!==e.canvas?e.canvas:((A=t2("canvas")).style.display="block",A),P=void 0!==e.context?e.context:null,D=void 0===e.depth||e.depth,O=void 0===e.stencil||e.stencil,L=void 0!==e.antialias&&e.antialias,I=void 0===e.premultipliedAlpha||e.premultipliedAlpha,R=void 0!==e.preserveDrawingBuffer&&e.preserveDrawingBuffer,k=void 0!==e.powerPreference?e.powerPreference:"default",B=void 0!==e.failIfMajorPerformanceCaveat&&e.failIfMajorPerformanceCaveat,z;z=null!==P?P.getContextAttributes().alpha:void 0!==e.alpha&&e.alpha;let N=null,F=null,j=[],U=[];
3139this.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=3e3,this.physicallyCorrectLights=!1,this.toneMapping=0,this.toneMappingExposure=1;let V=this,W=!1,H=0,G=0,q=null,X=-1,Y=null,Q=new id,Z=new id,K=null,J=T.width,$=T.height,ee=1,et=null,ei=null,er=new id(0,0,J,$),es=new id(0,0,J,$),ea=!1,en=new so,eo=!1,el=!1,eh=null,ec=new iY,ed=new tZ,eu=new iy,ep={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function ef(){return null===q?ee:1}let em=P;function eg(e,t){for(let i=0;i<e.length;i++){let r=e[i],s=T.getContext(r,t);if(null!==s)return s}return null}try{if("setAttribute"in T&&T.setAttribute("data-engine","three.js r149"),T.addEventListener("webglcontextlost",ex,!1),T.addEventListener("webglcontextrestored",eb,!1),T.addEventListener("webglcontextcreationerror",ew,!1),null===em){let e=["webgl2","webgl","experimental-webgl"];if(!0===V.isWebGL1Renderer&&e.shift(),em=eg(e,{alpha:!0,depth:D,stencil:O,antialias:L,premultipliedAlpha:I,preserveDrawingBuffer:R,powerPreference:k,failIfMajorPerformanceCaveat:B}),null===em)throw eg(e)?Error("Error creating WebGL context with your selected attributes."):Error("Error creating WebGL context.")}void 0===em.getShaderPrecisionFormat&&(em.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(e){throw console.error("THREE.WebGLRenderer: "+e.message),e}function ev(){t=new sB(em),i=new sy(em,t,e),t.init(i),C=new nh(em,t,i),r=new no(em,t,i),s=new sF,a=new a1,o=new nl(em,t,r,a,i,C,s),h=new sb(V),c=new sk(V),d=new sh(em,i),M=new sg(em,t,d,i),u=new sz(em,d,s,M),p=new sW(em,u,d,s),w=new sV(em,i,o),y=new sx(a),f=new a0(V,h,c,t,i,M,y),m=new ng(V,a),g=new a5,v=new nt(t,i),b=new sm(V,h,c,r,p,z,I),x=new nn(V,p,i),E=new nv(em,s,i,r),_=new sv(em,t,s,i),S=new sN(em,t,s,i),s.programs=f.programs,V.capabilities=i,V.extensions=t,V.properties=a,V.renderLists=g,V.shadowMap=x,V.state=r,V.info=s}ev();let ey=new nm(V,em);function ex(e){e.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),W=!0}function eb(){console.log("THREE.WebGLRenderer: Context Restored."),W=!1;let e=s.autoReset,t=x.enabled,i=x.autoUpdate,r=x.needsUpdate,a=x.type;ev(),s.autoReset=e,x.enabled=t,x.autoUpdate=i,x.needsUpdate=r,x.type=a}function ew(e){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",e.statusMessage)}function e_(e){var t,i;let r,s=e.target;s.removeEventListener("dispose",e_),i=t=s,void 0!==(r=a.get(i).programs)&&(r.forEach(function(e){f.releaseProgram(e)}),i.isShaderMaterial&&f.releaseShaderCache(i)),a.remove(t)}this.xr=ey,this.getContext=function(){return em},this.getContextAttributes=function(){return em.getContextAttributes()},this.forceContextLoss=function(){let e=t.get("WEBGL_lose_context");e&&e.loseContext()},this.forceContextRestore=function(){let e=t.get("WEBGL_lose_context");e&&e.restoreContext()},this.getPixelRatio=function(){return ee},this.setPixelRatio=function(e){void 0!==e&&(ee=e,this.setSize(J,$,!1))},this.getSize=function(e){return e.set(J,$)},this.setSize=function(e,t,i){ey.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(J=e,$=t,T.width=Math.floor(e*ee),T.height=Math.floor(t*ee),!1!==i&&(T.style.width=e+"px",T.style.height=t+"px"),this.setViewport(0,0,e,t))},this.getDrawingBufferSize=function(e){return e.set(J*ee,$*ee).floor()},this.setDrawingBufferSize=function(e,t,i){J=e,$=t,ee=i,T.width=Math.floor(e*i),T.height=Math.floor(t*i),this.setViewport(0,0,e,t)},this.getCurrentViewport=function(e){return e.copy(Q)},this.getViewport=function(e){return e.copy(er)},this.setViewport=function(e,t,i,s){e.isVector4?er.set(e.x,e.y,e.z,e.w):er.set(e,t,i,s),r.viewport(Q.copy(er).multiplyScalar(ee).floor())},this.getScissor=function(e){return e.copy(es)},this.setScissor=function(e,t,i,s){e.isVector4?es.set(e.x,e.y,e.z,e.w):es.set(e,t,i,s),r.scissor(Z.copy(es).multiplyScalar(ee).floor())},this.getScissorTest=function(){return ea},this.setScissorTest=function(e){r.setScissorTest(ea=e)},this.setOpaqueSort=function(e){et=e},this.setTransparentSort=function(e){ei=e},this.getClearColor=function(e){return e.copy(b.getClearColor())},this.setClearColor=function(){b.setClearColor.apply(b,arguments)},this.getClearAlpha=function(){return b.getClearAlpha()},this.setClearAlpha=function(){b.setClearAlpha.apply(b,arguments)},this.clear=function(e=!0,t=!0,i=!0){let r=0;e&&(r|=16384),t&&(r|=256),i&&(r|=1024),em.clear(r)},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",ex,!1),T.removeEventListener("webglcontextrestored",eb,!1),T.removeEventListener("webglcontextcreationerror",ew,!1),g.dispose(),v.dispose(),a.dispose(),h.dispose(),c.dispose(),p.dispose(),M.dispose(),E.dispose(),f.dispose(),ey.dispose(),ey.removeEventListener("sessionstart",eC),ey.removeEventListener("sessionend",eM),eh&&(eh.dispose(),eh=null),eE.stop()},this.renderBufferDirect=function(e,t,s,p,f,g){null===t&&(t=ep);let v=f.isMesh&&0>f.matrixWorld.determinant(),x=function(e,t,s,d,u){var p,f;!0!==t.isScene&&(t=ep),o.resetTextureUnits();let g=t.fog,v=d.isMeshStandardMaterial?t.environment:null,x=null===q?V.outputEncoding:!0===q.isXRRenderTarget?q.texture.encoding:3e3,b=(d.isMeshStandardMaterial?c:h).get(d.envMap||v),_=!0===d.vertexColors&&!!s.attributes.color&&4===s.attributes.color.itemSize,S=!!d.normalMap&&!!s.attributes.tangent,C=!!s.morphAttributes.position,M=!!s.morphAttributes.normal,A=!!s.morphAttributes.color,T=d.toneMapped?V.toneMapping:0,P=s.morphAttributes.position||s.morphAttributes.normal||s.morphAttributes.color,D=void 0!==P?P.length:0,O=a.get(d),L=F.state.lights;if(!0===eo&&(!0===el||e!==Y)){let t=e===Y&&d.id===X;y.setState(d,e,t)}let I=!1;d.version===O.__version?(O.needsLights&&O.lightsStateVersion!==L.state.ver
3139sion||O.outputEncoding!==x||u.isInstancedMesh&&!1===O.instancing||!u.isInstancedMesh&&!0===O.instancing||u.isSkinnedMesh&&!1===O.skinning||!u.isSkinnedMesh&&!0===O.skinning||O.envMap!==b||!0===d.fog&&O.fog!==g||void 0!==O.numClippingPlanes&&(O.numClippingPlanes!==y.numPlanes||O.numIntersection!==y.numIntersection)||O.vertexAlphas!==_||O.vertexTangents!==S||O.morphTargets!==C||O.morphNormals!==M||O.morphColors!==A||O.toneMapping!==T||!0===i.isWebGL2&&O.morphTargetsCount!==D)&&(I=!0):(I=!0,O.__version=d.version);let R=O.currentProgram;!0===I&&(R=eP(d,t,u));let k=!1,B=!1,z=!1,N=R.getUniforms(),j=O.uniforms;if(r.useProgram(R.program)&&(k=!0,B=!0,z=!0),d.id!==X&&(X=d.id,B=!0),k||Y!==e){if(N.setValue(em,"projectionMatrix",e.projectionMatrix),i.logarithmicDepthBuffer&&N.setValue(em,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),Y!==e&&(Y=e,B=!0,z=!0),d.isShaderMaterial||d.isMeshPhongMaterial||d.isMeshToonMaterial||d.isMeshStandardMaterial||d.envMap){let t=N.map.cameraPosition;void 0!==t&&t.setValue(em,eu.setFromMatrixPosition(e.matrixWorld))}(d.isMeshPhongMaterial||d.isMeshToonMaterial||d.isMeshLambertMaterial||d.isMeshBasicMaterial||d.isMeshStandardMaterial||d.isShaderMaterial)&&N.setValue(em,"isOrthographic",!0===e.isOrthographicCamera),(d.isMeshPhongMaterial||d.isMeshToonMaterial||d.isMeshLambertMaterial||d.isMeshBasicMaterial||d.isMeshStandardMaterial||d.isShaderMaterial||d.isShadowMaterial||u.isSkinnedMesh)&&N.setValue(em,"viewMatrix",e.matrixWorldInverse)}if(u.isSkinnedMesh){N.setOptional(em,u,"bindMatrix"),N.setOptional(em,u,"bindMatrixInverse");let e=u.skeleton;e&&(i.floatVertexTextures?(null===e.boneTexture&&e.computeBoneTexture(),N.setValue(em,"boneTexture",e.boneTexture,o),N.setValue(em,"boneTextureSize",e.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 U=s.morphAttributes;if((void 0!==U.position||void 0!==U.normal||void 0!==U.color&&!0===i.isWebGL2)&&w.update(u,s,d,R),(B||O.receiveShadow!==u.receiveShadow)&&(O.receiveShadow=u.receiveShadow,N.setValue(em,"receiveShadow",u.receiveShadow)),d.isMeshGouraudMaterial&&null!==d.envMap&&(j.envMap.value=b,j.flipEnvMap.value=b.isCubeTexture&&!1===b.isRenderTargetTexture?-1:1),B&&(N.setValue(em,"toneMappingExposure",V.toneMappingExposure),O.needsLights&&(p=j,f=z,p.ambientLightColor.needsUpdate=f,p.lightProbe.needsUpdate=f,p.directionalLights.needsUpdate=f,p.directionalLightShadows.needsUpdate=f,p.pointLights.needsUpdate=f,p.pointLightShadows.needsUpdate=f,p.spotLights.needsUpdate=f,p.spotLightShadows.needsUpdate=f,p.rectAreaLights.needsUpdate=f,p.hemisphereLights.needsUpdate=f),g&&!0===d.fog&&m.refreshFogUniforms(j,g),m.refreshMaterialUniforms(j,d,ee,$,eh),aB.upload(em,O.uniformsList,j,o)),d.isShaderMaterial&&!0===d.uniformsNeedUpdate&&(aB.upload(em,O.uniformsList,j,o),d.uniformsNeedUpdate=!1),d.isSpriteMaterial&&N.setValue(em,"center",u.center),N.setValue(em,"modelViewMatrix",u.modelViewMatrix),N.setValue(em,"normalMatrix",u.normalMatrix),N.setValue(em,"modelMatrix",u.matrixWorld),u.previousModelViewMatrix&&N.setValue(em,"previousModelViewMatrix",u.previousModelViewMatrix),e.previousProjectionMatrix&&N.setValue(em,"previousProjectionMatrix",e.previousProjectionMatrix),d.isShaderMaterial||d.isRawShaderMaterial){let e=d.uniformsGroups;for(let t=0,r=e.length;t<r;t++)if(i.isWebGL2){let i=e[t];E.update(i,R),E.bind(i,R)}else console.warn("THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.")}return R}(e,t,s,p,f);r.setMaterial(p,v);let b=s.index,C=1;!0===p.wireframe&&(b=u.getWireframeAttribute(s),C=2);let A=s.drawRange,T=s.attributes.position,P=A.start*C,D=(A.start+A.count)*C;null!==g&&(P=Math.max(P,g.start*C),D=Math.min(D,(g.start+g.count)*C)),null!==b?(P=Math.max(P,0),D=Math.min(D,b.count)):null!=T&&(P=Math.max(P,0),D=Math.min(D,T.count));let O=D-P;if(O<0||O===1/0)return;M.setup(f,p,x,s,b);let L,I=_;if(null!==b&&(L=d.get(b),(I=S).setIndex(L)),f.isMesh)!0===p.wireframe?(r.setLineWidth(p.wireframeLinewidth*ef()),I.setMode(1)):I.setMode(4);else if(f.isLine){let e=p.linewidth;void 0===e&&(e=1),r.setLineWidth(e*ef()),f.isLineSegments?I.setMode(1):f.isLineLoop?I.setMode(2):I.setMode(3)}else f.isPoints?I.setMode(0):f.isSprite&&I.setMode(4);if(f.isInstancedMesh)I.renderInstances(P,O,f.count);else if(s.isInstancedBufferGeometry){let e=void 0!==s._maxInstanceCount?s._maxInstanceCount:1/0,t=Math.min(s.instanceCount,e);I.renderInstances(P,O,t)}else I.render(P,O)},this.compile=function(e,t){function i(e,t,i){!0===e.transparent&&2===e.side&&!1===e.forceSinglePass?(e.side=1,e.needsUpdate=!0,eP(e,t,i),e.side=0,e.needsUpdate=!0,eP(e,t,i),e.side=2):eP(e,t,i)}(F=v.get(e)).init(),U.push(F),e.traverseVisible(function(e){e.isLight&&e.layers.test(t.layers)&&(F.pushLight(e),e.castShadow&&F.pushShadow(e))}),F.setupLights(V.physicallyCorrectLights),e.traverse(function(t){let r=t.material;if(r)if(Array.isArray(r))for(let s=0;s<r.length;s++)i(r[s],e,t);else i(r,e,t)}),U.pop(),F=null};let eS=null;function eC(){eE.stop()}function eM(){eE.start()}let eE=new sl;function eA(e,s,a,h){var c,d,u;let p,f,m,g=e.opaque,v=e.transmissive,x=e.transparent;F.setupLightsView(a),!0===eo&&y.setGlobalState(V.clippingPlanes,a),v.length>
31390&&(c=g,d=s,u=a,p=i.isWebGL2,null===eh&&(eh=new iu(1,1,{generateMipmaps:!0,type:t.has("EXT_color_buffer_half_float")?1016:1009,minFilter:1008,samples:p&&!0===L?4:0})),V.getDrawingBufferSize(ed),p?eh.setSize(ed.x,ed.y):eh.setSize(tq(ed.x),tq(ed.y)),f=V.getRenderTarget(),V.setRenderTarget(eh),V.clear(),m=V.toneMapping,V.toneMapping=0,eT(c,d,u),V.toneMapping=m,o.updateMultisampleRenderTarget(eh),o.updateRenderTargetMipmap(eh),V.setRenderTarget(f)),h&&r.viewport(Q.copy(h)),g.length>0&&eT(g,s,a),v.length>0&&eT(v,s,a),x.length>0&&eT(x,s,a),r.buffers.depth.setTest(!0),r.buffers.depth.setMask(!0),r.buffers.color.setMask(!0),r.setPolygonOffset(!1)}function eT(e,t,i){let r=!0===t.isScene?t.overrideMaterial:null;for(let u=0,p=e.length;u<p;u++){var s,a,o,h,c,d;let p=e[u],f=p.object,m=p.geometry,g=null===r?p.material:r,v=p.group;f.layers.test(i.layers)&&(s=f,a=t,o=i,h=m,c=g,d=v,s.onBeforeRender(V,a,o,h,c,d),s.modelViewMatrix.multiplyMatrices(o.matrixWorldInverse,s.matrixWorld),s.normalMatrix.getNormalMatrix(s.modelViewMatrix),c.onBeforeRender(V,a,o,h,s,d),!0===c.transparent&&2===c.side&&!1===c.forceSinglePass?(c.side=1,c.needsUpdate=!0,V.renderBufferDirect(o,a,h,c,s,d),c.side=0,c.needsUpdate=!0,V.renderBufferDirect(o,a,h,c,s,d),c.side=2):V.renderBufferDirect(o,a,h,c,s,d),s.onAfterRender(V,a,o,h,c,d))}}function eP(e,t,i){var r;!0!==t.isScene&&(t=ep);let s=a.get(e),o=F.state.lights,d=F.state.shadowsArray,u=o.state.version,p=f.getParameters(e,o.state,d,t,i),m=f.getProgramCacheKey(p),g=s.programs;s.environment=e.isMeshStandardMaterial?t.environment:null,s.fog=t.fog,s.envMap=(e.isMeshStandardMaterial?c:h).get(e.envMap||s.environment),void 0===g&&(e.addEventListener("dispose",e_),s.programs=g=new Map);let v=g.get(m);if(void 0!==v){if(s.currentProgram===v&&s.lightsStateVersion===u)return eD(e,p),v}else p.uniforms=f.getUniforms(e),e.onBuild(i,p,V),e.onBeforeCompile(p,V),v=f.acquireProgram(p,m),g.set(m,v),s.uniforms=p.uniforms;let x=s.uniforms;(e.isShaderMaterial||e.isRawShaderMaterial)&&!0!==e.clipping||(x.clippingPlanes=y.uniform),eD(e,p),s.needsLights=(r=e).isMeshLambertMaterial||r.isMeshToonMaterial||r.isMeshPhongMaterial||r.isMeshStandardMaterial||r.isShadowMaterial||r.isShaderMaterial&&!0===r.lights,s.lightsStateVersion=u,s.needsLights&&(x.ambientLightColor.value=o.state.ambient,x.lightProbe.value=o.state.probe,x.directionalLights.value=o.state.directional,x.directionalLightShadows.value=o.state.directionalShadow,x.spotLights.value=o.state.spot,x.spotLightShadows.value=o.state.spotShadow,x.rectAreaLights.value=o.state.rectArea,x.ltc_1.value=o.state.rectAreaLTC1,x.ltc_2.value=o.state.rectAreaLTC2,x.pointLights.value=o.state.point,x.pointLightShadows.value=o.state.pointShadow,x.hemisphereLights.value=o.state.hemi,x.directionalShadowMap.value=o.state.directionalShadowMap,x.directionalShadowMatrix.value=o.state.directionalShadowMatrix,x.spotShadowMap.value=o.state.spotShadowMap,x.spotLightMatrix.value=o.state.spotLightMatrix,x.spotLightMap.value=o.state.spotLightMap,x.pointShadowMap.value=o.state.pointShadowMap,x.pointShadowMatrix.value=o.state.pointShadowMatrix);let b=v.getUniforms(),w=aB.seqWithValue(b.seq,x);return s.currentProgram=v,s.uniformsList=w,v}function eD(e,t){let i=a.get(e);i.outputEncoding=t.outputEncoding,i.instancing=t.instancing,i.skinning=t.skinning,i.morphTargets=t.morphTargets,i.morphNormals=t.morphNormals,i.morphColors=t.morphColors,i.morphTargetsCount=t.morphTargetsCount,i.numClippingPlanes=t.numClippingPlanes,i.numIntersection=t.numClipIntersection,i.vertexAlphas=t.vertexAlphas,i.vertexTangents=t.vertexTangents,i.toneMapping=t.toneMapping}eE.setAnimationLoop(function(e){eS&&eS(e)}),"u">typeof self&&eE.setContext(self),this.setAnimationLoop=function(e){eS=e,ey.setAnimationLoop(e),null===e?eE.stop():eE.start()},ey.addEventListener("sessionstart",eC),ey.addEventListener("sessionend",eM),this.render=function(e,t){if(void 0!==t&&!0!==t.isCamera)return void console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");if(!0===W)return;!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===t.parent&&!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),!0===ey.enabled&&!0===ey.isPresenting&&(!0===ey.cameraAutoUpdate&&ey.updateCamera(t),t=ey.getCamera()),!0===e.isScene&&e.onBeforeRender(V,e,t,q),(F=v.get(e,U.length)).init(),U.push(F),ec.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),en.setFromProjectionMatrix(ec),el=this.localClippingEnabled,eo=y.init(this.clippingPlanes,el),(N=g.get(e,j.length)).init(),j.push(N),function e(t,i,r,a){if(!1===t.visible)return;if(t.layers.test(i.layers)){if(t.isGroup)r=t.renderOrder;else if(t.isLOD)!0===t.autoUpdate&&t.update(i);else if(t.isLight)F.pushLight(t),t.castShadow&&F.pushShadow(t);else if(t.isSprite){if(!t.frustumCulled||en.intersectsSprite(t)){a&&eu.setFromMatrixPosition(t.matrixWorld).applyMatrix4(ec);let e=p.update(t),i=t.material;i.visible&&N.push(t,e,i,r,eu.z,null)}}else if((t.isMesh||t.isLine||t.isPoints)&&(t.isSkinnedMesh&&t.skeleton.frame!==s.render.frame&&(t.skeleton.update(),t.skeleton.frame=s.render.frame),!t.frustumCulled||en.intersectsObject(t))){a&&eu.setFromMatrixPosition(t.matrixWorld).applyMatrix4(ec);let e=p.update(t),i=t.material;if(Array.isArray(i)){let s=e.groups;for(let a=0,o=s.length;a<o;a++){let o=s[a],h=i[o.materialIndex];h&&h.visible&&N.push(t,e,h,r,eu.z,o)}}else i.visible&&N.push(t,e,i,r,eu.z,null)}}let o=t.children;for(let t=0,s=o.length;t<s;t++)e(o[t],i,r,a)}(e,t,0,V.sortObjects),N.finish(),!0===V.sortObjects&&N.sort(et,ei),!0===eo&&y.beginShadows();let i=F.state.shadowsArray;if(x.render(i,e,t),!0===eo&&y.endShadows(),!0===this.info.autoReset&&this.info.reset(),b.render(N,e),F.setupLights(V.physicallyCorrectLights),t.isArrayCamera){let i=t.cameras;for(let t=0,r=i.length;t<r;t++){let r=i[t];eA(N,e,r,r.viewport)}}else eA(N,e,t);null!==q&&(o.updateMultisampleRenderTarget(q),o.updateRenderTargetMipmap(q)),!0===e.isScene&&e.onAfterRender(V,e,t),M.resetDefaultState(),X=-1,Y=null,U.pop(),F=U.length>0?U[U.length-1]:null,j.pop(),N=j.length>0?j[j.length-1]:null},this.getActiveCubeFace=function(){return H},this.getActiveMipmapLevel=function(){return G},this.getRenderTarget=function(){return q},this.setRenderTargetTextures=function(e,i,r){a.get(e.texture).__webglTexture=i,a.get(e.depthTexture).__webglTexture=r;let s=a.get(e);s.__hasExternalTextures=!0,s.__hasExternalTextures&&(s.__autoAllocateDepthBuffer=void 0===r,s.__autoAllocateDepthBuffer||!0===t.has("WEBGL_multisampled_render_to_texture")&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),s.__useRenderToTexture=!1))},this.setRenderTargetFramebuffer=function(e,t){let i=a.get(e);i.__webglFramebuffer=t,i.__useDefaultFramebuffer=void 0===t},this.setRenderTarget=function(e,t=0,s=0){q=e,H=t,G=s;let h=!0,c=null,d=!1,u=!1;if(e){let s=a.get(e);void 0!==s.__useDefaultFramebuffer?(r.bindFramebuffer(36160,null),h=!1):void 0===s.__webglFramebuffer?o.setupRenderTarget(e):s.__hasExternalTextures&&o.rebindTextures(e,a.get(e.texture).__webglTexture,a.get(e.depthTexture).__webglTexture);let p=e.texture;(p.isData3DTexture||p.isDataArrayTexture||p.isCompressedArrayTexture)&&(u=!0);let f=a.get(e).__webglFramebuffer;
3139e.isWebGLCubeRenderTarget?(c=f[t],d=!0):c=i.isWebGL2&&e.samples>0&&!1===o.useMultisampledRTT(e)?a.get(e).__webglMultisampledFramebuffer:f,Q.copy(e.viewport),Z.copy(e.scissor),K=e.scissorTest}else Q.copy(er).multiplyScalar(ee).floor(),Z.copy(es).multiplyScalar(ee).floor(),K=ea;if(r.bindFramebuffer(36160,c)&&i.drawBuffers&&h&&r.drawBuffers(e,c),r.viewport(Q),r.scissor(Z),r.setScissorTest(K),d){let i=a.get(e.texture);em.framebufferTexture2D(36160,36064,34069+t,i.__webglTexture,s)}else if(u){let i=a.get(e.texture);em.framebufferTextureLayer(36160,36064,i.__webglTexture,s||0,t||0)}X=-1},this.readRenderTargetPixels=function(e,s,o,h,c,d,u){if(!(e&&e.isWebGLRenderTarget))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let p=a.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==u&&(p=p[u]),p){r.bindFramebuffer(36160,p);try{let r=e.texture,a=r.format,u=r.type;if(1023!==a&&C.convert(a)!==em.getParameter(35739))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");let p=1016===u&&(t.has("EXT_color_buffer_half_float")||i.isWebGL2&&t.has("EXT_color_buffer_float"));if(1009!==u&&C.convert(u)!==em.getParameter(35738)&&!(1015===u&&(i.isWebGL2||t.has("OES_texture_float")||t.has("WEBGL_color_buffer_float")))&&!p)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");s>=0&&s<=e.width-h&&o>=0&&o<=e.height-c&&em.readPixels(s,o,h,c,C.convert(a),C.convert(u),d)}finally{let e=null!==q?a.get(q).__webglFramebuffer:null;r.bindFramebuffer(36160,e)}}},this.readRenderTargetPixelsAsync=async function(e,t,i,s,o,h,c){if(!(e&&e.isWebGLRenderTarget))throw Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let d=a.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==c&&(d=d[c]),d){let c=e.texture,p=c.format,f=c.type;if(t>=0&&t<=e.width-s&&i>=0&&i<=e.height-o){var u;r.bindFramebuffer(em.FRAMEBUFFER,d);let e=em.createBuffer();em.bindBuffer(em.PIXEL_PACK_BUFFER,e),em.bufferData(em.PIXEL_PACK_BUFFER,h.byteLength,em.STREAM_READ),em.readPixels(t,i,s,o,C.convert(p),C.convert(f),0);let c=null!==q?a.get(q).__webglFramebuffer:null;r.bindFramebuffer(em.FRAMEBUFFER,c);let m=em.fenceSync(em.SYNC_GPU_COMMANDS_COMPLETE,0);return em.flush(),await (u=em,new Promise(function(e,t){setTimeout(function i(){switch(u.clientWaitSync(m,u.SYNC_FLUSH_COMMANDS_BIT,0)){case u.WAIT_FAILED:t();break;case u.TIMEOUT_EXPIRED:setTimeout(i,4);break;default:e()}},4)})),em.bindBuffer(em.PIXEL_PACK_BUFFER,e),em.getBufferSubData(em.PIXEL_PACK_BUFFER,0,h),em.deleteBuffer(e),em.deleteSync(m),h}throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")}},this.copyFramebufferToTexture=function(e,t,i=0){let s=Math.pow(2,-i),a=Math.floor(t.image.width*s),h=Math.floor(t.image.height*s);o.setTexture2D(t,0),em.copyTexSubImage2D(3553,i,0,0,e.x,e.y,a,h),r.unbindTexture()},this.copyTextureToTexture=function(e,t,i,s=0){let a=t.image.width,h=t.image.height,c=C.convert(i.format),d=C.convert(i.type);o.setTexture2D(i,0),em.pixelStorei(37440,i.flipY),em.pixelStorei(37441,i.premultiplyAlpha),em.pixelStorei(3317,i.unpackAlignment),t.isDataTexture?em.texSubImage2D(3553,s,e.x,e.y,a,h,c,d,t.image.data):t.isCompressedTexture?em.compressedTexSubImage2D(3553,s,e.x,e.y,t.mipmaps[0].width,t.mipmaps[0].height,c,t.mipmaps[0].data):em.texSubImage2D(3553,s,e.x,e.y,c,d,t.image),0===s&&i.generateMipmaps&&em.generateMipmap(3553),r.unbindTexture()},this.copyTextureToTexture3D=function(e,t,i,s,a=0){if(V.isWebGL1Renderer)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");let h=e.max.x-e.min.x+1,c=e.max.y-e.min.y+1,d=e.max.z-e.min.z+1,u=C.convert(s.format),p=C.convert(s.type),f;if(s.isData3DTexture)o.setTexture3D(s,0),f=32879;else{if(!s.isDataArrayTexture)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");o.setTexture2DArray(s,0),f=35866}em.pixelStorei(37440,s.flipY),em.pixelStorei(37441,s.premultiplyAlpha),em.pixelStorei(3317,s.unpackAlignment);let m=em.getParameter(3314),g=em.getParameter(32878),v=em.getParameter(3316),y=em.getParameter(3315),x=em.getParameter(32877),b=i.isCompressedTexture?i.mipmaps[0]:i.image;em.pixelStorei(3314,b.width),em.pixelStorei(32878,b.height),em.pixelStorei(3316,e.min.x),em.pixelStorei(3315,e.min.y),em.pixelStorei(32877,e.min.z),i.isDataTexture||i.isData3DTexture?em.texSubImage3D(f,a,t.x,t.y,t.z,h,c,d,u,p,b.data):i.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),em.compressedTexSubImage3D(f,a,t.x,t.y,t.z,h,c,d,u,b.data)):em.texSubImage3D(f,a,t.x,t.y,t.z,h,c,d,u,p,b),em.pixelStorei(3314,m),em.pixelStorei(32878,g),em.pixelStorei(3316,v),em.pixelStorei(3315,y),em.pixelStorei(32877,x),0===a&&s.generateMipmaps&&em.generateMipmap(f),r.unbindTexture()},this.initRenderTarget=function(e){void 0===a.get(e).__webglFramebuffer&&o.setupRenderTarget(e)},this.initTexture=function(e){e.isCubeTexture?o.setTextureCube(e,0):e.isData3DTexture?o.setTexture3D(e,0):e.isDataArrayTexture||e.isCompressedArrayTexture?o.setTexture2DArray(e,0):o.setTexture2D(e,0),r.unbindTexture()},this.resetState=function(){H=0,G=0,q=null,r.reset(),M.reset()},"u">typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}(class extends ny{}).prototype.isWebGL1Renderer=!0;var nx=class{constructor(e,t=1,i=1e3){this.isFog=!0,this.name="",this.color=new ir(e),this.near=t,this.far=i}clone(){return new nx(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}},nb=class extends rh{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,"u">typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),null!==e.background&&(this.background=e.background.clone()),null!==e.environment&&(this.environment=e.environment.clone()),null!==e.fog&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){let t=super.toJSON(e);return null!==this.fog&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),1!==this.backgroundIntensity&&(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}},nw=class{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=void 0!==e?e.length/t:0,this.usage=35044,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=tj()}onUploadCallback(){}set needsUpdate(e){!0===e&&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){void 0===e.arrayBuffers&&(e.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=tj()),void 0===e.arrayBuffers[this.array.buffer._uuid]&&(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 void 0===e.arrayBuffers&&(e.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=tj()),void 0===e.arrayBuffers[this.array.buffer._uuid]&&(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}}},n_=new iy,nS=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: 5,548 bytes, line 3139
3139get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,i=this.data.count;t<i;t++)n_.fromBufferAttribute(this,t),n_.applyMatrix4(e),this.setXYZ(t,n_.x,n_.y,n_.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)n_.fromBufferAttribute(this,t),n_.applyNormalMatrix(e),this.setXYZ(t,n_.x,n_.y,n_.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)n_.fromBufferAttribute(this,t),n_.transformDirection(e),this.setXYZ(t,n_.x,n_.y,n_.z);return this}setX(e,t){return this.normalized&&(t=tY(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=tY(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=tY(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=tY(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=tX(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=tX(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=tX(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=tX(t,this.array)),t}setXY(e,t,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=tY(t,this.array),i=tY(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=tY(t,this.array),i=tY(i,this.array),r=tY(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=tY(t,this.array),i=tY(i,this.array),r=tY(r,this.array),s=tY(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(void 0!==e)return void 0===e.interleavedBuffers&&(e.interleavedBuffers={}),void 0===e.interleavedBuffers[this.data.uuid]&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new nS(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized);{console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");let e=[];for(let t=0;t<this.count;t++){let i=t*this.data.stride+this.offset;for(let t=0;t<this.itemSize;t++)e.push(this.data.array[i+t])}return new rE(new this.array.constructor(e),this.itemSize,this.normalized)}}toJSON(e){if(void 0!==e)return void 0===e.interleavedBuffers&&(e.interleavedBuffers={}),void 0===e.interleavedBuffers[this.data.uuid]&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized};{console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");let e=[];for(let t=0;t<this.count;t++){let i=t*this.data.stride+this.offset;for(let t=0;t<this.itemSize;t++)e.push(this.data.array[i+t])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:e,normalized:this.normalized}}}},nC=class extends rh{constructor(){super(),this.isBone=!0,this.type="Bone"}},nM=class extends ic{constructor(e=null,t=1,i=1,r,s,a,o,h,c=1003,d=1003,u,p){super(null,a,o,h,c,d,r,s,u,p),this.isDataTexture=!0,this.image={data:e,width:t,height:i},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}},nE=new iY,nA=new iY,nT=class{constructor(e=[],t=[]){this.uuid=tj(),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(16*e.length),0===t.length)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 e=0,t=this.bones.length;e<t;e++)this.boneInverses.push(new iY)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){let t=new iY;this.bones[e]&&t.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(t)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){let t=this.bones[e];t&&t.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){let t=this.bones[e];t&&(t.parent&&t.parent.isBone?(t.matrix.copy(t.parent.matrixWorld).invert(),t.matrix.multiply(t.matrixWorld)):t.matrix.copy(t.matrixWorld),t.matrix.decompose(t.position,t.quaternion,t.scale))}}update(){let e=this.bones,t=this.boneInverses,i=this.boneMatrices,r=this.boneTexture;for(let r=0,s=e.length;r<s;r++){let s=e[r]?e[r].matrixWorld:nA;nE.multiplyMatrices(s,t[r]),nE.toArray(i,16*r)}null!==r&&(r.needsUpdate=!0)}clone(){return new nT(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(4*this.bones.length),t=new Float32Array((e=Math.max(e=tG(e),4))*e*4);t.set(this.boneMatrices);let i=new nM(t,e,e,1023,1015);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 i=this.bones[t];if(i.name===e)return i}}dispose(){null!==this.boneTexture&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;
3139for(let i=0,r=e.bones.length;i<r;i++){let r=e.bones[i],s=t[r];void 0===s&&(console.warn("THREE.Skeleton: No bone found with UUID:",r),s=new nC),this.bones.push(s),this.boneInverses.push(new iY().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 s=t[r];e.bones.push(s.uuid);let a=i[r];e.boneInverses.push(a.toArray())}return e}},nP=class extends rE{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}},nD=new iY,nO=new iY,nL=[],nI=new iY,nR=new rK,nk=class extends rK{constructor(e,t,i){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new nP(new Float32Array(16*i),16),this.instanceColor=null,this.count=i,this.frustumCulled=!1;for(let e=0;e<i;e++)this.setMatrixAt(e,nI)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),null!==e.instanceColor&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,this}getColorAt(e,t){t.fromArray(this.instanceColor.array,3*e)}getMatrixAt(e,t){t.fromArray(this.instanceMatrix.array,16*e)}raycast(e,t){let i=this.matrixWorld,r=this.count;if(nR.geometry=this.geometry,nR.material=this.material,void 0!==nR.material)for(let s=0;s<r;s++){this.getMatrixAt(s,nD),nO.multiplyMatrices(i,nD),nR.matrixWorld=nO,nR.raycast(e,nL);for(let e=0,i=nL.length;e<i;e++){let i=nL[e];i.instanceId=s,i.object=this,t.push(i)}nL.length=0}}setColorAt(e,t){null===this.instanceColor&&(this.instanceColor=new nP(new Float32Array(3*this.instanceMatrix.count),3)),t.toArray(this.instanceColor.array,3*e)}setMatrixAt(e,t){t.toArray(this.instanceMatrix.array,16*e)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"})}},nB=class extends r_{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new ir(0xffffff),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}},nz=new iy,nN=new iy,nF=new iY,nj=new iX,nU=new iF,nV=class extends rh{constructor(e=new rz,t=new nB){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(null===e.index){let t=e.attributes.position,i=[0];for(let e=1,r=t.count;e<r;e++)nz.fromBufferAttribute(t,e-1),nN.fromBufferAttribute(t,e),i[e]=i[e-1],i[e]+=nz.distanceTo(nN);e.setAttribute("lineDistance",new rP(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(null===i.boundingSphere&&i.computeBoundingSphere(),nU.copy(i.boundingSphere),nU.applyMatrix4(r),nU.radius+=s,!1===e.ray.intersectsSphere(nU))return;nF.copy(r).invert(),nj.copy(e.ray).applyMatrix4(nF);let o=s/((this.scale.x+this.scale.y+this.scale.z)/3),h=o*o,c=new iy,d=new iy,u=new iy,p=new iy,f=this.isLineSegments?2:1,m=i.index,g=i.attributes.position;if(null!==m){let i=Math.max(0,a.start),r=Math.min(m.count,a.start+a.count);for(let s=i,a=r-1;s<a;s+=f){let i=m.getX(s),r=m.getX(s+1);if(c.fromBufferAttribute(g,i),d.fromBufferAttribute(g,r),nj.distanceSqToSegment(c,d,p,u)>h)continue;p.applyMatrix4(this.matrixWorld);let a=e.ray.origin.distanceTo(p);a<e.near||a>e.far||t.push({distance:a,point:u.clone().applyMatrix4(this.matrixWorld),index:s,face:null,faceIndex:null,object:this})}}else{let i=Math.max(0,a.start),r=Math.min(g.count,a.start+a.count);for(let s=i,a=r-1;s<a;s+=f){if(c.fromBufferAttribute(g,s),d.fromBufferAttribute(g,s+1),nj.distanceSqToSegment(c,d,p,u)>h)continue;p.applyMatrix4(this.matrixWorld);let i=e.ray.origin.distanceTo(p);i<e.near||i>e.far||t.push({distance:i,point:u.clone().applyMatrix4(this.matrixWorld),index:s,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(void 0!==i){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=i.length;e<t;e++){let t=i[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}},nW=new iy,nH=new iy,nG=class extends nV{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){let e=this.geometry;if(null===e.index){let t=e.attributes.position,i=[];for(let e=0,r=t.count;e<r;e+=2)nW.fromBufferAttribute(t,e),nH.fromBufferAttribute(t,e+1),i[e]=0===e?0:i[e-1],i[e+1]=i[e]+nW.distanceTo(nH);e.setAttribute("lineDistance",new rP(i,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}},nq=class extends ic{constructor(e,t,i,r,s,a,o,h,c){super(e,t,i,r,s,a,o,h,c),this.isVideoTexture=!0,this.minFilter=void 0!==a?a:1006,this.magFilter=void 0!==s?s:1006,this.generateMipmaps=!1;let d=this;"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(function t(){d.needsUpdate=!0,e.requestVideoFrameCallback(t)})}clone(){return new this.constructor(this.image).copy(this)}update(){let e=this.image;"requestVideoFrameCallback"in e==!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}},nX=class extends ic{constructor(e,t,i,r,s,a,o,h,c){super(e,t,i,r,s,a,o,h,c),this.isCanvasTexture=!0,this.needsUpdate=!0}},nY=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++)t.push(s+=(i=this.getPoint(a/e)).distanceTo(r)),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;a=t||e*i[s-1];let o=0,h=s-1,c;for(;o<=h;)if((c=i[r=Math.floor(o+(h-o)/2)]-a)<0)o=r+1;else if(c>0)h=r-1;else{h=r;break}if(i[r=h]===a)return r/(s-1);let d=i[r],u=i[r+1]-d;return(r+(a-d)/u)/(s-1)}getTangent(e,t){let i=e-1e-4,r=e+1e-4;i<0&&(i=0),r>1&&(r=1);let s=this.getPoint(i),a=this.getPoint(r),o=t||(s.isVector2?new tZ:new iy);return o.copy(a).sub(s).normalize(),o}getTangentAt(e,t){let i=this.getUtoTmapping(e);return this.getTangent(i,t)}computeFrenetFrames(e,t){let i=new iy,r=[],s=[],a=[],o=new iy,h=new iY;for(let t=0;t<=e;t++){let i=t/e;r[t]=this.getTangentAt(i,new iy)}s[0]=new iy,a[0]=new iy;let c=Number.MAX_VALUE,d=Math.abs(r[0].x),u=Math.abs(r[0].y),p=Math.abs(r[0].z);d<=c&&(c=d,i.set(1,0,0)),u<=c&&(c=u,i.set(0,1,0)),p<=c&&i.set(0,0,1),o.crossVectors(r[0],i).normalize(),s[0].crossVectors(r[0],o),a[0].crossVectors(r[0],s[0]);for(let t=1;t<=e;
vendor: 6,159 bytes, line 3139
3139t++){if(s[t]=s[t-1].clone(),a[t]=a[t-1].clone(),o.crossVectors(r[t-1],r[t]),o.length()>Number.EPSILON){o.normalize();let e=Math.acos(tU(r[t-1].dot(r[t]),-1,1));s[t].applyMatrix4(h.makeRotationAxis(o,e))}a[t].crossVectors(r[t],s[t])}if(!0===t){let t=Math.acos(tU(s[0].dot(s[e]),-1,1));t/=e,r[0].dot(o.crossVectors(s[0],s[e]))>0&&(t=-t);for(let i=1;i<=e;i++)s[i].applyMatrix4(h.makeRotationAxis(r[i],t*i)),a[i].crossVectors(r[i],s[i])}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.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}},nQ=class extends nY{constructor(e=0,t=0,i=1,r=1,s=0,a=2*Math.PI,o=!1,h=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=o,this.aRotation=h}getPoint(e,t){let i=t||new tZ,r=2*Math.PI,s=this.aEndAngle-this.aStartAngle,a=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=r;for(;s>r;)s-=r;s<Number.EPSILON&&(s=a?0:r),!0!==this.aClockwise||a||(s===r?s=-r:s-=r);let o=this.aStartAngle+e*s,h=this.aX+this.xRadius*Math.cos(o),c=this.aY+this.yRadius*Math.sin(o);if(0!==this.aRotation){let e=Math.cos(this.aRotation),t=Math.sin(this.aRotation),i=h-this.aX,r=c-this.aY;h=i*e-r*t+this.aX,c=i*t+r*e+this.aY}return i.set(h,c)}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}},nZ=class extends nQ{constructor(e,t,i,r,s,a){super(e,t,i,i,r,s,a),this.isArcCurve=!0,this.type="ArcCurve"}};function nK(){let e=0,t=0,i=0,r=0;function s(s,a,o,h){e=s,t=o,i=-3*s+3*a-2*o-h,r=2*s-2*a+o+h}return{initCatmullRom:function(e,t,i,r,a){s(t,i,a*(i-e),a*(r-t))},initNonuniformCatmullRom:function(e,t,i,r,a,o,h){let c=(t-e)/a-(i-e)/(a+o)+(i-t)/o,d=(i-t)/o-(r-t)/(o+h)+(r-i)/h;s(t,i,c*=o,d*=o)},calc:function(s){let a=s*s;return e+t*s+i*a+a*s*r}}}var nJ=new iy,n$=new nK,n0=new nK,n1=new nK,n2=class extends nY{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 iy){let i,r,s=this.points,a=s.length,o=(a-!this.closed)*e,h=Math.floor(o),c=o-h;this.closed?h+=h>0?0:(Math.floor(Math.abs(h)/a)+1)*a:0===c&&h===a-1&&(h=a-2,c=1),this.closed||h>0?i=s[(h-1)%a]:(nJ.subVectors(s[0],s[1]).add(s[0]),i=nJ);let d=s[h%a],u=s[(h+1)%a];if(this.closed||h+2<a?r=s[(h+2)%a]:(nJ.subVectors(s[a-1],s[a-2]).add(s[a-1]),r=nJ),"centripetal"===this.curveType||"chordal"===this.curveType){let e="chordal"===this.curveType?.5:.25,t=Math.pow(i.distanceToSquared(d),e),s=Math.pow(d.distanceToSquared(u),e),a=Math.pow(u.distanceToSquared(r),e);s<1e-4&&(s=1),t<1e-4&&(t=s),a<1e-4&&(a=s),n$.initNonuniformCatmullRom(i.x,d.x,u.x,r.x,t,s,a),n0.initNonuniformCatmullRom(i.y,d.y,u.y,r.y,t,s,a),n1.initNonuniformCatmullRom(i.z,d.z,u.z,r.z,t,s,a)}else"catmullrom"===this.curveType&&(n$.initCatmullRom(i.x,d.x,u.x,r.x,this.tension),n0.initCatmullRom(i.y,d.y,u.y,r.y,this.tension),n1.initCatmullRom(i.z,d.z,u.z,r.z,this.tension));return t.set(n$.calc(c),n0.calc(c),n1.calc(c)),t}copy(e){super.copy(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){let i=e.points[t];this.points.push(i.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,i=this.points.length;t<i;t++){let i=this.points[t];e.points.push(i.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){let i=e.points[t];this.points.push(new iy().fromArray(i))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}};function n3(e,t,i,r,s){let a=(r-t)*.5,o=(s-i)*.5,h=e*e;return e*h*(2*i-2*r+a+o)+(-3*i+3*r-2*a-o)*h+a*e+i}function n4(e,t,i,r){let s;return(s=1-e)*s*t+2*(1-e)*e*i+e*e*r}function n5(e,t,i,r,s){let a,o;return(a=1-e)*a*a*t+3*(o=1-e)*o*e*i+3*(1-e)*e*e*r+e*e*e*s}var n6=class extends nY{constructor(e=new tZ,t=new tZ,i=new tZ,r=new tZ){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=i,this.v3=r}getPoint(e,t=new tZ){let i=this.v0,r=this.v1,s=this.v2,a=this.v3;return t.set(n5(e,i.x,r.x,s.x,a.x),n5(e,i.y,r.y,s.y,a.y)),t}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}},n8=class extends nY{constructor(e=new iy,t=new iy,i=new iy,r=new iy){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=i,this.v3=r}getPoint(e,t=new iy){let i=this.v0,r=this.v1,s=this.v2,a=this.v3;return t.set(n5(e,i.x,r.x,s.x,a.x),n5(e,i.y,r.y,s.y,a.y),n5(e,i.z,r.z,s.z,a.z)),t}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}}
vendor: 12,312 bytes, line 3139
3139,n9=class extends nY{constructor(e=new tZ,t=new tZ){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new tZ){return 1===e?t.copy(this.v2):(t.copy(this.v2).sub(this.v1),t.multiplyScalar(e).add(this.v1)),t}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t){let i=t||new tZ;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}},n7=class extends nY{constructor(e=new iy,t=new iy){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new iy){return 1===e?t.copy(this.v2):(t.copy(this.v2).sub(this.v1),t.multiplyScalar(e).add(this.v1)),t}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}},oe=class extends nY{constructor(e=new tZ,t=new tZ,i=new tZ){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=i}getPoint(e,t=new tZ){let i=this.v0,r=this.v1,s=this.v2;return t.set(n4(e,i.x,r.x,s.x),n4(e,i.y,r.y,s.y)),t}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}},ot=class extends nY{constructor(e=new iy,t=new iy,i=new iy){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=i}getPoint(e,t=new iy){let i=this.v0,r=this.v1,s=this.v2;return t.set(n4(e,i.x,r.x,s.x),n4(e,i.y,r.y,s.y),n4(e,i.z,r.z,s.z)),t}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}},oi=class extends nY{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new tZ){let i=this.points,r=(i.length-1)*e,s=Math.floor(r),a=r-s,o=i[0===s?s:s-1],h=i[s],c=i[s>i.length-2?i.length-1:s+1],d=i[s>i.length-3?i.length-1:s+2];return t.set(n3(a,o.x,h.x,c.x,d.x),n3(a,o.y,h.y,c.y,d.y)),t}copy(e){super.copy(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){let i=e.points[t];this.points.push(i.clone())}return this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,i=this.points.length;t<i;t++){let i=this.points[t];e.points.push(i.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){let i=e.points[t];this.points.push(new tZ().fromArray(i))}return this}},or=Object.freeze({__proto__:null,ArcCurve:nZ,CatmullRomCurve3:n2,CubicBezierCurve:n6,CubicBezierCurve3:n8,EllipseCurve:nQ,LineCurve:n9,LineCurve3:n7,QuadraticBezierCurve:oe,QuadraticBezierCurve3:ot,SplineCurve:oi}),os=class extends nY{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 n9(t,e))}getPoint(e,t){let i=e*this.getLength(),r=this.getCurveLengths(),s=0;for(;s<r.length;){if(r[s]>=i){let e=r[s]-i,a=this.curves[s],o=a.getLength(),h=0===o?0:1-e/o;return a.getPointAt(h,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++)e.push(t+=this.curves[i].getLength());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],o=a.isEllipseCurve?2*e:a.isLineCurve||a.isLineCurve3?1:a.isSplineCurve?e*a.points.length:e,h=a.getPoints(o);for(let e=0;e<h.length;e++){let r=h[e];i&&i.equals(r)||(t.push(r),i=r)}}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 i=e.curves[t];this.curves.push(i.clone())}return this.autoClose=e.autoClose,this}toJSON(){let e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,i=this.curves.length;t<i;t++){let i=this.curves[t];e.curves.push(i.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,i=e.curves.length;t<i;t++){let i=e.curves[t];this.curves.push(new or[i.type]().fromJSON(i))}return this}},oa=class extends os{constructor(e){super(),this.type="Path",this.currentPoint=new tZ,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 n9(this.currentPoint.clone(),new tZ(e,t));return this.curves.push(i),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,i,r){let s=new oe(this.currentPoint.clone(),new tZ(e,t),new tZ(i,r));return this.curves.push(s),this.currentPoint.set(i,r),this}bezierCurveTo(e,t,i,r,s,a){let o=new n6(this.currentPoint.clone(),new tZ(e,t),new tZ(i,r),new tZ(s,a));return this.curves.push(o),this.currentPoint.set(s,a),this}splineThru(e){let t=new oi([this.currentPoint.clone()].concat(e));return this.curves.push(t),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,i,r,s,a){let o=this.currentPoint.x,h=this.currentPoint.y;return this.absarc(e+o,t+h,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,o,h){let c=this.currentPoint.x,d=this.currentPoint.y;return this.absellipse(e+c,t+d,i,r,s,a,o,h),this}absellipse(e,t,i,r,s,a,o,h){let c=new nQ(e,t,i,r,s,a,o,h);if(this.curves.length>0){let e=c.getPoint(0);e.equals(this.currentPoint)||this.lineTo(e.x,e.y)}this.curves.push(c);let d=c.getPoint(1);return this.currentPoint.copy(d),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}},on=class extends rz{constructor(e=[new tZ(0,-.5),new tZ(.5,0),new tZ(0,.5)],t=12,i=0,r=2*Math.PI){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:i,phiLength:r},t=Math.floor(t),r=tU(r,0,2*Math.PI);let s=[],a=[],o=[],h=[],c=[],d=1/t,u=new iy,p=new tZ,f=new iy,m=new iy,g=new iy,v=0,y=0;for(let t=0;t<=e.length-1;t++)switch(t){case 0:v=e[t+1].x-e[t].x,f.x=+(y=e[t+1].y-e[t].y),f.y=-v,f.z=0*y,g.copy(f),f.normalize(),h.push(f.x,f.y,f.z);break;case e.length-1:h.push(g.x,g.y,g.z);break;default:v=e[t+1].x-e[t].x,f.x=+(y=e[t+1].y-e[t].y),f.y=-v,f.z=0*y,m.copy(f),f.x+=g.x,f.y+=g.y,f.z+=g.z,f.normalize(),h.push(f.x,f.y,f.z),g.copy(m)}for(let s=0;s<=t;s++){let f=i+s*d*r,m=Math.sin(f),g=Math.cos(f);for(let i=0;i<=e.length-1;i++){u.x=e[i].x*m,u.y=e[i].y,u.z=e[i].x*g,a.push(u.x,u.y,u.z),p.x=s/t,p.y=i/(e.length-1),o.push(p.x,p.y);let r=h[3*i+0]*m,d=h[3*i+1],f=h[3*i+0]*g;c.push(r,d,f)}}for(let i=0;i<t;i++)for(let t=0;t<e.length-1;t++){let r=t+i*e.length,a=r+e.length,o=r+e.length+1,h=r+1;s.push(r,a,h),s.push(o,h,a)}this.setIndex(s),this.setAttribute("position",new rP(a,3)),this.setAttribute("uv",new rP(o,2)),this.setAttribute("normal",new rP(c,3))}static fromJSON(e){return new on(e.points,e.segments,e.phiStart,e.phiLength)}},oo=class extends rz{constructor(e=1,t=1,i=1,r=32,s=1,a=!1,o=0,h=2*Math.PI){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:i,radialSegments:r,heightSegments:s,openEnded:a,thetaStart:o,thetaLength:h};let c=this;r=Math.floor(r),s=Math.floor(s);let d=[],u=[],p=[],f=[],m=0,g=[],v=i/2,y=0;function x(i){let s=m,a=new tZ,g=new iy,x=0,b=!0===i?e:t,w=!0===i?1:-1;for(let e=1;e<=r;e++)u.push(0,v*w,0),p.push(0,w,0),f.push(.5,.5),m++;let _=m;for(let e=0;e<=r;e++){let t=e/r*h+o,i=Math.cos(t),s=Math.sin(t);g.x=b*s,g.y=v*w,g.z=b*i,u.push(g.x,g.y,g.z),p.push(0,w,0),a.x=.5*i+.5,a.y=.5*s*w+.5,f.push(a.x,a.y),m++}for(let e=0;e<r;e++){let t=s+e,r=_+e;!0===i?d.push(r,r+1,t):d.push(r+1,r,t),x+=3}c.addGroup(y,x,!0===i?1:2),y+=x}(function(){let a=new iy,x=new iy,b=0,w=(t-e)/i;for(let c=0;c<=s;c++){let d=[],y=c/s,b=y*(t-e)+e;for(let e=0;e<=r;e++){let t=e/r,s=t*h+o,c=Math.sin(s),g=Math.cos(s);x.x=b*c,x.y=-y*i+v,x.z=b*g,u.push(x.x,x.y,x.z),a.set(c,w,g).normalize(),p.push(a.x,a.y,a.z),f.push(t,1-y),d.push(m++)}g.push(d)}for(let e=0;e<r;e++)for(let t=0;t<s;t++){let i=g[t][e],r=g[t+1][e],s=g[t+1][e+1],a=g[t][e+1];d.push(i,r,a),d.push(r,s,a),b+=6}c.addGroup(y,b,0),y+=b})(),!1===a&&(e>0&&x(!0),t>0&&x(!1)),this.setIndex(d),this.setAttribute("position",new rP(u,3)),this.setAttribute("normal",new rP(p,3)),this.setAttribute("uv",new rP(f,2))}static fromJSON(e){return new oo(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}},ol=class extends oo{constructor(e=1,t=1,i=32,r=1,s=!1,a=0,o=2*Math.PI){super(0,e,t,i,r,s,a,o),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:i,heightSegments:r,openEnded:s,thetaStart:a,thetaLength:o}}static fromJSON(e){return new ol(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}},oh=class extends rz{constructor(e=[],t=[],i=1,r=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:i,detail:r};let s=[],a=[];function o(e){s.push(e.x,e.y,e.z)}function h(t,i){let r=3*t;i.x=e[r+0],i.y=e[r+1],i.z=e[r+2]}function c(e,t,i,r){r<0&&1===e.x&&(a[t]=e.x-1),0===i.x&&0===i.z&&(a[t]=r/2/Math.PI+.5)}function d(e){return Math.atan2(e.z,-e.x)}(function(e){let i=new iy,r=new iy,s=new iy;for(let a=0;a<t.length;a+=3)h(t[a+0],i),h(t[a+1],r),h(t[a+2],s),function(e,t,i,r){let s=r+1,a=[];for(let r=0;r<=s;r++){a[r]=[];let o=e.clone().lerp(i,r/s),h=t.clone().lerp(i,r/s),c=s-r;for(let e=0;e<=c;e++)0===e&&r===s?a[r][e]=o:a[r][e]=o.clone().lerp(h,e/c)}for(let e=0;e<s;e++)for(let t=0;t<2*(s-e)-1;t++){let i=Math.floor(t/2);t%2==0?(o(a[e][i+1]),o(a[e+1][i]),o(a[e][i])):(o(a[e][i+1]),o(a[e+1][i+1]),o(a[e+1][i]))}}(i,r,s,e)})(r),function(e){let t=new iy;for(let i=0;i<s.length;i+=3)t.x=s[i+0],t.y=s[i+1],t.z=s[i+2],t.normalize().multiplyScalar(e),s[i+0]=t.x,s[i+1]=t.y,s[i+2]=t.z}(i),function(){let e=new iy;for(let i=0;i<s.length;i+=3){var t;e.x=s[i+0],e.y=s[i+1],e.z=s[i+2];let r=d(e)/2/Math.PI+.5,o=Math.atan2(-(t=e).y,Math.sqrt(t.x*t.x+t.z*t.z))/Math.PI+.5;a.push(r,1-o)}(function(){let e=new iy,t=new iy,i=new iy,r=new iy,o=new tZ,h=new tZ,u=new tZ;for(let p=0,f=0;p<s.length;p+=9,f+=6){e.set(s[p+0],s[p+1],s[p+2]),t.set(s[p+3],s[p+4],s[p+5]),i.set(s[p+6],s[p+7],s[p+8]),o.set(a[f+0],a[f+1]),h.set(a[f+2],a[f+3]),u.set(a[f+4],a[f+5]),r.copy(e).add(t).add(i).divideScalar(3);let m=d(r);c(o,f+0,e,m),c(h,f+2,t,m),c(u,f+4,i,m)}})(),function(){for(let e=0;e<a.length;e+=6){let t=a[e+0],i=a[e+2],r=a[e+4],s=Math.max(t,i,r),o=Math.min(t,i,r);s>.9&&o<.1&&(t<.2&&(a[e+0]+=1),i<.2&&(a[e+2]+=1),r<.2&&(a[e+4]+=1))}}()}(),this.setAttribute("position",new rP(s,3)),this.setAttribute("normal",new rP(s.slice(),3)),this.setAttribute("uv",new rP(a,2)),0===r?this.computeVertexNormals():this.normalizeNormals()}static fromJSON(e){return new oh(e.vertices,e.indices,e.radius,e.details)}},oc=class extends oh{constructor(e=1,t=0){let i=(1+Math.sqrt(5))/2,r=1/i;super([-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],[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,
313919,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],e,t),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new oc(e.radius,e.detail)}},od=class extends oa{constructor(e){super(e),this.uuid=tj(),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 i=e.holes[t];this.holes.push(i.clone())}return this}toJSON(){let e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,i=this.holes.length;t<i;t++){let i=this.holes[t];e.holes.push(i.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,i=e.holes.length;t<i;t++){let i=e.holes[t];this.holes.push(new oa().fromJSON(i))}return this}},ou=function(e,t,i=2){let r,s,a,o,h,c,d,u=t&&t.length,p=u?t[0]*i:e.length,f=op(e,0,p,i,!0),m=[];if(!f||f.next===f.prev)return m;if(u&&(f=function(e,t,i,r){let s=[],a,o,h,c,d;for(a=0,o=t.length;a<o;a++)h=t[a]*r,c=a<o-1?t[a+1]*r:e.length,(d=op(e,h,c,r,!1))===d.next&&(d.steiner=!0),s.push(function(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}(d));for(s.sort(om),a=0;a<s.length;a++)i=function(e,t){let i=function(e,t){let i=t,r=-1/0,s,a=e.x,o=e.y;do{if(o<=i.y&&o>=i.next.y&&i.next.y!==i.y){let e=i.x+(o-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(e<=a&&e>r&&(r=e,s=i.x<i.next.x?i:i.next,e===a))return s}i=i.next}while(i!==t)if(!s)return null;let h=s,c=s.x,d=s.y,u=1/0,p;i=s;do{var f,m;a>=i.x&&i.x>=c&&a!==i.x&&ov(o<d?a:r,o,c,d,o<d?r:a,o,i.x,i.y)&&(p=Math.abs(o-i.y)/(a-i.x),oS(i,e)&&(p<u||p===u&&(i.x>s.x||i.x===s.x&&(f=s,m=i,0>oy(f.prev,f,m.prev)&&0>oy(m.next,f,f.next))))&&(s=i,u=p)),i=i.next}while(i!==h)return s}(e,t);if(!i)return t;let r=oC(i,e);return of(r,r.next),of(i,i.next)}(s[a],i);return i}(e,t,f,i)),e.length>80*i){r=a=e[0],s=o=e[1];for(let t=i;t<p;t+=i)h=e[t],c=e[t+1],h<r&&(r=h),c<s&&(s=c),h>a&&(a=h),c>o&&(o=c);d=0!==(d=Math.max(a-r,o-s))?32767/d:0}return function e(t,i,r,s,a,o,h){if(!t)return;!h&&o&&function(e,t,i,r){let s=e;do 0===s.z&&(s.z=og(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,function(e){let t,i,r,s,a,o,h,c,d=1;do{for(i=e,e=null,a=null,o=0;i;){for(o++,r=i,h=0,t=0;t<d&&(h++,r=r.nextZ);t++);for(c=d;h>0||c>0&&r;)0!==h&&(0===c||!r||i.z<=r.z)?(s=i,i=i.nextZ,h--):(s=r,r=r.nextZ,c--),a?a.nextZ=s:e=s,s.prevZ=a,a=s;i=r}a.nextZ=null,d*=2}while(o>1)}(s)}(t,s,a,o);let c=t,d,u;for(;t.prev!==t.next;){if(d=t.prev,u=t.next,o?function(e,t,i,r){let s=e.prev,a=e.next;if(oy(s,e,a)>=0)return!1;let o=s.x,h=e.x,c=a.x,d=s.y,u=e.y,p=a.y,f=o<h?o<c?o:c:h<c?h:c,m=d<u?d<p?d:p:u<p?u:p,g=o>h?o>c?o:c:h>c?h:c,v=d>u?d>p?d:p:u>p?u:p,y=og(f,m,t,i,r),x=og(g,v,t,i,r),b=e.prevZ,w=e.nextZ;for(;b&&b.z>=y&&w&&w.z<=x;){if(b.x>=f&&b.x<=g&&b.y>=m&&b.y<=v&&b!==s&&b!==a&&ov(o,d,h,u,c,p,b.x,b.y)&&oy(b.prev,b,b.next)>=0||(b=b.prevZ,w.x>=f&&w.x<=g&&w.y>=m&&w.y<=v&&w!==s&&w!==a&&ov(o,d,h,u,c,p,w.x,w.y)&&oy(w.prev,w,w.next)>=0))return!1;w=w.nextZ}for(;b&&b.z>=y;){if(b.x>=f&&b.x<=g&&b.y>=m&&b.y<=v&&b!==s&&b!==a&&ov(o,d,h,u,c,p,b.x,b.y)&&oy(b.prev,b,b.next)>=0)return!1;b=b.prevZ}for(;w&&w.z<=x;){if(w.x>=f&&w.x<=g&&w.y>=m&&w.y<=v&&w!==s&&w!==a&&ov(o,d,h,u,c,p,w.x,w.y)&&oy(w.prev,w,w.next)>=0)return!1;w=w.nextZ}return!0}(t,s,a,o):function(e){let t=e.prev,i=e.next;if(oy(t,e,i)>=0)return!1;let r=t.x,s=e.x,a=i.x,o=t.y,h=e.y,c=i.y,d=r<s?r<a?r:a:s<a?s:a,u=o<h?o<c?o:c:h<c?h:c,p=r>s?r>a?r:a:s>a?s:a,f=o>h?o>c?o:c:h>c?h:c,m=i.next;for(;m!==t;){if(m.x>=d&&m.x<=p&&m.y>=u&&m.y<=f&&ov(r,o,s,h,a,c,m.x,m.y)&&oy(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}(t)){i.push(d.i/r|0),i.push(t.i/r|0),i.push(u.i/r|0),oE(t),t=u.next,c=u.next;continue}if((t=u)===c){h?1===h?e(t=function(e,t,i){let r=e;do{let s=r.prev,a=r.next.next;!ox(s,a)&&ob(s,r,r.next,a)&&oS(s,a)&&oS(a,s)&&(t.push(s.i/i|0),t.push(r.i/i|0),t.push(a.i/i|0),oE(r),oE(r.next),r=e=a),r=r.next}while(r!==e)return of(r)}(of(t),i,r),i,r,s,a,o,2):2===h&&function(t,i,r,s,a,o){let h=t;do{let t=h.next.next;for(;t!==h.prev;){var c,d;if(h.i!==t.i&&(c=h,d=t,c.next.i!==d.i&&c.prev.i!==d.i&&!function(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&&ob(i,i.next,e,t))return!0;
3139i=i.next}while(i!==e)return!1}(c,d)&&(oS(c,d)&&oS(d,c)&&function(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}(c,d)&&(oy(c.prev,c,d.prev)||oy(c,d.prev,d))||ox(c,d)&&oy(c.prev,c,c.next)>0&&oy(d.prev,d,d.next)>0))){let c=oC(h,t);h=of(h,h.next),c=of(c,c.next),e(h,i,r,s,a,o,0),e(c,i,r,s,a,o,0);return}t=t.next}h=h.next}while(h!==t)}(t,i,r,s,a,o):e(of(t),i,r,s,a,o,1);break}}}(f,m,i,r,s,d,0),m};function op(e,t,i,r,s){let a,o;if(s===function(e,t,i,r){let s=0;for(let a=t,o=i-r;a<i;a+=r)s+=(e[o]-e[a])*(e[a+1]+e[o+1]),o=a;return s}(e,t,i,r)>0)for(a=t;a<i;a+=r)o=oM(a,e[a],e[a+1],o);else for(a=i-r;a>=t;a-=r)o=oM(a,e[a],e[a+1],o);return o&&ox(o,o.next)&&(oE(o),o=o.next),o}function of(e,t){if(!e)return e;t||(t=e);let i=e,r;do if(r=!1,!i.steiner&&(ox(i,i.next)||0===oy(i.prev,i,i.next))){if(oE(i),(i=t=i.prev)===i.next)break;r=!0}else i=i.next;while(r||i!==t)return t}function om(e,t){return e.x-t.x}function og(e,t,i,r,s){return(e=((e=((e=((e=((e=(e-i)*s|0)|e<<8)&0xff00ff)|e<<4)&0xf0f0f0f)|e<<2)&0x33333333)|e<<1)&0x55555555)|(t=((t=((t=((t=((t=(t-r)*s|0)|t<<8)&0xff00ff)|t<<4)&0xf0f0f0f)|t<<2)&0x33333333)|t<<1)&0x55555555)<<1}function ov(e,t,i,r,s,a,o,h){return(s-o)*(t-h)>=(e-o)*(a-h)&&(e-o)*(r-h)>=(i-o)*(t-h)&&(i-o)*(a-h)>=(s-o)*(r-h)}function oy(e,t,i){return(t.y-e.y)*(i.x-t.x)-(t.x-e.x)*(i.y-t.y)}function ox(e,t){return e.x===t.x&&e.y===t.y}function ob(e,t,i,r){let s=o_(oy(e,t,i)),a=o_(oy(e,t,r)),o=o_(oy(i,r,e)),h=o_(oy(i,r,t));return!!(s!==a&&o!==h||0===s&&ow(e,i,t)||0===a&&ow(e,r,t)||0===o&&ow(i,e,r)||0===h&&ow(i,t,r))}function ow(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 o_(e){return e>0?1:e<0?-1:0}function oS(e,t){return 0>oy(e.prev,e,e.next)?oy(e,t,e.next)>=0&&oy(e,e.prev,t)>=0:0>oy(e,t,e.prev)||0>oy(e,e.next,t)}function oC(e,t){let i=new oA(e.i,e.x,e.y),r=new oA(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 oM(e,t,i,r){let s=new oA(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 oE(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 oA(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}var oT=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 .5*i}static isClockWise(e){return 0>oT.area(e)}static triangulateShape(e,t){let i=[],r=[],s=[];oP(e),oD(i,e);let a=e.length;t.forEach(oP);for(let e=0;e<t.length;e++)r.push(a),a+=t[e].length,oD(i,t[e]);let o=ou(i,r);for(let e=0;e<o.length;e+=3)s.push(o.slice(e,e+3));return s}};function oP(e){let t=e.length;t>2&&e[t-1].equals(e[0])&&e.pop()}function oD(e,t){for(let i=0;i<t.length;i++)e.push(t[i].x),e.push(t[i].y)}var oO=class extends oh{constructor(e=1,t=0){let i=(1+Math.sqrt(5))/2;super([-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],[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],e,t),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new oO(e.radius,e.detail)}},oL=class extends rz{constructor(e=1,t=32,i=16,r=0,s=2*Math.PI,a=0,o=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:i,phiStart:r,phiLength:s,thetaStart:a,thetaLength:o},t=Math.max(3,Math.floor(t)),i=Math.max(2,Math.floor(i));let h=Math.min(a+o,Math.PI),c=0,d=[],u=new iy,p=new iy,f=[],m=[],g=[],v=[];for(let f=0;f<=i;f++){let y=[],x=f/i,b=0;0==f&&0==a?b=.5/t:f==i&&h==Math.PI&&(b=-.5/t);for(let i=0;i<=t;i++){let h=i/t;u.x=-e*Math.cos(r+h*s)*Math.sin(a+x*o),u.y=e*Math.cos(a+x*o),u.z=e*Math.sin(r+h*s)*Math.sin(a+x*o),m.push(u.x,u.y,u.z),p.copy(u).normalize(),g.push(p.x,p.y,p.z),v.push(h+b,1-x),y.push(c++)}d.push(y)}for(let e=0;e<i;e++)for(let r=0;r<t;r++){let t=d[e][r+1],s=d[e][r],o=d[e+1][r],c=d[e+1][r+1];(0!==e||a>0)&&f.push(t,s,c),(e!==i-1||h<Math.PI)&&f.push(s,o,c)}this.setIndex(f),this.setAttribute("position",new rP(m,3)),this.setAttribute("normal",new rP(g,3)),this.setAttribute("uv",new rP(v,2))}static fromJSON(e){return new oL(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}},oI=class extends rz{constructor(e=1,t=.4,i=12,r=48,s=2*Math.PI){super(),this.type="TorusGeometry",this.parameters={radiu
3139s:e,tube:t,radialSegments:i,tubularSegments:r,arc:s},i=Math.floor(i),r=Math.floor(r);let a=[],o=[],h=[],c=[],d=new iy,u=new iy,p=new iy;for(let a=0;a<=i;a++)for(let f=0;f<=r;f++){let m=f/r*s,g=a/i*Math.PI*2;u.x=(e+t*Math.cos(g))*Math.cos(m),u.y=(e+t*Math.cos(g))*Math.sin(m),u.z=t*Math.sin(g),o.push(u.x,u.y,u.z),d.x=e*Math.cos(m),d.y=e*Math.sin(m),p.subVectors(u,d).normalize(),h.push(p.x,p.y,p.z),c.push(f/r),c.push(a/i)}for(let e=1;e<=i;e++)for(let t=1;t<=r;t++){let i=(r+1)*e+t-1,s=(r+1)*(e-1)+t-1,o=(r+1)*(e-1)+t,h=(r+1)*e+t;a.push(i,s,h),a.push(s,o,h)}this.setIndex(a),this.setAttribute("position",new rP(o,3)),this.setAttribute("normal",new rP(h,3)),this.setAttribute("uv",new rP(c,2))}static fromJSON(e){return new oI(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}},oR=class extends rz{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 o=[],h=[],c=[],d=[],u=new iy,p=new iy,f=new iy,m=new iy,g=new iy,v=new iy,y=new iy;for(let o=0;o<=i;++o){let b=o/i*s*Math.PI*2;x(b,s,a,e,f),x(b+.01,s,a,e,m),v.subVectors(m,f),y.addVectors(m,f),g.crossVectors(v,y),y.crossVectors(g,v),g.normalize(),y.normalize();for(let e=0;e<=r;++e){let s=e/r*Math.PI*2,a=-t*Math.cos(s),m=t*Math.sin(s);u.x=f.x+(a*y.x+m*g.x),u.y=f.y+(a*y.y+m*g.y),u.z=f.z+(a*y.z+m*g.z),h.push(u.x,u.y,u.z),p.subVectors(u,f).normalize(),c.push(p.x,p.y,p.z),d.push(o/i),d.push(e/r)}}for(let e=1;e<=i;e++)for(let t=1;t<=r;t++){let i=(r+1)*(e-1)+(t-1),s=(r+1)*e+(t-1),a=(r+1)*e+t,h=(r+1)*(e-1)+t;o.push(i,s,h),o.push(s,a,h)}function x(e,t,i,r,s){let a=Math.cos(e),o=Math.sin(e),h=i/t*e,c=Math.cos(h);s.x=r*(2+c)*.5*a,s.y=r*(2+c)*o*.5,s.z=r*Math.sin(h)*.5}this.setIndex(o),this.setAttribute("position",new rP(h,3)),this.setAttribute("normal",new rP(c,3)),this.setAttribute("uv",new rP(d,2))}static fromJSON(e){return new oR(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}},ok=class extends r5{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}};function oB(e,t,i){return oN(e)?new e.constructor(e.subarray(t,void 0!==i?i:e.length)):e.slice(t,i)}function oz(e,t,i){return e&&(i||e.constructor!==t)?"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e):e}function oN(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function oF(e,t,i){let r=e.length,s=new e.constructor(r);for(let a=0,o=0;o!==r;++a){let r=i[a]*t;for(let i=0;i!==t;++i)s[o++]=e[r+i]}return s}function oj(e,t,i,r){let s=1,a=e[0];for(;void 0!==a&&void 0===a[r];)a=e[s++];if(void 0===a)return;let o=a[r];if(void 0!==o)if(Array.isArray(o))do void 0!==(o=a[r])&&(t.push(a.time),i.push.apply(i,o)),a=e[s++];while(void 0!==a)else if(void 0!==o.toArray)do void 0!==(o=a[r])&&(t.push(a.time),o.toArray(i,i.length)),a=e[s++];while(void 0!==a)else do void 0!==(o=a[r])&&(t.push(a.time),i.push(o)),a=e[s++];while(void 0!==a)}var oU=class{constructor(e,t,i,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=void 0!==r?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 a=i+2;;){if(void 0===r){if(e<s)break r;return i=t.length,this._cachedIndex=i,this.copySampleValue_(i-1)}if(i===a)break;if(s=r,e<(r=t[++i]))break t}a=t.length;break i}if(!(e>=s)){let o=t[1];e<o&&(i=2,s=o);for(let a=i-2;;){if(void 0===s)return this._cachedIndex=0,this.copySampleValue_(0);if(i===a)break;if(r=s,e>=(s=t[--i-1]))break t}a=i,i=0;break i}break e}for(;i<a;){let r=i+a>>>1;e<t[r]?a=r:i=r+1}if(r=t[i],void 0===(s=t[i-1]))return this._cachedIndex=0,this.copySampleValue_(0);if(void 0===r)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 e=0;e!==r;++e)t[e]=i[s+e];return t}interpolate_(){throw Error("call to abstract method")}intervalChanged_(){}},oV=class extends oU{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:2400,endingEnd:2400}}intervalChanged_(e,t,i){let r=this.parameterPositions,s=e-2,a=e+1,o=r[s],h=r[a];if(void 0===o)switch(this.getSettings_().endingStart){case 2401:s=e,o=2*t-i;break;case 2402:s=r.length-2,o=t+r[s]-r[s+1];break;default:s=e,o=i}if(void 0===h)switch(this.getSettings_().endingEnd){case 2401:a=e,h=2*i-t;break;case 2402:a=1,h=i+r[1]-r[0];break;default:a=e-1,h=t}let c=(i-t)*.5,d=this.valueSize;this._weightPrev=c/(t-o),this._weightNext=c/(h-i),this._offsetPrev=s*d,this._offsetNext=a*d}interpolate_(e,t,i,r){let s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,h=e*o,c=h-o,d=this._offsetPrev,u=this._offsetNext,p=this._weightPrev,f=this._weightNext,m=(i-t)/(r-t),g=m*m,v=g*m,y=-p*v+2*p*g-p*m,x=(1+p)*v+(-1.5-2*p)*g+(-.5+p)*m+1,b=(-1-f)*v+(1.5+f)*g+.5*m,w=f*v-f*g;for(let e=0;e!==o;++e)s[e]=y*a[d+e]+x*a[c+e]+b*a[h+e]+w*a[u+e];return s}},oW=class extends oU{constructor(e,t,i,r){super(e,t,i,r)}interpolate_(e,t,i,r){let s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,h=e*o,c=h-o,d=(i-t)/(r-t),u=1-d;for(let e=0;e!==o;++e)s[e]=a[c+e]*u+a[h+e]*d;return s}},oH=class extends oU{constructor(e,t,i,r){super(e,t,i,r)}interpolate_(e){return this.copySampleValue_(e-1)}},oG=class{constructor(e,t,i,r){if(void 0===e)throw Error("THREE.KeyframeTrack: track name is undefined");if(void 0===t||0===t.length)throw Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=oz(t,this.TimeBufferType),this.values=oz(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:oz(e.times,Array),values:oz(e.values,Array)};let t=e.getInterpolation();t!==e.DefaultInterpolation&&(i.interpolation=t)}return i.type=e.ValueTypeName,i}InterpolantFactoryMethodDiscrete(e){return new oH(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new oW(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new oV(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case 2300:t=this.InterpolantFactoryMethodDiscrete;break;case 2301:t=this.InterpolantFactoryMethodLinear;break;case 2302:t=this.InterpolantFactoryMethodSmooth}if(void 0===t){let t="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw Error(t);return console.warn("THREE.KeyframeTrack:",t),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return 2300;case this.InterpolantFactoryMethodLinear:return 2301;case this.InterpolantFactoryMethodSmooth:return 2302}}getValueSize(){return this.values.length/this.times.length}shift(e){if(0!==e){let t=this.times;for(let i=0,r=t.length;i!==r;++i)t[i]+=e}return this}scale(e){if(1!==e){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(;-1!==a&&i[a]>t;)--a;if(++a,0!==s||a!==r){s>=a&&(s=(a=Math.max(a,1))-1);let e=this.getValueSize();this.times=oB(i,s,a),this.values=oB(this.values,s*e,a*e)}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;0===s&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let a=null;for(let t=0;t!==s;t++){let r=i[t];if("number"==typeof r&&isNaN(r)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,t,r),e=!1;break}if(null!==a&&a>r){console.error("THREE.KeyframeTrack: Out of order keys.",this,t,r,a),e=!1;break}a=r}if(void 0!==r&&oN(r))for(let t=0,i=r.length;t!==i;++t){let i=r[t];if(isNaN(i)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,t,i),e=!1;break}}return e}optimize(){let e=oB(this.times),t=oB(this.values),i=this.getValueSize(),r=2302===this.getInterpolation(),s=e.length-1,a=1;for(let o=1;o<s;++o){let s=!1,h=e[o];if(h!==e[o+1]&&(1!==o||h!==e[0]))if(r)s=!0;else{let e=o*i,r=e-i,a=e+i;for(let o=0;o!==i;++o){let i=t[e+o];if(i!==t[r+o]||i!==t[a+o]){s=!0;break}}}if(s){if(o!==a){e[a]=e[o];let r=o*i,s=a*i;for(let e=0;e!==i;++e)t[s+e]=t[r+e]}++a}}if(s>0){e[a]=e[s];for(let e=s*i,r=a*i,o=0;o!==i;++o)t[r+o]=t[e+o];++a}return a!==e.length?(this.times=oB(e,0,a),this.values=oB(t,0,a*i)):(this.times=e,this.values=t),this}clone(){let e=oB(this.times,0),t=oB(this.values,0),i=new this.constructor(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}};oG.prototype.TimeBufferType=Float32Array,oG.prototype.ValueBufferType=Float32Array,oG.prototype.DefaultInterpolation=2301;var oq=class extends oG{};oq.prototype.ValueTypeName="bool",oq.prototype.ValueBufferType=Array,oq.prototype.DefaultInterpolation=2300,oq.prototype.InterpolantFactoryMethodLinear=void 0,oq.prototype.InterpolantFactoryMethodSmooth=void 0;var oX=class extends oG{};oX.prototype.ValueTypeName="color";var oY=class extends oG{};oY.prototype.ValueTypeName="number";var oQ=class extends oU{constructor(e,t,i,r){super(e,t,i,r)}interpolate_(e,t,i,r){let s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,h=(i-t)/(r-t),c=e*o;for(let e=c+o;c!==e;
3139c+=4)iv.slerpFlat(s,0,a,c-o,a,c,h);return s}},oZ=class extends oG{InterpolantFactoryMethodLinear(e){return new oQ(this.times,this.values,this.getValueSize(),e)}};oZ.prototype.ValueTypeName="quaternion",oZ.prototype.DefaultInterpolation=2301,oZ.prototype.InterpolantFactoryMethodSmooth=void 0;var oK=class extends oG{};oK.prototype.ValueTypeName="string",oK.prototype.ValueBufferType=Array,oK.prototype.DefaultInterpolation=2300,oK.prototype.InterpolantFactoryMethodLinear=void 0,oK.prototype.InterpolantFactoryMethodSmooth=void 0;var oJ=class extends oG{};oJ.prototype.ValueTypeName="vector";var o$=class{constructor(e,t=-1,i,r=2500){this.name=e,this.tracks=i,this.duration=t,this.blendMode=r,this.uuid=tj(),this.duration<0&&this.resetDuration()}static parse(e){let t=[],i=e.tracks,r=1/(e.fps||1);for(let e=0,s=i.length;e!==s;++e)t.push((function(e){if(void 0===e.type)throw Error("THREE.KeyframeTrack: track type undefined, can not parse");let t=function(e){switch(e.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return oY;case"vector":case"vector2":case"vector3":case"vector4":return oJ;case"color":return oX;case"quaternion":return oZ;case"bool":case"boolean":return oq;case"string":return oK}throw Error("THREE.KeyframeTrack: Unsupported typeName: "+e)}(e.type);if(void 0===e.times){let t=[],i=[];oj(e.keys,t,i,"value"),e.times=t,e.values=i}return void 0!==t.parse?t.parse(e):new t(e.name,e.times,e.values,e.interpolation)})(i[e]).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 e=0,r=i.length;e!==r;++e)t.push(oG.toJSON(i[e]));return r}static CreateFromMorphTargetSequence(e,t,i,r){let s=t.length,a=[];for(let e=0;e<s;e++){let o=[],h=[];o.push((e+s-1)%s,e,(e+1)%s),h.push(0,1,0);let c=function(e){let t=e.length,i=Array(t);for(let e=0;e!==t;++e)i[e]=e;return i.sort(function(t,i){return e[t]-e[i]}),i}(o);o=oF(o,1,c),h=oF(h,1,c),r||0!==o[0]||(o.push(s),h.push(h[0])),a.push(new oY(".morphTargetInfluences["+t[e].name+"]",o,h).scale(1/i))}return new this(e,-1,a)}static findByName(e,t){let i=e;Array.isArray(e)||(i=e.geometry&&e.geometry.animations||e.animations);for(let e=0;e<i.length;e++)if(i[e].name===t)return i[e];return null}static CreateClipsFromMorphTargetSequences(e,t,i){let r={},s=/^([\w-]*?)([\d]+)$/;for(let t=0,i=e.length;t<i;t++){let i=e[t],a=i.name.match(s);if(a&&a.length>1){let e=a[1],t=r[e];t||(r[e]=t=[]),t.push(i)}}let a=[];for(let e in r)a.push(this.CreateFromMorphTargetSequence(e,r[e],t,i));return a}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;let i=function(e,t,i,r,s){if(0!==i.length){let a=[],o=[];oj(i,a,o,r),0!==a.length&&s.push(new e(t,a,o))}},r=[],s=e.name||"default",a=e.fps||30,o=e.blendMode,h=e.length||-1,c=e.hierarchy||[];for(let e=0;e<c.length;e++){let s=c[e].keys;if(!(!s||0===s.length))if(s[0].morphTargets){let e={},t;for(t=0;t<s.length;t++)if(s[t].morphTargets)for(let i=0;i<s[t].morphTargets.length;i++)e[s[t].morphTargets[i]]=-1;for(let i in e){let e=[],a=[];for(let r=0;r!==s[t].morphTargets.length;++r){let r=s[t];e.push(r.time),a.push(+(r.morphTarget===i))}r.push(new oY(".morphTargetInfluence["+i+"]",e,a))}h=e.length*a}else{let a=".bones["+t[e].name+"]";i(oJ,a+".position",s,"pos",r),i(oZ,a+".quaternion",s,"rot",r),i(oJ,a+".scale",s,"scl",r)}}return 0===r.length?null:new this(s,h,r,o)}resetDuration(){let e=this.tracks,t=0;for(let i=0,r=e.length;i!==r;++i){let e=this.tracks[i];t=Math.max(t,e.times[e.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)}},o0={enabled:!1,files:{},add:function(e,t){!1!==this.enabled&&(this.files[e]=t)},get:function(e){if(!1!==this.enabled)return this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}},o1=class{constructor(e,t,i){let r=this,s=!1,a=0,o=0,h,c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=i,this.itemStart=function(e){o++,!1===s&&void 0!==r.onStart&&r.onStart(e,a,o),s=!0},this.itemEnd=function(e){a++,void 0!==r.onProgress&&r.onProgress(e,a,o),a===o&&(s=!1,void 0!==r.onLoad&&r.onLoad())},this.itemError=function(e){void 0!==r.onError&&r.onError(e)},this.resolveURL=function(e){return h?h(e):e},this.setURLModifier=function(e){return h=e,this},this.addHandler=function(e,t){return c.push(e,t),this},this.removeHandler=function(e){let t=c.indexOf(e);return -1!==t&&c.splice(t,2),this},this.getHandler=function(e){for(let t=0,i=c.length;t<i;t+=2){let i=c[t],r=c[t+1];if(i.global&&(i.lastIndex=0),i.test(e))return r}return null}}},o2=new o1,o3=class{constructor(e){this.manager=void 0!==e?e:o2,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}},o4={}
3139,o5=class extends Error{constructor(e,t){super(e),this.response=t}},o6=class extends o3{constructor(e){super(e)}load(e,t,i,r){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);let s=o0.get(e);if(void 0!==s)return this.manager.itemStart(e),setTimeout(()=>{t&&t(s),this.manager.itemEnd(e)},0),s;if(void 0!==o4[e])return void o4[e].push({onLoad:t,onProgress:i,onError:r});o4[e]=[],o4[e].push({onLoad:t,onProgress:i,onError:r});let a=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),o=this.mimeType,h=this.responseType;fetch(a).then(t=>{if(200===t.status||0===t.status){if(0===t.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||void 0===t.body||void 0===t.body.getReader)return t;let i=o4[e],r=t.body.getReader(),s=t.headers.get("Content-Length")||t.headers.get("X-File-Size"),a=s?parseInt(s):0,o=0!==a,h=0;return new Response(new ReadableStream({start(e){!function t(){r.read().then(({done:r,value:s})=>{if(r)e.close();else{let r=new ProgressEvent("progress",{lengthComputable:o,loaded:h+=s.byteLength,total:a});for(let e=0,t=i.length;e<t;e++){let t=i[e];t.onProgress&&t.onProgress(r)}e.enqueue(s),t()}})}()}}))}throw new o5(`fetch for "${t.url}" responded with ${t.status}: ${t.statusText}`,t)}).then(e=>{switch(h){case"arraybuffer":return e.arrayBuffer();case"blob":return e.blob();case"document":return e.text().then(e=>new DOMParser().parseFromString(e,o));case"json":return e.json();default:if(void 0===o)return e.text();{let t=/charset="?([^;"\s]*)"?/i.exec(o),i=new TextDecoder(t&&t[1]?t[1].toLowerCase():void 0);return e.arrayBuffer().then(e=>i.decode(e))}}}).then(t=>{o0.add(e,t);let i=o4[e];delete o4[e];for(let e=0,r=i.length;e<r;e++){let r=i[e];r.onLoad&&r.onLoad(t)}}).catch(t=>{let i=o4[e];if(void 0===i)throw this.manager.itemError(e),t;delete o4[e];for(let e=0,r=i.length;e<r;e++){let r=i[e];r.onError&&r.onError(t)}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}},o8=class extends o3{constructor(e){super(e)}load(e,t,i,r){void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);let s=this,a=o0.get(e);if(void 0!==a)return s.manager.itemStart(e),setTimeout(function(){t&&t(a),s.manager.itemEnd(e)},0),a;let o=t2("img");function h(){d(),o0.add(e,this),t&&t(this),s.manager.itemEnd(e)}function c(t){d(),r&&r(t),s.manager.itemError(e),s.manager.itemEnd(e)}function d(){o.removeEventListener("load",h,!1),o.removeEventListener("error",c,!1)}return o.addEventListener("load",h,!1),o.addEventListener("error",c,!1),"data:"!==e.slice(0,5)&&void 0!==this.crossOrigin&&(o.crossOrigin=this.crossOrigin),s.manager.itemStart(e),o.src=e,o}},o9=class extends o3{constructor(e){super(e)}load(e,t,i,r){let s=new ic,a=new o8(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,function(e){s.image=e,s.needsUpdate=!0,void 0!==t&&t(s)},i,r),s}},o7=class extends rh{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new ir(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,void 0!==this.groundColor&&(t.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(t.object.distance=this.distance),void 0!==this.angle&&(t.object.angle=this.angle),void 0!==this.decay&&(t.object.decay=this.decay),void 0!==this.penumbra&&(t.object.penumbra=this.penumbra),void 0!==this.shadow&&(t.object.shadow=this.shadow.toJSON()),t}},le=class extends o7{constructor(e,t,i){super(e,i),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(rh.DEFAULT_UP),this.updateMatrix(),this.groundColor=new ir(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}},lt=new iY,li=new iy,lr=new iy,ls=class{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new tZ(512,512),this.map=null,this.mapPass=null,this.matrix=new iY,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new so,this._frameExtents=new tZ(1,1),this._viewportCount=1,this._viewports=[new id(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){let t=this.camera,i=this.matrix;li.setFromMatrixPosition(e.matrixWorld),t.position.copy(li),lr.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(lr),t.updateMatrixWorld(),lt.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(lt),i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(lt)}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 0!==this.bias&&(e.bias=this.bias),0!==this.normalBias&&(e.normalBias=this.normalBias),1!==this.radius&&(e.radiu
vendor: 11,896 bytes, line 3139
3139s=this.radius),(512!==this.mapSize.x||512!==this.mapSize.y)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}},la=class extends ls{constructor(){super(new r8(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){let t=this.camera,i=2*tF*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}},ln=class extends o7{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(rh.DEFAULT_UP),this.updateMatrix(),this.target=new rh,this.distance=i,this.angle=r,this.penumbra=s,this.decay=a,this.map=null,this.shadow=new la}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}},lo=new iY,ll=new iy,lh=new iy,lc=class extends ls{constructor(){super(new r8(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new tZ(4,2),this._viewportCount=6,this._viewports=[new id(2,1,1,1),new id(0,1,1,1),new id(3,1,1,1),new id(1,1,1,1),new id(3,0,1,1),new id(1,0,1,1)],this._cubeDirections=[new iy(1,0,0),new iy(-1,0,0),new iy(0,0,1),new iy(0,0,-1),new iy(0,1,0),new iy(0,-1,0)],this._cubeUps=[new iy(0,1,0),new iy(0,1,0),new iy(0,1,0),new iy(0,1,0),new iy(0,0,1),new iy(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()),ll.setFromMatrixPosition(e.matrixWorld),i.position.copy(ll),lh.copy(i.position),lh.add(this._cubeDirections[t]),i.up.copy(this._cubeUps[t]),i.lookAt(lh),i.updateMatrixWorld(),r.makeTranslation(-ll.x,-ll.y,-ll.z),lo.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),this._frustum.setFromProjectionMatrix(lo)}},ld=class extends o7{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 lc}get power(){return 4*this.intensity*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}},lu=class extends ls{constructor(){super(new sw(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}},lp=class extends o7{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(rh.DEFAULT_UP),this.updateMatrix(),this.target=new rh,this.shadow=new lu}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}},lf=class extends rz{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}},lm=class extends o3{constructor(e){super(e)}load(e,t,i,r){let s=this,a=new o6(s.manager);a.setPath(s.path),a.setRequestHeader(s.requestHeader),a.setWithCredentials(s.withCredentials),a.load(e,function(i){try{t(s.parse(JSON.parse(i)))}catch(t){r?r(t):console.error(t),s.manager.itemError(e)}},i,r)}parse(e){let t={},i={};function r(e,r){if(void 0!==t[r])return t[r];let s=e.interleavedBuffers[r],a=function(e,t){if(void 0!==i[t])return i[t];let r=new Uint32Array(e.arrayBuffers[t]).buffer;return i[t]=r,r}(e,s.buffer),o=new nw(t1(s.type,a),s.stride);return o.uuid=s.uuid,t[r]=o,o}let s=e.isInstancedBufferGeometry?new lf:new rz,a=e.data.index;if(void 0!==a){let e=t1(a.type,a.array);s.setIndex(new rE(e,1))}let o=e.data.attributes;for(let t in o){let i=o[t],a;if(i.isInterleavedBufferAttribute)a=new nS(r(e.data,i.data),i.itemSize,i.offset,i.normalized);else{let e=t1(i.type,i.array);a=new(i.isInstancedBufferAttribute?nP:rE)(e,i.itemSize,i.normalized)}void 0!==i.name&&(a.name=i.name),void 0!==i.usage&&a.setUsage(i.usage),void 0!==i.updateRange&&(a.updateRange.offset=i.updateRange.offset,a.updateRange.count=i.updateRange.count),s.setAttribute(t,a)}let h=e.data.morphAttributes;if(h)for(let t in h){let i=h[t],a=[];for(let t=0,s=i.length;t<s;t++){let s=i[t],o;o=s.isInterleavedBufferAttribute?new nS(r(e.data,s.data),s.itemSize,s.offset,s.normalized):new rE(t1(s.type,s.array),s.itemSize,s.normalized),void 0!==s.name&&(o.name=s.name),a.push(o)}s.morphAttributes[t]=a}e.data.morphTargetsRelative&&(s.morphTargetsRelative=!0);let c=e.data.groups||e.data.drawcalls||e.data.offsets;if(void 0!==c)for(let e=0,t=c.length;e!==t;++e){let t=c[e];s.addGroup(t.start,t.count,t.materialIndex)}let d=e.data.boundingSphere;if(void 0!==d){let e=new iy;void 0!==d.center&&e.fromArray(d.center),s.boundingSphere=new iF(e,d.radius)}return e.name&&(s.name=e.name),e.userData&&(s.userData=e.userData),s}},lg=class{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=lv(),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=lv();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}};function lv(){return(typeof performance>"u"?Date:performance).now()}var ly=class{constructor(e,t,i){let r,s,a;switch(this.binding=e,this.valueSize=i,t){case"quaternion":r=this._slerp,s=this._slerpAdditive,a=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(6*i),this._workIndex=5;break;case"string":case"bool":r=this._select,s=this._select,a=this._setAdditiveIdentityOther,this.buffer=Array(5*i);break;default:r=this._lerp,s=this._lerpAdditive,a=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(5*i)}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(0===a){for(let e=0;e!==r;++e)i[s+e]=i[e];a=t}else{a+=t;let e=t/a;this._mixBufferRegion(i,s,0,e,r)}this.cumulativeWeight=a}accumulateAdditive(e){let t=this.buffer,i=this.valueSize,r=i*this._addIndex;0===this.cumulativeWeightAdditive&&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,o=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,s<1){let e=t*this._origIndex;this._mixBufferRegion(i,r,e,1-s,t)}a>0&&this._mixBufferRegionAdditive(i,r,this._addIndex*t,1,t);for(let e=t,s=t+t;e!==s;++e)if(i[e]!==i[e+t]){o.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 e=i;e!==r;++e)t[e]=t[r+e%i];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){let e=3*this.valueSize;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 r=0;r!==s;++r)e[t+r]=e[i+r]}_slerp(e,t,i,r){iv.slerpFlat(e,t,e,t,e,i,r)}_slerpAdditive(e,t,i,r,s){let a=this._workIndex*s;iv.multiplyQuaternionsFlat(e,a,e,t,e,i),iv.slerpFlat(e,t,e,t,e,a,r)}_lerp(e,t,i,r,s){let a=1-r;for(let o=0;o!==s;++o){let s=t+o;e[s]=e[s]*a+e[i+o]*r}}_lerpAdditive(e,t,i,r,s){for(let a=0;a!==s;++a){let s=t+a;e[s]=e[s]+e[i+a]*r}}},lx="\\[\\]\\.:\\/",lb=RegExp("["+lx+"]","g"),lw="[^"+lx+"]",l_="[^"+lx.replace("\\.","")+"]",lS=RegExp("^"+/((?:WC+[\/:])*)/.source.replace("WC",lw)+/(WCOD+)?/.source.replace("WCOD",l_)+/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",lw)+/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",lw)+"$"),lC=["material","materials","bones","map"],lM=class{constructor(e,t,i){let r=i||lE.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];void 0!==r&&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()}},lE=class{constructor(e,t,i){this.path=t,this.parsedPath=i||lE.parseTrackName(t),this.node=lE.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,i){return e&&e.isAnimationObjectGroup?new lE.Composite(e,t,i):new lE(e,t,i)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(lb,"")}static parseTrackName(e){let t=lS.exec(e);if(null===t)throw 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(void 0!==r&&-1!==r){let e=i.nodeName.substring(r+1);-1!==lC.indexOf(e)&&(i.nodeName=i.nodeName.substring(0,r),i.objectName=e)}if(null===i.propertyName||0===i.propertyName.length)throw Error("PropertyBinding: can not parse propertyName from trackName: "+e);return i}static findNode(e,t){if(void 0===t||""===t||"."===t||-1===t||t===e.name||t===e.uuid)return e;if(e.skeleton){let i=e.skeleton.getBoneByName(t);if(void 0!==i)return i}if(e.children){let i=function(e){for(let r=0;r<e.length;r++){let s=e[r];if(s.name===t||s.uuid===t)return s;let a=i(s.children);if(a)return a}return null},r=i(e.children);if(r)return r}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){let i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)e[t++]=i[r]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){let i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)i[r]=e[t++]}_setValue_array_setNeedsUpdate(e,t){let i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)i[r]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){let i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)i[r]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}
vendor: 5,469 bytes, line 3139
3139_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node,t=this.parsedPath,i=t.objectName,r=t.propertyName,s=t.propertyIndex;if(e||(e=lE.findNode(this.rootNode,t.nodeName)||this.rootNode,this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e)return void console.error("THREE.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.");if(i){let r=t.objectIndex;switch(i){case"materials":if(!e.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!e.material.materials)return void console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);e=e.material.materials;break;case"bones":if(!e.skeleton)return void console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);e=e.skeleton.bones;for(let t=0;t<e.length;t++)if(e[t].name===r){r=t;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!e.material.map)return void console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);e=e.material.map;break;default:if(void 0===e[i])return void console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);e=e[i]}if(void 0!==r){if(void 0===e[r])return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);e=e[r]}}let a=e[r];if(void 0===a)return void console.error("THREE.PropertyBinding: Trying to update property for track: "+t.nodeName+"."+r+" but it wasn't found.",e);let o=this.Versioning.None;this.targetObject=e,void 0!==e.needsUpdate?o=this.Versioning.NeedsUpdate:void 0!==e.matrixWorldNeedsUpdate&&(o=this.Versioning.MatrixWorldNeedsUpdate);let h=this.BindingType.Direct;if(void 0!==s){if("morphTargetInfluences"===r){if(!e.geometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(!e.geometry.morphAttributes)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);void 0!==e.morphTargetDictionary[s]&&(s=e.morphTargetDictionary[s])}h=this.BindingType.ArrayElement,this.resolvedProperty=a,this.propertyIndex=s}else void 0!==a.fromArray&&void 0!==a.toArray?(h=this.BindingType.HasFromToArray,this.resolvedProperty=a):Array.isArray(a)?(h=this.BindingType.EntireArray,this.resolvedProperty=a):this.propertyName=r;this.getValue=this.GetterByBindingType[h],this.setValue=this.SetterByBindingTypeAndVersioning[h][o]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}};lE.Composite=lM,lE.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},lE.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},lE.prototype.GetterByBindingType=[lE.prototype._getValue_direct,lE.prototype._getValue_array,lE.prototype._getValue_arrayElement,lE.prototype._getValue_toArray],lE.prototype.SetterByBindingTypeAndVersioning=[[lE.prototype._setValue_direct,lE.prototype._setValue_direct_setNeedsUpdate,lE.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[lE.prototype._setValue_array,lE.prototype._setValue_array_setNeedsUpdate,lE.prototype._setValue_array_setMatrixWorldNeedsUpdate],[lE.prototype._setValue_arrayElement,lE.prototype._setValue_arrayElement_setNeedsUpdate,lE.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[lE.prototype._setValue_fromArray,lE.prototype._setValue_fromArray_setNeedsUpdate,lE.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var lA=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,o=Array(a),h={endingStart:2400,endingEnd:2400};for(let e=0;e!==a;++e){let t=s[e].createInterpolant(null);o[e]=t,t.settings=h}this._interpolantSettings=h,this._interpolants=o,this._propertyBindings=Array(a),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=2201,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&&0!==this.timeScale&&null===this._startTime&&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}
3139fadeIn(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 i=this._clip.duration,r=e._clip.duration;e.warp(1,r/i,t),this.warp(i/r,1,t)}return this}crossFadeTo(e,t,i){return e.crossFadeFrom(this,t,i)}stopFading(){let e=this._weightInterpolant;return null!==e&&(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,o=this._timeScaleInterpolant;null===o&&(o=r._lendControlInterpolant(),this._timeScaleInterpolant=o);let h=o.parameterPositions,c=o.sampleValues;return h[0]=s,h[1]=s+i,c[0]=e/a,c[1]=t/a,this}stopWarping(){let e=this._timeScaleInterpolant;return null!==e&&(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)return void this._updateWeight(e);let s=this._startTime;if(null!==s){let r=(e-s)*i;r<0||0===i?t=0:(this._startTime=null,t=i*r)}t*=this._updateTimeScale(e);let a=this._updateTime(t),o=this._updateWeight(e);if(o>0){let e=this._interpolants,t=this._propertyBindings;if(2501===this.blendMode)for(let i=0,r=e.length;i!==r;++i)e[i].evaluate(a),t[i].accumulateAdditive(o);else for(let i=0,s=e.length;i!==s;++i)e[i].evaluate(a),t[i].accumulate(r,o)}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;let i=this._weightInterpolant;if(null!==i){let r=i.evaluate(e)[0];t*=r,e>i.parameterPositions[1]&&(this.stopFading(),0===r&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;let i=this._timeScaleInterpolant;null!==i&&(t*=i.evaluate(e)[0],e>i.parameterPositions[1]&&(this.stopWarping(),0===t?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=2202===i;if(0===e)return -1===s?r:a&&(1&s)==1?t-r:r;if(2200===i){-1===s&&(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(-1===s&&(e>=0?(s=0,this._setEndings(!0,0===this.repetitions,a)):this._setEndings(0===this.repetitions,!0,a)),r>=t||r<0){let i=Math.floor(r/t);r-=t*i,s+=Math.abs(i);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(1===o){let t=e<0;this._setEndings(t,!t,a)}else this._setEndings(!1,!1,a);this._loopCount=s,this.time=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:i})}}else this.time=r;if(a&&(1&s)==1)return t-r}return r}_setEndings(e,t,i){let r=this._interpolantSettings;i?(r.endingStart=2401,r.endingEnd=2401):(e?r.endingStart=this.zeroSlopeAtStart?2401:2400:r.endingStart=2402,t?r.endingEnd=this.zeroSlopeAtEnd?2401:2400:r.endingEnd=2402)}_scheduleFading(e,t,i){let r=this._mixer,s=r.time,a=this._weightInterpolant;null===a&&(a=r._lendControlInterpolant(),this._weightInterpolant=a);let o=a.parameterPositions,h=a.sampleValues;return o[0]=s,h[0]=t,o[1]=s+e,h[1]=i,this}},lT=new Float32Array(1),lP=class extends tk{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,o=e._interpolants,h=i.uuid,c=this._bindingsByRootAndName,d=c[h];void 0===d&&(d={},c[h]=d);for(let e=0;e!==s;++e){let s=r[e],c=s.name,u=d[c];if(void 0!==u)++u.referenceCount,a[e]=u;else{if(void 0!==(u=a[e])){null===u._cacheIndex&&(++u.referenceCount,this._addInactiveBinding(u,h,
vendor: 6,167 bytes, line 3139
3139c));continue}let r=t&&t._propertyBindings[e].binding.parsedPath;u=new ly(lE.create(i,c,r),s.ValueTypeName,s.getValueSize()),++u.referenceCount,this._addInactiveBinding(u,h,c),a[e]=u}o[e].resultBuffer=u.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(null===e._cacheIndex){let t=(e._localRoot||this._root).uuid,i=e._clip.uuid,r=this._actionsByClip[i];this._bindAction(e,r&&r.knownActions[0]),this._addInactiveAction(e,i,t)}let t=e._propertyBindings;for(let e=0,i=t.length;e!==i;++e){let i=t[e];0==i.useCount++&&(this._lendBinding(i),i.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){let t=e._propertyBindings;for(let e=0,i=t.length;e!==i;++e){let i=t[e];0==--i.useCount&&(i.restoreOriginalState(),this._takeBackBinding(i))}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 null!==t&&t<this._nActiveActions}_addInactiveAction(e,t,i){let r=this._actions,s=this._actionsByClip,a=s[t];if(void 0===a)a={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,s[t]=a;else{let t=a.knownActions;e._byClipCacheIndex=t.length,t.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,o=a[s],h=o.knownActions,c=h[h.length-1],d=e._byClipCacheIndex;c._byClipCacheIndex=d,h[d]=c,h.pop(),e._byClipCacheIndex=null;let u=o.actionByRoot,p=(e._localRoot||this._root).uuid;delete u[p],0===h.length&&delete a[s],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){let t=e._propertyBindings;for(let e=0,i=t.length;e!==i;++e){let i=t[e];0==--i.referenceCount&&this._removeInactiveBinding(i)}}_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];void 0===a&&(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,o=a[r],h=t[t.length-1],c=e._cacheIndex;h._cacheIndex=c,t[c]=h,t.pop(),delete o[s],0===Object.keys(o).length&&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 void 0===i&&((i=new oW(new Float32Array(2),new Float32Array(2),1,lT)).__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="string"==typeof e?o$.findByName(r,e):e,o=null!==a?a.uuid:e,h=this._actionsByClip[o],c=null;if(void 0===i&&(i=null!==a?a.blendMode:2500),void 0!==h){let e=h.actionByRoot[s];if(void 0!==e&&e.blendMode===i)return e;c=h.knownActions[0],null===a&&(a=c._clip)}if(null===a)return null;let d=new lA(this,a,t,i);return this._bindAction(d,c),this._addInactiveAction(d,o,s),d}existingAction(e,t){let i=t||this._root,r=i.uuid,s="string"==typeof e?o$.findByName(i,e):e,a=s?s.uuid:e,o=this._actionsByClip[a];return void 0!==o&&o.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 o=0;o!==i;++o)t[o]._update(r,e,s,a);let o=this._bindings,h=this._nActiveBindings;for(let e=0;e!==h;++e)o[e].apply(a);return this}setTime(e){this.time=0;for(let e=0;e<this._actions.length;e++)this._actions[e].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(void 0!==s){let e=s.knownActions;for(let i=0,r=e.length;i!==r;++i){let r=e[i];this._deactivateAction(r);let s=r._cacheIndex,a=t[t.length-1];r._cacheIndex=null,r._byClipCacheIndex=null,a._cacheIndex=s,t[s]=a,t.pop(),this._removeInactiveBindingsForAction(r)}delete r[i]}}uncacheRoot(e){let t=e.uuid,i=this._actionsByClip;for(let e in i){let r=i[e].actionByRoot[t];void 0!==r&&(this._deactivateAction(r),this._removeInactiveAction(r))}let r=this._bindingsByRootAndName[t];if(void 0!==r)for(let e in r){let t=r[e];t.restoreOriginalState(),this._removeInactiveBinding(t)}}uncacheAction(e,t){let i=this.existingAction(e,t);null!==i&&(this._deactivateAction(i),this._removeInactiveAction(i))}},lD=class{constructor(e){this.value=e}clone(){return new lD(void 0===this.value.clone?this.value:this.value.clone())}},lO=class{constructor(e,t,i=0,r=1/0){this.ray=new iX(e,t),this.near=i,this.far=r,this.camera=null,this.layers=new i5,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error("THREE.Raycaster: 
3139Unsupported camera type: "+t.type)}intersectObject(e,t=!0,i=[]){return lI(e,this,i,t),i.sort(lL),i}intersectObjects(e,t=!0,i=[]){for(let r=0,s=e.length;r<s;r++)lI(e[r],this,i,t);return i.sort(lL),i}};function lL(e,t){return e.distance-t.distance}function lI(e,t,i,r){if(e.layers.test(t.layers)&&e.raycast(t,i),!0===r){let r=e.children;for(let e=0,s=r.length;e<s;e++)lI(r[e],t,i,!0)}}var lR=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),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,i),this.phi=Math.acos(tU(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}},lk=new tZ,lB=class{constructor(e=new tZ(1/0,1/0),t=new tZ(-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=lk.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 lk.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)}},lz=new iy,lN=new iy,lF=class{constructor(e=new iy,t=new iy){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){lz.subVectors(e,this.start),lN.subVectors(this.end,this.start);let i=lN.dot(lN),r=lN.dot(lz)/i;return t&&(r=tU(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)}},lj=new iy,lU=class extends rh{constructor(e,t){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";let i=new rz,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 e=0,t=1;e<32;e++,t++){let i=e/32*Math.PI*2,s=t/32*Math.PI*2;r.push(Math.cos(i),Math.sin(i),1,Math.cos(s),Math.sin(s),1)}i.setAttribute("position",new rP(r,3));let s=new nB({fog:!1,toneMapped:!1});this.cone=new nG(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),lj.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(lj),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}},lV=class extends rK{constructor(e,t,i){super(new oL(t,4,2),new rS({wireframe:!0,fog:!1,toneMapped:!1})),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),void 0!==this.color?this.material.color.set(this.color):this.material.color.copy(this.light.color)}},lW=new iy,lH=new iy,lG=new iy,lq=class extends rh{constructor(e,t,i){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=i,this.type="DirectionalLightHelper",void 0===t&&(t=1);let r=new rz;r.setAttribute("position",new rP([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));let s=new nB({fog:!1,toneMapped:!1});this.lightPlane=new nV(r,s),this.add(this.lightPlane),(r=new rz).setAttribute("position",new rP([0,0,0,0,0,1],3)),this.targetLine=new nV(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),lW.setFromMatrixPosition(this.light.matrixWorld),lH.setFromMatrixPosition(this.light.target.matrixWorld),lG.subVectors(lH,lW),this.lightPlane.lookAt(lH),void 0!==this.color?(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(lH),this.targetLine.scale.z
vendor: 6,012 bytes, line 3139
3139=lG.length()}},lX=new iy,lY=new r6,lQ=class extends nG{constructor(e){let t=new rz,i=new nB({color:0xffffff,vertexColors:!0,toneMapped:!1}),r=[],s=[],a={};function o(e,t){h(e),h(t)}function h(e){r.push(0,0,0),s.push(0,0,0),void 0===a[e]&&(a[e]=[]),a[e].push(r.length/3-1)}o("n1","n2"),o("n2","n4"),o("n4","n3"),o("n3","n1"),o("f1","f2"),o("f2","f4"),o("f4","f3"),o("f3","f1"),o("n1","f1"),o("n2","f2"),o("n3","f3"),o("n4","f4"),o("p","n1"),o("p","n2"),o("p","n3"),o("p","n4"),o("u1","u2"),o("u2","u3"),o("u3","u1"),o("c","t"),o("p","c"),o("cn1","cn2"),o("cn3","cn4"),o("cf1","cf2"),o("cf3","cf4"),t.setAttribute("position",new rP(r,3)),t.setAttribute("color",new rP(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 c=new ir(0xffaa00),d=new ir(0xff0000),u=new ir(43775),p=new ir(0xffffff),f=new ir(3355443);this.setColors(c,d,u,p,f)}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;lY.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),lZ("c",t,e,lY,0,0,-1),lZ("t",t,e,lY,0,0,1),lZ("n1",t,e,lY,-1,-1,-1),lZ("n2",t,e,lY,1,-1,-1),lZ("n3",t,e,lY,-1,1,-1),lZ("n4",t,e,lY,1,1,-1),lZ("f1",t,e,lY,-1,-1,1),lZ("f2",t,e,lY,1,-1,1),lZ("f3",t,e,lY,-1,1,1),lZ("f4",t,e,lY,1,1,1),lZ("u1",t,e,lY,.7,1.1,-1),lZ("u2",t,e,lY,-.7,1.1,-1),lZ("u3",t,e,lY,0,2,-1),lZ("cf1",t,e,lY,-1,0,1),lZ("cf2",t,e,lY,1,0,1),lZ("cf3",t,e,lY,0,-1,1),lZ("cf4",t,e,lY,0,1,1),lZ("cn1",t,e,lY,-1,0,-1),lZ("cn2",t,e,lY,1,0,-1),lZ("cn3",t,e,lY,0,-1,-1),lZ("cn4",t,e,lY,0,1,-1),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}};function lZ(e,t,i,r,s,a,o){lX.set(s,a,o).unproject(r);let h=t[e];if(void 0!==h){let e=i.getAttribute("position");for(let t=0,i=h.length;t<i;t++)e.setXYZ(h[t],lX.x,lX.y,lX.z)}}var lK=class extends nG{constructor(e,t=0xffff00){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=new rz;r.setIndex(new rE(i,1)),r.setAttribute("position",new rP([1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],3)),super(r,new nB({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()}},lJ=class extends nG{constructor(e=1){let t=new rz;t.setAttribute("position",new rP([0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],3)),t.setAttribute("color",new rP([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3)),super(t,new nB({vertexColors:!0,toneMapped:!1})),this.type="AxesHelper"}setColors(e,t,i){let r=new ir,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()}},l$=function(){let e=new ArrayBuffer(4),t=new Float32Array(e),i=new Uint32Array(e),r=new Uint32Array(512),s=new Uint32Array(512);for(let e=0;e<256;++e){let t=e-127;t<-27?(r[e]=0,r[256|e]=32768,s[e]=24,s[256|e]=24):t<-14?(r[e]=1024>>-t-14,r[256|e]=1024>>-t-14|32768,s[e]=-t-1,s[256|e]=-t-1):t<=15?(r[e]=t+15<<10,r[256|e]=t+15<<10|32768,s[e]=13,s[256|e]=13):t<128?(r[e]=31744,r[256|e]=64512,s[e]=24,s[256|e]=24):(r[e]=31744,r[256|e]=64512,s[e]=13,s[256|e]=13)}let a=new Uint32Array(2048),o=new Uint32Array(64),h=new Uint32Array(64);for(let e=1;e<1024;++e){let t=e<<13,i=0;for(;(8388608&t)==0;)t<<=1,i-=8388608;t&=-8388609,i+=0x38800000,a[e]=t|i}for(let e=1024;e<2048;++e)a[e]=0x38000000+(e-1024<<13);for(let e=1;e<31;++e)o[e]=e<<23;o[31]=0x47800000,o[32]=0x80000000;for(let e=33;e<63;++e)o[e]=0x80000000+(e-32<<23);o[63]=0xc7800000;for(let e=1;e<64;++e)32!==e&&(h[e]=1024);return{floatView:t,uint32View:i,baseTable:r,shiftTable:s,mantissaTable:a,exponentTable:o,offsetTable:h}}(),l0=Object.freeze({__proto__:null,fromHalfFloat:function(e){let t=e>>10;return l$.uint32View[0]=l$.mantissaTable[l$.offsetTable[t]+(1023&e)]+l$.exponentTable[t],l$.floatView[0]},toHalfFloat:function(e){Math.abs(e)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),e=tU(e,-65504,65504),l$.floatView[0]=e;let t=l$.uint32View[0],i=t>>23&511;return l$.baseTable[i]+((8388607&t)>>l$.shiftTable[i])}});"u">typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"149"}})),"u">typeof window&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="
3139149");var l1=Symbol("target"),l2=Symbol("unsubscribe");function l3(e){return e instanceof Date||e instanceof Set||e instanceof Map||e instanceof WeakSet||e instanceof WeakMap||ArrayBuffer.isView(e)}var l4=Array.isArray;function l5(e){return"symbol"==typeof e}var l6={after:(e,t)=>l4(e)?e.slice(t.length):""===t?e:e.slice(t.length+1),concat:(e,t)=>l4(e)?(e=[...e],t&&e.push(t),e):t&&void 0!==t.toString?(""!==e&&(e+="."),l5(t)?e+t.toString():e+t):e,initial:e=>{if(l4(e))return e.slice(0,-1);if(""===e)return e;let t=e.lastIndexOf(".");return -1===t?"":e.slice(0,t)},last:e=>{if(l4(e))return e[e.length-1]||"";if(""===e)return e;let t=e.lastIndexOf(".");return -1===t?e:e.slice(t+1)},walk:(e,t)=>{if(l4(e))for(let i of e)t(i);else if(""!==e){let i=0,r=e.indexOf(".");if(-1===r)t(e);else for(;i<e.length;)-1===r&&(r=e.length),t(e.slice(i,r)),i=r+1,r=e.indexOf(".",i)}},get(e,t){return this.walk(t,t=>{e&&(e=e[t])}),e}};function l8(e,t,i){return e.isUnsubscribed||t.ignoreSymbols&&l5(i)||t.ignoreUnderscores&&"_"===i.charAt(0)||"ignoreKeys"in t&&t.ignoreKeys.includes(i)}var l9=class{constructor(e){this._equals=e,this._proxyCache=new WeakMap,this._pathCache=new WeakMap,this.isUnsubscribed=!1}_getDescriptorCache(){return void 0===this._descriptorCache&&(this._descriptorCache=new WeakMap),this._descriptorCache}_getProperties(e){let t=this._getDescriptorCache(),i=t.get(e);return void 0===i&&(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 void 0===r&&(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 o=this._proxyCache.get(a);return void 0===o&&(o=void 0===s?new Proxy(e,i):e,this._proxyCache.set(a,o)),o}getPath(e){return this.isUnsubscribed?void 0:this._pathCache.get(e)}isDetached(e,t){return!Object.is(e,l6.get(t,this.getPath(e)))}defineProperty(e,t,i){return!!Reflect.defineProperty(e,t,i)&&(this.isUnsubscribed||(this._getProperties(e)[t]=i),!0)}setProperty(e,t,i,r,s){if(!this._equals(s,i)||!(t in e)){let s=this._getOwnPropertyDescriptor(e,t);return void 0!==s&&"set"in s?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 void 0!==e&&void 0!==r&&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 void 0!==i&&!0!==i.configurable&&!0!==i.writable}unsubscribe(){this._descriptorCache=null,this._pathCache=null,this._proxyCache=null,this.isUnsubscribed=!0}};function l7(e){return"[object Object]"===toString.call(e)}function he(){return!0}function ht(e,t){return e.length!==t.length||e.some((e,i)=>t[i]!==e)}var hi=new Set(["hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]),hr=new Set(["concat","includes","indexOf","join","keys","lastIndexOf"]),hs={push:he,pop:he,shift:he,unshift:he,copyWithin:ht,reverse:ht,sort:ht,splice:ht,flat:ht,fill:ht},ha=new Set([...hi,...hr,...Object.keys(hs)]);function hn(e,t){if(e.size!==t.size)return!0;for(let i of e)if(!t.has(i))return!0;return!1}var ho=["keys","values","entries"],hl=new Set(["has","toString"]),hh={add:hn,clear:hn,delete:hn,forEach:hn},hc=new Set([...hl,...Object.keys(hh),...ho]);function hd(e,t){let i;if(e.size!==t.size)return!0;for(let[r,s]of e)if((i=t.get(r))!==s||void 0===i&&!t.has(r))return!0;return!1}var hu=new Set([...hl,"get"]),hp={set:hd,clear:hd,delete:hd,forEach:hd},hf=new Set([...hu,...Object.keys(hp),...ho]),hm=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=void 0===t?e:this._shallowClone(e)}static isHandledMethod(e){return hi.has(e)}_shallowClone(e){let t=e;if(l7(e))t={...e};else if(l4(e))t=[...e];else if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set([...e].map(e=>this._shallowClone(e)));else if(e instanceof Map)for(let[i,r]of(t=new Map,e.entries()))t.set(i,this._shallowClone(r));return this._clonedCache.add(t),t}preferredThisArg(e,t,i,r){return e?(l4(r)?this._onIsChanged=hs[t]:r instanceof Set?this._onIsChanged=hh[t]:r instanceof Map&&(this._onIsChanged=hp[t]),r):i}update(e,t,i){let r=l6.after(e,this._path);if("length"!==t){let e=this.clone;l6.walk(r,t=>{e&&e[t]&&(this._clonedCache.has(e[t])||(e[t]=this._shallowClone(e[t])),e=e[t])}),this._hasOnValidate&&this._changes.push({path:r,property:t,previous:i}),e&&e[t]&&(e[t]=i)}this._isChanged=!0}undo(e){let t;for(let i=this._changes.length-1;-1!==i;i--)t=this._changes[i],l6.get(e,t.path)[t.property]=t.previous}isChanged(e){return void 0===this._onIsChanged?this._isChanged:this._onIsChanged(this.clone,e)}},hg=class extends hm{static isHandledMethod(e){return ha.has(e)}},hv=class extends hm{undo(e){e.setTime(this.clone.getTime())}isChanged(e,t){return!t(this.clone.valueOf(),e.valueOf())}},hy=class extends hm{static isHandledMethod(e){return hc.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)}},hx=class extends hm{static isHandledMethod(e){return hf.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)}},hb=class extends hm{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)}},hw=class extends hm{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)}},h_=class{constructor(e){this._stack=[],this._hasOnValidate=e}static isHandledType(e){return l7(e)||l4(e)||l3(e)}static isHandledMethod(e,t){return l7(e)?hm.isHandledMethod(t):l4(e)?hg.isHandledMethod(t):e instanceof Set?hy.isHandledMethod(t):e instanceof Map?hx.isH
3139andledMethod(t):l3(e)}get isCloning(){return this._stack.length>0}start(e,t,i){let r=hm;l4(e)?r=hg:e instanceof Date?r=hv:e instanceof Set?r=hy:e instanceof Map?r=hx:e instanceof WeakSet?r=hb:e instanceof WeakMap&&(r=hw),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=h_.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){void 0!==this._previousClone&&this._previousClone.undo(e)}stop(){return this._previousClone=this._stack.pop(),this._previousClone.clone}},hS={equals:Object.is,isShallow:!1,pathAsArray:!1,ignoreSymbols:!1,ignoreUnderscores:!1,ignoreDetached:!1,details:!1},hC=(e,t,i={})=>{i={...hS,...i};let r=Symbol("ProxyTarget"),{equals:s,isShallow:a,ignoreDetached:o,details:h}=i,c=new l9(s),d="function"==typeof i.onValidate,u=new h_(d),p=(e,t,r,s,a)=>!d||u.isCloning||!0===i.onValidate(l6.concat(c.getPath(e),t),r,s,a),f=(t,r,s,a)=>{l8(c,i,r)||o&&c.isDetached(t,e)||m(c.getPath(t),r,s,a)},m=(e,i,r,s,a)=>{u.isCloning?u.update(e,i,s):t(l6.concat(e,i),r,s,a)},g=e=>e&&(e[r]||e),v=(t,s,h,d)=>("object"==typeof t?null===t:"function"!=typeof t)||t instanceof RegExp||"constructor"===h||a&&!h_.isHandledMethod(s,h)||l8(c,i,h)||c.isGetInvariant(s,h)||o&&c.isDetached(s,e)?t:(void 0===d&&(d=c.getPath(s)),c.getProxy(t,l6.concat(d,h),y,r)),y={get(e,t,i){if(l5(t)){if(t===r||t===l1)return e;if(t===l2&&!c.isUnsubscribed&&0===c.getPath(e).length)return c.unsubscribe(),e}return v(l3(e)?Reflect.get(e,t):Reflect.get(e,t,i),e,t)},set(e,t,i,a){i=g(i);let o=e[r]||e,h=o[t];if(s(h,i)&&t in e)return!0;let d=p(e,t,i,h);return d&&c.setProperty(o,t,i,a,h)?(f(e,t,e[t],h),!0):!d},defineProperty(e,t,i){if(!c.isSameDescriptor(i,e,t)){let r=e[t];p(e,t,i.value,r)&&c.defineProperty(e,t,i,r)&&f(e,t,i.value,r)}return!0},deleteProperty(e,t){if(!Reflect.has(e,t))return!0;let i=Reflect.get(e,t),r=p(e,t,void 0,i);return r&&c.deleteProperty(e,t,i)?(f(e,t,void 0,i),!0):!r},apply(t,i,a){let o=i[r]||i;if(c.isUnsubscribed)return Reflect.apply(t,o,a);if((!1===h||!0!==h&&!h.includes(t.name))&&h_.isHandledType(o)){var d;let r=l6.initial(c.getPath(t)),h=h_.isHandledMethod(o,t.name);u.start(o,r,a);let f=Reflect.apply(t,u.preferredThisArg(t,i,o),h?a.map(e=>g(e)):a),x=u.isChanged(o,s),b=u.stop();if(h_.isHandledType(f)&&h&&(i instanceof Map&&"get"===t.name&&(r=l6.concat(r,a[0])),f=c.getProxy(f,r,y)),x){let i={name:t.name,args:a,result:f},s=u.isCloning?l6.initial(r):r,h=u.isCloning?l6.last(r):"";p(l6.get(e,s),h,o,b,i)?m(s,h,o,b,i):u.undo(o)}return(i instanceof Map||i instanceof Set)&&"object"==typeof(d=f)&&"function"==typeof d.next?function(e,t,i,r,s){let a=e.next;if("entries"===t.name)e.next=function(){let e=a.call(this);return!1===e.done&&(e.value[0]=s(e.value[0],t,e.value[0],r),e.value[1]=s(e.value[1],t,e.value[0],r)),e};else if("values"===t.name){let o=i[l1].keys();e.next=function(){let e=a.call(this);return!1===e.done&&(e.value=s(e.value,t,o.next().value,r)),e}}else e.next=function(){let e=a.call(this);return!1===e.done&&(e.value=s(e.value,t,e.value,r)),e};return e}(f,t,i,r,v):f}return Reflect.apply(t,i,a)}},x=c.getProxy(e,i.pathAsArray?[]:"",y);return t=t.bind(x),d&&(i.onValidate=i.onValidate.bind(x)),x};hC.target=e=>e&&e[l1]||e,hC.unsubscribe=e=>e[l2]||e;var hM=e.g&&e.g.Object===Object&&e.g,hE="object"==typeof self&&self&&self.Object===Object&&self,hA=hM||hE||Function("return this")(),hT=hA.Symbol,hP=Object.prototype,hD=hP.hasOwnProperty,hO=hP.toString,hL=hT?hT.toStringTag:void 0,hI=function(e){var t=hD.call(e,hL),i=e[hL];try{e[hL]=void 0;var r=!0}catch{}var s=hO.call(e);return r&&(t?e[hL]=i:delete e[hL]),s},hR=Object.prototype.toString,hk=hT?hT.toStringTag:void 0,hB=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":hk&&hk in Object(e)?hI(e):hR.call(e)},hz=function(e){return null!=e&&"object"==typeof e},hN=function(e){return"symbol"==typeof e||hz(e)&&"[object Symbol]"==hB(e)},hF=function(e,t){for(var i=-1,r=null==e?0:e.length,s=Array(r);++i<r;)s[i]=t(e[i],i,e);return s},hj=Array.isArray,hU=1/0,hV=hT?hT.prototype:void 0,hW=hV?hV.toString:void 0,hH=function e(t){if("string"==typeof t)return t;if(hj(t))return hF(t,e)+"";if(hN(t))return hW?hW.call(t):"";var i=t+"";return"0"==i&&1/t==-hU?"-0":i},hG=/\s/,hq=function(e){for(var t=e.length;t--&&hG.test(e.charAt(t)););return t},hX=/^\s+/,hY=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},hQ=0/0,hZ=/^[-+]0x[0-9a-f]+$/i,hK=/^0b[01]+$/i,hJ=/^0o[0-7]+$/i,h$=parseInt,h0=function(e){if("number"==typeof e)return e;if(hN(e))return hQ;if(hY(e)){var t,i="function"==typeof e.valueOf?e.valueOf():e;e=hY(i)?i+"":i}if("string"!=typeof e)return 0===e?e:+e;e=(t=e)&&t.slice(0,hq(t)+1).replace(hX,"");var r=hK.test(e);return r||hJ.test(e)?h$(e.slice(2),r?2:8):hZ.test(e)?hQ:+e},h1=function(e){return e},h2=function(e){if(!hY(e))return!1;var t=hB(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}
3139,h3=hA["__core-js_shared__"],h4=(pd=/[^.]+$/.exec(h3&&h3.keys&&h3.keys.IE_PROTO||""))?"Symbol(src)_1."+pd:"",h5=Function.prototype.toString,h6=function(e){if(null!=e){try{return h5.call(e)}catch{}try{return e+""}catch{}}return""},h8=/^\[object .+?Constructor\]$/,h9=Object.prototype,h7=Function.prototype.toString,ce=h9.hasOwnProperty,ct=RegExp("^"+h7.call(ce).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ci=function(e){return!!hY(e)&&(!h4||!(h4 in e))&&(h2(e)?ct:h8).test(h6(e))},cr=function(e,t){var i=e?.[t];return ci(i)?i:void 0},cs=cr(hA,"WeakMap"),ca=Object.create,cn=function(){function e(){}return function(t){if(!hY(t))return{};if(ca)return ca(t);e.prototype=t;var i=new e;return e.prototype=void 0,i}}(),co=function(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)},cl=function(e,t){var i=-1,r=e.length;for(t||(t=Array(r));++i<r;)t[i]=e[i];return t},ch=Date.now,cc=function(){try{var e=cr(Object,"defineProperty");return e({},"",{}),e}catch{}}(),cd=(pu=cc?function(e,t){return cc(e,"toString",{configurable:!0,enumerable:!1,value:function(){return t},writable:!0})}:h1,pp=0,pf=0,function(){var e=ch(),t=16-(e-pf);if(pf=e,t>0){if(++pp>=800)return arguments[0]}else pp=0;return pu.apply(void 0,arguments)}),cu=function(e,t){for(var i=-1,r=null==e?0:e.length;++i<r&&!1!==t(e[i],i,e););return e},cp=function(e,t,i,r){for(var s=e.length,a=i+(r?1:-1);r?a--:++a<s;)if(t(e[a],a,e))return a;return -1},cf=function(e){return e!=e},cm=function(e,t,i){for(var r=i-1,s=e.length;++r<s;)if(e[r]===t)return r;return -1},cg=/^(?:0|[1-9]\d*)$/,cv=function(e,t){var i=typeof e;return!!(t=t??0x1fffffffffffff)&&("number"==i||"symbol"!=i&&cg.test(e))&&e>-1&&e%1==0&&e<t},cy=function(e,t,i){"__proto__"==t&&cc?cc(e,t,{configurable:!0,enumerable:!0,value:i,writable:!0}):e[t]=i},cx=function(e,t){return e===t||e!=e&&t!=t},cb=Object.prototype.hasOwnProperty,cw=function(e,t,i){var r=e[t];cb.call(e,t)&&cx(r,i)&&(void 0!==i||t in e)||cy(e,t,i)},c_=function(e,t,i,r){var s=!i;i||(i={});for(var a=-1,o=t.length;++a<o;){var h=t[a],c=r?r(i[h],e[h],h,i,e):void 0;void 0===c&&(c=e[h]),s?cy(i,h,c):cw(i,h,c)}return i},cS=Math.max,cC=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=0x1fffffffffffff},cM=function(e){return null!=e&&cC(e.length)&&!h2(e)},cE=Object.prototype,cA=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||cE)},cT=function(e,t){for(var i=-1,r=Array(e);++i<e;)r[i]=t(i);return r},cP=function(e){return hz(e)&&"[object Arguments]"==hB(e)},cD=Object.prototype,cO=cD.hasOwnProperty,cL=cD.propertyIsEnumerable,cI=cP(function(){return arguments}())?cP:function(e){return hz(e)&&cO.call(e,"callee")&&!cL.call(e,"callee")},cR=function(){return!1},ck={};ck["[object Float32Array]"]=ck["[object Float64Array]"]=ck["[object Int8Array]"]=ck["[object Int16Array]"]=ck["[object Int32Array]"]=ck["[object Uint8Array]"]=ck["[object Uint8ClampedArray]"]=ck["[object Uint16Array]"]=ck["[object Uint32Array]"]=!0,ck["[object Arguments]"]=ck["[object Array]"]=ck["[object ArrayBuffer]"]=ck["[object Boolean]"]=ck["[object DataView]"]=ck["[object Date]"]=ck["[object Error]"]=ck["[object Function]"]=ck["[object Map]"]=ck["[object Number]"]=ck["[object Object]"]=ck["[object RegExp]"]=ck["[object Set]"]=ck["[object String]"]=ck["[object WeakMap]"]=!1;var cB=function(e){return function(t){return e(t)}},cz=function(){try{return!1}catch{}}(),cN=cz&&cz.isTypedArray,cF=cN?cB(cN):function(e){return hz(e)&&cC(e.length)&&!!ck[hB(e)]},cj=Object.prototype.hasOwnProperty,cU=function(e,t){var i=hj(e),r=!i&&cI(e),s=!i&&!r&&cR(e),a=!i&&!r&&!s&&cF(e),o=i||r||s||a,h=o?cT(e.length,String):[],c=h.length;for(var d in e)(t||cj.call(e,d))&&!(o&&("length"==d||s&&("offset"==d||"parent"==d)||a&&("buffer"==d||"byteLength"==d||"byteOffset"==d)||cv(d,c)))&&h.push(d);return h},cV=function(e,t){return function(i){return e(t(i))}},cW=cV(Object.keys,Object),cH=Object.prototype.hasOwnProperty,cG=function(e){if(!cA(e))return cW(e);var t=[];for(var i in Object(e))cH.call(e,i)&&"constructor"!=i&&t.push(i);return t},cq=function(e){return cM(e)?cU(e):cG(e)},cX=function(e){var t=[];if(null!=e)for(var i in Object(e))t.push(i);return t},cY=Object.prototype.hasOwnProperty,cQ=function(e){if(!hY(e))return cX(e);var t=cA(e),i=[];for(var r in e)"constructor"==r&&(t||!cY.call(e,r))||i.push(r);return i},cZ=function(e){return cM(e)?cU(e,!0):cQ(e)},cK=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,cJ=/^\w*$/,c$=function(e,t){if(hj(e))return!1;var i=typeof e;return!!("number"==i||"symbol"==i||"boolean"==i||null==e||hN(e))||cJ.test(e)||!cK.test(e)||null!=t&&e in Object(t)},c0=cr(Object,"create"),c1=Object.prototype.hasOwnProperty,c2=Object.prototype.hasOwnProperty;function c3(e){var t=-1,i=null==e?0:e.length;for(this.clear();++t<i;){var r=e[t];this.set(r[0],r[1])}}c3.prototype.clear=function(){this.__data__=c0?c0(null):{},this.size=0},c3.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=!!t,t},c3.prototype.get=function(e){var t=this.__data__;if(c0){var i=t[e];return"__lodash_hash_undefined__"===i?void 0:i}return c1.call(t,e)?t[e]:void 0},c3.prototype.has=function(e){var t=this.__data__;return c0?void 0!==t[e]:c2.call(t,e)},c3.prototype.set=function(e,t){var i=this.__data__;return this.size+=+!this.has(e),i[e]=c0&&void 0===t?"__lodash_hash_undefined__":t,this};var c4=function(e,t){for(var i=e.length;i--;)if(cx(e[i][0],t))return i;return -1},c5=Array.prototype.splice;function c6(e){var t=-1,i=null==e?0:e.length;for(this.clear();++t<i;){var r=e[t];this.set(r[0],r[1])}}c6.prototype.clear=function(){this.__data__=[],this.size=0},c6.prototype.delete=function(e){var t=this.__data__,i=c4(t,e);return!(i<0)&&(i==t.length-1?t.pop():c5.call(t,i,1),--this.size,!0)},c6.prototype.get=function(e){var t=this.__data__,i=c4(t,e);return i<0?void 0:t[i][1]},c6.prototype.has=function(e){return c4(this.__data__,e)>-1},c6.prototype.set=function(e,t){var i=this.__data__,r=c4(i,e);return r<0?(++this.size,i.push([e,t])):i[r][1]=t,this};var c8=cr(hA,"Map"),c9=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}
3139,c7=function(e,t){var i=e.__data__;return c9(t)?i["string"==typeof t?"string":"hash"]:i.map};function de(e){var t=-1,i=null==e?0:e.length;for(this.clear();++t<i;){var r=e[t];this.set(r[0],r[1])}}function dt(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw TypeError("Expected a function");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 o=e.apply(this,r);return i.cache=a.set(s,o)||a,o};return i.cache=new(dt.Cache||de),i}de.prototype.clear=function(){this.size=0,this.__data__={hash:new c3,map:new(c8||c6),string:new c3}},de.prototype.delete=function(e){var t=c7(this,e).delete(e);return this.size-=!!t,t},de.prototype.get=function(e){return c7(this,e).get(e)},de.prototype.has=function(e){return c7(this,e).has(e)},de.prototype.set=function(e,t){var i=c7(this,e),r=i.size;return i.set(e,t),this.size+=+(i.size!=r),this},dt.Cache=de;var di=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,dr=/\\(\\)?/g,ds=(pg=(pm=dt(function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(di,function(e,i,r,s){t.push(r?s.replace(dr,"$1"):i||e)}),t},function(e){return 500===pg.size&&pg.clear(),e})).cache,pm),da=function(e){return null==e?"":hH(e)},dn=function(e,t){return hj(e)?e:c$(e,t)?[e]:ds(da(e))},dl=1/0,dh=function(e){if("string"==typeof e||hN(e))return e;var t=e+"";return"0"==t&&1/e==-dl?"-0":t},dc=function(e,t){t=dn(t,e);for(var i=0,r=t.length;null!=e&&i<r;)e=e[dh(t[i++])];return i&&i==r?e:void 0},dd=function(e,t){for(var i=-1,r=t.length,s=e.length;++i<r;)e[s+i]=t[i];return e},du=hT?hT.isConcatSpreadable:void 0,dp=function(e){return hj(e)||cI(e)||!!(du&&e&&e[du])},df=function e(t,i,r,s,a){var o=-1,h=t.length;for(r||(r=dp),a||(a=[]);++o<h;){var c=t[o];i>0&&r(c)?i>1?e(c,i-1,r,s,a):dd(a,c):s||(a[a.length]=c)}return a},dm=function(e){return(null==e?0:e.length)?df(e,1):[]},dg=function(e){var t;return cd((t=cS((t=void 0,e.length-1),0),function(){for(var i=arguments,r=-1,s=cS(i.length-t,0),a=Array(s);++r<s;)a[r]=i[t+r];r=-1;for(var o=Array(t+1);++r<t;)o[r]=i[r];return o[t]=dm(a),co(e,this,o)}),e+"")},dv=cV(Object.getPrototypeOf,Object),dy=Object.prototype,dx=Function.prototype.toString,db=dy.hasOwnProperty,dw=dx.call(Object),d_=function(e){if(!hz(e)||"[object Object]"!=hB(e))return!1;var t=dv(e);if(null===t)return!0;var i=db.call(t,"constructor")&&t.constructor;return"function"==typeof i&&i instanceof i&&dx.call(i)==dw},dS=function(e,t,i){var r=-1,s=e.length;t<0&&(t=-t>s?0:s+t),(i=i>s?s: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},dC=function(e,t,i){var r=e.length;return i=void 0===i?r:i,!t&&i>=r?e:dS(e,t,i)},dM=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]"),dE="\\ud800-\\udfff",dA="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",dT="\\ud83c[\\udffb-\\udfff]",dP="[^"+dE+"]",dD="(?:\\ud83c[\\udde6-\\uddff]){2}",dO="[\\ud800-\\udbff][\\udc00-\\udfff]",dL="(?:"+dA+"|"+dT+")?",dI="[\\ufe0e\\ufe0f]?",dR="(?:\\u200d(?:"+[dP,dD,dO].join("|")+")"+dI+dL+")*",dk=RegExp(dT+"(?="+dT+")|"+("(?:"+[dP+dA+"?",dA,dD,dO,"["+dE+"]"].join("|"))+")"+(dI+dL+dR),"g"),dB=function(e){return dM.test(e)?e.match(dk)||[]:e.split("")};function dz(e){var t=this.__data__=new c6(e);this.size=t.size}dz.prototype.clear=function(){this.__data__=new c6,this.size=0},dz.prototype.delete=function(e){var t=this.__data__,i=t.delete(e);return this.size=t.size,i},dz.prototype.get=function(e){return this.__data__.get(e)},dz.prototype.has=function(e){return this.__data__.has(e)},dz.prototype.set=function(e,t){var i=this.__data__;if(i instanceof c6){var r=i.__data__;if(!c8||r.length<199)return r.push([e,t]),this.size=++i.size,this;i=this.__data__=new de(r)}return i.set(e,t),this.size=i.size,this};var dN=function(e,t){for(var i=-1,r=null==e?0:e.length,s=0,a=[];++i<r;){var o=e[i];t(o,i,e)&&(a[s++]=o)}return a},dF=function(){return[]},dj=Object.prototype.propertyIsEnumerable,dU=Object.getOwnPropertySymbols,dV=dU?function(e){return null==e?[]:dN(dU(e=Object(e)),function(t){return dj.call(e,t)})}:dF,dW=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)dd(t,dV(e)),e=dv(e);return t}:dF,dH=function(e,t,i){var r=t(e);return hj(e)?r:dd(r,i(e))},dG=function(e){return dH(e,cq,dV)},dq=function(e){return dH(e,cZ,dW)},dX=cr(hA,"DataView"),dY=cr(hA,"Promise"),dQ=cr(hA,"Set"),dZ="[object Map]",dK="[object Promise]",dJ="[object Set]",d$="[object WeakMap]",d0="[object DataView]",d1=h6(dX),d2=h6(c8),d3=h6(dY),d4=h6(dQ),d5=h6(cs),d6=hB;(dX&&d6(new dX(new ArrayBuffer(1)))!=d0||c8&&d6(new c8)!=dZ||dY&&d6(dY.resolve())!=dK||dQ&&d6(new dQ)!=dJ||cs&&d6(new cs)!=d$)&&(d6=function(e){var t=hB(e),i="[object Object]"==t?e.constructor:void 0,r=i?h6(i):"";if(r)switch(r){case d1:return d0;case d2:return dZ;case d3:return dK;case d4:return dJ;case d5:return d$}return t});var d8=d6,d9=Object.prototype.hasOwnProperty,d7=function(e){var t=e.length,i=new e.constructor(t);return t&&"string"==typeof e[0]&&d9.call(e,"index")&&(i.index=e.index,i.input=e.input),i},ue=hA.Uint8Array,ut=function(e){var t=new e.constructor(e.byteLength);return new ue(t).set(new ue(e)),t},ui=function(e,t){var i=t?ut(e.buffer):e.buffer;return new e.constructor(i,e.byteOffset,e.byteLength)}
3139,ur=/\w*$/,us=function(e){var t=new e.constructor(e.source,ur.exec(e));return t.lastIndex=e.lastIndex,t},ua=hT?hT.prototype:void 0,un=ua?ua.valueOf:void 0,uo=function(e,t){var i=t?ut(e.buffer):e.buffer;return new e.constructor(i,e.byteOffset,e.length)},ul=function(e,t,i){var r=e.constructor;switch(t){case"[object ArrayBuffer]":return ut(e);case"[object Boolean]":case"[object Date]":return new r(+e);case"[object DataView]":return ui(e,i);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return uo(e,i);case"[object Map]":case"[object Set]":return new r;case"[object Number]":case"[object String]":return new r(e);case"[object RegExp]":return us(e);case"[object Symbol]":return un?Object(un.call(e)):{}}},uh=cz&&cz.isMap,uc=uh?cB(uh):function(e){return hz(e)&&"[object Map]"==d8(e)},ud=cz&&cz.isSet,uu=ud?cB(ud):function(e){return hz(e)&&"[object Set]"==d8(e)},up="[object Arguments]",uf="[object Function]",um="[object Object]",ug={};ug[up]=ug["[object Array]"]=ug["[object ArrayBuffer]"]=ug["[object DataView]"]=ug["[object Boolean]"]=ug["[object Date]"]=ug["[object Float32Array]"]=ug["[object Float64Array]"]=ug["[object Int8Array]"]=ug["[object Int16Array]"]=ug["[object Int32Array]"]=ug["[object Map]"]=ug["[object Number]"]=ug[um]=ug["[object RegExp]"]=ug["[object Set]"]=ug["[object String]"]=ug["[object Symbol]"]=ug["[object Uint8Array]"]=ug["[object Uint8ClampedArray]"]=ug["[object Uint16Array]"]=ug["[object Uint32Array]"]=!0,ug["[object Error]"]=ug[uf]=ug["[object WeakMap]"]=!1;var uv=function e(t,i,r,s,a,o){var h,c=1&i,d=2&i,u=4&i;if(r&&(h=a?r(t,s,a,o):r(t)),void 0!==h)return h;if(!hY(t))return t;var p=hj(t);if(p){if(h=d7(t),!c)return cl(t,h)}else{var f,m,g,v,y,x=d8(t),b=x==uf||"[object GeneratorFunction]"==x;if(cR(t),x==um||x==up||b&&!a){if(h=d||b||"function"!=typeof(f=t).constructor||cA(f)?{}:cn(dv(f)),!c)return d?(g=(m=h)&&c_(t,cZ(t),m),c_(t,dW(t),g)):(y=(v=h)&&c_(t,cq(t),v),c_(t,dV(t),y))}else{if(!ug[x])return a?t:{};h=ul(t,x,c)}}o||(o=new dz);var w=o.get(t);if(w)return w;o.set(t,h),uu(t)?t.forEach(function(s){h.add(e(s,i,r,s,t,o))}):uc(t)&&t.forEach(function(s,a){h.set(a,e(s,i,r,a,t,o))});var _=u?d?dq:dG:d?cZ:cq,S=p?void 0:_(t);return cu(S||t,function(s,a){S&&(s=t[a=s]),cw(h,a,e(s,i,r,a,t,o))}),h},uy=function(e){return uv(e,5)};function ux(e){var t=-1,i=null==e?0:e.length;for(this.__data__=new de;++t<i;)this.add(e[t])}ux.prototype.add=ux.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},ux.prototype.has=function(e){return this.__data__.has(e)};var ub=function(e,t){for(var i=-1,r=null==e?0:e.length;++i<r;)if(t(e[i],i,e))return!0;return!1},uw=function(e,t,i,r,s,a){var o=1&i,h=e.length,c=t.length;if(h!=c&&!(o&&c>h))return!1;var d=a.get(e),u=a.get(t);if(d&&u)return d==t&&u==e;var p=-1,f=!0,m=2&i?new ux:void 0;for(a.set(e,t),a.set(t,e);++p<h;){var g=e[p],v=t[p];if(r)var y=o?r(v,g,p,t,e,a):r(g,v,p,e,t,a);if(void 0!==y){if(y)continue;f=!1;break}if(m){if(!ub(t,function(e,t){if(!m.has(t)&&(g===e||s(g,e,i,r,a)))return m.push(t)})){f=!1;break}}else if(!(g===v||s(g,v,i,r,a))){f=!1;break}}return a.delete(e),a.delete(t),f},u_=function(e){var t=-1,i=Array(e.size);return e.forEach(function(e,r){i[++t]=[r,e]}),i},uS=function(e){var t=-1,i=Array(e.size);return e.forEach(function(e){i[++t]=e}),i},uC=hT?hT.prototype:void 0,uM=uC?uC.valueOf:void 0,uE=function(e,t,i,r,s,a,o){switch(i){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)break;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!a(new ue(e),new ue(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return cx(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var h=u_;case"[object Set]":var c=1&r;if(h||(h=uS),e.size!=t.size&&!c)break;var d=o.get(e);if(d)return d==t;r|=2,o.set(e,t);var u=uw(h(e),h(t),r,s,a,o);return o.delete(e),u;case"[object Symbol]":if(uM)return uM.call(e)==uM.call(t)}return!1},uA=Object.prototype.hasOwnProperty,uT=function(e,t,i,r,s,a){var o=1&i,h=dG(e),c=h.length;if(c!=dG(t).length&&!o)return!1;for(var d=c;d--;){var u=h[d];if(!(o?u in t:uA.call(t,u)))return!1}var p=a.get(e),f=a.get(t);if(p&&f)return p==t&&f==e;var m=!0;a.set(e,t),a.set(t,e);for(var g=o;++d<c;){var v=e[u=h[d]],y=t[u];
3139if(r)var x=o?r(y,v,u,t,e,a):r(v,y,u,e,t,a);if(!(void 0===x?v===y||s(v,y,i,r,a):x)){m=!1;break}g||(g="constructor"==u)}if(m&&!g){var b=e.constructor,w=t.constructor;b!=w&&"constructor"in e&&"constructor"in t&&!("function"==typeof b&&b instanceof b&&"function"==typeof w&&w instanceof w)&&(m=!1)}return a.delete(e),a.delete(t),m},uP="[object Arguments]",uD="[object Array]",uO="[object Object]",uL=Object.prototype.hasOwnProperty,uI=function(e,t,i,r,s,a){var o=hj(e),h=hj(t),c=o?uD:d8(e),d=h?uD:d8(t);c=c==uP?uO:c,d=d==uP?uO:d;var u=c==uO,p=d==uO,f=c==d;if(f&&cR(e),f&&!u)return a||(a=new dz),o||cF(e)?uw(e,t,i,r,s,a):uE(e,t,c,i,r,s,a);if(!(1&i)){var m=u&&uL.call(e,"__wrapped__"),g=p&&uL.call(t,"__wrapped__");if(m||g){var v=m?e.value():e,y=g?t.value():t;return a||(a=new dz),s(v,y,i,r,a)}}return!!f&&(a||(a=new dz),uT(e,t,i,r,s,a))},uR=function(e,t){return null!=e&&t in Object(e)},uk=function(e,t,i){t=dn(t,e);for(var r=-1,s=t.length,a=!1;++r<s;){var o=dh(t[r]);if(!(a=null!=e&&i(e,o)))break;e=e[o]}return a||++r!=s?a:!!(s=null==e?0:e.length)&&cC(s)&&cv(o,s)&&(hj(e)||cI(e))},uB=function(){return hA.Date.now()},uz=Math.max,uN=Math.min,uF=function(e,t,i){var r,s,a,o,h,c,d=0,u=!1,p=!1,f=!0;if("function"!=typeof e)throw TypeError("Expected a function");function m(t){var i=r,a=s;return r=s=void 0,d=t,o=e.apply(a,i)}function g(e){var i=e-c,r=e-d;return void 0===c||i>=t||i<0||p&&r>=a}function v(){var e,i,r,s=uB();if(g(s))return y(s);h=setTimeout(v,(e=s-c,i=s-d,r=t-e,p?uN(r,a-i):r))}function y(e){return h=void 0,f&&r?m(e):(r=s=void 0,o)}function x(){var e,i=uB(),a=g(i);if(r=arguments,s=this,c=i,a){if(void 0===h)return d=e=c,h=setTimeout(v,t),u?m(e):o;if(p)return clearTimeout(h),h=setTimeout(v,t),m(c)}return void 0===h&&(h=setTimeout(v,t)),o}return t=h0(t)||0,hY(i)&&(u=!!i.leading,a=(p="maxWait"in i)?uz(h0(i.maxWait)||0,t):a,f="trailing"in i?!!i.trailing:f),x.cancel=function(){void 0!==h&&clearTimeout(h),d=0,r=c=s=h=void 0},x.flush=function(){return void 0===h?o:y(uB())},x},uj=function(e){var t=null==e?0:e.length;return t?e[t-1]:void 0},uU=function(e,t){return e>t},uV=function(e,t){return function e(t,i,r,s,a){return t===i||(null!=t&&null!=i&&(hz(t)||hz(i))?uI(t,i,r,s,e,a):t!=t&&i!=i)}(e,t)},uW=function(e,t,i){for(var r=-1,s=e.length;++r<s;){var a=e[r],o=t(a);if(null!=o&&(void 0===h?o==o&&!hN(o):i(o,h)))var h=o,c=a}return c},uH=function(e,t){var i,r;return t=dn(t,e),i=e,null==(e=(r=t).length<2?i:dc(i,dS(r,0,-1)))||delete e[dh(uj(t))]},uG=function(e){return d_(e)?void 0:e},uq=dg(function(e,t){var i={};if(null==e)return i;var r=!1;t=hF(t,function(t){return t=dn(t,e),r||(r=t.length>1),t}),c_(e,dq(e),i),r&&(i=uv(i,7,uG));for(var s=t.length;s--;)uH(i,t[s]);return i}),uX=function(e,t,i,r){if(!hY(e))return e;t=dn(t,e);for(var s=-1,a=t.length,o=a-1,h=e;null!=h&&++s<a;){var c=dh(t[s]),d=i;if("__proto__"===c||"constructor"===c||"prototype"===c)break;if(s!=o){var u=h[c];void 0===(d=r?r(u,c,h):void 0)&&(d=hY(u)?u:cv(t[s+1])?[]:{})}cw(h,c,d),h=h[c]}return e},uY=function(e,t,i){for(var r=-1,s=t.length,a={};++r<s;){var o=t[r],h=dc(e,o);i(h,o)&&uX(a,dn(o,e),h)}return a},uQ=dg(function(e,t){return null==e?{}:uY(e,t,function(t,i){return null!=e&&uk(e,i,uR)})}),uZ=function(e,t,i){var r=!0,s=!0;if("function"!=typeof e)throw TypeError("Expected a function");return hY(i)&&(r="leading"in i?!!i.leading:r,s="trailing"in i?!!i.trailing:s),uF(e,t,{leading:r,maxWait:t,trailing:s})},uK=function(e,t){for(var i,r=e.length;r--&&((i=e[r])==i?cm(t,i,0):cp(t,cf,0))>-1;);return r},uJ=function(e,t,i){if((e=da(e))&&(i||void 0===t))return e.slice(0,hq(e)+1);if(!e||!(t=hH(t)))return e;var r=dB(e),s=uK(r,dB(t))+1;return dC(r,0,s).join("")};function u$(e){for(let t of Object.keys(e))void 0===e[t]&&delete e[t];return e}function u0(e,t){return Object.setPrototypeOf(e,t),e}var u1=!(typeof window>"u")&&window.navigator.userAgent.toLowerCase().includes(" electron/"),u2=(u1&&(()=>{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):window.localStorage.getItem("desktop-app-version")??"0.0.6"})(),!(typeof window>"u")&&window.navigator.platform.toUpperCase().includes("MAC")),u3=!(typeof window>"u")&&(/iPad|iPhone|iPod/.test(window.navigator.userAgent)||u2&&"ontouchend"in document),u4=!(typeof window>"u")&&window.navigator.userAgent.toLowerCase().indexOf("firefox")>-1,u5=!(typeof window>"u")&&("ontouchstart"in window||navigator.maxTouchPoints>0),u6=(()=>
3139{if(typeof window>"u")return!1;let e=navigator.userAgent,t=navigator.vendor;return/Safari/i.test(e)&&/Apple Computer/.test(t)})(),u8=Number((()=>{if(typeof window>"u")return null;let e=navigator.userAgent.match(/Version\/(\d+\.\d)/);return e&&e[1]})());function u9(e){return Array.isArray(e)?e:[e]}function u7(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)}function pe(e){return u2?e.metaKey:e.ctrlKey}var pt=[],pi={},pr={},ps={};function pa(e){pt.includes(e)||pt.push(e)}function pn(e){delete pi[e.pointerId];for(let t=0;t<pt.length;t++)if(pt[t].pointerId===e.pointerId){pt.splice(t,1);break}}function po(e){if("touch"!==e.pointerType)return;let t=pi[e.pointerId];void 0===t&&(t={x:0,y:0},pi[e.pointerId]=t),t.x=e.pageX,t.y=e.pageY}function pl(e){return pi[(e.pointerId===pt[0].pointerId?pt[1]:pt[0]).pointerId]}function ph(e){pr[e.key]=!0,ps[e.key]=void 0===ps[e.key]?1:ps[e.key]+1}function pc(e){if(u2&&pr.Meta)for(let e in pr)pr[e]=!1;else pr[e.key]=!1;ps={}}var pd,pu,pp,pf,pm,pg,pv,py,px,pb=new Promise(e=>{pv=e}),pw=new Promise(e=>{px=e}),p_=class{modifyById(e,t){if(void 0===this[e])throw Error("not expected");{let i={...this,[e]:t};return Object.setPrototypeOf(i,p_.prototype),i}}add(e,t){return this.runOp({type:1,id:e,data:t})?.data??this}runOp(e){if(1===e.type){let t=this[e.id],i;i=void 0===t?{type:2,id:e.id}:{type:1,id:e.id,data:t};let{id:r,data:s}=e,a={...this,[r]:s};return Object.setPrototypeOf(a,p_.prototype),{data:a,actual:e,reverse:i}}if(2===e.type){let{id:t}=e,i=this[t];if(void 0===i)return null;{let r={...this};return Object.setPrototypeOf(r,p_.prototype),delete r[t],{data:r,actual:e,reverse:{type:1,id:t,data:i}}}}return null}};function pS(e){if(void 0!==e.deepFreeze)return void e.deepFreeze(e);for(let t of Object.getOwnPropertyNames(e)){let i=e[t];i&&"object"==typeof i&&pS(i)}return Object.freeze(e)}var pC=class extends Error{};function pM(e){let t={...e};return Object.setPrototypeOf(t,Object.getPrototypeOf(e)),t}function pE(e,t,i){if(void 0===e?void 0===t?(e=0,t=10):e=t-10:void 0===t&&(t=e+10),e>t){let i=e;e=t,t=i}let r=[],s=1/(i+1);for(let a=0;a<i;a++){let i=e+(t-e)*(a+.75+.5*Math.random())*s;r.push(i)}return r}function pA(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}var pT=class extends Array{constructor(...e){super(...e),Object.setPrototypeOf(this,pT.prototype)}deepFreeze(){let e=0;for(;e<this.length;)pS(this[e]),e++}fillCaches0(e,t){for(let i of(this.objCaches.set(e.id,e),this.parentCaches.set(e.id,t),e.children))this.fillCaches0(i,e.id)}fillCaches(){if(void 0===this.objCaches)for(let e of(this.objCaches=new Map,this.parentCaches=new Map,this))this.fillCaches0(e,null)}randomId(){this.fillCaches();let e=Array.from(this.objCaches.keys());if(0!==e.length)return e[Math.max(0,Math.floor(Math.random()*e.length)-1)]}nonExistOrDescendantOf(e,t){if(!this.has(e))return!0;for(;e;){let i=this.parent(e);if(i===t)return!0;e=i}return!1}rootAcestor(e){for(;e;){let t=this.parent(e);if(t)e=t;else break}return e}isDescendantOf(e,t){for(;e;){let i=this.parent(e);if(i===t)return!0;e=i}return!1}data(e){return this.get(e)?.data}has(e){return void 0!==this.childrenOf(e)}get(e){return this.fillCaches(),this.objCaches.get(e)}childrenOf(e){return null===e?this:this.get(e)?.children}traverseFrom(e,t){if(null===e)this.traverse(t);else{let i=this.get(e);i&&function e(t,i){if(!0!==i(t.id,t.data))for(let r of t.children)e(r,i)}(i,t)}}traverse(e){!function e(t,i){for(let r of t)!0!==i(r.id,r.data)&&e(r.children,i)}(this,e)}totalSize(){return this.fillCaches(),this.objCaches.size}parent(e){return this.fillCaches(),this.parentCaches.get(e)}childrenArray(e){return null===e?this:this.get(e).children}modifyById(e,t){if(void 0===this.get(e))throw Error("not expected");{let i=this.parent(e),r=this.childrenArray(i),s=r.findIndex(t=>t.id===e);if(s<0)throw Error("not expected");let a=r[s];return(r=[...r])[s]={...a,data:t},this.modifyArrayBy(i,r)}}modifyArrayBy(e,t){let i=e,r=t;for(;null!==i;){let e=r,t=i;if(void 0===(i=this.parent(i)))throw Error();let s=(r=this.childrenArray(i)).findIndex(e=>e.id===t);if(s<0)throw Error();(r=[...r])[s]={...r[s],children:e}}Object.setPrototypeOf(r,pT.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(void 0!==this.get(e))return!0;for(let e of t)if(this.checkDuplicatedIdRec(e))return!0;return!1}
3139addOp(e){let{parent:t,fi:i,id:r,data:s,children:a}=e;if(null!==t&&void 0===this.get(t)||this.checkDuplicatedIdRec(e))return null;{let o=this.childrenArray(t),h={fi:i,id:r,data:s,children:a};return(o=[...o,h]).sort((e,t)=>e.fi-t.fi),e.localIndex=o.indexOf(h),{data:this.modifyArrayBy(t,o),actual:e,reverse:{type:8,id:r}}}}deleteOp(e){let{id:t}=e;if(null===this.get(t))return null;{let i=this.parent(t);if(void 0===i)return null;let r=this.childrenArray(i),s=r.findIndex(e=>e.id===t);e.localIndex=s;let a=(r=[...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(null!==t&&void 0===this.get(t))return this.deleteOp({type:8,id:r});if(null!==t){let e=t;for(;null!==e;){if(void 0===e)throw Error();if(e===r)throw new pC("cyclic tree");e=this.parent(e)}}let s=this.parent(r);if(void 0===s)return null;let a=s,o=this.childrenArray(s),h=o.findIndex(e=>e.id===r),c=(o=[...o]).splice(h,1)[0],d=this.modifyArrayBy(s,o);s=t,o=d.childrenArray(s);let u=c.fi;return(o=[...o,c={...c,fi:i}]).sort((e,t)=>e.fi-t.fi),e.localIndex=o.indexOf(c),{data:d=d.modifyArrayBy(s,o),actual:e,reverse:{type:9,parent:a,fi:u,id:r}}}previous(e,t){if(null===t){let t=this.childrenArray(e);return 0===t.length?null:t[t.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(void 0!==t){let i=this.childrenArray(t),r=i.findIndex(t=>t.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(void 0!==t){let i=this.childrenArray(t),r=i.findIndex(t=>t.id===e)-1;return r>=0?this.traverseSortPrevious(i[r].id):t}}getAllSorted(e){let t=[];for(let i of e){let e=this.getWithSortKey(i.id);void 0!==e&&t.push({...i,...e})}for(let e of(t.sort((e,t)=>(function(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)})(e.sortKey,t.sortKey)),t))delete e.sortKey;return t}getWithSortKey(e){var t=e;let i=[],r=this.get(t),s=r;if(void 0!==r){for(;t;)i.splice(0,0,r.fi),null!==(t=this.parent(t))&&(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(null===t){if(0===r.length)return pE(0,i,i);{let e=r[0].fi;return pE(e-i,e,i)}}{let s=this.get(t);if(void 0===s||this.parent(t)!==e)throw Error("illegal args");let a=r.find(e=>e.fi>s.fi);if(void 0!==a)return pE(s.fi,a.fi,i);{let e=r[r.length-1].fi;return pE(e,e+i,i)}}}};(pL||(pL={})).runOp=function(e,t){if(0!==t.type)return null;if(Array.isArray(e)){let i=t.props,r={},s=[...e],a=!1;if(i)for(let e of Object.keys(i)){let t=parseInt(e);if(isNaN(t))throw Error("wrong index");r[e]=s[t],s[t]=i[e],a=!0}return a?{data:s,actual:t,reverse:{type:0,props:r}}:null}{let i=t.props,r={},s={...e},a=!1;if(i)for(let e of Object.keys(i)){r[e]=s[e];let t=i[e];void 0===t?delete s[e]:s[e]=t,a=!0}return a?{data:s,actual:t,reverse:{type:0,props:r}}:null}};var pP=class extends Array{constructor(...e){super(...e),Object.setPrototypeOf(this,pP.prototype)}deepFreeze(){let e=0;for(;e<this.length;)pS(this[e]),e++}fillCaches0(e){this.objCaches.set(e.id,e)}fillCaches(){if(void 0===this.objCaches)for(let e of(this.objCaches=new Map,Object.getOwnPropertyDescriptor(this,"objCaches").enumerable=!1,this))this.fillCaches0(e)}randomId(){this.fillCaches();let e=Array.from(this.objCaches.keys());if(0!==e.length)return e[Math.max(0,Math.floor(Math.random()*e.length)-1)]}data(e){return this.get(e)?.data}get(e){return this.fillCaches(),this.objCaches.get(e)}modifyById(e,t){if(void 0===this.get(e))throw Error("not expected");{let i=this,r=i.findIndex(t=>t.id===e);if(r<0)throw Error("not expected");let s=i[r];return(i=[...i])[r]={...s,data:t},this.modifyArrayBy(i)}}modifyArrayBy(e){return Object.setPrototypeOf(e,pP.prototype),"u">typeof tf.default||e.fillCaches(),e}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]).sort((e,t)=>
3139e.fi-t.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(e=>e.id===t);if(-1===r)return null;e.localIndex=r;let s=(i=[...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,s=(r=[...r]).findIndex(e=>e.id===i);if(-1===s)return null;let a=r[s].fi,o={...r[s],fi:t};return r[s]=o,r.sort((e,t)=>e.fi-t.fi),e.localIndex=r.indexOf(o),{data:this.modifyArrayBy(r),actual:e,reverse:{type:6,fi:a,id:i}}}previous(e){if(null===e)return 0===this.length?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){if(null===e){if(0===this.length)return pE(0,t,t);{let e=this[0].fi;return pE(e-t,e,t)}}{let i=this.get(e);if(void 0===i)throw Error("illegal args");let r=this.find(e=>e.fi>i.fi);if(void 0!==r)return pE(i.fi,r.fi,t);{let e=this[this.length-1].fi;return pE(e,e+t,t)}}}};function pD(e){return e&&"object"==typeof e&&e instanceof pR}var pO,pL,pI,pR=class{unusedFunOverridesTable(e){}runOp(e){let t=[],i=this,r=0,s={};for(;r<e.path.length;){if(t.push(i),void 0!==(i=void 0===i?void 0:i[e.path[r]])&&!pD(i))return null;r+=1}for(let[t,r]of(i=i?pM(i):new pR,Object.entries(e.props))){let e=i[t];s[t]=e,void 0===r?delete i[t]:i[t]=r}for(;r>0;){if(0===Object.keys(i).length){let s=t[r-1];s&&(i=pM(s),delete i[e.path[r-1]])}else{let s=t[r-1];if(s){let t=pM(s);t[e.path[r-1]]=i,i=t}else{let t=new pR;t[e.path[r-1]]=i,i=t}}r-=1}let a=Object.setPrototypeOf(i,pR.prototype),o={...e,props:s};return{data:a,actual:e,reverse:o}}};function pk(e,t){if(void 0===t)return;let i=!1,r=e.map(e=>{let r=e.id,s=pB(e.data,t[r]);if(i=i||void 0!==s,void 0===s&&(s=e.data),!e.children)return{...e,id:r,data:s};{let a=pk(e.children,t);return void 0!==a?i=!0:a=e.children,{...e,id:r,data:s,children:a}}});if(i)return r}function pB(e,t){if(!pD(t))return t;if(e instanceof pT){let i=pk(e,t);return void 0!==i&&Object.setPrototypeOf(i,Object.getPrototypeOf(e)),i}if(e instanceof pP){if(void 0===t)return;let i=!1,r=e.map(e=>{let r=e.id,s=pB(e.data,t[r]);return i=i||void 0!==s,void 0===s&&(s=e.data),{...e,id:r,data:s}});return i?(Object.setPrototypeOf(r,Object.getPrototypeOf(e)),r):void 0}if(Array.isArray(e)){let i=!1,r=e.map((e,r)=>{let s=pB(e,t[r]);return i=i||void 0!==s,void 0===s&&(s=e),s});return i?(Object.setPrototypeOf(r,Object.getPrototypeOf(e)),r):void 0}if(e instanceof pR)return pz(e,t);if(e&&"object"==typeof e){let i={},r=!1;for(let[s,a]of Object.entries(e)){let e=pB(a,t[s]);r=r||void 0!==e,void 0===e&&(e=a),i[s]=e}return r?(Object.setPrototypeOf(i,Object.getPrototypeOf(e)),i):void 0}}function pz(e,t){if(void 0===e)return t;if(void 0===t)return e;if(!pD(t))return t;if(!pD(e))return pI.apply(e,t);let i=new Set;for(let t of Object.keys(e))i.add(t);for(let e of Object.keys(t))i.add(e);let r=new pR;for(let s of i){let i=pz(void 0===e?void 0:e[s],void 0===t?void 0:t[s]);r[s]=i}return r}function pN(e,t){return null===e?null:(e.cur[e.len]=t,e.len+=1,e)}function pF(e){e&&(e.len-=1)}(fi=pI||(pI={})).apply=function(e,t){return pB(e,t)??e},fi.merge=function(e,t){return pz(e,t)},fi.filterOp=function(e,t){let i=0,r=t.path,s=e;for(;i<r.length&&void 0!==s;){if(void 0===(s=fn.zoomOnce(s,r[i])))return t;if(!pD(s))return;i+=1}if(void 0===s)return t;if(pD(s))if(0===t.type){let e={...t.props};for(let t of Object.keys(s))delete e[t];return{...t,props:e}}else{if(1!==t.type&&4!==t.type&&7!==t.type)return t;let e=pk([t],s);return e?e[0]:t}};(fr||(fr={})).replaceProps=function(e,t){let i=fn.zoom(t,e.path);if("object"!=typeof i)return{...e,props:{}};{let t={};for(let r of Object.keys(e.props))t[r]=i[r];return{...e,props:t}}},(e=>{function t(e,t){let i=t.path;for(var r=[];;){let s;if(e instanceof pR&&0===t.type&&null===(s=e.runOp({...t,path:i.slice(r.length)}))&&(s=void 0),void 0===s&&r.length===i.length&&(s=e instanceof pT||e instanceof pP||e instanceof p_?e.runOp(t):pL.runOp(e,t)),void 0!==s)if(null===s)return null;else{let e=s.data;for(let t=r.length-1;t>=0;t--){let s=i[t],a=r[t];if(a instanceof pT){if("number"==typeof s)throw Error("illegal arg");e=a.modifyById(s,e)}else if(a instanceof pP){if("number"==typeof s)throw Error("illegal arg");e=a.modifyById(s,e)}else if(a instanceof p_){if("number"==typeof s)throw Error("illegal arg");e=a.modifyById(s,e)}else if(a instanceof pR)e=Object.setPrototypeOf({...a,[s]:e},pR.prototype);else if("object"!=typeof a)return null;else if(Array.isArray(a)){if("string"==typeof s&&isNaN(s=parseInt(s)))throw Error("Invalid path");let t=e;(e=[...a])[s]=t}else e={...a,[s]:e}}return{data:e,actual:{...s.actual,path:i},reverse:{...s.reverse,path:i}}}let a=i[r.length],o;if(e instanceof pT){if("number"==typeof a)throw Error("");o=e.get(a)?.data}else if(e instanceof pP){if("number"==typeof a)throw Error("");o=e.get(a)?.data}else null!==e&&(o=e[a]);if(void 0===o)return null;r.push(e),e=o}}function i(e,t){for(let i=0;i<e.length&&i<t.length;i++)if(e[i]!==t[i])return!0;return!1}function r(e,t){if(e.length!==t.length)return!1;for(let i=0;i<e.length;i++)if(e[i]!==t[i])return!1;return!0}e.drop=function(e,t){return{...e,path:e.path.slice(t)}},e.applySimple=function(e,i){return t(e,i)?.data??e},e.apply=t,e.pathDisjoint=i,e.pathEq=r,e.commutative=function(e,t){return i(e.path,t.path)},e.subsumed=function(e,t){return!!(0===e.type&&0===t.type&&r(e.path,t.path))&&Object.keys(e.props).every(e=>void 0!==t.props[e])}})(fs||(fs={}));var pj=fa||(fa={});function pU(e,t){var i=e;let r=[],s=[];for(let e of t)try{if(3===e.type||5===e.type&&"variables"===e.path[e.path.length-1]){let t,a,o;if(3===e.type?(t=fn.zoom(i,[...e.path,e.id]),o=fs.apply(i,{...e,type:2})):(t=fn.zoom(i,[...e.path,e.id,"value"]),o=fs.apply(i,e)),null!==o){i=o.data;let[h,c]=function(e,t){let i={cur:[],result:[],len:0};return[e=function e(t,i,r){if(t instanceof pT){let s=function t(i,r,s){let a=!1,o=i.map(i=>{let o=i.id,h=r[o];if(void 0!==h&&"string"==typeof h&&(a=!0,o=h,null!==s))throw Error("not supported");let c=e(i.data,r,pN(s,o));pF(s),a=a||void 0!==c,void 0===c&&(c=i.data);let d=t(i.children,r,s);return void 0!==d?a=!0:d=i.children,{...i,id:o,data:c,children:d}});if(a)return o}(t,i,r);return void 0!==s&&Object.setPrototypeOf(s,Object.getPrototypeOf(t)),s}if(t instanceof pP){let s=!1,a=t.map(t=>{let a=t.id,o=i[a];if(void 0!==o&&"string"==typeof o&&(s=!0,a=o,null!==r))throw Error("not supported");let h=e(t.data,i,pN(r,a));return pF(r),s=s||void 0!==h,void 0===h&&(h=t.data),{...t,id:a,data:h}});return s?(Object.setPrototypeOf(a,Object.getPrototypeOf(t)),a):void 0}if(Array.isArray(t)){let s=!1,a=t.map((t,a)=>{let o=e(t,i,pN(r,a));return pF(r),s=s||void 0!==o,void 0===o&&(o=t),o});return s?(Object.setPrototypeOf(a,Object.getPrototypeOf(t)),a):void 0}if(t&&"object"==typeof t&&!pA(t)){let s={},a=!1;for(let[o,h]of Object.entries(t))if("name"!==o&&"variableId"!==o){let t=i[o];if("string"==typeof t){if(null!==r)throw Error("not supported");a=!0,o=t}let c=e(h,i,pN(r,o));pF(r),a=a||void 0!==c,void 0===c&&(c=h),s[o]=c}else s[o]=h;return a?(Object.setPrototypeOf(s,Object.getPrototypeOf(t)),s):void 0}{var s;if("string"!=typeof t)return;let e=i[t];return void 0!==e&&(null===(s=r)||s.result.push(s.cur.slice(0,s.len))),e}}(e,t,i)??e,i.result]}(i,{[e.id]:t});i=h;for(let o=0;o<c.length;o++){let h=c[o],d=h.pop();if("number"==typeof d){let r=[d];for(let e=o+1;e<c.length;e++){let t=c[e],i=t[t.length-1];if("number"==typeof i&&fn.equal(h,t.slice(0,t.length-1)))r.push(i),c.splice(e,1);else break}let s=fn.zoom(i,h);a=s.map((t,i)=>r.includes(i)?e.id:t),t=s,d=h.pop()}else{if("alphaOverride"===d||"alpha"===d){let e=t/=100,r=fn.zoom(i,h.slice(0,h.length-2)),s=r.layers.map(t=>
vendor: 6,485 bytes, line 3139
3139t.id===h[h.length-1]?{...t,data:{...t.data,[d]:e}}:t);Object.setPrototypeOf(s,Object.getPrototypeOf(r.layers)),r.layers=s}a=e.id}r.push({type:0,path:h,props:{[d]:t}}),s.push({type:0,path:h,props:{[d]:a}})}s.push(o.reverse),r.push(o.actual)}}else{let t=fs.apply(i,e);null!==t&&(r.push(t.actual),i=t.data,s.push(t.reverse))}}catch(e){if(e instanceof pC)return null;throw e}return{data:i,actual:r,reverse:s.reverse()}}pj.empty=function(){return[]},pj.removePrefix=function(e,t){let i=[];for(let r of e){let[e,...s]=r.path;e===t&&i.push({...r,path:s})}return i},pj.addPrefix=function(e,t){return e.map(e=>({...e,path:[t,...e.path]}))},pj.concat=function(e,t){return[...e,...t]},pj.compress=function(e,t){return[...e.filter(e=>!t.some(t=>fs.subsumed(e,t))),...t]},pj.commutative=function(e,t){return e.every(e=>t.every(t=>fs.commutative(e,t)))},pj.applyAll=function(e,t){for(let i of t){let t=pU(e,i);null!==t&&(e=t.data)}return e},pj.apply=pU;var pV=Symbol(),pW=Symbol(),pH=Symbol(),pG=class{reportOp(e,t,i=[]){let r=this;if(null!==t){for(r._current=t.data;!(r instanceof p0);){let e=r._path,t=r._current;if(""!==e&&i.splice(0,0,e),null===(r=r._parent))return;r.update(e,t)}r.push(i,e,t.actual,t.reverse)}}deleteChildren(e){if(this._children){let t=this._children[e];if(t){let i=t[pH];i&&i(),delete this._children[e]}}}},pq=class extends pG{constructor(e,t,i){super(),this._parent=e,this._path=t,this._current=i}update(e,t){if(Array.isArray(this._current)){if("string"==typeof e&&isNaN(e=parseInt(e)))throw Error("Invalid path");this._current=[...this._current],this._current[e]=t}else if(this._current instanceof pR){let i={...this._current,[e]:t};this._current=Object.setPrototypeOf(i,pR.prototype)}else this._current={...this._current,[e]:t}}runOp(e){this.reportOp(e,pL.runOp(this._current,e),e.path)}},pX=class extends pG{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,p_.prototype)}runOp(e){this.reportOp(e,this._current.runOp(e))}},pY={get(e,t){if(t===pH)return()=>{e._parent=null};if(t===pV)return e._current;if(t===pW)return e;let{_current:i,_children:r}=e;if("push"===t&&Array.isArray(i))throw Error("not supported to expand array");let s=void 0===r?void 0:r[t];if(void 0!==s)return s;let a=i[t],o=p1(e,t,a);return o!==a?(void 0===r&&(e._children=r={}),r[t]=o,o):a},has:(e,t)=>t in e._current,ownKeys:e=>Reflect.ownKeys(e._current),defineProperty(){throw Error("not supported")},getPrototypeOf:e=>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]}}},pQ={...pY,set(e,t,i){let r={type:0,props:{[t]:p4(i)??i}};return e.deleteChildren(t),e.runOp(r),!0},deleteProperty:(e,t)=>(e.deleteChildren(t),e.runOp({type:0,props:{[t]:void 0}}),!0)},pZ={...pY,set(e,t,i){return void 0===i?this.deleteProperty(e,t):(e.deleteChildren(t),e.runOp({type:1,id:t,data:i})),!0},deleteProperty:(e,t)=>(e.runOp({type:2,id:t}),!0)},pK=class extends pG{constructor(e,t,i){super(),this._children={},this._parent=e,this._path=t,this._current=i,this[pH]=()=>{this._parent=null}}unproxy(){return this._current}update(e,t){this._current=this._current.modifyById(e,t)}runOp(e){this.reportOp(e,this._current.runOp(e))}randomId(){return this._current.randomId()}isDescendantOf(e,t){return this._current.isDescendantOf(e,t)}childrenOf(e){return this._current.childrenOf(e)}traverse(e){return this._current.traverse(e)}get(e){return this._current.get(e)}parent(e){return this._current.parent(e)}traverse(e){this._current.traverse((t,i)=>{e(t,this.data(t))})}data(e){let{_current:t,_children:i}=this,r=void 0===i?void 0:i[e];if(void 0!==r)return r;let s=t.get(e)?.data,a=p1(this,e,s);return a!==s?(void 0===i&&(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 t=0;t<i.length;t++){let s=i[t];this.add(e,r[t],s.id,s.data,s.children)}}insertBefore(e,t,i){let r=this._current.insertBeforeHelper(e,t,i.length);for(let t=0;t<i.length;t++){let s=i[t];this.add(e,r[t],s.id,s.data,s.children)}}moveAfter(e,t,i){let r=this._current.insertAfterHelper(e,t,i.length);for(let t=0;t<i.length;t++){let s=i[t];this.move(e,r[t],s)}}moveBefore(e,t,i){let r=this._current.insertBeforeHelper(e,t,i.length);for(let t=0;t<i.length;t++){let s=i[t];this.move(e,r[t],s)}}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)}},pJ=class extends pG{constructor(e,t,i){super(),this._children={},this._parent=e,this._path=t,this._current=i,this[pH]=()=>{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 t=this._current[i].id,r=this._current[i].fi;e(this.data(this._current[i].id),t,r)}}find(e){let t=this.length;for(let i=0;i<t;i++){let t=this._current[i].id;if(e(this.data(t),t))return this.get(t)}}update(e,t){this._current=this._current.modifyById(e,t)}randomId(){return this._current.randomId()}get(e){return{...this._current.get(e),data:this.data(e)}}data(e){let{_current:t,_children:i}=this,r=void 0===i?void 0:i[e];if(void 0!==r)return r;let s=t.get(e)?.data,a=p1(this,e,s);return a!==s?(void 0===i&&(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 e=0;e<t.length;e++){let r=t[e];this.add(i[e],r.id,r.data)}}insertBefore(e,t){let i=this._current.insertBeforeHelper(e,t.length);for(let e=0;e<t.length;e++){let r=t[e];this.add(i[e],r.id,r.data)}}moveAfter(e,t){let i=this._current.insertAfterHelper(e,t.length);for(let e=0;e<t.length;e++){let r=t[e];this.move(i[e],r)}}moveBefore(e,t){let i=this._current.insertBeforeHelper(e,t.length);for(let e=0;e<t.length;e++){let r=t[e];this.move(i[e],r)}}delete(e){this.deleteChildren(e),this.runOp({type:5,id:e})}};function p$(e,t,i){if(e.length>0){let r=e[e.length-1];if(0===r.type&&0===t.type&&fn.equal(r.path,i))return void Object.assign(r.props,t.props)}
3139e.push({...t,path:i})}var p0=class extends pG{constructor(e){super(),this.ts=[],this.actual=[],this.reverse=[],this._current=e}update(e,t){if(""!==e)throw Error("");this._current=t}push(e,t,i,r){p$(this.ts,t,e),p$(this.actual,i,e),p$(this.reverse,r,e)}result(){return{data:this._current,ts:this.ts,actual:this.actual,reverse:this.reverse.reverse()}}};function p1(e,t,i){return i instanceof pT?new pK(e,t,i):i instanceof pP?new pJ(e,t,i):i instanceof p_?new Proxy(new pX(e,t,i),pZ):null!==i&&"object"==typeof i?pA(i)?i:new Proxy(new pq(e,t,i),pQ):i}function p2(e){let t=new p0(e);return[p1(t,"",e),t]}function p3(e,t){let[i,r]=p2(e);return t(i),r.result()}function p4(e){return e instanceof pK||e instanceof pJ?e._current:null!==e&&"object"==typeof e?e[pV]:e}var p5=fn||(fn={});function p6(e,t){return(e instanceof pT||e instanceof pK)&&"string"==typeof t||(e instanceof pP||e instanceof pJ)&&"string"==typeof t?e.data(t):"number"==typeof t&&Array.isArray(e)||"string"==typeof t&&"object"==typeof e&&null!==e?e[t]:void 0}function p8(e,t,i=0){for(;i<t.length&&void 0!==e;)e=p6(e,t[i]),i+=1;return e}function p9(e,t){let i=[];if(!(t.length<=e.length))return null;for(var r=0;r<t.length;){if("*"===t[r])i.push(e[r]);else if(e[r]!==t[r])return null;r+=1}return i}p5.equal=function(e,t){if(t.length!==e.length)return!1;for(var i=0;i<e.length;){if(e[i]!==t[i])return!1;i+=1}return!0},p5.removeOverridden=function(e,t,i){let r=p8(i,e);if(void 0===r||"object"!=typeof r||null===r)return t;{let e={...t};return Object.keys(r).forEach(t=>{delete e[t]}),e}},p5.zoomOnce=p6,p5.zoom=p8;var p7=class{},fe=class extends p7{constructor(e){super(),this.id=e}},ft=class extends p7{constructor(e){super(),this.data=e}};try{fo=new TextDecoder}catch{}var fi,fr,fs,fa,fn,fo,fl,fh,fc,fd,fu,fp,ff,fm=0,fg=[],fv=fg,fy=0,fx={},fb=0,fw=0,f_=[],fS={useRecords:!1,mapsAsObjects:!0},fC=class{},fM=new fC;fM.name="MessagePack 0xC1";var fE=!1,fA=class{constructor(e){e&&(!1===e.useRecords&&void 0===e.mapsAsObjects&&(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(fl)return fJ(()=>(f$(),this?this.unpack(e,t):fA.prototype.unpack.call(fS,e,t)));fh=t>-1?t:e.length,fm=0,fy=0,fw=0,fd=null,fv=fg,fu=null,fl=e;try{ff=e.dataView||(e.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength))}catch(t){throw fl=null,e instanceof Uint8Array?t:Error("Source must be a Uint8Array or Buffer but was a "+(e&&"object"==typeof e?e.constructor.name:typeof e))}if(this instanceof fA){if(fx=this,this.structures)return fc=this.structures,fT();(!fc||fc.length>0)&&(fc=[])}else fx=fS,(!fc||fc.length>0)&&(fc=[]);return fT()}unpackMultiple(e,t){let i,r=0;try{fE=!0;let s=e.length,a=this?this.unpack(e,s):f1.unpack(e,s);if(t){for(t(a);fm<s;)if(r=fm,!1===t(fT()))return}else{for(i=[a];fm<s;)r=fm,i.push(fT());return i}}catch(e){throw e.lastPosition=r,e.values=i,e}finally{fE=!1,f$()}}_mergeStructures(e,t){e=e||[];for(let t=0,i=e.length;t<i;t++){let i=e[t];i&&(i.isShared=!0,t>=32&&(i.highByte=t-32>>5))}for(let i in e.sharedLength=e.length,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 fT(){try{if(!fx.trusted&&!fE){let e=fc.sharedLength||0;e<fc.length&&(fc.length=e)}let e=fD();if(fm==fh)fc.restoreStructures&&fP(),fc=null,fl=null,fp&&(fp=null);else if(fm>fh){let e=Error("Unexpected end of MessagePack data");throw e.incomplete=!0,e}else if(!fE)throw Error("Data read, but end of buffer not reached");return e}catch(e){throw fc.restoreStructures&&fP(),f$(),(e instanceof RangeError||e.message.startsWith("Unexpected end of buffer"))&&(e.incomplete=!0),e}}function fP(){for(let e in fc.restoreStructures)fc[e]=fc.restoreStructures[e];fc.restoreStructures=null}function fD(){let e=fl[fm++];if(e<160)if(e<128){if(e<64)return e;{let t=fc[63&e]||fx.getStructures&&fR()[63&e];return t?(t.read||(t.read=fL(t,63&e)),t.read()):e}}else if(e<144)if(e-=128,fx.mapsAsObjects){let t={};for(let i=0;i<e;i++)t[fY()]=fD();return t}else{let t=new Map;for(let i=0;i<e;i++)t.set(fD(),fD());return t}else{let t=Array(e-=144);for(let i=0;i<e;i++)t[i]=fD();return t}if(e<192){let t=e-160;if(fw>=fm)return fd.slice(fm-fb,(fm+=t)-fb);if(0==fw&&fh<140){let e=t<16?fH(t):fW(t);if(null!=e)return e}return fk(t)}{let t;switch(e){case 192:return null;case 193:return fu?(t=fD())>0?fu[1].slice(fu.position1,fu.position1+=t):fu[0].slice(fu.position0,fu.position0-=t):fM;case 194:return!1;case 195:return!0;case 196:return fG(fl[fm++]);case 197:return t=ff.getUint16(fm),fm+=2,fG(t);case 198:return t=ff.getUint32(fm),fm+=4,fG(t);case 199:return fq(fl[fm++]);case 200:return t=ff.getUint16(fm),fm+=2,fq(t);case 201:return t=ff.getUint32(fm),fm+=4,fq(t);case 202:if(t=ff.getFloat32(fm),fx.useFloat32>2){let e=f0[(127&fl[fm])<<1|fl[fm+1]>>7];return fm+=4,(e*t+(t>0?.5:-.5)|0)/e}return fm+=4,t;case 203:return t=ff.getFloat64(fm),fm+=8,t;case 204:return fl[fm++];case 205:return t=ff.getUint16(fm),fm+=2,t;case 206:return t=ff.getUint32(fm),fm+=4,t;case 207:return t=fx.int64AsNumber?0x100000000*ff.getUint32(fm)+ff.getUint32(fm+4):ff.getBigUint64(fm),fm+=8,t;case 208:return ff.getInt8(fm++);case 209:return t=ff.getInt16(fm),fm+=2,t;case 210:return t=ff.getInt32(fm),fm+=4,t;case 211:return t=fx.int64AsNumber?0x100000000*ff.getInt32(fm)+ff.getUint32(fm+4):ff.getBigInt64(fm),fm+=8,t;case 212:if(114==(t=fl[fm++]))return fQ(63&fl[fm++]);{let e=f_[t];
3139if(e)return e.read?(fm++,e.read(fD())):e.noBuffer?(fm++,e()):e(fl.subarray(fm,++fm));throw Error("Unknown extension "+t)}case 213:return 114==(t=fl[fm])?(fm++,fQ(63&fl[fm++],fl[fm++])):fq(2);case 214:return fq(4);case 215:return fq(8);case 216:return fq(16);case 217:return t=fl[fm++],fw>=fm?fd.slice(fm-fb,(fm+=t)-fb):fB(t);case 218:return t=ff.getUint16(fm),fm+=2,fw>=fm?fd.slice(fm-fb,(fm+=t)-fb):fz(t);case 219:return t=ff.getUint32(fm),fm+=4,fw>=fm?fd.slice(fm-fb,(fm+=t)-fb):fN(t);case 220:return t=ff.getUint16(fm),fm+=2,fj(t);case 221:return t=ff.getUint32(fm),fm+=4,fj(t);case 222:return t=ff.getUint16(fm),fm+=2,fU(t);case 223:return t=ff.getUint32(fm),fm+=4,fU(t);default:if(e>=224)return e-256;if(void 0===e){let e=Error("Unexpected end of MessagePack data");throw e.incomplete=!0,e}throw Error("Unknown MessagePack token "+e)}}}var fO=/^[a-zA-Z_$][a-zA-Z\d_$]*$/;function fL(e,t){function i(){if(i.count++>2){let i=e.read=Function("r","return function(){return {"+e.map(e=>fO.test(e)?e+":r()":"["+JSON.stringify(e)+"]:r()").join(",")+"}}")(fD);return 0===e.highByte&&(e.read=fI(t,e.read)),i()}let r={};for(let t=0,i=e.length;t<i;t++)r[e[t]]=fD();return r}return i.count=0,0===e.highByte?fI(t,i):i}var fI=(e,t)=>function(){let i=fl[fm++];if(0===i)return t();let r=e<32?-(e+(i<<5)):e+(i<<5),s=fc[r]||fR()[r];if(!s)throw Error("Record id is not defined for "+r);return s.read||(s.read=fL(s,e)),s.read()};function fR(){let e=fJ(()=>(fl=null,fx.getStructures()));return fc=fx._mergeStructures(e,fc)}var fk=fF,fB=fF,fz=fF,fN=fF;function fF(e){let t;if(e<16&&(t=fH(e)))return t;if(e>64&&fo)return fo.decode(fl.subarray(fm,fm+=e));let i=fm+e,r=[];for(t="";fm<i;){let e=fl[fm++];if((128&e)==0)r.push(e);else if((224&e)==192){let t=63&fl[fm++];r.push((31&e)<<6|t)}else if((240&e)==224){let t=63&fl[fm++],i=63&fl[fm++];r.push((31&e)<<12|t<<6|i)}else if((248&e)==240){let t=(7&e)<<18|(63&fl[fm++])<<12|(63&fl[fm++])<<6|63&fl[fm++];t>65535&&(t-=65536,r.push(t>>>10&1023|55296),t=56320|1023&t),r.push(t)}else r.push(e);r.length>=4096&&(t+=fV.apply(String,r),r.length=0)}return r.length>0&&(t+=fV.apply(String,r)),t}function fj(e){let t=Array(e);for(let i=0;i<e;i++)t[i]=fD();return t}function fU(e){if(fx.mapsAsObjects){let t={};for(let i=0;i<e;i++)t[fY()]=fD();return t}{let t=new Map;for(let i=0;i<e;i++)t.set(fD(),fD());return t}}var fV=String.fromCharCode;function fW(e){let t=fm,i=Array(e);for(let r=0;r<e;r++){let e=fl[fm++];if((128&e)>0){fm=t;return}i[r]=e}return fV.apply(String,i)}function fH(e){if(e<4)if(e<2){if(0===e)return"";{let e=fl[fm++];if((128&e)>1){fm-=1;return}return fV(e)}}else{let t=fl[fm++],i=fl[fm++];if((128&t)>0||(128&i)>0){fm-=2;return}if(e<3)return fV(t,i);let r=fl[fm++];if((128&r)>0){fm-=3;return}return fV(t,i,r)}{let t=fl[fm++],i=fl[fm++],r=fl[fm++],s=fl[fm++];if((128&t)>0||(128&i)>0||(128&r)>0||(128&s)>0){fm-=4;return}if(e<6){if(4===e)return fV(t,i,r,s);{let e=fl[fm++];if((128&e)>0){fm-=5;return}return fV(t,i,r,s,e)}}if(e<8){let a=fl[fm++],o=fl[fm++];if((128&a)>0||(128&o)>0){fm-=6;return}if(e<7)return fV(t,i,r,s,a,o);let h=fl[fm++];if((128&h)>0){fm-=7;return}return fV(t,i,r,s,a,o,h)}{let a=fl[fm++],o=fl[fm++],h=fl[fm++],c=fl[fm++];if((128&a)>0||(128&o)>0||(128&h)>0||(128&c)>0){fm-=8;return}if(e<10){if(8===e)return fV(t,i,r,s,a,o,h,c);{let e=fl[fm++];if((128&e)>0){fm-=9;return}return fV(t,i,r,s,a,o,h,c,e)}}if(e<12){let d=fl[fm++],u=fl[fm++];if((128&d)>0||(128&u)>0){fm-=10;return}if(e<11)return fV(t,i,r,s,a,o,h,c,d,u);let p=fl[fm++];if((128&p)>0){fm-=11;return}return fV(t,i,r,s,a,o,h,c,d,u,p)}{let d=fl[fm++],u=fl[fm++],p=fl[fm++],f=fl[fm++];if((128&d)>0||(128&u)>0||(128&p)>0||(128&f)>0){fm-=12;return}if(e<14){if(12===e)return fV(t,i,r,s,a,o,h,c,d,u,p,f);{let e=fl[fm++];if((128&e)>0){fm-=13;return}return fV(t,i,r,s,a,o,h,c,d,u,p,f,e)}}{let m=fl[fm++],g=fl[fm++];if((128&m)>0||(128&g)>0){fm-=14;return}if(e<15)return fV(t,i,r,s,a,o,h,c,d,u,p,f,m,g);let v=fl[fm++];if((128&v)>0){fm-=15;return}return fV(t,i,r,s,a,o,h,c,d,u,p,f,m,g,v)}}}}}function fG(e){return fx.copyBuffers?Uint8Array.prototype.slice.call(fl,fm,fm+=e):fl.subarray(fm,fm+=e)}function fq(e){let t=fl[fm++];if(f_[t])return f_[t](fl.subarray(fm,fm+=e));throw Error("Unknown extension type "+t)}var fX=Array(4096);function fY(){let e=fl[fm++];if(!(e>=160)||!(e<192))return fm--,fD();if(e-=160,fw>=fm)return fd.slice(fm-fb,(fm+=e)-fb);if(!(0==fw&&fh<180))return fk(e);let t=(e<<5^(e>1?ff.getUint16(fm):e>0?fl[fm]:0))&4095,i=fX[t],r=fm,s=fm+e-3,a,o=0;if(i&&i.bytes==e){for(;r<s;){if((a=ff.getUint32(r))!=i[o++]){r=0x70000000;break}r+=4}for(s+=3;r<s;)if((a=fl[r++])!=i[o++]){r=0x70000000;break}if(r===s)return fm=r,i.string;s-=3,r=fm}for(i=[],fX[t]=i,i.bytes=e;r<s;)a=ff.getUint32(r),i.push(a),r+=4;for(s+=3;r<s;)a=fl[r++],i.push(a);let h=e<16?fH(e):fW(e);return null!=h?i.string=h:i.string=fk(e)}var fQ=(e,t)=>{var i=fD();let r=e;void 0!==t&&(e=e<32?-((t<<5)+e):(t<<5)+e,i.highByte=t);let s=fc[e];return s&&s.isShared&&((fc.restoreStructures||(fc.restoreStructures=[]))[e]=s),fc[e]=i,i.read=fL(i,r),i.read()},fZ="object"==typeof self?self:e.g;f_[0]=()=>{},f_[0].noBuffer=!0,f_[101]=()=>{let e=fD();return(fZ[e[0]]||Error)(e[1])},f_[105]=e=>{let t=ff.getUint32(fm-4);fp||(fp=new Map);let i=fl[fm],r,s={target:r=i>=144&&i<160||220==i||221==i?[]:{}};fp.set(t,s);let a=fD();return s.used?Object.assign(r,a):(s.target=a,a)},f_[112]=e=>{let t=ff.getUint32(fm-4),i=fp.get(t);return i.used=!0,i.target},f_[115]=()=>new Set(fD());var fK=["Int8","Uint8","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64","BigInt64","BigUint64"].map(e=>e+"Array");function fJ(e){let t=fh,i=fm,r=fy,s=fb,a=fw,o=fd,h=fv,c=fp,d=fu,u=new Uint8Array(fl.slice(0,fh)),p=fc,f=fc.slice(0,fc.length),m=fx,g=fE,v=e();return fh=t,fm=i,fy=r,fb=s,fw=a,fd=o,fv=h,fp=c,fu=d,fl=u,fE=g,(fc=p).splice(0,fc.length,...f),fx=m,ff=new DataView(fl.buffer,fl.byteOffset,fl.byteLength),v}function f$(){fl=null,fp=null,fc=null}f_[116]=e=>{let t=e[0],i=fK[t];
3139if(!i)throw Error("Could not find typed array for code "+t);return new fZ[i](Uint8Array.prototype.slice.call(e,1).buffer)},f_[120]=()=>{let e=fD();return new RegExp(e[0],e[1])},f_[98]=e=>{let t=(e[0]<<24)+(e[1]<<16)+(e[2]<<8)+e[3],i=fm;fm+=t-4,(fu=[fD(),fD()]).position0=0,fu.position1=0;let r=fm;fm=i;try{return fD()}finally{fm=r}},f_[255]=e=>new Date(4==e.length?(0x1000000*e[0]+(e[1]<<16)+(e[2]<<8)+e[3])*1e3:8==e.length?((e[0]<<22)+(e[1]<<14)+(e[2]<<6)+(e[3]>>2))/1e6+((3&e[3])*0x100000000+0x1000000*e[4]+(e[5]<<16)+(e[6]<<8)+e[7])*1e3:12==e.length?((e[0]<<24)+(e[1]<<16)+(e[2]<<8)+e[3])/1e6+((128&e[4]?-0x1000000000000:0)+0x10000000000*e[6]+0x100000000*e[7]+0x1000000*e[8]+(e[9]<<16)+(e[10]<<8)+e[11])*1e3:"invalid");var f0=Array(147);for(let e=0;e<256;e++)f0[e]=+("1e"+Math.floor(45.15-.30103*e));var f1=new fA({useRecords:!1});new Uint8Array((f1.unpack,f1.unpackMultiple,f1.unpack,new Float32Array(1)).buffer,0,4);try{f2=new TextEncoder}catch{}var f2,f3,f4,f5,f6,f8,f9="u">typeof tm.Buffer,f7=f9?tm.Buffer.allocUnsafeSlow:Uint8Array,me=f9?tm.Buffer:Uint8Array,mt=f9?0x100000000:0x7fd00000,mi=0,mr=null,ms=/[\u0080-\uFFFF]/,ma=Symbol("record-id"),mn=class extends fA{constructor(e){super(e),this.offset=0;let t,i,r,s,a,o=0,h=me.prototype.utf8Write?function(e,t,i){return f5.utf8Write(e,t,i)}:!!f2&&!!f2.encodeInto&&function(e,t){return f2.encodeInto(e,f5.subarray(t)).written},c=this;e||(e={});let d=e&&e.sequential,u=e.structures||e.saveStructures,p=e.maxSharedStructures;if(null==p&&(p=32*!!u),p>8160)throw Error("Maximum maxSharedStructure is 8160");let f=e.maxOwnStructures;null==f&&(f=u?32:64),d&&!e.saveStructures&&(this.structures=[]);let m=p>32||f+p>64,g=p+64,v=p+f+64;if(v>8256)throw Error("Maximum maxSharedStructure + maxOwnStructure is 8192");let y=[],x=0,b=0;this.pack=this.encode=function(e,h){if(f5||(f6=new DataView((f5=new f7(8192)).buffer,0,8192),mi=0),(f8=f5.length-10)-mi<2048?(f6=new DataView((f5=new f7(f5.length)).buffer,0,f5.length),f8=f5.length-10,mi=0):mi=mi+7&0x7ffffff8,t=mi,a=c.structuredClone?new Map:null,c.bundleStrings?(mr=["",""],f5[mi++]=214,f5[mi++]=98,mr.position=mi-t,mi+=4):mr=null,i=c.structures){i.uninitialized&&(i=c._mergeStructures(c.getStructures()));let e=i.sharedLength||0;if(e>p)throw Error("Shared structures is larger than maximum shared structures, try increasing maxSharedStructures to "+i.sharedLength);if(!i.transitions){i.transitions=Object.create(null);for(let t=0;t<e;t++){let e=i[t];if(!e)continue;let r,s=i.transitions;for(let t=0,i=e.length;t<i;t++){let i=e[t];(r=s[i])||(r=s[i]=Object.create(null)),s=r}s[ma]=t+64}o=e}d||(i.nextId=e+64)}r&&(r=!1),s=i||[];try{if(w(e),mr){f6.setUint32(mr.position+t,mi-mr.position-t);let e=mr;mr=null,w(e[0]),w(e[1])}if(c.offset=mi,a&&a.idsToInsert){(mi+=6*a.idsToInsert.length)>f8&&S(mi),c.offset=mi;let e=function(e,t){let i,r=6*t.length,s=e.length-r;for(t.sort((e,t)=>e.offset>t.offset?1:-1);i=t.pop();){let t=i.offset,a=i.id;e.copyWithin(t+r,t,s);let o=t+(r-=6);e[o++]=214,e[o++]=105,e[o++]=a>>24,e[o++]=a>>16&255,e[o++]=a>>8&255,e[o++]=255&a,s=t}return e}(f5.subarray(t,mi),a.idsToInsert);return a=null,e}return h&mm?(f5.start=t,f5.end=mi,f5):f5.subarray(t,mi)}finally{if(i){if(b<10&&b++,x>1e4)i.transitions=null,b=0,x=0,y.length>0&&(y=[]);else if(y.length>0&&!d){for(let e=0,t=y.length;e<t;e++)y[e][ma]=0;y=[]}if(r&&c.saveStructures){let r=i.sharedLength||p;i.length>r&&(i=i.slice(0,r));let s=f5.subarray(t,mi);return!1===c.saveStructures(i,o)?(c._mergeStructures(c.getStructures()),c.pack(e)):(o=r,s)}}h&mg&&(mi=t)}};let w=e=>{mi>f8&&(f5=S(mi));var i,r=typeof e;if("string"===r){let t,r=e.length;if(mr&&r>=8&&r<4096){let t=ms.test(e);mr[+!t]+=e,f5[mi++]=193,w(t?-r:r);return}t=r<32?1:r<256?2:r<65536?3:5;let s=3*r;if(mi+s>f8&&(f5=S(mi+s)),r<64||!h){let s,a,o,h=mi+t;for(s=0;s<r;s++)(a=e.charCodeAt(s))<128?f5[h++]=a:(a<2048?f5[h++]=a>>6|192:((64512&a)==55296&&(64512&(o=e.charCodeAt(s+1)))==56320?(a=65536+((1023&a)<<10)+(1023&o),s++,f5[h++]=a>>18|240,f5[h++]=a>>12&63|128):f5[h++]=a>>12|224,f5[h++]=a>>6&63|128),f5[h++]=63&a|128);i=h-mi-t}else i=h(e,mi+t,s);i<32?f5[mi++]=160|i:i<256?(t<2&&f5.copyWithin(mi+2,mi+1,mi+1+i),f5[mi++]=217,f5[mi++]=i):i<65536?(t<3&&f5.copyWithin(mi+3,mi+2,mi+2+i),f5[mi++]=218,f5[mi++]=i>>8,f5[mi++]=255&i):(t<5&&f5.copyWithin(mi+5,mi+3,mi+3+i),f5[mi++]=219,f6.setUint32(mi,i),mi+=4),mi+=i}else if("number"===r)if(e>>>0===e)e<64?f5[mi++]=e:e<256?(f5[mi++]=204,f5[mi++]=e):e<65536?(f5[mi++]=205,f5[mi++]=e>>8,f5[mi++]=255&e):(f5[mi++]=206,f6.setUint32(mi,e),mi+=4);else if((0|e)===e)e>=-32?f5[mi++]=256+e:e>=-128?(f5[mi++]=208,f5[mi++]=e+256):e>
3139=-32768?(f5[mi++]=209,f6.setInt16(mi,e),mi+=2):(f5[mi++]=210,f6.setInt32(mi,e),mi+=4);else{let t;if((t=this.useFloat32)>0&&e<0x100000000&&e>=-0x80000000){let i;if(f5[mi++]=202,f6.setFloat32(mi,e),t<4||(0|(i=e*f0[(127&f5[mi])<<1|f5[mi+1]>>7]))===i){mi+=4;return}mi--}f5[mi++]=203,f6.setFloat64(mi,e),mi+=8}else if("object"===r)if(e){if(a){let i=a.get(e);if(i){i.id||(i.id=(a.idsToInsert||(a.idsToInsert=[])).push(i)),f5[mi++]=214,f5[mi++]=112,f6.setUint32(mi,i.id),mi+=4;return}a.set(e,{offset:mi-t})}let r=e.constructor;if(r===Object)_(e,!0);else if(r===Array){(i=e.length)<16?f5[mi++]=144|i:i<65536?(f5[mi++]=220,f5[mi++]=i>>8,f5[mi++]=255&i):(f5[mi++]=221,f6.setUint32(mi,i),mi+=4);for(let t=0;t<i;t++)w(e[t])}else if(r===Map)for(let[t,r]of((i=e.size)<16?f5[mi++]=128|i:i<65536?(f5[mi++]=222,f5[mi++]=i>>8,f5[mi++]=255&i):(f5[mi++]=223,f6.setUint32(mi,i),mi+=4),e))w(t),w(r);else{for(let t=0,i=f3.length;t<i;t++)if(e instanceof f4[t]){let i,r=f3[t];if(r.write){r.type&&(f5[mi++]=212,f5[mi++]=r.type,f5[mi++]=0),w(r.write.call(this,e));return}let s=f5,a=f6,o=mi;f5=null;try{i=r.pack.call(this,e,e=>(f5=s,s=null,(mi+=e)>f8&&S(mi),{target:f5,targetView:f6,position:mi-e}),w)}finally{s&&(f5=s,f6=a,mi=o,f8=f5.length-10)}i&&(i.length+mi>f8&&S(i.length+mi),mi=function(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++]=201,t[i++]=s>>24,t[i++]=s>>16&255,t[i++]=s>>8&255),t[i++]=255&s)}return t[i++]=r,t.set(e,i),i+=s}(i,f5,mi,r.type));return}_(e,!e.hasOwnProperty)}}else f5[mi++]=192;else if("boolean"===r)f5[mi++]=e?195:194;else if("bigint"===r){if(e<BigInt(1)<<BigInt(63)&&e>=-(BigInt(1)<<BigInt(63)))f5[mi++]=211,f6.setBigInt64(mi,e);else if(e<BigInt(1)<<BigInt(64)&&e>0)f5[mi++]=207,f6.setBigUint64(mi,e);else if(this.largeBigIntToFloat)f5[mi++]=203,f6.setFloat64(mi,Number(e));else throw RangeError(e+" was too large to fit in MessagePack 64-bit integer format, set largeBigIntToFloat to convert to float-64");mi+=8}else if("undefined"===r)this.encodeUndefinedAsNil?f5[mi++]=192:(f5[mi++]=212,f5[mi++]=0,f5[mi++]=0);else if("function"===r)w(this.writeFunction&&this.writeFunction());else throw Error("Unknown type: "+r)},_=!1===this.useRecords?this.variableMapSize?e=>{let t,i=Object.keys(e),r=i.length;r<16?f5[mi++]=128|r:r<65536?(f5[mi++]=222,f5[mi++]=r>>8,f5[mi++]=255&r):(f5[mi++]=223,f6.setUint32(mi,r),mi+=4);for(let s=0;s<r;s++)w(t=i[s]),w(e[t])}:(e,i)=>{f5[mi++]=222;let r=mi-t;mi+=2;let s=0;for(let t in e)(i||e.hasOwnProperty(t))&&(w(t),w(e[t]),s++);f5[r+++t]=s>>8,f5[r+t]=255&s}:e=>{let t=Object.keys(e),i,a=s.transitions||(s.transitions=Object.create(null)),o=0;for(let e=0,r=t.length;e<r;e++){let r=t[e];(i=a[r])||(i=a[r]=Object.create(null),o++),a=i}let h=a[ma];if(h)h>=96&&m?(f5[mi++]=(31&(h-=96))+96,f5[mi++]=h>>5):f5[mi++]=h;else{(h=s.nextId)||(h=64),h<g&&this.shouldShareStructure&&!this.shouldShareStructure(t)?((h=s.nextOwnId)<v||(h=g),s.nextOwnId=h+1):(h>=v&&(h=g),s.nextId=h+1);let e=t.highByte=h>=96&&m?h-96>>5:-1;a[ma]=h,s[h-64]=t,h<g?(t.isShared=!0,s.sharedLength=h-63,r=!0,e>=0?(f5[mi++]=(31&h)+96,f5[mi++]=e):f5[mi++]=h):(e>=0?(f5[mi++]=213,f5[mi++]=114,f5[mi++]=(31&h)+96,f5[mi++]=e):(f5[mi++]=212,f5[mi++]=114,f5[mi++]=h),o&&(x+=b*o),y.length>=f&&(y.shift()[ma]=0),y.push(a),w(t))}for(let i=0,r=t.length;i<r;i++)w(e[t[i]])},S=e=>{let i;if(e>0x1000000){if(e-t>mt)throw Error("Packed buffer would be larger than maximum buffer size");i=Math.min(mt,4096*Math.round(Math.max((e-t)*(e>0x4000000?1.25:2),4194304)/4096))}else i=(Math.max(e-t<<2,f5.length-1)>>12)+1<<12;let r=new f7(i);return f6=new DataView(r.buffer,0,i),f5.copy?f5.copy(r,0,t,e):r.set(f5.slice(t,e)),mi-=t,t=0,f8=r.length-10,f5=r}}useBuffer(e){f6=new DataView((f5=e).buffer,f5.byteOffset,f5.byteLength),mi=0}};function mo(e,t,i,r){let s=e.byteLength;if(s+1<256){var{target:a,position:o}=i(4+s);a[o++]=199,a[o++]=s+1}else if(s+1<65536){var{target:a,position:o}=i(5+s);a[o++]=200,a[o++]=s+1>>8,a[o++]=s+1&255}else{var{target:a,position:o,targetView:h}=i(7+s);a[o++]=201,h.setUint32(o,s+1),o+=4}a[o++]=116,a[o++]=t,a.set(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),o)}function ml(e,t){let i=e.byteLength;if(i<256){var r,s,{target:r,position:s}=t(i+2);
3139r[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++]=255&i}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 mh(e){if(e.Class){if(!e.pack&&!e.write)throw Error("Extension has no pack or write function");if(e.pack&&!e.type)throw Error("Extension has no type (numeric code to identify the extension)");f4.unshift(e.Class),f3.unshift(e)}e.unpack?f_[e.type]=e.unpack:f_[e.type]=e}f4=[Date,Set,Error,RegExp,ArrayBuffer,Object.getPrototypeOf(Uint8Array.prototype).constructor,fC],f3=[{pack(e,t,i){let r=e.getTime()/1e3;if((this.useTimestamp32||0===e.getMilliseconds())&&r>=0&&r<0x100000000){let{target:e,targetView:i,position:s}=t(6);e[s++]=214,e[s++]=255,i.setUint32(s,r)}else if(r>0&&r<0x400000000){let{target:i,targetView:s,position:a}=t(10);i[a++]=215,i[a++]=255,s.setUint32(a,4e6*e.getMilliseconds()+(r/1e3/0x100000000|0)),s.setUint32(a+4,r)}else if(isNaN(r)){if(this.onInvalidDate)return t(0),i(this.onInvalidDate());let{target:e,targetView:r,position:s}=t(3);e[s++]=212,e[s++]=255,e[s++]=255}else{let{target:i,targetView:s,position:a}=t(15);i[a++]=199,i[a++]=12,i[a++]=255,s.setUint32(a,1e6*e.getMilliseconds()),s.setBigInt64(a+4,BigInt(Math.floor(r)))}}},{pack(e,t,i){let r=Array.from(e),{target:s,position:a}=t(3*!!this.structuredClone);this.structuredClone&&(s[a++]=212,s[a++]=115,s[a++]=0),i(r)}},{pack(e,t,i){let{target:r,position:s}=t(3*!!this.structuredClone);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(3*!!this.structuredClone);this.structuredClone&&(r[s++]=212,r[s++]=120,r[s++]=0),i([e.source,e.flags])}},{pack(e,t){this.structuredClone?mo(e,16,t):ml(f9?tm.Buffer.from(e):new Uint8Array(e),t)}},{pack(e,t){let i=e.constructor;i!==me&&this.structuredClone?mo(e,fK.indexOf(i.name),t):ml(e,t)}},{pack(e,t){let{target:i,position:r}=t(1);i[r]=193}}];var mc=new mn({useRecords:!1});mc.pack,mc.pack;var{NEVER:md,ALWAYS:mu,DECIMAL_ROUND:mp,DECIMAL_FIT:mf}={NEVER:0,ALWAYS:1,DECIMAL_ROUND:3,DECIMAL_FIT:4},mm=512,mg=1024,mv=new mn({structuredClone:!0});mh({Class:p_.prototype.constructor,type:1,write:e=>({...e}),read:e=>(Object.setPrototypeOf(e,p_.prototype),e)}),mh({Class:pP.prototype.constructor,type:2,write:e=>[...e],read:e=>(Object.setPrototypeOf(e,pP.prototype),e)}),mh({Class:pT.prototype.constructor,type:3,write:e=>[...e],read:e=>(Object.setPrototypeOf(e,pT.prototype),e)}),mh({Class:fe.prototype.constructor,type:4,write:e=>e.id,read:e=>new fe(e)}),mh({Class:ft.prototype.constructor,type:5,write:e=>e.data,read:e=>new ft(e)}),mh({Class:pR.prototype.constructor,type:6,write:e=>({...e}),read:e=>(Object.setPrototypeOf(e,pR.prototype),e)});var my=m_||(m_={});function mx(e){return mv.pack(e)}function mb(e){return"MouseDown"===e||"MouseUp"===e||"KeyDown"===e||"KeyUp"===e||"Collision"===e||"Trigger"===e}my.serialize=mx,my.deserialize=function(e){return mv.unpack(e)},my.checksum=function(e){return(function(e){var t=0;if(0===e.length)return t;for(let i=0;i<e.length;i++)t=(t<<5)-t+e[i],t&=t;return t})(mx(function e(t){if(pA(t))return t;if(Array.isArray(t))return t.map(e);if("object"!=typeof t||null===t)return t;{let i={};for(let r of Object.keys(t).sort())i[r]=e(t[r]);return Object.setPrototypeOf(i,Object.getPrototypeOf(t)),i}}(e))).toString()},(mw=mS||(mS={})).toEventUIType=function(e){return"Conditional"===e.type?"Distance"===e.condition.type?"Distance":"StateChange":e.type},mw.fromEventUIType=function(e){return"Distance"===e||"StateChange"===e?"Conditional":e};var mw,m_,mS,mC,mM={LookAt:[],Follow:["Create"],DragDrop:["Transition","Animation","Audio","Particles","Create","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],MouseHover:["Transition","Animation","TimelineAnimation","Particles","Create","Destroy","SwitchCamera","SceneTransition","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],Scroll:["Transition","Animation","TimelineAnimation","Create","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],Start:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],Conditional:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],MouseDown:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],MouseUp:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],MousePress:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],KeyDown:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],KeyUp:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],KeyPress:["Transition","Animation","Audio","Particles","Video","Link","Create","SwitchCamera","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],GameControl:["Transition","Animation","TimelineAnimation","Audio","Particles","Create","Conditional"],Collision:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Create","Destroy","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],Trigger:["Transition","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],Resize:["Transition","Animation","Audio","Particles","Video","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],VariableChange:["Transition","Animation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],API:["Transition","Animation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],WEBHOOK:["Transition","Animation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],AIAssistantListener:["SetVariable"],AIAssistantTrigger:["Transition","Animation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"]};(mT=mC||(mC={})).is=function(e){return"MouseDown"===e.type||"MouseUp"===e.type||"MousePress"===e.type||"KeyDown"===e.type||"KeyUp"===e.type||"KeyPress"===e.type},mT.defaultData=function(e){return"MouseDown"===e||"MouseUp"===e||"MousePress"===e?{type:e,mode:"Object",disabled:!1,actions:new pP}:{type:e,disabled:!1,key:void 0,actions:new pP}},(mP=mY||(mY={})).propertyDefaultData=function(e){return{type:"Property",value:[e??null,"position","x"]}},mP.valueDefaultData={type:"Literal",value:0},(mD=mQ||(mQ={})).comparisonDefaultData=function(e){return{type:"Comparison",operator:"==",lOperand:mY.propertyDefaultData(e),rOperand:{...mY.valueDefaultData}}},mD.distanceDefaultData=function(e){return{type:"Distance",toObject:e??null,fromObject:e??null,distance:200}},mD.stateDefaultData=function(e,t){return{type:"State",object:e??null,state:t??null}},(mZ||(mZ={})).isConditionalSubActions=function(e){return void 0!==e.find(e=>"ifActions"===e||"elseActions"===e)},(mO=mK||(mK={})).is=function(e){return"Conditional"===e.type},mO.defaultData=function(e){return{type:"Conditional",disabled:!1,inActions:new pP,outActions:new pP,condition:mQ.distanceDefaultData(e)}},(mJ||(mJ={})).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 pP,drop:new pP}},(m$||(m$={})).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 pP},(m0||(m0={})).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},(mL=m1||(m1={})).is=function(e){return"MouseHover"===e.type},mL.defaultData=function(){return{type:"MouseHover",disabled:!1,actions:new pP}},(mI=m2||(m2={})).is=function(e){return"Scroll"===e.type},mI.defaultData=function(){return{type:"Scroll",disabled:!1,steps:100,trigger:"load",startFrom:"enter",enterAnchor:"top",startOffset:0,endAfter:400,actions:new pP}},(mR=m3||(m3={})).is=function(e){return"Start"===e.type},mR.defaultData=function(){return{type:"Start",disabled:!1,actions:new pP}},(mk=m4||(m4={})).is=function(e){return"Collision"===e.type},mk.defaultData=function(){return{type:"Collision",disabled:!1,target:"character",actions:new pP}},(mB=m5||(m5={})).is=function(e){return"Trigger"===e.type},mB.defaultData=function(e,t){return{type:"Trigger",disabled:!1,target:"all",triggeringObjects:[],actions:new pP,triggerZone:"box",position:t.toArray(),rotation:[0,0,0],size:e.toArray(),radius:e.length()/2,helperVisible:!0}},(mz=m6||(m6={}
vendor: 4,513 bytes, line 3139
3139)).defaultSizes={mobile:[480,480],tablet:[768,768],desktop:[1200,1200],custom:[769,1200]},mz.is=function(e){return"Resize"===e.type},mz.sizeToDevice=function(e){return"string"==typeof e?e:"custom"},mz.deviceToSize=function(e){return"string"==typeof e?[...mz.defaultSizes[e]]:[...e]},mz.defaultData=function(){let e={size:"mobile",operator:"<",actions:new pP},t={size:"tablet",operator:"<",actions:new pP},i={size:[...mz.defaultSizes.custom],operator:"<>",actions:new pP},r=new pP;return r.push({id:tQ.generateUUID(),fi:0,data:e},{id:tQ.generateUUID(),fi:1,data:t},{id:tQ.generateUUID(),fi:2,data:i}),{type:"Resize",disabled:!1,orientation:"horizontal",breakpoints:r}},mz.defaultBreakpointData=function(){return{size:[...mz.defaultSizes.custom],operator:"<>",actions:new pP}},(mN=m8||(m8={})).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"]},mN.is=function(e){return"VariableChange"===e.type},mN.defaultData=function(){return{disabled:!1,type:"VariableChange",actions:new pP,variableId:"",objectId:null,property:"Position X"}},(mF=m9||(m9={})).is=function(e){return"API"===e.type},mF.defaultData=function(){return{disabled:!1,type:"API",successActions:new pP,errorActions:new pP,userAPIId:""}},(mj=m7||(m7={})).is=function(e){return"WEBHOOK"===e.type},mj.defaultData=function(){return{disabled:!1,type:"WEBHOOK",actions:new pP,userWebhookId:""}},(mU=ge||(ge={})).is=function(e){return"AIAssistantListener"===e.type},mU.defaultData=function(){return{disabled:!1,type:"AIAssistantListener",actions:new pP,analysis:"average",analysisRange:[0,71],analysisSingle:0}},(mV=gt||(gt={})).is=function(e){return"AIAssistantTrigger"===e.type},mV.defaultData=function(){return{disabled:!1,description:"",type:"AIAssistantTrigger",actions:new pP}};var mE="personal camera",mA="a218fcc3-276b-49b9-b485-49037fd14f5f";(e=>{function t(e,t){return Math.pow(t[0]-e[0],2)+Math.pow(t[1]-e[1],2)}function i(e,i){return Math.sqrt(t(e,i))}function r(t,i,r){let s=e.sub(i,t),a=e.sub(r,t),o=e.dot(s,a)/e.dot(s,s),h=e.scalarMultiply(s,o);return e.add(t,h)}e.isEqual=function(e,t){return e[0]===t[0]&&e[1]===t[1]},e.lerp=function(e,t,i){return[e[0]+(t[0]-e[0])*i,e[1]+(t[1]-e[1])*i]},e.add=function(e,t){return[e[0]+t[0],e[1]+t[1]]},e.sub=function(e,t){return[e[0]-t[0],e[1]-t[1]]},e.multiply=function(e,t){return[e[0]*t[0],e[1]*t[1]]},e.divide=function(e,t){return[e[0]/t[0],e[1]/t[1]]},e.distanceSquared=t,e.distance=i,e.dot=function(e,t){return e[0]*t[0]+e[1]*t[1]},e.scalarMultiply=function(e,t){return[e[0]*t,e[1]*t]},e.projectionOnto=r,e.projectionOntoDistance=function(e,t,s){return i(e,r(e,t,s))},e.center=function(e,t){return[(e[0]+t[0])*.5,(e[1]+t[1])*.5]}})(gi||(gi={})),(mW=gr||(gr={})).isEqual=function(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]},mW.add=function(e,t){return[e[0]+t[0],e[1]+t[1],e[2]+t[2]]},mW.sub=function(e,t){return[e[0]-t[0],e[1]-t[1],e[2]-t[2]]},mW.div=function(e,t){return[e[0]/t[0],e[1]/t[1],e[2]/t[2]]},mW.mul=function(e,t){return[e[0]*t[0],e[1]*t[1],e[2]*t[2]]},mW.dist=function(e,t){return Math.hypot(e[0]-t[0],e[1]-t[1],e[2]-t[2])},mW.lerp=function(e,t,i){return[e[0]+(t[0]-e[0])*i,e[1]+(t[1]-e[1])*i,e[2]+(t[2]-e[2])*i]},(mH=gs||(gs={})).isEqual=function(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]},mH.lerp=function(e,t,i){return[e[0]+(t[0]-e[0])*i,e[1]+(t[1]-e[1])*i,e[2]+(t[2]-e[2])*i,e[3]+(t[3]-e[3])*i]},(e=>{let t=180/Math.PI,i=Math.PI/180;function r(e){return"number"==typeof e?e*t:e}function s(e){return"number"==typeof e?e*i:e}e.radToDeg=function(e){return[r(e[0]),r(e[1]),r(e[2])]},e.degToRad=function(e){return[s(e[0]),s(e[1]),s(e[2])]}})(ga||(ga={})),(mG=gn||(gn={})).identity=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],mG.isEqual=function(e,t){for(let i=0;i<16;i++)if(e[i]!==t[i])return!1;return!0},mG.simplify=function(e){return e??mG.identity}
vendor: 2,250 bytes, line 3139
3139,mG.applyMatrix4=function(e,t){let i=t.slice(0);for(var r=0,s=t.length;r<s;r+=3){let s=e[3]*t[r]+e[7]*t[r+1]+e[11]*t[r+2]+e[15];i[r]=(e[0]*t[r]+e[4]*t[r+1]+e[8]*t[r+2]+e[12])/s,i[r+1]=(e[1]*t[r]+e[5]*t[r+1]+e[9]*t[r+2]+e[13])/s,i[r+2]=(e[2]*t[r]+e[6]*t[r+1]+e[10]*t[r+2]+e[14])/s}return i},(mq=go||(go={})).isRGB=function(e){return"object"==typeof e&&"number"==typeof e.r&&"number"==typeof e.g&&"number"==typeof e.b},mq.white={r:1,g:1,b:1},mq.red={r:1,g:0,b:0},mq.black={r:0,g:0,b:0},mq.toRgb255a1=function(e){return{r:Math.round(255*e.r),g:Math.round(255*e.g),b:Math.round(255*e.b),a:1}},mq.clone=function(e){return{r:e.r,g:e.g,b:e.b}},mq.fromHex=function(e){return{r:((e=Math.floor(e))>>16&255)/255,g:(e>>8&255)/255,b:(255&e)/255}},mq.toHex=function(e){return 65536*Math.round(255*e.r)+256*Math.round(255*e.g)+Math.round(255*e.b)},mq.equals=function(e,t){return e.r===t.r&&e.g===t.g&&e.b===t.b},mq.equalsFixed=function(e,t){return e.r.toFixed(2)===t.r.toFixed(2)&&e.g.toFixed(2)===t.g.toFixed(2)&&e.b.toFixed(2)===t.b.toFixed(2)},mq.lerp=function(e,t,i){return{r:e.r+(t.r-e.r)*i,g:e.g+(t.g-e.g)*i,b:e.b+(t.b-e.b)*i}},mq.is=function(e){return!!hY(e)&&"r"in e&&"g"in e&&"b"in e&&!("a"in e)},(mX=gl||(gl={})).white={...go.white,a:1},mX.is=function(e){return!!hY(e)&&"r"in e&&"g"in e&&"b"in e&&"a"in e},mX.transparent={...go.white,a:0},mX.from0to1=function(e){return{r:e[0],g:e[1],b:e[2],a:e[3]}},mX.fromHexAndA=function(e,t){return{...go.fromHex(e),a:t}},mX.toRgb255a1=function(e){return{r:Math.round(255*e.r),g:Math.round(255*e.g),b:Math.round(255*e.b),a:e.a}},mX.equals=function(e,t){return go.equals(e,t)&&e.a===t.a},mX.equalsFixed=function(e,t){return go.equalsFixed(e,t)&&e.a.toFixed(2)===t.a.toFixed(2)},mX.lerp=function(e,t,i){return{r:e.r+(t.r-e.r)*i,g:e.g+(t.g-e.g)*i,b:e.b+(t.b-e.b)*i,a:e.a+(t.a-e.a)*i}},mX.toStyle=function({r:e,g:t,b:i,a:r}=mX.white){return`rgba(${255*e}, ${255*t}, ${255*i}, ${r})`},(gh||(gh={})).identity={position:[0,0,0],rotation:[0,0,0],scale:[1,1,1]};var mT,mP,mD,mO,mL,mI,mR,mk,mB,mz,mN,mF,mj,mU,mV,mW,mH,mG,mq,mX,mY,mQ,mZ,mK,mJ,m$,m0,m1,m2,m3,m4,m5,m6,m8,m9,m7,ge,gt,gi,gr,gs,ga,gn,go,gl,gh,gc,gd=((t=gd||{})[t.LINEAR=0]="LINEAR",t[t.EASE=1]="EASE",t[t.EASE_IN=2]="EASE_IN",t[t.EASE_OUT=3]="EASE_OUT",t[t.EASE_IN_O
3139UT=4]="EASE_IN_OUT",t[t.CUBIC=5]="CUBIC",t[t.SPRING=6]="SPRING",t[t.ARC=7]="ARC",t[t.NONE=8]="NONE",t);function gu(e){return"string"==typeof e&&36===e.length&&/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e)}(gc||(gc={})).defaultData={mass:1,stiffness:80,damping:10,velocity:0},(gE||(gE={})).defaultData={control1:[.5,0],control2:[.5,1]},(i=gA||(gA={})).linear=[0,0,1,1],i.ease=[.25,.1,.25,1],i.easeIn=[.42,0,1,1],i.easeOut=[0,0,.58,1],i.easeInOut=[.42,0,.58,1],(gx=gT||(gT={})).all=["PerspectiveCamera","OrthographicCamera"],gx.is=function(e){return gx.all.includes(e)},(gb=gP||(gP={})).DefaultUp=[0,1,0],gb.DefaultTargetOffset=1e3,gb.defaultData={far:1e5,type:"OrthographicCamera",perspective:{near:70,fov:45,zoom:1},orthographic:{near:-1e5,zoom:1},up:gb.DefaultUp,isUpVectorFlipped:!1,targetOffset:gb.DefaultTargetOffset},gb.getZoom=function(e){return"PerspectiveCamera"===e.type?e.perspective?.zoom??1:e.orthographic?.zoom??1},(gw=gD||(gD={})).defaultData=function(e,t=.1){return{disabled:!1,type:"linear",hideBase:!1,count:3,radial:{radius:2*Math.max(e[0],e[1]),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:[e[0]+e[0]*t,0,0]},grid:{count:[2,2,2],size:e.map(e=>e*(1+t)),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"}}},gw.merge=function(e,t){let i={...e};if(gp.forEach(r=>{Object.assign(i,{[r]:t[r]??e[r]})}),i.radial={...e.radial},t.radial){let r=e.radial,s=t.radial;gf.forEach(e=>{Object.assign(i.radial,{[e]:s[e]??r[e]})})}if(i.linear={...e.linear},t.linear){let r=e.linear,s=t.linear;gm.forEach(e=>{Object.assign(i.linear,{[e]:s[e]??r[e]})})}if(i.grid={...e.grid},t.grid){let r=e.grid,s=t.grid;gg.forEach(e=>{Object.assign(i.grid,{[e]:s[e]??r[e]})})}if(i.toObject={...e.toObject},t.toObject){let r=e.toObject,s=t.toObject;gv.forEach(e=>{Object.assign(i.toObject,{[e]:s[e]??r[e]})})}if(i.randomnessObject={...e.randomnessObject},t.randomnessObject){let r=e.randomnessObject,s=t.randomnessObject;gy.forEach(e=>{Object.assign(i.randomnessObject,{[e]:s[e]??r[e]})})}return i},gw.isPartial=function(e){return!!(e.randomnessObject||e.toObject)},(g_=gO||(gO={})).defaultData={radial:{},linear:{},grid:{},toObject:{},randomnessObject:{}},r=["radial","linear","grid","toObject","randomnessObject"],g_.toOps=function(e,t){let i=[];for(let s of(void 0!==e.count&&i.push({type:0,path:t,props:{count:e.count}}),r)){let r=e[s];r&&Object.keys(r).length>0&&i.push({type:0,path:[...t,s],props:r})}return i};var gp=["count"],gf=["radius","start","end","position","scale","rotation"],gm=["position","scale","rotation"],gg=["count","size"],gv=["count","position","scale","rotation"],gy=["strength","scale","rotation","position","movement","seed","freqScale"];(gS=gL||(gL={})).all=["PointLight","SpotLight","DirectionalLight","HemisphereLight"],gS.is=function(e){return gS.all.includes(e)},(gI||(gI={})).defaultData=function(e){var t=e;if("PointLight"===t)return{type:t,color:gl.white,intensity:1,distance:2e3,decay:1,shadows:!0,shadowResolution:1024,shadowRadius:1,penumbraSize:.5,depth:1e5};if("SpotLight"===t)return{type:t,color:gl.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("DirectionalLight"===t)return{type:t,color:gl.white,intensity:1,shadows:!0,size:2e3,depth:1e5,penumbraSize:.5,shadowResolution:1024,shadowRadius:1};throw Error("not implemented")},(s=gR||(gR={})).defaultShapeData={type:"PlaneEmitterShape",size:[100,100,100]},s.defaultCollisionData={colliderEntityId:null,collisionBounce:.75},s.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:s.defaultShapeData,autoPlay:!0,emitTimeDelay:0,emitTimeCycle:"infinity",emitTimeDuration:1,...s.defaultCollisionData},(gk||(gk={})).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]},(gC=gB||(gB={})).defaultData={castShadow:!0,receiveShadow:!0}
vendor: 10,255 bytes, line 3139
3139,gC.equals=function(e,t){return e.castShadow===t.castShadow&&e.receiveShadow===t.receiveShadow},(gM=gz||(gz={})).defaultData={flatShading:!1,wireframe:!1,side:0},gM.equals=function(e,t){return e.flatShading===t.flatShading&&e.side===t.side&&e.wireframe===t.wireframe},(gN||(gN={})).defaultData={...gz.defaultData,...gB.defaultData},(gF||(gF={})).getMaterialData=function(e,t){let i=[];if("material"in e){let r="string"==typeof e.material?t.materials[e.material]??t.lib.materials[e.material]?.asset:e.material;r&&i.push(r)}else if("materials"in e)for(let r of e.materials){let e="string"==typeof r?t.materials[r]??t.lib.materials[r]?.asset:r;e&&i.push(e)}return i},(a=gj||(gj={})).defaultVideo={data:"",thumb:"/_assets/_videos/catThumb.png",type:"video",name:"Cat video"},a.maxSize=3e7,(gU||(gU={})).is=function(e){return"texture"===e||"video"===e||"color"===e||"depth"===e||"normal"===e||"gradient"===e||"noise"===e||"fresnel"===e||"rainbow"===e||"toon"===e||"outline"===e||"particle"===e||"transmission"===e||"matcap"===e||"displace"===e||"pattern"===e||"light"===e},(gV||(gV={})).is=function(e){return"phong"===e||"toon"===e||"lambert"===e||"physical"===e};var gx,gb,gw,g_,gS,gC,gM,gE,gA,gT,gP,gD,gO,gL,gI,gR,gk,gB,gz,gN,gF,gj,gU,gV,gW,gH=["mode","gradientType","noiseType","displacementType","projection","cnormal","crop","axis","side"],gG=["wrapping","image","video","name","minFilter","magFilter"];(gJ=gW||(gW={})).patch=function(e,t){let{texture:i,...r}=t;if(Object.assign(e,r),i){let t=e.texture;t&&Object.assign(t,i)}},gJ.defaultData=function(e,t){return"light"===e&&t?function(e){let t={mode:0,isMask:!1,visible:!0,bumpMap:void 0,bumpMapIntensity:5,roughnessMap:void 0,alphaOverride:1};switch(e){case"phong":return{...t,category:"phong",specular:{r:.2,g:.2,b:.2},shininess:5,type:"light",visible:!0,mode:0,occlusion:!0,alpha:.6};case"toon":return{...t,category:"toon",specular:{r:.2,g:.2,b:.2},shininess:10,type:"light",alpha:1};case"lambert":return{...t,category:"lambert",emissive:{r:0,g:0,b:0},type:"light",alpha:1,visible:!0,mode:0,occlusion:!0};case"physical":return{...t,category:"physical",roughness:.2,metalness:.2,reflectivity:.2,type:"light",alpha:1,visible:!0,mode:0,occlusion:!0}}}(t):function(e){let t={alpha:1,mode:0,isMask:!1,visible:!0};switch(e){case"texture":return{...t,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{...t,type:"video",size:[128,128],blending:0,axis:"x",side:2,projection:0,texture:{video:gj.defaultVideo,wrapping:1001,repeat:[1,1],offset:[0,0],rotation:0,minFilter:1008,magFilter:1006},crop:!1};case"color":return{...t,type:"color",color:go.fromHex(5526619)};case"depth":return{...t,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{...t,type:"normal",cnormal:[1,1,1]};case"gradient":return{...t,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{...t,type:"noise",size:[100,100,100],noiseType:0,scale:1,move:1,colorA:{...go.fromHex(6710886),a:1},colorB:{...go.fromHex(6710886),a:1},colorC:{...go.fromHex(0xffffff),a:1},colorD:{...go.fromHex(0xffffff),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{...t,type:"fresnel",color:gl.fromHexAndA(0xffffff,1),bias:.1,scale:1,intensity:2,factor:1};case"rainbow":return{...t,type:"rainbow",filmThickness:30,movement:0,wavelengths:[0,0,0],noiseStrength:0,noiseScale:1,offset:[0,0,0]};case"toon":return{...t,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:gl.fromHexAndA(0,0),offset:[0,0,0]};case"outline":return{...t,type:"outline",outlineColor:gl.fromHexAndA(0,1),contourColor:gl.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{...t,type:"matcap",texture:{image:"matcap_0",wrapping:1001,repeat:[1,1],offset:[0,0],rotation:0,minFilter:1008,magFilter:1006}};case"transmission":return{...t,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{...t,type:"pattern",style:0,projection:0,axis:"y",blending:0,offset:[0,0],colorA:{...go.fromHex(0),a:1},colorB:{...go.fromHex(0xffffff),a:1},frequency:[10,10],size:.5,variation:0,smoothness:.5,zigzag:0,rotation:0,vertical:[0,1],horizontal:[0,1],sides:6}}}(e)};var gq=g3||(g3={});function gX(e,t="layer1",i="layer2"){let r=new pP;return r.push({fi:0,data:gW.defaultData("light",e),id:t}),r.push({fi:1,data:gW.defaultData("color"),id:i}),{layers:r}}gq.isMergable=function(e){return!e.layers.some(e=>"texture"===e.data.type&&0!==e.data.projection||"depth"===e.data.type&&!e.data.isWorldSpace||"noise"===e.data.type||"displace"===e.data.type)},gq.getHash=function(e){let t="";return e.layers.forEach(e=>{Object.entries(e.data).forEach(([e,i])=>{t+=`${e}${i}`,Array.isArray(i)?i.forEach(e=>t+=`${e}`):"object"==typeof i?Object.values(i).forEach(e=>{"number"==typeof e?t+=`${e.toFixed(4)}`:t+=`${e}`}):t+=`${i}`})}),t},gq.defaultEmptyData=function(){return{layers:new pP}},gq.defaultData=function(e="layer1",t="layer2"){return gX("phong",e,t)},gq.withName=function(e,t){return{...e,name:t}},gq.defaultTwoLayerData=gX,gq.defaultUIObjectMaterial=function(e){let t=gW.defaultData("texture");e&&Object.assign(t.texture,{image:e});let i=new pP;return i.push({fi:0,data:t,id:"layer1"}),i.push({fi:1,data:{...gW.defaultData("transmission"),alpha:1},id:"layer2"}),i.push({fi:2,data:{...gW.defaultData("light","lambert"),alpha:0},id:"layer3"}),{layers:i}},gq.defaultTwoLayerTextureData=function(e,t="phong",i="layer1",r="layer2"){let s=gW.defaultData("texture");Object.assign(s.texture,{image:e});let a=new pP;return a.push({fi:0,data:s,id:i}),a.push({fi:1,data:gW.defaultData("light",t),id:r}),{layers:a}},gq.defaultTwoLayerVideoTextureData=function(e,t="phong",i="layer1",r="layer2"){let s=gW.defaultData("video");Object.assign(s.texture,{video:e});let a=new pP;return a.push({fi:0,data:s,id:i}),a.push({fi:1,data:gW.defaultData("light",t),id:r}),{layers:a}},(g4||(g4={})).defaultData=function(){return{points:new pP,roundness:0,shapeHoles:[],isClosed:!1}},(g5||(g5={})).defaultData=function(){return{points:new pP,lastInsertionPlane:null,subdivisions:12,isClosed:!1}};var gY={type:"Ellipse",width:50,height:50,spikes:16,angle:360,innerRadius:0};(g6||(g6={})).merge=function(e,t){let i={...e};return gZ.forEach(r=>{Object.assign(i,{[r]:t[r]??e[r]})}),i};var gQ={shape:gY,depth:1,offset:0,bevel:50,bevelSides:6,angle:0,twist:0,startScale:1,endScale:1,capType:"flat"},gZ=["depth","offset","angle","twist","startScale","endScale"];(g$=g8||(g8={})).is2DParametricMesh=function(e){return"PolygonGeometry"===e||"RectangleGeometry"===e||"StarGeometry"===e||"TriangleGeometry"===e||"EllipseGeometry"===e||"UIGeometry"===e},g$.isParametricMesh=function(e){return"PolygonGeometry"===e||"RectangleGeometry"===e||"StarGeometry"===e||"TriangleGeometry"===e||"EllipseGeometry"===e||"PathGeometry"===e||"VectorGeometry"===e||"ConeGeometry"===e||"CubeGeometry"===e||"CylinderGeometry"===e||"DodecahedronGeometry"===e||"HelixGeometry"===e||"IcosahedronGeometry"===e||"LatheGeometry"===e||"PyramidGeometry"===e||"SphereGeometry"===e||"PlaneGeometry"===e||"BackdropGeometry"===e||"TorusGeometry"===e||"TorusKnotGeometry"===e||"BooleanGeometry"===e||"TextGeometry"===e||"InputGeometry"===e},g$.isSwappableGeometry=function(e){return"PolygonGeometry"===e||"RectangleGeometry"===e||"StarGeometry"===e||"TriangleGeometry"===e||"EllipseGeometry"===e||"PathGeometry"===e||"VectorGeometry"===e||"ConeGeometry"===e||"CubeGeometry"===e||"CylinderGeometry"===e||"DodecahedronGeometry"===e||"HelixGeometry"===e||"IcosahedronGeometry"===e||"LatheGeometry"===e||"PyramidGeometry"===e||"SphereGeometry"===e||"PlaneGeometry"===e||"BackdropGeometry"===e||"TorusGeometry"===e||"TorusKnotGeometry"===e||"TextGeometry"===e||"SubdivGeometry"===e||"NonParametricGeometry"===e},(g9||(g9={})).merge=function(e,t){let i={...e};return Object.assign(i,t),"PathGeometry"===i.type&&"extrusion"in t&&t.extrusion&&(i.extrusion={...e.extrusion},Object.assign(i.extrusion,g6.merge(i.extrusion,t.extrusion))),i},(g0=g7||(g7={})).defaultData=function(e){if("RectangleGeometry"===e)return{width:320,height:320,type:e,cornerRadius:[0,0,0,0],cornerType:0,depth:0,extrudeBevelSize:0,extrudeBevelSegments:1};if("UIGeometry"===e)return{type:e,frame:"",cornerRadius:[0,0,0,0],cornerType:0,width:1,height:1};if("PathGeometry"===e)return{type:e,width:1,height:1,depth:1,path:g5.defaultData(),extrusion:gQ};if("VectorGeometry"===e)return{width:1,height:1,type:e,subdivisions:12,shape:g4.defaultData(),depth:0,extrudeBevelSize:0,extrudeBevelSegments:1};if("BooleanGeometry"===e)return{type:e,operation:2,width:0,height:0,depth:0,phongAngle:35};if("ShapeBlendGeometry"===e)return{type:e,width:0,height:0,depth:0,resolutionLevel:6,blendRange:100,useChildrenColors:!1};if("TextGeometry"===e)return{type:e,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("InputGeometry"===e)return{...g0.defaultData("TextGeometry"),type:e,editable:!0};if("SphereGeometry"===e)return{type:"SphereGeometry",width:100,height:100,depth:100,widthSegments:64,heightSegments:64,phiStart:0,phiLength:2*Math.PI,thetaStart:0,thetaLength:180};throw Error("not implemented")};var gK=["width","height","depth"];(ve||(ve={}
3139)).defaultData={enabled:!1,useBackgroundColor:!1,color:go.white,near:.1,far:2e3},o={opacity:1,blendFunction:13,enabled:!1},(vt||(vt={})).defaultData={enabled:!1,pixelation:{...o,blendFunction:16,granularity:15},bloom:{...o,blendFunction:16,intensity:1,blurScale:1,luminanceThreshold:.25,luminanceSmoothing:.025,kernelSize:3},chromaticAberration:{...o,offset:[2,2]},vignette:{...o,darkness:1,offset:0},hueSaturation:{...o,hue:3,saturation:0},brightnessContrast:{...o,brightness:.25,contrast:0},depthOfField:{...o,focusDistance:100,focalLength:20,bokehScale:5},noise:{...o,blendFunction:16}},(vi||(vi={})).defaultData={softShadowQuality:"low"},(vr||(vr={})).defaultData={enabled:!0,color:{r:.8274509803921568,g:.8274509803921568,b:.8274509803921568},intensity:.75},(vs||(vs={})).defaultData={occlusion:!1,aoFullRes:!1,radius:256,bias:.5,aoColor:{r:.19607843137254902,g:.19607843137254902,b:.19607843137254902}},(va||(va={})).defaultData={usePhysics:!1,gravity:-10},(vn||(vn={})).defaultData={playCamera:mE,gameControlObject:null},(vo||(vo={})).defaultData={backgroundColor:gl.fromHexAndA(2960946,1),postprocessing:vt.defaultData,fog:ve.defaultData,globalPhysics:va.defaultData,ambient:vr.defaultData,ao:vs.defaultData,shadow:vi.defaultData,publish:vn.defaultData},(vl||(vl={})).defaultData={colliderType:"box",size:[100,100,100],colliderHelperVisible:!0,forceType:"collider",forceRange:"global",forceIntensity:.5,forceDambing:.95},(g1=vh||(vh={})).isComponentRelated=function(e){return"Component"===e||"Instance"===e},g1.isEmptyOrComponent=function(e){return"Empty"===e||"Instance"===e},(g2=vc||(vc={})).identity={...gh.identity,hiddenMatrix:gn.identity},g2.fromObject=function(e){return{position:e.position,rotation:e.rotation,scale:e.scale,hiddenMatrix:e.hiddenMatrix}},g2.merge=function(e,t){return{position:t?.position||e.position,rotation:t?.rotation||e.rotation,scale:t?.scale||e.scale,hiddenMatrix:t?.hiddenMatrix||e.hiddenMatrix}},g2.diff=function(e,t){return u$({position:gr.isEqual(e.position,t.position)?void 0:t.position,rotation:gr.isEqual(e.rotation,t.rotation)?void 0:t.rotation,scale:gr.isEqual(e.scale,t.scale)?null:t.scale,hiddenMatrix:gn.isEqual(e.hiddenMatrix,t.hiddenMatrix)?void 0:t.hiddenMatrix})};var gJ,g$,g0,g1,g2,g3,g4,g5,g6,g8,g9,g7,ve,vt,vi,vr,vs,va,vn,vo,vl,vh,vc,vd,vu=["slide","offset"];(vd||(vd={})).defaultData={states:new pP,events:new pP,timelineAnimations:new p_,visible:!0,raycastLock:!1,physics:gk.defaultData,pathSnapping:{pathId:null,slide:0,offset:0,orientation:"tangential"},...vc.identity,cloner:null},(yR||(yR={})).defaultData={type:"Empty",...vd.defaultData},(yk||(yk={})).defaultData={type:"ParticleCollider",...vl.defaultData,...vd.defaultData},(yB||(yB={})).defaultData={type:"Component",...vd.defaultData},(yz||(yz={})).defaultData={type:"Particle",...vd.defaultData,...gR.defaultData},(yN||(yN={})).defaultData={type:"Mesh",...vd.defaultData,...gN.defaultData},(yF||(yF={})).defaultData={...vd.defaultData,...vc.identity,position:[0,0,gP.DefaultTargetOffset],...gP.defaultData},(yS=yj||(yj={})).defaultData=function(e){return{...vd.defaultData,...gI.defaultData(e)}},yS.defaultDirectionalLightData={...yS.defaultData("DirectionalLight"),position:[200,300,300],name:"Directional Light",intensity:.7};var vp=yU||(yU={});function vf(e,t,i=0){for(;i<t.length;){let r=e?e[t[i]]:void 0;if(t.length===i+1)return r;if(!r)return;e=r.descendants,i+=1}}vp.resolveWithDes=vf,vp.resolve=function(e,t,i=0){let r=vf(e,t,i);if(r){let e=Object.keys(r);if(1===e.length&&"descendants"===e[0])return}return r};var vm=yV||(yV={});function vg(e,t){return{...vd.defaultData,...t,component:e,overrides:new pR,physics:void 0,events:void 0,type:"Instance"}}vm.rootOverrideProps=["physics","events"],vm.compositeNonOptionalOverrideProps=["geometry"],vm.compositeEntireOverrideOverrideProps=["material"],vm.ofComponent=vg,vm.fromComponentData=function(e){let t=vc.fromObject(e.data);return vg(e.id,t)},(yC=yW||(yW={})).defaultData={type:"Page",...vd.defaultData,physics:{...gk.defaultData,fusedBody:!1},...vo.defaultData,camera:yF.defaultData},yC.isUIPage=function(e){return void 0!==e.uiScene},(h=yH||(yH={})).defaultCamera={position:[0,0,1e3],scale:[1,1,1],rotation:[0,0,0],hiddenMatrix:gn.identity,name:"Play Camera",visible:!0,raycastLock:!1,physics:gk.defaultData,states:new pP,events:new pP,timelineAnimations:new p_,cloner:null,pathSnapping:{pathId:null,orientation:"tangential",slide:0,offset:0},...gP.defaultData},h.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"]},h.defaultMeshObject={name:"Rectangle",...vd.defaultData,...yN.defaultData,geometry:g7.defaultData("RectangleGeometry"),material:g3.defaultTwoLayerData("phong","layer1","layer2")},h.defaultBooleanObject={name:"Boolean",...vd.defaultData,...yN.defaultData,geometry:g7.defaultData("BooleanGeometry"),material:g3.defaultTwoLayerData("phong","layer1","layer2")},h.defaultShapeBlendObject={name:"Shape Blend",...vd.defaultData,...yN.defaultData,geometry:g7.defaultData("ShapeBlendGeometry"),material:g3.defaultTwoLayerData("phong","layer1","layer2")},h.defaultTextObject={name:"Text",...vd.defaultData,...yN.defaultData,geometry:g7.defaultData("TextGeometry"),material:g3.defaultTwoLayerData("phong","layer1","layer2")},h.defaultInputObject={name:"Input",...vd.defaultData,...yN.defaultData,geometry:g7.defaultData("InputGeometry"),material:g3.defaultTwoLayerData("phong","layer1","layer2")},(yM=yG||(yG={}
3139)).newEmpty=function(e,t){let i={name:t};return"Mesh"===e.type?(i.geometry={},"material"in e&&(i.material={layers:new pR}),"materials"in e&&(i.materials=e.materials.map(e=>({layers:new pR})))):gT.is(e.type)&&(i.perspective={},i.orthographic={}),i},yM.toOps=function(e,t){let i,r=[],s={orthographic:0,perspective:0,geometry:0};function a(e,t){for(let[i,s]of Object.entries(t.layers)){let{texture:t,...a}=s;if(void 0!==t&&Object.keys(t).length>0){let s={path:[...e,"layers",i,"texture"],props:t,type:0};r.push(s)}if(Object.keys(a).length>0){let t={path:[...e,"layers",i],props:a,type:0};r.push(t)}}}for(let[e,o]of Object.entries(t))if("name"!==e)if("cloner"===e)r.push(...gO.toOps(o,["cloner"]));else if("pathSnapping"===e)r.push({path:[e],props:{slide:o.slide,offset:o.offset},type:0});else if("material"===e)a(["material"],o);else if("materials"===e)for(let[e,t]of Object.entries(o))a(["materials",e],t);else if(0===s[e]){if("geometry"===e&&void 0!==o.extrusion){let t={path:[e,"extrusion"],props:o.extrusion,type:0};r.push(t),o={...o},delete o.extrusion}if(Object.keys(o).length>0){let t={path:[e],props:o,type:0};r.push(t)}}else void 0===i&&(i={path:[],props:{},type:0},r.push(i)),i.props[e]=o;return r},yM.patch=function(e,t){if(void 0===t)return e;let i={...e};return(Object.assign(i,vc.merge(i,t)),Object.assign(i,{pathSnapping:Object.assign({},i.pathSnapping,{slide:t.pathSnapping?.slide??i.pathSnapping?.slide??0,offset:t.pathSnapping?.offset??i.pathSnapping?.offset??0})}),gT.is(e.type))?(i.orthographic={...i.orthographic},i.perspective={...i.perspective},t.orthographic?.zoom!==void 0&&(i.orthographic.zoom=t.orthographic.zoom),t.perspective?.zoom!==void 0&&(i.perspective.zoom=t.perspective.zoom),void 0!==t.isUpVectorFlipped&&(i.isUpVectorFlipped=t.isUpVectorFlipped),void 0!==t.targetOffset&&(i.targetOffset=t.targetOffset)):"Mesh"===e.type?("geometry"in t&&Object.assign(i,{geometry:g9.merge(i.geometry,t.geometry)}),(t.material||t.materials)&&(i=function(e,t){if(void 0===t)return e;let i={...e};return"material"in i&&"material"in t&&t.material&&(i.material=p3(i.material,e=>{if("string"!=typeof e)for(let[i,r]of Object.entries(t.material.layers)){let t=e.layers.data(i);t&&gW.patch(t,r)}}).data),i.materials&&t.materials&&(i.materials=p3(i.materials,e=>{for(let r=0;r<i.materials.length;r++){let i=t.materials[r];if("string"!=typeof i)for(let[t,s]of Object.entries(i.layers)){let i=e[r]?.layers?.data(t);i&&gW.patch(i,s)}}}).data),i}(i,t)),i.cloner&&"cloner"in t&&Object.assign(i,{cloner:gD.merge(i.cloner,t.cloner)})):"Empty"===e.type?i.cloner&&"cloner"in t&&Object.assign(i,{cloner:gD.merge(i.cloner,t.cloner)}):gL.is(e.type)&&(void 0!==t.intensity&&(i.intensity=t.intensity),void 0!==t.color&&("string"==typeof t.color?i.color=t.color:i.color=go.clone(t.color))),i},(yq||(yq={})).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},(yX||(yX={})).defaultData={orbitControls:yq.defaultData,playPage:mA,withBackground:!0,preventScroll:!1,preventTouchScroll:!1,hideCursor:!1,mouseEventTarget:"canvas",joystickSizeAndXYOffset:Array(12).fill(0).map((e,t)=>{let i=0,r=0;return t<5?r=-30:t<10&&(r=30),0===t||10===t||5===t?i=30:(4===t||11===t||9===t)&&(i=-30),[120,[i,r],"show"]}),settings:{image:{format:"jpg",ratio:1},videoStatic:{fps:60,mbps:150,ratio:1,duration:1e3,activeTimeline:null},video:{format:"mp4",imageFormat:"jpg",fps:30,mbps:80,ratio:Math.max(1,"u">typeof window?Math.floor(window.devicePixelRatio):1),stopMode:"manual",duration:5e3},web:{logo:!0,compress:!0,preset:1,preload:!0,hint:!1,imageQuality:70,pixelRatioMobile:0,pixelRatioDesktop:0}},stopRaycast:!0,hdTransmission:!1},(yY||(yY={})).defaultData={id:"basic",label:"Basic",style:"None",prompt:""},(yQ||(yQ={})).defaultData={weather:0,shadows:0,lightOrigin:0,temperature:0,sun:0,camera:0,environment:0,particles:0,nature:0,floor:0},(c=yZ||(yZ={})).defaultData=()=>({mode:"line-art-both",prompt:"",negativePrompt:"",style:{...yY.defaultData},isRandomSeed:!0,seed:c.generateSeed(),guessMode:!1,advanced:!1,steps:20,guidanceScale:7.5,controlNetScale:1,modifiers:yQ.defaultData}),c.generateSeed=()=>Math.round(1e5*Math.random()),(yE=yK||(yK={})).physicsEnabled=function(e){return void 0!==e.find(e=>"Page"===e.data.type&&e.data.globalPhysics.usePhysics)},yE.traverseModuleInstances=function(e,t,i){e.scene.objects.traverseFrom(t,(t,r)=>{if("Instance"===r.type){let s=xe.getComponentData(e,r.component)?.data;s&&i(t,r,s.events)}else i(t,r,r.events)})};var vv=yJ||(yJ={});function vy(e=!0,t=[]){let i=[],r=yH.defaultMeshObject;e&&(i.push({...vv.defaultLight}
vendor: 4,076 bytes, line 3139
3139),i.push({fi:1,id:"7ba78968-2a55-48f2-b14c-5191da3e075e",data:r,children:[]})),i.push(...t);let s=new pT;return s.push({fi:1,id:mA,data:{...yW.defaultData,name:"Scene 1"},children:i}),s}function vx(e){return{...vv.defaultData,objects:u0(e,pT.prototype)}}vv.TRASH_CAN_ID="830a2708-8ed9-49cf-a68e-085299892222",vv.defaultLight={fi:-1,data:yj.defaultDirectionalLightData,id:"830a2708-8ed9-49cf-a68e-085299899103",children:[]},vv.createDefaultObjectTreeWithPage=vy,vv.defaultData={objects:vy(),publish:yX.defaultData,styles:yZ.defaultData()},vv.emptyDataWithoutPage=function(){return{objects:new pT,publish:yX.defaultData,styles:yZ.defaultData()}},vv.emptyDataWithPage=function(e=!0){return{objects:vy(e),publish:yX.defaultData,styles:yZ.defaultData()}},vv.emptyData=function(){return{objects:new pT,publish:{...yX.defaultData},styles:yZ.defaultData()}},vv.withObjs=vx,vv.withObj=function(e,t){return vx([{id:e,data:t,children:[],fi:0}])},(y$||(y$={})).defaultData={preset:"fullscreen",allowResponsive:!1,size:[512,512],coords:[0,0],sceneScale:1,color:{r:0,g:0,b:0,a:.5}},(d=y0||(y0={})).defaultData=e=>({url:e,name:"New Webhook",parametersSchemas:new pP}),d.defaultParameterValueByType=e=>"number"===e?0:"boolean"!==e&&"",(y1||(y1={})).defaultData=(e,t="GET")=>({url:e,method:t,name:"New API",headers:new pP,queries:new pP,autoStart:!0});var vb=y2||(y2={});function vw(e){return void 0!==e.textValue}function v_(e){return"boolean"==typeof e}function vS(e){e.layers.forEach(e=>{if("depth"===e.type&&void 0!==e.colorA){let t=e.colorA,i=e.colorB,r=[[t.r,t.g,t.b,t.a],[i.r,i.g,i.b,i.a]],s=[0,1];for(let e=2;e<10;e++)r.push(r[1]),s.push(1);let a={...uQ(p4(e),"type","visible","isVector","isWorldSpace","origin","alpha","mode"),near:Math.max(0,e.near),far:Math.max(0,e.far),colors:r,steps:s,num:2,direction:[1,0,0],smooth:!1,gradientType:1};Object.assign(e,a)}else if("depth"===e.type&&1===e.gradientType&&(e.near<0||e.far<0)){let t={...p4(e),near:Math.max(e.near,0),far:Math.max(e.far,0)};Object.assign(e,t)}})}function vC(e,t){Object.values(e.shared.materials).forEach(e=>t(e))}function vM(e,t){e.scene.objects.traverse((e,i)=>{"materials"in i?i.materials.forEach((e,r)=>{void 0===e&&(i.materials[r]=g3.defaultData(),e=i.materials[r]),"string"!=typeof e&&t(e)}):"material"in i?"string"!=typeof i.material&&(void 0===i.material&&(i.material=g3.defaultData()),t(i.material)):"Mesh"===i.type&&(void 0===i.material&&(i.material=g3.defaultData()),t(i.material)),"overrides"in i&&Object.values(i.overrides).forEach(e=>{e.material&&"string"!=typeof e.material&&Object.getPrototypeOf(e.material)!==pR.prototype&&t(e.material)})})}function vE(e){void 0===e.layers&&Object.assign(e,g3.defaultTwoLayerData("lambert"))}function vA(e){e.layers&&e.layers.forEach(e=>{if("depth"===e.type&&10===e.colors.length){let t=[...e.colors];t.push(e.colors[9]);let i=[...e.steps];i.push(e.steps[9]);let r={...p4(e),colors:t,steps:i};Object.assign(e,r)}})}function vT(e){e.scene.objects.traverse((e,t)=>{"materials"in t?t.materials.forEach(e=>{"string"!=typeof e&&vA(e)}):"material"in t&&"string"!=typeof t.material&&vA(t.material)}),Object.values(e.shared.materials).forEach(e=>vA(e))}function vP(e){e.layers&&e.layers.forEach(e=>{"depth"===e.type&&void 0!==e.num&&(e.colors=e.colors.slice(0,e.num),e.steps=e.steps.slice(0,e.num),delete e.num)})}function vD(e){e.layers&&e.layers.forEach(e=>{"displace"!==e.type&&void 0===e.isMask&&(e.isMask=!1),("texture"===e.type||"video"===e.type)&&void 0===e.blending&&(e.blending=0),("noise"===e.type||"displace"===e.type&&"noise"===e.displacementType)&&(void 0===e.voronoiStyle&&(e.voronoiStyle=0),void 0===e.highCut&&(e.highCut=1),void 0===e.lowCut&&(e.lowCut=0),void 0===e.smoothness&&(e.smoothness=.3),void 0===e.seed&&(e.seed=0),void 0===e.quality&&(e.quality=1))})}function vO(e){let t=e.layers.find(e=>"light"===e.type)?.data;t?.category==="basic"&&(Object.assign(t,gW.defaultData("light","phong")),t.visible=!1)}function vL(e){vC(e,vO),vM(e,vO)}function vI(e){e.layers.forEach(e=>{"light"===e.type&&"toon"!==e.category&&void 0===e.occlusion&&(e.occlusion=!0)})}
3139function vR(e){e.layers&&e.layers.forEach(e=>{"light"===e.type&&void 0===e.bumpMapIntensity&&(e.bumpMapIntensity=5)})}function vk(e){e.layers&&e.layers.forEach(e=>{"light"===e.type&&void 0===e.alphaOverride&&(e.alphaOverride=1)})}vb.isTextValue=vw,vb.isNumber=function(e){return"number"==typeof e},vb.isBoolean=v_,vb.typeOfVariable=function(e){return vw(e)?"string":v_(e)?"boolean":"number"},vb.getDisplayedValue=function(e){return vb.isTextValue(e)?Array.isArray(e.textValue)?e.textValue.map(t=>t.toString().padStart(e.padding??2,"0")).join(e.deliminator??":")+(void 0!==e.suffix?" "+e.suffix:""):e.textValue.toString():vb.isBoolean(e)?e?"True":"False":vb.isNumber(e)?parseFloat(e.toFixed(3)).toString():e.toString()},(y3||(y3={})).all=["images","videos","colors","audios","particles","fonts","materials","variables"],(y4||(y4={})).all=[...y3.all,"components"],(y5||(y5={})).defaultData=function(){return{images:new p_,videos:new p_,colors:new p_,audios:new p_,particles:new p_,fonts:new p_,materials:new p_,components:new p_,variables:new p_,userAPIs:new p_,userWebhooks:new p_,timelineAnimations:new p_}},(y6||(y6={})).defaultData=function(){return{images:new p_,videos:new p_,colors:new p_,audios:new p_,particles:new p_,fonts:new p_,materials:new p_,components:new p_,variables:new p_,userAPIs:new p_,userWebhooks:new p_,timelineAnimations:new p_}},(yA=y8||(y8={})).defaultColors=function(){let e={};return e["89b10010-844c-11ec-a8a3-0242ac120002"]={r:.5,g:.5,b:.5,a:1,name:"Default Color"},u0(e,p_.prototype)},yA.defaultImages=function(){return u0({},p_.prototype)},yA.emptyData=function(){return{catelogs:new p_,materials:new p_,images:new p_,videos:new p_,colors:new p_,timelineAnimations:new p_,audios:new p_,particles:new p_,fonts:new p_,variables:new pP,userAPIs:new p_,userWebhooks:new p_,lib:y6.defaultData()}},yA.defaultVariables=function(e){switch(e){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 t=[0,0,0];return{name:"Time",value:{textValue:t,deliminator:":",padding:2,suffix:"AM"},dynamicVariableType:"time",format:"HH:mm:ss",format12h24h:"12ampm",timeZone:null,hasEnd:!1,endValue:{textValue:t,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",e)}},yA.getFormattedTimerTime=function(e,t){if("HH:mm:ss"===t.format){let t=Math.floor(e/3600),i=Math.floor((e-3600*t)/60),r=Math.round(e-3600*t-60*i);return{textValue:[t,i,r]}}if("mm:ss"!==t.format)return"number"===t.format?Math.round(e):Math.round(1e3*e)/1e3;{let t=Math.floor(e/60),i=Math.round(e-60*t);return{textValue:[t,i]}}},(y9||(y9={})).list=["idle","move","jump","run"],(u=y7||(y7={})).defaultColliderData={type:"capsule",height:200,radius:50,position:[0,0,0],rotation:[0,0,0]},u.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:u.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 pP,move:new pP,jump:new pP,run:new pP},navmesh:{enabled:!1,ch:6,cs:6,walkableClimb:5,walkableHeight:1,walkableRadius:0,zones:"all",objects:[],helperVisible:!0,destinationHelperRadius:0,destinationHelperColor:gl.fromHexAndA(3728051,1)}};var vB=180/Math.PI;function vz(e){e.rotation=e.rotation.slice(0,3).map(e=>e*vB)}function vN(e){vz(e),"Page"===e.type&&vz(e.camera),e.states?.forEach(e
3139=>{void 0===e.rotation||null===e.rotation||(e.rotation=e.rotation.slice(0,3).map(e=>e*vB))});let t=e.geometry;t&&"SphereGeometry"===t.type&&(t.thetaLength=(t.thetaLength??180)*vB),t&&"TorusGeometry"===t.type&&(t.arc=t.arc*vB),t&&"PathGeometry"===t.type&&(t.extrusion.angle*=vB,t.extrusion.twist*=vB),"Mesh"===e.type&&"TextGeometry"===e.geometry.type&&(e.geometry.text={textValue:e.geometry.text}),Array.isArray(p4(e.events))&&e.events?.forEach(e=>{("MouseDown"===e.type||"MouseUp"===e.type||"MousePress"===e.type||"KeyDown"===e.type||"KeyUp"===e.type||"KeyPress"===e.type||"Collision"===e.type||"Trigger"===e.type)&&(e.runMode=e.toggle?"Toggle":"Repeat")})}function vF(e,t){for(let i of(t(e.data),e.children))vF(i,t)}function vj(e){e.timelineAnimations=u0({},p_.prototype)}function vU(e){let t=e.schema??0;if(118!==t){let i;for(let i of(console.warn("updating from ",t,"to ",118),function(e,t){let i,r,s,a;if(t<1&&(vM(e,vS),vC(e,vS),e.schema=1),t<2&&(Object.assign(e.scene.publish,{orbitControls:{...yq.defaultData,...p4(e.scene.publish.orbitControls)}}),e.schema=2),t<3&&(function(e){function t(e){if(e.layers){for(let t of Object.values(e.layers))if(t){for(let[e,i]of Object.entries(t))if((gH.includes(e)||"boolean"==typeof i)&&delete t[e],"texture"===e)for(let[e,t]of Object.entries(i))(gG.includes(e)||"boolean"==typeof t)&&delete i[e]}}}e.scene.objects.traverse((e,i)=>{i.states.forEach(e=>{e.material?t(e.material):e.materials&&e.materials.forEach(e=>{t(e)})})})}(e),e.schema=3),t<4&&(e.scene.publish.withBackground=!0,e.schema=4),t<5&&(e.scene.publish.settings.web={compress:!0,preload:!0,preset:1,logo:!0,hint:!1},e.schema=5),t<6&&(e.scene.objects.traverse((e,t)=>{let i=t.cloner;i&&(i.radial.scale=i.radial.scale.map(e=>e+1),i.linear.scale=i.linear.scale.map(e=>e+1))}),e.schema=6),t<7&&(e.scene.objects.traverse((e,t)=>{let i=t.geometry;i&&("DodecahedronGeometry"===i.type||"IcosahedronGeometry"===i.type)&&(i.detail=Math.round(i.detail))}),e.schema=7),t<8&&(e.schema=8),t<9&&(vT(e),e.schema=9),t<10&&(e.scene.objects.traverse((e,t)=>{"Mesh"===t.type&&("BooleanGeometry"===t.geometry.type||"SubdivGeometry"===t.geometry.type)&&(t.geometry.phongAngle=35)}),e.schema=10),t<11&&(e.scene.environment.ambientLight.softShadows=!1,e.scene.environment.ambientLight.softShadowQuality="low",e.scene.objects.traverse((e,t)=>{("DirectionalLight"===t.type||"SpotLight"===t.type)&&(t.shadowResolution=1024,t.shadowRadius=1,t.depth=1e5)}),e.shared.penumbraSize=[,,,,,].fill(.5),e.schema=11),t<12&&(vT(e),e.schema=12),t<13&&(e.shared.audios=u0({},p_.prototype),e.schema=13),t<14&&(Object.entries(i=e.shared.materials).forEach(([e,t])=>{t.layers||Object.assign(i,{[e]:{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"}]}})}),e.schema=14),t<15&&(Object.entries(p4(e.shared.images)).filter(e=>!1===e[1].asset).map(e=>e[0]).forEach(t=>{delete e.shared.images[t]}),Object.entries(p4(e.shared.audios)).filter(e=>!1===e[1].asset).map(e=>e[0]).forEach(t=>{delete e.shared.audios[t]}),e.schema=15),t<16&&(e.scene.publish.settings.web.preload=!1,e.schema=16),t<17&&(vM(e,vP),vC(e,vP),e.schema=17),t<18&&(vM(e,vE),vC(e,vE),e.schema=18),t<19&&(Object.assign(e.scene.publish.settings,{video:{...yX.defaultData.settings.video,...p4(e.scene.publish.settings.video)}}),e.schema=19),t<20&&(e.shared.fonts=u0({},p_.prototype),r=[],e.scene.objects.traverse((t,i)=>{if("TextFrame"===i.type){let s=g3.defaultTwoLayerData("phong"),a="string"==typeof i.color?e.shared.colors[i.color]:i.color;s.layers[1].data.color={r:a.r,g:a.g,b:a.b},s.layers[1].data.alpha=i.alpha;let o=i.font.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(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ");void 0===e.shared.fonts[o]&&(e.shared.fonts[o]={name:o});let h={name:i.name,...vd.defaultData,...yN.defaultData,flatShading:!1,wireframe:!1,geometry:{...g7.defaultData("TextGeometry"),width:i.width,height:i.height,font:o,depth:0,horizontalAlign:i.horizontalAlign,verticalAlign:i.verticalAlign,fontSize:1.40625*i.fontSize,lineHeight:i.lineHeight/1.40625,letterSpacing:i.letterSpacing-1,text:i.text,textTransform:i.textTransform,extrudeBevelSize:0,extrudeBevelSegments:1},material:s,states:p4(i.states),events:p4(i.events),visible:i.visible,raycastLock:i.raycastLock,position:i.position,rotation:i.rotation,scale:i.scale,hiddenMatrix:i.hiddenMatrix},c=p4(e.scene.objects).parent(t);e.scene.objects.insertAfter(c??null,t,[{id:t+"new",data:h,children:[]}]),r.push(t)}}),r.forEach(t=>{e.scene.objects.delete(t)}),e.schema=20),t<21&&(s={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((e,t)=>
vendor: 4,323 bytes, line 3139
3139{t.events.forEach(e=>{if(s[Number(e.type)])if(Object.assign(e,{type:s[Number(e.type)]}),"Audio"===e.type&&"audioEvent"in e&&(Object.assign(e,{playAudio:e.audioEvent}),delete e.audioEvent),"GameControl"===e.type)Object.assign(e,{gameActions:{idle:new pP,move:new pP,jump:new pP}});else{let t=new pP;Object.assign(e,{actions:t}),("MouseDown"===e.type||"MouseUp"===e.type||"KeyDown"===e.type||"KeyUp"===e.type)&&"url"in e&&t.push({fi:0,id:tQ.generateUUID(),data:{type:"Link",url:e.url,delay:0}}),"targets"in e&&(e.targets.forEach((e,i,r)=>{let s={easing:e.easing,duration:e.duration};6===e.easing?Object.assign(s,uQ(e,"mass","stiffness","damping","velocity")):5===e.easing&&Object.assign(s,{control1:{...e.control1},control2:{...e.control2}});let a={repeat:e.repeat?-1:0,delay:e.delay,delayDirection:e.delayDirection,direction:e.cycle&&e.rewind?"pingpong-rewind":e.cycle?"pingpong":"normal"},o={state:e.state,...a,...s},h={allowSlerp:!0,type:"Transition",object:e.object,repeat:0,delay:0,delayDirection:void 0,direction:"normal",tweens:new pP({fi:0,id:tQ.generateUUID(),data:{state:void 0,repeat:0,delay:0,delayDirection:void 0,direction:"normal",duration:0,easing:4}},{fi:1,id:tQ.generateUUID(),data:o})};t.push({fi:r,id:i,data:h})}),delete e.targets)}})}),e.scene.objects.traverse((e,t)=>{function i(e,i){let r=new pP,s=[];if(t.events.forEach((e,t,a)=>{if("Audio"===e.type&&e.trigger===i){let i;s.push(t),"play"===e.interaction?i={...uQ(e,"interaction","audio","delay","volume","loop"),triggerAfter:"after"in e?e.after:void 0,toggle:"after"in e?e.toggle:void 0,type:"Audio"}:("pause"===e.interaction||"stop"===e.interaction)&&(i={...uQ(e,"interaction","delay","object","playAudio"),type:"Audio"}),i&&r.push({fi:a,id:t,data:i})}}),s.forEach(e=>t.events.delete(e)),r.length){let i=t.events.find(t=>t.type===e)?.data;i?"actions"in i&&i.actions.insertBefore(null,r):t.events.insertBefore(null,[{id:tQ.generateUUID(),data:{type:e,actions:r}}])}}i("Start","start"),i("MouseDown","mouseDown"),i("MouseUp","mouseUp"),i("KeyDown","keyDown"),i("KeyUp","keyUp")}),e.schema=21),t<22&&(vL(e),e.schema=22),t<23&&(e.scene.objects.traverse((e,t)=>{"Mesh"===t.type&&"SubdivGeometry"===t.geometry.type&&(t.geometry.scaleBaked||(t.geometry.scaleBaked=[1,1,1]))}),e.schema=23),t<24&&(e.scene.objects.traverse((e,t)=>{"Empty"!==t.type&&"Mesh"!==t.type||!t.cloner||t.cloner.randomnessObject||t.cloner.toObject||t.cloner.randomness||(t.cloner={...t.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"}})}),e.schema=24),(t<25||void 0===e.shared.videos)&&(e.shared.videos=u0({},p_.prototype),t<25&&(e.schema=25)),t<26&&(e.scene.objects.traverse((t,i)=>{let r=e.scene.objects.unproxy().parent(t);if(r){let t=p4(e.scene.objects.data(r));t&&"Mesh"===t.type&&"BooleanGeometry"===t.geometry.type&&"Mesh"===i.type&&(i.visible=!0!==p4(i).booleanExclude)}}),e.schema=26),t<27&&(e.scene.objects.traverse((e,t)=>{"Mesh"===t.type&&("NonParametricGeometry"===t.geometry.type?void 0!==t.material&&delete t.material:void 0!==t.materials&&delete t.materials)}),e.schema=27),t<28&&(vL(e),e.schema=28),t<29&&(function(e){function t(e){for(let i in Object.setPrototypeOf(e,pR.prototype),e){var t;Object.setPrototypeOf(t=e[i],pR.prototype),t.texture&&Object.setPrototypeOf(t.texture,pR.prototype)}}e.scene.objects.traverse((e,i)=>{i.states.forEach(e=>{if(e.material){let i=p4(e.material).layers;t(i),e.material.layers=i}if(e.materials)for(let i=0;i<e.materials.length;i++){let r=e.materials[i],s=p4(r).layers;t(s),r.layers=s}})})}(e),e.schema=29),t<30&&(e.scene.objects.traverse((e,t)=>{"Mesh"!==t.type||"NonParametricGeometry"!==t.geometry.type||"material"in t||"materials"in t||(t.material=g3.defaultTwoLayerData("phong"))}),e.schema=30),t<31&&(void 0===e.scene.publish.orbitControls.autoZoom&&(e.scene.publish.orbitControls.autoZoom=!1),e.scene.objects.traverse((e,t)=>{("OrthographicCamera"===t.type||"PerspectiveCamera"===t.type)&&(void 0===t.orthographic.autoZoom&&(t.orthographic.autoZoom=!1),void 0===t.orthographic.autoZoomFrustumSize&&(t.orthographic.autoZoomFrustumSize=790))}),e.schema=31),t<33&&(e.scene.objects.traverse((e,t)=>
vendor: 4,384 bytes, line 3139
3139{void 0===t.pathSnapping&&(t.pathSnapping={pathId:null,slide:0,offset:0,orientation:"tangential"}),void 0===t.pathSnapping.offset&&(t.pathSnapping.offset=0)}),e.schema=33),t<34&&(void 0===e.scene.publish.mouseEventTarget&&(e.scene.publish.mouseEventTarget="canvas"),void 0===e.scene.publish.settings.web.hint&&(e.scene.publish.settings.web.hint=!1),e.schema=34),t<35&&(function(e){let{video:t}=e.scene.publish.settings;"gif"===t.format&&t.fps>48&&(t.fps=15)}(e),e.schema=35),t<36&&(e.scene.objects.traverse((e,t)=>{t.events.forEach(e=>{"GameControl"===e.type&&(e.resetYPosition=Math.abs(e.resetYPosition-t.position[1]))})}),e.schema=36),t<37&&(a=e.scene.environment.usePhysics,e.scene.objects.traverse((e,t)=>{a&&null===t.physics?t.collision=!1:t.collision="visibility"}),e.schema=37),t<38&&(vM(e,vD),vC(e,vD),e.schema=38),t<39&&(e.scene.objects.traverse((e,t)=>{t.events.forEach(e=>{"GameControl"===e.type&&(e.navmesh=y7.defaultDataThirdPerson.navmesh)})}),e.schema=39),t<40&&(e.scene.styles||(e.scene.styles=yZ.defaultData()),e.schema=40),t<41&&(void 0===e.scene.environment.ambientLight.occlusion&&(e.scene.environment.ambientLight.occlusion=!1),void 0===e.scene.environment.ambientLight.aoFullRes&&(e.scene.environment.ambientLight.aoFullRes=!1),void 0===e.scene.environment.ambientLight.radius&&(e.scene.environment.ambientLight.radius=256),void 0===e.scene.environment.ambientLight.bias&&(e.scene.environment.ambientLight.bias=.5),void 0===e.scene.environment.ambientLight.aoColor&&(e.scene.environment.ambientLight.aoColor={r:.19607843137254902,g:.19607843137254902,b:.19607843137254902}),vM(e,vI),vC(e,vI),e.schema=41),t<42&&(e.scene.objects.traverse((e,t)=>{t.events.forEach(e=>{"GameControl"===e.type&&Object.assign(e.gameActions,{run:new pP})})}),e.schema=42),t<43&&(e.scene.objects.traverse((e,t)=>{t.events.forEach(e=>{"GameControl"===e.type&&(e.keyAssignments=[...e.keyAssignments,["run","⇧"],["none","Ctrl"]])})}),e.schema=43),t<99){vM(e,vR),vC(e,vR),null===e.scene.publish.playCamera&&(e.scene.publish.playCamera=mE);let t=p4(e.scene.objects),i=e.scene.objects;for(let r of(e.scene.publish.playPage=mA,i.insertBefore(null,null,[{id:mA,data:{...yW.defaultData,backgroundColor:e.scene.backgroundColor,fog:e.scene.fog,postprocessing:e.scene.postprocessing,ao:uQ(e.scene.environment.ambientLight,"occlusion","aoFullRes","radius","bias","aoColor"),publish:{playCamera:e.scene.publish.playCamera,gameControlObject:e.scene.publish.gameControlObject},shadow:uQ(e.scene.environment.ambientLight,"softShadowQuality"),globalPhysics:{...va.defaultData,...uQ(e.scene.environment,"usePhysics","gravity")},camera:p4(e.scene.ownerCamera)??yW.defaultData.camera,name:"Scene"},children:[]}]),t))r.id!==yJ.TRASH_CAN_ID&&i.move(mA,r.fi,r.id);let r=0,s=0;e.shared.penumbraSize&&e.scene.objects.traverse((t,i)=>{"DirectionalLight"===i.type?(i.penumbraSize=e.shared.penumbraSize[Math.min(r,2)],r+=1):"SpotLight"===i.type&&(i.penumbraSize=e.shared.penumbraSize[3+Math.min(s,1)],s+=1),(void 0===i.physics||null===i.physics)&&"Instance"!==i.type&&(i.physics={},Object.assign(i.physics,gk.defaultData)),void 0!==i.physics&&null!==i.physics&&(i.physics.enabled=i.collision??"visibility",delete i.collision)}),e.schema=99}}(e,t),t<100&&(void 0===e.scene.publish.joystickSizeAndXYOffset&&(e.scene.publish.joystickSizeAndXYOffset=yX.defaultData.joystickSizeAndXYOffset),e.schema=100),t<101&&(vM(e,vk),vC(e,vk),e.schema=101),t<102&&(e.scene.objects.traverse((e,t)=>{let i=t.geometry;i&&"PathGeometry"===i.type&&(i.extrusion.capType="flat",i.extrusion.bevel=50,i.extrusion.bevelSides=6,"Custom"===i.extrusion.shape.type&&(i.extrusion.shape.shapeQuality="low"))}),e.schema=102),t<104&&(e.shared.catelogs=new p_,e.shared.lib=y6.defaultData(),e.schema=104),t<105&&(e.shared.variables=u0({},p_.prototype),e.scene.objects.traverse((e,t)=>{vN(t)}),e.schema=105),Object.values(e.shared.lib.components)))!function(e){let t=e.schema??104;118!==t&&(t<105&&(vF(e.asset,vN),e.schema=105),t<118&&(vF(e.asset,vj),e.schema=118))}(i);t<106&&(i=p4(e.shared.variables),e.shared.variables=u0(Object.entries(i??{}).map(([e,t],i)=>({fi:i,id:e,data:t})),pP.prototype),e.schema=106),t<107&&(e.shared.lib.variables=y6.defaultData().variables,e.schema=107),t<109&&(e.shared.particles=u0({},p_.prototype),e.shared.lib&&(e.shared.lib.particles=y6.defaultData().particles),e.schema=109),t<110&&(e.scene.objects.traverse((e,t)=>
vendor: 4,634 bytes, line 3139
3139{"Particle"===t.type&&"number"==typeof t.renderMaterial.size&&Object.assign(t.renderMaterial,{size:[t.renderMaterial.size,t.renderMaterial.size]})}),e.schema=110),t<111&&(e.scene.objects.traverse((e,t)=>{Array.isArray(p4(t.events))&&t.events?.forEach(e=>{"disabled"in e||(e.disabled=!1),("MouseDown"===e.type||"MouseUp"===e.type||"MousePress"===e.type)&&(e.mode=e.mode||"Object")})}),e.schema=111),t<112&&(e.scene.objects.traverse((e,t)=>{"Page"===t.type&&(t.postprocessing.depthOfField.focusDistance=100,t.postprocessing.depthOfField.focalLength=20,t.postprocessing.depthOfField.bokehScale=5)}),e.schema=112),t<113&&(e.scene.objects.traverse((e,t)=>{!1!==Array.isArray(p4(t.events))&&t.events?.forEach(e=>{let t=e.runMode;"MouseDown"===e.type||"MouseUp"===e.type||"KeyDown"===e.type||"KeyUp"===e.type||"Collision"===e.type||"Trigger"===e.type?e.actions?.forEach(e=>{"Transition"===e.type&&(e.runMode=t??"Repeat"),("Animation"===e.type||"SwitchCamera"===e.type)&&(e.runMode="Toggle"===t?"Toggle":"Normal")}):"MouseHover"===e.type||"MousePress"===e.type||"KeyPress"===e.type?e.actions?.forEach(e=>{("Transition"===e.type||"Animation"===e.type||"SwitchCamera"===e.type)&&(e.runMode="Toggle")}):"GameControl"===e.type?(delete e.actions,Object.keys(e.gameActions).forEach(t=>{e.gameActions[t]?.forEach(e=>{"Transition"===e.type&&(e.runMode="Repeat"),"Animation"===e.type&&(e.runMode="Normal")})})):"DragDrop"===e.type?(delete e.actions,e.dragDropActions?.drag?.forEach(e=>{("Transition"===e.type||"Animation"===e.type||"SwitchCamera"===e.type)&&(e.runMode="Toggle")}),e.dragDropActions?.drop?.forEach(e=>{("Transition"===e.type||"Animation"===e.type||"SwitchCamera"===e.type)&&(e.runMode="Toggle")})):"Resize"===e.type?(delete e.actions,e.breakpoints?.forEach(e=>{e.actions?.forEach(e=>{("Transition"===e.type||"Animation"===e.type||"SwitchCamera"===e.type)&&(e.runMode="Toggle")})})):"Start"===e.type?e.actions?.forEach(e=>{"Transition"===e.type&&(e.runMode="Once"),("Animation"===e.type||"SwitchCamera"===e.type)&&(e.runMode="Normal")}):"VariableChange"===e.type||"Scroll"===e.type?e.actions?.forEach(e=>{"Transition"===e.type&&(e.runMode="Repeat"),("Animation"===e.type||"SwitchCamera"===e.type)&&(e.runMode="Normal")}):"Conditional"===e.type&&(delete e.actions,e.inActions?.forEach(e=>{"Transition"===e.type&&(e.runMode="Repeat"),("Animation"===e.type||"SwitchCamera"===e.type)&&(e.runMode="Normal")}),e.outActions?.forEach(e=>{"Transition"===e.type&&(e.runMode="Repeat"),("Animation"===e.type||"SwitchCamera"===e.type)&&(e.runMode="Normal")}))})}),e.schema=113),t<114&&(void 0===e.scene.publish.settings.web.imageQuality&&(e.scene.publish.settings.web.imageQuality=70),e.schema=114),t<115&&(e.shared.userAPIs=u0({},p_.prototype),e.shared.userWebhooks=u0({},p_.prototype),e.shared.lib&&(e.shared.lib.userAPIs=y6.defaultData().userAPIs,e.shared.lib.userWebhooks=y6.defaultData().userWebhooks),e.schema=115),t<116&&(void 0===e.scene.publish.settings.videoStatic&&(e.scene.publish.settings.videoStatic=yX.defaultData.settings.videoStatic),e.schema=116),t<117&&(void 0===e.scene.publish.settings.web.pixelRatioMobile&&(e.scene.publish.settings.web.pixelRatioMobile=0),void 0===e.scene.publish.settings.web.pixelRatioDesktop&&(e.scene.publish.settings.web.pixelRatioDesktop=0),e.schema=117),t<118&&(e.shared.timelineAnimations=u0({},p_.prototype),e.scene.objects.traverse((e,t)=>{vj(t)}),e.schema=118)}}function vV(e,t=!1){let i=null!==e[0].index,r=new Set(Object.keys(e[0].attributes)),s=new Set(Object.keys(e[0].morphAttributes)),a={},o={},h=e[0].morphTargetsRelative,c=new rz,d=0;for(let u=0;u<e.length;++u){let p=e[u],f=0;if(i!==(null!==p.index))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+u+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(let e in p.attributes){if(!r.has(e))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+u+'. All geometries must have compatible attributes; make sure "'+e+'" attribute exists among all geometries, or in none of them.'),null;void 0===a[e]&&(a[e]=[]),a[e].push(p.attributes[e]),f++}if(f!==r.size)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+u+". Make sure all geometries have the same number of attributes."),null;if(h!==p.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+u+". .morphTargetsRelative must be consistent throughout all geometries."),null;
3139for(let e in p.morphAttributes){if(!s.has(e))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+u+".  .morphAttributes must be consistent throughout all geometries."),null;void 0===o[e]&&(o[e]=[]),o[e].push(p.morphAttributes[e])}if(t){let e;if(i)e=p.index.count;else{if(void 0===p.attributes.position)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+u+". The geometry must have either an index or a position attribute"),null;e=p.attributes.position.count}c.addGroup(d,e,u),d+=e}}if(i){let t=0,i=[];for(let r=0;r<e.length;++r){let s=e[r].index;for(let e=0;e<s.count;++e)i.push(s.getX(e)+t);t+=e[r].attributes.position.count}c.setIndex(i)}for(let e in a){let t=vW(a[e]);if(!t)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+e+" attribute."),null;c.setAttribute(e,t)}for(let e in o){let t=o[e][0].length;if(0===t)break;c.morphAttributes=c.morphAttributes||{},c.morphAttributes[e]=[];for(let i=0;i<t;++i){let t=[];for(let r=0;r<o[e].length;++r)t.push(o[e][r][i]);let r=vW(t);if(!r)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+e+" morphAttribute."),null;c.morphAttributes[e].push(r)}}return c}function vW(e){let t,i,r,s=0;for(let a=0;a<e.length;++a){let o=e[a];if(o.isInterleavedBufferAttribute)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. InterleavedBufferAttributes are not supported."),null;if(void 0===t&&(t=o.array.constructor),t!==o.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(void 0===i&&(i=o.itemSize),i!==o.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(void 0===r&&(r=o.normalized),r!==o.normalized)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;s+=o.array.length}let a=new t(s),o=0;for(let t=0;t<e.length;++t)a.set(e[t].array,o),o+=e[t].array.length;return new rE(a,i,r)}(yT=xe||(xe={})).defaultData={schema:118,scene:yJ.defaultData,frames:new p_().add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",y$.defaultData),shared:{...y8.emptyData(),colors:y8.defaultColors()}},yT.emptyDataForImports=function(){return{schema:118,scene:yJ.emptyDataWithPage(),frames:new p_().add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",y$.defaultData),shared:{...y8.emptyData(),colors:y8.defaultColors(),images:y8.defaultImages()}}},yT.emptyData=function(){return{schema:118,scene:yJ.emptyDataWithPage(),frames:new p_().add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",y$.defaultData),shared:y8.emptyData()}},yT.clipboard2dData=function(){return{schema:118,scene:yJ.emptyData(),frames:new p_,shared:y8.emptyData()}},yT.collabHelper={...fa,updateSchema:e=>(e.schema??0)<118?p3(e,vU):(e.schema??0)-118},yT.updateSchemaDirectly=function(e){let t=yT.collabHelper.updateSchema(e);return"number"==typeof t?0===t?e:null:t.data},yT.withoutLib=function(e){return{...e,shared:{...e.shared,lib:y6.defaultData()}}},yT.getComponentData=function(e,t){let i=e.scene.objects.get(t);if(i&&"Component"===i.data.type)return i;{let i=e.shared.lib.components[t];if(i)return i.asset}},yT.hasSensitiveData=function(e){for(let t of Object.values(e.shared.userAPIs))for(let e of t.headers)if("authorization"===e.data.key.toLowerCase()&&""!==e.data.value)return!0;return!1},(xt||(xt={})).emptyImage={data:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVQYV2NgYAAAAAMAAWgmWQ0AAAAASUVORK5CYII=",name:"empty"},(xi||(xi={})).is=function(e){return!0},(yP=xr||(xr={})).defaultData={position:[0,0],scale:[1,1],rotation:0,shear:[0,0]},yP.merge=function(e,t){return{position:t?.position??e.position,rotation:t?.rotation??e.rotation,scale:t?.scale??e.scale,shear:t?.shear??e.shear}},yP.diff=function(e,t){return u$({position:gi.isEqual(e.position,t.position)?void 0:t.position,rotation:e.rotation===t.rotation?void 0:t.rotation,scale:gi.isEqual(e.scale,t.scale)?void 0:t.scale,shear:e.shear&&t.shear&&gi.isEqual(e.shear,t.shear)?void 0:t.shear})},(xs||(xs={})).defaultData={horizontalConstraint:0,verticalConstraint:0},(xa||(xa={})).defaultData={direction:"row",wrap:"unwrap",align:"top-left",gap:10,rowGap:10,autoGap:!1,autoRowGap:!1,leftPadding:8,rightPadding:8,topPadding:8,bottomPadding:8},(xn||(xn={})).defaultData={opacity:1,fill:{color:gl.fromHexAndA(5526619,1),enabled:!0},stroke:{color:gl.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:gl.from0to1([0,0,0,1]),enabled:!1,spread:0},innerShadow:{offset:[10,10],blurRadius:10,color:gl.from0to1([0,0,0,1]),enabled:!1,spread:0}},(yD=xo||(xo={})).newEmpty=function(e,t){return{name:t}},yD.patch=function(e,t){if(void 0===t)return e;let i={...e};return Object.assign(i,xr.merge(i,t)),i=function(e,t){if(void 0===t)return e;let i={...e};return"fill"in i&&"fill"in t&&void 0!==t.fill&&Object.assign(i,{fill:{...i.fill,...t.fill}}),"stroke"in i&&"stroke"in t&&void 0!==t.stroke&&Object.assign(i,{stroke:{...i.stroke,...t.stroke}}),"layerBlur"in i&&"layerBlur"in t&&void 0!==t.layerBlur&&Object.assign(i,{layerBlur:{...i.layerBlur,...t.layerBlur}}),"backgroundBlur"in i&&"backgroundBlur"in t&&void 0!==t.backgroundBlur&&Object.assign(i,{backgroundBlur:{...i.backgroundBlur,...t.backgroundBlur}}),"dropShadow"in i&&"dropShadow"in t&&void 0!==t.dropShadow&&Object.assign(i,{dropShadow:{...i.dropShadow,...t.dropShadow}}),"innerShadow"in i&&"innerShadow"in t&&void 0!==t.innerShadow&&Object.assign(i,{innerShadow:{...i.innerShadow,...t.innerShadow}}),i}(i=function(e,t){if(void 0===t)return e;let i={...e};for(let e of["width","height","cornerRadius"])e in i&&e in t&&void 0!==t[e]&&Object.assign(i,{[e]:t[e]});return i}(i,t),t)},yD.toOps=function(e,t){let i,r=[];for(let[e,s]of Object.entries(t))"name"!==e&&(void 0===i&&(i={path:[],props:{}
3139,type:0},r.push(i)),i.props[e]=s);return r},(xl||(xl={})).defaultData={...xr.defaultData,...xs.defaultData,states:new pP,events:new pP,visible:!0,raycastLock:!1},(xh||(xh={})).defaultData={...xl.defaultData,...xn.defaultData},(xc||(xc={})).defaultData={cornerRadius:[0,0,0,0]},(xd||(xd={})).defaultData={...xh.defaultData,type:"ellipse2d",width:100,height:100,name:"Ellipse"},(xu||(xu={})).defaultData={...xh.defaultData,...xc.defaultData,type:"rectangle2d",width:100,height:100,name:"Rectangle"},(xp||(xp={})).defaultData={...xh.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"},(xf||(xf={})).defaultData={...xh.defaultData,type:"path2d",path:"",name:"Path"},(xm||(xm={})).is=function(e){return"ellipse2d"===e.type||"rectangle2d"===e.type||"text2d"===e.type||"vector2d"===e.type||"path2d"===e.type},(xg||(xg={})).defaultData={...xl.defaultData,name:"Group",type:"group2d"},(xv||(xv={})).defaultData=()=>({...xl.defaultData,...xc.defaultData,...xn.defaultData,name:"Frame",type:"frame2d",clipped:!0,width:200,height:200,fill:{color:gl.fromHexAndA(4737101,1),enabled:!0},stroke:{color:gl.fromHexAndA(0,1),thickness:1,enabled:!1,mode:"inside"},backgroundBlur:{radius:2,enabled:!1},layerBlur:{radius:2,enabled:!1}}),(yO=xy||(xy={})).defaultData=function(e){switch(e){case"rectangle2d":case"vector2d":return{...xu.defaultData};case"ellipse2d":return{...xd.defaultData};case"text2d":return{...xp.defaultData};case"path2d":return{...xf.defaultData};case"frame2d":return{...xv.defaultData()};case"group2d":return{...xg.defaultData}}},yO.getPivot=function(e){return"width"in e&&"height"in e?["number"==typeof e.width?.5*e.width:0,"number"==typeof e.height?.5*e.height:0]:[0,0]},yO.isResizeable=function(e){return"rectangle2d"===e.type||"ellipse2d"===e.type||"text2d"===e.type||"frame2d"===e.type},yO.isAutoLayoutable=function(e){return"frame2d"===e.type&&void 0!==e.autoLayout},yO.hasCorners=function(e){return"rectangle2d"===e.type||"frame2d"===e.type},(p=xx||(xx={})).defaultData={name:"UI",type:"scene2d",objects:new pT},p.emptyData=function(){return{type:"scene2d",objects:new pT}};var vH={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},vG={duration:1e3,delay:0,endDelay:0,startOnceDelay:0,pingPongDelayCorrection:0,pingPongEndDelayCorrection:0,easing:"easeOutElastic(1, .5)",round:0},vq=["translateX","translateY","translateZ","rotate","rotateX","rotateY","rotateZ","scale","scaleX","scaleY","scaleZ","skew","skewX","skewY","perspective","matrix","matrix3d"],vX={},vY={};function vQ(e,t,i){return Math.min(Math.max(e,t),i)}function vZ(e,t){return e.indexOf(t)>-1}function vK(e,t){return e.apply(null,t)}var vJ={arr:function(e){return Array.isArray(e)},obj:function(e){return vZ(Object.prototype.toString.call(e),"Object")},pth:function(e){return vJ.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||vJ.svg(e))},str:function(e){return"string"==typeof e},fnc:function(e){return"function"==typeof e},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 vJ.hex(e)||vJ.rgb(e)||vJ.hsl(e)},key:function(e){return!vH.hasOwnProperty(e)&&!vG.hasOwnProperty(e)&&"targets"!==e&&"keyframes"!==e}};function v$(e){var t=/\(([^)]+)\)/.exec(e);return t?t[1].split(",").map(function(e){return parseFloat(e)}):[]}function v0(e,t){var i=v$(e),r=vQ(vJ.und(i[0])?1:i[0],.1,100),s=vQ(vJ.und(i[1])?100:i[1],.1,100),a=vQ(vJ.und(i[2])?10:i[2],.1,100),o=vQ(vJ.und(i[3])?0:i[3],.1,100),h=Math.sqrt(s/r),c=a/(2*Math.sqrt(s*r)),d=c<1?h*Math.sqrt(1-c*c):0,u=c<1?(c*h+-o)/d:-o+h;function p(e){var i=t?t*e/1e3:e;return i=c<1?Math.exp(-i*c*h)*(+Math.cos(d*i)+u*Math.sin(d*i)):(1+u*i)*Math.exp(-i*h),0===e||1===e?e:1-i}return t?p:function(){var t=vY[e];if(t)return t;for(var i=1/6,r=0,s=0;;)if(1===p(r+=i)){if(++s>=16)break}else s=0;var a=r*i*1e3;return vY[e]=a,a}}function v1(e){return void 0===e&&(e=10),function(t){return Math.ceil(vQ(t,1e-6,1)*e)*(1/e)}}var v2=function(){function e(e,t,i){return(((1-3*i+3*t)*e+(3*i-6*t))*e+3*t)*e}function t(e,t,i){return 3*(1-3*i+3*t)*e*e+2*(3*i-6*t)*e+3*t}return function(i,r,s,a){if(0<=i&&i<=1&&0<=s&&s<=1){var o=new Float32Array(11);if(i!==r||s!==a)for(var h=0;h<11;++h)o[h]=e(.1*h,i,s);return function(h){return i===r&&s===a||0===h||1===h?h:e(function(r){for(var a=0,h=1;10!==h&&o[h]<=r;++h)a+=.1;var c=a+(r-o[--h])/(o[h+1]-o[h])*.1,d=t(c,i,s);return d>=.001?function(i,r,s,a){for(var o=0;o<4;++o){var h=t(r,s,a);if(0===h)break;var c=e(r,s,a)-i;r-=c/h}return r}(r,c,i,s):0===d?c:function(t,i,r,s,a){var o,h,c=0;do(o=e(h=i+(r-i)/2,s,a)-t)>0?r=h:i=h;while(Math.abs(o)>1e-7&&++c<10)return h}(r,a,a+.1,i,s)}(h),r,a)}}}}(),v3=(yL={linear:function(){return function(e){return e}}},yI={Sine:function(){return function(e){return 1-Math.cos(e*Math.PI/2)}},Circ:function(){return function(e){return 1-Math.sqrt(1-e*e)}},Back:function(){return function(e){return e*e*(3*e-2)}},Bounce:function(){return function(e){for(var t,i=4;e<((t=Math.pow(2,--i))-1)/11;);return 1/Math.pow(4,3-i)-7.5625*Math.pow((3*t-2)/22-e,2)}},Elastic:function(e,t){void 0===e&&(e=1),void 0===t&&(t=.5);var i=vQ(e,1,10),r=vQ(t,.1,2);return function(e){return 0===e||1===e?e:-i*Math.pow(2,10*(e-1))*Math.sin(2*Math.PI*(e-1-r/(2*Math.PI)*Math.asin(1/i))/r)}}},["Quad","Cubic","Quart","Quint","Expo"].forEach(function(e,t){yI[e]=function(){return function(e){return Math.pow(e,t+2)}}}
3139),Object.keys(yI).forEach(function(e){var t=yI[e];yL["easeIn"+e]=t,yL["easeOut"+e]=function(e,i){return function(r){return 1-t(e,i)(1-r)}},yL["easeInOut"+e]=function(e,i){return function(r){return r<.5?t(e,i)(2*r)/2:1-t(e,i)(-2*r+2)/2}}}),yL);function v4(e,t){if(vJ.fnc(e))return e;var i=e.split("(")[0],r=v3[i],s=v$(e);switch(i){case"spring":return v0(e,t);case"cubicBezier":return vK(v2,s);case"steps":return vK(v1,s);default:return vK(r,s)}}function v5(e){try{return document.querySelectorAll(e)}catch{return}}function v6(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 o=e[a];t.call(r,o,a,e)&&s.push(o)}return s}function v8(e){return e.reduce(function(e,t){return e.concat(vJ.arr(t)?v8(t):t)},[])}function v9(e){return vJ.arr(e)?e:(vJ.str(e)&&(e=v5(e)||e),e instanceof NodeList||e instanceof HTMLCollection?[].slice.call(e):[e])}function v7(e,t){return e.some(function(e){return e===t})}function ye(e){var t={};for(var i in e)t[i]=e[i];return t}function yt(e,t){var i=ye(e);for(var r in e)i[r]=t.hasOwnProperty(r)?t[r]:e[r];return i}function yi(e,t){var i=ye(e);for(var r in t)i[r]=vJ.und(e[r])?t[r]:e[r];return i}function yr(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 ys(e,t){return vJ.fnc(e)?e(t.target,t.id,t.total):e}function ya(e,t){return e.getAttribute(t)}function yn(e,t,i){if(v7([i,"deg","rad","turn"],yr(t)))return t;var r=vX[t+i];if(!vJ.und(r))return r;var s=document.createElement(e.tagName),a=e.parentNode&&e.parentNode!==document?e.parentNode:document.body;a.appendChild(s),s.style.position="absolute",s.style.width=100+i;var o=100/s.offsetWidth;a.removeChild(s);var h=o*parseFloat(t);return vX[t+i]=h,h}function yo(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?yn(e,s,i):s}}function yl(e,t){return vJ.dom(e)&&!vJ.inp(e)&&(ya(e,t)||vJ.svg(e)&&e[t])?"attribute":vJ.dom(e)&&v7(vq,t)?"transform":vJ.dom(e)&&"transform"!==t&&yo(e,t)?"css":null!=e[t]?"object":void 0}function yh(e){if(vJ.dom(e)){for(var t,i=e.style.transform||"",r=/(\w+)\(([^)]*)\)/g,s=new Map;t=r.exec(i);)s.set(t[1],t[2]);return s}}function yc(e,t,i,r){switch(yl(e,t)){case"transform":var s,a;return s=vZ(t,"scale")?1:0+(vZ(t,"translate")||"perspective"===t?"px":vZ(t,"rotate")||vZ(t,"skew")?"deg":void 0),a=yh(e).get(t)||s,r&&(r.transforms.list.set(t,a),r.transforms.last=t),i?yn(e,a,i):a;case"css":return yo(e,t,i);case"attribute":return ya(e,t);default:return e[t]||0}}function yd(e,t){var i=/^(\*=|\+=|-=)/.exec(e);if(!i)return e;var r=yr(e)||0,s=parseFloat(t),a=parseFloat(e.replace(i[0],""));switch(i[0][0]){case"+":return s+a+r;case"-":return s-a+r;case"*":return s*a+r}}function yu(e,t){if(vJ.col(e)){var i,r,s;return vJ.rgb(e)?(i=/rgb\((\d+,\s*[\d]+,\s*[\d]+)\)/g.exec(e))?"rgba("+i[1]+",1)":e:vJ.hex(e)?(r=e.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,function(e,t,i,r){return t+t+i+i+r+r}),"rgba("+parseInt((s=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(r))[1],16)+","+parseInt(s[2],16)+","+parseInt(s[3],16)+",1)"):vJ.hsl(e)?function(e){var t,i,r,s=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(e)||/hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)/g.exec(e),a=parseInt(s[1],10)/360,o=parseInt(s[2],10)/100,h=parseInt(s[3],10)/100,c=s[4]||1;function d(e,t,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?e+(t-e)*6*i:i<.5?t:i<2/3?e+(t-e)*(2/3-i)*6:e}if(0==o)t=i=r=h;else{var u=h<.5?h*(1+o):h+o-h*o,p=2*h-u;t=d(p,u,a+1/3),i=d(p,u,a),r=d(p,u,a-1/3)}return"rgba("+255*t+","+255*i+","+255*r+","+c+")"}(e):void 0}if(/\s/g.test(e))return e;var a=yr(e),o=a?e.substr(0,e.length-a.length):e;return t?o+t:o}function yp(e,t){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function yf(e){for(var t,i=e.points,r=0,s=0;s<i.numberOfItems;s++){var a=i.getItem(s);s>0&&(r+=yp(t,a)),t=a}return r}function ym(e){var t;if(e.getTotalLength)return e.getTotalLength();switch(e.tagName.toLowerCase()){case"circle":return 2*Math.PI*ya(e,"r");case"rect":return 2*ya(e,"width")+2*ya(e,"height");case"line":return yp({x:ya(e,"x1"),y:ya(e,"y1")},{x:ya(e,"x2"),y:ya(e,"y2")});case"polyline":return yf(e);case"polygon":return t=e.points,yf(e)+yp(t.getItem(t.numberOfItems-1),t.getItem(0))}}function yg(e,t){var i=t||{},r=i.el||function(e){for(var t=e.parentNode;vJ.svg(t)&&vJ.svg(t.parentNode);)t=t.parentNode;return t}(e),s=r.getBoundingClientRect(),a=ya(r,"viewBox"),o=s.width,h=s.height,c=i.viewBox||(a?a.split(" "):[0,0,o,h]);return{el:r,viewBox:c,x:c[0]/1,y:c[1]/1,w:o/c[2],h:h/c[3]}}function yv(e,t){var i=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/g,r=yu(vJ.pth(e)?e.totalLength:e,t)+"";return{original:r,numbers:r.match(i)?r.match(i).map(Number):[0],strings:vJ.str(e)||t?r.split(i):[]}}function yy(e){return v6(e?v8(vJ.arr(e)?e.map(v9):v9(e)):[],function(e,t,i){return i.indexOf(e)===t})}function yx(e){var t=yy(e);return t.map(function(e,i){return{target:e,id:i,total:t.length,transforms:{list:yh(e)}}})}var yb={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(e,t){a+=t+"("+e+") "}),e.style.transform=a}}};function yw(e,t){yx(e).forEach(function(e){for(var i in t){var r=ys(t[i],e),s=e.target,a=yr(r),o=yc(s,i,a,e),h=yd(yu(r,a||yr(o)),o);yb[yl(s,i)](s,i,h,e.transforms,!0)}})}function y_(e,t){var i=e.length,r=function(e){return e.timelineOffset?e.timelineOffset:0},s={};return s.duration=i?Math.max.apply(Math,e.map(function(e){let t=e.startOnceDelay??0,i=e.pingPongDelayCorrection??0,s=e.pingPongEndDelayCorrection??0;return r(e)+t+i+s+e.duration*(e.loop??1)})):t.duration,s.delay=i?Math.min.apply(Math,e.map(function(e){let t=e.startOnceDelay??0,i=e.pingPongDelayCorrection??0;return r(e)+t+i+e.delay})):t.delay,s.endDelay=i?s.duration-Math.max.apply(Math,e.map(function(e){let t=e.startOnceDelay??0,i=e.pingPongDelayCorrection??0,s=e.pingPongEndDelayCorrection??0;return r(e)+t+i+e.duration*(e.loop??1)-e.endDelay-s})):t.endDelay,s}var yS,yC,yM,yE,yA,yT,yP,yD,yO,yL,yI,yR,yk,yB,yz,yN,yF,yj,yU,yV,yW,yH,yG,yq,yX,yY,yQ,yZ,yK,yJ,y$,y0,y1,y2,y3,y4,y5,y6,y8,y9,y7,xe,xt,xi,xr,xs,xa,xn,xo,xl,xh,xc,xd,xu,xp,xf,xm,xg,xv,xy,xx,xb,xw=0,x_=[],xS=[],xC=function(){let e=0;function t(e){let i=x_.length;if(i){let r=0;for(;r<i;){let t=x_[r];t.paused?(x_.splice(r,1),i--):(t.tick(e),r++)}xb=requestAnimationFrame(t)}else xb&&(cancelAnimationFrame(xb),xb=null)}return{isUsingInternalRaf:!0,play:function(){e=performance.now(),xb=requestAnimationFrame(t)},update:function(i){t(e+=i)}}}();function xM(e){void 0===e&&(e={});var t,i,r,s,a,o,h,c,d,u,p,f=0,m=0,g=0,v=0,y=null;function x(e){var t=window.Promise&&new Promise(function(e){return y=e});return e.finished=t,t}var b=(r=yt(vH,t=e),a=function(e,t){var i=[],r=t.keyframes;for(var s in r&&(t=yi(function(e){for(var t=v6(v8(e.map(function(e){return Object.keys(e)})),function(e){return vJ.key(e)}).reduce(function(e,t){return 0>e.indexOf(t)&&e.push(t),e},[]),i={},r=0;r<t.length;r++)!function(r){var s=t[r];
3139i[s]=e.map(function(e){var t={};for(var i in e)vJ.key(i)?i==s&&(t.value=e[i]):t[i]=e[i];return t})}(r);return i}(r),t)),t)vJ.key(s)&&i.push({name:s,tweens:function(e,t){var i=ye(t);if(/^spring/.test(i.easing)&&(i.duration=v0(i.easing)),vJ.arr(e)){var r=e.length;2!==r||vJ.obj(e[0])?vJ.fnc(t.duration)||(i.duration=t.duration/r):e={value:e}}var s=vJ.arr(e)?e:[e];return s.map(function(e,i){var r=vJ.obj(e)&&!vJ.pth(e)?e:{value:e};return vJ.und(r.delay)&&(r.delay=i?0:t.delay),vJ.und(r.endDelay)&&(r.endDelay=i===s.length-1?t.endDelay:0),r}).map(function(e){return yi(e,i)})}(t[s],e)});return i}(s=yt(vG,t),t),c=y_((i=o=yx(t.targets),h=v6(v8(i.map(function(e){return a.map(function(t){var i=e,r=t,s=yl(i.target,r.name);if(s){var a,o=r.tweens.map(function(e){var t=function(e,t){var i={};for(var r in e){var s=ys(e[r],t);vJ.arr(s)&&1===(s=s.map(function(e){return ys(e,t)})).length&&(s=s[0]),i[r]=s}return i.duration=parseFloat(i.duration),i.delay=parseFloat(i.delay),i}(e,i),s=t.value,o=vJ.arr(s)?s[1]:s,h=yr(o),c=yc(i.target,r.name,h,i),d=a?a.to.original:c,u=vJ.arr(s)?s[0]:d,p=yr(u)||yr(c),f=h||p;return vJ.und(o)&&(o=d),t.from=yv(u,f),t.to=yv(yd(o,u),f),t.start=a?a.end:0,t.end=t.start+t.delay+t.duration+t.endDelay,t.easing=v4(t.easing,t.duration),t.isPath=vJ.pth(s),t.isColor=vJ.col(t.from.original),t.isColor&&(t.round=1),a=t,t}),h=o[o.length-1];return{type:s,property:r.name,animatable:i,tweens:o,duration:h.end,delay:o[0].delay,endDelay:h.endDelay}}})})),function(e){return!vJ.und(e)})),s),d=xw,xw++,yi(r,{id:d,children:[],animatables:o,animations:h,duration:c.duration,delay:c.delay,endDelay:c.endDelay,startOnceDelay:s.startOnceDelay,pingPongDelayCorrection:s.pingPongDelayCorrection,pingPongEndDelayCorrection:s.pingPongEndDelayCorrection}));function w(){var e=b.direction;"alternate"!==e&&(b.direction="normal"!==e?"normal":"reverse"),b.reversed=!b.reversed,p.forEach(function(e){(1===e.loop||e.loop%2==0)&&(e.reversed=b.reversed)})}function _(e){return b.reversed?b.duration-e:e}function S(e,t,i=!1){t&&(b.reversed?t.seek(t.duration*t.loop-(e-t.timelineOffset-t.pingPongDelayCorrection),i):t.seek(e-t.timelineOffset-t.startOnceDelay-t.pingPongDelayCorrection,i))}function C(e){var t=0,i=b.animations,r=i.length;for("alternate"!==b.direction&&b.parent?.direction==="alternate"?b.parent?.rewind===!1&&!0===b.reversePlayback&&!1===b.rewind&&(e=b.parent?.reversed&&"alternate"===b.direction?b.duration-b.delay+b.endDelay-e:b.duration+b.delay-b.endDelay-e):A(!1,b.parent?.rewind,b.rewind,b.parent?.reversePlayback,b.reversePlayback)&&(e=b.parent?.reversed&&"alternate"===b.direction?b.duration-b.delay+b.endDelay-e:b.duration+b.delay-b.endDelay-e);t<r;){let r;var s=i[t],a=s.animatable,o=s.tweens,h=o.length-1,c=o[h];h&&(c=v6(o,function(t){return e<t.end})[0]||c),r=b.parent?.reversed&&"alternate"===b.direction?vQ(e-c.start-c.endDelay,0,c.duration)/c.duration:vQ(e-c.start-c.delay,0,c.duration)/c.duration;for(var d=isNaN(r)?1:c.easing(r),u=c.to.strings,p=c.round,f=[],m=c.to.numbers.length,g=void 0,v=0;v<m;v++){let e,t;var y=void 0;"alternate"!==b.direction?b.parent?.rewind===!1&&!0===b.reversePlayback&&!1===b.rewind?(e=c.to.numbers[v],t=c.from.numbers[v]||0):(t=c.to.numbers[v],e=c.from.numbers[v]||0):A(!0,b.parent?.rewind,b.rewind,b.parent?.reversePlayback,b.reversePlayback)?(e=c.to.numbers[v],t=c.from.numbers[v]||0):(t=c.to.numbers[v],e=c.from.numbers[v]||0),y=c.isPath?function(e,t){function i(i){void 0===i&&(i=0);var r=t+i>=1?t+i:0;return e.el.getPointAtLength(r)}var r=yg(e.el,e.svg),s=i(),a=i(-1),o=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 180*Math.atan2(o.y-a.y,o.x-a.x)/Math.PI}}(c.value,d*t):e+d*(t-e),p&&(c.isColor&&v>2||(y=Math.round(y*p)/p)),f.push(y)}var x=u.length;if(x){g=u[0];for(var w=0;w<x;w++){u[w];var _=u[w+1],S=f[w];isNaN(S)||(_?g+=S+_:g+=S+" ")}}else g=f[0];yb[s.type](a.target,s.property,g,a.transforms),s.currentValue=g,t++}}function M(e){b[e]&&!b.passThrough&&b[e](b)}x(b);let E={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 A(e,t,i,r,s){return E[e<<4|t<<3|i<<2|r<<1|s]}function T(e,t=!1){var i=b.duration;let r=b.delay,s=i-b.endDelay;b.parent?.reversed&&"alternate"===b.direction&&(r=b.endDelay,s=i-b.delay);var a=_(e);if(b.progress=vQ(a/i*100,0,100),t||(b.reversePlayback=a<b.currentTime),v&&function(e,t=!1){if(b.reversed)for(var i=v;i--;)S(e,p[i],t);else for(var r=0;r<v;r++)S(e,p[r],t)}(a,t),!b.began&&a>=r&&(b.began=!0),!b.loopBegan&&b.currentTime>0&&(b.loopBegan=!0,M("loopBegin")),(b.reversed||a>=0)&&a<=r&&0!==b.currentTime&&(C(0),M("change")),(a>=s&&b.currentTime!==i+b.pingPongDelayCorrection||!i)&&(C(i),M("change")),a>r&&a<s?(b.changeBegan||(b.changeBegan=!0,b.changeCompleted=!1,M("changeBegin")),C(a),M("change")):b.changeBegan?(b.changeCompleted=!0,b.changeBegan=!1,M("change"),v&&M("timelineChangeComplete")):b.began&&a>s&&M("changeComplete"),b.currentTime=vQ(a,0,i+b.pingPongDelayCorrection),b.began&&M("update"),e>=i)if(b.remaining&&!0!==b.remaining&&b.remaining--,b.remaining){for(let e of(v?f+=b.duration/xM.speed:f+=b.duration,p))e.setStartTime(0),e.remaining=e.loop;M("loopComplete"),b.loopBegan=!1,"alternate"===b.direction?w():v&&(b.direction="normal",b.reversed=!1,p.forEach(function(e){return e.reversed=!1}))}else b.paused=!0,b.completed||(b.completed=!0,M("loopComplete"),M("complete"),!b.passThrough&&"Promise"in window&&(y(),x(b)))}return b.reset=function(){var e=b.direction;b.passThrough=!1,b.currentTime=0,b.progress=0,b.paused=!0,b.began=!1,b.loopBegan=!1,b.changeBegan=!1,b.completed=!1,b.changeCompleted=!1,b.reversed="reverse"===e,b.remaining=b.loop,v=(p=b.children).length;for(var t=v;t--;)b.children[t].reset();C(b.reversed?b.duration:0)},b.setStartTime=function(e){f=e},b.set=function(e,t){return yw(e,t),b},b.tick=function(e){g=e,f||(f=g),T((g+(m-f))*xM.speed)},b.seek=function(e,t=!1){T(e-f,t)},b.pause=function(e){b.paused=!0,v&&(u=e??performance.now())},b.play=function(e){b.paused&&(b.completed&&b.reset(),b.paused=!1,x_.push(b),v&&void 0!==u&&(f+=(e??performance.now())-u),!xb&&xC.isUsingInternalRaf&&xC.play())},b.reverse=function(){w(),b.completed=!b.reversed,f=0,m=_(b.currentTime)*(1/xM.speed)},b.restart=function(){b.reset(),b.play()},b.reset(),b.autoplay&&b.play(),b}function xE(e,t){for(var i=t.length;i--;)v7(e,t[i].animatable.target)&&t.splice(i,1)}"u">typeof document&&document.addEventListener("visibilitychange",function(e){document.hidden?(x_.forEach(function(t){return t.pause(e.timeStamp)}),xS=x_.slice(0),xM.running=x_=[]):xS.forEach(function(t){return t.play(e.timeStamp)})}),xM.version="3.2.0",xM.speed=1,xM.running=x_,xM.remove=function(e){for(var t=yy(e),i=x_.length;i--;){var r=x_[i],s=r.animations,a=r.children;xE(t,s);for(var o=a.length;o--;){var h=a[o],c=h.animations;xE(t,c),c.length||h.children.length||a.splice(o,1)}s.length||a.length||r.pause()}},xM.get=yc,xM.set=yw,xM.convertPx=yn,xM.path=function(e,t){var i=vJ.str(e)?v5(e)[0]:e,r=t||100;return function(e){return{property:e,el:i,svg:yg(i),totalLength:ym(i)*(r/100)}}},xM.setDashoffset=function(e){var t=ym(e);return e.setAttribute("stroke-dasharray",t),t},xM.stagger=function(e,t){void 0===t&&(t={});var i=t.direction||"normal",r=t.easing?v4(t.easing):null,s=t.grid,a=t.axis,o=t.from||0,h="first"===o,c="center"===o,d="last"===o,u=vJ.arr(e),p=parseFloat(u?e[0]:e),f=u?parseFloat(e[1]):0,m=yr(u?e[1]:e)||0,g=t.start||0+(u?p:0),v=[],y=0;return function(e,t,x){if(h&&(o=0),c&&(o=(x-1)/2),d&&(o=x-1),!v.length){for(var b=0;b<x;b++){if(s){var w=c?(s[0]-1)/2:o%s[0],_=c?(s[1]-1)/2:Math.floor(o/s[0]),S=b%s[0],C=Math.floor(b/s[0]),M=w-S,E=_-C,A=Math.sqrt(M*M+E*E);"x"===a&&(A=-M),"y"===a&&(A=-E),v.push(A)}else v.push(Math.abs(o-b));y=Math.max.apply(Math,v)}r&&(v=v.map(function(e){return r(e/y)*y})),"reverse"===i&&(v=v.map(function(e){return a?e<0?-1*e:-e:Math.abs(y-e)}))}return g+(u?(f-p)/y:p)*(Math.round(100*v[t])/100)+m}},xM.timeline=function(e){void 0===e&&(e={});var t=xM(e);return t.duration=0,t.add=function(i,r){var s=x_.indexOf(t),a=t.children;function o(e){e.passThrough=!0}s>-1&&x_.splice(s,1);for(var h=0;h<a.length;h++)o(a[h]);var c=yi(i,yt(vG,e));c.targets=c.targets||e.targets;var d=t.duration;c.autoplay=!1,c.timelineOffset=vJ.und(r)?d:yd(r,d),o(t);var u=xM(c);o(u),a.push(u),u.parent=t;var p=y_(a,e);return t.delay=p.delay,t.endDelay=p.endDelay,t.duration=p.duration,!0===u.loop&&(t.duration=1/0),t.seek(0),t.reset(),t.autoplay&&t.play(),t},t},xM.easing=v4,xM.penner=v3,xM.random=function(e,t){return Math.floor(Math.random()*(t-e+1))+e};var xA=class extends ir{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("transparent"===e)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="rgba"===s?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="hsla"===s?parseFloat(r[4]):1,super.setStyle(e,t)}}return super.setStyle(e,t)}get x(){return this.r}get y(){return this.g}get z(){return this.b}get w(){return this.a}set x(e){this.r=e}set y(e){this.g=e}set z(e){this.b=e}set w(e){this.a=e}},{degToRad:xT,radToDeg:xP}=tQ,xD=new iy,xO=new iy,xL=new iv;function xI(e,t,i,r,s,a){let o=void 0!==i[e]?i[e]:void 0,h=r[e];if(null==h)return;let c=null!=o?"string"==typeof o?Number(s.getVariable(o)??0):o:t[e],d="string"==typeof h?Number(s.getVariable(h)??0):h;if(c!==d)return{update:i=>{let r=tQ.lerp(c,d,i);a?t[e]=Math.trunc(r):t[e]=r},start:()=>{t[e]=c},end:()=>{t[e]=d}}}function xR(e,t,i,r,s,a){let o=i[e]?i[e]:void 0,h=r[e];if(!h)return;let c=t[e],d=[...o??c].map(e=>"string"==typeof e?Number(s.getVariable(e)??0):e),u=[...h].map(e=>"string"==typeof e?Number(s.getVariable(e)??0):e);if(!(d.length!==u.length||uV(d,u)))return{update:i=>{d.forEach((r,s)=>{let o=tQ.lerp(r,u[s],i);t[e][s]=a?Math.trunc(o):o})},start:()=>{Object.assign(t[e],d)},end:()=>{Object.assign(t[e],u)}}}function xk(e,t,i){return t.forEach((t,r)=>{e.setComponent(r,"string"==typeof t?Number(i.getVariable(t)??0):t)}),e}function xB(e,t,i,r,s){let a=i[e]?i[e]:void 0,o=r[e];if(!o)return;let h=t[e],c=a?xk(new iy,a,s):h.clone(),d=xk(new iy,o,s);if(!c.equals(d))return{update:e=>{h.lerpVectors(c,d,e)},start:()=>{h.copy(c)},end:()=>{h.copy(d)}}}function xz(e,t,i){return t.forEach((t,r)=>{e.setComponent(r,"string"==typeof t?Number(i.getVariable(t)??0):t)}),e}function xN(e,t,i,r,s){let a=i[e]?i[e]:void 0,o=r[e];if(!o)return;let h=t[e],c=!(h instanceof tZ),d=h instanceof tZ?h:new tZ().fromArray(h),u=a?xz(new tZ,a,s):d.clone(),p=xz(new tZ,o,s);if(!u.equals(p))return{update:i=>{d.lerpVectors(u,p,i),c&&(t[e]=d.toArray())},start:()=>{d.copy(u),c&&(t[e]=d.toArray())},end:()=>{d.copy(p),c&&(t[e]=d.toArray())}}}function xF(e,t,i,r,s){let a=i[e]?i[e]:void 0,o=r[e];if(!o)return;let h=t[e],c=new xA(h.r,h.g,h.b,h.a),d=a?"string"==typeof a?s.getColor(a).clone():new xA(a.r,a.g,a.b,a.a):c.clone(),u="string"==typeof o?s.getColor(o).clone():new xA(o.r,o.g,o.b,o.a);if(!d.equals(u))return{update:i=>{c.lerpColors(d,u,i),c.a=tQ.lerp(d.a,u.a,i),t[e]={r:c.r,g:c.g,b:c.b,a:c.a}},start:()=>{c.copy(d)},end:()=>{c.copy(u)}}}function xj(e,t,i,r,s){return"number"==typeof t[e]?xI(e,t,i??{},r,s):Array.isArray(t[e])?xR(e,t,i??{},r,s):void 0}var xU=new i4;function xV(e,t,i,r,s){let a=i[e],o=r[e];if("number"==typeof t[e])t[e]=tQ.lerp(a,o,s);else if(Array.isArray(t[e]))for(let i=0,r=a.length;i<r;i++)t[e][i]=tQ.lerp(a[i],o[i],s)}function xW(e,t=[0,0]){return[e&&!isNaN(e[0])?e[0]:t[0],e&&!isNaN(e[1])?e[1]:t[1]]}function xH(e,t,i){switch(e){case 0:return"cubicBezier( 0, 0, 1, 1 )";case 1:return"cubicBezier( .25, .1, .25, 1 )";case 2:return"cubicBezier( .42, 0, 1, 1 )";case 3:return"cubicBezier( 0, 0, .58, 1 )";case 4:return"cubicBezier( .42, 0, .58, 1 )";case 7:return"cubicBezier( .25, 1, .5, 1 )";case 5:let{control1:r,control2:s}=t??{...gE.defaultData};return`cubicBezier( ${r[0]}, ${r[1]}, ${s[0]}, ${s[1]} )`;case 6:let{mass:a,stiffness:o,damping:h,velocity:c}=i??{...gc.defaultData},d=new xK(a,o,h,c),u=d.solve(1);return()=>e=>d.solve(e)/u;case 8:return()=>e=>Math.floor(e)}}(bE||(bE={})).is=function(e){return e&&"number"==typeof e.x&&"number"==typeof e.y&&"number"==typeof e.z};var xG=bA||(bA={});function xq(e,t,i,r){let s=[];
3139return t.properties.forEach((t,a)=>{let o=t.data.path?.[0];if(o&&["position","rotation","scale"].includes(o)){let r=function(e,t=()=>{},i){let r=[];for(let s of xY){let a=[...e.keyframes??[]].filter(e=>void 0!==e.data.value[s]).sort((e,t)=>e.data.time-t.data.time),o=a[0];o&&t?.(o.data.value);let h={index:[],t:[]};for(let e=0;e<a.length-1;e++){let t=a[e],i=a[e+1]??t,r={duration:(i?.data?.time-t.data.time)*1e3,delay:0===e?1e3*a[0].data.time:0};e<a.length-1&&(h.t.push({...r,value:+(e%2==0),easing:xH(t.data.easing.type,{control1:xW(t.data.easing.cubicControls?.control1,[0,0]),control2:xW(i.data.easing.cubicControls?.control2,[1,1])},t.data.easing.springParameters)}),h.index.push({...r,value:e,easing:"linear"}))}if(a.length>1){let o={t:0,index:0};r.push({targets:o,...h,update:r=>{let h=Math.ceil(o.index),c=h%2==0?o.t:1-o.t,d=a?.[h].data.value,u=a?.[h+1]?.data.value;if(void 0!==d&&void 0!==u){let r=i&&"rotation"===e.path[0]&&3===Object.keys(d).length&&3===Object.keys(u).length?function(e,t,i,r=!0){let s=[e.x,e.y,e.z],a=[t.x,t.y,t.z];r&&(s=s.map(xT),a=a.map(xT));let o=new iv().setFromEuler(xU.fromArray(s)),h=new iv().setFromEuler(xU.fromArray(a)),c=o.slerp(h,i),d=new i4().setFromQuaternion(c),u=[d.x,d.y,d.z];return r&&(u=u.map(xP)),{x:u[0],y:u[1],z:u[2]}}(d,u,c):{[s]:d[s]+(u[s]-d[s])*c};t?.(r)}}})}}return r}(t.data,i?.[o],e instanceof Ts);r&&s.push(...r)}if(o&&"shape size"===o&&"geometry"in e){let e=function(e,t){let i=[];for(let r of xY){let s={},a=[...e.keyframes??[]].filter(e=>void 0!==e.data.value[r]).sort((e,t)=>e.data.time-t.data.time),o=a[0];o&&t?.(o.data.value),s={index:[],t:[]};for(let e=0;e<a.length-1;e++){let t=a[e],i=a[e+1]??t,r={duration:(i?.data?.time-t.data.time)*1e3,delay:0===e?1e3*a[0].data.time:0};e<a.length-1&&(s.t.push({...r,value:+(e%2==0),easing:xH(t.data.easing.type,{control1:xW(t.data.easing.cubicControls?.control1,[0,0]),control2:xW(i.data.easing.cubicControls?.control2,[1,1])},t.data.easing.springParameters)}),s.index.push({...r,value:e,easing:"linear"}))}if(a.length>1){let e={t:0,index:0};i.push({targets:e,...s,update:i=>{let s=Math.ceil(e.index),o=s%2==0?e.t:1-e.t,h=a?.[s].data.value,c=a?.[s+1]?.data.value;if(void 0!==h&&void 0!==c){let e={[r]:h[r]+(c[r]-h[r])*o};t?.(e)}}})}}return i}(t.data,i?.shapeSize);e&&s.push(...e)}if(o&&"path extrusion"===o&&e instanceof Og){let r=function(e,t,i){let r={},s=[...t.keyframes??[]].sort((e,t)=>e.data.time-t.data.time),a=s[0];a&&i?.(e,a.data.value),r={index:[],t:[]};for(let e=0;e<s.length-1;e++){let t=s[e],i=s[e+1]??t,a={duration:(i?.data?.time-t.data.time)*1e3,delay:0===e?1e3*s[0].data.time:0};e<s.length-1&&(r.t.push({...a,value:+(e%2==0),easing:xH(t.data.easing.type,{control1:xW(t.data.easing.cubicControls?.control1,[0,0]),control2:xW(i.data.easing.cubicControls?.control2,[1,1])},t.data.easing.springParameters)}),r.index.push({...a,value:e,easing:"linear"}))}if(s.length>1){let t={t:0,index:0};return{targets:t,...r,update:r=>{let a=Math.ceil(t.index),o=a%2==0?t.t:1-t.t,h=s?.[Math.min(a,s.length-1)].data.value,c=s?.[Math.min(a,s.length-1)+1]?.data.value;i?.(e,function(e,t,i,r){let s=e.geometry.userData.parameters.extrusion;if(s)return gZ.forEach(e=>{xV(e,s,t,i,r)}),s}(e,h,c,o))}}}}(e,t.data,i?.pathExtrusion);r&&s.push(r)}if(o&&"path snapping"===o&&e.data.pathSnapping){let r=function(e,t,i){let r={},s=[...t.keyframes??[]].sort((e,t)=>e.data.time-t.data.time),a=s[0];a&&i?.(a.data.value),r={index:[],t:[]};for(let e=0;e<s.length-1;e++){let t=s[e],i=s[e+1]??t,a={duration:(i?.data?.time-t.data.time)*1e3,delay:0===e?1e3*s[0].data.time:0};e<s.length-1&&(r.t.push({...a,value:+(e%2==0),easing:xH(t.data.easing.type,{control1:xW(t.data.easing.cubicControls?.control1,[0,0]),control2:xW(i.data.easing.cubicControls?.control2,[1,1])},t.data.easing.springParameters)}),r.index.push({...a,value:e,easing:"linear"}))}if(s.length>1){let t={t:0,index:0};return{targets:t,...r,update:r=>{let a=Math.ceil(t.index),o=a%2==0?t.t:1-t.t,h=s?.[Math.min(a,s.length-1)].data.value,c=s?.[Math.min(a,s.length-1)+1]?.data.value;i?.(function(e,t,i,r){let s=e.updatedPathSnapping;if(s)return vu.forEach(e=>{xV(e,s,t,i,r)}),s}(e,h,c,o))}}}}(e,t.data,i?.pathSnapping);r&&s.push(r)}if(o&&"material"===o&&"Mesh"===e.type&&"material"in e&&e.material instanceof EA){let a=t.data.id;if(a){let o=e.material.getLayerByUuid(a);if(o){let e=xQ(o,t.data,i?.material,r);e&&s.push(e)}else{let a=e.material.getLayersOfType(t.data.type);if(a)for(let e of a){let a=xQ(e,t.data,i?.material,r);a&&s.push(a)}}}}if(o&&"opacity"===o&&"Mesh"===e.type&&"material"in e){let e=function(e,t){if(e){let i={},r=[...e.keyframes??[]].sort((e,t)=>
3139e.data.time-t.data.time),s=r[0];s&&t?.(s.data.value),i={index:[],t:[]};for(let e=0;e<r.length-1;e++){let t=r[e],s=r[e+1]??t,a={duration:(s?.data?.time-t.data.time)*1e3,delay:0===e?1e3*r[0].data.time:0};e<r.length-1&&(i.t.push({...a,value:+(e%2==0),easing:xH(t.data.easing.type,{control1:xW(t.data.easing.cubicControls?.control1,[0,0]),control2:xW(s.data.easing.cubicControls?.control2,[1,1])},t.data.easing.springParameters)}),i.index.push({...a,value:e,easing:"linear"}))}if(r.length>1){let e={t:0,index:0};return{targets:e,...i,update:i=>{let s=Math.ceil(e.index),a=s%2==0?e.t:1-e.t,o=r?.[Math.min(s,r.length-1)].data.value,h=r?.[Math.min(s,r.length-1)+1]?.data.value,c=tQ.lerp(o,h,a);t?.(c)}}}}}(t.data,i?.opacity);e&&s.push(e)}if(o&&"cloner"===o){let r=function(e,t,i){let r={},s=[...t.keyframes??[]].sort((e,t)=>e.data.time-t.data.time),a=s[0];a&&i?.(e,a.data.value,a.data.value),r={index:[],t:[]};for(let e=0;e<s.length-1;e++){let t=s[e],i=s[e+1]??t,a={duration:(i?.data?.time-t.data.time)*1e3,delay:0===e?1e3*s[0].data.time:0};e<s.length-1&&(r.t.push({...a,value:+(e%2==0),easing:xH(t.data.easing.type,{control1:xW(t.data.easing.cubicControls?.control1,[0,0]),control2:xW(i.data.easing.cubicControls?.control2,[1,1])},t.data.easing.springParameters)}),r.index.push({...a,value:e,easing:"linear"}))}if(s.length>1){let t={t:0,index:0};return{targets:t,...r,update:r=>{let a=Math.ceil(t.index),o=a%2==0?t.t:1-t.t,h=s?.[Math.min(a,s.length-1)].data.value,c=s?.[Math.min(a,s.length-1)+1]?.data.value;i?.(e,h.randomnessObject?void 0:function(e,t,i,r){let s=r.cloner?.parameters;if(s){for(let r of(xV("count",s,e,t,i),s.count=Math.trunc(s.count),gf))xV(r,s.radial,e.radial,t.radial,i);for(let r of gm)xV(r,s.linear,e.linear,t.linear,i);for(let r of gg)xV(r,s.grid,e.grid,t.grid,i);for(let r of gv)xV(r,s.toObject,e.toObject,t.toObject,i);return s}}(h,c,o,e),h.randomnessObject?function(e,t,i,r){let s=r.cloner?.parameters;if(s){for(let r of gy)xV(r,s.randomnessObject,e.randomnessObject,t.randomnessObject,i);return s}}(h,c,o,e):void 0)}}}}(e,t.data,i?.cloner);r&&s.push(r)}if(o&&"camera"===o&&e instanceof Ts){let r=function(e,t,i,r){if(t){let s={[r]:[]},a=[...t.keyframes??[]].sort((e,t)=>e.data.time-t.data.time),o=a[0];o&&(e[r]=o.data.value,o&&i?.(r,o.data.value));for(let e=0;e<a.length-1;e++){let t=a[e];if(!Number.isFinite(t.data.value))continue;let i=a[e+1]??t,o=i.data.value;s[r].push({value:o,easing:xH(t.data.easing.type,{control1:xW(t.data.easing.cubicControls?.control1,[0,0]),control2:xW(i.data.easing.cubicControls?.control2,[1,1])},t.data.easing.springParameters),duration:(i?.data?.time-t.data.time)*1e3,delay:0===e?1e3*a[0].data.time:0})}if(a.length>1)return{targets:e,...s,update:()=>{i?.(r,e[r])}}}}(e,t.data,i?.camera,"zoom");r&&s.push(r)}if(o&&"light"===o&&(e instanceof Dg||e instanceof Of||e instanceof Db)){let a=function(e,t,i,r,s){if(t){let a={},o=[...t.keyframes??[]].sort((e,t)=>e.data.time-t.data.time),h=o[0];if(h){let t=h.data.value;e[r]=t,i?.(r,t)}a={index:[],t:[]};for(let e=0;e<o.length-1;e++){let t=o[e],i=o[e+1]??t,r={duration:(i?.data?.time-t.data.time)*1e3,delay:0===e?1e3*o[0].data.time:0};e<o.length-1&&(a.t.push({...r,value:+(e%2==0),easing:xH(t.data.easing.type,{control1:xW(t.data.easing.cubicControls?.control1,[0,0]),control2:xW(i.data.easing.cubicControls?.control2,[1,1])},t.data.easing.springParameters)}),a.index.push({...r,value:e,easing:"linear"}))}if(o.length>1){let e={t:0,index:0};return{targets:e,...a,update:()=>{let t=Math.ceil(e.index),a=t%2==0?e.t:1-e.t,h=xZ(o?.[Math.min(t,o.length-1)].data.value,o?.[Math.min(t,o.length-1)+1]?.data.value,a,s);i?.(r,h)}}}}}(e,t.data,i?.light,t.data.path[1],r);a&&s.push(a)}}),s}function xX(e,t,i){return{id:t,fi:i,data:{id:t,path:e,keyframes:new pP}}}xG.getControlsWithDefault=function(e,t){let i=[0,0],r=[1,1];if(e?.cubicControls)i=xW(e.cubicControls.control1,i);else switch(e?.type){case 2:case 4:i=[.42,0];break;case 3:case 0:i=[0,0];break;case 1:i=[.25,.1];break;case 7:i=[.25,1]}if(t?.cubicControls)r=xW(t.cubicControls.control2,r);else switch(t?.type){case 2:case 0:r=[1,1];break;case 3:case 4:r=[.58,1];break;case 1:r=[.25,1];break;case 7:r=[.5,1]}return{control1:i,control2:r}},xG.defaultData=function(e,t){return{id:e,name:t,to:5,properties:new pP}},xG.createMaterialGroup=function(e){let t=new pP;return e.forEach(({data:e,id:i,fi:r})=>{if("light"===e.type){let s=xX(["material",`${e.category} lighting`],i,r);t.push(s)}else{let s=xX(["material",e.type],i,r);t.push(s)}}),t},xG.createName=function(e){return Object.entries(e).reduce((e,[t,i])=>
3139("string"!=typeof i&&e.push({name:i.name}),e),[])},xG.createTimeline=function(e,t,i){let r=xM.timeline({easing:xH(0),begin(){e.resetBBoxNeedsUpdate()},change(){e.resetBBoxNeedsUpdate()},direction:t.direction,autoplay:!1});return xq(e,t,i).forEach(e=>r.add(e,0)),r.duration=1e3*t.to,r},xG.addKeyframesToTimeline=xq,xG.Presets=[{name:"Slide in",animationParams:{translateX:{value:[-20,0],easing:xH(3),duration:1e3},opacity:{value:[0,1],easing:xH(3),duration:1e3},endDelay:250,loop:!0}},{name:"Rotate",animationParams:{rotate:{value:[0,"1turn"],easing:xH(5),duration:700},endDelay:250,loop:!0}},{name:"Scale Out",animationParams:{scale:{value:[1,1.5],easing:xH(4),duration:1e3},endDelay:250,loop:!0}},{name:"Jump",animationParams:{translateY:[{value:0,duration:200,easing:"linear"},{value:-20,easing:"linear",duration:200},{value:0,easing:"linear",duration:100}],endDelay:500,loop:!0}},{name:"Jump Rotate",animationParams:{translateY:[{value:0,duration:200,easing:"linear"},{value:-20,easing:"linear",duration:200},{value:0,easing:"linear",duration:100}],rotate:{value:[0,"1turn"],easing:xH(5),duration:500},endDelay:500,loop:!0}},{name:"Bounce",animationParams:{translateY:{value:["20px","-20px"],duration:575,easing:"easeOutQuad"},direction:"alternate",loop:!0}}];var xY=["x","y","z"];function xQ(e,t,i,r){if(t){let s={},a=[...t.keyframes??[]].sort((e,t)=>e.data.time-t.data.time);if("data"in e){let t=a[0];t&&i?.(t.data.value,e),s={index:[],t:[]};for(let e=0;e<a.length-1;e++){let t=a[e],i=a[e+1]??t,r={duration:(i?.data?.time-t.data.time)*1e3,delay:0===e?1e3*a[0].data.time:0};e<a.length-1&&(s.t.push({...r,value:+(e%2==0),easing:xH(t.data.easing.type,{control1:xW(t.data.easing.cubicControls?.control1,[0,0]),control2:xW(i.data.easing.cubicControls?.control2,[1,1])},t.data.easing.springParameters)}),s.index.push({...r,value:e,easing:"linear"}))}if(a.length>1){let t={t:0,index:0};return{targets:t,...s,update:s=>{let o=Math.ceil(t.index),h=o%2==0?t.t:1-t.t,c=a?.[Math.min(o,a.length-1)].data.value,d=a?.[Math.min(o,a.length-1)+1]?.data.value,u={},p={};if(Object.keys(c).length>0&&Object.keys(d).length>0){for(let t in e.data)if(t in c&&t in d){let e=xZ(c[t],d[t],h,r);void 0!==e&&(u[t]=e,p[t]={start:c,end:d,t:h})}}i?.({...u},e,p)}}}}}}function xZ(e,t,i,r){if("string"==typeof e&&r&&(e=r.color(e)),"string"==typeof t&&r&&(e=r.color(t)),"number"==typeof e)return e===t?void 0:tQ.lerp(e,t,i);if(gl.is(e))return gl.lerp(e,t,i);if(go.is(e))return go.lerp(e,t,i);if(Array.isArray(e))return(e.length>t.length?t:e).map((r,s,a)=>{if(!Array.isArray(r))return tQ.lerp(e[s],t[s],i);{let r=e[s].length>t[s].length?t[s].length:e[s].length;return(4===r?gs:3===r?gr:gi).lerp(e[s],t[s],i)}});if("object"==typeof e&&null!==e){let s={};for(let a in e){let o=xZ(e[a],t[a],i,r);void 0!==o&&(s[a]=o)}return s}}var xK=class{constructor(e=1,t=100,i=10,r=0){this.mass=e,this.stiffness=t,this.damping=i,this.initialVelocity=r,this.m_w0=Math.sqrt(t/e),this.m_zeta=i/(2*Math.sqrt(t*e)),this.m_zeta<1?(this.m_wd=this.m_w0*Math.sqrt(1-this.m_zeta*this.m_zeta),this.m_A=1,this.m_B=(this.m_zeta*this.m_w0+-r)/this.m_wd):(this.m_wd=0,this.m_A=1,this.m_B=-r+this.m_w0)}solve(e){return 1-(e=this.m_zeta<1?Math.exp(-e*this.m_zeta*this.m_w0)*(this.m_A*Math.cos(this.m_wd*e)+this.m_B*Math.sin(this.m_wd*e)):(this.m_A+this.m_B*e)*Math.exp(-e*this.m_w0))}getDuration(){let e=0,t=0;for(;;)if(e+=.16666666666666666,1===this.solve(e)){if(++t>=16)break}else t=0;return .16666666666666666*e*1e3}},xJ=class{};function x$(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 x0(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 x1(e,t,i){let r,s;for(let a=0;a<3;a++){let o=a+3;r=e[a],s=t[a],i[a]=r<s?r:s,r=e[o],s=t[o],i[o]=r>s?r:s}}function x2(e,t,i){for(let r=0;r<3;r++){let s=t[e+2*r],a=t[e+2*r+1],o=s-a,h=s+a;o<i[r]&&(i[r]=o),h>i[r+3]&&(i[r+3]=h)}}function x3(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 x4(e,t,i,r,s=null){let a=1/0,o=1/0,h=1/0,c=-1/0,d=-1/0,u=-1/0,p=1/0,f=1/0,m=1/0,g=-1/0,v=-1/0,y=-1/0,x=null!==s;for(let r=6*t,s=(t+i)*6;r<s;r+=6){let t=e[r+0],i=e[r+1],s=t-i,b=t+i;s<a&&(a=s),b>c&&(c=b),x&&t<p&&(p=t),x&&t>g&&(g=t);let w=e[r+2],_=e[r+3],S=w-_,C=w+_;S<o&&(o=S),C>d&&(d=C),x&&w<f&&(f=w),x&&w>v&&(v=w);let M=e[r+4],E=e[r+5],A=M-E,T=M+E;A<h&&(h=A),T>u&&(u=T),x&&M<m&&(m=M),x&&M>y&&(y=M)}r[0]=a,r[1]=o,r[2]=h,r[3]=c,r[4]=d,r[5]=u,x&&(s[0]=p,s[1]=f,s[2]=m,s[3]=g,s[4]=v,s[5]=y)}var x5=(e,t)=>e.candidate-t.candidate,x6=Array(32).fill().map(()=>({count:0,bounds:new Float32Array(6),rightCacheBounds:new Float32Array(6),leftCacheBounds:new Float32Array(6),candidate:0})),x8=new Float32Array(6),x9=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 a=e[s][t];i=a<i?a:i,r=a>r?a: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 a=t[s],o=e.dot(a);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}};x9.prototype.setFromBox=(f=new iy,function(e,t){let i=t.min,r=t.max,s=1/0,a=-1/0;for(let t=0;t<=1;t++)for(let o=0;o<=1;o++)for(let h=0;h<=1;
3139h++){f.x=i.x*t+r.x*(1-t),f.y=i.y*o+r.y*(1-o),f.z=i.z*h+r.z*(1-h);let c=e.dot(f);s=Math.min(c,s),a=Math.max(c,a)}this.min=s,this.max=a}),new x9;var x7=(m=new iy,g=new iy,v=new iy,function(e,t,i){let r=e.start,s=t.start;v.subVectors(r,s),m.subVectors(e.end,e.start),g.subVectors(t.end,t.start);let a=v.dot(g),o=g.dot(m),h=g.dot(g),c=v.dot(m),d=m.dot(m)*h-o*o,u,p;u=0!==d?(a*o-c*h)/d:0,p=(a+u*o)/h,i.x=u,i.y=p}),be=(y=new tZ,x=new iy,b=new iy,function(e,t,i,r){x7(e,t,y);let s=y.x,a=y.y;if(s>=0&&s<=1&&a>=0&&a<=1){e.at(s,i),t.at(a,r);return}if(s>=0&&s<=1){a<0?t.at(0,r):t.at(1,r),e.closestPointToPoint(r,!0,i);return}if(a>=0&&a<=1){s<0?e.at(0,i):e.at(1,i),t.closestPointToPoint(i,!0,r);return}{let o,h;if(o=s<0?e.start:e.end,h=a<0?t.start:t.end,e.closestPointToPoint(h,!0,x),t.closestPointToPoint(o,!0,b),x.distanceToSquared(h)<=b.distanceToSquared(o)){i.copy(x),r.copy(h);return}i.copy(o),r.copy(b);return}}),bt=(w=new iy,_=new iy,S=new ss,C=new lF,function(e,t){let{radius:i,center:r}=e,{a:s,b:a,c:o}=t;if(C.start=s,C.end=a,C.closestPointToPoint(r,!0,w).distanceTo(r)<=i||(C.start=s,C.end=o,C.closestPointToPoint(r,!0,w).distanceTo(r)<=i)||(C.start=a,C.end=o,C.closestPointToPoint(r,!0,w).distanceTo(r)<=i))return!0;let h=t.getPlane(S);if(Math.abs(h.distanceToPoint(r))<=i){let e=h.projectPoint(r,_);if(t.containsPoint(e))return!0}return!1});function bi(e){return 1e-15>Math.abs(e)}var br=class extends rb{constructor(...e){super(...e),this.isExtendedTriangle=!0,this.satAxes=[,,,,].fill().map(()=>new iy),this.satBounds=[,,,,].fill().map(()=>new x9),this.points=[this.a,this.b,this.c],this.sphere=new iF,this.plane=new ss,this.needsUpdate=!0}intersectsSphere(e){return bt(e,this)}update(){let e=this.a,t=this.b,i=this.c,r=this.points,s=this.satAxes,a=this.satBounds,o=s[0],h=a[0];this.getNormal(o),h.setFromPoints(o,r);let c=s[1],d=a[1];c.subVectors(e,t),d.setFromPoints(c,r);let u=s[2],p=a[2];u.subVectors(t,i),p.setFromPoints(u,r);let f=s[3],m=a[3];f.subVectors(i,e),m.setFromPoints(f,r),this.sphere.setFromPoints(this.points),this.plane.setFromNormalAndCoplanarPoint(o,e),this.needsUpdate=!1}};br.prototype.closestPointToSegment=(M=new iy,E=new iy,A=new lF,function(e,t=null,i=null){let{start:r,end:s}=e,a=this.points,o,h=1/0;for(let r=0;r<3;r++){let s=(r+1)%3;A.start.copy(a[r]),A.end.copy(a[s]),be(A,e,M,E),(o=M.distanceToSquared(E))<h&&(h=o,t&&t.copy(M),i&&i.copy(E))}return this.closestPointToPoint(r,M),(o=r.distanceToSquared(M))<h&&(h=o,t&&t.copy(M),i&&i.copy(r)),this.closestPointToPoint(s,M),(o=s.distanceToSquared(M))<h&&(h=o,t&&t.copy(M),i&&i.copy(s)),Math.sqrt(h)}),br.prototype.intersectsTriangle=(T=new br,P=[,,,],D=[,,,],O=new x9,L=new x9,I=new iy,R=new iy,k=new iy,B=new iy,z=new lF,N=new lF,F=new lF,function(e,t=null,i=!1){this.needsUpdate&&this.update(),e.isExtendedTriangle?e.needsUpdate&&e.update():(T.copy(e),T.update(),e=T);let r=this.plane,s=e.plane;if(Math.abs(r.normal.dot(s.normal))>1-1e-10){let r=this.satBounds,s=this.satAxes;D[0]=e.a,D[1]=e.b,D[2]=e.c;for(let e=0;e<4;e++){let t=r[e],i=s[e];if(O.setFromPoints(i,D),t.isSeparated(O))return!1}let a=e.satBounds,o=e.satAxes;P[0]=this.a,P[1]=this.b,P[2]=this.c;for(let e=0;e<4;e++){let t=a[e],i=o[e];if(O.setFromPoints(i,P),t.isSeparated(O))return!1}for(let e=0;e<4;e++){let t=s[e];for(let e=0;e<4;e++){let i=o[e];if(I.crossVectors(t,i),O.setFromPoints(I,P),L.setFromPoints(I,D),O.isSeparated(L))return!1}}return t&&(i||console.warn("ExtendedTriangle.intersectsTriangle: Triangles are coplanar which does not support an output edge. Setting edge to 0, 0, 0."),t.start.set(0,0,0),t.end.set(0,0,0)),!0}{let i=this.points,a=!1,o=0;for(let e=0;e<3;e++){let t=i[e],r=i[(e+1)%3];z.start.copy(t),z.end.copy(r),z.delta(R);let h=a?N.start:N.end,c=bi(s.distanceToPoint(t));if(bi(s.normal.dot(R))&&c){N.copy(z),o=2;break}if((s.intersectLine(z,h)||c)&&!bi(h.distanceTo(r))){if(o++,a)break;a=!0}}if(1===o&&e.containsPoint(N.end))return t&&(t.start.copy(N.end),t.end.copy(N.end)),!0;if(2!==o)return!1;let h=e.points,c=!1,d=0;for(let e=0;e<3;e++){let t=h[e],i=h[(e+1)%3];z.start.copy(t),z.end.copy(i),z.delta(k);let s=c?F.start:F.end,a=bi(r.distanceToPoint(t));if(bi(r.normal.dot(k))&&a){F.copy(z),d=2;break}if((r.intersectLine(z,s)||a)&&!bi(s.distanceTo(i))){if(d++,c)break;c=!0}}if(1===d&&this.containsPoint(F.end))return t&&(t.start.copy(F.end),t.end.copy(
3139F.end)),!0;if(2!==d)return!1;if(N.delta(R),F.delta(k),0>R.dot(k)){let e=F.start;F.start=F.end,F.end=e}let u=N.start.dot(R),p=N.end.dot(R),f=F.start.dot(R),m=F.end.dot(R);return(u===m||f===p||p<f!=u<m)&&(t&&(B.subVectors(N.start,F.start),B.dot(R)>0?t.start.copy(N.start):t.start.copy(F.start),B.subVectors(N.end,F.end),0>B.dot(R)?t.end.copy(N.end):t.end.copy(F.end)),!0)}}),br.prototype.distanceToPoint=(j=new iy,function(e){return this.closestPointToPoint(e,j),e.distanceTo(j)}),br.prototype.distanceToTriangle=(U=new iy,V=new iy,W=["a","b","c"],H=new lF,G=new lF,function(e,t=null,i=null){let r=t||i?H:null;if(this.intersectsTriangle(e,r))return(t||i)&&(t&&r.getCenter(t),i&&r.getCenter(i)),0;let s=1/0;for(let r=0;r<3;r++){let a,o=W[r],h=e[o];this.closestPointToPoint(h,U),(a=h.distanceToSquared(U))<s&&(s=a,t&&t.copy(U),i&&i.copy(h));let c=this[o];e.closestPointToPoint(c,U),(a=c.distanceToSquared(U))<s&&(s=a,t&&t.copy(c),i&&i.copy(U))}for(let r=0;r<3;r++){let a=W[r],o=W[(r+1)%3];H.set(this[a],this[o]);for(let r=0;r<3;r++){let a=W[r],o=W[(r+1)%3];G.set(e[a],e[o]),be(H,G,U,V);let h=U.distanceToSquared(V);h<s&&(s=h,t&&t.copy(U),i&&i.copy(V))}}return Math.sqrt(s)});var bs=class{constructor(e,t,i){this.isOrientedBox=!0,this.min=new iy,this.max=new iy,this.matrix=new iY,this.invMatrix=new iY,this.points=Array(8).fill().map(()=>new iy),this.satAxes=[,,,].fill().map(()=>new iy),this.satBounds=[,,,].fill().map(()=>new x9),this.alignedSatBounds=[,,,].fill().map(()=>new x9),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}};bs.prototype.update=function(){let e=this.matrix,t=this.min,i=this.max,r=this.points;for(let s=0;s<=1;s++)for(let a=0;a<=1;a++)for(let o=0;o<=1;o++){let h=r[s|2*a|4*o];h.x=s?i.x:t.x,h.y=a?i.y:t.y,h.z=o?i.z:t.z,h.applyMatrix4(e)}let s=this.satBounds,a=this.satAxes,o=r[0];for(let e=0;e<3;e++){let t=a[e],i=s[e],h=r[1<<e];t.subVectors(o,h),i.setFromPoints(t,r)}let h=this.alignedSatBounds;h[0].setFromPointsField(r,"x"),h[1].setFromPointsField(r,"y"),h[2].setFromPointsField(r,"z"),this.invMatrix.copy(this.matrix).invert(),this.needsUpdate=!1},bs.prototype.intersectsBox=(q=new x9,function(e){this.needsUpdate&&this.update();let t=e.min,i=e.max,r=this.satBounds,s=this.satAxes,a=this.alignedSatBounds;if(q.min=t.x,q.max=i.x,a[0].isSeparated(q)||(q.min=t.y,q.max=i.y,a[1].isSeparated(q))||(q.min=t.z,q.max=i.z,a[2].isSeparated(q)))return!1;for(let t=0;t<3;t++){let i=s[t],a=r[t];if(q.setFromBox(i,e),a.isSeparated(q))return!1}return!0}),bs.prototype.intersectsTriangle=(X=new br,Y=[,,,],Q=new x9,Z=new x9,K=new iy,function(e){this.needsUpdate&&this.update(),e.isExtendedTriangle?e.needsUpdate&&e.update():(X.copy(e),X.update(),e=X);let t=this.satBounds,i=this.satAxes;Y[0]=e.a,Y[1]=e.b,Y[2]=e.c;for(let e=0;e<3;e++){let r=t[e],s=i[e];if(Q.setFromPoints(s,Y),r.isSeparated(Q))return!1}let r=e.satBounds,s=e.satAxes,a=this.points;for(let e=0;e<3;e++){let t=r[e],i=s[e];if(Q.setFromPoints(i,a),t.isSeparated(Q))return!1}for(let e=0;e<3;e++){let t=i[e];for(let e=0;e<4;e++){let i=s[e];if(K.crossVectors(t,i),Q.setFromPoints(K,Y),Z.setFromPoints(K,a),Q.isSeparated(Z))return!1}}return!0}),bs.prototype.closestPointToPoint=function(e,t){return this.needsUpdate&&this.update(),t.copy(e).applyMatrix4(this.invMatrix).clamp(this.min,this.max).applyMatrix4(this.matrix),t},bs.prototype.distanceToPoint=(J=new iy,function(e){return this.closestPointToPoint(e,J),e.distanceTo(J)}),bs.prototype.distanceToBox=($=["x","y","z"],ee=Array(12).fill().map(()=>new lF),et=Array(12).fill().map(()=>new lF),ei=new iy,er=new iy,function(e,t=0,i=null,r=null){if(this.needsUpdate&&this.update(),this.intersectsBox(e))return(i||r)&&(e.getCenter(er),this.closestPointToPoint(er,ei),e.closestPointToPoint(ei,er),i&&i.copy(ei),r&&r.copy(er)),0;let s=t*t,a=e.min,o=e.max,h=this.points,c=1/0;for(let e=0;e<8;e++){let t=h[e];er.copy(t).clamp(a,o);let d=t.distanceToSquared(er);if(d<c&&(c=d,i&&i.copy(t),r&&r.copy(er),d<s))return Math.sqrt(d)}let d=0;for(let e=0;e<3;e++)for(let t=0;t<=1;t++)for(let i=0;i<=1;i++){let r=(e+1)%3,s=(e+2)%3,c=t<<r|i<<s,u=1<<e|t<<r|i<<s,p=h[c],f=h[u];ee[d].set(p,f);let m=$[e],g=$[r],v=$[s],y=et[d],x=y.start,b=y.end;x[m]=a[m],x[g]=t?a[g]:o[g],x[v]=i?a[v]:o[g],b[m]=o[m],b[g]=t?a[g]:o[g],b[v]=i?a[v]:o[g],d++}for(let e=0;e<=1;e++)for(let t=0;t<=1;t++)for(let h=0;h<=1;h++){er.x=e?o.x:a.x,er.y=t?o.y:a.y,er.z=h?o.z:a.z,this.closestPointToPoint(er,ei);let d=er.distanceToSquared(ei);if(d<c&&(c=d,i&&i.copy(ei),r&&r.copy(er),d<s))return Math.sqrt(d)}for(let e=0;e<12;e++){let t=ee[e];for(let e=0;e<12;e++){be(t,et[e],ei,er);let a=ei.distanceToSquared(er);
3139if(a<c&&(c=a,i&&i.copy(ei),r&&r.copy(er),a<s))return Math.sqrt(a)}}return Math.sqrt(c)});var ba=new iy,bn=new iy,bo=new iy,bl=new tZ,bh=new tZ,bc=new tZ,bd=new iy,bu=new iy,bp=new iy,bf=new iy;function bm(e,t,i,r,s){let a=3*r,o=e.index.getX(a),h=e.index.getX(a+1),c=e.index.getX(a+2),{position:d,normal:u,uv:p,uv1:f}=e.attributes,m=function(e,t,i,r,s,a,o,h,c){ba.fromBufferAttribute(t,a),bn.fromBufferAttribute(t,o),bo.fromBufferAttribute(t,h);let d=null===(1===c?e.intersectTriangle(bo,bn,ba,!0,bf):e.intersectTriangle(ba,bn,bo,2!==c,bf))?null:{distance:e.origin.distanceTo(bf),point:bf.clone()};if(d){r&&(bl.fromBufferAttribute(r,a),bh.fromBufferAttribute(r,o),bc.fromBufferAttribute(r,h),d.uv=rb.getInterpolation(bf,ba,bn,bo,bl,bh,bc,new tZ)),s&&(bl.fromBufferAttribute(s,a),bh.fromBufferAttribute(s,o),bc.fromBufferAttribute(s,h),d.uv1=rb.getInterpolation(bf,ba,bn,bo,bl,bh,bc,new tZ)),i&&(bd.fromBufferAttribute(i,a),bu.fromBufferAttribute(i,o),bp.fromBufferAttribute(i,h),d.normal=rb.getInterpolation(bf,ba,bn,bo,bd,bu,bp,new iy),d.normal.dot(e.direction)>0&&d.normal.multiplyScalar(-1));let t={a:a,b:o,c:h,normal:new iy,materialIndex:0};rb.getNormal(ba,bn,bo,t.normal),d.face=t,d.faceIndex=a}return d}(i,d,u,p,f,o,h,c,t);return m?(m.faceIndex=r,s&&s.push(m),m):null}function bg(e,t,i,r){let s=e.a,a=e.b,o=e.c,h=t,c=t+1,d=t+2;i&&(h=i.getX(t),c=i.getX(t+1),d=i.getX(t+2)),s.x=r.getX(h),s.y=r.getY(h),s.z=r.getZ(h),a.x=r.getX(c),a.y=r.getY(c),a.z=r.getZ(c),o.x=r.getX(d),o.y=r.getY(d),o.z=r.getZ(d)}function bv(e,t,i,r,s,a,o){let h=i.index,c=i.attributes.position;for(let i=e,d=t+e;i<d;i++)if(bg(o,3*i,h,c),o.needsUpdate=!0,r(o,i,s,a))return!0;return!1}var by=class{constructor(e){this._getNewPrimitive=e,this._primitives=[]}getPrimitive(){let e=this._primitives;return 0===e.length?this._getNewPrimitive():e.pop()}releasePrimitive(e){this._primitives.push(e)}};function bx(e,t){return 65535===t[e+15]}var bb=new iw,bw=new iy,b_=["x","y","z"],bS=(en=[],eo=new by(()=>new iw),function(...e){es=eo.getPrimitive(),ea=eo.getPrimitive(),en.push(es,ea);let t=function e(t,i,r,s,a=null,o=0,h=0){function c(e){let t=2*e,i=bD,r=bO;for(;!bx(t,i);)t=2*(e+=8);return r[e+6]}function d(e){let t=2*e,i=bD,r=bO;for(;!bx(t,i);)t=2*(e=r[e+6]);return r[e+6]+i[t+14]}let u=2*t,p=bP,f=bD,m=bO;if(bx(u,f)){let e=m[t+6],i=f[u+14];return x$(t,p,es),s(e,i,!1,h,o+t,es)}{let u=t+8,g=m[t+6],v=u,y=g,x,b,w,_;if(a&&(w=es,_=ea,x$(v,p,w),x$(y,p,_),x=a(w),(b=a(_))<x)){v=g,y=u;let e=x;x=b,b=e,w=_}w||x$(v,p,w=es);let S=r(w,bx(2*v,f),x,h+1,o+v),C;if(2===S){let e=c(v),t=d(v)-e;C=s(e,t,!0,h+1,o+v,w)}else C=S&&e(v,i,r,s,a,o,h+1);if(C)return!0;x$(y,p,_=ea);let M=r(_,bx(2*y,f),b,h+1,o+y),E;if(2===M){let e=c(y),t=d(y)-e;E=s(e,t,!0,h+1,o+y,_)}else E=M&&e(y,i,r,s,a,o,h+1);return!!E}}(...e);eo.releasePrimitive(es),eo.releasePrimitive(ea),en.pop(),en.pop();let i=en.length;return i>0&&(ea=en[i-1],es=en[i-2]),t}),bC=(el=new br,eh=new br,ec=new iY,ed=new bs,eu=new bs,function e(t,i,r,s,a=null){let o=2*t,h=bP,c=bD,d=bO;if(null===a&&(r.boundingBox||r.computeBoundingBox(),ed.set(r.boundingBox.min,r.boundingBox.max,s),a=ed),bx(o,c)){let e=i.index,a=i.attributes.position,u=r.index,p=r.attributes.position,f=d[t+6],m=c[o+14];if(ec.copy(s).invert(),r.boundsTree)return x$(t,h,eu),eu.matrix.copy(ec),eu.needsUpdate=!0,r.boundsTree.shapecast({intersectsBounds:e=>eu.intersectsBox(e),intersectsTriangle:t=>{t.a.applyMatrix4(s),t.b.applyMatrix4(s),t.c.applyMatrix4(s),t.needsUpdate=!0;for(let i=3*f,r=(m+f)*3;i<r;i+=3)if(bg(eh,i,e,a),eh.needsUpdate=!0,t.intersectsTriangle(eh))return!0;return!1}});for(let t=3*f,i=m+3*f;t<i;t+=3){bg(el,t,e,a),el.a.applyMatrix4(ec),el.b.applyMatrix4(ec),el.c.applyMatrix4(ec),el.needsUpdate=!0;for(let e=0,t=u.count;e<t;e+=3)if(bg(eh,e,u,p),eh.needsUpdate=!0,el.intersectsTriangle(eh))return!0}}else{let o=t+8,c=d[t+6];return x$(o,h,bb),!!(a.intersectsBox(bb)&&e(o,i,r,s,a)||(x$(c,h,bb),a.intersectsBox(bb)&&e(c,i,r,s,a)))}});function bM(e,t,i,r){return x$(e,t,bb),i.intersectBox(bb,r)}var bE,bA,bT,bP,bD,bO,bL=[];function bI(e){bT&&bL.push(bT),bT=e,bP=new Float32Array(e),bD=new Uint16Array(e),bO=new Uint32Array(e)}function bR(){bT=null,bP=null,bD=null,bO=null,bL.length&&bI(bL.pop())}var bk=Symbol("skip tree generation"),bB=new iw,bz=new iw,bN=new iY,bF=new bs,bj=new bs,bU=new iy,bV=new iy,bW=new iy,bH=new iy,bG=new iy,bq=new iw,bX=new by(()=>new br),bY=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."),bY.serialize(arguments[0],{cloneBuffers:void 0===arguments[2]||arguments[2]});t={cloneBuffers:!0,...t};let i=e.geometry,r=e._roots,s=i.getIndex();return t.cloneBuffers?{roots:r.map(e=>e.slice()),index:s.array.slice()}:{roots:r,index:s.array}}static deserialize(e,t,i={}){if("boolean"==typeof i)return console.warn("MeshBVH.deserialize: The arguments for the function have changed. See documentation for new signature."),bY.deserialize(arguments[0],arguments[1],{setIndex:void 0===arguments[2]||arguments[2]});i={setIndex:!0,...i};let{index:r,roots:s}=e,a=new bY(t,{...i,[bk]:!0});if(a._roots=s,i.setIndex){let i=t.getIndex();if(null===i){let i=new rE(e.index,1,!1);t.setIndex(i)}else i.array!==r&&(i.array.set(r),i.needsUpdate=!0)}return a}constructor(e,t={}){if(e.isBufferGeometry){if(e.index&&e.index.isInterleavedBufferAttribute)throw Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.")}else throw Error("MeshBVH: Only BufferGeometries are supported.");
3139if((t=Object.assign({strategy:0,maxDepth:40,maxLeafTris:10,verbose:!0,useSharedArrayBuffer:!1,setBoundingBox:!0,onProgress:null,[bk]:!1},t)).useSharedArrayBuffer&&typeof SharedArrayBuffer>"u")throw Error("MeshBVH: SharedArrayBuffer is not available.");this._roots=null,t[bk]||(this._roots=function(e,t){let i=function(e,t){function i(e){f&&f(e/m)}function r(t,s,f,m=null,v=0){if(!g&&v>=c&&(g=!0,d&&(console.warn(`MeshBVH: Max depth of ${c} reached when generating BVH. Consider increasing maxDepth.`),console.warn(e))),f<=u||v>=c)return i(s+f),t.offset=s,t.count=f,t;let y=function(e,t,i,r,s,a){let o=-1,h=0;if(0===a)-1!==(o=x0(t))&&(h=(t[o]+t[o+3])/2);else if(1===a)-1!==(o=x0(e))&&(h=function(e,t,i,r){let s=0;for(let a=t,o=t+i;a<o;a++)s+=e[6*a+2*r];return s/i}(i,r,s,o));else if(2===a){let a=x3(e),d=1.25*s,u=6*r,p=(r+s)*6;for(let e=0;e<3;e++){let r=t[e],f=(t[e+3]-r)/32;if(s<8){let t=[...x6];t.length=s;let r=0;for(let s=u;s<p;s+=6,r++){let a=t[r];a.candidate=i[s+2*e],a.count=0;let{bounds:o,leftCacheBounds:h,rightCacheBounds:c}=a;for(let e=0;e<3;e++)c[e]=1/0,c[e+3]=-1/0,h[e]=1/0,h[e+3]=-1/0,o[e]=1/0,o[e+3]=-1/0;x2(s,i,o)}t.sort(x5);let c=s;for(let e=0;e<c;e++){let i=t[e];for(;e+1<c&&t[e+1].candidate===i.candidate;)t.splice(e+1,1),c--}for(let r=u;r<p;r+=6){let s=i[r+2*e];for(let e=0;e<c;e++){let a=t[e];s>=a.candidate?x2(r,i,a.rightCacheBounds):(x2(r,i,a.leftCacheBounds),a.count++)}}for(let i=0;i<c;i++){let r=t[i],c=r.count,u=s-r.count,p=r.leftCacheBounds,f=r.rightCacheBounds,m=0;0!==c&&(m=x3(p)/a);let g=0;0!==u&&(g=x3(f)/a);let v=1+1.25*(m*c+g*u);v<d&&(o=e,d=v,h=r.candidate)}}else{var c;for(let e=0;e<32;e++){let t=x6[e];t.count=0,t.candidate=r+f+e*f;let i=t.bounds;for(let e=0;e<3;e++)i[e]=1/0,i[e+3]=-1/0}for(let t=u;t<p;t+=6){let s=~~((i[t+2*e]-r)/f);s>=32&&(s=31);let a=x6[s];a.count++,x2(t,i,a.bounds)}let t=x6[31];c=t.bounds,t.rightCacheBounds.set(c);for(let e=30;e>=0;e--){let t=x6[e],i=x6[e+1];x1(t.bounds,i.rightCacheBounds,t.rightCacheBounds)}let m=0;for(let t=0;t<31;t++){let i=x6[t],r=i.count,c=i.bounds,u=x6[t+1].rightCacheBounds;0!==r&&(0===m?x8.set(c):x1(c,x8,x8));let p=0,f=0;0!==(m+=r)&&(p=x3(x8)/a);let g=s-m;0!==g&&(f=x3(u)/a);let v=1+1.25*(p*m+f*g);v<d&&(o=e,d=v,h=i.candidate)}}}}else console.warn(`MeshBVH: Invalid build strategy value ${a} used.`);return{axis:o,pos:h}}(t.boundingData,m,o,s,f,p);if(-1===y.axis)return i(s+f),t.offset=s,t.count=f,t;let x=function(e,t,i,r,s){let a=i,o=i+r-1,h=s.pos,c=2*s.axis;for(;;){for(;a<=o&&t[6*a+c]<h;)a++;for(;a<=o&&t[6*o+c]>=h;)o--;if(!(a<o))return a;for(let i=0;i<3;i++){let r=e[3*a+i];e[3*a+i]=e[3*o+i],e[3*o+i]=r;let s=t[6*a+2*i+0];t[6*a+2*i+0]=t[6*o+2*i+0],t[6*o+2*i+0]=s;let h=t[6*a+2*i+1];t[6*a+2*i+1]=t[6*o+2*i+1],t[6*o+2*i+1]=h}a++,o--}}(h,o,s,f,y);if(x===s||x===s+f)i(s+f),t.offset=s,t.count=f;else{t.splitAxis=y.axis;let e=new xJ,i=x-s;t.left=e,e.boundingData=new Float32Array(6),x4(o,s,i,e.boundingData,a),r(e,s,i,a,v+1);let h=new xJ,c=f-i;t.right=h,h.boundingData=new Float32Array(6),x4(o,x,c,h.boundingData,a),r(h,x,c,a,v+1)}return t}if(!e.index){let i=e.attributes.position.count,r=t.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer,s;s=i>65535?new Uint32Array(new r(4*i)):new Uint16Array(new r(2*i)),e.setIndex(new rE(s,1));for(let e=0;e<i;e++)s[e]=e}let s=new Float32Array(6),a=new Float32Array(6),o=function(e,t){let i=e.attributes.position,r=e.index.array,s=r.length/3,a=new Float32Array(6*s),o=i.normalized,h=i.array,c=i.offset||0,d=3;i.isInterleavedBufferAttribute&&(d=i.data.stride);let u=["getX","getY","getZ"];for(let e=0;e<s;e++){let s=3*e,p=6*e,f,m,g;o?(f=r[s+0],m=r[s+1],g=r[s+2]):(f=r[s+0]*d+c,m=r[s+1]*d+c,g=r[s+2]*d+c);for(let e=0;e<3;e++){let r,s,c;o?(r=i[u[e]](f),s=i[u[e]](m),c=i[u[e]](g)):(r=h[f+e],s=h[m+e],c=h[g+e]);let d=r;s<d&&(d=s),c<d&&(d=c);let v=r;s>v&&(v=s),c>v&&(v=c);let y=(v-d)/2,x=2*e;a[p+x+0]=d+y,a[p+x+1]=y+(Math.abs(d)+y)*5960464477539063e-23,d<t[e]&&(t[e]=d),v>t[e+3]&&(t[e+3]=v)}}return a}(e,s),h=e.index.array,c=t.maxDepth,d=t.verbose,u=t.maxLeafTris,p=t.strategy,f=t.onProgress,m=e.index.count/3,g=!1,v=[],y=function(e){if(!e.groups||!e.groups.length)return[{offset:0,count:e.index.count/3}];let t=[],i=new Set;for(let t of e.groups)i.add(t.start),i.add(t.start+t.count);let r=Array.from(i.values()).sort((e,t)=>
3139e-t);for(let e=0;e<r.length-1;e++){let i=r[e],s=r[e+1];t.push({offset:i/3,count:(s-i)/3})}return t}(e);if(1===y.length){let e=y[0],t=new xJ;t.boundingData=s,function(e,t,i,r){let s=1/0,a=1/0,o=1/0,h=-1/0,c=-1/0,d=-1/0;for(let r=6*t,u=(t+i)*6;r<u;r+=6){let t=e[r+0];t<s&&(s=t),t>h&&(h=t);let i=e[r+2];i<a&&(a=i),i>c&&(c=i);let u=e[r+4];u<o&&(o=u),u>d&&(d=u)}r[0]=s,r[1]=a,r[2]=o,r[3]=h,r[4]=c,r[5]=d}(o,e.offset,e.count,a),r(t,e.offset,e.count,a),v.push(t)}else for(let e of y){let t=new xJ;t.boundingData=new Float32Array(6),x4(o,e.offset,e.count,t.boundingData,a),r(t,e.offset,e.count,a),v.push(t)}return v}(e,t),r,s,a,o=[],h=t.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer;for(let e=0;e<i.length;e++){let t=i[e],c=new h(32*function e(t){return t.count?1:1+e(t.left)+e(t.right)}(t));r=new Float32Array(c),s=new Uint32Array(c),a=new Uint16Array(c),function e(t,i){let o=t/4,h=t/2,c=!!i.count,d=i.boundingData;for(let e=0;e<6;e++)r[o+e]=d[e];if(c){let e=i.offset,r=i.count;return s[o+6]=e,a[h+14]=r,a[h+15]=65535,t+32}{let r=i.left,a=i.right,h=i.splitAxis,c;if((c=e(t+32,r))/4>0x100000000)throw Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return s[o+6]=c/4,c=e(c,a),s[o+7]=h,c}}(0,t),o.push(c)}return o}(e,t),!e.boundingBox&&t.setBoundingBox&&(e.boundingBox=this.getBoundingBox(new iw))),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,o,h,c=0,d=this._roots;for(let t=0,u=d.length;t<u;t++)a=new Uint32Array(s=d[t]),o=new Uint16Array(s),h=new Float32Array(s),function t(s,c,d=!1){let u=2*s;if(65535===o[u+15]){let e=a[s+6],t=o[u+14],c=1/0,d=1/0,p=1/0,f=-1/0,m=-1/0,g=-1/0;for(let s=3*e,a=3*(e+t);s<a;s++){let e=i[s],t=r.getX(e),a=r.getY(e),o=r.getZ(e);t<c&&(c=t),t>f&&(f=t),a<d&&(d=a),a>m&&(m=a),o<p&&(p=o),o>g&&(g=o)}return(h[s+0]!==c||h[s+1]!==d||h[s+2]!==p||h[s+3]!==f||h[s+4]!==m||h[s+5]!==g)&&(h[s+0]=c,h[s+1]=d,h[s+2]=p,h[s+3]=f,h[s+4]=m,h[s+5]=g,!0)}{let i=s+8,r=a[s+6],o=i+c,u=r+c,p=d,f=!1,m=!1;e?p||(f=e.has(o),m=e.has(u),p=!f&&!m):(f=!0,m=!0);let g=p||f,v=p||m,y=!1;g&&(y=t(i,c,p));let x=!1;v&&(x=t(r,c,p));let b=y||x;if(b)for(let e=0;e<3;e++){let t=i+e,a=r+e,o=h[t],c=h[t+3],d=h[a],u=h[a+3];h[s+e]=o<d?o:d,h[s+e+3]=c>u?c:u}return b}}(0,c),c+=s.byteLength}traverse(e,t=0){let i=this._roots[t],r=new Uint32Array(i),s=new Uint16Array(i);!function t(a,o=0){let h=2*a,c=65535===s[h+15];if(c){let t=r[a+6],d=s[h+14];e(o,c,new Float32Array(i,4*a,6),t,d)}else{let s=r[a+6],h=r[a+7];e(o,c,new Float32Array(i,4*a,6),h)||(t(a+8,o+1),t(s,o+1))}}(0)}raycast(e,t=0){let i=this._roots,r=this.geometry,s=[],a=t.isMaterial,o=Array.isArray(t),h=r.groups,c=a?t.side:t;for(let a=0,d=i.length;a<d;a++){let d=o?t[h[a].materialIndex].side:c,u=s.length;if(bI(i[a]),function e(t,i,r,s,a){let o=2*t,h=bP,c=bD,d=bO;if(bx(o,c)){let e=d[t+6],h=c[o+14];for(let t=e,o=e+h;t<o;t++)bm(i,r,s,t,a)}else{let o=t+8;bM(o,h,s,bw)&&e(o,i,r,s,a);let c=d[t+6];bM(c,h,s,bw)&&e(c,i,r,s,a)}}(0,r,d,e,s),bR(),o){let e=h[a].materialIndex;for(let t=u,i=s.length;t<i;t++)s[t].face.materialIndex=e}}return s}raycastFirst(e,t=0){let i=this._roots,r=this.geometry,s=t.isMaterial,a=Array.isArray(t),o=null,h=r.groups,c=s?t.side:t;for(let s=0,d=i.length;s<d;s++){let d=a?t[h[s].materialIndex].side:c;bI(i[s]);let u=function e(t,i,r,s){let a=2*t,o=bP,h=bD,c=bO;if(bx(a,h))return function(e,t,i,r,s){let a=1/0,o=null;for(let h=r,c=r+s;h<c;h++){let r=bm(e,t,i,h);r&&r.distance<a&&(o=r,a=r.distance)}return o}(i,r,s,c[t+6],h[a+14]);{let a=c[t+7],h=b_[a],d=s.direction[h]>=0,u,p;d?(u=t+8,p=c[t+6]):(u=c[t+6],p=t+8);let f=bM(u,o,s,bw)?e(u,i,r,s):null;if(f){let e=f.point[h];if(d?e<=o[p+a]:e>=o[p+a+3])return f}let m=bM(p,o,s,bw)?e(p,i,r,s):null;return f&&m?f.distance<=m.distance?f:m:f||m||null}}(0,r,d,e);bR(),null!=u&&(null==o||u.distance<o.distance)&&(o=u,a&&(u.face.materialIndex=h[s].materialIndex))}return o}intersectsGeometry(e,t){let i=this.geometry,r=!1;for(let s of this._roots)if(bI(s),r=bC(0,i,e,t),bR(),r)break;return r}shapecast(e,t,i){let r=this.geometry;if(e instanceof Function){if(t){let e=t;t=(t,i,r,s)=>{let a=3*i;return e(t,a,a+1,a+2,r,s)}}
3139e={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=bX.getPrimitive(),{boundsTraverseOrder:a,intersectsBounds:o,intersectsRange:h,intersectsTriangle:c}=e;if(h&&c){let e=h;h=(t,i,a,o,h)=>!!e(t,i,a,o,h)||bv(t,i,r,c,a,o,s)}else h||(h=c?(e,t,i,a)=>bv(e,t,r,c,i,a,s):(e,t,i)=>i);let d=!1,u=0;for(let e of this._roots){if(bI(e),d=bS(0,r,o,h,a,u),bR(),d)break;u+=e.byteLength}return bX.releasePrimitive(s),d}bvhcast(e,t,i){let{intersectsRanges:r,intersectsTriangles:s}=i,a=this.geometry.index,o=this.geometry.attributes.position,h=e.geometry.index,c=e.geometry.attributes.position;bN.copy(t).invert();let d=bX.getPrimitive(),u=bX.getPrimitive();if(s){let e=function(e,i,r,p,f,m,g,v){for(let y=r,x=r+p;y<x;y++){bg(u,3*y,h,c),u.a.applyMatrix4(t),u.b.applyMatrix4(t),u.c.applyMatrix4(t),u.needsUpdate=!0;for(let t=e,r=e+i;t<r;t++)if(bg(d,3*t,a,o),d.needsUpdate=!0,s(d,u,t,y,f,m,g,v))return!0}return!1};if(r){let t=r;r=function(i,r,s,a,o,h,c,d){return!!t(i,r,s,a,o,h,c,d)||e(i,r,s,a,o,h,c,d)}}else r=e}e.getBoundingBox(bz),bz.applyMatrix4(t);let p=this.shapecast({intersectsBounds:e=>bz.intersectsBox(e),intersectsRange:(t,i,s,a,o,h)=>(bB.copy(h),bB.applyMatrix4(bN),e.shapecast({intersectsBounds:e=>bB.intersectsBox(e),intersectsRange:(e,s,h,c,d)=>r(t,i,e,s,a,o,c,d)}))});return bX.releasePrimitive(d),bX.releasePrimitive(u),p}intersectsBox(e,t){return bF.set(e.min,e.max,t),bF.needsUpdate=!0,this.shapecast({intersectsBounds:e=>bF.intersectsBox(e),intersectsTriangle:e=>bF.intersectsTriangle(e)})}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(),bF.set(e.boundingBox.min,e.boundingBox.max,t),bF.needsUpdate=!0;let o=this.geometry,h=o.attributes.position,c=o.index,d=e.attributes.position,u=e.index,p=bX.getPrimitive(),f=bX.getPrimitive(),m=null,g=null;r&&(m=bH,g=bG);let v=1/0,y=null,x=null;return bN.copy(t).invert(),bj.matrix.copy(bN),this.shapecast({boundsTraverseOrder:e=>bF.distanceToBox(e),intersectsBounds:(e,t,i)=>i<v&&i<a&&(t&&(bj.min.copy(e.min),bj.max.copy(e.max),bj.needsUpdate=!0),!0),intersectsRange:(i,r)=>{if(e.boundsTree)return e.boundsTree.shapecast({boundsTraverseOrder:e=>bj.distanceToBox(e),intersectsBounds:(e,t,i)=>i<v&&i<a,intersectsRange:(e,a)=>{for(let o=3*e,b=(e+a)*3;o<b;o+=3){bg(f,o,u,d),f.a.applyMatrix4(t),f.b.applyMatrix4(t),f.c.applyMatrix4(t),f.needsUpdate=!0;for(let e=3*i,t=(i+r)*3;e<t;e+=3){bg(p,e,c,h),p.needsUpdate=!0;let t=p.distanceToTriangle(f,bV,m);if(t<v&&(bW.copy(bV),g&&g.copy(m),v=t,y=e/3,x=o/3),t<s)return!0}}}});{let e=u?u.count:d.count;for(let a=0;a<e;a+=3){bg(f,a,u,d),f.a.applyMatrix4(t),f.b.applyMatrix4(t),f.c.applyMatrix4(t),f.needsUpdate=!0;for(let e=3*i,t=(i+r)*3;e<t;e+=3){bg(p,e,c,h),p.needsUpdate=!0;let t=p.distanceToTriangle(f,bV,m);if(t<v&&(bW.copy(bV),g&&g.copy(m),v=t,y=e/3,x=a/3),t<s)return!0}}}}}),bX.releasePrimitive(p),bX.releasePrimitive(f),v===1/0?null:(i.point?i.point.copy(bW):i.point=bW.clone(),i.distance=v,i.faceIndex=y,r&&(r.point?r.point.copy(g):r.point=g.clone(),r.point.applyMatrix4(bN),bW.applyMatrix4(bN),r.distance=bW.sub(r.point).length(),r.faceIndex=x),i)}closestPointToPoint(e,t={},i=0,r=1/0){let s=i*i,a=r*r,o=1/0,h=null;if(this.shapecast({boundsTraverseOrder:t=>(bU.copy(e).clamp(t.min,t.max),bU.distanceToSquared(e)),intersectsBounds:(e,t,i)=>i<o&&i<a,intersectsTriangle:(t,i)=>{t.closestPointToPoint(e,bU);let r=e.distanceToSquared(bU);return r<o&&(bV.copy(bU),o=r,h=i),r<s}}),o===1/0)return null;let c=Math.sqrt(o);return t.point?t.point.copy(bV):t.point=bV.clone(),t.distance=c,t.faceIndex=h,t}getBoundingBox(e){return e.makeEmpty(),this._roots.forEach(t=>{x$(0,new Float32Array(t),bq),e.union(bq)}),e}},bQ=tS(tM()),bZ=.5*(Math.sqrt(3)-1),bK=(3-Math.sqrt(3))/6,bJ=1/3,b$=1/6,b0=e=>0|Math.floor(e),b1=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]),b2=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 b3(e){let t=new Uint8Array(512);for(let e=0;e<256;e++)t[e]=e;for(let i=0;i<255;i++){let r=i+~~(e()*(256-i)),s=t[i];t[i]=t[r],t[r]=s}for(let e=256;e<512;
3139e++)t[e]=t[e-256];return t}var b4,b5=new rb,b6=class{constructor(e){this.weightAttribute=null;let t=e.geometry;if(!t.isBufferGeometry||3!==t.attributes.position.itemSize)throw 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 i=0;i<e.count;i+=3){let r=1;b5.a.fromBufferAttribute(e,i),b5.b.fromBufferAttribute(e,i+1),b5.c.fromBufferAttribute(e,i+2),r*=b5.getArea(),t[i/3]=r}this.distribution=new Float32Array(e.count/3);let i=0;for(let e=0;e<t.length;e++)i+=t[e],this.distribution[e]=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(0===a||t[a-1]<=e&&t[a]>e){s=a;break}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),b5.a.fromBufferAttribute(this.positionAttribute,3*e),b5.b.fromBufferAttribute(this.positionAttribute,3*e+1),b5.c.fromBufferAttribute(this.positionAttribute,3*e+2),t.set(0,0,0).addScaledVector(b5.a,r).addScaledVector(b5.b,s).addScaledVector(b5.c,1-(r+s)),b5.getNormal(i),this}},b8=tS(tE()),b9=new iY,b7=new iY,we=new iY;(b4||(b4={})).is=function(e){return e&&e.__isSPEObject};var wt=e=>class extends e{constructor(){super(...arguments),this.previousModelViewMatrix=new iY,this.copyPreviousMatrix=!0,this.hiddenMatrix=new iY,this.matrixWorldRigid=new iY,this.shearScale=new iY,this.shearScaleInv=new iY}get __isSPEObject(){return!0}isDescendantOf(e){e instanceof rh&&(e=e.uuid);let t=this;for(;t.parent;){if(t.parent.uuid===e)return!0;t=t.parent}return!1}updateMatrixWorld(e){for(let t of(this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(null===this.parent?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,e=!0),this.children))t.updateMatrixWorld(e)}updateWorldMatrix(e,t){let i=this.parent;if(e&&null!==i&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),null===this.parent?this.matrixWorld.multiplyMatrices(this.hiddenMatrix,this.matrix):(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.hiddenMatrix),this.matrixWorld.multiplyMatrices(this.matrixWorld,this.matrix)),t)for(let e of this.children)e.updateWorldMatrix(!1,!0)}traverseChildren(e,t=0){for(let i of this.children)b4.is(i)&&i.traverseObject(e,t+1)}traverseObject(e,t=0){if(!0!==e(this,t))for(let i of this.children)b4.is(i)&&i.traverseObject(e,t+1)}updateMatrixWorldSVD(){let e=this.matrixWorld.elements,t=[[e[0],e[4],e[8]],[e[1],e[5],e[9]],[e[2],e[6],e[10]]],{u:i,v:r,q:s}=(0,b8.SVD)(t),a=b9.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),o=b7.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),h=we.copy(o).transpose();this.shearScale.makeScale(s[0],s[1],s[2]).multiply(h).premultiply(o),this.shearScaleInv.copy(this.shearScale).invert(),this.matrixWorldRigid.multiplyMatrices(a,h).copyPosition(this.matrixWorld),s.every(e=>.01>Math.abs(s[0]-e))?this.hasNonUniformScale=!1:this.hasNonUniformScale=!0}attach(e,t){this.updateWorldMatrix(!0,!1);let i=new iY().copy(this.matrixWorld).invert();return null!==e.parent&&(e.parent.updateWorldMatrix(!0,!1),i.multiply(e.parent.matrixWorld)),"hiddenMatrix"in e&&e.hiddenMatrix instanceof iY?e.hiddenMatrix.premultiply(i):e.applyMatrix4(i),e.updateWorldMatrix(!1,!1),this.add(e),void 0!==t&&(this.children.pop(),this.children.splice(t,0,e)),this}copy(e,t=!1){return super.copy(e,t),this.hasNonUniformScale=e.hasNonUniformScale,this}onAfterRender(e,t,i,r,s,a){this.copyPreviousMatrix&&this.previousModelViewMatrix.copy(this.modelViewMatrix)}},wi=class extends wt(rh){},wr=class extends wi{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];
3139i?.object!==t&&(i&&this.remove(i),i=new wr(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(){return void 0!==this.playModeVisible?this.playModeVisible:this.object.visible||this.object.dataPatched.visible&&this.object.dataPatched.cloner?.hideBase===!0}set visible(e){}get castShadow(){return this.object.castShadow}set castShadow(e){}get receiveShadow(){return this.object.receiveShadow}set receiveShadow(e){}get isMesh(){return"Mesh"===this.object.type}get isLight(){return this.object.isLight}get layers(){return this.object.layers}set layers(e){}get isCamera(){return!1}get geometry(){if(this.object.geometry)return this.object.geometry}get material(){if(this.object.material)return this.object.material}get morphTargetInfluences(){if(this.object.morphTargetInfluences)return this.object.morphTargetInfluences}set morphTargetInfluences(e){}},ws=new iy,wa=new iy,wn=new iY,wo=[new iy(-1,1,1),new iy(-1,-1,1),new iy(1,-1,1),new iy(1,1,1),new iy(-1,1,-1),new iy(-1,-1,-1),new iy(1,-1,-1),new iy(1,1,-1)],wl=[[0,3],[1,2],[5,6],[4,7],[0,1],[3,2],[7,6],[4,5],[0,4],[1,5],[2,6],[3,7]],wh=[[0,2],[7,5],[4,1],[3,6],[4,3],[1,6]],wc=(e,t,i)=>{e.updateEntityBoxSize(ws,wa),wn.copy(t).multiply(e.matrixWorld),0===wa.x&&0===wa.y&&0===wa.z?i.push(new iy(ws.x,ws.y,ws.z).applyMatrix4(wn)):wo.forEach(e=>{i.push(e.clone().multiply(wa).add(ws).applyMatrix4(wn))})},wd=class extends iw{constructor(){super(...arguments),this.matrix=new iY,this.vertices=[],this.faces=[],this.edges=[],this.centerEdges=[]}copy(e){return super.copy(e),this.matrix.copy(e.matrix),this.vertices=e.vertices.map(e=>e.clone()),this.faces=e.faces.map(e=>e.clone()),this.edges=e.edges.map(e=>e.clone()),this.centerEdges=e.centerEdges.map(e=>e.clone()),this}setFromObjectSize(e,t=!1){e.updateWorldMatrix(!1,t),this.makeEmpty(),this.matrix.copy(e.matrixWorld);let i=new iY().copy(e.matrixWorld).invert();return this.expandByObjectSize(e,i,t)}expandByObjectSize(e,t,i=!1){let r=[];return!0===i?e.traverseEntity(e=>{if(e.visible||e.cloner&&e.data.visible){if(!("geometry"in e))return void r.push(new iy);wc(e,t,r)}}):wc(e,t,r),this.setFromPoints(r)}getCenter(e){return(e=super.getCenter(e)).applyMatrix4(this.matrix),e}getPositionToCenter(e){return(e=super.getCenter(e)).applyMatrix4(wn.copy(this.matrix).setPosition(0,0,0)),e}computeVertices(){this.getSize(wa).multiplyScalar(.5),this.getCenter(ws),wn.copy(this.matrix).setPosition(ws),this.vertices=wo.map(e=>e.clone().multiply(wa).applyMatrix4(wn))}computeEdges(){this.vertices.length>0&&this.computeVertices(),this.edges=wl.map(([e,t])=>new lF(this.vertices[e],this.vertices[t])),this.centerEdges=this.edges.map(e=>e.getCenter(new iy))}computeFaces(){this.vertices.length>0&&this.computeVertices(),this.faces=wh.map(([e,t])=>this.vertices[e].clone().add(this.vertices[t]).multiplyScalar(.5))}},wu={Cloner:()=>{},changeEntityProptotype:()=>{},createEntity:()=>{}},wp=class extends os{constructor(){super()}getPoints(e=12){let t=[],i,r=this.getCurveLengths(),s=r[r.length-1]/r.length;for(let a=0,o=this.curves;a<o.length;a++){let h=o[a],c=Math.ceil(e*(0===a?r[a]:r[a]-r[a-1])/s),d=h.getPoints(c);for(let e=0;e<d.length;e++){let r=d[e];i&&i.equals(r)||(t.push(r),i=r)}}return this.autoClose&&t.length>1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}};function wf(e,t,i){return .001>=t.clone().sub(e).cross(t.clone().sub(i)).length()}function wm(e,t){let i=new iy(...e.position),r=new iy(...e.controlNext.position),s=new iy(...t.controlPrevious.position),a=new iy(...t.position);return wf(i,r,a)&&wf(i,s,a)}function wg(e){let t=e.points.map(e=>new iy(...e.data.position)),i=[e.points[0]],r=new iy(...i[0].data.position);for(let s=0;s<e.points.length-1;s++)wf(r,t[s],t[s+1])||(i.push(e.points[s]),r=t[s]);i.push(e.points[e.points.length-1]);let s=e.isClosed,a=i.length-!s,o=i.length,h=[];for(let t=0;t<o;t++){let r=i[t].data,a=new iy(...r.position),c=new iy(...r.controlPrevious.position),d=new iy(...r.controlNext.position),u={position:a,baseRoundness:r.roundness,controlPrevious:c,controlNext:d};if(0===r.roundness||!e.isClosed&&(0===t||t===o-1)){h[t]={...u,removedLength:0};continue}let p=s&&0==t?o-1:t-1,f=s&&t==o-1?0:t+1,m=i[p].data,g=i[f].data,v=new iy(...m.position),y=new iy(...g.position),x=v.clone().sub(a).normalize(),b=y.clone().sub(a).normalize();Object.assign(u,{prevDir:x,nextDir:b});let w=wm(m,r),_=wm(r,g);if(w&&_){let e=x.clone().add(b).normalize(),i=e.clone().cross(x).length()/x.dot(e);h[t]={...u,tan:i,removedLength:r.roundness/i}}else h[t]={...u,removedLength:0}}for(let e=0;e<a;e++){let t=e,i=s&&e===o-1?0:e+1,r=h[t],a=h[i];if(0!==r.removedLength||0!==a.removedLength){let e=r.position.distanceTo(a.position);r.removedLength=Math.min(r.removedLength,e/2),a.removedLength=Math.min(a.removedLength,e/2)}}let c=[];for(let e=0;e<a;e++){let t=e,r=s&&e===o-1?0:e+1,a=h[t],d=h[r],u=null;if(wm(i[t].data,i[r].data)){let e=a.position.clone(),t=d.position.clone();(0!==a.removedLength||0!==d.removedLength)&&(a.nextDir&&e.add(a.nextDir.clone().setLength(a.removedLength)),d.prevDir&&t.add(d.prevDir.clone().setLength(d.removedLength))),e.distanceTo(t)>.001&&(u=new n8(e,e.clone().lerp(t,.3),t.clone().lerp(e,.3),t))}else a.position.distanceTo(d.position)>.001&&(u=new n8(a.position,a.controlNext,d.controlPrevious,d.position));c[2*e+1]=u}for(let e=0;e<o;e++){let t=h[e];if(0===t.removedLength){c[2*e]=null;continue}let i=t.position,r=t.prevDir.clone().multiplyScalar(t.removedLength).add(i),s=t.nextDir.clone().multiplyScalar(t.removedLength).add(i),a=t.tan*t.removedLength,o=t.prevDir.clone().add(t.nextDir).normalize(),d=r.clone().lerp(s,.5),u=r.distanceTo(s)/2,p=o.clone().multiplyScalar(Math.sqrt(Math.pow(a,2)-Math.pow(u,2))).add(d),f=o.clone().multiplyScalar(-a).add(p),m=i.distanceTo(f)/i.distanceTo(d),g=t.prevDir.clone().multiplyScalar(m*i.distanceTo(r)).add(i),v=g.clone().lerp(f,2),y=r.clone().lerp(g,4/3),x=s.clone().lerp(v,4/3);c[2*e]=new n8(r,y,x,s)}let d=new wp;
vendor: 12,068 bytes, line 3139
3139return c.forEach(e=>{e&&d.add(e)}),d}(SL||(SL={})).is=function(e){return e&&e.__isEntity};var wv=e=>SL.is(e),wy={type:"completeState",isfromEntity:!0},wx=["x","y","z"],wb=new iy,ww=new iy().set(0,1,0),w_=e=>class extends wt(e){constructor(){super(...arguments),this.raycastLock=!1,this.scaleLock=!1,this.disposed=!1,this.stateSelection=null,this.destroyedInAction=!1,this.instances=[],this.prevState=null,this.currentState=null,this.currentAnimationAction=null,this.reversibleToState=null,this.currentTransitionEvent=null,this.previousAction=null,this._singleBBox=new wd,this._recursiveBBox=new wd,this.singleBBoxNeedsUpdate=!0,this.recursiveBBoxNeedsUpdate=!0,this._needApplyPathSnapping=!0,this.attachedPaths=new Set}get __isEntity(){return!0}entityChildren(e){let t=this.children[e];if(SL.is(t))return t}entityChildrenCount(){let e=this.children.length;for(;e--;)if(SL.is(this.children[e]))return e+1;return 0}get isConcreteEntity(){return"string"==typeof this.identity}get isVirtualEntity(){return"string"!=typeof this.identity}get isInstanceRoot(){return this.isConcreteEntity&&"Instance"===this.data.type}nearestInstanceSelfOrParent(){let e=this;for(;"Instance"!==e.data.type;){let t=e.parent;if(!SL.is(t))return;e=t}return e}forInstancesRec(e){this.instances.forEach(t=>{t.disposed||e(t),t.forInstancesRec(e)})}super_Entity(e,t){"string"==typeof e&&(this.uuid=e),this.identity=e,this.data=t,this.matrixAutoUpdate=!1,this.dataPatched=this.data}changeSelectedState(e,t,i=!1){if(!(0===this.data.states.length&&!i)){for(let e of this.data.states)yG.toOps(this.data,e.data).forEach(e=>{let i=fr.replaceProps(e,this.data);this.dataPatched=this.data,this.updateByPatchedOp(i,this.data,t)});if(null!==e){let i=this.data.states.data(e);i&&(this.dataPatched=yG.patch(this.data,i),yG.toOps(this.data,i).forEach(e=>{this.updateByPatchedOp(e,this.dataPatched,t)}))}i&&this.updateTransformState(this.dataPatched,t),this.stateSelection=e,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(e,t){e.setScalar(0),t.setScalar(0)}resetBBoxNeedsUpdateSelf(){this.singleBBoxNeedsUpdate=!0,this.recursiveBBoxNeedsUpdate=!0}resetBBoxNeedsUpdate(){this.resetBBoxNeedsUpdateSelf(),this.traverseAncestors(e=>{wv(e)&&e.resetBBoxNeedsUpdateSelf()}),this.traverseEntity(e=>{e.resetBBoxNeedsUpdateSelf()})}find(e){let t;return this.traverseEntity(i=>{i.uuid===e&&(t=i)}),t}traverseSortNextHelper(){let e=this.parent;if(e){let t=e.children,i=t.indexOf(this)+1;if(SL.is(t[i]))return t[i];if(SL.is(e))return e.traverseSortNextHelper()}}sortNext(){let e=this.children;return this.children.length>0&&SL.is(this.children[0])?e[0]:this.traverseSortNextHelper()}goUp(e){let t=this;for(;e>0&&null!==t;)t=t.parent,e-=1;return t}hasAnccestorOrSelf(e){return this===e||this.hasAnccestor(e)}hasAnccestor(e){let t=this.parent;for(;t;){if(e===t)return!0;t=t.parent}return!1}countToAccestor(e){let t=0,i=this;for(;i!==e;){if(null===i)return -1;i=i.parent,t+=1}return t}forEachEntity(e){for(let t of this.children)wv(t)&&e(t)}traverseEntityAncestors(e){this.traverseAncestors(t=>{SL.is(t)&&e(t)})}traverseConcreteEntity(e,t=0){if(!0!==e(this,t))for(let i of this.children)wv(i)&&i.isConcreteEntity&&i.traverseEntity(e,t+1)}traverseEntity(e,t=0){if(!0!==e(this,t))for(let i of this.children)wv(i)&&i.traverseEntity(e,t+1)}traverseVisibleEntity(e){for(let t of(e(this),this.children))wv(t)&&t.visible&&t.traverseVisibleEntity(e)}updateMatrix(){super.updateMatrix(),this.cloner&&this.cloner.onObjUpdateMatrix(),this.dispatchEvent({type:"updateMatrix"})}updateMatrixWorld(e){super.updateMatrixWorld(e),this.dispatchEvent({type:"updateMatrixWorld"})}copy(e,t=!1){return super.copy(e,t),this.dataPatched=e.dataPatched,this.raycastLock=e.raycastLock,this.scaleLock=e.scaleLock,this.hiddenMatrix.copy(e.hiddenMatrix),this}hasEntityChild(){return this.children.some(e=>wv(e))}isAncestorOf(e){if(this.uuid===e)return!1;let t=!1;return this.traverseEntity(i=>{i.uuid===e&&(t=!0)}),t}toObjectTransformState(e=[]){return this.updateWorldMatrix(!0,!1),uq({position:this.position.toArray(),rotation:[this.rotation.x*tQ.RAD2DEG,this.rotation.y*tQ.RAD2DEG,this.rotation.z*tQ.RAD2DEG],scale:this.scale.toArray(),hiddenMatrix:this.hiddenMatrix.toArray()},e)}getTransformValues(e,t,i){return t[e].map((t,r)=>i?.shared.getVariable(t,[this.uuid,e,wx[r]])??t)}updateTransformState(e,t){let i=!1;return e.position&&(this.position.fromArray(this.getTransformValues("position",e,t)),i=!0),e.rotation&&(wb.fromArray(this.getTransformValues("rotation",e,t)).multiplyScalar(tQ.DEG2RAD),this.rotation.setFromVector3(wb),i=!0),e.scale&&(this.scale.fromArray(this.getTransformValues("scale",e,t)),i=!0),void 0!==e.hiddenMatrix&&(i=!0,this.hiddenMatrix.fromArray(e.hiddenMatrix??gn.identity)),i&&(this.updateMatrix(),this.resetBBoxNeedsUpdate(),this.invalidateClonerTransform(this),this.traverseEntityAncestors(e=>{e.invalidateClonerTransform(this)})),e.position&&e.rotation&&e.scale&&void 0!==e.hiddenMatrix&&this.updateWorldMatrix(!1,!0),i}onVariableUpdate(e=!1){e?this.resetBBoxNeedsUpdate():(this.updateMatrix(),this.resetBBoxNeedsUpdate(),this.invalidateClonerTransform(this),this.traverseEntityAncestors(e=>{e.invalidateClonerTransform(this)}))}dispose(){this.disposed=!0,this.cloner&&(this.cloner.removeFromParent(),this.cloner=void 0)}disposeChildrenRecursively(){for(let e of this.children)SL.is(e)&&e.disposeRecursively()}disposeRecursively(){this.dispose(),this.children.forEach(e=>{SL.is(e)&&e.disposeRecursively()})}toState(e=[]){return uq({name:this.name,visible:this.visible,raycastLock:this.raycastLock,...this.toObjectTransformState(e)},e)}updateByObjUpdateOp(e,t){void 0!==e&&this.updateByOp({type:0,props:e,path:[]},{...this.data,...e},t,!1)}updateByOp(e,t,i,r){let s=this.data;this.data=t;let a=e,o=p9(e.path,["states","*"]);if(null!==o){if(0===e.type){let[t]=o;if(this?.stateSelection===t){let t={...e.props};if(delete t.name,Object.values(e.props).some(e=>void 0===e)){let i=this.data;if(void 0!==i){let r=fn.zoom(i,e.path.slice(2));if(r)for(let i in e.props)void 0===e.props[i]&&i in r&&(t[i]=r[i])}}a={...e,props:t,path:e.path.slice(2)}}}}else if(0===e.type){let t=this.stateSelection?this.data.states.data(this.stateSelection):void 0;if(void 0!==t){if(void 0!==e.props.name&&t.name){let{name:e,...i}=t;t=i}if(void 0!==e.props.material&&"material"in t){let{material:e,...i}=t;t=i}let i=fn.removeOverridden(e.path,e.props,t);a={...e,props:i}}}if(this.updateByPatchedOpBase(a,yG.patch(this.data,this.stateSelection?this.data.states.data(this.stateSelection):void 0),i),p9(e.path,["overrides"])){let r=[],s=[...e.path];for(r.push(s[1]),s.splice(0,2);s.length>0&&"descendants"===s[0];)r.push(s[1]),s.splice(0,2);if(void 0===r[r.length-1]){if(0===e.type)for(let t of Object.keys(e.props)){r[r.length-1]=t;let s=i.scene.findInstance([this.uuid,...r]);s&&(s.overrideData=e.props[t],s.updateState(pI.apply(s.component.data,s.overrideData),i))}}else{let a=i.scene.findInstance([this.uuid,...r]);if(a){let o=fn.zoom(a.component.data,s);if(0===(e={...e,path:s}).type){let t=e.props;if(o)for(let[i,r]of Object.entries(e.props))void 0===r&&(t===e.props&&(t={...e.props}),t[i]=o[i]);e={...e,props:t}}a.overrideData=yU.resolve(t.overrides,r),a.updateByOp(e,fs.applySimple(a.data,e),i,!1)}}}else if(this.instances.length>0){let r;if(0===e.path.length&&0===e.type){let t;for(let i of yV.rootOverrideProps)i in e.props&&(void 0===t&&(t={}),t[i]=e.props[i]);t&&(r={...e,props:t})}else for(let t of yV.rootOverrideProps)if(p9(e.path,[t])){r=e;break}void 0!==r&&this.instances.forEach(e=>{if(e.isInstanceRoot){let t=pI.filterOp(e.overrideData,r);t&&e.updateByOp(t,fs.applySimple(e.data,t),i,!0)}}),this.instances.forEach(r=>{if(!r.isInstanceRoot){let a=pI.filterOp(r.overrideData,e);if(a){let o;o=s===r.data&&e===a?t:fs.applySimple(r.data,a),r.updateByOp(a,o,i,!0)}}})}}updateByPatchedOpBase(e,t,i){if(this.dataPatched=t,0===e.path.length&&0===e.type)void 0===e.props.type||gT.is(e.props.type)||wu.changeEntityProptotype(this,t,i);else if(1===e.path.length&&"geometry"===e.path[0]&&0===e.type&&"type"in e.props)for(let e of(wu.changeEntityProptotype(this,t,i),this.children))SL.is(e)&&e.updateVisible(i.scene);this.updateByPatchedOp(e,t,i)}updateByPatchedOp(e,t,i){if(0===e.path.length&&0===e.type?this.updateState(e.props,i):0===e.type&&("resolutionLevel"in e.props||"useChildrenColors"in e.props)&&this.updateState(t,i),"morphTargetInfluences"===e.path[0]&&0===e.type){let r=t.morphTargetInfluences.get(e.path[1])?.data.name;r&&this.updateMorphInfluences(r,i.shared.getVariable(e.props.value,[this.uuid,"morphTargetInfluences",r]))}if(null!==p9(e.path,["pathSnapping"])&&this.updatePathSnapping(t.pathSnapping),null!==p9(e.path,["cloner"])){let r=fs.drop(e,1);0===r.path.length&&0===r.type&&!0===r.props.disabled?this.setFromClonerState(null,i):this.cloner?this.cloner.updateState(t.cloner,i.scene):(this.setFromClonerState(t.cloner,i),this.expandCloner(i.scene)),this.updateVisible(i.scene)}}updatePathSnapping(e=this.dataPatched.pathSnapping){this._updatedPathSnapping=e,this._needApplyPathSnapping=!0}get updatedPathSnapping(){return this._updatedPathSnapping}applyPathSnapping(e){let t=this._updatedPathSnapping?.pathId??this.dataPatched.pathSnapping.pathId,i=this._updatedPathSnapping?.slide??this.dataPatched.pathSnapping.slide??0,r=this._updatedPathSnapping?.offset??this.dataPatched.pathSnapping.offset??0,s=this._updatedPathSnapping?.orientation??this.dataPatched.pathSnapping.orientation;if(null===t)return;let a=e.find(t);if(!a||!1===this._needApplyPathSnapping)return;this._needApplyPathSnapping=!1;let o=a.data;if(o.geometry.path.points.length<=1)return;let h=wg(o.geometry.path),c=(i+r)%1;i+r===1&&0===c&&(c=1);let d=null;try{d=h.curves.length?h.getPointAt(c):null}catch(e){}if(null===d)return;let u=this.parent?this.parent?.matrixWorld:new iY;a.updateMatrixWorld();let p=new iY().multiplyMatrices(u.clone().invert(),a.matrixWorld);d.applyMatrix4(p);let f={position:d.toArray(),rotation:o.rotation};if("tangential"===s){let e=new iY().extractRotation(a.matrixWorld),t=h.getTangentAt(c).applyMatrix4(e).add(d),i=new iY().lookAt(d,t,ww),r=wb.setFromEuler(new i4().setFromRotationMatrix(i)).multiplyScalar(tQ.RAD2DEG);f={...f,rotation:r.toArray()}}this.updateTransformState(f),this.traverseEntity(e=>{e._cameraType&&e.dispatchEvent(wy)})}updateVisible(e){if(this.visible=this.dataPatched.visible&&(!this.dataPatched.cloner||(this.dataPatched.cloner.disabled??!1)||this.dataPatched.cloner?.hideBase!==!0),!e)return;let t=!1;this.traverseEntity(e=>{if("Splat"===e.data.type)return t=!0,!0}),t&&e.reloadSplats()}updateState_Entity(e,t){void 0!==e.name&&(this.name=e.name),void 0!==e.raycastLock&&(this.raycastLock=e.raycastLock),void 0!==e.visible&&(this.updateVisible(t?.scene),this.resetBBoxNeedsUpdate()),t&&"cloner"in e&&void 0!==e.cloner&&(this.setFromClonerState(e.cloner,t),this.updateVisible(t.scene)),this.updateTransformState(e,t)}get attachedSurfaceCloners(){return this.children.filter(e=>e instanceof wu.Cloner&&"toObject"===e.parameters.type)}setFromClonerState(e,t){this.disposed||(null===e||e.disabled?(this.cloner&&this.cloner.removeFromParent(),this.cloner=void 0):void 0===this.cloner?(this.cloner=new wu.Cloner(this,e),t.scene.addPendingExpandCloner(this)):this.cloner.updateState(e,t.scene))}expandCloner(e){!this.disposed&&this.cloner&&this.cloner.expandClones(e)}invalidateClonerTransform(e){this.cloner&&this.cloner.invalidateTransform(e)}requestRender(){this.dispatchEvent({type:"requestRender"})}},wS=class{static create(e){return this.build(this.normalizeInputs(e))}
3139static normalizeInputs(e,t){let i=e.parameters?.radiusTop,r=e.parameters?.radiusBottom,s=Object.assign({},t?.parameters??{width:100,radialSegments:64,heightSegments:1,openEnded:!1,thetaStart:0,thetaLength:360,cornerRadius:8,cornerSegments:8,hollow:0},e.parameters);s.thetaLength=tQ.clamp(s.thetaLength,0,360);let a=s.width/2,o=s.radiusTop??a,h=s.radiusBottom??a;if(o===h?(o=a,h=a):o>h?(o=a,h=h*a/o):(o=o*a/h,h=a),s.shapeBlendNode){let e=2*Math.max(o=i??a,h=r??a);s.width=e,s.depth=e}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:o,radiusBottom:h})}}static build(e){let{width:t,depth:i,height:r,radialSegments:s,heightSegments:a,openEnded:o,thetaStart:h,thetaLength:c,radiusTop:d,radiusBottom:u,cornerRadius:p,cornerSegments:f,hollow:m}=e.parameters,g;return 0===c?(g=new rz).setAttribute("position",new rP([],3)):g=p||m?new wE(d,u,r,s,a,o,h,c*Math.PI/180,p,p,f,m):new oo(d,u,r,s,a,o,h,c*Math.PI/180),g.scale(1,1,i/t),Object.assign(g,{userData:{...e,type:"CylinderGeometry"}})}};function wC(e,t,i){i.x=e.x*t.x,i.y=e.y,i.z=e.x*t.y}function wM(e){return new tZ(e.y,-e.x)}var wE=class extends rz{constructor(e,t,i,r,s,a,o,h,c,d,u,p,f=!1){super(),this.type="RoundedCylinderBufferGeometry",e=void 0!==e?e:1,t=void 0!==t?t:1,i=i||1,r=Math.floor(r)||8,s=Math.floor(s)||1,a=void 0!==a&&a,o=void 0!==o?o:0,h=void 0!==h?h:2*Math.PI,a&&(c=0,d=0);let m=[],g=[],v=[],y=[],x=0,b=i/2,w=new iy,_=new iy;f&&0==e&&(e=c),f&&0==t&&(t=d);let S=new tZ(e,b),C=new tZ(t,-b),M=null,E=null,A=null,T=null,P=S.clone().sub(C),D=0,O=0,L=0;p>0&&(D=Math.min(e,t)*(1-p),O=e-D,L=t-D);let I=S.clone();I.x-=D;let R=Math.PI-P.angle(),k=P.angle(),B=Math.tan(k/2),z=Math.tan(R/2),N=B+z;if(c=Math.min(c,(e-O)/(p?N:z),P.length()/N),d=Math.min(d,(t-L)/(p?N:B),P.length()/N),c>0){let e=c/B;M=S.clone().sub(new tZ(e,c)),p&&(A=M.clone(),A.x-=D-N*c),S.sub(P.clone().setLength(e))}if(d>0){let e=d/z;E=C.clone().sub(new tZ(e,-d)),C.add(P.clone().setLength(e)),p&&(T=E.clone(),T.x-=D-N*d,I.sub(P.clone().setLength(e)))}let F=.5>(P=S.clone().sub(C)).length(),j=[];for(let u=0;u<=r;u++){let f=[],m=u/r,b=m*h+o,S=new tZ(Math.sin(b),Math.cos(b));if(T&&E?(U(f,m,S,R,d,T,-1,!0),U(f,m,S,k,d,E,-1,!1)):E?(V(f,S,E.x,0,-1),U(f,m,S,k,d,E,-1,!1)):a||V(f,S,t,L,-1),wC(wM(P).normalize(),S,w),!F)for(let e=0;e<=s;e++){let t=e/s;wC(P.clone().multiplyScalar(t).add(C),S,_),g.push(_.x,_.y,_.z),v.push(w.x,w.y,w.z),y.push(m,.5+_.y/i),f.push(x++)}if(A&&M?(U(f,m,S,R,c,M,1,!1),U(f,m,S,k,c,A,1,!0)):M?(U(f,m,S,R,c,M,1,!1),V(f,S,M.x,0,1)):a||V(f,S,e,O,1),p&&!F){wC(wM(P).multiplyScalar(-1).normalize(),S,w);for(let e=0;e<=s;e++){let t=e/s;wC(P.clone().multiplyScalar(-t).add(I),S,_),g.push(_.x,_.y,_.z),v.push(w.x,w.y,w.z),y.push(m,.5+_.y/i),f.push(x++)}}p&&!a&&f.push(f[0]),j.push(f)}for(let e=0;e<j.length-1;e++)for(let t=0;t<j[0].length-1;t++){if(a&&p&&t==s)continue;let i=j[e][t],r=j[e+1][t],o=j[e+1][t+1],h=j[e][t+1],c=g[3*o+0],d=g[3*o+2];m.push(i,r,h),(0!=c||0!=d)&&m.push(r,o,h)}function U(e,t,r,s,a,o,h,c){for(let d=0;d<u+1;d++){let p=d/u,f=h<0?p:1-p;c&&(f-=1);let m=new tZ(Math.sin(f*=s),Math.cos(f)*h);wC(m.clone().multiplyScalar(a).add(o),r,_),g.push(_.x,_.y,_.z),wC(m,r,w),v.push(w.x,w.y,w.z),y.push(t,.5+_.y/i),e.push(x++)}}function V(e,t,i,r,s){let a=new iy,o=new tZ,h=[i,r];for(let i of(s<0&&h.reverse(),h))o.set(i,b*s),wC(o,t,a),g.push(a.x,a.y,a.z),v.push(0,s,0),y.push(.5,.5),e.push(x++)}function W(i,r,s){let a=new tZ(Math.sin(s),Math.cos(s)),o=new tZ(-Math.cos(s),Math.sin(s)),h=new iy,c=i<0?(e,t,i)=>m.push(e,t,i):(e,t,i)=>m.push(e,i,t);wC(new tZ((e+t+O+L)/4,0),a,h),g.push(h.x,h.y,h.z),v.push(o.x,0,o.y),y.push(.5,.5);let d=x++;for(let e of r){let t=g.slice(3*e,3*e+3);g.push(...t),v.push(o.x,0,o.y);let i=y.slice(2*e,2*e+2);y.push(...i),x++}for(let e=d+1;e<x-1;e++)c(d,e,e+1);c(d,x-1,d+1)}h<2*Math.PI&&(W(-1,j[0],o),W(1,j[j.length-1],o+h)),this.setIndex(m),this.setAttribute("position",new rP(g,3)),this.setAttribute("normal",new rP(v,3)),this.setAttribute("uv",new rP(y,2))}},wA=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,radialSegments:32,heightSegments:8,openEnded:!1,thetaStart:0,thetaLength:360,cornerRadiusTop:8,cornerRadiusBottom:8,cornerSegments:8},e.parameters);return i.thetaLength=tQ.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:o,thetaStart:h,thetaLength:c,cornerRadiusTop:d,cornerRadiusBottom:u,cornerSegments:p}=e.parameters,f;return 0===c?(f=new rz).setAttribute("position",new rP([],3)):f=d>0||u>0||c<360?new wE(0,t/2,r,s,a,o,h,c*Math.PI/180,d,u,p,0,!0):new ol(t/2,r,s,a,o),f.scale(1,1,i/t),Object.assign(f,{userData:{...e,type:"ConeGeometry"}})}},wT=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,widthSegments:1,heightSegments:1,depthSegments:1,cornerRadius:8,cornerSegments:8},e.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(e){let{width:t,height:i,depth:r,widthSegments:s,heightSegments:a,depthSegments:o,cornerRadius:h,cornerSegments:c}=e.parameters;
3139return Object.assign(0===h?new r$(t,i,r,s,a,o):new wD(t,i,r,s,a,o,h,c),{userData:{...e,type:"CubeGeometry"}})}},wP=Math.PI/2,wD=class extends rz{constructor(e=1,t=1,i=1,r=1,s=1,a=1,o=0,h=4){super(),this.type="BoxGeometry",r=Math.floor(r),s=Math.floor(s),a=Math.floor(a),h=Math.floor(h),o=Math.min(o,e/2,t/2,i/2);let c=[],d=[],u=[],p=[],f=0;function m(e,t,i,r,s,a,h,m,g,v){let y=(a-2*o)/g,x=(h-2*o)/v,b=a/2-o,w=h/2-o,_=m/2,S=g+1,C=v+1,M=0,E=new iy;for(let a=0;a<C;a++){let o=a*x-w;for(let h=0;h<S;h++){let c=h*y-b;E[e]=c*r,E[t]=o*s,E[i]=_,d.push(E.x,E.y,E.z),E[e]=0,E[t]=0,E[i]=m>0?1:-1,u.push(E.x,E.y,E.z),p.push(h/g),p.push(1-a/v),M+=1}}for(let e=0;e<v;e++)for(let t=0;t<g;t++){let i=f+t+S*e,r=f+t+S*(e+1),s=f+(t+1)+S*(e+1),a=f+(t+1)+S*e;c.push(i,r,a),c.push(r,s,a)}f+=M}function g(e,t,i,r,s,a,m,g,v,y){let x=(m-2*o)/y,b=m/2-o,w=g/2-o,_=v/2,S=y+1,C=0,M=new iy,E=new iy;for(let c=0;c<h+1;c++){let f=c/h*wP,m=Math.sin(f)*o,g=(1-Math.cos(f))*o,v=Math.sin(f),A=Math.cos(f);M[t]=(w+m)*s,M[i]=(_-g)*a,E[e]=0,E[t]=v*Math.sign(M[t]),E[i]=A*Math.sign(M[i]);for(let t=0;t<S;t++){let i=t*x-b;M[e]=i*r,d.push(M.x,M.y,M.z),u.push(E.x,E.y,E.z),p.push(t/y),p.push(0),C+=1}}for(let e=0;e<h;e++)for(let t=0;t<y;t++){let i=f+t+S*e,r=f+t+S*(e+1),s=f+(t+1)+S*(e+1),a=f+(t+1)+S*e;c.push(i,r,a),c.push(r,s,a)}f+=C}function v(r,s,a){let m=new iy,g=new iy(e/2,t/2,i/2);g.subScalar(o);let v=[],y=r*s*a>0?(e,t,i)=>c.push(e,t,i):(e,t,i)=>c.push(e,i,t);for(let e=0;e<=h;e++){let t=[],i=wP*(1-e/h),c=Math.cos(i),y=Math.sin(i),x=0;for(let i=0;i<=e;i++){let i=Math.cos(x),h=Math.sin(x);m.x=c*i,m.y=y,m.z=c*h;let v=g.clone().addScaledVector(m,o);d.push(r*v.x,s*v.y,a*v.z),u.push(r*m.x,s*m.y,a*m.z),p.push(0,0),t.push(f++),x+=wP/e}v.push(t)}let x=v.length-1;for(let e=0;e<x;e++){let t=v[e],i=v[e+1],r=t.length-1;y(t[0],i[1],i[0]);for(let e=1;e<=r;e++)y(t[e-1],t[e],i[e]),y(t[e],i[e+1],i[e])}}m("z","y","x",-1,-1,i,t,e,a,s),m("z","y","x",1,-1,i,t,-e,a,s),m("x","z","y",1,1,e,i,t,r,a),m("x","z","y",1,-1,e,i,-t,r,a),m("x","y","z",1,-1,e,t,i,r,s),m("x","y","z",-1,-1,e,t,-i,r,s),o>0&&(g("z","y","x",-1,-1,1,i,t,e,a),g("z","y","x",1,-1,-1,i,t,e,a),g("z","y","x",-1,1,-1,i,t,e,a),g("z","y","x",1,1,1,i,t,e,a),g("x","y","z",-1,-1,-1,e,t,i,r),g("x","y","z",1,-1,1,e,t,i,r),g("x","y","z",-1,1,1,e,t,i,r),g("x","y","z",1,1,-1,e,t,i,r),g("y","x","z",-1,-1,1,t,e,i,s),g("y","x","z",1,-1,-1,t,e,i,s),g("y","x","z",1,1,1,t,e,i,s),g("y","x","z",-1,1,-1,t,e,i,s),v(1,1,1),v(-1,1,1),v(1,-1,1),v(-1,-1,1),v(1,1,-1),v(-1,1,-1),v(1,-1,-1),v(-1,-1,-1)),this.setIndex(c),this.setAttribute("position",new rP(d,3)),this.setAttribute("normal",new rP(u,3)),this.setAttribute("uv",new rP(p,2))}},wO=class extends rz{constructor(e=[],t=[],i="",r=1,s=.2,a=4){super(),this.type="PolyhedronGeometryRound";let o=[],h=[],c=[];(function(){0==(s=Math.min(1-1e-5,s))&&(a=0);let h={IcosahedronGeometry:5,DodecahedronGeometry:3,HexahedronGeometry:3,OctahedronGeometry:4,TetrahedronGeometry:3}[i],d=new iy,u=d.clone(),p=new rb,f=s*r,m=r-f,g=a+1,v=new iy,y=(e,t)=>v.subVectors(e,t).normalize(),x=(e,t)=>Array(e).fill(void 0).map(t),b=x(e.length/3,(t,i)=>new iy().fromArray(e,3*i).setLength(r)),w=[];for(let e=0;e<b.length;e++){let i=b[e],r=[],s,a,o,h=1e10,c=-1;for(;-1!=(c=t.indexOf(e,c+1));){let e=c-c%3;s=t[e+(c+1)%3],a=t[e+(c+2)%3],h=Math.min(h,o=i.distanceToSquared(b[s])),r.push([s,a,o])}h+=1e-6;let d=[],u=0,p=r.length;for(let t=0;t<p;t++){[s,a,o]=r[u];let t=w[s]?.includes(e)==!0;o<=h&&d.push(s+1e6*t),u=r.findIndex(e=>e[0]==a)}w.push(d)}let _=[];{let e=0,t=0,i,r,s=3==h;for(let o=0;o<=a;o++){i=o*(o+1)/2,r=(o+1)*(o+2)/2;for(let h=0;h<a-o;h++)[e,t]=[i+h+o+2,r+h+o+3],_.push(i,r,...s?[t,i]:[e,r],t,e),[i,r]=[e,t];_.push(i,r,i+a+2)}}let S=d.clone(),C=d.clone(),M=d.clone(),E=d.clone(),A=d.clone(),T=[],P=x(b.length,()=>x(h,()=>d.clone()));for(let e=0;e<b.length;e++){d.copy(b[e]).normalize(),S.copy(d).multiplyScalar(m);let t=w[e];for(let i=0;i<t.length;i++){let r=t[i],s=t[(i+1)%h];p.setFromPointsAndIndices(b,e,r%1e6,s%1e6),p.b.sub(p.a).setLength(1e10).add(p.a),p.c.sub(p.a).setLength(1e10).add(p.a),p.closestPointToPoint(S,P[e][i])}let i=[],r=[],s=[],x=new iy;0==a&&[...P[e]].reduce((e,t)=>
3139e.add(t),x).multiplyScalar(1/h);for(let t=0;t<h;t++){let o=[],c=(t-1+h)%h,p=P[e][c],b=P[e][t];d.copy(p).sub(S),u.copy(b).sub(S);let w=S.angleTo(d),_=d.angleTo(u),T=Math.cos(w)*f;0==a?C.copy(x):C.copy(S).setLength(m+T),r.push(T);let D=[C,p,b];for(let e=0;e<2;e++){let t=D[e],r=D[e+1];E.subVectors(t,S),A.subVectors(r,S),M.crossVectors(E,A).normalize();for(let r=0;r<g;r++){let s=[w,_][e]*r/g;d.copy(E).applyAxisAngle(M,s).add(S),i.push(d.clone()),e&&(y(d,S),o.push([0==r?t:d.clone(),v.clone()]))}e&&(y(r,S),o.push([r,v.clone()]))}s.push(o)}T.push(s);let D=2*g;for(let e=0;e<h;e++){let t=D*e,s=(e+1)%h*D,a=[i[t]];for(let o=1;o<g;o++){E=i[t+o],A=i[s+o],a.push(E);for(let t=1,i=o-2+1;t<=i;t++)d.lerpVectors(E,A,t/(i+1)),d.sub(S).setLength(r[e]).add(S),a.push(d.clone());a.push(A)}for(let e=0;e<g;e++)a.push(i[e+g+t]);a.push(i[s+g]);let u=_.map(e=>a[e]);o.push(...u.map(e=>[e.x,e.y,e.z]).flat()),c.push(...u.map(e=>(y(e,S),[v.x,v.y,v.z])).flat())}}let D=[];for(let e=0;e<w.length;e++)for(let t=0;t<h;t++){let i=w[e][t];if(i<1e6){let r=w[i].findIndex(t=>t%1e6==e),s=T[e][t],a=T[i][r];for(let e=0;e<g;e++){let t=s[e],i=a[g-e],r=s[e+1];[t,i,r,r,i,a[g-(e+1)]].forEach(e=>{o.push(e[0].x,e[0].y,e[0].z),c.push(e[1].x,e[1].y,e[1].z)})}D.push(s[0][0],a[g][0],s[g][0],a[0][0])}}for(;D.length;){let e,t,i,r;[e,t]=D.splice(0,2);let s=[e];for(;e!=t;)s.push(t),r=(i=D.indexOf(t))%2,t=D.splice(i-r,2)[1-r];v.subVectors(s[0],s[1]).cross(d.subVectors(s[0],s[2])).normalize();let a=0>v.dot(s[0]);a&&v.negate();for(let e=1;e<=s.length-2;e++)[s[e+ +a],s[e+1-a],s[0]].forEach(e=>{o.push(e.x,e.y,e.z),c.push(v.x,v.y,v.z)})}})(),function(){let e=new iy;for(let i=0;i<o.length;i+=3){var t;e.x=o[i+0],e.y=o[i+1],e.z=o[i+2];let r=f(e)/2/Math.PI+.5,s=Math.atan2(-(t=e).y,Math.sqrt(t.x*t.x+t.z*t.z))/Math.PI+.5;h.push(r,1-s)}let i=new iy,r=new iy,s=new iy,a=new iy,c=new tZ,d=new tZ,u=new tZ,p=(e,t,i,r)=>{r<0&&1===e.x&&(h[t]=e.x-1),0===i.x&&0===i.z&&(h[t]=r/2/Math.PI+.5)};for(let e=0,t=0;e<o.length;e+=9,t+=6){i.set(o[e+0],o[e+1],o[e+2]),r.set(o[e+3],o[e+4],o[e+5]),s.set(o[e+6],o[e+7],o[e+8]),c.set(h[t+0],h[t+1]),d.set(h[t+2],h[t+3]),u.set(h[t+4],h[t+5]),a.copy(i).add(r).add(s).divideScalar(3);let m=f(a);p(c,t+0,i,m),p(d,t+2,r,m),p(u,t+4,s,m)}for(let e=0;e<h.length;e+=6){let t=h[e+0],i=h[e+2],r=h[e+4],s=Math.max(t,i,r),a=Math.min(t,i,r);s>
vendor: 1,347 bytes, line 3139
3139.9&&a<.1&&(t<.2&&(h[e+0]+=1),i<.2&&(h[e+2]+=1),r<.2&&(h[e+4]+=1))}function f(e){return Math.atan2(e.z,-e.x)}}(),this.setAttribute("position",new rP(o,3)),this.setAttribute("normal",new rP(c,3)),this.setAttribute("uv",new rP(h,2))}static fromJSON(e){return new wO(e.vertices,e.indices,e.radius,e.corner,e.cornerSides)}},wL=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,detail:0,corner:0,cornerSides:4},e.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(e){let{width:t,height:i,depth:r,detail:s,corner:a,cornerSides:o}=e.parameters,h=0===s&&0!==a?new wI(.5*t,a,o):new oc(.5*t,s);return h.scale(1,i/t,r/t),Object.assign(h,{userData:{...e,type:"DodecahedronGeometry"}})}},wI=class extends wO{constructor(e=1,t=.2,i=4){let r=(1+Math.sqrt(5))/2,s=1/r,a="DodecahedronGeometry";super([-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],[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,
vendor: 6,002 bytes, line 3139
313919,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],a,e,t,i),this.type=a}static fromJSON(e){return new wI(e.radius,e.corner,e.cornerSides)}},wR=class{constructor(e){this.position=new tZ,this.startPosition=new tZ,this.uuid=tQ.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 wR(this.position).copy(this)}toJSON(){return[this.position.x,this.position.y]}},wk=class extends wR{constructor(e){super(e.position),this.parent=e}copy(e){return super.copy(e),this}clone(){return new wk(this.parent).copy(this)}},wB=class extends wR{constructor(e,t){super(t),this.controls=[],this.roundness=0,this.areControlsDirectionsMirrored=!0,this.uuid=e,this.controls.push(new wk(this),new wk(this))}static create(e,t){let i=new wB(e,new tZ(...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 0===t?this.controls[1]:1===t?this.controls[0]:null}applyOffsetToControls(e,t=1){for(let i=0,r=this.controls.length;i<r;i++){let r=this.controls[i];this.position.distanceTo(r.position)<=t?r.position.copy(this.position):r.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 wB(this.uuid,this.position).copy(this)}toJSON(){return super.toJSON().concat(this.controls[0].toJSON(),this.controls[1].toJSON(),[this.roundness])}computeTangents(){return[this.curveBefore?.getTangentAt(1),this.curveAfter?.getTangentAt(0)]}computeNormals(e=new tZ,t=new tZ){let[i,r]=this.computeTangents();return i&&r&&(wz(i,e),wz(r,t)),[e,t]}computeTangent(e=new tZ){let[t,i]=this.computeTangents();return t&&i&&e.copy(t).add(i).normalize(),e}computeNormal(e=new tZ){let[t,i]=this.computeNormals();return e.copy(t).add(i).normalize(),e}};function wz(e,t=new tZ){let i=e.length();return t.set(-e.y/i,e.x/i)}var wN=e=>e,wF=new tZ,wj=new tZ,wU=new tZ,wV=new tZ,wW=new tZ,wH=new tZ,wG=new iy,wq=new iy;function wX(e,t,i=Number.EPSILON){return Math.abs(e-t)<i}function wY(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 wQ(e,t,i){return 0===wF.copy(t).sub(e).cross(wj.copy(i).sub(e))}function wZ(e,t){return e.position.equals(e.controls[1].position)&&t.position.equals(t.controls[0].position)}function wK(e,t){return wQ(e.position,e.controls[1].position,t.position)&&wQ(e.position,t.controls[0].position,t.position)}function wJ(e,t=12,i=!1){let r=[];for(let s=0,a=e.length;s<a;s++){let a=e[s],o=0;if(i&&void 0!==a.roundedCurveCorner){let e=.5*w$(a.roundedCurveCorner,t);s>0&&(r[s-1]+=e),o+=e}void 0!==a.curveAfter&&(o+=w$(a.curveAfter,t)),r.push(o)}return e.length>0&&i&&void 0!==e[0].roundedCurveCorner&&(r[e.length-1]+=.5*w$(e[0].roundedCurveCorner,t)),r}function w$(e,t=12){return e&&e instanceof nQ?2*t:e&&(e instanceof n9||e instanceof n7)?1:e&&e instanceof oi?t*e.points.length:t}var w0=new tZ,w1=new tZ,w2=new tZ,w3=new tZ,w4=new tZ,w5=new tZ,w6=class extends od{constructor(e=100,t=100){super(),this.points=[],this.shapeHoles=[],this.plane=new ss(new iy(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=tQ.generateUUID(),this.needsUpdate=!1,this.roundedCurves=[],this._width=e,this._height=t}static createFromState(e,t,i){let r=new w6;return r.isClosed=e.isClosed,r.points=e.points.map(e=>wB.create(e.id,e.data)),"number"==typeof e.roundness&&(r.roundness=e.roundness),r.shapeHoles=e.shapeHoles.map(e=>w6.createFromState(e)),void 0!==t&&void 0!==i&&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(e=>this.getPointIndexById(e)).filter(e=>e>=0)}getPointIndexById(e){let t=this.points.length,i=this.points.findIndex(t=>t.uuid===e);if(i<0){let i=t;for(let t=0,r=this.shapeHoles.length;t<r;t++){let r=this.shapeHoles[t],s=r.points.length,a=r.getPointIndexById(e);if(!(a<0))return a+i;i+=s}}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 r=this.shapeHoles[i],s=e-t;if(s<=r.points.length-1)return r.points[s];t+=r.points.length}}throw 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 r=this.shapeHoles[i],s=r.points.indexOf(e);if(s>=0)return t+s;t+=r.points.length}return -1}getAllPoints(){let e=[].concat(...this.shapeHoles.map(e=>e.points));return[...this.points,...e]}applySize(e,t){0===e&&(e=.001),0===t&&(t=.001),this._width=e,this._height=t}applyScale(e,t){let i=w0.set(e,t);for(let e=0,t=this.points.length;e<t;e++){let t=this.points[e];t.position.multiply(i),t.controls[0].position.multiply(i),t.controls[1].position.multiply(i)}for(let i=0,r=this.shapeHoles.length;i<r;i++)this.shapeHoles[i].applyScale(e,t);this._update()}createPoint(e,t=0,i=tQ.generateUUID()){let r=new wB(i,e instanceof tZ?e:ne
vendor: 5,866 bytes, line 3139
3139w tZ(e,t));return r.roundness=this.roundness,r}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 i=this.points[t];if(i.uuid===e)return i}for(let t=0,i=this.shapeHoles.length;t<i;t++){let i=this.shapeHoles[t].getPointByUuid(e);if(i)return i}}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(t=>t.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,void 0===this.curveDivisions&&this.computeCurveDivisions(t);let r=i?this.roundedCurveDivisions:this.curveDivisions;return function(e,t,i=12,r=!0){let s=wq.set(0,0,0),a,o=0,h=[];for(let r=0;r<t.length;r++){let c=wN(t[r]),d=w$(c,i);h.push(d);for(let t=0;t<=d;t++)if(c instanceof n6||c instanceof oe||c instanceof n9){if(c.getPoint(t/d,wF),s.set(wF.x,wF.y,0),void 0!==a&&function(e,t,i=Number.EPSILON){return e.distanceTo(t)<i}(a,s))continue;void 0===a&&(a=wG),a.copy(s),e.setXYZ(o,s.x,s.y,s.z),o++}}r&&o>1&&(e.getX(o-1)!==e.getX(0)||e.getY(o-1)!==e.getY(0)||e.getZ(o-1)!==e.getZ(0))&&(e.setXYZ(o,e.getX(0),e.getY(0),e.getZ(0)),o++)}(e,i?this.roundedCurves:this.curves,t,this.autoClose),r.reduce((e,t)=>e+t,0)+1}computeCurveDivisions(e=12){return this.curveDivisions=wJ(this.points,e,!1),this.roundedCurveDivisions=wJ(this.points,e,!0),this.curveDivisions}extractFilteredShapePointsToBuffer(e,t,i=12){return 2*(function(e,t,i,r=12,s=!0){let a=wq.set(0,0,0),o=0,h=[];for(let s=0;s<t.length;s++){if(!1===i[s])continue;let c,d=wN(t[s]),u=w$(d,r);h.push(u);for(let t=0;t<=u;t++)if(d instanceof n6||d instanceof oe||d instanceof n9){if(d.getPoint(t/u,wF),a.set(wF.x,wF.y,0),c?.equals(a))continue;void 0===c?c=wG:(e.setXYZ(o,c.x,c.y,c.z),o++,e.setXYZ(o,a.x,a.y,a.z),o++),c.copy(a)}}return s&&o>1&&(e.getX(o-1)!==e.getX(0)||e.getY(o-1)!==e.getY(0)||e.getZ(o-1)!==e.getZ(0))&&(e.setXYZ(o,e.getX(0),e.getY(0),e.getZ(0)),o++),h})(e,this.curves,t,i,this.autoClose).reduce((e,t)=>e+t,0)}extractShapePointsToFlatArray(e,t=12){return this.subdivision=t,void 0===this.curveDivisions&&this.computeCurveDivisions(t),function(e,t,i=12,r=!0){let s,a=0;for(let r=0;r<t.length;r++){let o=wN(t[r]),h=w$(o,i);for(let t=0;t<=h;t++)if(o instanceof n6||o instanceof oe||o instanceof n9){if(o.getPoint(t/h,wF),void 0!==s&&function(e,t,i=Number.EPSILON){return e.distanceTo(t)<i}(s,wF,1e-12))continue;void 0===s&&(s=wj),s.copy(wF),e.push(wF.x,wF.y),a++}}return wX(e[0],e[e.length-2],1e-12)&&wX(e[1],e[e.length-1],1e-12)&&(e.pop(),e.pop()),r&&a>1&&!(wX(e[a-1],e[1],1e-12)&&wX(e[a-2],e[0],1e-12))&&(e.push(e[0],e[1]),a++),e}(e,this.roundedCurves,t,this.autoClose)}getCurveIndexFromVertexId(e,t=!1){let i=0;void 0===this.curveDivisions&&this.computeCurveDivisions(this.subdivision);let r=t?this.roundedCurveDivisions:this.curveDivisions,s=0;t&&void 0!==this.points[0].roundedCurveCorner&&(s=.5*w$(this.points[0].roundedCurveCorner,this.subdivision));let a=e-s;a<0&&(a+=r.reduce((e,t)=>e+t,0));for(let e=0,t=r.length;e<t;e++){let t=r[e];if(a<i+t)return[e,(a-i+1)/t];i+=t}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,o=a[e];if(wZ(r,s)){let e=r.position.distanceTo(s.position);return r.position.distanceTo(w0.set(i.x,i.y))/e}let h=0;for(let t=0;t<e;t++)h+=a[t];return(t-h)/o}dispose(){}_applyCurveForPoint(e,t){wZ(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 e=0,t=this.points.length;e<t;e++){let t=this.points[e];if(0===e)this.moveTo(t.position.x,t.position.y);else{let i=this.points[e-1];this._applyCurveForPoint(t,i)}}let e=this.getLastPoint();if(e?.curveAfter&&(e.curveAfter=void 0),this.isClosed){let e=this.points[0],t=this.points[this.points.length-1];this._applyCurveForPoint(e,t)}if(this.points.length>2){let e=0;for(let i=0,r=this.points.length;i<r;i++){var t;let r=this.points[i],s=this.points[i-1]??this.points[this.points.length-1],a=this.points[i+1]??this.points[0],o=r.roundness,h=s&&a&&wK(s,r)&&wK(r,a)&&wQ(s.position,r.position,a.position);if(!r.controlsMoved()&&o>0&&!h){let s,a=r.curveBefore,h=r.curveAfter;if(void 0===a||void 0===h)continue;let c=r.roundedCurveBefore,d=r.roundedCurveAfter,u=a.getLength(),p=h.getLength(),f=Math.min(Math.min(o,.499*u),Math.min(o,.499*p)),m=1-f/u,g=f/p,v=a.getPointAt(m,w0),y=h.getPointAt(g,w1);if(this._subSplitCurve(a,c,m,v,void 0),this._subSplitCurve(h,d,g,void 0,y),this.useCubicForRoundedCorners){let e=Math.tan(wY(v,r.position,y)/2)*v.distanceTo(r.position),[i,a]=function(e,t,i,r,s){let a=Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2)),o=(e.y+t.y)/2,h=(e.x+t.x)/2,c=Math.sqrt(Math.pow(i,2)-Math.pow(a/2,2))*(e.y-t.y)/a,d=Math.sqrt(Math.pow(i,2)-Math.pow(a/2,2))*(t.x-e.x)/a;return r.set(h+c,o+d),s.set(h-c,o-d),[r,s]}(v,y,e,w2,w3),[o,h]=function(e,t,i,r,s,a){let o=t.x-e.x,h=t.y-e.y,c=i.x-e.x,d=i.y-e.y,u=Math.sqrt((o+c)*(o+c)+(h+d)*(h+d)),p;return wY(t,e,i)>Math.PI&&(u*=-1),p=wX(d,h)?(h+d)*(r/u-.5)*8/3/(o-c):(o+c)*(r/u-.5)*8/3/(d-h),s.set(t.x-p*h,t.y+p*o),a.set(i.x+p*d,i.y-p*c),[s,a]}((t=r.position,i.distanceTo(t)<a.distanceTo(t)?a:i),v,y,e,w4,w5);s=new n6(v.clone(),o.clone(),h.clone(),y.clone())}else s=new oe(v.clone(),r.position.clone(),y.clone());
vendor: 15,125 bytes, line 3139
3139r.roundedCurveCorner=s,this.roundedCurves.splice(i+e,0,s),e++}}}}_subSplitCurve(e,t,i,r,s){if(e instanceof n9)void 0!==r&&t.v2.copy(r),void 0!==s&&t.v1.copy(s);else{let a=e.getUtoTmapping(i,0),o=function(e,t,i,r,s=.5){let a=wF.subVectors(t,e).multiplyScalar(s).add(e),o=wj.subVectors(i,t).multiplyScalar(s).add(t),h=wU.subVectors(r,i).multiplyScalar(s).add(i),c=wV.subVectors(o,a).multiplyScalar(s).add(a),d=wW.subVectors(h,o).multiplyScalar(s).add(o),u=wH.subVectors(d,c).multiplyScalar(s).add(c);return[e.x,e.y,a.x,a.y,c.x,c.y,u.x,u.y,d.x,d.y,h.x,h.y,r.x,r.y]}(e.v0,e.v1,e.v2,e.v3,a);return void 0!==r&&(t.v0.set(o[0],o[1]),t.v1.set(o[2],o[3]),t.v2.set(o[4],o[5]),t.v3.set(o[6],o[7])),void 0!==s&&(t.v0.set(o[6],o[7]),t.v1.set(o[8],o[9]),t.v2.set(o[10],o[11]),t.v3.set(o[12],o[13])),t}return t}clone(){let e=new w6(this._width,this._height);return e.points=this.points.map(e=>e.clone()),e.isClosed=this.isClosed,e.roundness=this.roundness,e.isMesh2D=this.isMesh2D,e.shapeHoles=this.shapeHoles.map(e=>e.clone()),e}toJSON(){return{points:this.points.reduce((e,t)=>e.concat(t.toJSON()),[]),shapeHoles:this.shapeHoles.map(e=>e.toJSON()),isClosed:this.isClosed,roundness:this.roundness}}fromJSON(e){this.points=[],this.pointIDs=0;let t=e.points.length/7;for(let i=0;i<t;i++){let t=7*i,r=e.points[t+0],s=e.points[t+1],a=e.points[t+2],o=e.points[t+3],h=e.points[t+4],c=e.points[t+5],d=e.points[t+6],u=new wB(tQ.generateUUID(),new tZ(r,s));u.controls[0].position.set(a,o),u.controls[1].position.set(h,c),u.roundness=d,this.points.push(u)}return this.shapeHoles=e.shapeHoles?.length?e.shapeHoles.map(e=>{let t=new w6;return t.fromJSON(e),t}):[],this.isClosed=e.isClosed,this._roundness=e.roundness,this._update(),this}fromShape(e,t=!1){this.isText=t;let i=(e,t)=>{t instanceof n6&&t.v3.equals(e.position)&&e.controls[0].position.copy(t.v2)},r=e=>{let t=[],r,s;for(r=0,s=e.length;r<s;r++)e[r]instanceof oe&&(e[r]=function(e){let t=new tZ;t.addVectors(e.v0,wF.subVectors(e.v1,e.v0).multiplyScalar(2/3));let i=new tZ;return i.addVectors(e.v2,wj.subVectors(e.v1,e.v2).multiplyScalar(2/3)),new n6(e.v0,t,i,e.v2)}(e[r]));for(r=0,s=e.length;r<s;r++){let s=e[r],a=r>0?e[r-1]:null,o;s instanceof n6?(o=this.createPoint(s.v0)).controls[1].position.copy(s.v1):s instanceof n9&&(o=this.createPoint(s.v1)),void 0!==o&&(null!==a&&i(o,a),t.push(o))}let a=e[e.length-1],o=!1;return a instanceof n6?a.v3.equals(t[0].position)&&(t[0].controls[0].position.copy(a.v2),o=!0):a instanceof n9&&a.v2.equals(t[0].position)&&(o=!0),this.isClosed=o,t};return this.points=r(e.curves),e instanceof od&&(this.shapeHoles=e.holes.map(e=>{let t=new w6;return t.fromShape(e),t})),this.update(),this}updatePoint(e,t){let i=this.getPointByUuid(e);i&&(void 0!==t.position&&i.position.fromArray(t.position),void 0!==t.roundness&&(i.roundness=t.roundness),void 0!==t.areControlsDirectionsMirrored&&(i.areControlsDirectionsMirrored=t.areControlsDirectionsMirrored),this.needsUpdate=!0)}updatePreviousControl(e,t){let i=this.getPointByUuid(e)?.controls[0];i&&(t.position&&i.position.fromArray(t.position),this.needsUpdate=!0)}updateNextControl(e,t){let i=this.getPointByUuid(e)?.controls[1];i&&(t.position&&i.position.fromArray(t.position),this.needsUpdate=!0)}},w8=2*Math.PI;function w9({x:e,y:t},i,r,s,a){return{x:e*i+s,y:t*r+a}}function w7(e,t,i,r){let s=Math.min(1,Math.max(-1,e*i+t*r));return(e*r-t*i<0?-1:1)*Math.acos(s)}function _e(e,t){if(!e)throw t||"Assertion Failed!"}(SD=SI||(SI={}))[SD.ODD=0]="ODD",SD[SD.NONZERO=1]="NONZERO",SD[SD.POSITIVE=2]="POSITIVE",SD[SD.NEGATIVE=3]="NEGATIVE",SD[SD.ABS_GEQ_TWO=4]="ABS_GEQ_TWO",(SO=SR||(SR={}))[SO.POLYGONS=0]="POLYGONS",SO[SO.CONNECTED_POLYGONS=1]="CONNECTED_POLYGONS",SO[SO.BOUNDARY_CONTOURS=2]="BOUNDARY_CONTOURS";var _t=function(){function e(){}return e.vertEq=function(e,t){return e.s===t.s&&e.t===t.t},e.vertLeq=function(e,t){return e.s<t.s||e.s===t.s&&e.t<=t.t},e.transLeq=function(e,t){return e.t<t.t||e.t===t.t&&e.s<=t.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(e,t){return Math.abs(e.s-t.s)+Math.abs(e.t-t.t)},e.edgeEval=function(t,i,r){_e(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){_e(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){_e(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){_e(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(e,t,i){return e.s*(t.t-i.t)+t.s*(i.t-e.t)+i.s*(e.t-t.t)>=0},e.interpolate=function(e,t,i,r){return(e=e<0?0:e)<=(i=i<0?0:i)?0===i?(t+r)/2:t+e/(e+i)*(r-t):r+i/(e+i)*(t-r)},e.intersect=function(t,i,r,s,a){var o,h,c;e.vertLeq(t,i)||(c=t,t=i,i=c),e.vertLeq(r,s)||(c=r,r=s,s=c),e.vertLeq(t,r)||(c=t,t=r,r=c,c=i,i=s,s=c),e.vertLeq(r,i)?e.vertLeq(i,s)?((o=e.edgeEval(t,r,i))+(h=e.edgeEval(r,i,s))<0&&(o=-o,h=-h),a.s=e.interpolate(o,r.s,h,i.s)):((o=e.edgeSign(t,r,i))+(h=-e.edgeSign(t,s,i))<0&&(o=-o,h=-h),a.s=e.interpolate(o,r.s,h,s.s)):a.s=(r.s+i.s)/2,e.transLeq(t,i)||(c=t,t=i,i=c),e.transLeq(r,s)||(c=r,r=s,s=c),e.transLeq(t,r)||(c=t,t=r,r=c,c=i,i=s,s=c),e.transLeq(r,i)?e.transLeq(i,s)?((o=e.transEval(t,r,i))+(h=e.transEval(r,i,s))<0&&(o=-o,h=-h),a.t=e.interpolate(o,r.t,h,i.t)):((o=e.transSign(t,r,i))+(h=-e.transSign(t,s,i))<0&&(o=-o,h=-h),a.t=e.interpolate(o,r.t,h,s.t)):a.t=(r.t+i.t)/2},e}(),_i=function(){this.next=null,this.prev=null,this.anEdge=null,this.trail=null,this.n=0,this.marked=!1,this.inside=!1},_r=function(){function e(e){this.side=e,this.next=null,this.Org=null,this.Sym=null,this.Onext=null,this.Lnext=null,this.Lface=null,this.activeRegion=null,this.winding=0}return Object.defineProperty(e.prototype,"Rface",{get:function(){return this.Sym.Lface},set:function(e){this.Sym.Lface=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Dst",{get:function(){return this.Sym.Org},set:function(e){this.Sym.Org=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Oprev",{get:function(){return this.Sym.Lnext},set:function(e){this.Sym.Lnext=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Lprev",{get:function(){return this.Onext.Sym},set:function(e){this.Onext.Sym=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Dprev",{get:function(){return this.Lnext.Sym},set:function(e){this.Lnext.Sym=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Rprev",{get:function(){return this.Sym.Onext},set:function(e){this.Sym.Onext=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Dnext",{get:function(){return this.Sym.Onext.Sym},set:function(e){this.Sym.Onext.Sym=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Rnext",{get:function(){return this.Sym.Lnext.Sym},set:function(e){this.Sym.Lnext.Sym=e},enumerable:!0,configurable:!0}),e}(),_s=function(){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},_a=function(){function e(){var e=new _s,t=new _i,i=new _r(0),r=new _r(1);e.next=e.prev=e,e.anEdge=null,t.next=t.prev=t,i.next=i,i.Sym=r,r.next=r,r.Sym=i,this.vHead=e,this.fHead=t,this.eHead=i,this.eHeadSym=r}return e.prototype.makeEdge_=function(e){var t=new _r(0),i=new _r(1);e.Sym.side<e.side&&(e=e.Sym);var r=e.Sym.next;return i.next=r,r.Sym.next=t,t.next=e,e.Sym.next=i,t.Sym=i,t.Onext=t,t.Lnext=i,t.Org=null,t.Lface=null,t.winding=0,t.activeRegion=null,i.Sym=t,i.Onext=i,i.Lnext=t,i.Org=null,i.Lface=null,i.winding=0,i.activeRegion=null,t},e.prototype.splice_=function(e,t){var i=e.Onext,r=t.Onext;i.Sym.Lnext=t,r.Sym.Lnext=e,e.Onext=r,t.Onext=i},e.prototype.makeVertex_=function(e,t,i){_e(e,"Vertex can't be null!");var r=i.prev;e.prev=r,r.next=e,e.next=i,i.prev=e,e.anEdge=t;var s=t;do s.Org=e,s=s.Onext;while(s!==t)},e.prototype.makeFace_=function(e,t,i){_e(e,"Face can't be null");var r=i.prev;e.prev=r,r.next=e,e.next=i,i.prev=e,e.anEdge=t,e.trail=null,e.marked=!1,e.inside=i.inside;var s=t;do s.Lface=e,s=s.Lnext;while(s!==t)},e.prototype.killEdge_=function(e){e.Sym.side<e.side&&(e=e.Sym);var t=e.next,i=e.Sym.next;t.Sym.next=i,i.Sym.next=t},e.prototype.killVertex_=function(e,t){var i=e.anEdge,r=i;do r.Org=t,r=r.Onext;while(r!==i)var s=e.prev,a=e.next;a.prev=s,s.next=a},e.prototype.killFace_=function(e,t){var i=e.anEdge,r=i;do r.Lface=t,r=r.Lnext;while(r!==i)var s=e.prev,a=e.next;a.prev=s,s.next=a},e.prototype.makeEdge=function(){var e=new _s,t=new _s,i=new _i,r=this.makeEdge_(this.eHead);return this.makeVertex_(e,r,this.vHead),this.makeVertex_(t,r.Sym,this.vHead),this.makeFace_(i,r,this.fHead),r},e.prototype.splice=function(e,t){var i=!1,r=!1;if(e!==t){if(t.Org!==e.Org&&(r=!0,this.killVertex_(t.Org,e.Org)),t.Lface!==e.Lface&&(i=!0,this.killFace_(t.Lface,e.Lface)),this.splice_(t,e),!r){var s=new _s;this.makeVertex_(s,t,e.Org),e.Org.anEdge=e}if(!i){var a=new _i;this.makeFace_(a,t,e.Lface),e.Lface.anEdge=e}}},e.prototype.delete=function(e){var t=e.Sym,i=!1;if(e.Lface!==e.Rface&&(i=!0,this.killFace_(e.Lface,e.Rface)),e.Onext===e)this.killVertex_(e.Org,null);else if(e.Rface.anEdge=e.Oprev,e.Org.anEdge=e.Onext,this.splice_(e,e.Oprev),!i){var r=new _i;this.makeFace_(r,e,e.Lface)}t.Onext===t?(this.killVertex_(t.Org,null),this.killFace_(t.Lface,null)):(e.Lface.anEdge=t.Oprev,t.Org.anEdge=t.Onext,this.splice_(t,t.Oprev)),this.killEdge_(e)},e.prototype.addEdgeVertex=function(e){var t=this.makeEdge_(e),i=t.Sym;this.splice_(t,e.Lnext),t.Org=e.Dst;var r=new _s;return this.makeVertex_(r,i,t.Org),t.Lface=i.Lface=e.Lface,t},e.prototype.splitEdge=function(e){var t=this.addEdgeVertex(e).Sym;return this.splice_(e.Sym,e.Sym.Oprev),this.splice_(e.Sym,t),e.Dst=t.Org,t.Dst.anEdge=t.Sym,t.Rface=e.Rface,t.winding=e.winding,t.Sym.winding=e.Sym.winding,t.idx=e.idx,t.Sym.idx=e.Sym.idx,t},e.prototype.connect=function(e,t){var i=!1,r=this.makeEdge_(e),s=r.Sym;if(t.Lface!==e.Lface&&(i=!0,this.killFace_(t.Lface,e.Lface)),this.splice_(r,e.Lnext),this.splice_(s,t),r.Org=e.Dst,s.Org=t.Org,r.Lface=s.Lface=e.Lface,e.Lface.anEdge=s,!i){var a=new _i;this.makeFace_(a,r,e.Lface)}return r},e.prototype.zapFace=function(e){var t,i,r,s,a,o=e.anEdge;i=o.Lnext;do i=(t=i).Lnext,t.Lface=null,null===t.Rface&&(t.Onext===t?this.killVertex_(t.Org,null):(t.Org.anEdge=t.Onext,this.splice_(t,t.Oprev)),(r=t.Sym).Onext===r?this.killVertex_(r.Org,null):(r.Org.anEdge=r.Onext,this.splice_(r,r.Oprev)),this.killEdge_(t));while(t!=o)s=e.prev,(a=e.next).prev=s,s.next=a},e.prototype.countFaceVerts_=function(e){var t=e.anEdge,i=0;do i++,t=t.Lnext;while(t!==e.anEdge)return i},e.prototype.mergeConvexFaces=function(e){var t,i,r,s,a;for(t=this.fHead.next;t!==this.fHead;t=t.next)if(t.inside)for(a=(i=t.anEdge).Org;r=i.Lnext,(s=i.Sym)&&s.Lface&&s.Lface.inside&&this.countFaceVerts_(t)+this.countFaceVerts_(s.Lface)-2<=e&&_t.vertCCW(i.Lprev.Org,i.Org,s.Lnext.Lnext.Org)&&_t.vertCCW(s.Lprev.Org,s.Org,i.Lnext.Lnext.Org)&&(r=s.Lnext,this.delete(s),i=null,s=null),!(i&&i.Lnext.Org===a);)i=r;return!0},e.prototype.check=function(){var e,t,i,r,s,a,o=this.fHead,h=this.vHead,c=this.eHead;for(t=o,t=o;(e=t.next)!==o;t=e){_e(e.prev===t),s=e.anEdge;do _e(s.Sym!==s),_e(s.Sym.Sym===s),_e(s.Lnext.Onext.Sym===s),_e(s.Onext.Sym.Lnext===s),_e(s.Lface===e),s=s.Lnext;while(s!==e.anEdge)}for(_e(e.prev===t&&null===e.anEdge),r=h,r=h;(i=r.next)!==h;r=i){_e(i.prev===r),s=i.anEdge;do _e(s.Sym!==s),_e(s.Sym.Sym===s),_e(s.Lnext.Onext.Sym===s),_e(s.Onext.Sym.Lnext===s),_e(s.Org===i),s=s.Onext;while(s!==i.anEdge)}for(_e(i.prev===r&&null===i.anEdge),a=c,a=c;(s=a.next)!==c;a=s)_e(s.Sym.next===a.Sym),_e(s.Sym!==s),_e(s.Sym.Sym===s),_e(null!==s.Org),_e(null!==s.Dst),_e(s.Lnext.Onext.Sym===s),_e(s.Onext.Sym.Lnext===s);_e(s.Sym.next===a.Sym&&s.Sym===this.eHeadSym&&s.Sym.Sym===s&&null===s.Org&&null===s.Dst&&null===s.Lface&&null===s.Rface)},e}(),_n=function(){this.handle=null},_o=function(){this.key=null,this.node=0},_l=function(){function e(e,t){this.leq=t,this.max=0,this.nodes=[],this.handles=[],this.initialized=!1,this.freeList=0,this.size=0,this.max=e,this.nodes=[],this.handles=[];for(var i=0;i<e+1;i++)this.nodes[i]=new _n,this.handles[i]=new _o;this.initialized=!1,this.nodes[1].handle=1,this.handles[1].key=null}return e.prototype.floatDown_=function(e){var t,i,r,s=this.nodes,a=this.handles;for(t=s[e].handle;;){if((r=e<<1)<this.size&&this.leq(a[s[r+1].handle].key,a[s[r].handle].key)&&++r,_e(r<=this.max),i=s[r].handle,r>this.size||this.leq(a[t].key,a[i].key)){s[e].handle=t,a[t].node=e;break}s[e].handle=i,a[i].node=e,e=r}},e.prototype.floatUp_=function(e){var t,i,r,s=this.nodes,a=this.handles;for(t=s[e].handle;;){if(i=s[r=e>>1].handle,0===r||this.leq(a[i].key,a[t].key)){s[e].handle=t,a[t].node=e;break}s[e].handle=i,a[i].node=e,e=r}},e.prototype.init=function(){for(var e=this.size;e>=1;--e)this.floatDown_(e);this.initialized=!0},e.prototype.min=function(){return this.handles[this.nodes[1].handle].key},e.prototype.insert=function(e){var t,i,r,s;if(2*(t=++this.size)>this.max){for(this.max*=2,s=this.nodes.length,this.nodes.length=this.max+1,r=s;r<this.nodes.length;r++)this.nodes[r]=new _n;for(s=this.handles.length,this.handles.length=this.max+1,r=s;r<this.handles.length;r++)this.handles[r]=new _o}return 0===this.freeList?i=t:(i=this.freeList,this.freeList=this.handles[i].node),this.nodes[t].handle=i,this.handles[i].node=t,this.handles[i].key=e,this.initialized&&this.floatUp_(t),i},e.prototype.extractMin=function(){var e=this.nodes,t=this.handles,i=e[1].handle,r=t[i].key;return this.size>0&&(e[1].handle=e[this.size].handle,t[e[1].handle].node=1,t[i].key=null,t[i].node=this.freeList,this.freeList=i,--this.size,this.size>0&&this.floatDown_(1)),r},e.prototype.delete=function(e){var t,i=this.nodes,r=this.handles;_e(e>=1&&e<=this.max&&null!==r[e].key),i[t=r[e].node].handle=i[this.size].handle,r[i[t].handle].node=t,--this.size,t<=this.size&&(t<=1||this.leq(r[i[t>>1].handle].key,r[i[t].handle].key)?this.floatDown_(t):this.floatUp_(t)),r[e].key=null,r[e].node=this.freeList,this.freeList=e},e}(),_h=function(){this.eUp=null,this.nodeUp=null,this.windingNumber=0,this.inside=!1,this.sentinel=!1,this.dirty=!1,this.fixUpperEdge=!1},_c=function(){this.key=null,this.next=null,this.prev=null},_d=function(){function e(e,t){this.frame=e,this.leq=t,this.head=new _c,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(e){return this.insertBefore(this.head,e)},e.prototype.search=function(e){var t=this.head;do t=t.next;while(null!==t.key&&!this.leq(this.frame,e,t.key))return t},e.prototype.insertBefore=function(e,t){do e=e.prev;while(null!==e.key&&!this.leq(this.frame,e.key,t))var i=new _c;return i.key=t,i.next=e.next,e.next.prev=i,i.prev=e,e.next=i,i},e.prototype.delete=function(e){e.next.prev=e.prev,e.prev.next=e.next},e}(),_u=function(){function e(){}
vendor: 4,302 bytes, line 3139
3139return e.regionBelow=function(e){return e.nodeUp.prev.key},e.regionAbove=function(e){return e.nodeUp.next.key},e.debugEvent=function(e){},e.addWinding=function(e,t){e.winding+=t.winding,e.Sym.winding+=t.Sym.winding},e.edgeLeq=function(e,t,i){var r=e.event,s=t.eUp,a=i.eUp;return s.Dst===r?a.Dst===r?_t.vertLeq(s.Org,a.Org)?0>=_t.edgeSign(a.Dst,s.Org,a.Org):_t.edgeSign(s.Dst,a.Org,s.Org)>=0:0>=_t.edgeSign(a.Dst,r,a.Org):a.Dst===r?_t.edgeSign(s.Dst,r,s.Org)>=0:_t.edgeEval(s.Dst,r,s.Org)>=_t.edgeEval(a.Dst,r,a.Org)},e.deleteRegion=function(e,t){t.fixUpperEdge&&_e(0===t.eUp.winding),t.eUp.activeRegion=null,e.dict.delete(t.nodeUp)},e.fixUpperEdge=function(e,t,i){_e(t.fixUpperEdge),e.mesh.delete(t.eUp),t.fixUpperEdge=!1,t.eUp=i,i.activeRegion=t},e.topLeftRegion=function(t,i){var r,s=i.eUp.Org;do i=e.regionAbove(i);while(i.eUp.Org===s)if(i.fixUpperEdge){if(null===(r=t.mesh.connect(e.regionBelow(i).eUp.Sym,i.eUp.Lnext)))return null;e.fixUpperEdge(t,i,r),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(e,t,i){var r=new _h;return r.eUp=i,r.nodeUp=e.dict.insertBefore(t.nodeUp,r),r.fixUpperEdge=!1,r.sentinel=!1,r.dirty=!1,i.activeRegion=r,r},e.isWindingInside=function(e,t){switch(e.windingRule){case SI.ODD:return(1&t)!=0;case SI.NONZERO:return 0!==t;case SI.POSITIVE:return t>0;case SI.NEGATIVE:return t<0;case SI.ABS_GEQ_TWO:return t>=2||t<=-2}throw 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,o=i,h=i.eUp;o!==r;){if(o.fixUpperEdge=!1,(s=(a=e.regionBelow(o)).eUp).Org!=h.Org){if(!a.fixUpperEdge){e.finishRegion(t,o);break}s=t.mesh.connect(h.Lprev,s.Sym),e.fixUpperEdge(t,a,s)}h.Onext!==s&&(t.mesh.splice(s.Oprev,s),t.mesh.splice(h,s)),e.finishRegion(t,o),h=a.eUp,o=a}return h},e.addRightEdges=function(t,i,r,s,a,o){var h,c,d,u,p=!0;d=r;do _e(_t.vertLeq(d.Org,d.Dst)),e.addRegionBelow(t,i,d.Sym),d=d.Onext;while(d!==s)for(null===a&&(a=e.regionBelow(i).eUp.Rprev),c=i,u=a;(d=(h=e.regionBelow(c)).eUp.Sym).Org===u.Org;)d.Onext!==u&&(t.mesh.splice(d.Oprev,d),t.mesh.splice(u.Oprev,d)),h.windingNumber=c.windingNumber-d.winding,h.inside=e.isWindingInside(t,h.windingNumber),c.dirty=!0,!p&&e.checkForRightSplice(t,c)&&(e.addWinding(d,u),e.deleteRegion(t,c),t.mesh.delete(u)),p=!1,c=h,u=d;c.dirty=!0,_e(c.windingNumber-d.winding===h.windingNumber),o&&e.walkDirtyRegions(t,c)},e.spliceMergeVertices=function(e,t,i){e.mesh.splice(t,i)},e.vertexWeights=function(e,t,i){var r=_t.vertL1dist(t,e),s=_t.vertL1dist(i,e),a=.5*s/(r+s),o=.5*r/(r+s);e.coords[0]+=a*t.coords[0]+o*i.coords[0],e.coords[1]+=a*t.coords[1]+o*i.coords[1],e.coords[2]+=a*t.coords[2]+o*i.coords[2]},e.getIntersectData=function(t,i,r,s,a,o){i.coords[0]=i.coords[1]=i.coords[2]=0,i.idx=-1,e.vertexWeights(i,r,s),e.vertexWeights(i,a,o)},e.checkForRightSplice=function(t,i){var r=e.regionBelow(i),s=i.eUp,a=r.eUp;if(_t.vertLeq(s.Org,a.Org)){if(_t.edgeSign(a.Dst,s.Org,a.Org)>0)return!1;_t.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(0>_t.edgeSign(s.Dst,a.Org,s.Org))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,s=e.regionBelow(i),a=i.eUp,o=s.eUp;if(_e(!_t.vertEq(a.Dst,o.Dst)),_t.vertLeq(a.Dst,o.Dst)){if(0>_t.edgeSign(a.Dst,o.Dst,a.Org))return!1;e.regionAbove(i).dirty=i.dirty=!0,r=t.mesh.splitEdge(a),t.mesh.splice(o.Sym,r),r.Lface.inside=i.inside}else{if(_t.edgeSign(o.Dst,a.Dst,o.Org)>0)return!1;i.dirty=s.dirty=!0,r=t.mesh.splitEdge(o),t.mesh.splice(a.Lnext,o.Sym),r.Rface.inside=i.inside}return!0},e.checkForIntersect=function(t,i){var r,s,a=e.regionBelow(i),o=i.eUp,h=a.eUp,c=o.Org,d=h.Org,u=o.Dst,p=h.Dst,f=new _s;if(_e(!_t.vertEq(p,u)),_e(0>=_t.edgeSign(u,t.event,c)),_e(_t.edgeSign(p,t.event,d)>=0),_e(c!==t.event&&d!==t.event),_e(!i.fixUpperEdge&&!a.fixUpperEdge),c===d||Math.min(c.t,u.t)>Math.max(d.t,p.t))return!1;
3139if(_t.vertLeq(c,d)){if(_t.edgeSign(p,c,d)>0)return!1}else if(0>_t.edgeSign(u,d,c))return!1;return e.debugEvent(t),_t.intersect(u,c,p,d,f),_e(Math.min(c.t,u.t)<=f.t),_e(f.t<=Math.max(d.t,p.t)),_e(Math.min(p.s,u.s)<=f.s),_e(f.s<=Math.max(d.s,c.s)),_t.vertLeq(f,t.event)&&(f.s=t.event.s,f.t=t.event.t),r=_t.vertLeq(c,d)?c:d,_t.vertLeq(r,f)&&(f.s=r.s,f.t=r.t),_t.vertEq(f,c)||_t.vertEq(f,d)?(e.checkForRightSplice(t,i),!1):!_t.vertEq(u,t.event)&&_t.edgeSign(u,t.event,f)>=0||!_t.vertEq(p,t.event)&&0>=_t.edgeSign(p,t.event,f)?p===t.event?(t.mesh.splitEdge(o.Sym),t.mesh.splice(h.Sym,o),i=e.topLeftRegion(t,i),o=e.regionBelow(i).eUp,e.finishLeftRegions(t,e.regionBelow(i),a),e.addRightEdges(t,i,o.Oprev,o,o,!0),!0):u===t.event?(t.mesh.splitEdge(h.Sym),t.mesh.splice(o.Lnext,h.Oprev),a=i,i=e.topRightRegion(i),s=e.regionBelow(i).eUp.Rprev,a.eUp=h.Oprev,h=e.finishLeftRegions(t,a,null),e.addRightEdges(t,i,h.Onext,o.Rprev,s,!0),!0):(_t.edgeSign(u,t.event,f)>=0&&(e.regionAbove(i).dirty=i.dirty=!0,t.mesh.splitEdge(o.Sym),o.Org.s=t.event.s,o.Org.t=t.event.t),0>=_t.edgeSign(p,t.event,f)&&(i.dirty=a.dirty=!0,t.mesh.splitEdge(h.Sym),h.Org.s=t.event.s,h.Org.t=t.event.t),!1):(t.mesh.splitEdge(o.Sym),t.mesh.splitEdge(h.Sym),t.mesh.splice(h.Oprev,o),o.Org.s=f.s,o.Org.t=f.t,o.Org.pqHandle=t.pq.insert(o.Org),e.getIntersectData(t,o.Org,c,u,d,p),e.regionAbove(i).dirty=i.dirty=a.dirty=!0,!1)},e.walkDirtyRegions=function(t,i){for(var r,s,a=e.regionBelow(i);;){for(;a.dirty;)i=a,a=e.regionBelow(a);if(!i.dirty&&(a=i,null===(i=e.regionAbove(i))||!i.dirty))return;if(i.dirty=!1,r=i.eUp,s=a.eUp,r.Dst!==s.Dst&&e.checkForLeftSplice(t,i)&&(a.fixUpperEdge?(e.deleteRegion(t,a),t.mesh.delete(s),s=(a=e.regionBelow(i)).eUp):i.fixUpperEdge&&(e.deleteRegion(t,i),t.mesh.delete(r),r=(i=e.regionAbove(a)).eUp)),r.Org!==s.Org){if(r.Dst===s.Dst||i.fixUpperEdge||a.fixUpperEdge||r.Dst!==t.event&&s.Dst!==t.event)e.checkForRightSplice(t,i);else if(e.checkForIntersect(t,i))return}r.Org===s.Org&&r.Dst===s.Dst&&(e.addWinding(s,r),e.deleteRegion(t,i),t.mesh.delete(r),i=e.regionAbove(a))}},e.connectRightVertex=function(t,i,r){var s,a=r.Onext,o=e.regionBelow(i),h=i.eUp,c=o.eUp,d=!1;(h.Dst!==c.Dst&&e.checkForIntersect(t,i),_t.vertEq(h.Org,t.event)&&(t.mesh.splice(a.Oprev,h),i=e.topLeftRegion(t,i),a=e.regionBelow(i).eUp,e.finishLeftRegions(t,e.regionBelow(i),o),d=!0),_t.vertEq(c.Org,t.event)&&(t.mesh.splice(r,c.Oprev),r=e.finishLeftRegions(t,o,null),d=!0),d)?e.addRightEdges(t,i,r.Onext,a,a,!0):(s=_t.vertLeq(c.Org,h.Org)?c.Oprev:h,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,o,h,c;if(s=i.eUp,_t.vertEq(s.Org,r)){_e(!1),e.spliceMergeVertices(t,s,r.anEdge);return}if(!_t.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}_e(!1),i=e.topRightRegion(i),a=h=(o=(c=e.regionBelow(i)).eUp.Sym).Onext,c.fixUpperEdge&&(_e(a!==o),e.deleteRegion(t,c),t.mesh.delete(o),o=a.Oprev),t.mesh.splice(r.anEdge,o),_t.edgeGoesLeft(a)||(a=null),e.addRightEdges(t,i,o.Onext,h,a,!0)},e.connectLeftVertex=function(t,i){var r,s,a,o,h,c,d=new _h;if(d.eUp=i.anEdge.Sym,r=t.dict.search(d).key,s=e.regionBelow(r)){if(o=r.eUp,h=s.eUp,0===_t.edgeSign(o.Dst,i,o.Org))return void e.connectLeftDegenerate(t,r,i);(a=_t.vertLeq(h.Dst,o.Dst)?r:s,r.inside||a.fixUpperEdge)?(c=a===r?t.mesh.connect(i.anEdge.Sym,o.Lnext):t.mesh.connect(h.Dnext,i.anEdge).Sym,a.fixUpperEdge?e.fixUpperEdge(t,a,c):e.computeWinding(t,e.addRegionBelow(t,r,c)),e.sweepEvent(t,i)):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;null===r.activeRegion;)if((r=r.Onext)===i.anEdge)return void e.connectLeftVertex(t,i);var s=e.topLeftRegion(t,r.activeRegion);_e(null!==s);var a=e.regionBelow(s),o=a.eUp,h=e.finishLeftRegions(t,a,null);h.Onext===o?e.connectRightVertex(t,s,h):e.addRightEdges(t,s,h.Onext,o,o,!0)},e.addSentinel=function(e,t,i,r){var s=new _h,a=e.mesh.makeEdge();a.Org.s=i,a.Org.t=r,a.Dst.s=t,a.Dst.t=r,e.event=a.Dst,s.eUp=a,s.windingNumber=0,s.inside=!1,s.fixUpperEdge=!1,s.sentinel=!0,s.dirty=!1,s.nodeUp=e.dict.insert(s)},e.initEdgeDict=function(t){t.dict=new _d(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,o=t.bmin[1]-r,h=t.bmax[1]+r;e.addSentinel(t,s,a,o),e.addSentinel(t,s,a,h)},e.doneEdgeDict=function(t){for(var i,r=0;null!==(i=t.dict.min().key);)i.sentinel||(_e(i.fixUpperEdge),_e(1==++r)),_e(0===i.windingNumber),e.deleteRegion(t,i)},e.removeDegenerateEdges=function(t){var i,r,s,a=t.mesh.eHead;for(i=a.next;i!==a;
vendor: 4,340 bytes, line 3139
3139i=r)r=i.next,s=i.Lnext,_t.vertEq(i.Org,i.Dst)&&i.Lnext.Lnext!==i&&(e.spliceMergeVertices(t,s,i),t.mesh.delete(i),s=(i=s).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(e){var t,i,r,s=0;for(i=(r=e.mesh.vHead).next;i!==r;i=i.next)s++;for(s+=8,t=e.pq=new _l(s,_t.vertLeq),i=(r=e.mesh.vHead).next;i!==r;i=i.next)i.pqHandle=t.insert(i);return i===r&&(t.init(),!0)},e.donePriorityQ=function(e){e.pq=null},e.removeDegenerateFaces=function(t,i){var r,s,a;for(r=i.fHead.next;r!==i.fHead;r=s)s=r.next,_e((a=r.anEdge).Lnext!==a),a.Lnext.Lnext===a&&(e.addWinding(a.Onext,a),t.mesh.delete(a));return!0},e.computeInterior=function(t,i){var r,s;if(void 0===i&&(i=!0),e.removeDegenerateEdges(t),!e.initPriorityQ(t))return!1;for(e.initEdgeDict(t);null!==(r=t.pq.extractMin());){for(;!(null===(s=t.pq.min())||!_t.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)},e}(),_p=function(){function e(){this.mesh=new _a,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=SI.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(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]},e.prototype.normalize_=function(e){var t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2];if(!t)throw"Zero-size vector!";t=Math.sqrt(t),e[0]/=t,e[1]/=t,e[2]/=t},e.prototype.longAxis_=function(e){var t=0;return Math.abs(e[1])>Math.abs(e[0])&&(t=1),Math.abs(e[2])>Math.abs(e[t])&&(t=2),t},e.prototype.computeNormal_=function(e){var t,i,r,s,a,o,h=[0,0,0],c=[0,0,0],d=[0,0,0],u=[0,0,0],p=[0,0,0],f=[null,null,null],m=[null,null,null],g=this.mesh.vHead;t=g.next;for(var v=0;v<3;++v)s=t.coords[v],c[v]=s,m[v]=t,h[v]=s,f[v]=t;for(t=g.next;t!==g;t=t.next)for(var y=0;y<3;++y)(s=t.coords[y])<c[y]&&(c[y]=s,m[y]=t),s>h[y]&&(h[y]=s,f[y]=t);var x=0;if(h[1]-c[1]>h[0]-c[0]&&(x=1),h[2]-c[2]>h[x]-c[x]&&(x=2),c[x]>=h[x]){e[0]=0,e[1]=0,e[2]=1;return}for(o=0,i=m[x],r=f[x],d[0]=i.coords[0]-r.coords[0],d[1]=i.coords[1]-r.coords[1],d[2]=i.coords[2]-r.coords[2],t=g.next;t!==g;t=t.next)u[0]=t.coords[0]-r.coords[0],u[1]=t.coords[1]-r.coords[1],u[2]=t.coords[2]-r.coords[2],p[0]=d[1]*u[2]-d[2]*u[1],p[1]=d[2]*u[0]-d[0]*u[2],p[2]=d[0]*u[1]-d[1]*u[0],(a=p[0]*p[0]+p[1]*p[1]+p[2]*p[2])>o&&(o=a,e[0]=p[0],e[1]=p[1],e[2]=p[2]);o<=0&&(e[0]=e[1]=e[2]=0,e[this.longAxis_(d)]=1)},e.prototype.checkOrientation_=function(){for(var e,t,i=this.mesh.fHead,r=this.mesh.vHead,s=0,a=i.next;a!==i;a=a.next)if(!((t=a.anEdge).winding<=0))do s+=(t.Org.s-t.Dst.s)*(t.Org.t+t.Dst.t),t=t.Lnext;while(t!==a.anEdge)if(s<0){for(e=r.next;e!==r;e=e.next)e.t=-e.t;this.tUnit[0]=-this.tUnit[0],this.tUnit[1]=-this.tUnit[1],this.tUnit[2]=-this.tUnit[2]}},e.prototype.projectPolygon_=function(){var e,t,i=this.mesh.vHead,r=[0,0,0],s=!1;r[0]=this.normal[0],r[1]=this.normal[1],r[2]=this.normal[2],r[0]||r[1]||r[2]||(this.computeNormal_(r),s=!0),e=this.sUnit,t=this.tUnit;var a=this.longAxis_(r);e[a]=0,e[(a+1)%3]=1,e[(a+2)%3]=0,t[a]=0,t[(a+1)%3]=0,t[(a+2)%3]=r[a]>0?1:-1;for(var o=i.next;o!==i;o=o.next)o.s=this.dot_(o.coords,e),o.t=this.dot_(o.coords,t);s&&this.checkOrientation_();for(var h=!0,c=i.next;c!==i;c=c.next)h?(this.bmin[0]=this.bmax[0]=c.s,this.bmin[1]=this.bmax[1]=c.t,h=!1):(c.s<this.bmin[0]&&(this.bmin[0]=c.s),c.s>this.bmax[0]&&(this.bmax[0]=c.s),c.t<this.bmin[1]&&(this.bmin[1]=c.t),c.t>this.bmax[1]&&(this.bmax[1]=c.t))},e.prototype.addWinding_=function(e,t){e.winding+=t.winding,e.Sym.winding+=t.Sym.winding},e.prototype.tessellateMonoRegion_=function(e,t){var i,r;if((i=t.anEdge).Lnext===i||i.Lnext.Lnext===i)throw"Mono region invalid";for(;_t.vertLeq(i.Dst,i.Org);i=i.Lprev);for(;_t.vertLeq(i.Org,i.Dst);i=i.Lnext);r=i.Lprev;for(var s=void 0;i.Lnext!==r;)if(_t.vertLeq(i.Dst,r.Org)){for(;r.Lnext!==i&&(_t.edgeGoesLeft(r.Lnext)||0>=_t.edgeSign(r.Org,r.Dst,r.Lnext.Dst));)r=e.connect(r.Lnext,r).Sym;r=r.Lprev}else{for(;r.Lnext!==i&&(_t.edgeGoesRight(i.Lprev)||_t.edgeSign(i.Dst,i.Org,i.Lprev.Org)>=0);)i=e.connect(i,i.Lprev).Sym;i=i.Lnext}
3139if(r.Lnext===i)throw"Mono region invalid";for(;r.Lnext.Lnext!==i;)r=e.connect(r.Lnext,r).Sym;return!0},e.prototype.tessellateInterior_=function(e){for(var t,i=e.fHead.next;i!==e.fHead;i=t)if(t=i.next,i.inside&&!this.tessellateMonoRegion_(e,i))return!1;return!0},e.prototype.discardExterior_=function(e){for(var t,i=e.fHead.next;i!==e.fHead;i=t)t=i.next,i.inside||e.zapFace(i)},e.prototype.setWindingNumber_=function(e,t,i){for(var r,s=e.eHead.next;s!==e.eHead;s=r)r=s.next,s.Rface.inside!==s.Lface.inside?s.winding=s.Lface.inside?t:-t:i?e.delete(s):s.winding=0},e.prototype.getNeighbourFace_=function(e){return e.Rface&&e.Rface.inside?e.Rface.n:-1},e.prototype.outputPolymesh_=function(e,t,i,r){var s,a,o=0,h=0;i>3&&e.mergeConvexFaces(i);for(var c=e.vHead.next;c!==e.vHead;c=c.next)c.n=-1;for(var d=e.fHead.next;d!==e.fHead;d=d.next)if(d.n=-1,d.inside){s=d.anEdge,a=0;do{var c=s.Org;-1===c.n&&(c.n=h,h++),a++,s=s.Lnext}while(s!==d.anEdge)if(a>i)throw"Face vertex greater that support polygon";d.n=o,++o}this.elementCount=o,t===SR.CONNECTED_POLYGONS&&(o*=2),this.elements=[],this.elements.length=o*i,this.vertexCount=h,this.vertices=[],this.vertices.length=h*r,this.vertexIndices=[],this.vertexIndices.length=h;for(var c=e.vHead.next;c!==e.vHead;c=c.next)if(-1!==c.n){var u=c.n*r;this.vertices[u+0]=c.coords[0],this.vertices[u+1]=c.coords[1],r>2&&(this.vertices[u+2]=c.coords[2]),this.vertexIndices[c.n]=c.idx}for(var p=0,d=e.fHead.next;d!==e.fHead;d=d.next)if(d.inside){s=d.anEdge,a=0;do{var c=s.Org;this.elements[p++]=c.n,a++,s=s.Lnext}while(s!==d.anEdge)for(var f=a;f<i;++f)this.elements[p++]=-1;if(t===SR.CONNECTED_POLYGONS){s=d.anEdge;do this.elements[p++]=this.getNeighbourFace_(s),s=s.Lnext;while(s!==d.anEdge)for(var m=a;m<i;++m)this.elements[p++]=-1}}},e.prototype.outputContours_=function(e,t){var i,r,s=0,a=0;this.vertexCount=0,this.elementCount=0;for(var o=e.fHead.next;o!==e.fHead;o=o.next)if(o.inside){r=i=o.anEdge;do this.vertexCount++,i=i.Lnext;while(i!==r)this.elementCount++}this.elements=[],this.elements.length=2*this.elementCount,this.vertices=[],this.vertices.length=this.vertexCount*t,this.vertexIndices=[],this.vertexIndices.length=this.vertexCount;var h=0,c=0,d=0;s=0;for(var o=e.fHead.next;o!==e.fHead;o=o.next)if(o.inside){a=0,r=i=o.anEdge;do this.vertices[h++]=i.Org.coords[0],this.vertices[h++]=i.Org.coords[1],t>2&&(this.vertices[h++]=i.Org.coords[2]),this.vertexIndices[c++]=this.vertexIdCallback?this.vertexIdCallback(i):i.Org.idx,a++,i=i.Lnext;while(i!==r)this.elements[d++]=s,this.elements[d++]=a,s+=a}},e.prototype.addContour=function(e,t){null===this.mesh&&(this.mesh=new _a),e<2&&(e=2),e>3&&(e=3);for(var i=null,r=0;r<t.length;r+=e)null===i?(i=this.mesh.makeEdge(),this.mesh.splice(i,i.Sym)):(this.mesh.splitEdge(i),i=i.Lnext),i.Org.coords[0]=t[r+0],i.Org.coords[1]=t[r+1],e>2?i.Org.coords[2]=t[r+2]:i.Org.coords[2]=0,i.Org.idx=this.vertexIndexCounter++,this.edgeCreateCallback&&this.edgeCreateCallback(i),i.winding=1,i.Sym.winding=-1},e.prototype.tesselate=function(e,t,i,r,s,a){if(void 0===e&&(e=SI.ODD),void 0===t&&(t=SR.POLYGONS),void 0===a&&(a=!0),this.vertices=[],this.elements=[],this.vertexIndices=[],this.vertexIndexCounter=0,s&&(this.normal[0]=s[0],this.normal[1]=s[1],this.normal[2]=s[2]),this.windingRule=e,r<2&&(r=2),r>3&&(r=3),!this.mesh)return!1;this.projectPolygon_(),_u.computeInterior(this,a);var o=this.mesh;return t===SR.BOUNDARY_CONTOURS?this.setWindingNumber_(o,1,!0):this.tessellateInterior_(o),a&&o.check(),t===SR.BOUNDARY_CONTOURS?this.outputContours_(o,r):this.outputPolymesh_(o,t,i,r),!0},e}();function _f(e){var t=e.windingRule,i=void 0===t?SI.ODD:t,r=e.elementType,s=void 0===r?SR.POLYGONS:r,a=e.polySize,o=e.vertexSize,h=void 0===o?2:o,c=e.normal,d=e.contours,u=void 0===d?[]:d,p=e.strict,f=void 0===p||p,m=e.debug;if(!u&&f)throw Error("Contours can't be empty");if(u){var g=new _p;e.edgeCreateCallback&&(g.edgeCreateCallback=e.edgeCreateCallback),e.vertexIdCallback&&(g.vertexIdCallback=e.vertexIdCallback);for(var v=0;v<u.length;v++)g.addContour(h||2,u[v]);return g.tesselate(i,s,void 0===a?3:a,h,void 0===c?[0,0,1]:c,f),{vertices:g.vertices,vertexIndices:g.vertexIndices,vertexCount:g.vertexCount,elements:g.elements,elementCount:g.elementCount,mesh:void 0!==m&&m?g.mesh:void 0}}}SI.ODD,SI.NONZERO,SI.POSITIVE,SI.NEGATIVE,SI.ABS_GEQ_TWO,SR.POLYGONS,SR.CONNECTED_POLYGONS,SR.BOUNDARY_CONTOURS;var _m=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*_m.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} \u2192 ${e}`);let i=new ArrayBuffer(e*_m.eSize),r=Float32Array.BYTES_PER_ELEMENT,s=0,a=new Float32Array(i,0*r,3*e),o=new Float32Array(i,(s+=3*e)*r,3*e),h=new Float32Array(i,(s+=3*e)*r,2*e);t?(a.set(this.positions.subarray(0,3*this.size)),o.set(this.normals.subarray(0,3*this.size)),h.set(this.uvs.subarray(0,2*this.size))):(a.set(this.positions),o.set(this.normals),h.set(this.uvs)),this.buffer=i,this.positions=a,this.normals=o,this.uvs=h,this.capacity=e}get(e=1){let t=this.size+e;if(t>this.capacity){let e=this.capacity;for(;t>e;)e*=2;this.realloc(e)}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} \u2192 ${this.size}`),this.realloc(this.size,!0)}};_m.eSize=8*Float32Array.BYTES_PER_ELEMENT;var _g=class{constructor(e=[],t=(e,t)=>e<t?-1:+(e>t)){if(this.data=e,this.length=this.data.length,this.compare=t,this.length>0)for(let e=(this.length>>1)-1;e>=0;e--)this._down(e)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(0===this.length)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 r=(e<<1)+1,a=r+1;if(a<this.length&&0>i(t[a],t[r])&&(r=a),i(t[r],s)>=0)break;t[e]=t[r],e=r}t[e]=s}};function _v(e,t,i,r){this.x=e,this.y=t,this.h=i,this.d=function(e,t,i){let r=!1,s=1/0;for(let a of i)for(let i=0,o=a.length,h=o-1;i<o;h=i++){let o=a[i],c=a[h];o[1]>t!=c[1]>t&&e<(c[0]-o[0])*(t-o[1])/(c[1]-o[1])+o[0]&&(r=!r),s=Math.min(s,function(e,t,i,r){let s=i[0],a=i[1],o=r[0]-s,h=r[1]-a;if(0!==o||0!==h){let i=((e-s)*o+(t-a)*h)/(o*o+h*h);i>1?(s=r[0],a=r[1]):i>0&&(s+=o*i,a+=h*i)}return(o=e-s)*o+(h=t-a)*h}(e,t,o,c))}return 0===s?0:(r?1:-1)*Math.sqrt(s)}(e,t,r),this.max=this.d+this.h*Math.SQRT2}var _y={vertices:[160,160,-160,160,-160,-160,160,-160],vertexIndices:[1,0,3,2],vertexCount:4,elements:[0,4],elementCount:1,mesh:void 0},_x={vertices:[],vertexIndices:[],vertexCount:0,elements:[],elementCount:0,mesh:void 0},_b={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},_w=(e,t)=>([i,r])=>(r<i&&(r+=t),(e>=i?e:e+t)<=r),__=class extends rz{constructor(e,t,i=0,r=12,s=3,a=SI.ODD,o=!1){let h,c,d;super(),this.forPathBevel=o,this.type="ShapeGeometry",this.vertexCache={},this._shape=e,this._depth=t,this._curveSegments=r,this._bevelSegmentsInput=s;let u=this._shape.extractShapePointsToFlatArray([],r),p=this._shape.shapeHoles.map(e=>{let t=e.extractShapePointsToFlatArray([],r),i=[];for(let e=t.length-1;e>=1;e-=2){let r=t[e-1],s=t[e-0];i.push(r,s)}return i}),f=[],m=[];for(let e=0;e<u.length;e+=2)m.push([u[e],u[e+1]]);f.push(m);for(let e=0;e<p.length;e++){let t=p[e],i=[];for(let e=0;e<t.length;e+=2)i.push([t[e],t[e+1]]);f.push(i)}h=e.isText?.1*new lB().setFromPoints(e.points.map(e=>e.position)).getSize(new tZ).length():0===f[0].length?i:i>0?function(e,t,i=1,r=!1){let s=1/0,a=1/0,o=-1/0,h=-1/0;for(let[t,i]of e[0])t<s&&(s=t),i<a&&(a=i),t>o&&(o=t),i>h&&(h=i);
3139let c=o-s,d=h-a,u=Math.max(i,Math.min(c,d));if(u===i){let e=[s,a];return e.distance=0,e.distance}let p=new _g([],(e,t)=>t.max-e.max),f=function(e){let t=0,i=0,r=0,s=e[0];for(let e=0,a=s.length,o=a-1;e<a;o=e++){let a=s[e],h=s[o],c=a[0]*h[1]-h[0]*a[1];i+=(a[0]+h[0])*c,r+=(a[1]+h[1])*c,t+=3*c}let a=new _v(i/t,r/t,0,e);return 0===t||a.d<0?new _v(s[0][0],s[0][1],0,e):a}(e),m=new _v(s+c/2,a+d/2,0,e);m.d>f.d&&(f=m);let g=2;function v(s,a,o){let h=new _v(s,a,o,e);if(g++,h.max>f.d+i&&p.push(h),h.d>f.d&&(f=h,r&&console.log(`found best ${Math.round(1e4*h.d)/1e4} after ${g} probes`),f.d>t))return t}let y=u/2;for(let e=s;e<o;e+=u)for(let t=a;t<h;t+=u)v(e+y,t+y,y);for(;p.length;){let{max:e,x:t,y:r,h:s}=p.pop();if(e-f.d<=i)break;v(t-(y=s/2),r-y,y),v(t+y,r-y,y),v(t-y,r+y,y),v(t+y,r+y,y)}r&&console.log(`num probes: ${g}
3140best distance: ${f.d}`);let x=[f.x,f.y];return x.distance=f.d,x.distance}(f,i):1e-5,i<=0?(this._bevel=0,this._bevelSegments=0):(this._bevel=Math.min(i,h,t/2),this._bevelSegments=Math.floor(s));try{c=_f({windingRule:a,elementType:SR.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[u]})}catch{c=_y}try{d=_f({windingRule:SI.ODD,elementType:SR.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[...p]})}catch{d=_x}if(!c)throw Error("error generating geometry");let g=c.elementCount;if(d){c.elementCount+=d.elementCount;for(let e=0;e<d.elements.length;e++){let t=d.elements[e],i=e%2==0?c.vertexCount:0;c.elements.push(t+i)}for(let e=0;e<d.vertexIndices.length;e++){let t=d.vertexIndices[e],i=c.vertexCount;c.vertexIndices.push(t+i)}for(let e=0;e<d.vertices.length;e++){let t=d.vertices[e];c.vertices.push(t)}}let v=1/0,y=-1/0,x=1/0,b=-1/0;for(let e=0,t=c.vertexCount;e<t;e++){let t=2*e,i=c.vertices[t+0],r=c.vertices[t+1];i<v&&(v=i),i>y&&(y=i),r<x&&(x=r),r>b&&(b=r)}this._minX=v,this._minY=x,this._width=y-v,this._height=b-x,this._buffer=new _m(this._computeBufferEstimatedSize(c));let w=[],_=[];for(let e=c.elementCount-1;e>=0;e--){let t=e>=g,i=2*e,s=c.elements[i+0],a=c.elements[i+1],d=s+a,u={start:s,count:a,normals:[],continuous:[],concave:[]},f=s,m=d-1,v=s+1,y=this._shape.roundedCurves.length;do{let e=f-s,i=c.vertices[2*m+0],r=c.vertices[2*m+1],o=c.vertices[2*f+0],h=c.vertices[2*f+1],p=c.vertices[2*v+0],g=c.vertices[2*v+1],x=o-i,b=h-r,w=Math.sqrt(x*x+b*b);x/=w,b/=w;let _=o-p,S=h-g,C=Math.sqrt(_*_+S*S);_/=C,S/=C,u.normals[2*e+0]=-S,u.normals[2*e+1]=_,u.concave[e]=x*S-b*_>0;let M=c.vertexIndices[f];if(Array.isArray(M))u.continuous[e]=!1;else{let[t,i]=this._shape.getCurveIndexFromVertexId(M-1,!0);if(i>0&&i<1)u.continuous[e]=!0;else{let r=1===i?t+1:t-1;r=(r+y)%y;let s=+(1!==i),a=this._shape.roundedCurves[t].getTangent(i),o=this._shape.roundedCurves[r].getTangent(s);u.continuous[e]=a.dot(o)>.95}}t&&(u.normals[2*e+0]*=-1,u.normals[2*e+1]*=-1),[m,f,v]=[f,v,v+1],v>=d&&(v-=a)}while(v!==s+1)let x=[];x.push({bevelI:0,angle:0,size:0,boundary:{vertices:c.vertices.slice(2*s,2*d),vertexCount:a,vertexIndices:Array(a).fill(!0).map((e,t)=>[t,t]),elements:[0,a],elementCount:1,mesh:null},reverseMap:[],insetPoints:c.vertices.slice(2*s,2*d)});let b=0;for(let e=1;e<=this._bevelSegments;e++){let i=e/this._bevelSegments*Math.PI/2,s=(1-Math.cos(i))*this._bevel,o=[],h=[],d=[],p=[],f=0;for(let e=0;e<a;e++){let i=2*e,m=(e-1+a)%a*2,g=c.vertices[2*u.start+i+0],v=c.vertices[2*u.start+i+1],y=-u.normals[m+0]*s,x=-u.normals[m+1]*s,b=-u.normals[i+0]*s,w=-u.normals[i+1]*s;if(u.concave[e]||!u.concave[e]&&t){let i=Math.atan2(x,y),a=Math.atan2(w,b);a>i&&(a-=2*Math.PI);let h=a-i;if(u.continuous[e]||t){let r=i+h/2,a=Math.cos(r)*s,c=Math.sin(r)*s;o[2*f+0]=g+a*(t?-1:1),o[2*f+1]=v+c*(t?-1:1),p[f]=e,f++}else{let t=Math.max(1,Math.floor(r/4*Math.abs(h)/Math.PI));for(let r=0;r<=t;r++){let a=i+r/t*h,c=Math.cos(a)*s,d=Math.sin(a)*s;o[2*f+0]=g+c,o[2*f+1]=v+d,p[f]=e,f++}}}else o[2*f+0]=g+y,o[2*f+1]=v+x,p[f]=e,h[e]=f,o[2*++f+0]=g,o[2*f+1]=v,p[f]=e,o[2*++f+0]=g+b,o[2*f+1]=v+w,p[f]=e,d[e]=f,f++}let m=_f({windingRule:SI.POSITIVE,elementType:SR.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[o],edgeCreateCallback:e=>{let t=e.Org.idx,i=p[t],r=p[(t+1)%p.length];e.idx=[i,r],e.Sym.idx=[r,i]},vertexIdCallback:e=>{let t=e.Lprev.idx;return[t?t[1]:0,e.idx?e.idx[0]:0]}});if(!m)throw console.log("Error"),Error(`error generating bevel geometry for ${e}'th loop`);if(!m.vertexCount){b=(1-Math.sin((e-1)/this._bevelSegments*Math.PI/2))*this._bevel;break}for(let e=0;e<m.vertexIndices.length;e++){let[t,i]=m.vertexIndices[e];if(t===i)continue;let r=i;i<t&&(r+=a);for(let s=t;s<r;s++){let r=s%a,o=(s+1)%a;if(!u.continuous[r]||!u.continuous[o]){m.vertexIndices[e]=[t,r],m.vertexIndices.splice(e+1,0,[o,i]),m.vertices.splice((e+1)*2,0,m.vertices[2*e],m.vertices[2*e+1]);break}}}x.push({bevelI:e,angle:i,size:s,boundary:m,reverseMap:p,insetPoints:o})}let S=(e,t,i)=>{let r=0,s=e.boundary.vertexIndices.length;for(;r<s&&i(e.boundary.vertexIndices[t]);)t=(t+1)%s,r++;return r},C=w.length;for(let e=1;e<x.length;
3140e++){let t=x[e-1],i=x[e],r=t.boundary.vertexIndices.length,s=i.boundary.vertexIndices.length;if(!r||!s)break;let h=u.concave.length,c=0,d=_w(0,a);for(;!t.boundary.vertexIndices.filter(d).length||!i.boundary.vertexIndices.filter(d).length;)d=_w(++c,a);let p=t.boundary.vertexIndices.findIndex(d),f=i.boundary.vertexIndices.findIndex(d);do p=(p+1)%r;while(d(t.boundary.vertexIndices[p]))do f=(f+1)%s;while(d(i.boundary.vertexIndices[f]))let m=c=(c+1)%a,g=0,v=this._buildBevelVert(u,t,(p-1+r)%r,void 0,g),y=this._buildBevelVert(u,i,(f-1+s)%s,void 0,g),b=v,_=y,C,M,E=!1;do{g=(c||h)/h;let e=S(t,p,d=_w(c,a)),m=S(i,f,d),v=E;if(E=!1,e&&!m){for(let i=0;i<e;i++)C=this._buildBevelVert(u,t,(p+i)%r,i/(e-1),g),w.push(b.topN,C.topP,_.topN),!1===o&&w.push(C.bottomP,b.bottomN,_.bottomN),b=C;E=!0}else if(!e&&m)for(let e=0;e<m;e++)M=this._buildBevelVert(u,i,(f+e)%s,e/(m-1),g),w.push(_.topN,b.topP,M.topP),!1===o&&w.push(b.bottomP,_.bottomN,M.bottomP),_=M;else if(e&&m)if(C=this._buildBevelVert(u,t,p,0,g),M=this._buildBevelVert(u,i,f,0,g),v?(w.push(b.topN,M.topP,_.topN),w.push(b.topN,C.topP,M.topP),!1===o&&(w.push(M.bottomP,b.bottomN,_.bottomN),w.push(M.bottomP,C.bottomP,b.bottomN))):(w.push(_.topN,b.topN,C.topP),w.push(_.topN,C.topP,M.topP),!1===o&&(w.push(C.bottomP,b.bottomN,_.bottomN),w.push(C.bottomP,_.bottomN,M.bottomP))),b=C,_=M,e===m)for(let a=1;a<e;a++)C=this._buildBevelVert(u,t,(p+a)%r,a/(e-1),g),M=this._buildBevelVert(u,i,(f+a)%s,a/(m-1),g),w.push(b.topN,C.topP,_.topN),w.push(_.topN,C.topP,M.topP),!1===o&&(w.push(C.bottomP,b.bottomN,_.bottomN),w.push(C.bottomP,_.bottomN,M.bottomP)),b=C,_=M;else if(e>m){let a=e/m,h=0;for(let c=1;c<e;c++)C=this._buildBevelVert(u,t,(p+c)%r,c/(e-1),g),w.push(b.topN,C.topP,_.topN),!1===o&&w.push(C.bottomP,b.bottomN,_.bottomN),b=C,c>(h+1)*a&&(h++,M=this._buildBevelVert(u,i,(f+h)%s,h/(m-1),g),w.push(_.topN,C.topP,M.topP),!1===o&&w.push(C.bottomP,_.bottomN,M.bottomP),_=M)}else{let a=m/e,h=0;for(let c=1;c<m;c++)M=this._buildBevelVert(u,i,(f+c)%s,c/(m-1),g),w.push(_.topN,C.topP,M.topP),!1===o&&w.push(C.bottomP,_.bottomN,M.bottomP),_=M,c>(h+1)*a&&(h++,C=this._buildBevelVert(u,t,(p+h)%r,h/(e-1),g),w.push(b.topN,C.topP,_.topN),!1===o&&w.push(C.bottomP,b.bottomN,_.bottomN),b=C)}p=(p+e)%r,f=(f+m)%s,c=(c+1)%h}while(c!==m)}if(!1===o&&this._depth>2*this._bevel&&this._buildWall(x,u,w),t){let e=[];for(let t=w.length-1;t>=C+2;t-=3){let i=w[t-2],r=w[t-1],s=w[t-0];e.push(s,r,i)}w.splice(C,w.length-C,...e)}if(t){let e=[];for(let t=x[x.length-1].boundary.vertices.length-1;t>=1;t-=2){let i=x[x.length-1].boundary.vertices[t-1],r=x[x.length-1].boundary.vertices[t-0];e.push(i,r)}_.push(e)}if(!t){let e=x[x.length-1],t;try{t=_f({windingRule:x.length>1?SI.POSITIVE:SI.ODD,elementType:SR.POLYGONS,vertexSize:2,strict:!0,contours:[e.insetPoints,..._]})}catch{t=_b}if(!t)throw Error("Error generating geometry for surface");0===p.length&&this._bevel<h&&Object.assign(this,{useNgonForTopBottomFaceDuringBake:!0});for(let e=0;e<3*t.elementCount;e+=3){let i=this._buildSurfaceVert(t,t.elements[e+0],b),r=this._buildSurfaceVert(t,t.elements[e+1],b),s=this._buildSurfaceVert(t,t.elements[e+2],b);w.push(i.top,r.top,s.top),!1===o&&w.push(s.bottom,r.bottom,i.bottom)}}this.vertexCache={}}this._buffer.shrink();let S=new rE(Uint32Array.from(w),1),C=new rE(this._buffer.positions,3),M=new rE(this._buffer.normals,3),E=new rE(this._buffer.uvs,2);C.needsUpdate=!0,M.needsUpdate=!0,E.needsUpdate=!0,S.needsUpdate=!0,this.setAttribute("position",C),this.setAttribute("normal",M),this.setAttribute("uv",E),this.setIndex(S)}_computeBufferEstimatedSize(e){return 2*e.vertexCount*(2+this._bevelSegments)}_buildWall(e,t,i){let r=e[0];
3140for(let e=0,s=r.boundary.vertexCount;e<s;e++){let a=this._buildBevelVert(t,r,e),o=this._buildBevelVert(t,r,(e+1)%s);i.push(o.topP,a.topN,a.bottomN),i.push(o.topP,a.bottomN,o.bottomP)}}_buildSurfaceVert(e,t,i){let r=t.toString();if(r in this.vertexCache)return this.vertexCache[r];let s=e.vertices[2*t+0],a=e.vertices[2*t+1],o=(s-this._minX)/this._width,h=(a-this._minY)/this._height;this.forPathBevel&&(h=1);let c=this._buffer.get(this.forPathBevel?1:2),d=3*c,u=2*c,p={top:c+0,bottom:c+1};return this._buffer.positions[d+0]=s,this._buffer.positions[d+1]=a,this._buffer.positions[d+2]=this.forPathBevel?this._bevel:this._depth-i,this._buffer.normals[d+0]=0,this._buffer.normals[d+1]=0,this._buffer.normals[d+2]=1,this._buffer.uvs[u+0]=o,this._buffer.uvs[u+1]=h,!1===this.forPathBevel&&(this._buffer.positions[d+3]=s,this._buffer.positions[d+4]=a,this._buffer.positions[d+5]=i,this._buffer.normals[d+3]=0,this._buffer.normals[d+4]=0,this._buffer.normals[d+5]=-1,this._buffer.uvs[u+2]=o,this._buffer.uvs[u+3]=h),this.vertexCache[r]=p,p}_buildBevelVert(e,t,i,r=1,s){let a=`${t.bevelI}:${i}`;if(a in this.vertexCache&&0!==s&&1!==s&&(!s||s===this.vertexCache[a].pathBevelUCoord))return this.vertexCache[a];let[o,h]=t.boundary.vertexIndices[i],c,d,u,p;o!==h?(d=o,c=h,p=!1,u=e.continuous[d]&&e.continuous[c]):(d=((c=o)-1+e.count)%e.count,p=e.concave[c]&&t.bevelI>0,u=e.continuous[c]||p);let f=Math.cos(t.angle),m=Math.sin(t.angle),g=2*i,v=2*c,y=2*d,x=t.boundary.vertices[g+0],b=t.boundary.vertices[g+1],w=(1-m)*this._bevel,_=(x-this._minX)/this._width,S=(b-this._minY)/this._height;this.forPathBevel&&(void 0!==s&&(_=s),S=1);let C=e.normals[v+0],M=e.normals[v+1],E=e.normals[y+0],A=e.normals[y+1];if(p){let e=E-C,t=A-M,i=Math.sqrt((C+=e*(1-r))*C+(M+=t*(1-r))*M);C/=i,M/=i}let T=this.forPathBevel?this._buffer.get(u?1:2):this._buffer.get(u?2:4),P=3*T,D=2*T,O={i:i,fi:c,topP:T+0,topN:T+0,bottomP:T+1,bottomN:T+1,pathBevelUCoord:s};return this._buffer.positions[P+0]=x,this._buffer.positions[P+1]=b,this._buffer.positions[P+2]=(this.forPathBevel?this._bevel:this._depth)-w,this._buffer.normals[P+0]=C*f,this._buffer.normals[P+1]=M*f,this._buffer.normals[P+2]=m,this._buffer.uvs[D+0]=_,this._buffer.uvs[D+1]=S,!1===this.forPathBevel&&(this._buffer.positions[P+3]=x,this._buffer.positions[P+4]=b,this._buffer.positions[P+5]=w,this._buffer.normals[P+3]=C*f,this._buffer.normals[P+4]=M*f,this._buffer.normals[P+5]=-m,this._buffer.uvs[D+2]=S,this._buffer.uvs[D+3]=_),u||(this.forPathBevel?(T+=1,P+=3,D+=2):(T+=2,P+=6,D+=4),O.topP=T+0,O.bottomP=T+1,this._buffer.positions[P+0]=x,this._buffer.positions[P+1]=b,this._buffer.positions[P+2]=(this.forPathBevel?this._bevel:this._depth)-w,this._buffer.normals[P+0]=E*f,this._buffer.normals[P+1]=A*f,this._buffer.normals[P+2]=m,this._buffer.uvs[D+0]=_,this._buffer.uvs[D+1]=S,!1===this.forPathBevel&&(this._buffer.positions[P+3]=x,this._buffer.positions[P+4]=b,this._buffer.positions[P+5]=w,this._buffer.normals[P+3]=E*f,this._buffer.normals[P+4]=A*f,this._buffer.normals[P+5]=-m,this._buffer.uvs[D+2]=S,this._buffer.uvs[D+3]=_)),this.vertexCache[a]=O,O}clone(){let e=new __(this._shape,this._depth,this._bevel,this._curveSegments,this._bevelSegmentsInput);return e.userData=uy(this.userData),e}},_S=class extends rz{constructor(e,t=12,i={}){super(),this.type="ShapeGeometry",this.windingRule=SI.ODD,this.elementType=SR.POLYGONS,this.polySize=3,this.vertexSize=2,this.strict=!0,this._shape=e,this._curveSegments=t,this._triangulationOptions=Object.assign({windingRule:SI.ODD,elementType:SR.POLYGONS,polySize:3,vertexSize:2,strict:!0},i);let r=this._shape.extractShapePointsToFlatArray([],this._curveSegments),s=this._shape.shapeHoles.map(e=>e.extractShapePointsToFlatArray([],this._curveSegments)),a,o=!0,h=!0,c,d;for(let e=0,t=r.length/2;e<t;e++){let t=2*e,i=r[t+0],s=r[t+1];if(void 0!==c&&i!==c&&(o=!1),void 0!==d&&s!==d&&(h=!1),c=i,d=s,!o&&!h)break}if(!o&&!h)try{a=_f({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=_y}let u=a?.vertexCount??1,p=a?.elementCount??1;if(this._positionAttribute=new rE(new Float32Array(3*u),3),this._normalAttribute=new rE(new Float32Array(3*u),3),this._uvAttribute=new rE(new Float32Array(2*u),2),this._indexAttribute=new rE(new Uint32Array(3*p),1),a){let e=1/0,t=-1/0,i=1/0,r=-1/0;for(let s=0;s<u;s++){let o=2*s,h=a.vertices[o+0],c=a.vertices[o+1];h<e&&(e=h),h>t&&(t=h),c<i&&(i=c),c>r&&(r=c)}let s=t-e,o=r-i;for(let t=0;t<u;t++){let r=2*t,h=a.vertices[r+0],c=a.vertices[r+1],d=(h-e)/s,u=(c-i)/o;this._positionAttribute.setXYZ(t,h,c,0),this._normalAttribute.setXYZ(t,0,0,1),this._uvAttribute.setXY(t,d,u)}for(let e=0;e<p;e++){let t=3*e,i=a.elements[t+0],r=a.elements[t+1],s=a.elements[t+2];this._indexAttribute.setX(t+0,i),this._indexAttribute.setX(t+1,r),this._indexAttribute.setX(t+2,s)}}this.setAttribute("position",this._positionAttribute),this.setAttribute("normal",this._normalAttribute),this.setAttribute("uv",this._uvAttribute),this.setIndex(this._indexAttribute),this.setDrawRange(0,(a?.elementCount??1)*3)}clone(){let e=new _S(this._shape,this._curveSegments);return e.userData=uy(this.userData),e}},_C=class extends __{constructor(e,t,i=0,r=12,s=3,a=SI.ODD){super(e,t,i,r,s,a),this.type="ShapeGeometry"}_computeBufferEstimatedSize(e){return 2*e.vertexCount*(2+this._bevelSegments)}_buildWall(e,t,i){let r=e[0];
3140for(let e=0,s=r.boundary.vertexCount;e<s;e++){let a=this._buildBevelVert(t,r,e),o=this._buildBevelVert(t,r,(e+1)%s);i.push(o.topP,a.topN,a.bottomN),i.push(o.topP,a.bottomN,o.bottomP)}}clone(){let e=new _C(this._shape,this._depth,this._bevel,this._curveSegments,this._bevelSegmentsInput);return e.userData=uy(this.userData),e}},_M=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,subdivisions:40,roundness:0,extrudeBevelSize:0,extrudeBevelSegments:3,windingRule:SI.ODD},e.parameters),r=Math.abs(i.width),s=Math.abs(i.height??i.width),a=Math.abs(i.depth??0),o=e.shape??t?.shape,h=o?.roundness??i.roundness;void 0!==o&&(o instanceof w6?(o.width!==r||o.height!==s)&&o.applySize(r,s):o=new w6(r,s).fromJSON(o),e.parameters?.roundness!==void 0&&e.parameters?.roundness>0&&o.update());let c=o??new w6(r,s);return{parameters:Object.assign(i,{width:r,height:s,depth:a,roundness:h}),shape:c}}static build(e){let{depth:t,extrudeBevelSize:i,extrudeBevelSegments:r,subdivisions:s,roundness:a,windingRule:o}=e.parameters;return e.shape.roundness=a,Object.assign(t<=0?new _S(e.shape,s,{windingRule:o}):new _C(e.shape,t,i,s,r,o),{userData:{...e,type:"VectorGeometry"}})}},_E=2*Math.PI,_A=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,depth:0,spikes:64,angle:360,innerRadius:0,extrudeBevelSize:0,extrudeBevelSegments:1},e.parameters);return i.angle=tQ.clamp(i.angle,0,360),{shape:e.shape&&e.shape instanceof w6?e.shape:new w6,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 t,{width:i,height:r,spikes:s,angle:a,innerRadius:o,depth:h,extrudeBevelSize:c,extrudeBevelSegments:d}=e.parameters,u=e.shape,p=function(e,t,i,r,s,a){if(r>=_E)return s>30||s%4==0?(function(e,t,i,r=0,s=0,a=0){let o=.5522847498*t,h=.5522847498*i;e.addPoint(_D(s-t,a,s-t,a-h,s-t,a+h)),e.addPoint(_D(s,a+i,s-o,a+i,s+o,a+i)),e.addPoint(_D(s+t,a,s+t,a+h,s+t,a-h)),e.addPoint(_D(s,a-i,s+o,a-i,s-o,a-i)),r>0&&_L(e,t,i,r)}(e,t,i,a),Math.round(s/4)):_T(e,r,s,t,i,a);let o=(r=Math.max(r,.001))+.5*Math.PI,h={x:Math.cos(o)*t,y:Math.sin(o)*i},c=function({px:e,py:t,cx:i,cy:r,rx:s,ry:a,largeArcFlag:o,sweepFlag:h}){var c,d;let u,p,f,m,g,v,y,x,b,w,_,S=[];if(0===s||0===a)return[];let C=(e-i)/2,M=(t-r)/2;if(0===C&&0===M)return[];let E=Math.pow(C,2)/Math.pow(s=Math.abs(s),2)+Math.pow(M,2)/Math.pow(a=Math.abs(a),2);E>1&&(s*=Math.sqrt(E),a*=Math.sqrt(E));let A=(c=s,d=a,u=Math.pow(c,2),p=Math.pow(d,2),f=Math.pow(C,2),(g=u*p-u*(m=Math.pow(M,2))-p*f)<0&&(g=0),g/=u*m+p*f,v=(g=Math.sqrt(g)*(o===h?-1:1))*c/d*M,y=-(g*d)/c*C,w=w7(1,0,x=(C-v)/c,b=(M-y)/d),_=w7(x,b,(-C-v)/c,(-M-y)/d),!h&&_>0&&(_-=w8),h&&_<0&&(_+=w8),{centerx:v+(e+i)/2,centery:y+(t+r)/2,ang1:w,ang2:_}),{ang1:T,ang2:P}=A,{centerx:D,centery:O}=A,L=Math.abs(P)/(w8/4);1e-7>Math.abs(1-L)&&(L=1);let I=Math.max(Math.ceil(L),1);P/=I;for(let e=0;e<I;e++)S.push(function(e,t){let i=1.5707963267948966===t?.551915024494:-1.5707963267948966===t?-.551915024494:1.3333333333333333*Math.tan(t/4),r=Math.cos(e),s=Math.sin(e),a=Math.cos(e+t),o=Math.sin(e+t);return[{x:r-s*i,y:s+r*i},{x:a+o*i,y:o-a*i},{x:a,y:o}]}(T,P)),T+=P;return S.map(e=>{let{x:t,y:i}=w9(e[0],s,a,D,O),{x:r,y:o}=w9(e[1],s,a,D,O),{x:h,y:c}=w9(e[2],s,a,D,O);return{x1:t,y1:i,x2:r,y2:o,x:h,y:c}})}({px:0,py:i,cx:h.x,cy:h.y,rx:t,ry:i,largeArcFlag:r>Math.PI,sweepFlag:!0});return s>30||s%c.length==0?function(e,t,i,r,s,a,o){let h=Math.round(r/i.length);e.addPoint(_P(0,t));for(let t=0,r=i.length;t<r;t++){let r=i[t],s=e.points[t],a=_P(r.x,r.y);s.controls[1].position.set(r.x1,r.y1),a.controls[0].position.set(r.x2,r.y2),e.addPoint(a)}return o>0?_O(e,s,a,o):e.addPoint(_P(0,0)),h}(e,i,c,s,t,i,a):_T(e,r,s,t,i,a)}(u,.5*i,.5*r,a*Math.PI/180,s,o);
vendor: 4,864 bytes, line 3140
3140return u.isClosed=!0,u.update(),0===a?(t=new rz).setAttribute("position",new rP([],3)):t=_M.create({shape:u,parameters:{subdivisions:p,depth:h,extrudeBevelSize:c,extrudeBevelSegments:d}}),Object.assign(t,{userData:{...e,type:"EllipseGeometry"}})}};function _T(e,t,i,r,s,a){let o=-t/i;for(let t=0;t<=i;t++){let i=o*t,a=Math.sin(i)*r,h=Math.cos(i)*s;e.addPoint(_P(a,h))}return t<_E?a>0?_O(e,r,s,a):e.addPoint(_P(0,0)):(e.removePoint(e.points[e.points.length-1]),a>0&&_L(e,r,s,a)),1}function _P(e,t){return new wB(tQ.generateUUID(),new tZ(e,t))}function _D(e,t,i,r,s,a){let o=_P(e,t);return o.controls[0].position.set(i,r),o.controls[1].position.set(s,a),o}function _O(e,t,i,r){_I(e,t,i,r).forEach(t=>e.addPoint(t))}function _L(e,t,i,r){let s=_I(e,t,i,r),a=new w6;s.forEach(e=>a.addPoint(e)),a.isClosed=!0,e.shapeHoles.push(a)}function _I(e,t,i,r){let s=r*t/100,a=Math.abs(i)/Math.abs(t)*s,o=new tZ(s/t,a/i),h=e.points.map(e=>{let t=e.clone();return t.uuid=tQ.generateUUID(),t}).reverse();return h.forEach(e=>{e.position.multiply(o);let t=e.controls[0].position.clone().multiply(o),i=e.controls[1].position.clone().multiply(o);e.controls[0].position.copy(i),e.controls[1].position.copy(t)}),h}var _R=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,revolutions:2,segments:40,pathRadius:10,pathType:0,pathSegments:30,cornerRadius:30,cornerSegments:4},e.parameters),r=Math.abs(i.width),s=Math.abs(i.height??r),a=Math.abs(i.depth??r),o=Math.abs(Math.min(r,a))/2;return{parameters:Object.assign(i,{width:r,height:s,depth:a,radius:o,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:o,pathRadius:h,pathType:c,pathSegments:d,cornerRadius:u,cornerSegments:p}=e.parameters;return Object.assign(new _B(!1,t,i,r,s,a,o,h,c,d,u,p),{userData:{...e,type:"HelixGeometry"}})}},_k=new rT([0,0,0],1),_B=class extends rz{constructor(e=!0,t=1,i=1,r=1,s=1,a=1,o=1,h=1,c=1,d=1,u=1,p=1){if(super(),0===a)return;let f=e&&1===a;f&&(p=0),u>100&&(u=100),0===u&&(p=0);let m=()=>new iy,g=new iy,v=m(),y=m(),x=m(),b,w,_,S,C,M,E,A,T=m(),P=m(),D=m(),O=m(),L=m(),I=m(),R=m(),k=m(),B=i-2*h+.001,z=B/a,N=Math.ceil(o*a),F=N+1,j=B/N,U=-B/2,V=d+1,W=2*Math.PI/d,H=Math.PI/2/p,G=Math.min((1-u/100)*h,h-.01),q=h-G,X=0,Y=2*p+2,Q=V*Y/2,Z=Q+V*F,K=Math.max(0,V*(F+Y)),[J,$,ee]=[3,3,2].map(e=>Array(K*e).fill(0)),et=[],ei=s-h;function er(t,i){let r=Math.PI/2;A=2*Math.PI*((M=i*j)%z)/z+r,M+=U,E=Math.sin(A)*ei,C=Math.cos(A)*ei,e?t.set(C,E,M):t.set(C,M,E)}er(g,-1e-10),er(v,0),T.copy(g),er(g,1);let es=g.distanceTo(v),ea=f?0:q+G,en=es*N+2*ea,eo=en-ea;for(let t=0;t<=N;t++){er(y,t),k.subVectors(y,T).normalize(),T.copy(y),I.copy(y).setComponent(+e+1,0).normalize(),R.crossVectors(k,I).normalize();let i=0===t,r=t===N,s=i?3*Math.PI/2:H,a=i?G:eo,o=i?V:Z,c=i?0:K-V,u=k.clone().multiplyScalar(i?-q:q).add(y),m=k.clone().multiplyScalar(i?-1:1).normalize();for(let e=0;e<V;e++){let b=e*W;if(P.addVectors(g.copy(I).multiplyScalar(h*Math.cos(b)),v.copy(R).multiplyScalar(h*Math.sin(b))),D.copy(P).normalize(),i||r){f||(X=c+e,[0,1,2].forEach(e=>{J[3*X+e]=u.getComponent(e),$[3*X+e]=m.getComponent(e)}),ee[2*X]=+r,ee[2*X+1]=e/d),v.copy(D).multiplyScalar(G),x.addVectors(y,v);for(let t=0;t<p;t++){let r=t*H+s;O.addVectors(g.copy(k).multiplyScalar(q*Math.sin(r)),v.copy(D).multiplyScalar(q*Math.cos(r))),L.copy(O).normalize(),v.addVectors(x,O),O.normalize(),X=o+t*V+e,[0,1,2].forEach(e=>{J[3*X+e]=v.getComponent(e),$[3*X+e]=L.getComponent(e)});let h=+i+Math.sin(r);ee[2*X]=(a+q*h)/en,ee[2*X+1]=e/d}}v.addVectors(y,P),X=Q+t*V+e,[0,1,2].forEach(e=>{J[3*X+e]=v.getComponent(e),$[3*X+e]=D.getComponent(e)}),ee[2*X]=(ea+t*es)/en,ee[2*X+1]=e/d}}let el=F+2*p+2,[eh,ec]=[+f,el-1];for(let e=eh;e<=ec-1;e++){let t=f&&e===ec-1;for(let i=0;i<V-1;i++)w=(b=e*V+i)+1,_=(t?i:b)+V,S=(t?i+1:w)+V,0===e?et.push(w,S,_):e===el-2?et.push(b,w,_):et.push(b,w,_,w,S,_)}this.setIndex(et),this.setAttribute("position",new rP(J,3)),this.setAttribute("normal",new rP($,3)),this.setAttribute("uv",new rP(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,o,h,c=6*(t-1)*e.radialSegments,d=t==t;for(let u=0;u<e.radialSegments;u++)a=(s=t*i+u)+1,o=(d?u:s)+i,h=(d?u+1:a)+i,r[c++]=s,r[c++]=a,r[c++]=o,r[c++]=a,r[c++]=h,r[c++]=o;return r.length=c,_k.array=r,_k.count=r.length,_k}},_z=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,detail:0,corner:0,cornerSides:4},e.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}
3140static build(e){let{width:t,height:i,depth:r,detail:s,corner:a,cornerSides:o}=e.parameters,h=0===s&&0!==a?new _N(.5*t,a,o):new oO(.5*t,s);return h.scale(1,i/t,r/t),Object.assign(h,{userData:{...e,type:"IcosahedronGeometry"}})}},_N=class extends wO{constructor(e=1,t=.2,i=4){let r=(1+Math.sqrt(5))/2,s="IcosahedronGeometry";super([-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],[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],s,e,t,i),this.type=s}static fromJSON(e){return new _N(e.radius,e.corner,e.cornerSides)}},_F=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){(e.parameters?.points??[]).forEach(e=>{Array.isArray(e)&&(e.x=e[0],e.y=e[1])});let i=Object.assign({},t?.parameters??{width:100,segments:64,verticalSegments:64,points:[{x:0,y:-50,id:0},{x:50,y:-50,id:1},{x:50,y:50,id:2},{x:0,y:50,id:3}]},e.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(e){let{points:t,segments:i,verticalSegments:r}=e.parameters,s=new od;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 on(s.extractPoints(r).shape,i);return a.rotateZ(Math.PI),Object.assign(a,{userData:{...e,type:"LatheGeometry"}})}},_j=new iY,_U=new rh,_V=new iy,_W=class extends tk{constructor(){super(),this.uuid=tQ.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 tK().getNormalMatrix(e);for(let t=0,i=this.vertices.length;t<i;t++)this.vertices[t].applyMatrix4(e);for(let e=0,i=this.faces.length;e<i;e++){let i=this.faces[e];i.normal.applyMatrix3(t).normalize();for(let e=0,r=i.vertexNormals.length;e<r;e++)i.vertexNormals[e].applyMatrix3(t).normalize()}return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this.verticesNeedUpdate=!0,this.normalsNeedUpdate=!0,this}rotateX(e){return _j.makeRotationX(e),this.applyMatrix4(_j),this}rotateY(e){return _j.makeRotationY(e),this.applyMatrix4(_j),this}rotateZ(e){return _j.makeRotationZ(e),this.applyMatrix4(_j),this}translate(e,t,i){return _j.makeTranslation(e,t,i),this.applyMatrix4(_j),this}scale(e,t,i){return _j.makeScale(e,t,i),this.applyMatrix4(_j),this}lookAt(e){return _U.lookAt(e),_U.updateMatrix(),this.applyMatrix4(_U.matrix),this}fromBufferGeometry(e){let t=this,i=null!==e.index?e.index:void 0,r=e.attributes;if(void 0===r.position)return console.error("THREE.Geometry.fromBufferGeometry(): Position attribute required for conversion."),this;let s=r.position,a=r.normal,o=r.color,h=r.uv,c=r.uv2;void 0!==c&&(this.faceVertexUvs[1]=[]);for(let e=0;e<s.count;e++)t.vertices.push(new iy().fromBufferAttribute(s,e)),void 0!==o&&t.colors.push(new ir().fromBufferAttribute(o,e));function d(e,i,r,s){let d=void 0===o?[]:[t.colors[e].clone(),t.colors[i].clone(),t.colors[r].clone()],u=void 0===a?[]:[new iy().fromBufferAttribute(a,e),new iy().fromBufferAttribute(a,i),new iy().fromBufferAttribute(a,r)],p=new _G(e,i,r,u,d,s);t.faces.push(p),void 0!==h&&t.faceVertexUvs[0].push([new tZ().fromBufferAttribute(h,e),new tZ().fromBufferAttribute(h,i),new tZ().fromBufferAttribute(h,r)]),void 0!==c&&t.faceVertexUvs[1].push([new tZ().fromBufferAttribute(c,e),new tZ().fromBufferAttribute(c,i),new tZ().fromBufferAttribute(c,r)])}let u=e.groups;if(u.length>0)for(let e=0;e<u.length;e++){let t=u[e],r=t.start,s=t.count;for(let e=r,a=r+s;e<a;e+=3)void 0!==i?d(i.getX(e),i.getX(e+1),i.getX(e+2),t.materialIndex):d(e,e+1,e+2,t.materialIndex)}else if(void 0!==i)for(let e=0;e<i.count;e+=3)d(i.getX(e),i.getX(e+1),i.getX(e+2));else for(let e=0;e<s.count;e+=3)d(e,e+1,e+2);
3140return this.computeFaceNormals(),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(_V).negate(),this.translate(_V.x,_V.y,_V.z),this}normalize(){this.computeBoundingSphere();let e=this.boundingSphere.center,t=this.boundingSphere.radius,i=0===t?1:1/t,r=new iY;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 iy,t=new iy;for(let i=0,r=this.faces.length;i<r;i++){let r=this.faces[i],s=this.vertices[r.a],a=this.vertices[r.b],o=this.vertices[r.c];e.subVectors(o,a),t.subVectors(s,a),e.cross(t),e.normalize(),r.normal.copy(e)}}computeVertexNormals(e=!0){let t=Array(this.vertices.length);for(let e=0,i=this.vertices.length;e<i;e++)t[e]=new iy;if(e){let e=new iy,i=new iy;for(let r=0,s=this.faces.length;r<s;r++){let s=this.faces[r],a=this.vertices[s.a],o=this.vertices[s.b],h=this.vertices[s.c];e.subVectors(h,o),i.subVectors(a,o),e.cross(i),t[s.a].add(e),t[s.b].add(e),t[s.c].add(e)}}else{this.computeFaceNormals();for(let e=0,i=this.faces.length;e<i;e++){let i=this.faces[e];t[i.a].add(i.normal),t[i.b].add(i.normal),t[i.c].add(i.normal)}}for(let e=0,i=this.vertices.length;e<i;e++)t[e].normalize();for(let e=0,i=this.faces.length;e<i;e++){let i=this.faces[e],r=i.vertexNormals;3===r.length?(r[0].copy(t[i.a]),r[1].copy(t[i.b]),r[2].copy(t[i.c])):(r[0]=t[i.a].clone(),r[1]=t[i.b].clone(),r[2]=t[i.c].clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)}computeFlatVertexNormals(){this.computeFaceNormals();for(let e=0,t=this.faces.length;e<t;e++){let t=this.faces[e],i=t.vertexNormals;3===i.length?(i[0].copy(t.normal),i[1].copy(t.normal),i[2].copy(t.normal)):(i[0]=t.normal.clone(),i[1]=t.normal.clone(),i[2]=t.normal.clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)}computeMorphNormals(){for(let e=0,t=this.faces.length;e<t;e++){let t=this.faces[e];
3140t.__originalFaceNormal?t.__originalFaceNormal.copy(t.normal):t.__originalFaceNormal=t.normal.clone(),t.__originalVertexNormals||(t.__originalVertexNormals=[]);for(let e=0,i=t.vertexNormals.length;e<i;e++)t.__originalVertexNormals[e]?t.__originalVertexNormals[e].copy(t.vertexNormals[e]):t.__originalVertexNormals[e]=t.vertexNormals[e].clone()}let e=new _W;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 e=this.morphNormals[t].faceNormals,i=this.morphNormals[t].vertexNormals;for(let t=0,r=this.faces.length;t<r;t++){let t=new iy,r={a:new iy,b:new iy,c:new iy};e.push(t),i.push(r)}}let i=this.morphNormals[t];e.vertices=this.morphTargets[t].vertices,e.computeFaceNormals(),e.computeVertexNormals();for(let e=0,t=this.faces.length;e<t;e++){let t=this.faces[e],r=i.faceNormals[e],s=i.vertexNormals[e];r.copy(t.normal),s.a.copy(t.vertexNormals[0]),s.b.copy(t.vertexNormals[1]),s.c.copy(t.vertexNormals[2])}}for(let e=0,t=this.faces.length;e<t;e++){let t=this.faces[e];
3140t.normal=t.__originalFaceNormal,t.vertexNormals=t.__originalVertexNormals}}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new iw),this.boundingBox.setFromPoints(this.vertices)}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new iF),this.boundingSphere.setFromPoints(this.vertices)}merge(e,t,i=0){if(!(e&&e.isGeometry))return void console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",e);let r,s=this.vertices.length,a=this.vertices,o=e.vertices,h=this.faces,c=e.faces,d=this.colors,u=e.colors;void 0!==t&&(r=new tK().getNormalMatrix(t));for(let e=0,i=o.length;e<i;e++){let i=o[e].clone();void 0!==t&&i.applyMatrix4(t),a.push(i)}for(let e=0,t=u.length;e<t;e++)d.push(u[e].clone());for(let e=0,t=c.length;e<t;e++){let t=c[e],a,o,d=t.vertexNormals,u=t.vertexColors,p=new _G(t.a+s,t.b+s,t.c+s);p.normal.copy(t.normal),void 0!==r&&p.normal.applyMatrix3(r).normalize();for(let e=0,t=d.length;e<t;e++)a=d[e].clone(),void 0!==r&&a.applyMatrix3(r).normalize(),p.vertexNormals.push(a);p.color.copy(t.color);for(let e=0,t=u.length;e<t;e++)o=u[e],p.vertexColors.push(o.clone());p.materialIndex=t.materialIndex+i,h.push(p)}for(let t=0,i=e.faceVertexUvs.length;t<i;t++){let i=e.faceVertexUvs[t];void 0===this.faceVertexUvs[t]&&(this.faceVertexUvs[t]=[]);for(let e=0,r=i.length;e<r;e++){let r=i[e],s=[];for(let e=0,t=r.length;e<t;e++)s.push(r[e].clone());this.faceVertexUvs[t].push(s)}}}mergeMesh(e){e&&e.isMesh?(e.matrixAutoUpdate&&e.updateMatrix(),this.merge(e.geometry,e.matrix)):console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",e)}mergeVertices(e=4){let t={},i=[],r=[],s=Math.pow(10,e);for(let e=0,a=this.vertices.length;e<a;e++){let a=this.vertices[e],o=Math.round(a.x*s)+"_"+Math.round(a.y*s)+"_"+Math.round(a.z*s);void 0===t[o]?(t[o]=e,i.push(this.vertices[e]),r[e]=i.length-1):r[e]=r[t[o]]}let a=[];for(let e=0,t=this.faces.length;e<t;e++){let t=this.faces[e];t.a=r[t.a],t.b=r[t.b],t.c=r[t.c];let i=[t.a,t.b,t.c];for(let t=0;t<3;t++)if(i[t]===i[(t+1)%3]){a.push(e);break}}for(let e=a.length-1;e>=0;e--){let t=a[e];this.faces.splice(t,1);for(let e=0,i=this.faceVertexUvs.length;e<i;e++)this.faceVertexUvs[e].splice(t,1)}let o=this.vertices.length-i.length;return this.vertices=i,o}setFromPoints(e){this.vertices=[];for(let t=0,i=e.length;t<i;t++){let i=e[t];this.vertices.push(new iy(i.x,i.y,i.z||0))}return this}sortFacesByMaterialIndex(){let e=this.faces,t=e.length;for(let i=0;i<t;i++)e[i]._id=i;e.sort(function(e,t){return e.materialIndex-t.materialIndex});let i=this.faceVertexUvs[0],r=this.faceVertexUvs[1],s,a;i&&i.length===t&&(s=[]),r&&r.length===t&&(a=[]);for(let o=0;o<t;o++){let t=e[o]._id;s&&s.push(i[t]),a&&a.push(r[t])}s&&(this.faceVertexUvs[0]=s),a&&(this.faceVertexUvs[1]=a)}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),void 0!==this.parameters){let t=this.parameters;for(let i in t)void 0!==t[i]&&(e[i]=t[i]);return e}let t=[];for(let e=0;e<this.vertices.length;e++){let i=this.vertices[e];t.push(i.x,i.y,i.z)}let i=[],r=[],s={},a=[],o={},h=[],c={};for(let e=0;e<this.faces.length;e++){let t=this.faces[e],r=void 0!==this.faceVertexUvs[0][e],s=t.normal.length()>0,a=t.vertexNormals.length>0,o=1!==t.color.r||1!==t.color.g||1!==t.color.b,h=t.vertexColors.length>0,c=0;if(c=d(0,0,0),c=d(c,1,!0),c=d(c,2,!1),c=d(c,3,r),c=d(c,4,s),c=d(c,5,a),c=d(c,6,o),c=d(c,7,h),i.push(c),i.push(t.a,t.b,t.c),i.push(t.materialIndex),r){let t=this.faceVertexUvs[0][e];i.push(f(t[0]),f(t[1]),f(t[2]))}if(s&&i.push(u(t.normal)),a){let e=t.vertexNormals;i.push(u(e[0]),u(e[1]),u(e[2]))}if(o&&i.push(p(t.color)),h){let e=t.vertexColors;i.push(p(e[0]),p(e[1]),p(e[2]))}}function d(e,t,i){return i?e|1<<t:e&~(1<<t)}function u(e){let t=e.x.toString()+e.y.toString()+e.z.toString();return void 0!==s[t]||(s[t]=r.length/3,r.push(e.x,e.y,e.z)),s[t]}function p(e){let t=e.r.toString()+e.g.toString()+e.b.toString();return void 0!==o[t]||(o[t]=a.length,a.push(e.getHex())),o[t]}function f(e){let t=e.x.toString()+e.y.toString();return void 0!==c[t]||(c[t]=h.length/2,h.push(e.x,e.y)),c[t]}return e.data={},e.data.vertices=t,e.data.normals=r,a.length>0&&(e.data.colors=a),h.length>0&&(e.data.uvs=[h]),e.data.faces=i,e}clone(){return new _W().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 e=0,i=t.length;e<i;e++)this.vertices.push(t[e].clone());let i=e.colors;for(let e=0,t=i.length;e<t;e++)this.colors.push(i[e].clone());let r=e.faces;for(let e=0,t=r.length;e<t;e++)this.faces.push(r[e].clone());for(let t=0,i=e.faceVertexUvs.length;t<i;t++){let i=e.faceVertexUvs[t];void 0===this.faceVertexUvs[t]&&(this.faceVertexUvs[t]=[]);for(let e=0,r=i.length;e<r;e++){let r=i[e],s=[];for(let e=0,t=r.length;e<t;e++){let t=r[e];s.push(t.clone())}this.faceVertexUvs[t].push(s)}}let s=e.morphTargets;for(let e=0,t=s.length;e<t;e++){let t={};if(t.name=s[e].name,void 0!==s[e].vertices){t.vertices=[];for(let i=0,r=s[e].vertices.length;i<r;i++)t.vertices.push(s[e].vertices[i].clone())}if(void 0!==s[e].normals){t.normals=[];for(let i=0,r=s[e].normals.length;i<r;i++)t.normals.push(s[e].normals[i].clone())}this.morphTargets.push(t)}let a=e.morphNormals;for(let e=0,t=a.length;e<t;e++){let t={};if(void 0!==a[e].vertexNormals){t.vertexNormals=[];for(let i=0,r=a[e].vertexNormals.length;i<r;i++){let r=a[e].vertexNormals[i],s={};s.a=r.a.clone(),s.b=r.b.clone(),s.c=r.c.clone(),t.vertexNormals.push(s)}}if(void 0!==a[e].faceNormals){t.faceNormals=[];for(let i=0,r=a[e].faceNormals.length;i<r;i++)t.faceNormals.push(a[e].faceNormals[i].clone())}this.morphNormals.push(t)}let o=e.skinWeights;for(let e=0,t=o.length;e<t;e++)this.skinWeights.push(o[e].clone());let h=e.skinIndices;for(let e=0,t=h.length;e<t;e++)this.skinIndices.push(h[e].clone());let c=e.lineDistances;for(let e=0,t=c.length;e<t;e++)this.lineDistances.push(c[e]);let d=e.boundingBox;null!==d&&(this.boundingBox=d.clone());let u=e.boundingSphere;return null!==u&&(this.boundingSphere=u.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 _H().fromGeometry(this),t=new rz,i=new Float32Array(3*e.vertices.length);if(t.setAttribute("position",_Q.call(new rE(i,3),e.vertices)),e.normals.length>0){let i=new Float32Array(3*e.normals.length);t.setAttribute("normal",_Q.call(new rE(i,3),e.normals))}if(e.colors.length>0){let i=new Float32Array(3*e.colors.length);t.setAttribute("color",_X.call(new rE(i,3),e.colors))}if(e.uvs.length>0){let i=new Float32Array(2*e.uvs.length);t.setAttribute("uv",_Y.call(new rE(i,2),e.uvs))}if(e.uvs2.length>0){let i=new Float32Array(2*e.uvs2.length);t.setAttribute("uv2",_Y.call(new rE(i,2),e.uvs2))}for(let i in t.groups=e.groups,e.morphTargets){let r=[],s=e.morphTargets[i];for(let e=0,t=s.length;e<t;e++){let t=s[e],i=new rP(3*t.data.length,3);i.name=t.name,r.push(_Q.call(i,t.data))}t.morphAttributes[i]=r}if(e.skinIndices.length>0){let i=new rP(4*e.skinIndices.length,4);t.setAttribute("skinIndex",_Z.call(i,e.skinIndices))}if(e.skinWeights.length>0){let i=new rP(4*e.skinWeights.length,4);t.setAttribute("skinWeight",_Z.call(i,e.skinWeights))}
3140return null!==e.boundingSphere&&(t.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(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 rz,i=e.geometry;if(e.isPoints||e.isLine){let e=new rP(3*i.vertices.length,3),r=new rP(3*i.colors.length,3);if(t.setAttribute("position",_Q.call(e,i.vertices)),t.setAttribute("color",_X.call(r,i.colors)),i.lineDistances&&i.lineDistances.length===i.vertices.length){let e=new rP(i.lineDistances.length,1);t.setAttribute("lineDistance",_q.call(e,i.lineDistances))}null!==i.boundingSphere&&(t.boundingSphere=i.boundingSphere.clone()),null!==i.boundingBox&&(t.boundingBox=i.boundingBox.clone())}else e.isMesh&&(t=i.toBufferGeometry());return t}};_W.prototype.isGeometry=!0;var _H=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 e=a[r];e.materialIndex!==s&&(s=e.materialIndex,void 0!==i&&(i.count=3*r-i.start,t.push(i)),i={start:3*r,materialIndex:s})}void 0!==i&&(i.count=3*r-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,o=e.morphTargets,h=o.length,c;if(h>0){c=[];for(let e=0;e<h;e++)c[e]={name:o[e].name,data:[]};this.morphTargets.position=c}let d=e.morphNormals,u=d.length,p;if(u>0){p=[];for(let e=0;e<u;e++)p[e]={name:d[e].name,data:[]};this.morphTargets.normal=p}let f=e.skinIndices,m=e.skinWeights,g=f.length===i.length,v=m.length===i.length;i.length>0&&0===t.length&&console.error("THREE.DirectGeometry: Faceless geometries are not supported.");for(let e=0;e<t.length;e++){let y=t[e];this.vertices.push(i[y.a],i[y.b],i[y.c]);let x=y.vertexNormals;if(3===x.length)this.normals.push(x[0],x[1],x[2]);else{let e=y.normal;this.normals.push(e,e,e)}let b=y.vertexColors;if(3===b.length)this.colors.push(b[0],b[1],b[2]);else{let e=y.color;this.colors.push(e,e,e)}if(!0===s){let t=r[0][e];void 0!==t?this.uvs.push(t[0],t[1],t[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",e),this.uvs.push(new tZ,new tZ,new tZ))}if(!0===a){let t=r[1][e];void 0!==t?this.uvs2.push(t[0],t[1],t[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",e),this.uvs2.push(new tZ,new tZ,new tZ))}for(let e=0;e<h;e++){let t=o[e].vertices;c[e].data.push(t[y.a],t[y.b],t[y.c])}for(let t=0;t<u;t++){let i=d[t].vertexNormals[e];p[t].data.push(i.a,i.b,i.c)}g&&this.skinIndices.push(f[y.a],f[y.b],f[y.c]),v&&this.skinWeights.push(m[y.a],m[y.b],m[y.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,null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),this}},_G=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 iy,this.vertexNormals=Array.isArray(r)?r:[],this.color=s&&s.isColor?s:new ir,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 _q(e){return this.array.set(e),this}function _X(e){let t=this.array,i=0;for(let r=0,s=e.length;r<s;r++){let s=e[r];void 0===s&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",r),s=new ir),t[i++]=s.r,t[i++]=s.g,t[i++]=s.b}return this}function _Y(e){let t=this.array,i=0;for(let r=0,s=e.length;r<s;r++){let s=e[r];void 0===s&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",r),s=new tZ),t[i++]=s.x,t[i++]=s.y}return this}function _Q(e){let t=this.array,i=0;for(let r=0,s=e.length;r<s;r++){let s=e[r];void 0===s&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",r),s=new iy),t[i++]=s.x,t[i++]=s.y,t[i++]=s.z}return this}function _Z(e){let t=this.array,i=0;for(let r=0,s=e.length;r<s;r++){let s=e[r];void 0===s&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",r),s=new id),t[i++]=s.x,t[i++]=s.y,t[i++]=s.z,t[i++]=s.w}return this}var _K=["a","b","c"];function _J(e,t,i){let r=Math.min(e,t),s=Math.max(e,t);return i.get(r+"_"+s)}function _$(e,t,i,r,s,a){let o=Math.min(e,t),h=Math.max(e,t),c=o+"_"+h,d;r.has(c)?d=r.get(c):(d={a:i[o],b:i[h],newEdge:null,faces:[]},r.set(c,d)),d.faces.push(s),a[e].edges.push(d),a[t].edges.push(d)}function _0(e,t,i,r,s){e.push(new _G(t,i,r,void 0,void 0,s))}function _1(e,t){return Math.abs(t-e)/2+Math.min(e,t)}function _2(e,t,i,r){e.push([t.clone(),i.clone(),r.clone()])}var _3=class{constructor(e=1){this.subdivisions=e}modify(e){(e=e instanceof rz?new _W().fromBufferGeometry(e):e.clone()).mergeVertices();let t=this.subdivisions;for(;t-- >0;)this._smooth(e);return e.computeFaceNormals(),e.computeVertexNormals(),e}_smooth(e){let t,i,r,s=new iy,a,o,h,c,d,u=e.vertices,p=e.faces,f=e.faceVertexUvs[0],m=void 0!==f&&f.length>0,g=[],v=new Map;for(t=0,i=u.length;t<i;t++)g[t]={edges:[]};for(t=0,i=p.length;t<i;t++)_$((r=p[t]).a,r.b,u,v,r,g),_$(r.b,r.c,u,v,r,g),_$(r.c,r.a,u,v,r,g);let y=[],x,b,w,_,S,C,M;for(let e of Array.from(v.keys())){for(b=v.get(e),w=new iy,S=3/8,C=1/8,2!=(M=b.faces.length)&&(S=.5,C=0),w.addVectors(b.a,b.b).multiplyScalar(S),s.set(0,0,0),c=0;c<M;c++){for(_=b.faces[c],d=0;d<3&&((x=u[function(e,t){switch(t){case"c":return e.c;case"b":return e.b;default:return e.a}}(_,_K[d])])===b.a||x===b.b);d++);x&&s.add(x)}s.multiplyScalar(C),w.add(s),b.newEdge=y.length,y.push(w)}let E,A,T,P,D,O,L,I=[];for(o=0,h=u.length;o<h;o++){for(O=u[o],3==(a=(D=g[o].edges).length)?E=3/16:a>3&&(E=3/(8*a)),A=1-a*Number(E),T=E,a<=2&&2==a&&(A=3/4,T=1/8),L=O.clone().multiplyScalar(A),s.set(0,0,0),c=0;c<a;c++)x=(P=D[c]).a!==O?P.a:P.b,s.add(x);s.multiplyScalar(Number(T)),L.add(s),I.push(L)}let R=I.concat(y),k=I.length,B,z,N,F=[],j=[],U,V,W,H,G=new tZ,q=ne
vendor: 27,111 bytes, lines 3140-3141
3140w tZ,X=new tZ;for(o=0,h=p.length;o<h;o++)B=Number(_J((_=p[o]).a,_.b,v).newEdge)+k,_0(F,B,z=Number(_J(_.b,_.c,v).newEdge)+k,N=Number(_J(_.c,_.a,v).newEdge)+k,_.materialIndex),_0(F,_.a,B,N,_.materialIndex),_0(F,_.b,z,B,_.materialIndex),_0(F,_.c,N,z,_.materialIndex),m&&(V=(U=f[o])[0],W=U[1],H=U[2],G.set(_1(V.x,W.x),_1(V.y,W.y)),q.set(_1(W.x,H.x),_1(W.y,H.y)),X.set(_1(V.x,H.x),_1(V.y,H.y)),_2(j,G,q,X),_2(j,V,G,X),_2(j,W,q,G),_2(j,H,X,q));e.vertices=R,e.faces=F,m&&(e.faceVertexUvs[0]=j)}},_4=new iy,_5=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=e.geometry??t?.geometry??new rz().copy(new r$(100,100,100)),r;void 0===t?(i.computeBoundingBox(),i.boundingBox.getSize(_4),r={width:_4.x,height:_4.y,depth:_4.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 rz().copy(new r$(100,100,100)),o=a.userData.parameters;void 0===o?(a.computeBoundingBox(),a.boundingBox.getSize(_4)):_4.set(o.width,o.height,o.depth),(t!==_4.x||i!==_4.y||r!==_4.z)&&a.scale(0===_4.x?1:t/_4.x,0===_4.y?1:i/_4.y,0===_4.z?1:r/_4.z);let h=a.originalGeometry;try{s>0?(void 0===h||o?.subdivisions!==s)&&(void 0===h&&(h=a),a=new _3(s).modify(h).toBufferGeometry()):(void 0!==h&&(a=h),h=void 0,void 0===a.getAttribute("normal")&&a.computeVertexNormals())}catch{void 0!==h&&(a=h),h=void 0,void 0===a.getAttribute("normal")&&a.computeVertexNormals()}return void 0!==h&&Object.assign(a,{originalGeometry:h}),delete e.geometry,Object.assign(a,{userData:{...e,type:"NonParametricGeometry"}})}static loadFromUrl(e,t,i){new lm(i).load(e,e=>{let i=this.normalizeInputs({geometry:e});e.boundingBox.getSize(_4);let r=100/_4.x;Object.assign(i.parameters,{width:100,height:_4.y*r,depth:_4.z*r}),t(this.build(i))})}},_6=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,depth:0,spikes:5,cornerRadius:0,extrudeBevelSize:0,extrudeBevelSegments:3},e.parameters);return{shape:e.shape&&e.shape instanceof w6?e.shape:new w6,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:o,extrudeBevelSegments:h}=e.parameters,c=e.shape,d=.5*t,u=.5*i,p=2*Math.PI/r;for(let e=0;e<r;e++){let t=p*e,i=0+Math.sin(t)*d,r=0+Math.cos(t)*u;c.addPoint(c.createPoint(i,r))}c.isClosed=!0;for(let e=0,t=c.points.length;e<t;e++)c.points[e].roundness=s;return c.roundness=s,c.update(),Object.assign(_M.create({shape:c,parameters:{roundness:s,depth:a,extrudeBevelSize:o,extrudeBevelSegments:h}}),{userData:{...e,type:"PolygonGeometry"}})}},_8=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,radialSegments:4,heightSegments:1,cornerRadius:0,cornerSegments:8,openEnded:!1},e.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(e){let{width:t,height:i,depth:r,radialSegments:s,heightSegments:a,openEnded:o,cornerRadius:h,cornerSegments:c}=e.parameters,d=new Se(.5*t,i,s,a,o,h,c);return d.scale(1,1,r/t),Object.assign(d,{userData:{...e,type:"PyramidGeometry"}})}};function _9(e,t,i){i.x=e.x*t.x,i.y=e.y,i.z=e.x*t.y}function _7(e,t,i,r,s,a){let o=t.clone().sub(e),h=i.clone().sub(e),c=o.angleTo(h);if(o.normalize(),h.normalize(),r===s){let t=o.add(h).normalize();a.copy(e).addScaledVector(t,r/Math.sin(c/2))}else{let t=o.angleTo(h);a.copy(e),a.addScaledVector(o,s/Math.sin(t)),a.addScaledVector(h,r/Math.sin(t))}}var Se=class extends rz{constructor(e=.5,t=1,i=4,r=1,s=!1,a=0,o=4){let h;super(),i=Math.floor(Math.max(3,i)),r=Math.floor(r),o=Math.floor(o);let c=[],d=[],u=[],p=[],f=0,m=t/2,g=Math.PI/i,v=e*Math.cos(Math.PI/i),y=2*Math.PI/i,x=Math.PI-(i-2)*Math.PI/i,b=new iy(0,-m,0),w=new iy(0,m,0),_=new tZ(e,-m),S=new tZ(v,-m),C=new tZ(0,w.y).sub(S),M=new tZ(0,w.y).sub(_),E=new tZ(C.y,-C.x).normalize(),A=new tZ(M.y,-M.x).normalize(),T=e*Math.cos(Math.PI/i)*Math.tan((Math.PI-C.angle())/2)-1e-8;a=Math.min(a,T);{let e=new iy(E.x,E.y,0),t=new iy(Math.cos(y)*e.x,e.y,Math.sin(y)*e.x);h=e.angleTo(t)}let P=a/Math.tan((Math.PI-C.angle())/2),D=a/Math.tan((Math.PI-h)/2),O=new iy;if(!s){d.push(b.x,b.y,b.z),u.push(0,-1,0),p.push(0,0);let e=f++,t=[],r=_.clone(),s=P/Math.cos(Math.PI/i);r.x-=s;for(let e=0;e<i;e++){let s=e/i*Math.PI*2+g;_9(r,new tZ(Math.sin(s),Math.cos(s)),O),d.push(O.x,O.y,O.z),u.push(0,-1,0),p.push(0,0),t.push(f++)}for(let i=0;i<t.length;i++)c.push(t[i],e,t[(i+1)%t.length])}let L=[];{let e=new iy,t=new iy,r=new iy,s=new iy,m=new iy,v=new iy;for(let y=0;y<i;y++){let S=y/i*Math.PI*2+g,T=(y+.5)/i*Math.PI*2+g,O=(y+1)/i*Math.PI*2+g,R=new tZ(Math.sin(S),Math.cos(S)),k=new tZ(Math.sin(T),Math.cos(T)),B=new tZ(Math.sin(O),Math.cos(O));_9(_,R,t),_9(_,B,r),_9(E,k,e),_7(w,t,r,D,D,s),d.push(s.x,s.y,s.z),_7(t,w,r,D,P,m),d.push(m.x,m.y,m.z),_7(r,t,w,P,D,v),d.push(v.x,v.y,v.z),u.push(e.x,e.y,e.z),u.push(e.x,e.y,e.z),u.push(e.x,e.y,e.z),p.push(0,0),p.push(0,0),p.push(0,0);let z=f++,N=f++,F=f++;if(c.push(z,N,F),a>0){let g,y;{let e=t.clone().add(r).multiplyScalar(.5),i=w.clone().sub(e).normalize(),s=b.clone().sub(e).normalize().add(i).normalize().multiplyScalar(-1);I(e,v.clone().sub(m),s,C.angle())}{let e=new iy;_9(A,B,e);let t=v.clone().add(s).multiplyScalar(.5);t=function(e,t,i){let r=e.clone().sub(t),s=i.clone().sub(t);return r.projectOnVector(s),r.add(t)}(t,r,w);let i=v.clone().sub(s);[g,y]=I(t,i,e,h,s.y)}{let e=g,t=e.clone().setY(0).normalize(),i=new iy(0,-1,0),r=t.clone().cross(i);!function(e,t,i,r){let s=Math.PI/2,h=M.angle()-s,m=[],g=new iy,v=new iy;for(let c=0;c<=o;c++){let y=[],b=c/o;for(let o=0;o<=c;o++){let m=((c?o/c:0)-.5)*x,w=Math.cos(m),_=Math.sin(m),S=(s+Math.atan(Math.tan(h)*w))*b,C=Math.cos(S),M=Math.sin(S);g.set(0,0,0),g.addScaledVector(t,M*w),g.addScaledVector(i,C),g.addScaledVector(r,M*_),v.copy(e).addScaledVector(g,a),d.push(v.x,v.y,v.z),u.push(g.x,g.y,g.z),p.push(0,0),y.push(f++)}m.push(y)}let y=m.length-1;for(let e=0;e<y;e++){let t=m[e],i=m[e+1],r=t.length-1;c.push(t[0],i[1],i[0]);for(let e=1;e<=r;e++)c.push(t[e-1],t[e],i[e]),c.push(t[e],i[e+1],i[e])}}(e,t,i,r)}L.concat(y);{let t=C.angle(),r=Math.PI-t,s=w.clone();s.y-=a/Math.sin(t-Math.PI/2);let h=new iy,m=[];for(let t=0;t<o;t++){let c=[],g=Math.PI/2-r*t/o,v=Math.cos(g),y=Math.sin(g),x=T;for(let r=0;r<=t;r++){let r=Math.cos(x);e.x=v*Math.sin(x),e.y=y,e.z=v*r,h.copy(s).addScaledVector(e,a),d.push(h.x,h.y,h.z),u.push(e.x,e.y,e.z),p.push(0,0),c.push(f++),x+=2*Math.PI/t/i}m.push(c)}y.reverse(),m.push(y);let g=m.length-1;for(let e=0;e<g;e++){let t=m[e],i=m[e+1],r=t.length-1;c.push(i[1],t[0],i[0]);for(let e=1;e<=r;e++)c.push(t[e],t[e-1],i[e]),c.push(i[e+1],t[e],i[e])}}}}}function I(e,t,i,r,s){let h=-r/2,m=(Math.PI-r)/2,g=t.clone().normalize().cross(i);e.addScaledVector(i,-a/Math.sin(m));let v=new iy,y=new iy,x=f,b=[];for(let c=0;c<=o;c++){let m=h+c/o*r;y.set(0,0,0),y.addScaledVector(g,Math.sin(m)),y.addScaledVector(i,Math.cos(m));for(let i=0;i<=1;i++){let r=i/1-.5;if(v.copy(e),v.addScaledVector(t,r),v.addScaledVector(y,a),null!=s){let e=Math.max(0,v.y-s);v.addScaledVector(t,-e/t.y)}d.push(v.x,v.y,v.z),u.push(y.x,y.y,y.z),p.push(0,0),0===i&&b.push(f),f++}}for(let e=0;e<o;e++)for(let t=0;t<1;t++){let i=x+t+2*e,r=i+2,s=r+1,a=i+1;c.push(i,r,a),c.push(r,s,a)}return[e.clone().addScaledVector(t,.5),b]}this.setIndex(c),this.setAttribute("position",new rP(d,3)),this.setAttribute("normal",new rP(u,3)),this.setAttribute("uv",new rP(p,2))}},St=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,depth:0,cornerRadius:[0,0,0,0],cornerType:1,extrudeBevelSize:0,extrudeBevelSegments:1},e.parameters),r=Object.assign(t?.ui??{enabledIndieCorners:!1},e.ui);return{shape:e.shape&&e.shape instanceof w6?e.shape:new w6,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:o,extrudeBevelSize:h,extrudeBevelSegments:c}=e.parameters,d={x:.5*i,y:.5*r},u={x:-d.x,y:-d.y},p={x:d.x,y:d.y};function f(e,t,s){return t>i&&s>r?Math.min(e*i/t,e*r/s):t>i?e*i/t:s>r?e*r/s:e}let m=[];m[0]=0===s[0]?0:f(s[0],s[0]+s[3],s[0]+s[1]),m[1]=0===s[1]?0:f(s[1],s[1]+s[2],s[1]+s[0]),m[2]=0===s[2]?0:f(s[2],s[2]+s[1],s[2]+s[3]),m[3]=0===s[3]?0:f(s[3],s[3]+s[0],s[3]+s[2]);let g=u.x,v=p.x,y=p.y,x=u.y;t.addPoint(t.createPoint(g,y)),t.addPoint(t.createPoint(v,y)),t.addPoint(t.createPoint(v,x)),t.addPoint(t.createPoint(g,x)),t.isClosed=!0;let b=!0;for(let e=0,i=t.points.length;e<i;e++)t.points[e].roundness=m[e],e>0&&m[e]!==m[e-1]&&(b=!1);return b&&(t.roundness=m[0]),t.useCubicForRoundedCorners=1!==a,t.update(),Object.assign(_M.create({shape:t,parameters:{depth:o,extrudeBevelSize:h,extrudeBevelSegments:c}}),{userData:{...e,type:"RectangleGeometry"}})}},Si=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,widthSegments:64,heightSegments:64,phiStart:0,phiLength:2*Math.PI,thetaStart:0,thetaLength:180},e.parameters);return i.thetaLength=tQ.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:o,phiLength:h,thetaStart:c,thetaLength:d}=e.parameters,u;return 0===d?(u=new rz).setAttribute("position",new rP([],3)):u=new oL(.5*t,s,a,o,h,c,d*tQ.DEG2RAD),u.scale(1,i/t,r/t),Object.assign(u,{userData:{...e,type:"SphereGeometry"}})}},Sr=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,depth:0,widthSegments:8,heightSegments:8},e.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:0})}}static build(e){let{width:t=100,height:i=t,widthSegments:r=8,heightSegments:s=8}=e.parameters,a=new sc(t,i,r,s);return a.scale(1,1,1),Object.assign(a,{userData:{...e,type:"PlaneGeometry"}})}},Ss=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,angle:90,cornerRadius:24,cornerSegments:8},e.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(e){let{width:t,height:i,depth:r,angle:s,cornerRadius:a,cornerSegments:o}=e.parameters;return Object.assign(new Sa(t,i,r,s,a,o),{userData:{...e,type:"BackdropGeometry"}})}},Sa=class extends rz{constructor(e=1,t=1,i=1,r=90,s=10,a=24){super(),this.type="BackdropGeometry";let o=[],h=[],c=[];0==s&&(a=1),a=Math.max(1,Math.floor(a)),s=Math.min(s,100),r=Math.PI/180*Math.min(179.999,r);let d=[],u=Math.PI/2,p=(e=0,t=0,i=0)=>new iy(e,t,i),f=p(),m=p(),[g,v,y]=[t/2,e/2,i/2],x=-v,b=+v,[w,_,S]=[p(x,-g,+y),p(x,-g,-y),p(x,+g,-y)],C=(e,t=!1)=>Math.sin(e-Math.PI/(1+ +t)),M=(e,t=!1)=>Math.cos(e-Math.PI/(1+ +t));S.y=Math.sin(r)*t-g;let E=Math.cos(r)*t-y,A=w.z-.001;r<=u?(S.z=Math.min(E,A),S.z==A&&(S.y-=(E-A)/Math.tan(u-r))):_.z=Math.min(_.z-E-y,w.z-.001),f.subVectors(w,_),m.subVectors(S,_);let T=Math.min(f.length(),m.length())*s/100,P=T*Math.tan(r/2),D=T/Math.cos(r/2),O=f.clone().normalize().add(m.normalize()).setLength(D).add(_);f.set(0,C(r,!0),M(r,!0)),d.push([S,f.clone()]);let L=(Math.PI-r)/a;for(let e=0;e<=a;e++){let t=u+r+e*L;f.set(0,Math.sin(t)*P,Math.cos(t)*P),f.add(O),m.set(0,C(t),M(t)),d.push([f.clone(),m.clone()])}d.push([w,p(0,1,0)]);let I=Math.sin(L/2)*P*2,R=d.length-1,k=d[0][0].distanceTo(d[1][0]),B=k+I*a+d[R-1][0].distanceTo(d[R][0]);d[0].push(1);for(let e=0;e<=a;e++)d[e+1].push(1-(k+e*I)/B);d[R].push(0);let[z,N,F]=d[0],j,U,V;for(let e=1;e<d.length;e++)[j,U,V]=d[e],o.push(x,z.y,z.z,x,j.y,j.z,b,z.y,z.z,b,z.y,z.z,x,j.y,j.z,b,j.y,j.z),h.push(0,N.y,N.z,0,U.y,U.z,0,N.y,N.z,0,N.y,N.z,0,U.y,U.z,0,U.y,U.z),c.push(0,F,0,V,1,F,1,F,0,V,1,V),[z,N,F]=[j,U,V];this.setAttribute("position",new rP(o,3)),this.setAttribute("normal",new rP(h,3)),this.setAttribute("uv",new rP(c,2))}},Sn=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,depth:0,innerRadiusPercent:38.19,spikes:5,cornerRadius:0,angle:360,extrudeBevelSize:0,extrudeBevelSegments:1},e.parameters);return{shape:e.shape&&e.shape instanceof w6?e.shape:new w6,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:o,depth:h,extrudeBevelSize:c,extrudeBevelSegments:d}=e.parameters,u=e.shape,p=.5*t,f=.5*i,m=o*Math.PI/360/s,g=-(Math.PI/2*3),v=p*r/100,y=f*r/100;if(3===s&&50===r){m=2*Math.PI/s;for(let e=0;e<s;e++){let t=m*e,i=0+Math.sin(t)*p,r=0+Math.cos(t)*f;u.addPoint(u.createPoint(i,r))}}else for(let e=0;e<s;e++){let e=0+Math.cos(g)*p,t=0+Math.sin(g)*f;u.addPoint(u.createPoint(e,t)),g+=m,e=0+Math.cos(g)*v,t=0+Math.sin(g)*y,u.addPoint(u.createPoint(e,t)),g+=m}u.isClosed=!0;for(let e=0,t=u.points.length;e<t;e++)u.points[e].roundness=a;return u.roundness=a,u.update(),Object.assign(_M.create({shape:u,parameters:{roundness:a,depth:h,extrudeBevelSize:c,extrudeBevelSegments:d}}),{userData:{...e,type:"StarGeometry"}})}},So=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,depth:0},e.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??0)})}}static build(e){let{width:t,height:i}=e.parameters;return Object.assign(new sc(t,i),{userData:{...e,type:"TextFrameGeometry"}})}},Sl=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,radialSegments:32,tubularSegments:64,arc:360,cornerRadius:30,cornerSegments:8},e.parameters),r=Math.abs(i.width),s=Math.abs(i.height??i.width);i.shapeBlendNode&&(s=r);let a=Math.round(Math.abs(i.depth??.25*i.width));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:o,cornerRadius:h,cornerSegments:c}=e.parameters,d=function(e,t,i,r,s,a,o,h,c,d){[t,i]=[i,t],o=t/2;let u=tQ.clamp(s/360,0,1);if(0===u){let e=new rz;return e.setAttribute("position",new rP([],3)),e}return 1===u&&(c=0),new _B(!0,e,t,i,r,u,a,o,0,h,c,d)}(t,i,r,.5*t,o,a,0,s,h,c);return d.scale(1,i/t,1),Object.assign(d,{userData:{...e,type:"TorusGeometry"}})}},Sh=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,tubularSegments:64,radialSegments:32,p:2,q:3},e.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width),tube:i.tube??.125*i.width})}}static build(e){let{width:t,tube:i,tubularSegments:r,radialSegments:s,p:a,q:o}=e.parameters,h=.5*t;return h!==i&&(h-=i),Object.assign(new oR(h,i,r,s,a,o),{userData:{...e,type:"TorusKnotGeometry"}})}},Sc=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,depth:0,spikes:5,cornerRadius:0,extrudeBevelSize:0,extrudeBevelSegments:1,isRect:!1},e.parameters);return{shape:e.shape&&e.shape instanceof w6?e.shape:new w6,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:o,isRect:h}=e.parameters,c=e.shape,d=.5*t,u=.5*i;h?c.addPoint(c.createPoint(-d,u)):c.addPoint(c.createPoint(0,u)),c.addPoint(c.createPoint(d,-u)),c.addPoint(c.createPoint(-d,-u)),c.isClosed=!0;for(let e=0,t=c.points.length;e<t;e++)c.points[e].roundness=r;return c.roundness=r,c.update(),Object.assign(_M.create({shape:c,parameters:{roundness:r,depth:s,extrudeBevelSize:a,extrudeBevelSegments:o}}),{userData:{...e,type:"TriangleGeometry"}})}},Sd=function(e){e=e.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,(e,t,i,r)=>String(t+t+i+i+r+r));let t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16)}:null},Su=class{add(e,t,i){if("string"!=typeof arguments[0])for(let e in arguments[0])this.add(e,arguments[0][e],arguments[1]);else(Array.isArray(e)?e:[e]).forEach(function(e){this[e]=this[e]||[],t&&this[e][i?"unshift":"push"](t)},this)}run(e,t){this[e]=this[e]||[],this[e].forEach(function(e){e.call(t&&t.context?t.context:t,t)})}},Sp=class{constructor(e){this.jsep=e,this.registered={}}register(...e){e.forEach(e=>{if("object"!=typeof e||!e.name||!e.init)throw Error("Invalid JSEP plugin format");this.registered[e.name]||(e.init(this.jsep),this.registered[e.name]=e)})}},Sf=class{static get version(){return"1.3.8"}static toString(){return"JavaScript Expression Parser (JSEP) v"+Sf.version}static addUnaryOp(e){return Sf.max_unop_len=Math.max(e.length,Sf.max_unop_len),Sf.unary_ops[e]=1,Sf}static addBinaryOp(e,t,i){return Sf.max_binop_len=Math.max(e.length,Sf.max_binop_len),Sf.binary_ops[e]=t,i?Sf.right_associative.add(e):Sf.right_associative.delete(e),Sf}static addIdentifierChar(e){return Sf.additional_identifier_chars.add(e),Sf}static addLiteral(e,t){return Sf.literals[e]=t,Sf}static removeUnaryOp(e){return delete Sf.unary_ops[e],e.length===Sf.max_unop_len&&(Sf.max_unop_len=Sf.getMaxKeyLen(Sf.unary_ops)),Sf}static removeAllUnaryOps(){return Sf.unary_ops={},Sf.max_unop_len=0,Sf}static removeIdentifierChar(e){return Sf.additional_identifier_chars.delete(e),Sf}static removeBinaryOp(e){return delete Sf.binary_ops[e],e.length===Sf.max_binop_len&&(Sf.max_binop_len=Sf.getMaxKeyLen(Sf.binary_ops)),Sf.right_associative.delete(e),Sf}static removeAllBinaryOps(){return Sf.binary_ops={},Sf.max_binop_len=0,Sf}static removeLiteral(e){return delete Sf.literals[e],Sf}static removeAllLiterals(){return Sf.literals={},Sf}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 Sf(e).parse()}static getMaxKeyLen(e){return Math.max(0,...Object.keys(e).map(e=>e.length))}static isDecimalDigit(e){return e>=48&&e<=57}static binaryPrecedence(e){return Sf.binary_ops[e]||0}static isIdentifierStart(e){return e>=65&&e<=90||e>=97&&e<=122||e>=128&&!Sf.binary_ops[String.fromCharCode(e)]||Sf.additional_identifier_chars.has(String.fromCharCode(e))}static isIdentifierPart(e){return Sf.isIdentifierStart(e)||Sf.isDecimalDigit(e)}throwError(e){let t=Error(e+" at character "+this.index);throw t.index=this.index,t.description=e,t}runHook(e,t){if(Sf.hooks[e]){let i={context:this,node:t};return Sf.hooks.run(e,i),i.node}return t}searchHook(e){if(Sf.hooks[e]){let t={context:this};return Sf.hooks[e].find(function(e){return e.call(t.context,t),t.node}),t.node}}gobbleSpaces(){let e=this.code;for(;e===Sf.SPACE_CODE||e===Sf.TAB_CODE||e===Sf.LF_CODE||e===Sf.CR_CODE;)e=this.expr.charCodeAt(++this.index);this.runHook("gobble-spaces")}parse(){this.runHook("before-all");let e=this.gobbleExpressions(),t=1===e.length?e[0]:{type:Sf.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)===Sf.SEMCOL_CODE||i===Sf.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,Sf.max_binop_len),t=e.length;for(;t>0;){if(Sf.binary_ops.hasOwnProperty(e)&&(!Sf.isIdentifierStart(this.code)||this.index+e.length<this.expr.length&&!Sf.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,o,h,c;if(!(a=this.gobbleToken())||!(t=this.gobbleBinaryOp()))return a;for(s={value:t,prec:Sf.binaryPrecedence(t),right_a:Sf.right_associative.has(t)},(o=this.gobbleToken())||this.throwError("Expected expression after "+t),r=[a,s,o];t=this.gobbleBinaryOp();){if(0===(i=Sf.binaryPrecedence(t))){this.index-=t.length;break}s={value:t,prec:i,right_a:Sf.right_associative.has(t)},c=t;let h=e=>s.right_a&&e.right_a?i>e.prec:i<=e.prec;for(;r.length>2&&h(r[r.length-2]);)o=r.pop(),t=r.pop().value,a=r.pop(),e={type:Sf.BINARY_EXP,operator:t,left:a,right:o},r.push(e);(e=this.gobbleToken())||this.throwError("Expected expression after "+c),r.push(s,e)}for(h=r.length-1,e=r[h];h>1;)e={type:Sf.BINARY_EXP,operator:r[h-1].value,left:r[h-2],right:e},h-=2;return e}gobbleToken(){let e,t,i,r;if(this.gobbleSpaces(),r=this.searchHook("gobble-token"))return this.runHook("after-token",r);if(e=this.code,Sf.isDecimalDigit(e)||e===Sf.PERIOD_CODE)return this.gobbleNumericLiteral();if(e===Sf.SQUOTE_CODE||e===Sf.DQUOTE_CODE)r=this.gobbleStringLiteral();else if(e===Sf.OBRACK_CODE)r=this.gobbleArray();else{for(i=(t=this.expr.substr(this.index,Sf.max_unop_len)).length;i>0;){if(Sf.unary_ops.hasOwnProperty(t)&&(!Sf.isIdentifierStart(this.code)||this.index+t.length<this.expr.length&&!Sf.isIdentifierPart(this.expr.charCodeAt(this.index+t.length)))){this.index+=i;let e=this.gobbleToken();return e||this.throwError("missing unaryOp argument"),this.runHook("after-token",{type:Sf.UNARY_EXP,operator:t,argument:e,prefix:!0})}t=t.substr(0,--i)}Sf.isIdentifierStart(e)?(r=this.gobbleIdentifier(),Sf.literals.hasOwnProperty(r.name)?r={type:Sf.LITERAL,value:Sf.literals[r.name],raw:r.name}:r.name===Sf.this_str&&(r={type:Sf.THIS_EXP})):e===Sf.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===Sf.PERIOD_CODE||t===Sf.OBRACK_CODE||t===Sf.OPAREN_CODE||t===Sf.QUMARK_CODE;){let i;if(t===Sf.QUMARK_CODE){if(this.expr.charCodeAt(this.index+1)!==Sf.PERIOD_CODE)break;i=!0,this.index+=2,this.gobbleSpaces(),t=this.code}this.index++,t===Sf.OBRACK_CODE?(e={type:Sf.MEMBER_EXP,computed:!0,object:e,property:this.gobbleExpression()},this.gobbleSpaces(),(t=this.code)!==Sf.CBRACK_CODE&&this.throwError("Unclosed ["),this.index++):t===Sf.OPAREN_CODE?e={type:Sf.CALL_EXP,arguments:this.gobbleArguments(Sf.CPAREN_CODE),callee:e}:(t===Sf.PERIOD_CODE||i)&&(i&&this.index--,this.gobbleSpaces(),e={type:Sf.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(;Sf.isDecimalDigit(this.code);)e+=this.expr.charAt(this.index++);if(this.code===Sf.PERIOD_CODE)for(e+=this.expr.charAt(this.index++);Sf.isDecimalDigit(this.code);)e+=this.expr.charAt(this.index++);if("e"===(t=this.char)||"E"===t){for(e+=this.expr.charAt(this.index++),("+"===(t=this.char)||"-"===t)&&(e+=this.expr.charAt(this.index++));Sf.isDecimalDigit(this.code);)e+=this.expr.charAt(this.index++);Sf.isDecimalDigit(this.expr.charCodeAt(this.index-1))||this.throwError("Expected exponent ("+e+this.char+")")}return i=this.code,Sf.isIdentifierStart(i)?this.throwError("Variable names cannot start with a number ("+e+this.char+")"):(i===Sf.PERIOD_CODE||1===e.length&&e.charCodeAt(0)===Sf.PERIOD_CODE)&&this.throwError("Unexpected period"),{type:Sf.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 t=this.expr.charAt(this.index++);if(t===i){r=!0;break}if("\\"===t)switch(t=this.expr.charAt(this.index++)){case"n":e+=`
3141`;break;case"r":e+="\r";break;case"t":e+="	";break;case"b":e+="\b";break;case"f":e+="\f";break;case"v":e+="\v";break;default:e+=t}else e+=t}return r||this.throwError('Unclosed quote after "'+e+'"'),{type:Sf.LITERAL,value:e,raw:this.expr.substring(t,this.index)}}gobbleIdentifier(){let e=this.code,t=this.index;for(Sf.isIdentifierStart(e)?this.index++:this.throwError("Unexpected "+this.char);this.index<this.expr.length&&(e=this.code,Sf.isIdentifierPart(e));)this.index++;return{type:Sf.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===Sf.CPAREN_CODE&&r&&r>=t.length&&this.throwError("Unexpected token "+String.fromCharCode(e));break}if(s===Sf.COMMA_CODE){if(this.index++,++r!==t.length){if(e===Sf.CPAREN_CODE)this.throwError("Unexpected token ,");else if(e===Sf.CBRACK_CODE)for(let e=t.length;e<r;e++)t.push(null)}}else if(t.length!==r&&0!==r)this.throwError("Expected comma");else{let e=this.gobbleExpression();e&&e.type!==Sf.COMPOUND||this.throwError("Expected comma"),t.push(e)}}return i||this.throwError("Expected "+String.fromCharCode(e)),t}gobbleGroup(){this.index++;let e=this.gobbleExpressions(Sf.CPAREN_CODE);if(this.code===Sf.CPAREN_CODE)return this.index++,1===e.length?e[0]:!!e.length&&{type:Sf.SEQUENCE_EXP,expressions:e};this.throwError("Unclosed (")}gobbleArray(){return this.index++,{type:Sf.ARRAY_EXP,elements:this.gobbleArguments(Sf.CBRACK_CODE)}}};Object.assign(Sf,{hooks:new Su,plugins:new Sp(Sf),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"}),Sf.max_unop_len=Sf.getMaxKeyLen(Sf.unary_ops),Sf.max_binop_len=Sf.getMaxKeyLen(Sf.binary_ops);var Sm=e=>new Sf(e).parse();function Sg(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(e){e(i)}),(r=e.get("*"))&&r.slice().map(function(e){e(t,i)})}}}
3141Object.getOwnPropertyNames(Sf).forEach(e=>{void 0===Sm[e]&&"prototype"!==e&&(Sm[e]=Sf[e])}),Sm.Jsep=Sf,Sm.plugins.register({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:"ConditionalExpression",test:i,consequent:r,alternate:s},i.operator&&e.binary_ops[i.operator]<=.9){let r=i;for(;r.right.operator&&e.binary_ops[r.right.operator]<=.9;)r=r.right;t.node.test=r.right,r.right=t.node,t.node=i}}else this.throwError("Expected :")}})}});var Sv=class{constructor(e,t,i){this.id=e,this.userAPI=t,this.result=void 0,this.error="null",this.isPrefetched=!1,this.isLoading=!1,this.isLoaded=!1,this.prefetchPromise=new Promise(e=>e()),this.emitter=Sg(),this._innerCallUserAPI=async e=>{this.emitter.emit("start",{userAPIId:this.id}),this.isLoading=!0,this.isLoading=!1;try{this.result=await Sy(this.userAPI,e),this.error="null",this.emitter.emit("success",{userAPIId:this.id})}catch(t){let e=t.message?.split("_:_")?.[0]?.replace("status:","")??"null";this.error=e,this.result=null,this.emitter.emit("error",{userAPIId:this.id})}this.isLoading=!1,this.isPrefetched=!0,this.isLoaded=!0},t?.integration?.type==="OpenAI"?this.result={content:""}:"GET"===t.method&&""!==t.url&&(this.prefetchPromise=this.prefetch(i)),this._debouncedCallUserAPI=this._innerCallUserAPI,this._updateDebouncedCallUserAPI(),this._debouncedPrefetch=uF(this.prefetch,1e3,{trailing:!0})}_updateDebouncedCallUserAPI(){this._debouncedCallUserAPI=void 0!==this.userAPI.debounce&&this.userAPI.debounce>0?uF(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&&"GET"===this.userAPI.method&&i&&this._debouncedPrefetch(t)}retrieveValue(e){if(this.result)try{return fn.zoom(this.result,e)}catch(e){console.error(e)}}retrieveZoomedKeyValues(e){if(this.result){var t,i;let r=e&&e.length?fn.zoom(this.result,e):this.result;if("object"==typeof(t=r)&&null!==t)return Object.entries(r);if(Array.isArray(r))return r.map((e,t)=>[t.toString(),e]);throw"string"==typeof(i=r)||"number"==typeof i||"boolean"==typeof i||null===i?Error("This path points to a value, use retrieveValue() instead. "+e?.join(".")):Error("Path error"+e?.join("."))}}dispose(){}on(e,t){this.emitter.on(e,t)}off(e,t){this.emitter.off(e,t)}get autostart(){return this.userAPI.autoStart}};async function Sy(e,t,i=new AbortController){let r,s,a=e.url,o=e.proxy?.enabled??!1,h;if(e.integration?.type==="OpenAI"){let i=Sb(""===e.integration.prompt?[]:JSON.parse(e.integration.prompt),t),r=""===e.integration.behavior?[]:Sb(JSON.parse(e.integration.behavior),t);h=`{
3142		"model": "${e.integration.model}",
3143		"messages": [${e.integration.useBehavior?`
3144		{
3145			"role": "system",
3146			"content": "${r}"
3147		},`:""}
3148		{
3149			"role": "user",
3150			"content": "${i}"
3151		}
3152		]
3153	}`}if(o){let i;a=`https://apis.spline.design/file/${e.proxy.fileId}/external-api/request?uuidexternalapi=${e.proxy.proxyId}`,void 0!==h?i=h:"POST"===e.method&&e.body&&(i=Sb(JSON.parse(e.body),t)),void 0!==i&&(a+=`&data=${encodeURIComponent(i.replace(/(\r\n|\n|\r|\t)/gm,""))}`)}else e.integration?.type==="OpenAI"?s=h:"POST"===e.method&&e.body&&(s=Sb(JSON.parse(e.body),t));let c=await fetch(a,{method:o?"GET":e.method,headers:o?void 0:(r=new Headers,e.headers.forEach(e=>{""!==e.data.key&&r.append(e.data.key,e.data.value)}),r),signal:i.signal,body:s});if(!c.ok)throw Error("status:"+c.status+"_:_"+c.statusText);if(e.integration?.type==="OpenAI"){let e=await c.json();return o&&(e=e.response),{content:e.choices[0].message.content}}{let e=await c.json();return o&&(e=e.response),e}}var Sx=(e,t)=>{if("string"==typeof e){let i=t.getVariable(e);if(i)return Sx(i,t)}return y2.isBoolean(e)?y2.getDisplayedValue(e).toLowerCase():y2.getDisplayedValue(e)},Sb=(e,t)=>
3153e.map((e,i)=>{if("text"in e)return e.text;if("type"in e){if("paragraph"===e.type)return(i>0?`
3154`:"")+Sb(e.children,t);if("variable"===e.type){let i=t.getVariable(e.variableId);if(void 0!==i)return Sx(i,t)}}return""}).join(""),Sw=["+","-","*","/","(",")","==","!=",">","<",">=","<=","and","or","!","%","^",","],S_=["0","1","2","3","4","5","6","7","8","9","."],SS=["sin","cos","tan","asin","acos","atan","atan2","sqrt","abs","log","exp","floor","ceil","round","min","max","random"];function SC(e,t,i="number"){let r,s,a="";for(let r=0;r<e.length;r++){var o;let s=e[r];if("objType"in s&&"api"===s.objType){let e=JSON.parse(s.id),i=e[0],r=t.getUserAPI(i);if(void 0!==r&&r instanceof Sv){let t=r.retrieveValue(e.slice(1));void 0!==t&&(a+=t)}continue}if("objType"in s&&"webhook"===s.objType){let[e,i]=JSON.parse(s.id),r=t.getUserWebhook(e);if(void 0!==r){let e=r.getParameterValue(i);void 0!==e&&(a+=e)}continue}if("objType"in s&&"aiAssistant"===s.objType){let e=t.openAIRealtime;if("objId"in s&&void 0!==s.objId){let i;if(t.scene.data.objects.traverse((e,t)=>{let r=t.events?.find(e=>e.id===s.objId);r&&(i=r)}),void 0!==i&&"AIAssistantListener"===i.data.type){let t=e?.computeAnalysisForListenerEvent(i.data);if(void 0!==t){a+=t;continue}}}a+=e?.voice??0;continue}if("id"in s){let o=e[r-1];if(r>0&&"id"in o)return void console.error("Two variables in a row",e);let h=t.getVariable(s.id),c=y2.getDisplayedValue(h);"number"===i&&y2.isTextValue(h)&&Array.isArray(h.textValue)&&1===h.textValue.length?c=parseFloat(c).toString():"boolean"===i&&y2.isBoolean(h)?c=h?"true":"false":"boolean"===i&&y2.isTextValue(h)&&!Array.isArray(h.textValue)&&(c='"'+c+'"'),a+=c;continue}if("string"===i){'"'!==s.name&&("+"!==s.name||s.escaped)&&(a+=s.name),"+"!==s.name||s.escaped||"\\"!==a[a.length-1]||(a=a.slice(0,-1)+s.name);continue}if("and"===s.name){a+="&&";continue}if("or"===s.name){a+="||";continue}if("True"===s.name){a+="true";continue}if("False"===s.name){a+="false";continue}if("boolean"===i&&!("string"==typeof(o=s.name)&&!isNaN(o)&&!isNaN(parseFloat(o)))&&!S_.includes(s.name)&&!Sw.includes(s.name)&&!SS.includes(s.name.replace(/\($/g,""))){a+='"'+s.name+'"';continue}a+=s.name}if("string"===i)return a;if(0===e.length){if("number"===i)return 0;if("boolean"===i)return!1}try{r=Sm(a)}catch(e){console.error(a,e);return}try{s=function e(t){switch(t.type){case"BinaryExpression":switch(t.operator){case"==":return Number(e(t.left)===e(t.right));case"!=":return Number(e(t.left)!==e(t.right));case">":return Number(e(t.left)>e(t.right));case">=":return Number(e(t.left)>=e(t.right));case"<":return Number(e(t.left)<e(t.right));case"<=":return Number(e(t.left)<=e(t.right));case"+":return e(t.left)+e(t.right);case"-":return e(t.left)-e(t.right);case"*":return e(t.left)*e(t.right);case"/":return e(t.left)/e(t.right);case"%":return e(t.left)%e(t.right);case"&&":return e(t.left)&&e(t.right);case"||":return e(t.left)||e(t.right);case"^":return Math.pow(e(t.left),e(t.right));default:throw Error("Unknown operator: "+t.operator)}case"UnaryExpression":switch(t.operator){case"-":return-e(t.argument);case"!":return Number(!e(t.argument));default:throw Error("Unknown operator: "+t.operator)}case"Identifier":throw Error("Unknown identifier: "+t.name);case"Literal":return t.value;case"CallExpression":if("Identifier"===t.callee.type){if("random"===t.callee.name){let i=0,r=1;if(t.arguments.length>=1)try{i=e(t.arguments[0])}catch(e){console.warn(e)}if(t.arguments.length>=2)try{r=e(t.arguments[1])}catch(e){console.warn(e)}return i=Math.min(r,i),r=Math.max(r,i),i+Math.random()*(r-i)}return Math[t.callee.name].apply(null,t.arguments.map(e))}throw Error("Unknown node");default:throw Error("Unknown node type: "+t.type)}}(r)}catch(e){console.error(a,r,e)}return s}Sm.addBinaryOp("^",11,!0);var SM=new iY,SE=new iY,SA=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,height:100,depth:1,subdivisions:12,roundness:0,extrudeBevelSize:0,extrudeBevelSegments:3},e.parameters),r=Math.abs(i.width),s=Math.abs(i.height??i.width),a=Math.abs(i.depth??0),o=t?.shapeData??_A.create({parameters:gY}).userData.shape;return{path:e.path??g5.defaultData(),parameters:Object.assign(i,{width:r,height:s,depth:a,extrusion:{...gQ,...i.extrusion}}),shapeData:o}}static build(e){return e.path.points.length>=2?Object.assign(new ST(e),{userData:{...e,type:"PathGeometry"}}):Object.assign(new rz,{userData:{...e,type:"PathGeometry"}})}},ST=class extends rz{constructor(e){super(),this.type="PathExtrusionGeometry",this.inputs=e,this.build()}_isGeometryClosed(){return this.inputs.path.isClosed&&1===this.inputs.parameters.extrusion.depth}_isOpenEnded(){let e,t=this.inputs.parameters.extrusion;return!(this.inputs.path.isClosed&&1===t.depth)||(t.twist%(e=2*Math.PI)+e)%e!=(0%e+e)%e||t.startScale!==t.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),o=Math.min(Math.max(2,(this.inputs.path.isClosed?Math.ceil((i+r)*s):Math.ceil(Math.min(1,i+r)*s))-a+1),s+2),h=[],c=[];for(let i=0;i<o;i++){let r=this.inputs.path.isClosed?(i+a)%e.length:Math.min(i+a,e.length-1);h.push(e[r].clone()),c.push(t[r].clone())}let d=(e,t,i)=>{var r,s;let a,o;h[e]=h[e].clone().lerp(h[t],i),c[e]=(r=c[e],s=c[t],a=[new iy,new iy,new iy],o=[new iy,new iy,new iy],r.extractBasis(a[0],a[1],a[2]),s.extractBasis(o[0],o[1],o[2]),a.forEach((e,t)=>{let r=o[t],s=tQ.lerp(e.length(),r.length(),i);e.lerp(r,i).setLength(s)}),new iY().makeBasis(a[0],a[1],a[2]))},u=0,p=r*s%1;(!this.inputs.path.isClosed||i<=1)&&(p||0===r)&&d(0,1,u=p);let f=0,m=(r+i)*s%1;if((this.inputs.path.isClosed&&i<=1||!this.inputs.path.isClosed&&r+i<1)&&m&&(f=m,d(h.length-1,h.length-2,1-f)),0===i){let e=h.length-1;h[e].copy(h[0]),c[e].copy(c[0])}this._applyPathModifiers(c,u,f);let{bevel:g,bevelSides:v}=this.inputs.parameters.extrusion,y=g>0?this.inputs.parameters.extrusion.capType:"flat",x=5;"Custom"===this.inputs.parameters.extrusion.shape.type&&(x="low"===this.inputs.parameters.extrusion.shape.shapeQuality?5:12);let{regions:b,infos:w,vertices:_}=this._computeShapePoints(x),S=0,C;"round"===y&&(S=(C=new __(this.inputs.shapeData,2*g,g,x,v,void 0,!0)).getAttribute("position").count);let M=0,E=0;w.sort((e,t)=>
3154e.start-t.start),w.forEach(e=>{e.verticesStart=M,e.verticesCount=e.continuous.reduce((e,t,i)=>e+(0!==i&&t?1:2),0),E+=e.verticesCount,M=E});let A=E*o,T,P=0;if(this._isOpenEnded()&&"flat"===y){try{T=_f({windingRule:SI.ODD,elementType:SR.POLYGONS,polySize:3,vertexSize:2,strict:!0,contours:b})}catch{T=_b}P=T.vertexCount}let D=A+2*P+2*S,O=A+2*P,L={positions:new Float32Array(3*D),normals:new Float32Array(3*D),uvs:new Float32Array(2*D)},I=[];if(w.forEach(e=>{this._extrudeRegion(e,_,c,h,L,I,this._isGeometryClosed()&&!this._isOpenEnded())}),T&&(this._closeEnd(T,A,I,L,c[0],h[0],!1),this._closeEnd(T,A+P,I,L,c[c.length-1],h[h.length-1],!0)),C){L.positions.set(C.getAttribute("position").array,3*O),L.normals.set(C.getAttribute("normal").array,3*O),L.uvs.set(C.getAttribute("uv").array,2*O);for(let e=O;e<O+S;e++)L.uvs[2*e+1]=1e-4;let e=I.length;I.push(...C.getIndex().array.map(e=>e+O)),O+=S,L.positions.set(C.getAttribute("position").array,3*O),L.normals.set(C.getAttribute("normal").array,3*O),L.uvs.set(C.getAttribute("uv").array,2*O);let t=I.length;I.push(...C.getIndex().array.map(e=>e+O)),this.setAttribute("position",new rE(L.positions,3)),this.setAttribute("normal",new rE(L.normals,3)),this.setAttribute("uv",new rE(L.uvs,2)),this.setIndex(I),SM.copy(c[c.length-1]).setPosition(h[h.length-1]),this.applyMatrix4OnRange(SM,O,D),SM.copy(c[0]).setPosition(h[0]).multiply(SE.makeScale(1,1,-1)),this.applyMatrix4OnRange(SM,O-S,O),this.reverseIndicesOnRange(e,t)}else this.setAttribute("position",new rE(L.positions,3)),this.setAttribute("normal",new rE(L.normals,3)),this.setAttribute("uv",new rE(L.uvs,2)),this.setIndex(I)}_extractPathPoints(){let e=wg(this.inputs.path).getPoints(this.inputs.path.subdivisions);if(e.length<2)return[];let t=[e[0]];return e.forEach(e=>{t[t.length-1].distanceToSquared(e)>.001&&t.push(e)}),this.inputs.path.isClosed&&.001>t[t.length-1].distanceTo(t[0])&&t.pop(),t}_computeBasisMatrices(e){let t=[],i=e.length,r=this.inputs.path.isClosed,s=new iy,a=new iy,o=new iy,h=new iy,c=new iy(0,1,0);for(let d=0;d<i;d++){let u,p=e[d],f;f=0===d?r?e[e.length-2]:p.clone().multiplyScalar(2).sub(e[1]):e[d-1],u=d===i-1?r?e[1]:p.clone().multiplyScalar(2).sub(e[d-1]):e[d+1];let m=p.clone().sub(f).normalize(),g=u.clone().sub(p).normalize(),v=m.clone().add(g).normalize();o.copy(v),0===d&&(v.equals(c)||v.clone().negate().equals(c))&&c.set(0,0,1);let y=c.clone().cross(v).normalize(),x=v.clone().cross(y).normalize();c.copy(x),h.copy(y),0===d&&(s.copy(x),a.copy(v));let b=new iY().makeBasis(y,x,v);t.push(b)}let d=r?a:o,u=r?s:new iy(0,1,0),p=d.clone().cross(h).normalize(),f=Math.acos(u.dot(p));if(isNaN(f))return t;let m=u.clone().cross(p);d.dot(m)>0&&(f*=-1);for(let e=1;e<t.length;e++){let i=new iY().makeRotationZ(f*e/t.length);t[e].multiply(i)}return t}_applyPathModifiers(e,t,i){let r=e.length,{angle:s,twist:a,startScale:o,endScale:h}=this.inputs.parameters.extrusion,c=new iY,d=new iY;return e.forEach((e,u)=>{let p=0===u?0:u===r-1?1:(u-t)/(r-(0!==i)-(t+(1-i)));c.makeRotationZ(tQ.lerp(s,s+a,p)*tQ.DEG2RAD);let f=tQ.lerp(o,h,p);d.makeScale(f,f,f),e.multiply(c).multiply(d)}),e}_computeShapePoints(e=12,t=SI.ODD){let i,r=this.inputs.shapeData,s=r.extractShapePointsToFlatArray([],e),a=r.shapeHoles.map(t=>{let i=t.extractShapePointsToFlatArray([],e),r=[];for(let e=i.length-1;e>=1;e-=2){let t=i[e-1],s=i[e-0];r.push(t,s)}return r}),o;try{o=_f({windingRule:t,elementType:SR.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[s]})}catch{o=_y}try{i=_f({windingRule:SI.ODD,elementType:SR.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[...a]})}catch{i=_x}if(!o)throw Error("error generating geometry");let h=o.elementCount;if(i){o.elementCount+=i.elementCount;for(let e=0;e<i.elements.length;e++){let t=i.elements[e],r=e%2==0?o.vertexCount:0;o.elements.push(t+r)}for(let e=0;e<i.vertexIndices.length;e++){let t=i.vertexIndices[e],r=o.vertexCount;o.vertexIndices.push(t+r)}for(let e=0;e<i.vertices.length;e++){let t=i.vertices[e];o.vertices.push(t)}}let c=1/0,d=-1/0,u=1/0,p=-1/0;for(let e=0,t=o.vertexCount;e<t;e++){let t=2*e,i=o.vertices[t+0],r=o.vertices[t+1];i<c&&(c=i),i>d&&(d=i),r<u&&(u=r),r>p&&(p=r)}let f=[];for(let e=o.elementCount-1;e>=0;e--){let t=e>=h,i=2*e,s=o.elements[i+0],a=o.elements[i+1],c=s+a,d={start:s,count:a,normals:[],isHole:t,continuous:[],verticesStart:0,verticesCount:0};f.push(d);let u=s,p=c-1,m=s+1,g=r.roundedCurves.length;do{let e=u-s,i=o.vertices[2*p+0],h=o.vertices[2*p+1],f=o.vertices[2*u+0],v=o.vertices[2*u+1],y=o.vertices[2*m+0],x=o.vertices[2*m+1],b=f-i,w=v-h,_=Math.sqrt(b*b+w*w);b/=_,w/=_;let S=f-y,C=v-x,M=Math.sqrt(S*S+C*C);
3154S/=M,C/=M,d.normals[2*e+0]=-C,d.normals[2*e+1]=S;let E=o.vertexIndices[u];if(Array.isArray(E))d.continuous[e]=!1;else{let[t,i]=r.getCurveIndexFromVertexId(E-1,!0);if(i>0&&i<1)d.continuous[e]=!0;else{let s=1===i?t+1:t-1;s=(s+g)%g;let a=+(1!==i),o=r.roundedCurves[t].getTangent(i),h=r.roundedCurves[s].getTangent(a);d.continuous[e]=o.dot(h)>.95}}t&&(d.normals[2*e+0]*=-1,d.normals[2*e+1]*=-1),[p,u,m]=[u,m,m+1],m>=c&&(m-=a)}while(m!==s+1)}return{regions:[s,...a],infos:f,vertices:o.vertices}}_insertVertex(e,t,i,r,s){let a=2*t,o=3*t;e.positions[o+0]=i.x,e.positions[o+1]=i.y,e.positions[o+2]=i.z,e.normals[o+0]=r.x,e.normals[o+1]=r.y,e.normals[o+2]=r.z,e.uvs[a+0]=s.x,e.uvs[a+1]=s.y}_extrudeRegion(e,t,i,r,s,a,o){let h=new iy,c=new iy,d=new iy,u=new iy,p=new tZ;i.forEach((a,o)=>{let f=r[o],m=e.verticesStart*i.length+e.verticesCount*o;for(let r=0;r<e.count;r++){let g=(e.start+r)*2;if(h.set(t[g+0],t[g+1],0),d.copy(h).applyMatrix4(a).add(f),e.continuous[r])u.set(e.normals[2*r+0],e.normals[2*r+1],0);else{let i=0===r?(e.start+e.count-1)*2:g-2;c.set(t[i+0],t[i+1],0),u.copy(h).sub(c),u.set(-u.y,u.x,0),e.isHole||u.negate()}if(u.applyMatrix4(a).normalize(),p.set(0===r?1:r/e.count,o/(i.length-1)),this._insertVertex(s,m,d,u,p),m++,!e.continuous[r]||0===r){if(0===r)u.set(e.normals[2*r+0],e.normals[2*r+1],0),p.set(0,o/(i.length-1));else{let i=r===e.count-1?2*e.start:g+2;c.set(t[i+0],t[i+1],0),u.copy(c).sub(h),u.set(-u.y,u.x,0),e.isHole||u.negate()}u.applyMatrix4(a).normalize(),this._insertVertex(s,m,d,u,p),m++}}});let f=i.length-1;for(let t=0;t<f;t++){let r=e.verticesStart*i.length+e.verticesCount*t,s=e.verticesStart*i.length+e.verticesCount*(t+1),o=0;for(let t=0;t<e.count;t++){(!e.continuous[t]||0===t)&&o++;let i=t===e.count-1?0:o+1,h=r+o,c=r+i,d=s+i,u=s+o;e.isHole?a.push(h,d,c,h,u,d):a.push(h,c,d,h,d,u),o++}}}_closeEnd(e,t,i,r,s,a,o){let h=e.vertexCount,c=new iy(0,0,o?-1:1).applyMatrix4(s),d=new iy,u=new tZ;for(let i=0;i<h;i++){let o=2*i;d.set(e.vertices[o+0],e.vertices[o+1],0).applyMatrix4(s).add(a),this._insertVertex(r,t+i,d,c,u)}let p=e.elements;for(let r=0;r<e.elementCount;r++){let e=3*r,s=p[e+0]+t,a=p[e+(o?1:2)]+t,h=p[e+(o?2:1)]+t;i.push(s,a,h)}}applyMatrix4OnRange(e,t,i){let r=e.elements,s=new tK().getNormalMatrix(e).elements,a,o,h,c,d=this.attributes.position,u=this.attributes.normal;if(!d||!u)return;let p=d.array,f=u.array,m=d.itemSize;for(let e=t*m,d=i*m;e<d;e+=m)a=p[e+0],o=p[e+1],h=p[e+2],c=1/(r[3]*a+r[7]*o+r[11]*h+r[15]),p[e+0]=(r[0]*a+r[4]*o+r[8]*h+r[12])*c,p[e+1]=(r[1]*a+r[5]*o+r[9]*h+r[13])*c,p[e+2]=(r[2]*a+r[6]*o+r[10]*h+r[14])*c,a=f[e+0],o=f[e+1],h=f[e+2],f[e+0]=s[0]*a+s[3]*o+s[6]*h,f[e+1]=s[1]*a+s[4]*o+s[7]*h,f[e+2]=s[2]*a+s[5]*o+s[8]*h;d.needsUpdate=!0,u.needsUpdate=!0}reverseIndicesOnRange(e,t){let i=this.index;if(i){for(let r=e;r<t;r+=3){let e=i.getX(r),t=i.getX(r+1),s=i.getX(r+2);i.setXYZ(r,s,t,e)}i.needsUpdate=!0}}};function SP(){let e=new rz;return e.setAttribute("position",new rE(new Float32Array([]),3)),e.setIndex(new rE(new Uint16Array([]),1)),e}var SD,SO,SL,SI,SR,Sk,SB=SP().attributes,Sz=class extends rz{constructor(e,t){super(),this.charWidths=[],this.charCoords=[],this.wrappedText=[],this.isLowResolution=!1,this.vectorShapes=[],Object.assign(this.attributes,SB),this.userData={parameters:e,type:"TextGeometry"};let i=t.getFont(e.font);i?.isLoaded?(this.font=i,this.update(e,t)):this.updateFont(e.font,t).then(()=>{this.update(e,t),t?.requestRender()})}async updateFont(e,t){let i=t.getFont(e);i&&(this.font=i,await i.loadingPromise)}update(e,t){let i=this.font;if(this.userData={parameters:e,type:"TextGeometry"},!i?.isLoaded)return void console.warn("Cannot update text because its font is not loaded");let{width:r,height:s,depth:a,extrudeBevelSize:o,extrudeBevelSegments:h,text:c,textTransform:d}=e,u=y2.getDisplayedValue(c),p=function(e,t,i,r){let s="string"==typeof e.width?Number(r.getVariable(e.width)):e.width,a=[""],o="";for(let r of i)o+=r," "===r||r===`
3155`?(a[a.length-1]+=o,o="",r===`
3156`&&a.push("")):t.getTextWidth(a[a.length-1]+o,e)>s&&(a[a.length-1].length&&a.push(""),t.getTextWidth(a[a.length-1]+o,e)>s&&(1===o.length?(a[a.length-1]+=o,o=""):(a[a.length-1]+=o.slice(0,-1),o=o[o.length-1],a.push(""))));return a[a.length-1]+=o,a}(e,i,2===d?u.toUpperCase():3===d?u.toLowerCase():u,t),{shapes:f,charWidths:m,charCoords:g}=i.generateShapes(p,e,t),v=("number"==typeof r?r:Number(t.getVariable(r)))*.5,y=("number"==typeof s?s:Number(t.getVariable(s)))*.5,x=f.map(e=>new w6().fromShape(e,!0));this.vectorShapes=x;let b=x.map(e=>_M.create({shape:e,parameters:{depth:a,extrudeBevelSegments:h,extrudeBevelSize:o,windingRule:a<=0?SI.NONZERO:SI.ODD,subdivisions:this.isLowResolution&&a>0?1:12}})),w=b.length?vV(b):SP();w.translate(-v,y,0),this.dispose(),this.wrappedText=p,this.charCoords=g,this.charWidths=m,this.deleteAttribute("extrudeNormal"),Object.entries(w.attributes).forEac
3156h(([e,t])=>{this.setAttribute(e,t)}),this.setIndex(w.index),this.computeBoundingSphere()}clone(){let e=u0(new rz,Sz.prototype);return e.copy(this),console.log("CloneGeometry",this,e),e}copy(e){return Object.entries(e.attributes).forEach(([e,t])=>{this.setAttribute(e,t)}),this.setIndex(e.index),this.userData={parameters:{...e.userData.parameters},type:"TextGeometry"},this}async setText(e,t){this.font&&await this.font.loadingPromise,await this.update({...this.userData.parameters,text:{textValue:e}},t)}get text(){return this.userData.parameters.text??""}},SN=new Promise(e=>{Sk=e}),SF=!1,Sj=["font"];function SU(e,t,i,r){let s,a,o,h;for(let i of("PathGeometry"===e.type?(a=JSON.parse(JSON.stringify(e)),o=[[],["extrusion"]]):(a={...e},o=[[]]),o)){let e=a;for(let t of i)e=e[t];for(s in e){let a=e[s];gu(a)&&!Sj.includes(s)&&(e[s]=t.getVariable(a,[r.uuid,"geometry",...i,s]),gu(e[s])&&(e[s]=1))}}let c={parameters:a,type:a.type};if("PathGeometry"===a.type)c.path=a.path;else if("VectorGeometry"===a.type)c.shape=w6.createFromState(a.shape,a.width,a.height);else if("NonParametricGeometry"===a.type){if(a.data.groups&&a.data.groups?.forEach(e=>e.materialIndex=Math.max(e.materialIndex??0,0)),c.geometry=new lm().parse(a),0===c.geometry.groups.length){let e=c.geometry;e.addGroup(0,Math.max(e.getIndex()?.count??0,e.getAttribute("position").count),0)}}else if("SubdivGeometry"===a.type){let t=new SK(a,i);return t.data=e,t}else{if("TextGeometry"===a.type||"InputGeometry"===a.type)return new Sz(a,t);if("UIGeometry"===a.type)return St.create({parameters:{width:a.width,height:a.height,cornerRadius:a.cornerRadius,cornerType:a.cornerType}})}try{h=Co(c)}catch(e){console.error(e)}return h||(c.shape=w6.createFromState(g4.defaultData(),100,100),h=Co(c)),h}var SV=new iY;function SW(e,t,i,r){let s=e.position.array,a=e.normal.array,o=SV.makeScale(t,i,r).invert().elements,h,c,d;for(var u=0,p=s.length;u<p;u+=3)s[u]*=t,s[u+1]*=i,s[u+2]*=r,h=a[u],c=a[u+1],d=a[u+2],a[u]=o[0]*h+o[4]*c+o[8]*d,a[u+1]=o[1]*h+o[5]*c+o[9]*d,a[u+2]=o[2]*h+o[6]*c+o[10]*d;e.position.needsUpdate=!0,e.normal.needsUpdate=!0}var SH,SG,Sq=new iw,SX=new iy;SN.then(e=>{SG=e});var SY=new Float32Array([10,10,0,-10,10,0,-10,-10,0,10,-10,0]),SQ=new Uint32Array([0,1,2,3]),SZ=new Uint8Array([4]),SK=class extends rz{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=gr.div(t,i);if(r.every(e=>1===e))return;this.subdividedGeometry&&SW(this.subdividedGeometry.attributes,...r),this.originalGeometry&&SW(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(SX.fromArray(r));let a=SX.set(s.width,s.height,s.depth).length();this.originalGeometry.boundingSphere.radius=a/2}ensureSubdivPointer(){return 0===this.subdivPointer&&this.rebuild(),this.subdivPointer}rebuild(){let e,t,i;try{({originalGeometry:e,subdividedGeometry:t,subdivPointer:i}=SK.build(this.data,void 0,!this.flatShading,void 0))}catch{e=new r$(100,100,100),i=0}this.subdivPointer=i,this.originalGeometry=e,this.subdividedGeometry=t??void 0,Object.assign(this,this.subdividedGeometry??this.originalGeometry),this.calcBoundingBox()}freeSubdivPointer(){this.subdivPointer&&(SK.freeSubdivPointer(this.subdivPointer),this.subdivPointer=0)}dispose(){super.dispose(),this.freeSubdivPointer()}calcBoundingBox(){let e=this.originalGeometry;null===e.boundingSphere&&(e.boundingSphere=new iF,this.subdividedGeometry&&(this.subdividedGeometry.boundingSphere=e.boundingSphere));let t=e.attributes.position,i=e.boundingSphere.center;Sq.setFromBufferAttribute(t),Sq.getCenter(i),e.boundingSphere.radius=i.distanceTo(Sq.max),isNaN(e.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),Sq.getSize(SX);let r={width:SX.x,height:SX.y,depth:SX.z};return this.userData.parameters=r,r}static build(e,t,i,r){let s,a,o,h=e?.phongAngle??35;!1===i&&(h=-1),t&&(SG.free_bvh(t),SG.free_subdivision_surface(t));try{s=SK.allocate(e,r)}catch(t){console.error(t,e),s=SK.allocate({positionWASM:SY,indexWASM:SQ,verticesPerFaceWASM:SZ},r)}if(SG.set_destination_refinement_level(s,0),a=SK.buildLevel(s,!0,h),e.subdivisions>0)try{SG.set_destination_refinement_level(s,e.subdivisions),o=SK.buildLevel(s,!1,h)}catch{try{SG.set_destination_refinement_level(s,e.subdivisions-1),o=SK.buildLevel(s,!1,h)}catch{o=null}}else o=null;return{subdivPointer:s,originalGeometry:a,subdividedGeometry:o}}static primitiveToQuads(e,t,i){let r,s,a,o,h;e.widthSegments>16&&(e.widthSegments=16),e.heightSegments>16&&(e.heightSegments=16),e.depthSegments>16&&(e.depthSegments=16),e.radialSegments>16&&(e.radialSegments=16),"DodecahedronGeometry"===e.type&&(e.detail=0);let c=void 0!==e.shape||void 0!==e.path?t.geometry:SU(e,i,!1,t),d;if(d="TorusGeometry"===e.type&&e.arc===2*Math.PI?c.getClosedTorusIndicesForBooleanOrSubdiv():c.getIndex(),{positions:r,triIndices:o}=S$(c.getAttribute("position"),d),"CylinderGeometry"===e.type&&0===e.cornerRadius&&0===e.hollow&&!1===e.openEnded){let t=e.radialSegments*e.heightSegments*6,i=t
3156+3*e.radialSegments;h=[t,i]}return{indices:s,verticesPerFace:a}=S4(r,o,c,h),{positions:r,indices:s,verticesPerFace:a}}static allocate(e,t){let i,r,s,a,o=[],h=[];e.positionWASM&&e.positionWASM.length>0?(r=e.positionWASM,s=e.indexWASM,a=e.verticesPerFaceWASM):(r=SY,s=SQ,a=SZ);let c=r.length,d=s.length,u=a.length,p=r.length+o.length+h.length,f=s.length+a.length,m=p*Float32Array.BYTES_PER_ELEMENT+f*Uint32Array.BYTES_PER_ELEMENT,g=p*Float32Array.BYTES_PER_ELEMENT,v=(Uint32Array.BYTES_PER_ELEMENT,SG._malloc(m)),y=new Float32Array(SG.HEAPF32.buffer,v,p),x=new Uint32Array(SG.HEAPU32.buffer,v+g,f);y.set(r,0),y.set(o,r.length),y.set(h,r.length+o.length),x.set(s,0),x.set(a,s.length),e?.scaleBaked?.some(e=>1!==e)&&(i=new iY().makeScale(...e.scaleBaked)),t&&(i?i.premultiply(t):i=t);let b=i?SG.alloc_subdivision_surface2(v,c,v+g,d,v+g+s.length*Uint32Array.BYTES_PER_ELEMENT,u,i.elements):SG.alloc_subdivision_surface(v,c,v+g,d,v+g+s.length*Uint32Array.BYTES_PER_ELEMENT,u);return SG._free(v),b}static buildLevel(e,t,i,r,s){let a=s?SG.get_mesh_data2(e,t?SG.Level.CONTROL:SG.Level.REFINED,i,s.elements):SG.get_mesh_data(e,t?SG.Level.CONTROL:SG.Level.REFINED,i),o=SG.HEAPU32.subarray(a>>2,(a>>2)+8),h=o.subarray(4,8),c=0,d=SG.HEAPU32[o[c]>>2],u=SG.HEAPF32.subarray(d>>2,(d>>2)+h[c]);c++;let p=SG.HEAPU32[o[c]>>2],f=SG.HEAPF32.subarray(p>>2,(p>>2)+h[c]);c++;let m=SG.HEAPU32[o[c]>>2],g=SG.HEAPU32.subarray(m>>2,(m>>2)+h[c]);c++;let v=SG.HEAPU32[o[c]>>2],y=SG.HEAPU32.subarray(v>>2,(v>>2)+h[c]);if(c++,void 0===r){let e=new rz;if(e.setIndex(new rT(y,1)),e.setAttribute("position",new rP(u,3)),e.setAttribute("normal",new rP(f,3)),t){e.setAttribute("faceMap",new rT(g,1));let t=new Float32Array(f.length/3*4).fill(0);e.setAttribute("color",new rE(t,4))}return SG.free_mesh_data(a),e.userData.type="SubdivGeometry",e}r.getAttribute("position").copyArray(u),r.getAttribute("normal").copyArray(f),r.attributes.position.needsUpdate=!0,r.attributes.normal.needsUpdate=!0,SG.free_mesh_data(a)}static freeSubdivPointer(e){SG.free_bvh(e),SG.free_subdivision_surface(e)}static buildControlCageWireframe(e,t,i){let r=SG.get_wireframe_data_for_base_level(e),s=SG.HEAPU32.subarray(r>>2,(r>>2)+4),a=s.subarray(2,4),o=0,h=SG.HEAPU32[s[o]>>2],c=SG.HEAPF32.subarray(h>>2,(h>>2)+a[o]);o++;let d=SG.HEAPU32[s[o]>>2],u=SG.HEAPU32.subarray(d>>2,(d>>2)+a[o]);if(void 0===t){let e=new rz;e.setAttribute("position",new rP(c,3));let t=new Float32Array(c.length);for(let e=0,r=c.length;e<r;)t[e++]=i.r,t[e++]=i.g,t[e++]=i.b;return e.setAttribute("color",new rE(t,3)),e.setIndex(new rT(u,1)),SG.free_wireframe_data_for_base_level(r),e}t.getAttribute("position").copyArray(c),t.attributes.position.needsUpdate=!0,SG.free_wireframe_data_for_base_level(r)}static updateCollabMesh(e,t,i){let r=0===t;r||SG.set_destination_refinement_level(e,t);let s=i?SG.get_topological_data2(e,r?SG.Level.CONTROL:SG.Level.REFINED,i.elements):SG.get_topological_data(e,r?SG.Level.CONTROL:SG.Level.REFINED),a=SG.HEAPU32.subarray(s>>2,(s>>2)+6),o=a.subarray(3,6),h=0,c=SG.HEAPU32[a[h]>>2],d=new Float32Array(SG.HEAPF32.subarray(c>>2,(c>>2)+o[h]));h++;let u=SG.HEAPU32[a[h]>>2],p=new Uint32Array(SG.HEAPU32.subarray(u>>2,(u>>2)+o[h]));h++;let f=SG.HEAPU32[a[h]>>2],m=new Uint8Array(SG.HEAPU32.subarray(f>>2,(f>>2)+o[h]));return SG.free_topological_data(s),{positions:d,indices:p,verticesPerFace:m}}},SJ=["getX","getY","getZ"];function S$(e,t){let i={},r=t?t.count:e.count,s=0,a=[],o=[];for(let h=0;h<r;h++){let r=t?t.getX(h):h,c="";for(let t=0;t<3;t++)c+=`${~~(1e4*e[SJ[t]](r))},`;if(c in i)a.push(i[c]);else{for(let t=0;t<3;t++)o.push(e[SJ[t]](r));i[c]=s,a.push(s),s++}}let h=[];for(let e=0;e<a.length;e+=3)a[e]===a[e+1]||a[e]===a[e+2]||a[e+1]===a[e+2]||h.push(a[e],a[e+1],a[e+2]);return{positions:o,triIndices:h}}var S0=new iy,S1=new iy,S2=new iy,S3=new iy;function S4(e,t,i,r){let s=[],a=[];if(void 0!==i.userData.shape&&0===i.userData.parameters.depth&&0===i.userData.shape.shapeHoles.length){let t=i.userData.shape.extractShapePointsToFlatArray([]),r=i.userData.parameters.spikes;if("EllipseGeometry"===i.userData.type&&r<=24&&r%4==0&&i.userData.parameters.angle>=360){let e=t.length/2/r;t=t.filter((t,i)=>Math.floor(i/2)%e==0)}let o=0;for(let e=0;e<t.length;e+=2)o+=(t[e]-t[(0===e?t.length:e)-2])*(t[e+1]+t[(0===e?t.length:e)-1]);e.length=0;let h=0;if(o<0)for(let i=0;i<t.length;i+=2)e.push(t[i],t[i+1],0),s.push(h++);else for(let i=t.length-2;i>=0;i-=2)e.push(t[i],t[i+1],0),s.push(h++);return a.push(h),{indices:s,verticesPerFace:a}}let o=new Float32Array([i.userData.parameters.depth])[0],h=0;for(;h<t.length;){if(i.useNgonForTopBottomFaceDuringBake){let i=0;if((e[3*t[h]+2]===o||0===e[3*t[h]+2])&&i++,(e[3*t[h+1]+2]===o||0===e[3*t[h+1]+2])&&i++,(e[3*t[h+2]+2]===o||0===e[3*t[h+2]+2])&&i++,3===i)break}t[h+1]===t[h+3]&&t[h+2]===t[h+5]||t[h+0]===t[h+3]&&t[h+2]===t[h+4]?(S0.set(e[3*t[h]],e[3*t[h]+1],e[3*t[h]+2]),S1.set(e[3*t[h+1]],e[3*t[h+1]+1],e[3*t[h+1]+2]),S2.set(e[3*t[h+4]],e[3*t[h+4]+1],e[3*t[h+4]+2]),S3.set(e[3*t[h+5]],e[3*t[h+5]+1],e[3*t[h+5]+2]),S1.sub(S0).normalize(),S2.sub(S0).normalize(),S3.sub(S0).normalize(),Math.abs(S1.cross(S2).dot(S3))>.005||r&&r.some((e,t)=>t%2!=1&&h>=r[t]&&h<r[t+1])?(s.push(t[h],t[h+1],t[h+2]),a.push(3),h+=3):(s.push(t[h],t[h+1],t[h+4],t[h+5]),a.push(4),h+=6)):(s.push(t[h],t[h+1],t[h+2]),a.push(3),h+=3)}if(i.useNgonForTopBottomFaceDuringBake){let t=[],r=[],h=0;for(let i=0,s=0;i<e.length;i+=3,s++)0===e[i+2]&&(t.push(s),h++),e[i+2]===o&&r.push(s);if(0===i.userData.parameters.extrudeBevelSize){let e=r[0];r[0]=r[1],r[1]=e}t.reverse(),s.push(...t,...r),a.push(h,h)}return{indices:s,verticesPerFace:a}}var S5={},S6={calcBoolean:()=>Ct,calcBooleanTopological:()=>Ce,freeMeshSet:()=>Ca,getMeshSet:()=>Ci,hasOpenEdges:()=>Cr,transformMeshSet:()=>Cs};for(var S8 in S6)tv(S5,S8,{get:S6[S8],enumerable:!0});function S9(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=ME._malloc(s);return(Number.isInteger(e[0])?new Uint32Array(ME.HEAPU32.buffer,a,t):new Float32Array(ME.HEAPF32.buffer,a,t)).set(e,0),a}function S7(e){switch(e){case 0:return ME.OP.UNION;case 1:return ME.OP.INTERSECTION;case 2:return ME.OP.A_MINUS_B;default:throw Error("Unknown boolean operation "+e)}}function Ce(e,t){void 0===MA&&(MA=ME.init_csg());let i=S9(e),r=ME.csg_calc_topological(MA,i,e.length,S7(t));ME._free(i);let s=ME.HEAPU32.subarray(r>>2,(r>>2)+6),a=s.subarray(3,6),o=0,h=ME.HEAPU32[s[o]>>2],c=new Float32Array(ME.HEAPF32.subarray(h>>2,(h>>2)+a[o]));o++;let d=ME.HEAPU32[s[o]>>2],u=new Uint32Array(ME.HEAPU32.subarray(d>>2,(d>>2)+a[o]));o++;let p=ME.HEAPU32[s[o]>>2],f=new Uint8Array(ME.HEAPU32.subarray(p>>2,(p>>2)+a[o]));return ME.free_mesh_data(r),{positions:c,indices:u,verticesPerFace:f}}function Ct(e,t,i,r){void 0===MA&&(MA=ME.init_csg());let s=S9(e),a=ME.csg_calc(MA,s,e.length,r,S7(t));ME._free(s);let o=ME.HEAPU32.subarray(a>>2,(a>>2)+5),h=o.subarray(2,5),c=0,d=ME.HEAPU32[o[c]>>2],u=ME.HEAPF32.subarray(d>>2,(d>>2)+h[c]);c++;let p=ME.HEAPU32[o[c]>>2],f=ME.HEAPF32.subarray(p>>2,(p>>2)+h[c]),m=h[++c];i.setAttribute("position",new rP(u,3)),i.setAttribute("normal",new rP(f,3));let g=ME.HEAPF32.subarray((a>>2)+5,(a>>2)+5+6);return null===i.boundingSphere&&(i.boundingSphere=new iF),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:2*g[3],height:2*g[4],depth:2*g[5]},ME.free_mesh_data(a),m}function Ci(e,t,i){let r,s,a;if(void 0===ME)return -1;if(t&&void 0!==e.userData.positions){let t=e.userData;a=t.verticesPerFace.length,r=t.positions,s=Array(t.verticesPerFace.reduce((e,t)=>
3156e+t,0)+a);for(let e=0,i=0,r=0;e<t.verticesPerFace.length;e++){s[r++]=t.verticesPerFace[e];for(let a=0;a<t.verticesPerFace[e];a++)s[r++]=t.indices[i++]}}else({positions:r,faceIndices:s,nFaces:a}=function(e,t,i){let r,s;s="TorusGeometry"===e.userData.parameters.type&&e.userData.parameters.arc===2*Math.PI?e.getClosedTorusIndicesForBooleanOrSubdiv():e.getIndex();let{positions:a,triIndices:o}=S$(e.getAttribute("position"),s),h;if(t&&i){let{indices:t,verticesPerFace:i}=S4(a,o,e);h=i.length,r=[];for(let e=0,s=0;e<h;e++){r.push(i[e]);for(let a=0;a<i[e];a++)r.push(t[s++])}}else{let e=o.length;r=Array(e+e/3),h=0;for(let e=0,t=0;t<r.length;)r[t++]=3,h++,r[t++]=o[e++],r[t++]=o[e++],r[t++]=o[e++]}return{positions:a,faceIndices:r,nFaces:h}}(e,t,i));let o=r.length,h=s.length,c=r.length,d=s.length,u=c*Float32Array.BYTES_PER_ELEMENT+d*Uint32Array.BYTES_PER_ELEMENT,p=c*Float32Array.BYTES_PER_ELEMENT,f=(Uint32Array.BYTES_PER_ELEMENT,ME._malloc(u)),m=new Float32Array(ME.HEAPF32.buffer,f,c),g=new Uint32Array(ME.HEAPU32.buffer,f+p,d);m.set(r,0),g.set(s,0);let v=ME.get_csg_mesh(f,o,f+p,h,a);return ME._free(f),v}function Cr(e){return ME.has_open_edges(e)}function Cs(e,t){ME.transform_csg_mesh(e,t.elements)}function Ca(e){ME.free_csg_mesh(e)}new Promise(e=>{MC=e}).then(e=>ME=e);var Cn={ConeGeometry:wA,CubeGeometry:wT,CylinderGeometry:wS,DodecahedronGeometry:wL,EllipseGeometry:_A,HelixGeometry:_R,IcosahedronGeometry:_z,LatheGeometry:_F,NonParametricGeometry:_5,PolygonGeometry:_6,PyramidGeometry:_8,RectangleGeometry:St,SphereGeometry:Si,PlaneGeometry:Sr,BackdropGeometry:Ss,StarGeometry:Sn,TextFrameGeometry:So,TorusGeometry:Sl,TorusKnotGeometry:Sh,TriangleGeometry:Sc,PathGeometry:SA,VectorGeometry:_M},Co=e=>Cn[e.type].create(e);function Cl(e){return null!==e&&"booleanOp"in e}var Ch=class extends w_(rK){constructor(){super(...arguments),this.booleanMeshSetAddress=-1,this.booleanWasTransformed=!1,this.booleanMatrixInvOld=new iY}updateVisible(e){super.updateVisible(e),this.visible=!Cl(this.parent)&&this.visible,Cl(this.parent)&&this.parent.invalidateDownstreamBooleanData()}freeBooleanPointer(){-1!==this.booleanMeshSetAddress&&(S5.freeMeshSet(this.booleanMeshSetAddress),this.booleanMeshSetAddress=-1)}invalidateDownstreamBooleanData(e=!1){return e?this.booleanWasTransformed=!0:this.freeBooleanPointer(),Cl(this.parent)?this.parent.invalidateDownstreamBooleanData():this}invalidateUpstreamBooleanData(){for(let e of(this.freeBooleanPointer(),this.children))e instanceof Ch&&(e.freeBooleanPointer(),Cl(e)&&e.invalidateUpstreamBooleanData())}updateTransformState(e,t){let i=super.updateTransformState(e,t);return i&&Cl(this.parent)&&this.invalidateDownstreamBooleanData(!0),i}onVariableUpdate(e=!1){super.onVariableUpdate(e),Cl(this.parent)&&this.invalidateDownstreamBooleanData(!0)}},Cc=new iw;function Cd(e,t=0,i=e.count,r,s){let a=1/0,o=1/0,h=1/0,c=-1/0,d=-1/0,u=-1/0;for(let r=t;r<i;r++){let t=e.getX(r),i=e.getY(r),s=e.getZ(r);t<a&&(a=t),i<o&&(o=i),s<h&&(h=s),t>c&&(c=t),i>d&&(d=i),s>u&&(u=s)}Cc.min.set(a,o,h),Cc.max.set(c,d,u),Cc.getCenter(r),Cc.getSize(s).multiplyScalar(.5)}var Cu=new rz,Cp=new rS,Cf=class extends Ch{constructor(e,t){super(Cu,Cp),this.super_Entity(e,t)}updateState(e,t){this.updateState_Entity(e,t)}updateEntityBoxSize(e,t){let i=this.geometry.getAttribute("position");void 0!==i?Cd(i,this.geometry.drawRange.start,this.geometry.drawRange.count<1/0?this.geometry.drawRange.count:i.count,e,t):super.updateEntityBoxSize(e,t)}},Cm=class{constructor(e){if(this.hashProperties=void 0,this.isNode=!0,this.shortcuts={},null===Cm.uuidContext)throw Error("plz startContext");Cm.uuidContext===Cm.globalContext?this.uuid="_gid"+Cm.uuidContext.nodeContextUuid++:this.uuid="_uid"+Cm.uuidContext.nodeContextUuid++,this.type=e,this.name=""}static startContext(e){null===this.uuidContext||this.uuidContext===Cm.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),-1===e.nodes.indexOf(this)&&e.nodes.push(this),void 0!==this.updateFrame&&-1===e.updaters.indexOf(this)&&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>
vendor: 9,543 bytes, lines 3156-3160
3156(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"sampler2D"===t||"samplerCube"===t?t:this.type}},Cg=Cm;Cg.globalContext={nodeContextUuid:0},Cg.uuidContext=Cm.globalContext;var Cv=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}},Cy=new class{constructor(){this.nodes={},this.keywords={}}add(e){this.nodes[e.name]=e}addKeyword(e,t,i){i=void 0===i||i,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 void 0!==this.nodes[e]}containsKeyword(e){return void 0!==this.keywords[e]}},Cx=class extends Cg{constructor(e,t){super(e),this.scope="",t=t??{},this.shared=void 0===t.shared||t.shared,this.unique=void 0!==t.unique&&t.unique}build(e,t,i,r){if(t=t??this.getType(e),this.getShared(e,t)){let s=this.getUnique(e,t);s&&void 0===this.uuid&&(this.uuid=tQ.generateUUID()),i=e.getUUID(i??this.getUUID(),!s);let a=e.getNodeData(i),o=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,o)||e.context.ignoreCache||1===a.deps))return super.build(e,t,i);i=this.getUUID(!1);let h=this.getTemp(e,i);if(h)return e.format(h,o,t);{h=super.generate(e,t,i,a.output,r);let s=this.generate(e,o,i);return e.addNodeCode(h+" = "+s+";"),e.format(h,o,t)}}return super.build(e,t,i)}getShared(e,t){return"sampler2D"!==t&&"samplerCube"!==t&&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"string"==typeof this.scope&&(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}},Cb=class extends Cx{constructor(e,t){(t=t??{}).shared=void 0!==t.shared&&t.shared,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 o=e.getNodeData(i);return this.getReadonly()&&void 0!==this.generateReadonly?this.generateReadonly(e,t,i,r,s,a):e.isShader("vertex")?(o.vertex||(o.vertex=e.createVertexUniform(r,this,s,a,this.getLabel())),e.format(o.vertex.name,r,t)):(o.fragment||(o.fragment=e.createFragmentUniform(r,this,s,a,this.getLabel())),e.format(o.fragment.name,r,t))}},Cw=class extends Cb{constructor(e=0,t){super("v2"),this.nodeType="Vector2",this.value=e instanceof tZ?e:new tZ(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)}},C_=class extends Cb{constructor(e=0,t,i){super("v3"),this.nodeType="Vector3",this.value=e instanceof iy?e:new iy(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)}},CS=class extends Cb{constructor(e){super("v4"),this.nodeType="Vector4",this.value=e instanceof xA?e:new xA(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)}},CC=/^\s*([a-z_0-9]+)\s([a-z_0-9]+)\s*\((.*?)\)/i,CM=/[a-z_0-9]+/gi,CE=class extends Cx{constructor(e,t,i,r,s){super(s),this.src="",this.nodeType="Function",this.useKeywords=!0,this.includes=[],this.extensions={},this.keywords={},this.isMethod=void 0===s,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,o=0,h=this.src;if(this.includes)for(let t=0;t<this.includes.length;t++)e.include(this.includes[t],this);for(let t in this.extensions)e.extensions[t]=!0;let c=[];for(;a=CM.exec(this.src);)c.push(a);for(let t=0;t<c.length;t++){let i=c[t],r=i[0],s=!this.isMethod||!this.getInputByName(r),a=r;if(this.keywords[r]||this.useKeywords&&s&&Cy.containsKeyword(r)){let t=this.keywords[r];if(!t){let i=Cy.getKeywordData(r);i.cache&&(t=e.keywords[r]),t=t||Cy.getKeyword(r,e),i.cache&&(e.keywords[r]=t)}a=t.build(e)}r!==a&&"."!==h[i.index+o-1]&&(h=h.substring(0,i.index+o)+a+h.substring(i.index+r.length+o),o+=a.length-r.length),void 0===this.getIncludeByName(a)&&Cy.contains(a)&&e.include(Cy.get(a))}return"source"===t?h:this.isMethod?(this.isInterface||e.include(this,void 0,h),this.name):e.format("( "+h+" )",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 e=CC.exec(this.src);if(this.inputs=[],e&&4==e.length){this.type=e[1],this.name=e[2];let t=e[3].match(CM);if(t){let e=0;for(;e<t.length;){let i=t[e++],r;"in"===i||"out"===i||"inout"===i?r=t[e++]:(r=i,i="");let s=t[e++];this.inputs.push({name:s,type:r,qualifier:i})}}this.isInterface=-1===this.src.indexOf("{")}else this.type="",this.name=""}}},CA=/^([a-z_0-9]+)\s([a-z_0-9]+)\s?\=?\s?(.*?)(\;|$)/i,CT=class extends Cx{constructor(e="",t){super(),this.src="",this.useDefine=!1,this.nodeType="Const",this.parse(e||CT.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,o,h="",c=CA.exec(e);this.useDefine=s??"#"===this.src.charAt(0),c&&c.length>1?(o=c[1],a=c[2],h=c[3]):(a=this.src,o="f"),this.name=a,this.type=o,this.value=h}build(e,t){if("source"===t){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)}};CT.PI="PI",CT.PI2="PI2",CT.RECIPROCAL_PI="RECIPROCAL_PI",CT.RECIPROCAL_PI2="RECIPROCAL_PI2",CT.LOG2="LOG2",CT.EPSILON="EPSILON";var CP=RegExp(`^structs*([a-z_0-9]+)s*{s*((.|
3157)*?)}`,"gim"),CD=RegExp("s*(w*?)s*(w*?)(=|;)","gim"),CO=class extends Cx{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"source"===t?this.src+";":e.format("( "+this.src+" )",this.getType(e),t)}parse(e=""){this.src=e,this.inputs=[];let t=CP.exec(e);if(t){let e=t[2],i;for(;i=CD.exec(e);)this.inputs.push({type:i[1],name:i[2]});this.name=t[1]}else this.name="";this.type=this.name}},CL=class extends Cx{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)}};Cy.addKeyword("uv",function(){return new CL}),Cy.addKeyword("uv2",function(){return new CL(1)});var CI=class extends Cx{constructor(e,t){super("v4"),this.nodeType="ColorSpace",this.input=e,this.method=t??CI.LINEAR_TO_LINEAR,this.hashProperties=["method"]}static getEncodingComponents(e){switch(e){case 3e3:return["Linear"];case 3001:return["sRGB"];default:return[]}}generate(e,t){let i=this.input.build(e,"v4"),r=this.getType(e),s=CI.Nodes[this.method],a=e.include(s);if(a===CI.LINEAR_TO_LINEAR)return e.format(i,r,t);if(s.inputs?.length!==2)return e.format(a+"( "+i+" )",r,t);{let s=this.factor.build(e,"f");return e.format(a+"( "+i+", "+s+" )",r,t)}}fromEncoding(e){let t=CI.getEncodingComponents(e);this.method="LinearTo"+t[0],this.factor=t[1]}fromDecoding(e){let t=CI.getEncodingComponents(e);this.method=t[0]+"ToLinear",this.factor=t[1]}};CI.Nodes={LinearToLinear:new CE(["vec4 LinearToLinear( in vec4 value ) {","	return value;","}"].join(`
3158`)),sRGBToLinear:new CE(["vec4 sRGBToLinear( in vec4 value ) {","	return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.w );","}"].join(`
3159`)),LinearTosRGB:new CE(["vec4 LinearTosRGB( in vec4 value ) {","	return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.w );","}"].join(`
3160`))},CI.LINEAR_TO_LINEAR="LinearToLinear",CI.SRGB_TO_LINEAR="sRGBToLinear",CI.LINEAR_TO_SRGB="LinearTosRGB";var CR=class extends CE{constructor(e="",t,i,r,s){super(e,s,r,i,t),this.nodeType="Expression"}},Ck=class extends Cb{constructor(e=new ic,t,i,r){super("v4",{shared:!0}),this.nodeType="Texture",this.value=e,this.uv=t??new CL,this.bias=i,this.project=void 0!==r&&r}getTexture(e,t){return super.generate(e,t,this.value.uuid,"t")}generate(e,t){let i,r;if("sampler2D"===t)return this.getTexture(e,t);
vendor: 9,414 bytes, lines 3160-3235
3160let s=this.getTexture(e,t),a=this.uv.build(e,this.project?"v4":"v2"),o=this.bias?this.bias.build(e,"f"):void 0;void 0===o&&e.context.bias&&(o=e.context.bias.setTexture(this).build(e,"f")),i=this.project?"texture2DProj":o?"tex2DBias":"tex2D",r=o?i+"( "+s+", "+a+", "+o+" )":i+"( "+s+", "+a+" )";let h={include:e.isShader("vertex"),ignoreCache:!0},c=this.getType(e);return e.addContext(h),this.colorSpace=this.colorSpace??new CI(new CR("",c)),this.colorSpace.fromDecoding(e.getTextureEncodingFromMap(this.value)),this.colorSpace.input.parse(r),r=this.colorSpace.build(e,c),e.removeContext(),e.format(r,c,t)}},CB=class extends Cb{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)}},Cz=class extends Cx{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,o=a.build(e,t)+"( ",h=[];if(a.inputs){for(let t=0;t<a.inputs.length;t++){let i=a.inputs[t],r=this.inputs[t]||this.inputs[i.name];h.push(r.build(e,e.getTypeByFormat(i.type)))}o+=h.join(", ")+" )"}return e.format(o,r,t)}},CN=class extends Cx{constructor(e,t,i=CN.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)}};CN.ADD="+",CN.SUB="-",CN.MUL="*",CN.DIV="/";var CF=class extends Cx{constructor(e,t=CF.ABS,i,r){super(),this.nodeType="Math",this.a=e,"string"!=typeof t?this.b=t:r=t,"string"!=typeof i?this.c=i:r=i,this.method=r,this.hashProperties=["method"]}getNumInputs(e){switch(this.method){case CF.MIX:case CF.CLAMP:case CF.REFRACT:case CF.SMOOTHSTEP:case CF.FACEFORWARD:return 3;case CF.MIN:case CF.MAX:case CF.MOD:case CF.STEP:case CF.REFLECT:case CF.DISTANCE:case CF.DOT:case CF.CROSS:case CF.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 CF.LENGTH:case CF.DISTANCE:case CF.DOT:return"f";case CF.CROSS:return"v3"}return this.getInputType(e)}generate(e,t){let i,r,s,a=this.a?e.getTypeLength(this.a.getType(e)):0,o=this.b?e.getTypeLength(this.b.getType(e)):0,h=this.c?e.getTypeLength(this.c.getType(e)):0,c=this.getInputType(e),d=this.getType(e);switch(this.type=d,this.method){case CF.NEGATE:return e.format("( -"+this.a.build(e,c)+" )",c,t);case CF.INVERT:return e.format("( 1.0 - "+this.a.build(e,c)+" )",c,t);case CF.CROSS:i=this.a.build(e,"v3"),r=this.b.build(e,"v3");break;case CF.STEP:i=this.a.build(e,1===a?"f":c),r=this.b.build(e,c);break;case CF.MIN:case CF.MAX:case CF.MOD:i=this.a.build(e,c),r=this.b.build(e,1===o?"f":c);break;case CF.REFRACT:i=this.a.build(e,c),r=this.b.build(e,c),s=this.c.build(e,"f");break;case CF.MIX:i=this.a.build(e,c),r=this.b.build(e,c),s=this.c.build(e,1===h?"f":c);break;default:i=this.a.build(e,c),this.b&&(r=this.b.build(e,c)),this.c&&(s=this.c.build(e,c))}let u=[];u.push(i),r&&u.push(r),s&&u.push(s);let p=this.getNumInputs(e);if(u.length!==p)throw Error(`Arguments not match used in "${this.method}". Require ${p}, currently ${u.length}.`);return e.format(this.method+"( "+u.join(", ")+" )",d,t)}};CF.RAD="radians",CF.DEG="degrees",CF.EXP="exp",CF.EXP2="exp2",CF.LOG="log",CF.LOG2="log2",CF.SQRT="sqrt",CF.INV_SQRT="inversesqrt",CF.FLOOR="floor",CF.CEIL="ceil",CF.NORMALIZE="normalize",CF.FRACT="fract",CF.SATURATE="saturate",CF.SIN="sin",CF.COS="cos",CF.TAN="tan",CF.ASIN="asin",CF.ACOS="acos",CF.ARCTAN="atan",CF.ABS="abs",CF.SIGN="sign",CF.LENGTH="length",CF.NEGATE="negate",CF.INVERT="invert",CF.MIN="min",CF.MAX="max",CF.MOD="mod",CF.STEP="step",CF.REFLECT="reflect",CF.DISTANCE="distance",CF.DOT="dot",CF.CROSS="cross",CF.POW="pow",CF.MIX="mix",CF.CLAMP="clamp",CF.REFRACT="refract",CF.SMOOTHSTEP="smoothstep",CF.FACEFORWARD="faceforward";var Cj=class extends Cx{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 Cz(Cj.Nodes.bilinearCubeUV,[t,i,r]);this.colorSpaceTL=this.colorSpaceTL??new CI(new CR("","v4")),this.colorSpaceTL.fromDecoding(e.getTextureEncodingFromMap(this.value.value)),this.colorSpaceTL.input.parse(s.build(e)+".tl"),this.colorSpaceTR=this.colorSpaceTR??new CI(new CR("","v4")),this.colorSpaceTR.fromDecoding(e.getTextureEncodingFromMap(this.value.value)),this.colorSpaceTR.input.parse(s.build(e)+".tr"),this.colorSpaceBL=this.colorSpaceBL??new CI(new CR("","v4")),this.colorSpaceBL.fromDecoding(e.getTextureEncodingFromMap(this.value.value)),this.colorSpaceBL.input.parse(s.build(e)+".bl"),this.colorSpaceBR=this.colorSpaceBR??new CI(new CR("","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 CR(this.colorSpaceTL.build(e,"v4"),"v4"),this.colorSpaceTRExp=new CR(this.colorSpaceTR.build(e,"v4"),"v4"),this.colorSpaceBLExp=new CR(this.colorSpaceBL.build(e,"v4"),"v4"),this.colorSpaceBRExp=new CR(this.colorSpaceBR.build(e,"v4"),"v4"),e.removeContext();let o=new CR("mix( mix( cubeUV_TL, cubeUV_TR, cubeUV.f.x ), mix( cubeUV_BL, cubeUV_BR, cubeUV.f.x ), cubeUV.f.y )","v4");return o.keywords.cubeUV_TL=this.colorSpaceTLExp,o.keywords.cubeUV_TR=this.colorSpaceTRExp,o.keywords.cubeUV_BL=this.colorSpaceBLExp,o.keywords.cubeUV_BR=this.colorSpaceBRExp,o.keywords.cubeUV=s,o}generate(e,t){if(!e.isShader("fragment"))return console.warn("TextureCubeUVNode is not compatible with "+e.shader+" shader."),e.format("vec4( 0.0 )",this.getType(e),t);{let i=this.uv,r=this.bias||e.context.roughness,s=new CF(new Cz(Cj.Nodes.roughnessToMip,[r]),Cj.Nodes.m0,Cj.Nodes.cubeUV_maxMipLevel,CF.CLAMP),a=new CF(s,CF.FLOOR),o=new CF(s,CF.FRACT),h=new CF(this.bilinearCubeUV(e,this.value,i,a),this.bilinearCubeUV(e,this.value,i,new CN(a,new CB(1).setReadonly(!0),CN.ADD)),o,CF.MIX);return e.format(h.build(e),"v4",t)}}};ep=new CO(`struct TextureCubeUVData {
3161			vec4 tl;
3162			vec4 tr;
3163			vec4 br;
3164			vec4 bl;
3165			vec2 f;
3166		}`),ef=new CT("float cubeUV_maxMipLevel 8.0",!0),em=new CT("float cubeUV_minMipLevel 4.0",!0),eg=new CT("float cubeUV_maxTileSize 256.0",!0),ev=new CT("float cubeUV_minTileSize 16.0",!0),(ey=new CE(`float getFace(vec3 direction) {
3167				vec3 absDirection = abs(direction);
3168				float face = -1.0;
3169				if (absDirection.x > absDirection.z) {
3170					if (absDirection.x > absDirection.y)
3171						face = direction.x > 0.0 ? 0.0 : 3.0;
3172					else
3173						face = direction.y > 0.0 ? 1.0 : 4.0;
3174				} else {
3175					if (absDirection.z > absDirection.y)
3176						face = direction.z > 0.0 ? 2.0 : 5.0;
3177					else
3178						face = direction.y > 0.0 ? 1.0 : 4.0;
3179				}
3180				return face;
3181		}`)).useKeywords=!1,(ex=new CE(`vec2 getUV(vec3 direction, float face) {
3182				vec2 uv;
3183				if (face == 0.0) {
3184					uv = vec2(direction.z, direction.y) / abs(direction.x); // pos x
3185				} else if (face == 1.0) {
3186					uv = vec2(-direction.x, -direction.z) / abs(direction.y); // pos y
3187				} else if (face == 2.0) {
3188					uv = vec2(-direction.x, direction.y) / abs(direction.z); // pos z
3189				} else if (face == 3.0) {
3190					uv = vec2(-direction.z, direction.y) / abs(direction.x); // neg x
3191				} else if (face == 4.0) {
3192					uv = vec2(-direction.x, direction.z) / abs(direction.y); // neg y
3193				} else {
3194					uv = vec2(direction.x, direction.y) / abs(direction.z); // neg z
3195				}
3196				return 0.5 * (uv + 1.0);
3197		}`)).useKeywords=!1,(eb=new CE(`TextureCubeUVData bilinearCubeUV(sampler2D envMap, vec3 direction, float mipInt) {
3198			float face = getFace(direction);
3199			float filterInt = max(cubeUV_minMipLevel - mipInt, 0.0);
3200			mipInt = max(mipInt, cubeUV_minMipLevel);
3201			float faceSize = exp2(mipInt);
3202			float texelSize = 1.0 / (3.0 * cubeUV_maxTileSize);
3203			vec2 uv = getUV(direction, face) * (faceSize - 1.0);
3204			vec2 f = fract(uv);
3205			uv += 0.5 - f;
3206			if (face > 2.0) {
3207				uv.y += faceSize;
3208				face -= 3.0;
3209			}
3210			uv.x += face * faceSize;
3211			if(mipInt < cubeUV_maxMipLevel){
3212				uv.y += 2.0 * cubeUV_maxTileSize;
3213			}
3214			uv.y += filterInt * 2.0 * cubeUV_minTileSize;
3215			uv.x += 3.0 * max(0.0, cubeUV_maxTileSize - 2.0 * faceSize);
3216			uv *= texelSize;
3217			vec4 tl = texture2D(envMap, uv);
3218			uv.x += texelSize;
3219			vec4 tr = texture2D(envMap, uv);
3220			uv.y += texelSize;
3221			vec4 br = texture2D(envMap, uv);
3222			uv.x -= texelSize;
3223			vec4 bl = texture2D(envMap, uv);
3224			return TextureCubeUVData( tl, tr, br, bl, f );
3225		}`,[ep,ey,ex,ef,em,eg,ev])).useKeywords=!1,ew=new CT("float r0 1.0",!0),Cj.Nodes={bilinearCubeUV:eb,roughnessToMip:new CE(`float roughnessToMip(float roughness) {
3226			float mip = 0.0;
3227			if (roughness >= r1) {
3228				mip = (r0 - roughness) * (m1 - m0) / (r0 - r1) + m0;
3229			} else if (roughness >= r4) {
3230				mip = (r1 - roughness) * (m4 - m1) / (r1 - r4) + m1;
3231			} else if (roughness >= r5) {
3232				mip = (r4 - roughness) * (m5 - m4) / (r4 - r5) + m4;
3233			} else if (roughness >= r6) {
3234				mip = (r5 - roughness) * (m6 - m5) / (r5 - r6) + m5;
3235			} else {
3236				mip = -2.0 * log2(1.16 * roughness);// 1.16 = 1.79^0.25
3237			}
3238			return mip;
3239		}`,[ew,new CT("float v0 0.339",!0),e_=new CT("float m0 -2.0",!0),new CT("float r1 0.8",!0),new CT("float v1 0.276",!0),new CT("float m1 -1.0",!0),new CT("float r4 0.4",!0),new CT("float v4 0.046",!0),new CT("float m4 2.0",!0),new CT("float r5 0.305",!0),new CT("float v5 0.016",!0),new CT("float m5 3.0",!0),new CT("float r6 0.21",!0),new CT("float v6 0.0038",!0),new CT("float m6 4.0",!0)]),m0:e_,cubeUV_maxMipLevel:ef};var CU=class extends Cx{constructor(e){super("v3"),this.nodeType="Normal",this.scope=e??CU.VIEW}getShared(){return this.scope===CU.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 CU.VIEW:a=e.isShader("vertex")?"transformedNormal":"geometryNormal";break;case CU.LOCAL:e.isShader("vertex")?a="objectNormal":(e.requires.normal=!0,a="vObjectNormal");break;case CU.WORLD:e.isShader("vertex")?a="inverseTransformDirection( transformedNormal, viewMatrix ).xyz":(e.requires.worldNormal=!0,a="vWNormal")}return e.format(a,this.getType(e),t)}};CU.LOCAL="local",CU.WORLD="world",CU.VIEW="view",CU.NORMAL="normal",Cy.addKeyword("viewNormal",function(){return new CU(CU.VIEW)}),Cy.addKeyword("localNormal",function(){return new CU(CU.NORMAL)}),Cy.addKeyword("worldNormal",function(){return new CU(CU.WORLD)});var CV=class extends Cx{constructor(e){super("v3"),this.nodeType="Position",this.scope=e??CV.LOCAL}getType(){return this.scope===CV.PROJECTION?"v4":this.type}getShader(){switch(this.scope){case CV.LOCAL:case CV.WORLD:return!1}return!0}generate(e,t,i,r,s){let a;switch(this.scope){case CV.LOCAL:e.isShader("vertex")?a="transformed":(e.requires.position=!0,a="vPosition");break;case CV.WORLD:if(e.isShader("vertex"))return"( modelMatrix * vec4( transformed, 1.0 ) ).xyz";e.requires.worldPosition=!0,a="vWPosition";break;case CV.VIEW:a=e.isShader("vertex")?"-mvPosition.xyz":"vViewPosition";break;case CV.PROJECTION:a=e.isShader("vertex")?"( projectionMatrix * modelViewMatrix * vec4( position, 1.0 ) )":"vec4( 0.0 )"}return e.format(a,this.getType(),t)}};CV.LOCAL="local",CV.WORLD="world",CV.VIEW="view",CV.PROJECTION="projection",Cy.addKeyword("position",function(){return new CV}),Cy.addKeyword("worldPosition",function(){return new CV(CV.WORLD)}),Cy.addKeyword("viewPosition",function(){return new CV(CV.VIEW)});var CW=class extends Cx{constructor(e){super("v3"),this.nodeType="Reflect",this.scope=e??CW.CUBE}getUnique(e){return!e.context.viewNormal}getType(){return this.scope===CW.SPHERE?"v2":this.type}generate(e,t){let i=this.getUnique(e);if(!e.isShader("fragment"))return console.warn("ReflectNode is not compatible with "+e.shader+" shader."),e.format("vec3( 0.0 )",this.type,t);{let r;switch(this.scope){case CW.VECTOR:{let t=new CU(CU.VIEW),s=e.context.roughness,a=t.build(e,"v3"),o=new CV(CV.VIEW).build(e,"v3"),h=s?s.build(e,"f"):void 0,c=`reflect( -normalize( ${o} ), ${a} )`;h&&(c=`normalize( mix( ${c}, ${a}, ${h} * ${h} ) )`);let d=`inverseTransformDirection( ${c}, viewMatrix )`;i?(e.addNodeCode(`vec3 reflectVec = ${d};`),r="reflectVec"):r=d;break}case CW.CUBE:{let t=new CW(CW.VECTOR).build(e,"v3"),s="vec3( -"+t+".x, "+t+".yz )";i?(e.addNodeCode(`vec3 reflectCubeVec = ${s};`),r="reflectCubeVec"):r=s;break}case CW.SPHERE:{let t="normalize( ( viewMatrix * vec4( "+new CW(CW.VECTOR).build(e,"v3")+", 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) ).xy * 0.5 + 0.5";i?(e.addNodeCode(`vec2 reflectSphereVec = ${t};`),r="reflectSphereVec"):r=t}}return e.format(r,this.getType(),t)}}};CW.CUBE="cube",CW.SPHERE="sphere",CW.VECTOR="vector";var CH=class extends Cx{constructor(e=new Ck,t,i){super("v4"),this.nodeType="TextureCube",this.value=e,this.radianceNode=new Cj(this.value,t??new CW(CW.VECTOR),i),this.irradianceNode=new Cj(this.value,new CU(CU.WORLD),new CB(1).setReadonly(!0))}generate(e,t){return e.isShader("fragment")?(e.require("irradiance"),e.context.bias&&e.context.bias.setTexture(this.value),("irradiance"===e.slot?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))}},CG=class extends Cb{constructor(e=new r7,t,i){super("v4",{shared:!0}),this.nodeType="CubeTexture",this.value=e,this.uv=t??new CW,this.bias=i}getTexture(e,t){return super.generate(e,t,this.value.uuid,"tc")}generate(e,t){let i;if("samplerCube"===t)return this.getTexture(e,t);let r=this.getTexture(e,t),s=this.uv?.build(e,"v3"),a=this.bias?this.bias.build(e,"f"):void 0;void 0===a&&e.context.bias&&(a=e.context.bias.setTexture(this).build(e,"f")),i=a?"texCubeBias( "+r+", "+s+", "+a+" )":"texCube
3239( "+r+", "+s+" )";let o={include:e.isShader("vertex"),ignoreCache:!0},h=this.getType(e);return e.addContext(o),this.colorSpace=this.colorSpace??new CI(new CR("",h)),this.colorSpace.fromDecoding(e.getTextureEncodingFromMap(this.value)),this.colorSpace.input.parse(i),i=this.colorSpace.build(e,h),e.removeContext(),e.format(i,h,t)}},Cq=`
3240uniform int frameIndex;
3241uniform vec2 resolution;
3242uniform mat4 previousModelViewMatrix;
3243uniform mat4 previousProjectionMatrix;
3244
3245varying vec4 vCurrentPosition;
3246varying vec4 vPreviousPosition;
3247`,CX=`
3248layout(location = 1) out vec4 gVelocity;
3249
3250uniform int frameIndex;
3251uniform vec2 resolution;
3252
3253varying vec4 vCurrentPosition;
3254varying vec4 vPreviousPosition;
3255
3256const vec2 haltonSequence[16] = vec2[16](
3257vec2( 0.000000,-0.333334),
3258vec2(-0.500000, 0.333334),
3259vec2( 0.500000,-0.777778),
3260vec2(-0.750000,-0.111112),
3261vec2( 0.250000, 0.555556),
3262vec2(-0.250000,-0.555556),
3263vec2( 0.750000, 0.111112),
3264vec2(-0.875000, 0.777778),
3265vec2(0.125000, -0.925926),
3266vec2(-0.375000, -0.259260),
3267vec2(0.625000, 0.407408),
3268vec2(-0.625000, -0.703704),
3269vec2(0.375000, -0.037038),
3270vec2(-0.125000, 0.629630),
3271vec2(0.875000, -0.481482),
3272vec2(-0.937500, 0.185186));
3273
3274vec2 vogelDiskSample(int sampleIndex, int sampleCount, float angle) {
3275  const float goldenAngle = 2.399963f; // radians
3276  float r = sqrt(float(sampleIndex) + 0.5f) / sqrt(float(sampleCount));
3277  float theta = float(sampleIndex) * goldenAngle + angle;
3278  float sine = sin(theta);
3279  float cosine = cos(theta);
3280  return vec2(cosine, sine) * r;
3281}
3282
3283// Derived from the interleaved gradient function from Jimenez 2014 http:goo.gl/eomGso
3284float getNoiseInterleavedGradient(vec2 screenPos) {
3285    vec3 magic = vec3(0.06711056f, 0.00583715f, 52.9829189f);
3286    return fract(magic.z * fract(dot(screenPos, magic.xy)));
3287}
3288
3289`,CY=`
3290// TODO: This could be generated CPU side and passed to the shader every frame
3291const vec2 haltonSequence[16] = vec2[16](
3292vec2( 0.000000,-0.333334),
3293vec2(-0.500000, 0.333334),
3294vec2( 0.500000,-0.777778),
3295vec2(-0.750000,-0.111112),
3296vec2( 0.250000, 0.555556),
3297vec2(-0.250000,-0.555556),
3298vec2( 0.750000, 0.111112),
3299vec2(-0.875000, 0.777778),
3300vec2(0.125000, -0.925926),
3301vec2(-0.375000, -0.259260),
3302vec2(0.625000, 0.407408),
3303vec2(-0.625000, -0.703704),
3304vec2(0.375000, -0.037038),
3305vec2(-0.125000, 0.629630),
3306vec2(0.875000, -0.481482),
3307vec2(-0.937500, 0.185186));
3308
3309// TODO: Pass correct view size
3310vec2 offset = haltonSequence[frameIndex];
3311offset.x /= resolution.x;
3312offset.y /= resolution.y;
3313
3314vec4 currentPosition = gl_Position;
3315vec4 currentPositionJittered = currentPosition + (vec4(offset.x, offset.y, 0.0, 0.0) * currentPosition.w);
3316
3317// We want to calculate the velocity with unjittered positions
3318// so that things that are not moving get a velocity = 0
3319vCurrentPosition = currentPosition;
3320vPreviousPosition = previousProjectionMatrix * previousModelViewMatrix * vec4(transformed, 1.0);
3321#ifdef OUTLINE_COMPENSATION
3322vPreviousPosition.xy += OUTLINE_COMPENSATION;
3323#endif
3324gl_Position = currentPositionJittered;
3325
3326`,CQ=`
3327vec2 oldPos = vPreviousPosition.xy;
3328    oldPos /= vPreviousPosition.w;
3329    oldPos.xy = (oldPos.xy+1.)/2.0;
3330
3331vec2 newPos = vCurrentPosition.xy;
3332    newPos /= vCurrentPosition.w;
3333    newPos.xy = (newPos.xy+1.)/2.0;
3334
3335vec2 velocity = (newPos - oldPos);
3336
3337// Discard fully transparent pixels 
3338if (gl_FragColor.a <= 0.0) discard;
3339
3340gVelocity = vec4(velocity, 0.0, 1.0);
3341`,CZ=`
3342layout(location = 1) out vec4 gVelocity;
3343`,CK=`
3344    // Discard fully transparent pixels 
3345    if (gl_FragColor.a <= 0.0) discard;
3346
3347    gVelocity = vec4(0.0, 0.0, 0.0, 1.0);
3348`,CJ=["x","y","z","w"],C$=["float","vec2","vec3","vec4"],C0={float:"f",vec2:"v2",vec3:"v3",vec4:"v4",mat4:"v4",int:"i",bool:"b","float[]":"f[]","vec4[]":"v4[]"},C1={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[]"},C2=class{constructor(){this.includes={consts:{},functions:{},structs:{}},this.cache="",this.slot="",this.shader="",this.context={},this.needsJitter=!0,this.getIncludesCode=function(){function e(e,t){return e.deps.length-t.deps.length}return function(t,i){let r=this.getIncludes(t,i);if(!r)return"";let s="";r=r.sort(e);for(let e=0;e<r.length;e++)r[e].src&&(s+=r[e].src+`
3349`);return s}}(),this.slots=[],this.caches=[],this.contexts=[],this.keywords={},this.nodeData={},this.fragmentVariables={},this.fragmentParsVariables={},this.vertexParsVariables={},this.requires={uv:[],color:[],transparent:!1,irradiance:!1,position:!1,worldPosition:!1,normal:!1,worldNormal:!1,vWorldViewDir:!1,modelMatrix:!1,viewMatrix:!1,projectionMatrix:!1},this.includes={consts:[],functions:[],structs:[]},this.attributes={}
vendor: 4,744 bytes, lines 3349-3392
3349,this.prefixCode=["#ifdef TEXTURE_LOD_EXT","	#define texCube(a, b) textureCube(a, b)","	#define texCubeBias(a, b, c) textureCubeLodEXT(a, b, c)","	#define tex2D(a, b) texture2D(a, b)","	#define tex2DBias(a, b, c) texture2DLodEXT(a, b, c)","#else","	#define texCube(a, b) textureCube(a, b)","	#define texCubeBias(a, b, c) textureCube(a, b, c)","	#define tex2D(a, b) texture2D(a, b)","	#define tex2DBias(a, b, c) texture2D(a, b, c)","#endif",`
3350			// NOTE: Include Spline's blending modes. This could be part of BlendNode
3351			#define SPE_BLENDING_NORMAL 0
3352			#define SPE_BLENDING_MULTIPLY 1
3353			#define SPE_BLENDING_SCREEN 2
3354			#define SPE_BLENDING_OVERLAY 3
3355
3356			vec3 spe_normalBlend( vec3 a, vec3 b, float alpha ) {
3357				return mix( a, b, alpha );
3358			}
3359
3360			vec3 spe_multiplyBlend( vec3 a, vec3 b, float alpha ) {
3361				return mix( a, a * b, alpha );
3362			}
3363
3364			vec3 spe_screenBlend( vec3 a, vec3 b, float alpha ) {
3365				vec3 tmp = 1.0 - ( 1.0 - a ) * ( 1.0 - b );
3366				return mix( a, tmp, alpha );
3367			}
3368
3369			vec3 spe_overlayBlend( vec3 a, vec3 b, float alpha ) {
3370				vec3 tmp = mix( 1. - 2. * (1. - a) * (1. - b), 2. * a * b, step( a, vec3(.5) ) );
3371				return clamp( mix( a, tmp, alpha ), 0.0, 1.0 );
3372			}
3373
3374			vec3 spe_blend( vec3 a, vec3 b, float alpha, int mode ) {
3375				if ( mode == SPE_BLENDING_NORMAL ) return spe_normalBlend( a, b, alpha );
3376				else if ( mode == SPE_BLENDING_MULTIPLY ) return spe_multiplyBlend( a, b, alpha );
3377				else if ( mode == SPE_BLENDING_SCREEN ) return spe_screenBlend( a, b, alpha );
3378				else if ( mode == SPE_BLENDING_OVERLAY ) return spe_overlayBlend( a, b, alpha );
3379				return vec3( 1.0 );
3380			}
3381			`,"#include <packing>","#include <common>"].join(`
3382`),this.parsCode={vertex:["float neighbor_offset = 0.0001;",""].join(`
3383`),fragment:["float accumAlpha = 0.0;",`void accumulateAlpha(float alpha) {
3384					accumAlpha += (1.0 - accumAlpha) * alpha;
3385				}`,""].join(`
3386`)},this.code={vertex:"",fragment:""},this.nodeCode={vertex:"",fragment:""},this.resultCode={vertex:"",fragment:""},this.finalCode={vertex:"",fragment:""},this.inputs={uniforms:{list:[],vertex:[],fragment:[]},arrayUniforms:{list:[],vertex:[],fragment:[]},vars:{varying:[],vertex:[],fragment:[]}},this.defines={},this.uniforms={},this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.updaters=[],this.nodes=[],this.analyzing=!1}build(e,t){this.addVertexParsCode(Cq),this.addFragmentParsCode(CX),this.buildShader("vertex",e),this.buildShader("fragment",t);for(let e=0;e<this.requires.uv.length;e++)if(this.requires.uv[e]){let t=e>0?e+1:"";this.addVaryCode("varying vec2 vUv"+t+";"),e>0&&this.addVertexParsCode("attribute vec2 uv"+t+";"),this.addVertexFinalCode("vUv"+t+" = uv"+t+";")}return this.requires.color[0]&&(this.addVaryCode("varying vec4 vColor;"),this.addVertexParsCode("attribute vec4 color;"),this.addVertexFinalCode("vColor = color;")),this.requires.color[1]&&(this.addVaryCode("varying vec4 vColor2;"),this.addVertexParsCode("attribute vec4 color2;"),this.addVertexFinalCode("vColor2 = color2;")),this.requires.position&&(this.addVaryCode("varying vec3 vPosition;"),this.addVertexFinalCode("vPosition = transformed;")),this.requires.worldPosition,this.requires.normal&&(this.addVaryCode("varying vec3 vObjectNormal;"),this.addVertexFinalCode(`
3387				#ifndef SHAPEBLEND 
3388					vObjectNormal = normal;
3389				#else
3390					vObjectNormal = objectNormal;
3391				#endif
3392			`)),this.requires.modelMatrix&&this.addFragmentParsCode("uniform mat4 modelMatrix;"),this.requires.viewMatrix&&this.addFragmentParsCode("uniform mat4 viewMatrix;"),this.requires.projectionMatrix&&this.addFragmentParsCode("uniform mat4 projectionMatrix;"),this.requires.worldNormal&&(this.addVaryCode("varying vec3 vWNormal;"),this.addVertexFinalCode("vWNormal = inverseTransformDirection( transformedNormal, viewMatrix ).xyz;")),this.requires.vWorldViewDir&&(this.addVaryCode("varying vec3 vWorldViewDir;"),this.addVertexFinalCode("vWorldViewDir = isPerspectiveMatrix( projectionMatrix ) ?  ( (modelMatrix * vec4(position, 1.0)).xyz - cameraPosition ) : vec3( -viewMatrix[0][2], -viewMatrix[1][2], -viewMatrix[2][2] );")),this.needsJitter&&(this.addVertexFinalCode(CY),this.addFragmentFinalCode(CQ)),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}
vendor: 9,914 bytes, lines 3392-3399
3392removeContext(){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){void 0===this.fragmentVariables[e]&&(this.addFragmentCode(`${t} ${e};`),this.fragmentVariables[e]="")}addFragmentParsVariable(e,t){void 0===this.fragmentParsVariables[e]&&(this.addFragmentParsCode(`${t} ${e};`),this.fragmentParsVariables[e]="")}addVertexParsVariable(e,t){void 0===this.vertexParsVariables[e]&&(this.addVertexParsCode(`${t} ${e};`),this.vertexParsVariables[e]="")}addVertexCode(e){this.addCode(e,"vertex")}addFragmentCode(e){this.addCode(e,"fragment")}addCode(e,t){this.code[t??this.shader]+=e+`
3393`}addVertexNodeCode(e){this.addNodeCode(e,"vertex")}addFragmentNodeCode(e){this.addNodeCode(e,"fragment")}addNodeCode(e,t){this.nodeCode[t??this.shader]+=e+`
3394`}clearNodeCode(e){e=e??this.shader;let t=this.nodeCode[e];return this.nodeCode[e]="",t}clearVertexNodeCode(){return this.clearNodeCode("vertex")}clearFragmentNodeCode(){return this.clearNodeCode("fragment")}addVertexFinalCode(e){this.addFinalCode(e,"vertex")}addFragmentFinalCode(e){this.addFinalCode(e,"fragment")}addFinalCode(e,t){this.finalCode[t??this.shader]+=e+`
3395`}addVertexParsCode(e){this.addParsCode(e,"vertex")}addFragmentParsCode(e){this.addParsCode(e,"fragment")}addParsCode(e,t){this.parsCode[t??this.shader]+=e+`
3396`}addVaryCode(e){this.addVertexParsCode(e),this.addFragmentParsCode(e)}isCache(e){return -1!==this.caches.indexOf(e)}isSlot(e){return -1!==this.slots.indexOf(e)}define(e,t){this.defines[e]=void 0===t?1:t}require(e){this.requires[e]=!0}isDefined(e){return void 0!==this.defines[e]}getVar(e,t,i,r="varying",s="V",a=""){let o=this.getVars(r),h=o[e];if(!h){let r=o.length;h={name:i||"node"+s+r+(a?"_"+a:""),type:t},o.push(h),o[e]=h}return h}getTempVar(e,t,i,r){return this.getVar(e,t,i,this.shader,"T",r)}getAttribute(e,t){if(!this.attributes[e]){let i=this.getVar(e,t);this.addVertexParsCode("attribute "+t+" "+e+";"),this.addVertexFinalCode(i.name+" = "+e+";"),this.attributes[e]={varying:i,name:e,type:t}}return this.attributes[e]}getCode(e){return[this.prefixCode,this.parsCode[e],this.getVarListCode(this.getVars("varying"),"varying"),this.getVarListCode(this.inputs.uniforms[e],"uniform"),this.getVarListCode(this.inputs.arrayUniforms[e],"uniform"),this.getIncludesCode("consts",e),this.getIncludesCode("structs",e),this.getIncludesCode("functions",e),"void main() {",this.getVarListCode(this.getVars(e)),this.code[e],this.resultCode[e],this.finalCode[e],"}"].join(`
3397`)}getVarListCode(e,t){t=t??"";let i="";for(let r=0,s=e.length;r<s;++r){let s=e[r],a=s.type,o=s.name,h=s.size,c=this.getFormatByType(a);if(void 0===c)throw Error("Node pars "+c+" not found.");c.includes("[]")?i+=t+" "+c.substring(0,c.length-2)+" "+o+`[${h}];
3398`:i+=t+" "+c+" "+o+`;
3399`}return i}getVars(e){return this.inputs.vars[e??this.shader]}getNodeData(e){let t=e instanceof Cg?e.uuid:e;return this.nodeData[t]=this.nodeData[t]||{}}createUniform(e,t,i,r,s,a){if(t.includes("[]")){let o=this.inputs.arrayUniforms,h=o.list.length,c=new Cv({type:t,size:i.size,name:r||"nodeUA"+h+(a?"_"+a:""),node:i,needsUpdate:s});return o.list.push(c),o[e].push(c),o[e][c.name]=c,this.uniforms[c.name]=c,c}{let o=this.inputs.uniforms,h=o.list.length,c=new Cv({type:t,name:r||"nodeU"+h+(a?"_"+a:""),node:i,needsUpdate:s});return o.list.push(c),o[e].push(c),o[e][c.name]=c,this.uniforms[c.name]=c,c}}createVertexUniform(e,t,i,r,s){return this.createUniform("vertex",e,t,i,r,s)}createFragmentUniform(e,t,i,r,s){return this.createUniform("fragment",e,t,i,r,s)}include(e,t,i){let r;if(e="string"==typeof e?Cy.get(e):e,!1===this.context.include)return e.name;e instanceof CE?r=this.includes.functions:e instanceof CT?r=this.includes.consts:e instanceof CO&&(r=this.includes.structs);let s=r[this.shader]=r[this.shader]||[];if(e){let r=s[e.name];if(r||(r=s[e.name]={node:e,deps:[]},s.push(r),r.src=e.build(this,"source")),e instanceof CE&&t&&s[t.name]&&-1===s[t.name].deps.indexOf(e)&&(s[t.name].deps.push(e),e.includes?.length)){let i=0;do this.include(e.includes[i++],t);while(i<e.includes.length)}return i&&(r.src=i),e.name}throw 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 C$[e-1]}isTypeMatrix(e){return/^m/.test(e)}getTypeLength(e){return"f"===e?1:parseInt(this.colorToVector(e).substr(1))}getTypeFromLength(e){return 1===e?"f":"v"+e}findNode(...e){for(let t=0;t<arguments.length;t++){let i=e[t];if(i?.isNode)return i}}resolve(...e){for(let t=0;t<arguments.length;t++){let i=e[t];if(void 0!==i){if(i.isNode)return i;if(i.isTexture)switch(i.mapping){case 301:case 302:return new CG(i);case 306:return new CH(new Ck(i));default:return new Ck(i)}if(i.isVector2)return new Cw(i);if(i.isVector3)return new C_(i);if(i.isVector4)return new CS(i)}}}format(e,t,i){switch(this.colorToVector(i+" <- "+t)){case"f <- v2":case"f <- v3":case"f <- v4":return e+".x";case"f <- i":case"f <- b":return"float( "+e+" )";case"v2 <- f":return"vec2( "+e+" )";case"v2 <- v3":case"v2 <- v4":return e+".xy";case"v2 <- i":case"v2 <- b":case"v3 <- i":case"v3 <- 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"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":case"i <- v3":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 C0[e]||e}getFormatByType(e){return C1[e]||e}getUUID(e,t){return(t=void 0===t||t)&&this.cache&&(e=this.cache+"-"+e),e}getElementByIndex(e){return CJ[e]}getIndexByElement(e){return CJ.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=3e3,3e3===t&&this.context.gamma&&(t=3001),t}},C3=class extends Cb{constructor(e=0,t,i,r){super("c"),this.nodeType="Color",this.value=e instanceof xA?e:new xA(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 o=e.getNodeData(i),h=this.getReadonly()&&void 0!==this.generateReadonly;if(this.alpha){let t=this.alpha.build(e,"f");e.addFragmentNodeCode(`accumAlpha += ( 1.0 - accumAlpha ) * ${t};`)}return h?this.generateReadonly(e,t,i,r,s,a):e.isShader("vertex")?(o.vertex||(o.vertex=e.createVertexUniform(r,this,s,a,this.getLabel())),e.format(o.vertex.name,r,t)):(o.fragment||(o.fragment=e.createFragmentUniform(r,this,s,a,this.getLabel())),e.format(o.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)}},C4=class extends Cb{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)}},C5=class extends Cb{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)}},C6=class extends Cb{constructor(e=1,t){super("f[]"),this.nodeType="FloatArray",this.size=e,this.value=Array.isArray(t)?t:"number"==typeof t?Array(e).fill(t):Array(e).fill(0)}},C8=class extends Cb{},C9=class extends C8{constructor(e){super("v3"),this.image=e,this._value=new iy}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}},C7=class extends C8{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)}},Me=class extends Cb{constructor(e){super("m3"),this.nodeType="Matrix3",this.value=e??new tK}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)}},Mt=class extends Cb{constructor(e){super("m4"),this.nodeType="Matrix4",this.value=e??new iY}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 Mi(e,t,i,r=0){e.setUvTransform(i[0],i[1],t[0],t[1],0,0,0).premultiply(new tK().makeRotation(r*tQ.DEG2RAD))}var Mr=class extends Me{constructor(e,t,i=0){super(new tK),this.repeat=e,this.offset=t,this.rotation=i,Mi(this.value,e,t,i)}updateMatrix(){Mi(this.value,this.repeat,this.offset,this.rotation)}},Ms=class extends Cb{constructor(e=1,t){super("v4[]"),this.nodeType="Vector4Array",this.size=e,this.value=Array.isArray(t)?t:t instanceof id?Array(e).fill(t):Array(e).fill(new id(0))}},Ma=class extends Cx{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"))return console.warn("BlendNode is not compatible with "+e.shader+" shader."),e.format("vec3( 0.0 )",this.getType(e),t);{let i=[];return i.push(this.a.build(e,"c")),i.push(this.b.build(e,"c")),i.push(this.alpha.build(e,"f")),i.push(this.mode.build(e,"i")),e.format("spe_blend("
3399+i.join(",")+")",this.getType(e),t)}}},Mn=class extends Cx{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"))return console.warn("CustomColorNode is not compatible with "+e.shader+" shader."),e.format("vec3( 0.0 )",this.getType(e),t);{let i=e.include(Mn.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)}}};Mn.Nodes={customColor:new CE(`vec3 customColor(vec3 color, float mask, float alpha, out float calpha) {
3400				float lalpha = alpha * mask;
3401				calpha =  lalpha / clamp(lalpha + accumAlpha, 0.00001, 1.0);
3402				accumAlpha += (1.0 - accumAlpha) * lalpha;
3403
3404				return color;
3405			}`)};var Mo=class extends Cx{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"))return console.warn("CustomNormalNode is not compatible with "+e.shader+" shader."),e.format("vec3( 0.0 )",this.getType(e),t);{let i=e.include(Mo.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)}}};Mo.Nodes={customNormal:new CE(`vec3 customNormal(vec3 cnormal, vec3 norm, float mask, float alpha, out float calpha) {
3406				vec3 normal = packNormalToRGB( norm ).rgb;
3407				normal *= step( vec3(0.5), cnormal );
3408
3409				float lalpha = alpha * mask;
3410				calpha =  lalpha / clamp( lalpha + accumAlpha, 0.00001, 1.0 );
3411				accumAlpha += ( 1.0 - accumAlpha ) * lalpha;
3412
3413				return normal;
3414			}`)};var Ml=class extends Cx{constructor(e,t,i,r,s,a,o,h,c,d,u,p){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=o,this.blending=h,this.mat=c,this.isMask=p,this.alpha=d,this.mode=u,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;
3414switch(this.projection.value){case 3:r=e.include(Ml.Nodes.cylindrical);break;case 2:r=e.include(Ml.Nodes.spherical);break;case 1:let s=["vec3(1.0, 0.0, 0.0)","vec3(0.0, 1.0, 0.0)","vec3(0.0, 0.0, 1.0)"][this.axis.value],a=["zy","xz","xy"][this.axis.value],o=new CE(`
3415		vec3 ${i}_planarTexture(vec3 normal, sampler2D tex, vec2 textureSize, float crop, mat3 mat, vec2 size, float blending, bool isMask, float mask, float alpha, int mode, out float calpha, out vec2 writeUv) {
3416				vec2 projected = (1. + (position.${a})) / 2.;
3417				vec2 uvs = ( mat * vec3( (projected * 2. - 1.) / (size * .5), 1. ) / 2. + 0.5 ).xy;
3418				writeUv = uvs;
3419
3420				vec4 tmp = texture2D( tex, uvs );
3421
3422				vec3 col = tmp.rgb;
3423				float lalpha = alpha * tmp.a;
3424				${2===this.side.value?"":`lalpha *= step(0.0, ${1===this.side.value?"-1.0 * ":""}dot(vObjectNormal, ${s}));`}
3425
3426				if ( crop > 0.5 ) {
3427					if ( uvs.x < 0.0 || uvs.x > 1.0 || uvs.y < 0.0 || uvs.y > 1.0 )  {
3428						lalpha = 0.0;
3429					}
3430				}
3431				
3432				lalpha *= mask;
3433
3434				calpha =  lalpha / clamp( lalpha + accumAlpha, 0.00001, 1.0 );
3435				accumAlpha += (1.0 - accumAlpha) * lalpha * (1.0 - float(isMask));
3436
3437				return col;
3438			}`);r=e.include(o);break;
vendor: 4,100 bytes, lines 3438-3522
3438case 4:r=e.include(Ml.Nodes.triplanar);break;default:r=e.include(Ml.Nodes.uv)}e.addFragmentVariable(this.calpha,"float");let h=[];if(h.push("normal"),h.push(this.texture.generate(e,"t")),h.push(this.textureSize.build(e,"v2")),h.push(this.crop.build(e,"f")),h.push(this.mat.build(e,"mat3")),h.push(this.size.build(e,"v2")),h.push(this.blending.build(e,"f")),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.mode.build(e,"i")),h.push(this.calpha),4===this.projection.value){let t=`${i}_writeUvs`,r=t+"0",s=t+"1",a=t+"2",o=`${i}_triplanarWeights`;e.addFragmentVariable(r,"vec2"),e.addFragmentVariable(s,"vec2"),e.addFragmentVariable(a,"vec2"),e.addFragmentVariable(o,"vec3"),h.push(r),h.push(s),h.push(a),h.push(o)}else{let t=`${i}_writeUvs`;e.addFragmentVariable(t,"vec2"),h.push(t)}return e.format(r+"("+h.join(",")+")",this.getType(e),t)}};Ml.Nodes={cylindrical:new CE(`
3439vec3 cylindricalTexture(vec3 normal, sampler2D tex, vec2 textureSize, float crop, mat3 mat, vec2 size, float blending, bool isMask, float mask, float alpha, int mode, out float calpha, out vec2 writeUv) {
3440                vec3 posN = normalize(position);
3441                float u = 0.5 + atan(posN.z, posN.x) / (2.*3.1415);
3442                float scaledHeight = position.y / (size.y * 0.5);
3443                float v =  (scaledHeight / 2.) + .5;
3444
3445                vec2 calculatedUv = vec2(u,v);
3446				vec2 uvs = ( mat * vec3( calculatedUv * 2. - 1., 1. ) / 2. + 0.5 ).xy;
3447				writeUv = uvs;
3448
3449                vec2 df = fwidth(uvs);
3450               	if(df.x > 0.5) df.x = 0.;
3451
3452				#ifdef GL_EXT_shader_texture_lod
3453                vec4 tmp = texture2DLodEXT(tex, uvs, log2(max(df.x, df.y)*min(textureSize.x, textureSize.y)));
3454				#else
3455                vec4 tmp = textureLod(tex, uvs, log2(max(df.x, df.y)*min(textureSize.x, textureSize.y)));
3456				#endif
3457
3458				vec3 col = tmp.rgb;
3459				float lalpha = alpha * tmp.a;
3460				if ( crop > 0.5 ) {
3461					if ( uvs.x < 0.0 || uvs.x > 1.0 || uvs.y < 0.0 || uvs.y > 1.0 )  {
3462						lalpha = 0.0;
3463					}
3464				}
3465
3466				lalpha *= mask;
3467				
3468				calpha =  lalpha / clamp( lalpha + accumAlpha, 0.00001, 1.0 );
3469				accumAlpha += (1.0 - accumAlpha) * lalpha * (1.0 - float(isMask));
3470
3471				return col;
3472			}
3473`),spherical:new CE(`
3474vec3 sphericalTexture(vec3 normal, sampler2D tex, vec2 textureSize, float crop, mat3 mat, vec2 size, float blending, bool isMask, float mask, float alpha, int mode, out float calpha, out vec2 writeUv) {
3475                vec3 posN = normalize(vPosition);
3476                float u = 0.5 + atan(posN.z, posN.x) / (2.*3.1415);
3477                float v = 0.5 + asin(posN.y) / 3.1415;
3478
3479                vec2 calculatedUv = vec2(u,v);
3480				vec2 uvs = ( mat * vec3( calculatedUv * 2. - 1., 1. ) / 2. + 0.5 ).xy;
3481				writeUv = uvs;
3482
3483                vec2 df = fwidth(uvs);
3484               	if(df.x > 0.5) df.x = 0.;
3485				#ifdef GL_EXT_shader_texture_lod
3486                vec4 tmp = texture2DLodEXT(tex, uvs, log2(max(df.x, df.y)*min(textureSize.x, textureSize.y)));
3487				#else
3488                vec4 tmp = textureLod(tex, uvs, log2(max(df.x, df.y)*min(textureSize.x, textureSize.y)));
3489				#endif
3490
3491				vec3 col = tmp.rgb;
3492				float lalpha = alpha * tmp.a;
3493				if ( crop > 0.5 ) {
3494					if ( uvs.x < 0.0 || uvs.x > 1.0 || uvs.y < 0.0 || uvs.y > 1.0 )  {
3495						lalpha = 0.0;
3496					}
3497				}
3498
3499				lalpha *= mask;
3500
3501				calpha =  lalpha / clamp( lalpha + accumAlpha, 0.00001, 1.0 );
3502				accumAlpha += (1.0 - accumAlpha) * lalpha * (1.0 - float(isMask));
3503
3504				return col;
3505			}
3506`),uv:new CE(`vec3 uvTexture(vec3 normal, sampler2D tex, vec2 textureSize, float crop, mat3 mat, vec2 size, float blending, bool isMask, float mask, float alpha, int mode, out float calpha, out vec2 writeUv) {
3507				vec2 uvs = ( mat * vec3( vUv * 2. - 1., 1. ) / 2. + 0.5 ).xy;
3508				writeUv = uvs;
3509
3510				vec4 tmp = texture2D( tex, uvs );
3511
3512				vec3 col = tmp.rgb;
3513
3514				float lalpha = alpha * tmp.a;
3515				if ( crop > 0.5 ) {
3516					if ( uvs.x < 0.0 || uvs.x > 1.0 || uvs.y < 0.0 || uvs.y > 1.0 )  {
3517						lalpha = 0.0;
3518					}
3519				}
3520				
3521				lalpha *= mask;
3522
3523				calpha =  lalpha / clamp( lalpha + accumAlpha, 0.00001, 1.0 );
3524				accumAlpha += (1.0 - accumAlpha) * lalpha * (1.0 - float(isMask));
3525
3526				return col;
3527			}`),triplanar:new CE(`vec3 triplanarTexture(vec3 normal, sampler2D tex, vec2 textureSize, float crop, mat3 mat, vec2 size, float blending, bool isMask, float mask, float alpha, int mode, out float calpha, out vec2 writeUvs0, out vec2 writeUvs1, out vec2 writeUvs2, out vec3 writeWeights) {
3528				vec3 p = position;
3529				vec2 uv0 = (1.0 + p.xy) / 2.0;     
3530				vec2 uv1 = (1.0 + p.zy) / 2.0;		
3531				vec2 uv2 = (1.0 + p.xz) / 2.0;		
3532	
3533				uv0 = (mat * vec3((uv0 * 2.0 - 1.0) / (size * 0.5), 1.0) / 2.0 + 0.5).xy;
3534				uv1 = (mat * vec3((uv1 * 2.0 - 1.0) / (size * 0.5), 1.0) / 2.0 + 0.5).xy;
3535				uv2 = (mat * vec3((uv2 * 2.0 - 1.0) / (size * 0.5), 1.0) / 2.0 + 0.5).xy;
3536
3537				// Range from 3 to 128 seems to be good
3538				float exponent = (1.0 - blending) * 125.0 + 3.0;
3539
3540				vec3 n = vObjectNormal;
3541				vec3 weights = abs(normalize(n));
3542				weights = pow(weights, vec3(exponent));
3543				weights /= dot(weights, vec3(1.0));
3544
3545				// Write out all sets of UVs that we generated
3546				writeUvs0 = uv0;
3547				writeUvs1 = uv1;
3548				writeUvs2 = uv2;
3549				writeWeights = weights;
3550
3551				// Derivatives for LOD
3552				vec2 df0 = fwidth(uv0);
3553				vec2 df1 = fwidth(uv1);
3554				vec2 df2 = fwidth(uv2);
3555				if (df0.x > 0.5) df0.x = 0.0;
3556				if (df1.x > 0.5) df1.x = 0.0;
3557				if (df2.x > 0.5) df2.x = 0.0;
3558
3559				#ifdef GL_EXT_shader_texture_lod
3560                	vec4 tmp = 
3561						texture2DLodEXT(tex, uv0, log2(max(df0.x, df0.y)*min(textureSize.x, textureSize.y))) * weights.z + 
3562						texture2DLodEXT(tex, uv1, log2(max(df1.x, df1.y)*min(textureSize.x, textureSize.y))) * weights.x + 
3563						texture2DLodEXT(tex, uv2, log2(max(df2.x, df2.y)*min(textureSize.x, textureSize.y))) * weights.y;
3564				#else
3565                	vec4 tmp = 
3566						textureLod(tex, uv0, log2(max(df0.x, df0.y)*min(textureSize.x, textureSize.y))) * weights.z + 
3567						textureLod(tex, uv1, log2(max(df1.x, df1.y)*min(textureSize.x, textureSize.y))) * weights.x + 
3568						textureLod(tex, uv2, log2(max(df2.x, df2.y)*min(textureSize.x, textureSize.y))) * weights.y;
3569				#endif
3570
3571				vec3 col = tmp.rgb;
3572				float lalpha = alpha * tmp.a;
3573
3574				// Apply cropping across all 3 planes
3575				if ( crop > 0.5 ) {
3576					if ( uv0.x < 0.0 || uv0.x > 1.0 || uv0.y < 0.0 || uv0.y > 1.0 )  {
3577						lalpha = 0.0;
3578					}
3579					if ( uv1.x < 0.0 || uv1.x > 1.0 || uv1.y < 0.0 || uv1.y > 1.0 )  {
3580						lalpha = 0.0;
3581					}
3582					if ( uv2.x < 0.0 || uv2.x > 1.0 || uv2.y < 0.0 || uv2.y > 1.0 )  {
3583						lalpha = 0.0;
3584					}
3585				}
3586
3587				lalpha *= mask;
3588				calpha =  lalpha / clamp(lalpha + accumAlpha, 0.00001, 1.0);
3589				accumAlpha += (1.0 - accumAlpha) * lalpha * (1.0 - float(isMask));
3590
3591				return col;//n * 0.5 + 0.5;
3592			}			
3593			`)};var Mh=class extends Cx{constructor(e,t,i,r,s,a,o,h,c,d,u,p){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=o,this.direction=h,this.colors=c,this.steps=d,this.isMask=p,this.alpha=u,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(e,t){let i=`g${this.uuid.toString().replace(/-/g,"")}`,r=new CE(`vec3 ${i}_sdepth(float near, float far, vec3 origin, vec3 direction, vec4 colors[${i}_MAX_COLORS], float steps[${i}_MAX_COLORS], bool isMask, float mask, float alpha, out float calpha) {
3594               vec4 color = colors[0];
3595               #ifdef ${i}_IS_VECTOR
3596                   #ifdef ${i}_LINEAR
3597                       #ifdef ${i}_WORLDSPACE
3598                       float depth = vectorLinearWorldSpaceDepth(direction, origin, near, far);
3599                       #else
3600                       float depth = vectorLinearObjectSpaceDepth(direction, origin, near, far);
3601                       #endif
3602                   #else
3603                       #ifdef ${i}_WORLDSPACE
3604                           float depth = vectorSphericalWorldSpaceDepth(origin, near, far);
3605                       #else
3606                           float depth = vectorSphericalObjectSpaceDepth(origin, near, far);
3607                       #endif
3608                   #endif
3609               #else
3610                   float dist = length(vWPosition - cameraPosition);
3611			       float depth = ( dist - near ) / ( far - near );
3612               #endif
3613
3614
3615              float p;
3616              #ifdef ${i}_SMOOTH
3617				for ( int i = 1; i < ${i}_MAX_COLORS; i++ ) {
3618						p = clamp( ( depth - steps[i-1] ) / ( steps[i] - steps[i-1] ), 0.0, 1.0 );
3619						color = mix(color, colors[i], smoothstep(0.0, 1.0, p));
3620					}
3621              #else
3622                for ( int i = 1; i < ${i}_MAX_COLORS; i++ ) {
3623                   p = clamp(( depth - steps[i - 1] ) / ( steps[i] - steps[i - 1] ), 0.0, 1.0);
3624                   color = mix(color, colors[i], p);
3625                 }
3626              #endif
3627
3628               float lalpha = alpha * color.a * mask;
3629               calpha = mix(lalpha / clamp(lalpha + accumAlpha, 0.00001, 1.0), lalpha, float(isMask));
3630			   accumAlpha += (1.0 - accumAlpha) * lalpha * (1.0 - float(isMask));
3631			   
3632               return color.rgb;
3633			}`,[Mh.Nodes.vectorLinearWorldSpaceDepth,Mh.Nodes.vectorLinearObjectSpaceDepth,Mh.Nodes.vectorSphericalObjectSpaceDepth,Mh.Nodes.vectorSphericalWorldSpaceDepth]);if(!e.isShader("fragment"))return console.warn("DepthNode is not compatible with "+e.shader+" shader."),e.format("vec3( 0.0 )",this.getType(e),t);{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`),0===this.gradientType.value&&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)}}};Mh.Nodes={vectorLinearWorldSpaceDepth:new CE(`float vectorLinearWorldSpaceDepth(vec3 direction, vec3 origin, float near, float far) {
3634               vec3 n = normalize(direction);
3635               float dist = (n.x*(vWPosition.x - origin.x) + n.y*(vWPosition.y - origin.y) + n.z*(vWPosition.z - origin.z));
3636               return ( dist - near ) / ( far - near );
3637            }`),vectorLinearObjectSpaceDepth:new CE(`float vectorLinearObjectSpaceDepth(vec3 direction, vec3 origin, float near, float far) {
3638               vec3 n = normalize(direction);
3639               float dist = (n.x*(position.x - origin.x) + n.y*(position.y - origin.y) + n.z*(position.z - origin.z));
3640               return ( dist - near ) / ( far - near );
3641            }`),vectorSphericalWorldSpaceDepth:new CE(`float vectorSphericalWorldSpaceDepth(vec3 origin, float near, float far) {
3642               float dist = length(vWPosition - origin);
3643               return ( dist - near ) / ( far - near );
3644            }`),vectorSphericalObjectSpaceDepth:new CE(`float vectorSphericalObjectSpaceDepth(vec3 origin, float near, float far) {
3645               float dist = length(position - origin);
3646               return ( dist - near ) / ( far - near );
3647            }`)};var Mc=class extends Cx{constructor(e,t,i,r,s,a,o,h){super("v3"),this.nodeType="Fresnel",this.color=e,this.bias=t,this.scale=i,this.intensity=r,this.factor=s,this.isMask=h,this.alpha=a,this.mode=o,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(e,t){if(e.require("vWorldViewDir"),e.require("worldNormal"),!e.isShader("fragment"))return console.warn("FresnelNode is not compatible with "+e.shader+" shader."),e.format("vec3( 0.0 )",this.getType(e),t);{e.addFragmentVariable(this.calpha,"float");let i=new CE(`vec3 fresnel(vec3 color, float bias, float scale, float intensity, float factor, bool isMask, float mask, float alpha, int mode, out float calpha) {
3648					float fresnel = bias + scale * pow( abs( factor + dot( normalize( vWorldViewDir ), normalize( vWNormal ) ) ), intensity );
3649
3650					float lalpha = clamp(fresnel, 0.0, 1.0) * alpha * mask;
3651					calpha = mix(lalpha / clamp(lalpha + accumAlpha, 0.00001, 1.0), lalpha, float(isMask));
3652					accumAlpha += (1.0 - accumAlpha) * lalpha * (1.0 - float(isMask));
3653
3654					return color;
3655				}`),r=e.include(i),s=[];return s.push(this.color.build(e,"c")),s.push(this.bias.build(e,"f")),s.push(this.scale.build(e,"f")),s.push(this.intensity.build(e,"f")),s.push(this.factor.build(e,"f")),s.push(this.isMask.build(e,"b")),s.push(this.mask?`luminance(${this.mask.flow(e,"v3").result})`:"1.0"),s.push(this.alpha.build(e,"f")),s.push(this.mode.build(e,"i")),s.push(this.calpha),e.format(r+"("+s.join(",")+")",this.getType(e),t)}}},Md=class extends Cx{constructor(e,t,i,r,s,a,o,h,c){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=o,this.isMask=c,this.alpha=h,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(e,t){if(!e.isShader("fragment"))return console.warn("GradientNode is not compatible with "+e.shader+" shader."),e.format("vec3( 0.0 )",this.getType(e),t);{e.define("GRAD_MAX",10),e.require("uv"),e.requires.uv=[!0],e.addFragmentVariable(this.calpha,"float");let i=e.include(Md.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)}}};Md.Nodes={gradient:new CE(`vec3 gradient(int gradientType, bool smoothed, vec4 colors[GRAD_MAX], float steps[GRAD_MAX], vec2 offset, vec2 morph, float angle, bool isMask, float mask, float alpha, out float calpha) {
3656				vec4 color = colors[0];
3657				vec2 m = morph / vUv.xy;
3658				vec2 rot = vec2( 0.5 + m.x, m.y );
3659				vec2 dt = vec2(
3660					cos( angle ) * rot.x - sin( angle ) * rot.y,
3661					sin( angle ) * rot.x + cos( angle ) * rot.y
3662				);
3663				vec2 pt = ( vUv - 0.5 + offset ) / 2.0 + dt / 2.0;
3664				float t = dot( pt, dt ) / dot( dt, dt );
3665				if ( gradientType == 1 ) {
3666					t = distance (
3667						( vUv + morph ) * 3.0,
3668						( vUv + offset ) + 1.0
3669					) + angle;
3670				} else if ( gradientType == 2 ) {
3671					float polar = atan(
3672						vUv.x + morph.x - 0.5 + offset.x,
3673						vUv.y + morph.y - 0.5 + offset.y
3674					) * -1.0;
3675					t = fract( ( angle / PI / -2.0 ) + 0.5 * ( polar / PI ) );
3676				}
3677
3678				float p;
3679				if (smoothed) {
3680					for ( int i = 1; i < GRAD_MAX; i++ ) {
3681						p = clamp( ( t - steps[i-1] ) / ( steps[i] - steps[i-1] ), 0.0, 1.0 );
3682						color = mix(color, colors[i], smoothstep(0.0, 1.0, p));
3683					}
3684
3685				} else {
3686					for ( int i = 1; i < GRAD_MAX; i++ ) {
3687						p = clamp( ( t - steps[i-1] ) / ( steps[i] - steps[i-1] ), 0.0, 1.0 );
3688						color = mix(color, colors[i], p);
3689					}
3690				}
3691
3692				float lalpha = alpha * color.a * mask;
3693				calpha = mix(lalpha / clamp(lalpha + accumAlpha, 0.00001, 1.0), lalpha, float(isMask));
3694				accumAlpha += (1.0 - accumAlpha) * lalpha * (1.0 - float(isMask));
3695				
3696				return color.xyz;
3697			}`)};var Mu=class extends Cx{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"))return console.warn("MatcapNode is not compatible with "+e.shader+" shader."),e.format("vec3( 0.0 )",this.getType(e),t);{e.addFragmentVariable(this.calpha,"float");let i=e.include(Mu.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)}}};Mu.Nodes={matcap:new CE(`vec3 matcap(sampler2D matcapTex, vec3 normal, bool isMask, float mask, float alpha, int mode, out float calpha, float rotation) {
3698					vec3 viewDir = normalize( vViewPosition );
3699					vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
3700					vec3 y = cross( viewDir, x );
3701					vec2 uv = vec2( dot( x, normal ), dot( y, normal ) );
3702					uv = mat2( cos(rotation), sin(rotation), -sin(rotation), cos(rotation) ) * uv;
3703					uv = uv * 0.495 + 0.5;
3704					vec4 matcapColor = texture2D( matcapTex, uv );
3705
3706					float lalpha = alpha * mask;
3707					calpha = mix(lalpha / clamp(lalpha + accumAlpha, 0.00001, 1.0), lalpha, float(isMask));
3708					accumAlpha += (1.0 - accumAlpha) * lalpha * (1.0 - float(isMask));
3709					
3710					return matcapColor.rgb;
3711            	}`)};
3711var Mp=(eS=new CE(`vec3 random3(vec3 c) {
3712			float j = 4096.0*sin(dot(c,vec3(17.0, 59.4, 15.0)));
3713			vec3 r;
3714			r.z = fract(512.0*j);
3715			j *= .125;
3716			r.x = fract(512.0*j);
3717			j *= .125;
3718			r.y = fract(512.0*j);
3719			return r-0.5;
3720		}`),(eC=new CE(`float simplexFast(vec3 p) {
3721			 vec3 s = floor(p + dot(p, vec3(F3)));
3722			 mediump vec3 x = p - s + dot(s, vec3(G3));
3723			 mediump vec3 hs = s;
3724			 
3725			 mediump vec3 e = step(vec3(0.0), x - x.yzx);
3726			 mediump vec3 i1 = e*(1.0 - e.zxy);
3727			 mediump vec3 i2 = 1.0 - e.zxy*(1.0 - e);
3728				
3729			 mediump vec3 x1 = x - i1 + G3;
3730			 mediump vec3 x2 = x - i2 + 2.0*G3;
3731			 mediump vec3 x3 = x - 1.0 + 3.0*G3;
3732			 
3733			 mediump vec4 w, d;
3734			 
3735			 w.x = dot(x, x);
3736			 w.y = dot(x1, x1);
3737			 w.z = dot(x2, x2);
3738			 w.w = dot(x3, x3);
3739			 
3740			 w = max(0.6 - w, 0.0);
3741			 
3742			 d.x = dot(random3(hs), x);
3743			 d.y = dot(random3(hs + i1), x1);
3744			 d.z = dot(random3(hs + i2), x2);
3745			 d.w = dot(random3(hs + 1.0), x3);
3746			 
3747			 w *= w;
3748			 w *= w;
3749			 d *= w;
3750			 
3751			 return dot(d, vec4(52.0));
3752		}`,[eS])).keywords.F3=new CT("float F3 0.3333333"),eC.keywords.G3=new CT("float G3 0.1666667"),(eM=new CE(`float simplexPrecise(vec3 p) {
3753			 vec3 s = floor(p + dot(p, vec3(F3)));
3754			 vec3 x = p - s + dot(s, vec3(G3));
3755			 
3756			 vec3 e = step(vec3(0.0), x - x.yzx);
3757			 vec3 i1 = e*(1.0 - e.zxy);
3758			 vec3 i2 = 1.0 - e.zxy*(1.0 - e);
3759				
3760			 vec3 x1 = x - i1 + G3;
3761			 vec3 x2 = x - i2 + 2.0*G3;
3762			 vec3 x3 = x - 1.0 + 3.0*G3;
3763			 
3764			 vec4 w, d;
3765			 
3766			 w.x = dot(x, x);
3767			 w.y = dot(x1, x1);
3768			 w.z = dot(x2, x2);
3769			 w.w = dot(x3, x3);
3770			 
3771			 w = max(0.6 - w, 0.0);
3772			 
3773			 d.x = dot(random3(s), x);
3774			 d.y = dot(random3(s + i1), x1);
3775			 d.z = dot(random3(s + i2), x2);
3776			 d.w = dot(random3(s + 1.0), x3);
3777			 
3778			 w *= w;
3779			 w *= w;
3780			 d *= w;
3781			 
3782			 return dot(d, vec4(52.0));
3783		}`,[eS])).keywords.F3=new CT("float F3 0.3333333"),eM.keywords.G3=new CT("float G3 0.1666667"),eE=new CE(`float simplexFractal(vec3 m) {
3784			mat3 rot1 = mat3(-0.37, 0.36, 0.85,-0.14,-0.93, 0.34,0.92, 0.01,0.4);
3785			mat3 rot2 = mat3(-0.55,-0.39, 0.74, 0.33,-0.91,-0.24,0.77, 0.12,0.63);
3786			mat3 rot3 = mat3(-0.71, 0.52,-0.47,-0.08,-0.72,-0.68,-0.7,-0.45,0.56);
3787			return 0.5333333 * simplexFast(m * rot1)
3788				 + 0.2666667 * simplexFast(2.0 * m * rot2)
3789				 + 0.1333333 * simplexFast(4.0 * m * rot3)
3790				 + 0.0666667 * simplexFast(8.0 * m);
3791		}`,[eC]),eA=new CE("vec4 permute(vec4 x){return mod(((x*34.0)+1.0)*x, 289.0);}"),eT=new CE("vec4 taylorInvSqrt(vec4 r){return 1.79284291400159 - 0.85373472095314 * r;}"),eP=new CE(`float simplexAshima(vec3 v) {
3792		  const vec2  C = vec2(1.0/6.0, 1.0/3.0) ;
3793		  const vec4  D = vec4(0.0, 0.5, 1.0, 2.0);
3794		  vec3 i  = floor(v + dot(v, C.yyy) );
3795		  vec3 x0 =   v - i + dot(i, C.xxx) ;
3796		  vec3 g = step(x0.yzx, x0.xyz);
3797		  vec3 l = 1.0 - g;
3798		  vec3 i1 = min( g.xyz, l.zxy );
3799		  vec3 i2 = max( g.xyz, l.zxy );
3800		  vec3 x1 = x0 - i1 + 1.0 * C.xxx;
3801		  vec3 x2 = x0 - i2 + 2.0 * C.xxx;
3802		  vec3 x3 = x0 - 1. + 3.0 * C.xxx;
3803		  i = mod(i, 289.0 ); 
3804		  vec4 p = permute( permute( permute( 
3805					 i.z + vec4(0.0, i1.z, i2.z, 1.0 ))
3806				   + i.y + vec4(0.0, i1.y, i2.y, 1.0 )) 
3807				   + i.x + vec4(0.0, i1.x, i2.x, 1.0 ));
3808		  float n_ = 1.0/7.0; // N=7
3809		  vec3  ns = n_ * D.wyz - D.xzx;
3810		  vec4 j = p - 49.0 * floor(p * ns.z *ns.z);  //  mod(p,N*N)
3811		  vec4 x_ = floor(j * ns.z);
3812		  vec4 y_ = floor(j - 7.0 * x_ );    // mod(j,N)
3813		  vec4 x = x_ *ns.x + ns.yyyy;
3814		  vec4 y = y_ *ns.x + ns.yyyy;
3815		  vec4 h = 1.0 - abs(x) - abs(y);
3816		  vec4 b0 = vec4( x.xy, y.xy );
3817		  vec4 b1 = vec4( x.zw, y.zw );
3818		  vec4 s0 = floor(b0)*2.0 + 1.0;
3819		  vec4 s1 = floor(b1)*2.0 + 1.0;
3820		  vec4 sh = -step(h, vec4(0.0));
3821		  vec4 a0 = b0.xzyw + s0.xzyw*sh.xxyy ;
3822		  vec4 a1 = b1.xzyw + s1.xzyw*sh.zzww ;
3823		  vec3 p0 = vec3(a0.xy,h.x);
3824		  vec3 p1 = vec3(a0.zw,h.y);
3825		  vec3 p2 = vec3(a1.xy,h.z);
3826		  vec3 p3 = vec3(a1.zw,h.w);
3827		  vec4 norm = taylorInvSqrt(vec4(dot(p0,p0), dot(p1,p1), dot(p2, p2), dot(p3,p3)));
3828		  p0 *= norm.x;
3829		  p1 *= norm.y;
3830		  p2 *= norm.z;
3831		  p3 *= norm.w;
3832		  vec4 m = max(0.6 - vec4(dot(x0,x0), dot(x1,x1), dot(x2,x2), dot(x3,x3)), 0.0);
3833		  m = m * m;
3834		  return 42.0 * dot( m*m, vec4( dot(p0,x0), dot(p1,x1), 
3835										dot(p2,x2), dot(p3,x3) ) );
3836		}`,[eA,eT]),eD=new CE("vec4 mod289(vec4 x){return x - floor(x * (1.0 / 289.0)) * 289.0;}"),eO=new CE("vec4 perm(vec4 x){return mod289(((x * 34.0) + 1.0) * x);}",[eD]),eL=new CE(`float noise(vec3 p){
3837			vec3 a = floor(p);
3838			vec3 d = p - a;
3839			d = d * d * (3.0 - 2.0 * d);
3840			vec4 b = a.xxyy + vec4(0.0, 1.0, 0.0, 1.0);
3841			vec4 k1 = perm(b.xyxy);
3842			vec4 k2 = perm(k1.xyxy + b.zzww);
3843			vec4 c = k2 + a.zzzz;
3844			vec4 k3 = perm(c);
3845			vec4 k4 = perm(c + 1.0);
3846			vec4 o1 = fract(k3 * (1.0 / 41.0));
3847			vec4 o2 = fract(k4 * (1.0 / 41.0));
3848			vec4 o3 = o2 * d.z + o1 * (1.0 - d.z);
3849			vec2 o4 = o3.yw * d.x + o3.xz * (1.0 - d.x);
3850			return o4.y * d.y + o4.x * (1.0 - d.y);
3851		}`,[eO]),(eI=new CE(`float fbm(vec3 x) {
3852			float v = 0.0;
3853			float a = 0.5;
3854			vec3 shift = vec3(100);
3855			for (int i = 0; i < NUM_OCTAVES; ++i) {
3856				v += a * noise(x);
3857				x = x * 2.0 + shift;
3858				a *= 0.5;
3859			}
3860			return v;
3861		}`,[eL])).keywords.NUM_OCTAVES=new CT("int NUM_OCTAVES 5"),eR=new CE("vec3 fade(vec3 t) {return t*t*t*(t*(t*6.0-15.0)+10.0);}"),ek=new CE(`float perlin(vec3 P){
3862		  vec3 Pi0 = floor(P);
3863		  vec3 Pi1 = Pi0 + vec3(1.0);
3864		  Pi0 = mod(Pi0, 289.0);
3865		  Pi1 = mod(Pi1, 289.0);
3866		  vec3 Pf0 = fract(P);
3867		  vec3 Pf1 = Pf0 - vec3(1.0);
3868		  vec4 ix = vec4(Pi0.x, Pi1.x, Pi0.x, Pi1.x);
3869		  vec4 iy = vec4(Pi0.yy, Pi1.yy);
3870		  vec4 iz0 = Pi0.zzzz;
3871		  vec4 iz1 = Pi1.zzzz;
3872		  vec4 ixy = permute(permute(ix) + iy);
3873		  vec4 ixy0 = permute(ixy + iz0);
3874		  vec4 ixy1 = permute(ixy + iz1);
3875		  vec4 gx0 = ixy0 / 7.0;
3876		  vec4 gy0 = fract(floor(gx0) / 7.0) - 0.5;
3877		  gx0 = fract(gx0);
3878		  vec4 gz0 = vec4(0.5) - abs(gx0) - abs(gy0);
3879		  vec4 sz0 = step(gz0, vec4(0.0));
3880		  gx0 -= sz0 * (step(0.0, gx0) - 0.5);
3881		  gy0 -= sz0 * (step(0.0, gy0) - 0.5);
3882		  vec4 gx1 = ixy1 / 7.0;
3883		  vec4 gy1 = fract(floor(gx1) / 7.0) - 0.5;
3884		  gx1 = fract(gx1);
3885		  vec4 gz1 = vec4(0.5) - abs(gx1) - abs(gy1);
3886		  vec4 sz1 = step(gz1, vec4(0.0));
3887		  gx1 -= sz1 * (step(0.0, gx1) - 0.5);
3888		  gy1 -= sz1 * (step(0.0, gy1) - 0.5);
3889		  vec3 g000 = vec3(gx0.x,gy0.x,gz0.x);
3890		  vec3 g100 = vec3(gx0.y,gy0.y,gz0.y);
3891		  vec3 g010 = vec3(gx0.z,gy0.z,gz0.z);
3892		  vec3 g110 = vec3(gx0.w,gy0.w,gz0.w);
3893		  vec3 g001 = vec3(gx1.x,gy1.x,gz1.x);
3894		  vec3 g101 = vec3(gx1.y,gy1.y,gz1.y);
3895		  vec3 g011 = vec3(gx1.z,gy1.z,gz1.z);
3896		  vec3 g111 = vec3(gx1.w,gy1.w,gz1.w);
3897		  vec4 norm0 = taylorInvSqrt(vec4(dot(g000, g000), dot(g010, g010), dot(g100, g100), dot(g110, g110)));
3898		  g000 *= norm0.x;
3899		  g010 *= norm0.y;
3900		  g100 *= norm0.z;
3901		  g110 *= norm0.w;
3902		  vec4 norm1 = taylorInvSqrt(vec4(dot(g001, g001), dot(g011, g011), dot(g101, g101), dot(g111, g111)));
3903		  g001 *= norm1.x;
3904		  g011 *= norm1.y;
3905		  g101 *= norm1.z;
3906		  g111 *= norm1.w;
3907		  float n000 = dot(g000, Pf0);
3908		  float n100 = dot(g100, vec3(Pf1.x, Pf0.yz));
3909		  float n010 = dot(g010, vec3(Pf0.x, Pf1.y, Pf0.z));
3910		  float n110 = dot(g110, vec3(Pf1.xy, Pf0.z));
3911		  float n001 = dot(g001, vec3(Pf0.xy, Pf1.z));
3912		  float n101 = dot(g101, vec3(Pf1.x, Pf0.y, Pf1.z));
3913		  float n011 = dot(g011, vec3(Pf0.x, Pf1.yz));
3914		  float n111 = dot(g111, Pf1);
3915		  vec3 fade_xyz = fade(Pf0);
3916		  vec4 n_z = mix(vec4(n000, n100, n010, n110), vec4(n001, n101, n011, n111), fade_xyz.z);
3917		  vec2 n_yz = mix(n_z.xy, n_z.zw, fade_xyz.y);
3918		  float n_xyz = mix(n_yz.x, n_yz.y, fade_xyz.x); 
3919		  return 2.2 * n_xyz;
3920		}`,[eA,eT,eR]),eB=new CE(`float hashwithoutsine13(vec3 p3)
3921		{
3922			p3  = fract(p3 * .1031);
3923			p3 += dot(p3, p3.yzx + 33.33);
3924			return fract((p3.x + p3.y) * p3.z);
3925		}`),ez=new CE(`vec3 hashwithoutsine33(vec3 p3)
3926		{
3927			p3 = fract(p3 * vec3(.1031, .1030, .0973));
3928			p3 += dot(p3, p3.yxz+33.33);
3929			return fract((p3.xxy + p3.yxx)*p3.zyx);
3930		}`),eN=new CE(`float metric(in vec3 p)
3931		{
3932			// L2 
3933			return length(p);
3934
3935			// Chebyshev 
3936			// vec3 a = abs(p);
3937			// return max(a.x, max(a.y, a.z));
3938		}`),eF=new CE(`float smin( float a, float b, float k )
3939		{
3940			float h = smoothstep(0.0, 1.0, 0.5 + 0.5 * (b - a) / k);
3941			float correction = k * h * (1.0 - h);
3942			return mix(b, a, h) - correction;
3943		}`),ej=new CE(`float smax( float a, float b, float k )
3944		{
3945			float h = smoothstep(1.0, 0.0, 0.5 + 0.5 * (a - b) / k);
3946			float correction = k * h * (1.0 - h);
3947			return mix(a, b, h) + correction;
3948		}`),eU=new CE(`float remap(float value, float input_min, float input_max, float output_min, float output_max) {
3949			// Compute width of each interval
3950			float input_width = input_max - input_min;
3951			float output_width = output_max - output_min;
3952		
3953			// Convert input range into a 0-1 range 
3954			float scaled = (value - input_min) / input_width;
3955		
3956			// Convert the 0-1 range into a value in output range
3957			return output_min + (scaled * output_width);
3958		}
3958`),{simplexFast:eC,simplexPrecise:eM,simplexFractal:eE,simplexAshima:eP,fbm:eI,perlin:ek,voronoi:new CE(`float voronoi(in vec3 x, in int style, in float smoothness, in float seed, in int quality) 
3959		{
3960			// Integer and fractional parts of this point's coordinates
3961			ivec3 p = ivec3(floor(x));
3962			vec3 f = fract(x);
3963
3964			// Different variables that we will use to construct noise:
3965			//
3966			// f1: distance to the closest feature point
3967			// f2: distance to the second closest feature point
3968			// e: distance to the closest edge (cell boundary)
3969			//
3970			// We also compute "smooth" versions of all of the above quantites, essentially
3971			// replacing "hard" minimums with "smooth" minimums (described by IQ)
3972			float f1_smooth = 8.0;
3973			float f1 = 8.0;
3974			float f2_smooth = 8.0;
3975			float f2 = 8.0;
3976			float e_smooth = 8.0;
3977			float e = 8.0;
3978
3979			// Variables stored from closest cell
3980			ivec3 mb;
3981			vec3 mr; 
3982
3983			int steps = quality;
3984			
3985			for (int x = -steps; x <= steps; x++) 
3986			for (int y = -steps; y <= steps; y++)
3987			for (int z = -steps; z <= steps; z++)
3988			{
3989				ivec3 b = ivec3(x, y, z);
3990				vec3 r = vec3(b) + hashwithoutsine33(vec3(p + b) + seed) - f;
3991				float d = length(r);
3992				
3993				f1_smooth = smin(d, f1_smooth, smoothness);
3994
3995				// Store un-smoothed distances too 
3996				if (d < f1) 
3997				{
3998					f2 = f1;
3999					f1 = d;
4000
4001					mb = ivec3(x, y, z);
4002					mr = r;
4003				} 
4004				else if (d < f2) 
4005				{
4006					f2 = d;
4007				}
4008			}	
4009			
4010			// Second pass for edge distance  
4011			// skip for styles don't need
4012			if (style != 0 &&  style != 5 && style != 7)
4013			for (int x = -steps; x <= steps; x++) 
4014			for (int y = -steps; y <= steps; y++)
4015			for (int z = -steps; z <= steps; z++)
4016			{
4017				// Start search at the cell that contains the closest point to "x" (found in 1st pass)
4018				ivec3 b = mb + ivec3(x, y, z);
4019				vec3 r = vec3(b) + hashwithoutsine33(vec3(p + b) + seed) - f;
4020				float d1 = dot(0.5 * (mr + r), (r - mr)); 				// IQ normalizes "r - mr" but that breaks things for the smooth version?
4021				float d2 = dot(0.5 * (mr + r), normalize(r - mr));
4022
4023				e_smooth = smin(d1, e_smooth, smoothness);
4024
4025				e = min(e, d2);
4026
4027				// Also compute a smooth version of F2 in this pass
4028				{
4029					ivec3 b = ivec3(x, y, z);
4030					if (b != mb) 
4031					{
4032						vec3 r = vec3(b) + hashwithoutsine33(vec3(p + b) + seed) - f;
4033						float d = length(r);
4034
4035						f2_smooth = smin(d, f2_smooth, smoothness);
4036					}
4037				}
4038			}
4039
4040			// Different visualization modes 
4041			if (style == 0) 
4042			{
4043				return f1_smooth;
4044			}
4045			if (style == 1) 
4046			{
4047				return f2_smooth;
4048			}
4049			if (style == 2) 
4050			{
4051				return f2_smooth - f1_smooth;
4052				
4053				// "Pebbles" also cool
4054				//return step(0.2, f2_smooth - f1_smooth);
4055			}
4056			if (style == 3) 
4057			{
4058				// This one is really good for rock / stone effects
4059				float a = f1; 
4060				float b = f2;
4061				float k = 3.0;
4062				float h = max(k - abs(a - b), 0.0) / k;
4063				float final = min(a, b) - h * h * k * (1.0 / 4.0);
4064				return final;
4065			}
4066			if (style == 4) 
4067			{
4068				// Some random adjustments to make this style stand out more 
4069				return exp(5.0 * e_smooth);
4070			}
4071			if (style == 5) 
4072			{
4073				return pow(f1_smooth, 3.0);
4074			}
4075			if (style == 6) 
4076			{				
4077				const float eps = 0.0125;
4078
4079				// Thicker lines as the user increases the smoothness slider
4080				float thickness = smoothness * 0.25 + eps;
4081
4082				// Blurrier lines as the user increases the smoothness slider
4083				float blur = pow(smoothness, 3.0) * 0.25 + eps;
4084
4085				return smoothstep(
4086					thickness - thickness * blur, 
4087					thickness + thickness * blur, 
4088					e
4089				);
4090			}
4091			if (style == 7) 
4092			{
4093				return hashwithoutsine13(vec3(p + mb) + seed);
4094			}
4095		}
4096	`,[eB,ez,eN,eF,ej,eU])}),Mf=class extends Cx{constructor(e,t,i,r,s,a,o,h,c,d,u,p,f,m,g,v,y,x,b){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=o,this.colorB=h,this.colorC=c,this.colorD=d,this.noiseType=p,this.voronoiStyle=m,this.highCut=g,this.lowCut=v,this.smoothness=y,this.seed=x,this.quality=b,this.isMask=f,this.alpha=u,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");
vendor: 6,645 bytes, lines 4096-4163
4096let a=["simplexFast","simplexFractal","simplexAshima","fbm","perlin","voronoi"][this.noiseType.value],o="voronoi"==a?`
4097		float v = ${a}(st + move, voronoiStyle, smoothness, seed, quality);
4098
4099		// Apply clipping to colors
4100		v = remap(v, lowCut, highCut, 0.0, 1.0);
4101		v = smax(v, 0.0, smoothness * 0.25);
4102		v = smin(v, 1.0, smoothness * 0.25);
4103
4104		// Note that the voronoi mode only uses colors "A" and "C" from the UI 
4105		vec4 color = mix(colorA, colorC, v); 
4106		`:`
4107		vec3 q = vec3(${a}(st),
4108					   ${a}(st + vec3(1.0)),
4109					   ${a}(st + vec3(1.0)));
4110		vec3 r = vec3(${a}(st + vec3(distortion, 1.0) * q + vec3(fA, 1.0) + move),
4111					  ${a}(st + vec3(distortion, 1.0) * q + vec3(fB, 1.0) + move), 
4112					  ${a}(st * q));
4113		float f = ${a}(st + r);
4114		vec4 color;
4115		color = mix(colorA, colorB, clamp((f * f) * 4.0, 0.0, 1.0));
4116		color = mix(color, colorC, clamp(length(q), 0.0, 1.0));
4117		color = mix(color, colorD, clamp(length(r.x), 0.0, 1.0));
4118		`,h=new CE(`vec3 ${a}customNoise(float scale, vec3 size, float move, vec2 fA, vec2 fB, vec2 distortion, vec4 colorA, vec4 colorB, vec4 colorC, vec4 colorD, int voronoiStyle, float highCut, float lowCut, float smoothness, float seed, int quality, bool isMask, float mask, float alpha, out float calpha) 
4119			{
4120                // Prevent scale of zero 
4121				scale = max(abs(scale), 0.001);
4122
4123				vec3 st = position / size;
4124				st /= scale;
4125
4126				${o}
4127
4128				float lalpha = alpha * color.a * mask;
4129				calpha = mix(lalpha / clamp(lalpha + accumAlpha, 0.00001, 1.0), lalpha, float(isMask));
4130				accumAlpha += (1.0 - accumAlpha) * lalpha * (1.0 - float(isMask));
4131
4132				return clamp(color, 0.0, 1.0).rgb;
4133			}`,[Mp.simplexFast,Mp.simplexFractal,Mp.simplexAshima,Mp.fbm,Mp.perlin,Mp.voronoi]),c=e.include(h),d=[];return d.push(this.scale.build(e,"f")),d.push(this.size.build(e,"v3")),d.push(this.move.build(e,"f")),d.push(this.fA.build(e,"v2")),d.push(this.fB.build(e,"v2")),d.push(this.distortion.build(e,"v2")),d.push(this.colorA.build(e,"v4")),d.push(this.colorB.build(e,"v4")),d.push(this.colorC.build(e,"v4")),d.push(this.colorD.build(e,"v4")),d.push(this.voronoiStyle.build(e,"i")),d.push(this.highCut.build(e,"f")),d.push(this.lowCut.build(e,"f")),d.push(this.smoothness.build(e,"f")),d.push(this.seed.build(e,"f")),d.push(this.quality.build(e,"i")),d.push(this.isMask.build(e,"b")),d.push(this.mask?`luminance(${this.mask.flow(e,"v3").result})`:"1.0"),d.push(this.alpha.build(e,"f")),d.push(this.calpha),e.format(c+"("+d.join(",")+")",this.getType(e),t)}};Mf.numOctaves=5;var Mm=class extends Cx{constructor(e,t,i,r,s,a,o,h,c,d,u,p,f,m,g,v){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=o,this.outlineSmoothing=h,this.contourDirection=c,this.positionalLines=d,this.compensation=u,this.resolution=p,this.normalMap=f,this.depthMap=m,this.pixelRatio=g,this.alpha=v,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 t=this.outlineWidth.build(e,"f"),r=this.resolution.build(e,"v2"),s=this.compensation.build(e,"b"),a=this.pixelRatio.build(e,"f");e.addVertexParsVariable("randomColor","attribute vec3"),e.addVertexParsVariable("extrudeNormal","attribute vec3"),e.addVertexParsVariable(t,"uniform float"),e.addVertexParsVariable(r,"uniform vec2"),e.addVertexParsVariable(s,"uniform bool"),e.addVertexParsVariable(a,"uniform float"),e.addVertexParsVariable("vID","flat out float"),e.addFragmentParsVariable("vID","flat in float"),e.addVertexFinalCode(`
4134                vID = randomColor.r;
4135                vec2 ${i}_offset = vec2(0.0);
4136                if (${s}) {
4137                    vec4 ${i}_clipPosition = projectionMatrix * (modelViewMatrix * vec4(transformed, 1.0));
4138                    // NOTE: For certain shapes, like spheres, we get incorrect extrusion when the
4139                    // normals face the camera directly. So we hackily fix this by offsetting the normal
4140                    // by a tiny amount.
4141                    vec3 ${i}_clipNormal = mat3(projectionMatrix) * (mat3(modelViewMatrix) * extrudeNormal) + 0.0000001;
4142                    ${i}_offset = normalize(${i}_clipNormal.xy) / ${r} * (${t} / 2.0) * ${i}_clipPosition.w * 2.0 * ${a};
4143                    ${i}_clipPosition.xy += ${i}_offset;
4144                    // TODO(MAX): To handle multiple outline layers, we only want to extrude
4145                    // if this offset is the biggest of all the potential offsets
4146                    gl_Position = ${i}_clipPosition;
4147                }
4148            `)}if(!e.isShader("fragment"))return console.warn("OutlineNode is not compatible with "+e.shader+" shader."),"";{e.require("uv"),e.requires.uv=[!0],e.addFragmentVariable(this.calpha,"float");let i=e.include(Mm.Nodes.outline),r=[];return r.push(this.outlineColor.build(e,"c")),r.push(this.contourColor.build(e,"c")),r.push(this.outlineWidth.build(e,"f")),r.push(this.contourWidth.build(e,"f")),r.push(this.contourThreshold.build(e,"f")),r.push(this.outlineThreshold.build(e,"f")),r.push(this.contourFrequency.build(e,"f")),r.push(this.outlineSmoothing.build(e,"f")),r.push(this.contourDirection.build(e,"v3")),r.push(this.positionalLines.build(e,"b")),r.push(this.resolution.build(e,"v2")),r.push(this.normalMap.getTexture(e,"t")),r.push(this.depthMap.getTexture(e,"t")),r.push(this.pixelRatio.build(e,"f")),r.push(this.compensation.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),this.firstTime=!this.firstTime,e.format(i+"("+r.join(",")+")",this.getType(e),t)}}};eV=new CE(`
4149float sobelSample(sampler2D t, sampler2D d, vec2 uv, vec2 resolution, float outlineWidth, float pixelRatio)
4150{
4151    vec2 halton = haltonSequence[frameIndex];
4152    float temporalOffset = getNoiseInterleavedGradient(gl_FragCoord.xy + halton);
4153    float temporalAngle  = temporalOffset * PI2;
4154
4155    vec2 texelSize = (vec2(1.0) / resolution);
4156    vec2 offsetSize = texelSize * outlineWidth * pixelRatio;
4157
4158    vec2 uvSamples[9];
4159    vec4 normalSamples[9];
4160
4161	uvSamples[0] = uv + vec2( -offsetSize.x, -offsetSize.y) + (vogelDiskSample(0, 9, temporalAngle) * texelSize);
4162	uvSamples[1] = uv + vec2(0.0, -offsetSize.y) + (vogelDiskSample(1, 9, temporalAngle) * texelSize);
4163	uvSamples[2] = uv + vec2(  offsetSize.x, -offsetSize.y) + (vogelDiskSample(2, 9, temporalAngle) * texelSize);
4164	uvSamples[3] = uv + vec2( -offsetSize.x, 0.0) + (vogelDiskSample(3, 9, temporalAngle) * texelSize);
4165	uvSamples[4] = uv;
4166	uvSamples[5] = uv + vec2(  offsetSize.x, 0.0) + (vogelDiskSample(5, 9, temporalAngle) * texelSize);
4167	uvSamples[6] = uv + vec2( -offsetSize.x, offsetSize.y) + (vogelDiskSample(6, 9, temporalAngle) * texelSize);
4168	uvSamples[7] = uv + vec2(0.0, offsetSize.y) + (vogelDiskSample(7, 9, temporalAngle) * texelSize);
4169	uvSamples[8] = uv + vec2(  offsetSize.x, offsetSize.y) + (vogelDiskSample(8, 9, temporalAngle) * texelSize);
4170
4171
4172    normalSamples[0] = texture2D(t, uvSamples[0]);
4173    normalSamples[1] = texture2D(t, uvSamples[1]);
4174    normalSamples[2] = texture2D(t, uvSamples[2]);
4175    normalSamples[3] = texture2D(t, uvSamples[3]);
4176    normalSamples[4] = texture2D(t, uvSamples[4]);
4177    normalSamples[5] = texture2D(t, uvSamples[5]);
4178    normalSamples[6] = texture2D(t, uvSamples[6]);
4179    normalSamples[7] = texture2D(t, uvSamples[7]);
4180    normalSamples[8] = texture2D(t, uvSamples[8]);
4181
4182    float depthBias = 0.0001;
4183    // TODO(MAX): Can we somehow reduce the number of conditionals here with MATH?!
4184    if (normalSamples[0].a != vID && normalSamples[0].a != 0.0) {
4185        float depthAtSample = texture2D(d, uvSamples[0]).r + depthBias;
4186        if (gl_FragCoord.z > depthAtSample) {
4187           return 0.0;
4188        }
4189    }
4190
4191    if (normalSamples[1].a != vID && normalSamples[1].a != 0.0) {
4192        float depthAtSample = texture2D(d, uvSamples[1]).r + depthBias;
4193        if (gl_FragCoord.z > depthAtSample) {
4194           return 0.0;
4195        }
4196    }
4197
4198    if (normalSamples[2].a != vID && normalSamples[2].a != 0.0) {
4199        float depthAtSample = texture2D(d, uvSamples[2]).r + depthBias;
4200        if (gl_FragCoord.z > depthAtSample) {
4201           return 0.0;
4202        }
4203    }
4204
4205    if (normalSamples[3].a != vID && normalSamples[3].a != 0.0) {
4206        float depthAtSample = texture2D(d, uvSamples[3]).r + depthBias;
4207        if (gl_FragCoord.z > depthAtSample) {
4208           return 0.0;
4209        }
4210    }
4211
4212
4213    if (normalSamples[4].a != vID && normalSamples[4].a != 0.0) {
4214        float depthAtSample = texture2D(d, uvSamples[4]).r + depthBias;
4215        if (gl_FragCoord.z > depthAtSample) {
4216           return 0.0;
4217        }
4218    }
4219
4220    if (normalSamples[5].a != vID && normalSamples[5].a != 0.0) {
4221        float depthAtSample = texture2D(d, uvSamples[5]).r + depthBias;
4222        if (gl_FragCoord.z > depthAtSample) {
4223           return 0.0;
4224        }
4225    }
4226
4227    if (normalSamples[6].a != vID && normalSamples[6].a != 0.0) {
4228        float depthAtSample = texture2D(d, uvSamples[6]).r + depthBias;
4229        if (gl_FragCoord.z > depthAtSample) {
4230           return 0.0;
4231        }
4232    }
4233
4234    if (normalSamples[7].a != vID && normalSamples[7].a != 0.0) {
4235        float depthAtSample = texture2D(d, uvSamples[7]).r + depthBias;
4236        if (gl_FragCoord.z > depthAtSample) {
4237           return 0.0;
4238        }
4239    }
4240
4241    if (normalSamples[8].a != vID && normalSamples[8].a != 0.0) {
4242        float depthAtSample = texture2D(d, uvSamples[8]).r + depthBias;
4243        if (gl_FragCoord.z > depthAtSample) {
4244           return 0.0;
4245        }
4246    }
4247
4248    vec3 sobel_edge_h = normalSamples[2].rgb + (2.0*normalSamples[5].rgb) + normalSamples[8].rgb - (normalSamples[0].rgb + (2.0*normalSamples[3].rgb) + normalSamples[6].rgb);
4249  	vec3 sobel_edge_v = normalSamples[0].rgb + (2.0*normalSamples[1].rgb) + normalSamples[2].rgb - (normalSamples[6].rgb + (2.0*normalSamples[7].rgb) + normalSamples[8].rgb);
4250
4251    float edgeNormal = sqrt(dot(sobel_edge_h, sobel_edge_h) + dot(sobel_edge_v, sobel_edge_v));
4252    return edgeNormal;
4253}
4254`),Mm.Nodes={outline:new CE(`vec3 outline(vec3 outlineColor, vec3 contourColor, float outlineWidth, float contourWidth, float outlineThreshold, float contourThreshold, float outlineSmoothing, float contourFrequency, vec3 contourDirection, bool positionalLines, vec2 resolution, sampler2D normalMap, sampler2D depthMap, float pixelRatio, bool compensation, float mask, float alpha, out float calpha) {
4255                vec3 result = outlineColor;
4256                float resultAlpha = 0.0;
4257
4258                vec3 N = normalize(vWNormal);
4259                vec2 nuv = (gl_FragCoord.xy / resolution);
4260                float sobelSample = compensation ? sobelSample(normalMap, depthMap, nuv, resolution, outlineWidth / 2., pixelRatio) : sobelSample(normalMap, depthMap, nuv, resolution, outlineWidth, pixelRatio);
4261                resultAlpha = smoothstep(outlineThreshold - outlineSmoothing, outlineThreshold + outlineSmoothing, sobelSample);
4262
4263                //resultAlpha = 1.0;
4264                //result = vec3(sobelSample);
4265
4266                float t = 1.0 - contourThreshold;
4267                if(positionalLines) {
4268                    vec3 NDir = position * contourDirection;
4269                    float NT = NDir.x + NDir.y + NDir.z;
4270                    float f  = fract(NT * contourFrequency * 0.01);
4271                    float df = fwidth(NT * contourFrequency);
4272
4273                    float g = smoothstep(df * (contourWidth * 0.01), df * (contourWidth * 0.01 * 2.0), f);
4274                    if (g < 1.0 && resultAlpha == 0.0) {
4275                        result = contourColor;
4276                        resultAlpha = 1.0;
4277                    }
4278                 }
4279                 else {
4280                    vec3 NDir = N * contourDirection;
4281                    float NT = NDir.x + NDir.y + NDir.z;
4282                    float df = fwidth(NT * contourThreshold);
4283                    float f = sin(NT * 1.0 * contourFrequency);
4284                    float g = smoothstep(0.0, df * contourWidth, 1.0 - f);
4285
4286                    if (df > (t * 0.5) && g < 1.0 && resultAlpha == 0.0) {
4287                        result = contourColor;
4288                        resultAlpha = 1.0 - g;
4289                    }
4290                 }
4291
4292                 float lalpha = alpha * resultAlpha * mask;
4293                 calpha =  lalpha / clamp( lalpha + accumAlpha, 0.00001, 1.0 );
4294                 accumAlpha += ( 1.0 - accumAlpha ) * lalpha;
4295				 
4296                 return result;
4297             }`,[eV])};var Mg=class extends Cx{constructor(e,t,i,r,s,a,o,h,c,d,u,p,f,m,g,v,y,x){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=o,this.frequency=h,this.size=c,this.variation=d,this.smoothness=u,this.zigzag=p,this.rotation=f,this.vertical=m,this.horizontal=g,this.sides=v,this.isMask=x,this.alpha=y,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(e,t){if(!e.isShader("fragment"))return console.warn("PatterNode is not compatible with "+e.shader+" shader."),e.format("vec3(0.0)",this.getType(e),t);{let i;switch(e.require("position"),e.require("uv"),e.requires.uv=[!0],e.require("normal"),e.requires.normal=!0,e.addFragmentVariable(this.calpha,"float"),this.style.value){case 0:default: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"}let r=`g${this.uuid.toString().replace(/-/g,"")}`,s=new CE(`float hashwithoutsine12(vec2 p)
4298				{
4299					vec3 p3 = fract(vec3(p.xyx) * .1031);
4300					p3 += dot(p3, p3.yzx + 33.33);
4301					return fract((p3.x + p3.y) * p3.z);
4302				}`),a=new CE(`vec2 rotate_uv(in vec2 uv, float a, bool repeat) 
4303				{
4304					const float mid = 0.5;
4305					float radians = a * (PI / 180.0);
4306					vec2 rotated = vec2(
4307						cos(radians) * (uv.x - mid) + sin(radians) * (uv.y - mid) + mid,
4308						cos(radians) * (uv.y - mid) - sin(radians) * (uv.x - mid) + mid
4309					);
4310					return repeat ? fract(rotated): rotated;
4311				}`),o="";if(4===this.projection.value){let e=2===this.style.value?`${i}(uv0, frequency, size, variation, smoothness_remapped, zigzag, rotation, sides)`:`${i}(uv0, frequency, size, variation, smoothness_remapped, zigzag, rotation)`,t=2===this.style.value?`${i}(uv1, frequency, size, variation, smoothness_remapped, zigzag, rotation, sides)`:`${i}(uv1, frequency, size, variation, smoothness_remapped, zigzag, rotation)`,r=2===this.style.value?`${i}(uv2, frequency, size, variation, smoothness_remapped, zigzag, rotation, sides)`:`${i}(uv2, frequency, size, variation, smoothness_remapped, zigzag, rotation)`;o=`
4312				vec3 p = position;
4313				float factor = 0.0125;
4314				vec2 uv0 = fract(p.xy * factor);
4315				vec2 uv1 = fract(p.zy * factor);
4316				vec2 uv2 = fract(p.xz * factor);
4317				
4318				uv0 = rotate_uv(uv0 + offset, rotation, true);
4319				uv1 = rotate_uv(uv1 + offset, rotation, true);
4320				uv2 = rotate_uv(uv2 + offset, rotation, true);
4321	
4322				float d0 = ${e};
4323				float d1 = ${t};
4324				float d2 = ${r};
4325				
4326				// Range from 3 to 128 seems to be good
4327				float exponent = (1.0 - blending) * 125.0 + 3.0;
4328
4329				vec3 n = vObjectNormal;
4330				vec3 weights = abs(normalize(n));
4331				weights = pow(weights, vec3(exponent));
4332				weights /= dot(weights, vec3(1.0));
4333				d0 *= weights.z;
4334				d1 *= weights.x;
4335				d2 *= weights.y;
4336				float draw = d0 + d1 + d2;
4337	
4338				vec2 custom_uv = uv0 * weights.z + uv1 * weights.x + uv2 * weights.y;
4339				`}else{let e=2===this.style.value?`${i}(custom_uv, frequency, size, variation, smoothness_remapped, zigzag, rotation, sides)`:`${i}(custom_uv, frequency, size, variation, smoothness_remapped, zigzag, rotation)`,t="";0===this.axis.value?t=`float radius = length(p);
4340					float theta = atan(p.y, p.z);
4341					float phi = acos(p.x / radius);`:1===this.axis.value?t=`float radius = length(p);
4342					float theta = atan(p.x, p.z);
4343					float phi = acos(p.y / radius);`:(this.axis.value,t=`float radius = length(p);
4344					float theta = atan(p.y, p.x);
4345					float phi = acos(p.z / radius);`);let r="";switch(this.projection.value){case 0:r="custom_uv = vUv.st;";break;case 1:case 3:break;case 2:r=`
4346							vec3 p = position;
4347							${t}
4348							custom_uv = vec2(theta, phi);
4349							custom_uv /= PI;
4350							`}o=`
4351				vec2 custom_uv;
4352				${r}
4353	
4354				custom_uv += offset;
4355				custom_uv = fract(custom_uv);
4356				custom_uv = rotate_uv(custom_uv, rotation, true);
4357	
4358				float draw = ${e};
4359				`}let h=new CE(`vec3 ${r}_pattern(vec3 normal, float blending, int style, vec2 offset, vec4 colorA, vec4 colorB, vec2 frequency, float size, float variation, float smoothness, float zigzag, float rotation, vec2 vertical, vec2 horizontal, int sides, bool isMask, float mask, float alpha, out float calpha) {
4360					const float TWO_PI = PI * 2.0;
4361					float smoothness_remapped = pow(smoothness, 5.0);	
4362
4363					${o}
4364
4365					// Construct final output color
4366					vec4 color = mix(colorA, colorB, draw);
4367					color.a = clamp(color.a, 0.0, 1.0);
4368
4369					// Apply cuts
4370					color.a *= 
4371						step(vertical.x, custom_uv.y) * 
4372						step(custom_uv.y, vertical.y);
4373					color.a *= 
4374						step(horizontal.x, abs(custom_uv.x)) * 
4375						step(abs(custom_uv.x), horizontal.y);
4376
4377					// Accumulate alpha 
4378					float lalpha = alpha * clamp(color.a, 0.0, 1.0) * mask;
4379					calpha = mix(lalpha / clamp(lalpha + accumAlpha, 0.00001, 1.0), lalpha, float(isMask));
4380					accumAlpha += (1.0 - accumAlpha) * lalpha * (1.0 - float(isMask));
4381
4382					return clamp(color, 0.0, 1.0).rgb;
4383				}`,[a,s,Mg.DrawFunctions.circle,Mg.DrawFunctions.ring,Mg.DrawFunctions.polygon,Mg.DrawFunctions.cross,Mg.DrawFunctions.diamond,Mg.DrawFunctions.checkerboard,Mg.DrawFunctions.line,Mg.DrawFunctions.wave]),c=e.include(h),d=[];return d.push("normal"),d.push(this.blending.build(e,"f")),d.push(this.style.build(e,"i")),d.push(this.offset.build(e,"v2")),d.push(this.colorA.build(e,"v4")),d.push(this.colorB.build(e,"v4")),d.push(this.frequency.build(e,"v2")),d.push(this.size.build(e,"f")),d.push(this.variation.build(e,"f")),d.push(this.smoothness.build(e,"f")),d.push(this.zigzag.build(e,"f")),d.push(this.rotation.build(e,"f")),d.push(this.vertical.build(e,"v2")),d.push(this.horizontal.build(e,"v2")),d.push(this.sides.build(e,"i")),d.push(this.isMask.build(e,"b")),d.push(this.mask?`luminance(${this.mask.flow(e,"v3").result})`:"1.0"),d.push(this.alpha.build(e,"f")),d.push(this.calpha),e.format(c+"("+d.join(",")+")",this.getType(e),t)}}};eW=new CE(`float hashwithoutsine12(vec2 p) {
4384				vec3 p3 = fract(vec3(p.xyx) * 0.1031);
4385				p3 += dot(p3, p3.yzx + 33.33);
4386				return fract((p3.x + p3.y) * p3.z);
4387			}`),eH=new CE(`vec2 tile_and_center(in vec2 uv, in vec2 frequency, in float variation, in float zigzag, in float rotation) {
4388                // Create tiles in UV-space
4389                uv *= frequency;
4390
4391                // Integer coords
4392                vec2 i = floor(uv);
4393
4394                // Offset every other row based on zigzag param, then compute fractional coords
4395                float row_offset = mod(i.y, 2.0);
4396                uv.x += row_offset * zigzag;
4397                vec2 f = fract(uv);
4398
4399				// Rotate the tile itself:
4400				// const float mid = 0.5;
4401				// f = vec2(
4402				// 	cos(rotation) * (f.x - mid) + sin(rotation) * (f.y - mid) + mid,
4403				// 	cos(rotation) * (f.y - mid) - sin(rotation) * (f.x - mid) + mid
4404				// );
4405				// f = fract(f);
4406
4407                f = f * 2.0 - 1.0;
4408
4409				// Recompute integer coords after shifting - then, random value per tile 
4410				i = floor(uv);
4411				float rand = (hashwithoutsine12(i) * 5.0 + 1.0);
4412				float jitter = mix(1.0, rand, variation);
4413				f *= jitter;
4414
4415                return f;
4416            }`,[eW]),eG=new CE(`float circle(in vec2 uv, in vec2 frequency, in float size, in float variation, in float smoothness, in float zigzag, in float rotation) {
4417                vec2 f = tile_and_center(uv, frequency, variation, zigzag, rotation);
4418                return smoothstep(
4419                    -smoothness, 
4420                     smoothness, 
4421                     length(f) - size
4422                );
4423            }`,[eH]),eq=new CE(`float ring(in vec2 uv, in vec2 frequency, in float size, in float variation, in float smoothness, in float zigzag, in float rotation) {
4424                vec2 f = tile_and_center(uv, frequency, variation, zigzag, rotation);
4425
4426				float d = length(f);
4427                const float inner_width = 0.5;
4428
4429                float outer = smoothstep(-smoothness, smoothness, d - size);
4430                float inner = smoothstep(-smoothness, smoothness, d - size * inner_width);
4431				return outer + (1.0 - inner);   
4432            }`,[eH]),eX=new CE(`float sdf_ngon(in vec2 p, in float r, in int n) {
4433                float an = (PI * 2.0) / float(n);
4434                float he = r * tan(0.5 * an);
4435                
4436                // Rotate to first sector
4437                p = -p.yx; 
4438                float bn = an * floor((atan(p.y, p.x) + 0.5 * an) / an);
4439                vec2  cs = vec2(cos(bn), sin(bn));
4440                p = mat2(cs.x, -cs.y, cs.y, cs.x)*p;
4441            
4442                // Side of polygon
4443                return length(p - vec2(r, clamp(p.y, -he, he))) * sign(p.x - r);
4444            }
4445            
4446            float polygon(in vec2 uv, in vec2 frequency, in float size, in float variation, in float smoothness, in float zigzag, in float rotation, in int sides) {
4447                vec2 f = tile_and_center(uv, frequency, variation, zigzag, rotation);
4448                return smoothstep(-smoothness, smoothness, sdf_ngon(f, size, sides));
4449            }
4449`,[eH]),eY=new CE(`float sdf_cross(in vec2 p, in vec2 b, float r ) {
4450                p = abs(p); 
4451				p = (p.y > p.x) ? p.yx : p.xy;
4452                vec2  q = p - b;
4453                float k = max(q.y, q.x);
4454                vec2  w = (k > 0.0) ? q : vec2(b.y - p.x, -k);
4455                return sign(k) * length(max(w, 0.0)) + r;
4456            }
4457            
4458            // Avoid namespace conflicts 
4459            float xcross(in vec2 uv, in vec2 frequency, in float size, in float variation, in float smoothness, in float zigzag, in float rotation) {
4460                vec2 f = tile_and_center(uv, frequency, variation, zigzag, rotation);
4461                return smoothstep(-smoothness, smoothness, sdf_cross(f, vec2(size, size * 0.25), smoothness));
4462            }`,[eH]),eQ=new CE(`float ndot(vec2 a, vec2 b) { 
4463                return a.x*b.x - a.y*b.y; 
4464            }
4465            
4466            float sdf_diamond(in vec2 p, in vec2 b) {
4467                p = abs(p);
4468                float h = clamp(ndot(b - 2.0 * p, b) / dot(b, b), -1.0, 1.0);
4469                float d = length(p - 0.5 * b * vec2(1.0 - h, 1.0 + h));
4470                return d * sign(p.x * b.y + p.y * b.x - b.x * b.y);
4471            }
4472
4473            float diamond(in vec2 uv, in vec2 frequency, in float size, in float variation, in float smoothness, in float zigzag, in float rotation) {
4474                vec2 f = tile_and_center(uv, frequency, variation, zigzag, rotation);
4475	            return smoothstep(-smoothness, smoothness, sdf_diamond(f, vec2(size)));
4476            }`,[eH]),eZ=new CE(`float checkerboard(in vec2 uv, in vec2 frequency, in float size, in float variation, in float smoothness, in float zigzag, in float rotation) {
4477                uv *= frequency;
4478                vec2 i = floor(uv);
4479
4480                float offset = mod(i.y, 2.0);
4481
4482                uv.x += offset + zigzag * offset;
4483                float x = floor(uv.x);
4484                
4485                return mod(x, 2.0);
4486            }`),eK=new CE(`float line(in vec2 uv, in vec2 frequency, in float size, in float variation, in float smoothness, in float zigzag, in float rotation) {
4487                vec2 f = tile_and_center(uv, frequency, 0.0, zigzag, rotation);
4488				
4489				// Different approach for variation param here
4490				float row = floor(uv * frequency).y;
4491				float rand = hashwithoutsine12(vec2(row));
4492				float s = mix(size, size * rand, variation);
4493
4494				return smoothstep(
4495					s - smoothness, 
4496					s + smoothness, 
4497					abs(f.y)
4498				);
4499            }`,[eH]),Mg.DrawFunctions={tileAndCenter:eH,circle:eG,ring:eq,polygon:eX,cross:eY,diamond:eQ,checkerboard:eZ,line:eK,wave:new CE(`// Uses bisection 
4500            float udf_cos(in vec2 p, in float a, in float b, in float c, in float d) {
4501                // Convert all data to a primitive cosine wave
4502                p = c * (p - vec2(d, a));
4503                
4504                const float TWO_PI = PI * 2.0;
4505
4506                // Reduce to principal half cycle
4507                p.x = mod(p.x, TWO_PI); 
4508                if (p.x > PI) {
4509                    p.x = TWO_PI - p.x;
4510                }
4511            
4512                // Find zero of derivative (minimize distance)
4513                float xa = 0.0;
4514                float xb = TWO_PI;
4515
4516                // 24 bit precision
4517                for (int i = 0; i < 24; i++) {
4518                    float x = 0.5 * (xa + xb);
4519                    float y = x - p.x + b * c * sin(x) * (p.y - b * c * cos(x));
4520                    if (y < 0.0) xa = x; 
4521                    else xb = x;
4522                }
4523                float x = 0.5 * (xa + xb);
4524                
4525                // Compute distance    
4526                vec2 q = vec2(x, b * c * cos(x));
4527                return length(p - q) / c;
4528            }
4529
4530            float wave(in vec2 uv, in vec2 frequency, in float size, in float variation, in float smoothness, in float zigzag, in float rotation) {
4531                float repeat = frequency.x;
4532                uv *= repeat;
4533                vec2 i = floor(uv);
4534                float row_offset = mod(i.y, 2.0);
4535                uv.x += row_offset * zigzag;
4536                vec2 f = vec2(uv.x, fract(uv.y));
4537
4538                // Generalized cosine: y(x) = a + b * cos(cx + d)
4539                const float amplitude = 0.125;
4540                float wave_frequency = frequency.y * 0.1;
4541                float distance_estimate = udf_cos(f, 0.50, amplitude, wave_frequency * (2.0 * PI), 0.0);
4542
4543				// Different approach for variation param here
4544				float rand = hashwithoutsine12(vec2(i.y));
4545				float s = mix(size, size * rand, variation);
4546
4547                return smoothstep(-smoothness, smoothness, distance_estimate - s * 0.5);
4548            }`)};var Mv=class extends Cx{constructor(e,t,i,r,s,a,o,h){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=h,this.alpha=o,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(e,t){if(e.require("vWorldViewDir"),e.require("worldNormal"),!e.isShader("fragment"))return console.warn("RainbowNode is not compatible with "+e.shader+" shader."),e.format("vec3( 0.0 )",this.getType(e),t);{e.require("uv"),e.requires.uv=[!0],e.addFragmentVariable(this.calpha,"float");
4548let i=e.include(Mv.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)}}};eJ=new CE(`vec3 attenuation(vec3 wavelengths, float filmThickness, float movement, float noiseStrength, float noiseScale, vec3 offset) {
4549				float f = 0.0;
4550				
4551				if (noiseStrength != 0.0) {
4552					vec3 st = position / noiseScale;
4553					float noise = simplexFast(1.6 * st + vec3(1.8, 1.5, 1.9) * simplexFast(st) + vec3(1.7, 9.2, 1.0));
4554					f = noise * noiseStrength;
4555				}
4556
4557				vec3 waves = wavelengths * vec3(1.0, 0.8, 0.6) + 1.0;
4558				float angle = dot(normalize(vWorldViewDir + (offset * -0.001)), normalize(vWNormal));
4559
4560				mediump vec3 color = cos((((filmThickness + f) / waves) * angle) + movement);
4561				return .5 + .5 * color;
4562			 }`,[Mp.simplexFast]),Mv.Nodes={rainbow:new CE(`vec3 rainbow(float filmThickness, float movement, vec3 wavelengths, float noiseStrength, float noiseScale, vec3 offset, bool isMask, float mask, float alpha, out float calpha) {
4563				mediump vec3 res = clamp(attenuation(wavelengths, filmThickness, movement, noiseStrength, noiseScale, offset), 0.0, 2.0);
4564
4565				float rainbowContribution = clamp(res.r + res.g + res.b, 0.0, 1.0);
4566
4567				float lalpha = alpha * rainbowContribution * mask;
4568				calpha = mix(lalpha / clamp(lalpha + accumAlpha, 0.00001, 1.0), lalpha, float(isMask));
4569				accumAlpha += (1.0 - accumAlpha) * lalpha * (1.0 - float(isMask));
4570
4571				return res;
4572			 }`,[eJ])};var My=class extends Cx{constructor(e,t,i,r,s,a,o,h,c,d){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=o,this.shadowColor=h,this.offset=c,this.alpha=d,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(e,t){if(e.require("worldNormal"),e.require("worldPosition"),!e.isShader("fragment"))return console.warn("ToonNode is not compatible with "+e.shader+" shader."),e.format("vec3( 0.0 )",this.getType(e),t);{e.define("COLORS_MAX",10),e.addFragmentVariable(this.calpha,"float");let i=e.include(My.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)}}};e$=new CE(`float rand(float n) {
4573				return fract(sin(n) * 43758.5453123);
4574			}`),e0=new CE(`float hash1(float p) { 
4575				p = fract(p * 0.011); 
4576				p *= p + 7.5; 
4577				p *= p + p; 
4578				return fract(p); 
4579			}`),e1=new CE(`float valueNoise(vec3 x) {
4580				const vec3 step = vec3(110, 241, 171);
4581			
4582				vec3 i = floor(x);
4583				vec3 f = fract(x);
4584			 
4585				// For performance, compute the base input to a 1D hash from the integer part of the argument and the 
4586				// incremental change to the 1D based on the 3D -> 1D wrapping
4587				float n = dot(i, step);
4588			
4589				vec3 u = f * f * (3.0 - 2.0 * f);
4590				return mix(mix(mix( hash1(n + dot(step, vec3(0, 0, 0))), hash1(n + dot(step, vec3(1, 0, 0))), u.x),
4591							   mix( hash1(n + dot(step, vec3(0, 1, 0))), hash1(n + dot(step, vec3(1, 1, 0))), u.x), u.y),
4592						   mix(mix( hash1(n + dot(step, vec3(0, 0, 1))), hash1(n + dot(step, vec3(1, 0, 1))), u.x),
4593							   mix( hash1(n + dot(step, vec3(0, 1, 1))), hash1(n + dot(step, vec3(1, 1, 1))), u.x), u.y), u.z);
4594			}`,[e0]),e2=new CE(`vec3 hash3(vec3 x) {
4595				x = vec3(dot(x,vec3(127.1, 311.7, 74.7)),
4596						 dot(x,vec3(269.5, 183.3, 246.1)),
4597						 dot(x,vec3(113.5, 271.9, 124.6)));
4598			
4599				return fract(sin(x)*43758.5453123);
4600			}`),e3=new CE(`vec3 voronoiNoise(in vec3 x)
4601			{
4602				vec3 p = floor(x);
4603				vec3 f = fract(x);
4604
4605				float id = 0.0;
4606				vec2 res = vec2(100.0);
4607
4608				for(int k=-1; k<=1; k++)
4609				for(int j=-1; j<=1; j++)
4610				for(int i=-1; i<=1; i++)
4611				{
4612					vec3 b = vec3(float(i), float(j), float(k));
4613
4614					// Comment out the "+ hash(p + b);" part below to get "square" cells
4615					vec3 r = vec3(b) - f + hash3(p + b);
4616					float d = dot(r, r);
4617
4618					if (d < res.x)
4619					{
4620						id = dot(p + b, vec3(1.0, 57.0, 113.0));
4621						res = vec2(d, res.x);			
4622					}
4623					else if (d < res.y)
4624					{
4625						res.y = d;
4626					}
4627				}
4628
4629				return vec3(sqrt(res), abs(id));
4630			}
4631			`,[e2]),My.Nodes={toon:new CE(`vec3 toon(int positioning, vec4 colors[COLORS_MAX], float steps[COLORS_MAX], vec3 source, bool isWorldSpace, float noiseStrength, float noiseScale, vec4 shadowColor, vec3 offset, float mask, float alpha, out float calpha) {
4632				float t = 0.0;
4633				float shadow = 1.0;
4634
4635				if (positioning == 0) {
4636
4637					// Can't do this mode if lighting is "none"
4638					#if (defined(PHONG) || defined(LAMBERT) || defined(STANDARD))
4639
4640						// Algorithm from Chapter 10 of Graphics Shaders
4641						const vec3 weights = vec3(0.2125, 0.7154, 0.0721);
4642						vec3 lpos;
4643						vec3 l;
4644						float dproduct;
4645
4646						#if (NUM_POINT_LIGHTS > 0)
4647
4648							#if defined(USE_SHADOWMAP) && (NUM_POINT_LIGHT_SHADOWS > 0)
4649								PointLightShadow pointLightShadow;
4650							#endif 
4651
4652							#pragma unroll_loop_start
4653							for (int i = 0; i < NUM_POINT_LIGHTS; i++) {
4654								// Light positions are in view-space for some reason?
4655								lpos = (inverse(viewMatrix) * vec4(pointLights[UNROLLED_LOOP_INDEX].position, 1.0)).xyz;
4656								l = normalize(lpos - worldPosition);
4657								
4658								dproduct = dot(l, normalize(worldNormal)) * 0.5 + 0.5;
4659								
4660								// TODO: we want to use "intensity" but it isn't available in the shader code
4661								//dproduct += dot(pointLights[UNROLLED_LOOP_INDEX].color, weights);
4662
4663								t = max(t, dproduct);
4664
4665								// Accumulate shadow contribution
4666								#if defined(USE_SHADOWMAP) && (UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS)
4667									pointLightShadow = pointLightShadows[UNROLLED_LOOP_INDEX];
4668									shadow *= getPointShadow( 
4669											pointShadowMap[UNROLLED_LOOP_INDEX], 
4670											pointLightShadow.shadowMapSize, 
4671											pointLightShadow.shadowBias, 
4672											pointLightShadow.shadowRadius,
4673											vPointShadowCoord[UNROLLED_LOOP_INDEX], 
4674											pointLightShadow.shadowCameraNear, 
4675											pointLightShadow.shadowCameraFar);
4676								#endif
4677							}
4678							#pragma unroll_loop_end
4679
4680						#endif
4681
4682						#if NUM_DIR_LIGHTS > 0 
4683							
4684							#if defined(USE_SHADOWMAP) && (NUM_DIR_LIGHT_SHADOWS > 0)
4685								DirectionalLightShadow directionalLightShadow;
4686							#endif 
4687
4688							#pragma unroll_loop_start
4689							for (int i = 0; i < NUM_DIR_LIGHTS; i++) {
4690								// Use the direction vector for directional lights instead
4691								l = (inverse(viewMatrix) * vec4(directionalLights[UNROLLED_LOOP_INDEX].direction, 0.0)).xyz;
4692		
4693								dproduct = dot(l, normalize(worldNormal)) * 0.5 + 0.5;
4694								t = max(t, dproduct);
4695
4696								// Accumulate shadow contribution
4697								#if defined(USE_SHADOWMAP) && (UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS)
4698									directionalLightShadow = directionalLightShadows[UNROLLED_LOOP_INDEX];
4699									shadow *= getShadow( 
4700										UNROLLED_LOOP_INDEX,
4701										directionalShadowMap[UNROLLED_LOOP_INDEX], 
4702										directionalLightShadow.shadowMapSize, 
4703										directionalLightShadow.shadowBias, 
4704										directionalLightShadow.shadowRadius, 
4705										vDirectionalShadowCoord[UNROLLED_LOOP_INDEX]);
4706								#endif
4707							}
4708							#pragma unroll_loop_end
4709
4710						#endif
4711
4712						#if NUM_SPOT_LIGHTS > 0 
4713							
4714							#if defined(USE_SHADOWMAP) && (NUM_SPOT_LIGHT_SHADOWS > 0)
4715								SpotLightShadow spotLightShadow;
4716							#endif 
4717
4718							#pragma unroll_loop_start
4719							for (int i = 0; i < NUM_SPOT_LIGHTS; i++) {
4720								lpos = (inverse(viewMatrix) * vec4(spotLights[UNROLLED_LOOP_INDEX].position, 1.0)).xyz;
4721								l = normalize(lpos - worldPosition);
4722								
4723								dproduct = dot(l, normalize(worldNormal)) * 0.5 + 0.5;
4724								t = max(t, dproduct);
4725
4726								// Accumulate shadow contribution
4727								#if defined(USE_SHADOWMAP) && (UNROLLED_LOOP_INDEX < NUM_SPOT_L
4727IGHT_SHADOWS)
4728									spotLightShadow = spotLightShadows[UNROLLED_LOOP_INDEX];
4729									shadow *= getShadow(
4730										UNROLLED_LOOP_INDEX,
4731										spotShadowMap[UNROLLED_LOOP_INDEX], 
4732										spotLightShadow.shadowMapSize, 
4733										spotLightShadow.shadowBias, 
4734										spotLightShadow.shadowRadius, 
4735										vSpotLightCoord[UNROLLED_LOOP_INDEX]);
4736								#endif
4737							}
4738							#pragma unroll_loop_end
4739
4740						#endif
4741
4742						t = clamp(t, 0.0, 1.0);
4743				
4744					#endif
4745
4746				} else if (positioning == 1) {
4747					
4748					vec3 origin = mix(position, worldPosition, float(isWorldSpace));
4749					vec3 direction = normalize(source - origin);
4750					t = dot(direction, normalize(worldNormal)) * 0.5 + 0.5;	
4751
4752				} else {
4753
4754					vec3 origin = worldPosition;
4755					vec3 source = cameraPosition - offset;
4756					vec3 direction = normalize(source - origin);
4757					t = dot(direction, normalize(worldNormal)) * 0.5 + 0.5;	
4758					
4759				}
4760
4761				if (noiseStrength > 0.0) {
4762					// Distort with noise
4763					vec3 st = position / noiseScale;
4764					
4765					// Voronoi "smooth" noise
4766					float noise = 1.0 - voronoiNoise(st).x;
4767
4768					// Voronoi cellular noise
4769					//float noise = 1.0 - rand(voronoiNoise(st).z);
4770
4771					// Position warp noise
4772					// vec3 offset = vec3(
4773					// 	simplexFast(st),
4774					// 	simplexFast(st + vec3(111.1, 143.89, 217.19)),
4775					// 	simplexFast(st + vec3(171.1, 247.89, 117.23))
4776					// );
4777					// st += offset;
4778					// float noise = valueNoise(st);
4779
4780					t += noise * noiseStrength;
4781				}
4782
4783				t = clamp(t, 0.0, 1.0);
4784
4785				// Compute ramp color
4786				float p;
4787				vec4 color = colors[0];
4788				for (int i = 1; i < COLORS_MAX; i++) {
4789					p = clamp((t - steps[i-1]) / (steps[i] - steps[i-1]), 0.0, 1.0);
4790					color = mix(color, colors[i], smoothstep(0.0, 1.0, p));
4791				}
4792
4793				// Incorporate custom shadow color
4794				if (positioning == 0) {
4795
4796					vec3 blendedShadow = mix(color.rgb, shadowColor.rgb, shadowColor.a);
4797					color.rgb = mix(blendedShadow, color.rgb, shadow);
4798				
4799				}
4800
4801				// Accumulate alpha as usual
4802				float lalpha = alpha * color.a * mask;
4803				calpha =  lalpha / clamp(lalpha + accumAlpha, 0.00001, 1.0);
4804				accumAlpha += (1.0 - accumAlpha) * lalpha;
4805
4806				return color.xyz;
4807
4808            }`,[Mp.simplexFast,e$,e1,e3])};var Mx={textureBicubic:new CE(`float w0( float a ) {
4809            return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );
4810        }
4811    
4812        float w1( float a ) {
4813            return ( 1.0 / 6.0 ) * ( a *  a * ( 3.0 * a - 6.0 ) + 4.0 );
4814        }
4815    
4816        float w2( float a ){
4817            return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );
4818        }
4819    
4820        float w3( float a ) {
4821            return ( 1.0 / 6.0 ) * ( a * a * a );
4822        }
4823    
4824        // g0 and g1 are the two amplitude functions
4825        float g0( float a ) {
4826            return w0( a ) + w1( a );
4827        }
4828    
4829        float g1( float a ) {
4830            return w2( a ) + w3( a );
4831        }
4832    
4833        // h0 and h1 are the two offset functions
4834        float h0( float a ) {
4835            return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );
4836        }
4837    
4838        float h1( float a ) {
4839            return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );
4840        }
4841    
4842        vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {
4843            uv = uv * texelSize.zw + 0.5;
4844    
4845            vec2 iuv = floor( uv );
4846            vec2 fuv = fract( uv );
4847    
4848            float g0x = g0( fuv.x );
4849            float g1x = g1( fuv.x );
4850            float h0x = h0( fuv.x );
4851            float h1x = h1( fuv.x );
4852            float h0y = h0( fuv.y );
4853            float h1y = h1( fuv.y );
4854    
4855            vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
4856            vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
4857            vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
4858            vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
4859    
4860            return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) + 
4861                   g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );
4862        }
4863
4864        vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {
4865            vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );
4866            vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );
4867            vec2 fLodSizeInv = 1.0 / fLodSize;
4868            vec2 cLodSizeInv = 1.0 / cLodSize;
4869            vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );
4870            vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );
4871            return mix( fSample, cSample, fract( lod ) );
4872        }`)},Mb=class extends Cx{constructor(e,t,i,r,s,a,o,h){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=o,this.alpha=h,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(e,t){if(e.extensions.shaderTextureLOD=!0,e.extensions.derivatives=!0,!e.isShader("fragment"))return console.warn("TransmissionNode is not compatible with "+e.shader+" shader."),e.format("vec3( 0.0 )",this.getType(e),t);
vendor: 6,287 bytes, lines 4872-4957
4872{e.define("NUM_SAMPLES",6),e.define("BLUR_SLOD",Math.pow(2,MS.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(Mb.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)}}};e4=new CE(`vec3 blur(sampler2D sp, vec2 U, vec2 scale, float lod, sampler2D dm, vec2 unrefractedU, vec2 aspectRatio) {
4873                // Slightly modified version of this:
4874                // https://www.shadertoy.com/view/ltScRG
4875
4876				// Special case for blur == 0.0
4877				if (lod == 0.0) {
4878					#ifdef TEXTURE_LOD_EXT
4879					return texture2DLodEXT( sp, U, 0.0).rgb;
4880					#else
4881					return textureLod( sp, U, 0.0).rgb;
4882					#endif
4883				}
4884				
4885				vec2 texelSize = vec2(1.0) / resolution;
4886                vec2 halton = haltonSequence[frameIndex];
4887                float temporalOffset = getNoiseInterleavedGradient(gl_FragCoord.xy + halton);
4888                float temporalAngle  = temporalOffset * PI2;
4889				vec3 res = vec3(0.0);
4890                vec2 uv = vec2(0.0);
4891                vec2 offset = vec2(0.0);
4892                vec2 vogelSample = vec2(0.0);
4893                for (int i = 0; i < NUM_SAMPLES; i++) {
4894                    vogelSample =  vogelDiskSample(i, NUM_SAMPLES, temporalAngle) * texelSize;
4895                    offset = vogelSample * scale * (lod * 10.0); // TODO: used to be hardcoded to 20
4896                    uv = U + offset;
4897                    float opaqueDepth = unpackRGBAToDepth(textureLod(dm, uv, lod));
4898                    if (opaqueDepth != 0.0 && opaqueDepth < gl_FragCoord.z) {
4899                        uv = unrefractedU;
4900                        lod = lod > 4.0 ? lod : lod / 2.0;
4901                    }
4902                    res += textureLod(sp, uv, lod).rgb;
4903                }
4904                return res / float(NUM_SAMPLES);
4905            }`),e5=new CE(`vec3 getVolumeTransmissionRay( vec3 n, vec3 v, float thickness, float ior, mat4 modelMatrix ) {
4906		        // Direction of refracted light.
4907		        vec3 refractionVector = refract( -v,  n, 1.0 / ior );
4908		        
4909				// Compute rotation-independant scaling of the model matrix.
4910		        vec3 modelScale;
4911		        modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );
4912		        modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );
4913		        modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );
4914
4915		        // The thickness is specified in local space
4916		        return normalize( refractionVector ) * thickness * modelScale;
4917	        }`),e6=new CE(`float applyIorToRoughness( float roughness, float ior ) {
4918				// Scale roughness with IOR so that an IOR of 1.0 results in no microfacet refraction and
4919				// an IOR of 1.5 results in the default amount of microfacet refraction.
4920				return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );
4921			}`),e8=new CE(`vec3 getTransmissionSample( vec2 fragCoord, float roughness, float ior, vec2 transmissionSamplerSize, sampler2D transmissionSamplerMap, sampler2D transmissionDepthMap, vec2 unrefractedCoords, vec2 aspectRatio) {
4922				// Threejs exports do not pass a depth map to this shader, so we have to fallback to the "Threejs method of blurring" - see
4923				// also the code in convertTransmission.ts, which runs during export
4924				#ifdef IS_THREEJS_EXPORT
4925					float lod = log2(transmissionSamplerSize.x) * applyIorToRoughness(roughness / 5.0, ior);
4926					return textureBicubic(transmissionSamplerMap, fragCoord.xy, lod).rgb;
4927				#else
4928					float framebufferLod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );
4929					float lod = applyIorToRoughness(roughness, ior);
4930					return blur(transmissionSamplerMap, fragCoord, vec2(lod), min(framebufferLod / 5.5, 8.5), transmissionDepthMap, unrefractedCoords, aspectRatio);
4931				#endif
4932			}`,[Mx.textureBicubic,e6,e4]),e9=new CE(`vec3 getIBLVolumeRefraction( vec3 n, vec3 v, float roughness, vec3 position, mat4 modelMatrix, mat4 viewMatrix, mat4 projMatrix, float ior, float thickness, vec2 transmissionSamplerSize, sampler2D transmissionSamplerMap, sampler2D transmissionDepthMap, vec2 aspectRatio ) {
4933				vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );
4934				vec3 refractedRayExit = position + transmissionRay;
4935
4936				// Project refracted vector on the framebuffer, while mapping to normalized device coordinates.
4937				vec4 ndcPos = projMatrix * viewMatrix *  vec4( refractedRayExit, 1.0 );
4938				vec2 refractionCoords = ndcPos.xy / ndcPos.w;
4939				refractionCoords += 1.0;
4940				refractionCoords /= 2.0;
4941
4942				vec4 ndcPosUnrefracted = projMatrix * viewMatrix * vec4(position, 1.0 );
4943				vec2 unrefractedCoords = ndcPosUnrefracted.xy / ndcPosUnrefracted.w;
4944				unrefractedCoords += 1.0;
4945				unrefractedCoords /= 2.0;
4946
4947				// Sample framebuffer to get pixel the refracted ray hits.
4948				return getTransmissionSample( refractionCoords, roughness, ior, transmissionSamplerSize, transmissionSamplerMap, transmissionDepthMap, unrefractedCoords, aspectRatio );
4949    		}`,[e8,e5]),Mb.Nodes={transmission:new CE(`vec3 transmission(float thickness, float ior, float roughness, vec2 transmissionSamplerSize, sampler2D transmissionSamplerMap, sampler2D transmissionDepthMap, vec2 aspectRatio, vec3 normal, float mask, float alpha, out float calpha) {
4950                vec3 v = vec3(0.);
4951                if (isOrthographic) {
4952                    v = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
4953                } else {
4954                    v = normalize(vWPosition - cameraPosition);
4955                }
4956                vec3 transmission = getIBLVolumeRefraction(vWNormal, -v, roughness,  vWPosition, modelMatrix, viewMatrix, projectionMatrix, ior, thickness, transmissionSamplerSize, transmissionSamplerMap, transmissionDepthMap, aspectRatio );
4957                
4958				float lalpha = alpha * mask;
4959				calpha =  lalpha / clamp( lalpha + accumAlpha, 0.00001, 1.0 );
4960				accumAlpha += ( 1.0 - accumAlpha ) * alpha;
4961
4962				return transmission;
4963            }`,[e9])};var Mw=((e7=Mw||{}).NOISE="noise",e7.MAP="map",e7),M_=class extends Cx{constructor(e,t,i,r,s,a,o,h,c,d,u){super("v3"),this.displacementTypeIndex=new C4(0),this.nodeType="VertexDisplacement",this.intensity=e,this.movementOrTexture=t,"map"===Object.values(Mw)[this.displacementTypeIndex.value]&&(this.mat=new Me(this.movementOrTexture.value.matrix)),this.cropOrOffset=i,this.scale=d,this.noiseFunctionIndex=u,this.voronoiStyle=r,this.smoothness=s,this.seed=a,this.highCut=o,this.lowCut=h,this.quality=c}generate(e,t){if(!e.isShader("vertex"))return console.warn("VertexDisplacementNode is not compatible with "+e.shader+" shader."),e.format("vec3( 0.0 )",this.getType(e),t);{e.define("USE_LAYER_DISPLACE");let i,r=[];switch(r.push("displaced_position"),r.push("displaced_normal"),Object.values(Mw)[this.displacementTypeIndex.value]){case"map":i=e.include(M_.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 t=["simplexPrecise","simplexFractal","simplexAshima","fbm","perlin","voronoi"][this.noiseFunctionIndex.value],s=new CE(`vec3 orthogonal(vec3 v) {
4964							return normalize(abs(v.x) > abs(v.z) ? vec3(-v.y, v.x, 0.0) : vec3(0.0, -v.z, v.y));
4965						}`),a="voronoi"==t?`
4966					float v = ${t}((p + offset) * scale * 0.001 + neighbour_offset + (movement * 0.1), voronoiStyle, smoothness, seed, quality);
4967					v = remap(v, lowCut, highCut, 0.0, 1.0);
4968					v = smax(v, 0.0, smoothness * 0.25);
4969					v = smin(v, 1.0, smoothness * 0.25);
4970
4971					return p + n * v * intensity;
4972					`:`
4973					return p + n * ${t}((p + offset) * scale * 0.001 + neighbour_offset + (movement * 0.1)) * intensity;
4974					`,o=new CE(`vec3 distorted(vec3 p, vec3 n, float scale, float intensity, vec3 offset, float neighbour_offset, float movement, int voronoiStyle, float smoothness, float seed, float highCut, float lowCut, int quality) {
4975							${a}
4976						}`,[Mp.simplexPrecise,Mp.simplexFractal,Mp.simplexAshima,Mp.fbm,Mp.perlin,Mp.voronoi]),h=new CE(`vec3 vertexDisplacementNoise(vec3 position, vec3 normal, float scale, vec3 offset, float movement, int voronoiStyle, float smoothness, float seed, float highCut, float lowCut, int quality, float intensity, out vec3 displaced_normal) {
4977							vec3 displaced_position = distorted(position, normal, scale, intensity, offset, neighbor_offset, movement, voronoiStyle, smoothness, seed, highCut, lowCut, quality);
4978							vec3 tangent1 = orthogonal(normal);
4979							vec3 tangent2 = normalize(cross(normal, tangent1));
4980
4981                            // TODO(Max): The distance to the neighbors was originally scaled by 0.1.
4982                            // This caused some small oval/circular visual artifacts in the lighting.
4983                            // For now, simply using neighbors further away betters the problem,
4984                            // but we should figure out the underlying cause when we have some time.
4985                            // Maybe its related to how we calculate the tangent and bitangent?
4986							vec3 nearby1 = position + tangent1;
4987							vec3 nearby2 = position + tangent2;
4988							vec3 distorted1 = distorted(nearby1, normal, scale, intensity, offset, neighbor_offset, movement, voronoiStyle, smoothness, seed, highCut, lowCut, quality);
4989							vec3 distorted2 = distorted(nearby2, normal, scale, intensity, offset, neighbor_offset, movement, voronoiStyle, smoothness, seed, highCut, lowCut, quality);
4990							displaced_normal = normalize(cross(distorted1 - displaced_position, distorted2 - displaced_position));
4991							return displaced_position;
4992						}`,[o,s]);i=e.include(h),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.qual
4992ity.build(e,"i"))}}return r.push(this.intensity.build(e,"f")),r.push("displaced_normal"),e.format(i+"("+r.join(",")+")",this.getType(e),t)}}};te=new CE(`vec3 orthogonal(vec3 v) {
4993				return normalize(abs(v.x) > abs(v.z) ? vec3(-v.y, v.x, 0.0) : vec3(0.0, -v.z, v.y));
4994			}`),tt=new CE(`float displacementMapTexture(sampler2D tex, float crop, vec2 uv, mat3 mat, vec2 offset) {
4995				vec2 uvs = (mat * vec3(uv * 2.0 - 1.0, 1.0) / 2.0 + 0.5).xy + offset;
4996				vec4 tmp = texture2D(tex, uvs);
4997				vec3 col = tmp.rgb;
4998				if (crop > 0.5) {
4999					if ( uvs.x < 0.0 || uvs.x > 1.0 || uvs.y < 0.0 || uvs.y > 1.0 )  {
5000						return 0.0;
5001					}
5002				}
5003				return col.r;
5004			}`),M_.Nodes={map:new CE(`vec3 vertexDisplacementMap(vec3 position, vec3 normal, sampler2D tex, vec2 uv, float crop, mat3 mat, float intensity, out vec3 displaced_normal) {
5005				vec3 displaced_position = position + normal * displacementMapTexture(tex, crop, uv, mat, vec2(0.0)) * intensity;
5006				vec3 tangent1 = normalize(orthogonal(normal));
5007				vec3 tangent2 = normalize(cross(normal, tangent1));
5008				vec3 nearby1 = position + tangent1 * 0.1;
5009				vec3 nearby2 = position + tangent2 * 0.1;
5010				vec3 distorted1 = nearby1 + normal * displacementMapTexture(tex, crop, uv, mat, vec2(neighbor_offset)) * intensity;
5011				vec3 distorted2 = nearby2 + normal * displacementMapTexture(tex, crop, uv, mat, vec2(neighbor_offset)) * intensity;
5012				displaced_normal = normalize(cross(distorted1 - displaced_position, distorted2 - displaced_position));
5013				return displaced_position;
5014			}`,[te,tt])};var MS={normalRenderTarget:new Ck,normalRenderTargetDepth:new Ck,transmissionRenderTarget:new Ck,aspectRatio:new Cw,transmissionSize:new Cw(2048,2048),transmissionRenderTargetDepth:new Ck,aoRenderTarget:new Ck,aoEnabled:new C5,pixelRatioNode:new CB(1),resolution:new Cw,penumbraSize:new C6(5,.5),frameIndex:new C4(0),transmissionLod:new C4(2)};for(let e of Object.values(MS))e.isRenderGlobal=!0;var MC,MM,ME,MA,MT,MP={skiaWasmUrl:"https://unpkg.com/@splinetool/[email protected]/build/ui.wasm"},MD=class extends Cg{constructor(){super("basic"),this.nodeType="Basic",this.color=new C3(5526619),this.shadingAlpha=new CB(1),this.shadingBlend=new C4(0),this.previousModelViewMatrix=new Mt,this.previouseProjectionMatrix=new Mt}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:MS.frameIndex}),e.mergeUniform({resolution:MS.resolution}),e.mergeUniform({previousModelViewMatrix:this.previousModelViewMatrix}),e.mergeUniform({previousProjectionMatrix:this.previouseProjectionMatrix}),e.mergeUniform(r1([su.fog])),e.addParsCode(["varying vec3 vViewPosition;","varying vec3 vWPosition;","#include <fog_pars_vertex>","#include <skinning_pars_vertex>","#include <normal_pars_vertex>","#include <morphtarget_pars_vertex>"].join(`
5015`));let r=["#include <beginnormal_vertex>","#include <morphnormal_vertex>",`
5016				#include <skinbase_vertex>
5017				#include <skinnormal_vertex>
5018				#if !defined( USE_LAYER_DISPLACE )
5019					#include <defaultnormal_vertex>
5020				#endif
5021
5022				vec3 displaced_position = position;
5023				vec3 displaced_normal = normal;
5024
5025				#if defined( USE_LAYER_DISPLACE )
5026					vec3 transformed;
5027					vec3 transformedNormal;
5028				#endif
5029				`,"#include <normal_vertex>",`
5030				#if !defined( USE_LAYER_DISPLACE )
5031					#include <begin_vertex>
5032				#endif /* !USE_LAYER_DISPLACE */
5033				`];i&&r.push(i.code,i.result?"displaced_position = "+i.result+";
5033":""),r.push("transformed = displaced_position;","#include <morphtarget_vertex>","#include <skinning_vertex>","transformedNormal = normalMatrix * displaced_normal;","#ifndef FLAT_SHADED","	vNormal = transformedNormal;","#endif"),r.push("#include <project_vertex>","#include <fog_vertex>","#include <clipping_planes_vertex>","	vViewPosition = - mvPosition.xyz;","#include <worldpos_vertex>"),r.push("vWPosition = ( modelMatrix * vec4( transformed, 1.0 ) ).xyz;"),t=r.join(`
5034`)}else{void 0===this.color&&(this.color=new C3(5526619)),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=void 0!==r,e.addParsCode(["varying vec3 vWPosition;","#include <fog_pars_fragment>","#include <dithering_pars_fragment>","varying vec3 vViewPosition;","#include <normal_pars_fragment>"].join(`
5035`));let o=["#include <normal_fragment_begin>",i.code];r&&o.push(r.code,"#ifdef ALPHATEST"," if ( "+r.result+" <= ALPHATEST ) discard;","#endif"),a?o.push(a.code,`vec3 outgoingLight = ${i.result};`,`vec3 finalColor = spe_blend(outgoingLight, ${a.result}, 1.0, SPE_BLENDING_NORMAL);`):o.push(`vec3 finalColor = ${i.result};`);let h="1.0";this.mask&&(this.mask.analyze(e),h=`luminance(${this.mask.flow(e,"v3").result})`),r?o.push(`gl_FragColor = vec4( finalColor, accumAlpha * ${r.result} * ${h} );`):o.push("gl_FragColor = vec4("+i.result+", 1.0 );"),s&&o.push(`gl_FragColor.a *= ${s.result};`),o.push("#include <fog_fragment>","#include <dithering_fragment>"),t=o.join(`
5036`)}return t}},MO=class extends Cg{constructor(){super("lambert"),this.nodeType="Lambert",this.color=new C3(5526619),this.emissive=new C3(0),this.emissiveIntensity=new CB(1),this.previousModelViewMatrix=new Mt,this.previouseProjectionMatrix=new Mt,this.shadingAlpha=new CB(1),this.shadingBlend=new C4(0),this.occlusion=new C5(!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:MS.frameIndex}),e.mergeUniform({resolution:MS.resolution}),e.mergeUniform({previousModelViewMatrix:this.previousModelViewMatrix}),e.mergeUniform({previousProjectionMatrix:this.previouseProjectionMatrix}),e.mergeUniform(r1([su.fog,su.lights])),e.addParsCode(["varying vec3 vViewPosition;","varying vec3 vWPosition;","varying vec3 vLightFront;","varying vec3 vIndirectFront;","#ifndef DOUBLE_SIDED","   #define DOUBLE_SIDED","#endif","#ifdef DOUBLE_SIDED","	varying vec3 vLightBack;","	varying vec3 vIndirectBack;","#endif","#include <bsdfs>","#include <lights_pars_begin>","#include <color_pars_vertex>","#include <fog_pars_vertex>","#include <skinning_pars_vertex>","#include <normal_pars_vertex>","#include <morphtarget_pars_vertex>","#include <shadowmap_pars_vertex>","#include <clipping_planes_pars_vertex>"].join(`
5037`));let r=["#include <beginnormal_vertex>","#include <morphnormal_vertex>",`
5038				#include <skinbase_vertex>
5039				#include <skinnormal_vertex>
5040				#ifndef USE_LAYER_DISPLACE
5041					#include <defaultnormal_vertex>
5042				#endif
5043
5044				vec3 displaced_position = position;
5045				vec3 displaced_normal = objectNormal;
5046
5047				#ifdef USE_LAYER_DISPLACE
5048					vec3 transformed;
5049					vec3 transformedNormal;
5050				#endif
5051				`,"#include <normal_vertex>",`
5052				#ifndef USE_LAYER_DISPLACE
5053					#include <begin_vertex>
5054				#endif
5055				`];i&&r.push(i.code,i.result?"displaced_position = "+i.result+";
5055":""),r.push("transformed = displaced_position;","#include <morphtarget_vertex>","#include <skinning_vertex>","transformedNormal = normalMatrix * displaced_normal;","#ifndef FLAT_SHADED","    vNormal = transformedNormal;","#endif"),r.push("	#include <project_vertex>","	#include <clipping_planes_vertex>","	vViewPosition = - mvPosition.xyz;","	#include <worldpos_vertex>",`
5056					vec3 diffuse = vec3( 1.0 );
5057					GeometricContext geometry;
5058					geometry.position = mvPosition.xyz;
5059					geometry.normal = normalize( transformedNormal );
5060					geometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );
5061				`),r.push(`
5062					GeometricContext backGeometry;
5063					backGeometry.position = geometry.position;
5064					backGeometry.normal = -geometry.normal;
5065					backGeometry.viewDir = geometry.viewDir;
5066					vLightFront = vec3( 0.0 );
5067					vIndirectFront = vec3( 0.0 );
5068					#ifdef DOUBLE_SIDED
5069						vLightBack = vec3( 0.0 );
5070						vIndirectBack = vec3( 0.0 );
5071					#endif
5072					IncidentLight directLight;
5073					float dotNL;
5074					vec3 directLightColor_Diffuse;
5075					vIndirectFront += getAmbientLightIrradiance( ambientLightColor );
5076					vIndirectFront += getLightProbeIrradiance( lightProbe, geometry.normal );
5077					#ifdef DOUBLE_SIDED
5078						vIndirectBack += getAmbientLightIrradiance( ambientLightColor );
5079						vIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry.normal );
5080					#endif
5081					#if NUM_POINT_LIGHTS > 0
5082						#pragma unroll_loop_start
5083						for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
5084							getPointLightInfo( pointLights[ i ], geometry, directLight );
5085							dotNL = dot( geometry.normal, directLight.direction );
5086							directLightColor_Diffuse = directLight.color;
5087							vLightFront += saturate( dotNL ) * directLightColor_Diffuse;
5088							#ifdef DOUBLE_SIDED
5089								vLightBack += saturate( -dotNL ) * directLightColor_Diffuse;
5090							#endif
5091						}
5092						#pragma unroll_loop_end
5093					#endif
5094					#if NUM_SPOT_LIGHTS > 0
5095						#pragma unroll_loop_start
5096						for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
5097							getSpotLightInfo( spotLights[ i ], geometry, directLight );
5098							dotNL = dot( geometry.normal, directLight.direction );
5099							directLightColor_Diffuse = directLight.color;
5100							vLightFront += saturate( dotNL ) * directLightColor_Diffuse;
5101							#ifdef DOUBLE_SIDED
5102								vLightBack += saturate( -dotNL ) * directLightColor_Diffuse;
5103							#endif
5104						}
5105						#pragma unroll_loop_end
5106					#endif
5107					#if NUM_DIR_LIGHTS > 0
5108						#pragma unroll_loop_start
5109						for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
5110							getDirectionalLightInfo( directionalLights[ i ], geometry, directLight );
5111							dotNL = dot( geometry.normal, directLight.direction );
5112							directLightColor_Diffuse = directLight.color;
5113							vLightFront += saturate( dotNL ) * directLightColor_Diffuse;
5114							#ifdef DOUBLE_SIDED
5115								vLightBack += saturate( -dotNL ) * directLightColor_Diffuse;
5116							#endif
5117						}
5118						#pragma unroll_loop_end
5119					#endif
5120					#if NUM_HEMI_LIGHTS > 0
5121						#pragma unroll_loop_start
5122						for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
5123							vIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );
5124							#ifdef DOUBLE_SIDED
5125								vIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry.normal );
5126							#endif
5127						}
5128						#pragma unroll_loop_end
5129					#endif
5130				`,"	#include <shadowmap_vertex>","	#include <fog_vertex>"),r.push("vWPosition = ( modelMatrix * vec4( transformed, 1.0 ) ).xyz;"),t=r.join(`
5131`)}else{e.mergeUniform({penumbraSize:MS.penumbraSize}),e.mergeUniform({frameIndex:MS.frameIndex}),e.mergeUniform({aoMap:MS.aoRenderTarget}),e.mergeUniform({aoEnabled:MS.aoEnabled}),void 0===this.color&&(this.color=new C3(5526619)),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: 6,225 bytes, lines 5131-5197
5131),o=this.shadingAlpha.flow(e,"f"),h=this.shadingBlend.flow(e,"i"),c=this.afterColor?this.afterColor.flow(e,"c",{slot:"afterColor"}):void 0,d=this.alpha?this.alpha.flow(e,"f"):void 0,u=this.alphaOverride?this.alphaOverride.flow(e,"f"):void 0;e.requires.transparent=void 0!==d,e.addParsCode(["uniform float penumbraSize[5];","uniform sampler2D aoMap;","uniform bool aoEnabled;","varying vec3 vViewPosition;","varying vec3 vWPosition;","varying vec3 vLightFront;","varying vec3 vIndirectFront;","#ifndef DOUBLE_SIDED","   #define DOUBLE_SIDED","#endif","#include <normal_pars_fragment>","#ifdef DOUBLE_SIDED","	varying vec3 vLightBack;","	varying vec3 vIndirectBack;","#endif","#include <bsdfs>","#include <lights_pars_begin>","#include <fog_pars_fragment>","#include <shadowmap_pars_fragment>","#include <shadowmask_pars_fragment>","#include <clipping_planes_pars_fragment>","#include <dithering_pars_fragment>"].join(`
5132`));let p=["#include <normal_fragment_begin>",`
5133				// NOTE: gl_FrontFacing alternative using face normal estimation.
5134				vec3 viewdx = dFdx(vViewPosition);
5135				vec3 viewdy = dFdy(vViewPosition);
5136				vec3 faceNormal = normalize(cross(viewdx, viewdy));
5137				bool isFrontFacing = (dot(normal, faceNormal) >= 0.0);
5138				`,"#include <clipping_planes_fragment>"];p.push(i.code,"vec3 diffuseColor = "+i.result+";","ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );"),d&&p.push(d.code,"#ifdef ALPHATEST","if ( "+d.result+" <= ALPHATEST ) discard;","#endif"),p.push("#ifdef DOUBLE_SIDED","	reflectedLight.indirectDiffuse += ( isFrontFacing ) ? vIndirectFront : vIndirectBack;","#else","	reflectedLight.indirectDiffuse += vIndirectFront;","#endif","#include <lightmap_fragment>","reflectedLight.indirectDiffuse *= BRDF_Lambert( diffuseColor.rgb );","#ifdef DOUBLE_SIDED","	reflectedLight.directDiffuse = ( isFrontFacing ) ? vLightFront : vLightBack;","#else","	reflectedLight.directDiffuse = vLightFront;","#endif","reflectedLight.directDiffuse *= BRDF_Lambert( diffuseColor.rgb ) * getShadowMask();"),r&&p.push(r.code,"reflectedLight.directDiffuse += "+r.result+" * "+s.result+";"),p.push("vec3 ao = aoEnabled && "+a.result+" ? tex2D(aoMap, gl_FragCoord.xy / resolution).rgb : vec3(1.0);","vec3 outgoingLight = (reflectedLight.directDiffuse + reflectedLight.indirectDiffuse) ;");let f="1.0";this.mask&&(this.mask.analyze(e),f=`luminance(${this.mask.flow(e,"v3").result})`),p.push(`
5139				if (outgoingLight != diffuseColor) {
5140					float lightAccu = clamp( length( reflectedLight.directSpecular + reflectedLight.indirectSpecular ), 0.0, 1.0 );
5141					accumAlpha += ( 1.0 - accumAlpha ) * ${o.result} * ${f} * lightAccu;
5142					outgoingLight = spe_blend( diffuseColor, outgoingLight, ${o.result} * ${f}, ${h.result} );
5143
5144					outgoingLight *= ao;
5145				}
5146				`),c&&p.push(c.code,`outgoingLight = spe_blend(outgoingLight, ${c.result}, 1.0, SPE_BLENDING_NORMAL);`),d?p.push(`gl_FragColor = vec4( outgoingLight, accumAlpha * ${d.result} );`):p.push("gl_FragColor = vec4( outgoingLight, 1.0 );"),u&&p.push(`gl_FragColor.a *= ${u.result};`),p.push("#include <encodings_fragment>","#include <fog_fragment>","#include <dithering_fragment>"),t=p.join(`
5147`)}return t}},ML={dHdxy:new CE(`vec2 dHdxy(sampler2D bumpMap, vec2 bumpMapUv, float bumpScale) {
5148
5149            // Gradient of UVs w.r.t. X coordinate (in screen-space)
5150            vec2 dSTdx = dFdx(bumpMapUv);
5151
5152            // Gradient of UVs w.r.t. Y coordinate (in screen-space)
5153            vec2 dSTdy = dFdy(bumpMapUv);
5154            
5155            // Forward differencing
5156            float Hll = bumpScale * luminance(texture(bumpMap, bumpMapUv).rgb);
5157            float dBx = bumpScale * luminance(texture(bumpMap, bumpMapUv + dSTdx).rgb) - Hll;
5158            float dBy = bumpScale * luminance(texture(bumpMap, bumpMapUv + dSTdy).rgb) - Hll;
5159            
5160            return vec2( dBx, dBy );
5161        }`),perturbNormalArb:new CE(`vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {
5162            vec3 vSigmaX = dFdx( surf_pos.xyz );
5163            vec3 vSigmaY = dFdy( surf_pos.xyz );
5164            vec3 vN = surf_norm; // normalized
5165            
5166            vN = normalize(vN);
5167
5168            vec3 R1 = cross( vSigmaY, vN );
5169            vec3 R2 = cross( vN, vSigmaX );
5170
5171            R1 = normalize(R1);
5172            R2 = normalize(R2);
5173    
5174            float fDet = dot( vSigmaX, R1 ) * faceDirection;
5175    
5176            vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
5177            return normalize( abs( fDet ) * vN - vGrad );
5178        }`)},MI=class extends Cg{constructor(){super("phong"),this.nodeType="Phong",this.color=new C3(5526619),this.specular=new C3(1118481),this.shininess=new CB(30),this.previousModelViewMatrix=new Mt,this.previouseProjectionMatrix=new Mt,this.shadingAlpha=new CB(1),this.shadingBlend=new C4(0),this.occlusion=new C5(!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:MS.frameIndex}),e.mergeUniform({resolution:MS.resolution}),e.mergeUniform({previousModelViewMatrix:this.previousModelViewMatrix}),e.mergeUniform({previousProjectionMatrix:this.previouseProjectionMatrix}),e.mergeUniform(r1([su.fog,su.lights])),e.addParsCode(["varying vec3 vViewPosition;","varying vec3 vWPosition;","#include <fog_pars_vertex>","#include <skinning_pars_vertex>","#include <normal_pars_vertex>","#include <morphtarget_pars_vertex>","#include <shadowmap_pars_vertex>","#include <clipping_planes_pars_vertex>"].join(`
5179`));let r=["#include <beginnormal_vertex>","#include <morphnormal_vertex>",`
5180				#include <skinbase_vertex>
5181				#include <skinnormal_vertex>
5182				#ifndef USE_LAYER_DISPLACE
5183					#include <defaultnormal_vertex>
5184				#endif
5185
5186				vec3 displaced_position = position;
5187				vec3 displaced_normal = objectNormal;
5188
5189				#ifdef USE_LAYER_DISPLACE
5190					vec3 transformed;
5191					vec3 transformedNormal;
5192				#endif
5193				`,"#include <normal_vertex>",`
5194				#ifndef USE_LAYER_DISPLACE
5195					#include <begin_vertex>
5196				#endif
5197				`];i&&r.push(i.code,i.result?"displaced_position = "+i.result+";
5197":""),r.push("transformed = displaced_position;","#include <morphtarget_vertex>","#include <skinning_vertex>","transformedNormal = normalMatrix * displaced_normal;","#ifndef FLAT_SHADED","    vNormal = transformedNormal;","#endif"),r.push("	#include <project_vertex>","	#include <clipping_planes_vertex>","	vViewPosition = - mvPosition.xyz;","	#include <worldpos_vertex>","	#include <shadowmap_vertex>","	#include <fog_vertex>"),r.push("vWPosition = ( modelMatrix * vec4( transformed, 1.0 ) ).xyz;"),t=r.join(`
5198`)}else{e.mergeUniform({penumbraSize:MS.penumbraSize}),e.mergeUniform({frameIndex:MS.frameIndex}),e.mergeUniform({aoMap:MS.aoRenderTarget}),e.mergeUniform({aoEnabled:MS.aoEnabled}),void 0===this.color&&(this.color=new C3(5526619)),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"),o=this.shadingAlpha.flow(e,"f"),h=this.shadingBlend.flow(e,"i"),c=this.afterColor?this.afterColor.flow(e,"c",{slot:"afterColor"}):void 0,d=this.alpha?this.alpha.flow(e,"f"):void 0,u=this.alphaOverride?this.alphaOverride.flow(e,"f"):void 0;e.requires.transparent=void 0!==d,e.addParsCode(["varying vec3 vWPosition;","uniform vec3 emissive;","uniform float penumbraSize[5];","uniform sampler2D aoMap;","uniform bool aoEnabled;","#include <normal_pars_fragment>","#include <fog_pars_fragment>","#include <bsdfs>","#include <lights_pars_begin>","#include <lights_phong_pars_fragment>","#include <shadowmap_pars_fragment>","#include <dithering_pars_fragment>"].join(`
5199`));let p=["#include <normal_fragment_begin>",`
5200				// NOTE: gl_FrontFacing alternative using face normal estimation.
5201				vec3 viewdx = dFdx(vViewPosition);
5202				vec3 viewdy = dFdy(vViewPosition);
5203				vec3 faceNormal = normalize(cross(viewdx,viewdy));
5204				if (dot(normal, faceNormal) < 0.0) {
5205					normal *= -1.0;
5206				}
5207				`,"	BlinnPhongMaterial material;"];if(this.bumpMap){e.include(ML.dHdxy),e.include(ML.perturbNormalArb);let t=this.bumpMap.texture.flow(e,"t"),i=this.bumpMap.flow(e,"v3"),r=this.bumpMapIntensity?this.bumpMapIntensity.flow(e,"f").result:"1.0",s="";s=4===this.bumpMap.projection.value?`
5208					vec3 bumpNormal = vec3(0.0);
5209					{
5210						vec2 uv0 = g${this.bumpMap.uuid.toString().replace(/-/g,"")}_writeUvs0;
5211						vec2 uv1 = g${this.bumpMap.uuid.toString().replace(/-/g,"")}_writeUvs1;
5212						vec2 uv2 = g${this.bumpMap.uuid.toString().replace(/-/g,"")}_writeUvs2;
5213						vec3 weights = g${this.bumpMap.uuid.toString().replace(/-/g,"")}_triplanarWeights;
5214
5215						vec2 grad0 = dHdxy(${t.result}, uv0, ${r});
5216						vec3 n0 = perturbNormalArb(-vViewPosition, normal, grad0, faceDirection);
5217
5218						vec2 grad1 = dHdxy(${t.result}, uv1, ${r});
5219						vec3 n1 = perturbNormalArb(-vViewPosition, normal, grad1, faceDirection);
5220
5221						vec2 grad2 = dHdxy(${t.result}, uv2, ${r});
5222						vec3 n2 = perturbNormalArb(-vViewPosition, normal, grad2, faceDirection);
5223						
5224						bumpNormal = n0 * weights.z + n1 * weights.x + n2 * weights.y;
5225						bumpNormal = normalize(bumpNormal);
5226					}
5227
5228					normal = bumpNormal;
5229					`:`
5230					vec2 bumpMapCachedUv = g${this.bumpMap.uuid.toString().replace(/-/g,"")}_writeUvs;
5231					vec2 grad = dHdxy(${t.result}, bumpMapCachedUv, ${r});
5232					normal = perturbNormalArb( - vViewPosition, normal, grad, faceDirection );
5233					`,p.push(`// Call the Texture Layer's function once here so that it writes out its procedural UV coordinates
5234					${i.result};
5235					${s}
5236					`)}p.push(r.code,"	vec3 diffuseColor = "+r.result+";","	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );","	vec3 totalEmissiveRadiance = emissive;",s.code,"	vec3 specular = "+s.result+";",a.code,"	float shininess = max( 0.0001, "+a.result+" );","	float specularStrength = 1.0;"),d&&p.push(d.code,"#ifdef ALPHATEST","if ( "+d.result+" <= ALPHATEST ) discard;","#endif"),p.push("material.diffuseColor = diffuseColor;"),p.push("material.specularColor = specular;","material.specularShininess = shininess;","material.specularStrength = specularStrength;","#include <lights_fragment_begin>","#include <lights_fragment_end>"),p.push("vec3 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 f="1.0";this.mask&&(this.mask.analyze(e),f=`luminance(${this.mask.flow(e,"v3").result})`),p.push(`
5237				if (outgoingLight != diffuseColor) {
5238					float lightAccu = clamp( length( reflectedLight.directSpecular + reflectedLight.indirectSpecular ), 0.0, 1.0 );
5239					accumAlpha += ( 1.0 - accumAlpha ) * ${o.result} * ${f} * lightAccu;
5240					outgoingLight = spe_blend( diffuseColor, outgoingLight, ${o.result} * ${f}, ${h.result} );
5241					
5242					outgoingLight *= ao;
5243				}
5244				`),c&&p.push(c.code,`outgoingLight = spe_blend(outgoingLight, ${c.result}, 1.0, SPE_BLENDING_NORMAL);`),d?p.push(`gl_FragColor = vec4( outgoingLight, accumAlpha * ${d.result});`):p.push("gl_FragColor = vec4( outgoingLight, 1.0 );"),u&&p.push(`gl_FragColor.a *= ${u.result};`),p.push("#include <encodings_fragment>","#include <fog_fragment>","#include <dithering_fragment>"),t=p.join(`
5245`)}return t}},MR=class extends Cg{constructor(){super("standard"),this.nodeType="Standard",this.color=new C3(5526619),this.roughness=new CB(.3),this.metalness=new CB(0),this.reflectivity=new CB(.5),this.previousModelViewMatrix=new Mt,this.previouseProjectionMatrix=new Mt,this.shadingAlp
vendor: 1,580 bytes, lines 5245-5264
5245ha=new CB(1),this.shadingBlend=new C4(0),this.occlusion=new C5(!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:MS.frameIndex}),e.mergeUniform({resolution:MS.resolution}),e.mergeUniform({previousModelViewMatrix:this.previousModelViewMatrix}),e.mergeUniform({previousProjectionMatrix:this.previouseProjectionMatrix}),e.mergeUniform(r1([su.fog,su.lights])),su.LTC_1&&(e.uniforms.ltc_1={value:void 0},e.uniforms.ltc_2={value:void 0}),e.addParsCode(["varying vec3 vViewPosition;","varying vec3 vWPosition;","#include <fog_pars_vertex>","#include <skinning_pars_vertex>","#include <normal_pars_vertex>","#include <morphtarget_pars_vertex>","#include <shadowmap_pars_vertex>","#include <clipping_planes_pars_vertex>"].join(`
5246`));let r=["#include <beginnormal_vertex>","#include <morphnormal_vertex>",`
5247				#include <skinbase_vertex>
5248				#include <skinnormal_vertex>
5249				#if !defined( USE_LAYER_DISPLACE )
5250					#include <defaultnormal_vertex>
5251				#endif
5252
5253				vec3 displaced_position = position;
5254				vec3 displaced_normal = objectNormal;
5255
5256				#if defined( USE_LAYER_DISPLACE )
5257					vec3 transformed;
5258					vec3 transformedNormal;
5259				#endif
5260				`,"#include <normal_vertex>",`
5261				#if !defined( USE_LAYER_DISPLACE )
5262					#include <begin_vertex>
5263				#endif /* !USE_LAYER_DISPLACE */
5264				`];i&&r.push(i.code,i.result?"displaced_position = "+i.result+";
5264":""),r.push("transformed = displaced_position;","#include <morphtarget_vertex>","#include <skinning_vertex>","transformedNormal = normalMatrix * displaced_normal;","#ifndef FLAT_SHADED","    vNormal = transformedNormal;","#endif"),r.push("#include <project_vertex>","#include <fog_vertex>","#include <clipping_planes_vertex>","	vViewPosition = - mvPosition.xyz;","#include <worldpos_vertex>","#include <shadowmap_vertex>"),r.push("vWPosition = ( modelMatrix * vec4( transformed, 1.0 ) ).xyz;"),t=r.join(`
5265`)}else{e.mergeUniform({penumbraSize:MS.penumbraSize}),e.mergeUniform({frameIndex:MS.frameIndex}),e.mergeUniform({aoMap:MS.aoRenderTarget}),e.mergeUniform({aoEnabled:MS.aoEnabled});let i={gamma:!0};void 0===this.color&&(this.color=new C3(5526619)),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"),o=this.metalness.flow(e,"f"),h=this.shadingAlpha.flow(e,"f"),c=this.shadingBlend.flow(e,"i"),d=this.afterColor?this.afterColor.flow(e,"c",{slot:"afterColor"}):void 0,u=this.alpha?this.alpha.flow(e,"f"):void 0,p=this.alphaOverride?this.alphaOverride.flow(e,"f"):void 0,f=this.reflectivity?this.reflectivity.flow(e,"f"):void 0;e.requires.transparent=void 0!==u,e.addParsCode(["varying vec3 vViewPosition;","varying vec3 vWPosition;","uniform float penumbraSize[5];","uniform sampler2D aoMap;","uniform bool aoEnabled;","#include <normal_pars_fragment>","#include <dithering_pars_fragment>","#include <fog_pars_fragment>","#include <bsdfs>","#include <lights_pars_begin>","#include <lights_physical_pars_fragment>","#include <shadowmap_pars_fragment>"].join(`
5266`));let m=["#include <clipping_planes_fragment>","	#include <normal_fragment_begin>",`
5267				// NOTE: gl_FrontFacing alternative using face normal estimation.
5268				vec3 viewdx = dFdx(vViewPosition);
5269				vec3 viewdy = dFdy(vViewPosition);
5270				vec3 faceNormal = normalize(cross(viewdx,viewdy));
5271				if (dot(normal, faceNormal) < 0.0) {
5272					normal *= -1.0;
5273				}
5274				`,"	PhysicalMaterial material;","	material.diffuseColor = vec3( 1.0 );"];if(this.bumpMap){e.include(ML.dHdxy),e.include(ML.perturbNormalArb);let t=this.bumpMap.texture.flow(e,"t"),i=this.bumpMap.flow(e,"v3"),r=this.bumpMapIntensity?this.bumpMapIntensity.flow(e,"f").result:"1.0",s="";s=4===this.bumpMap.projection.value?`
5275					vec3 bumpNormal = vec3(0.0);
5276					{
5277						vec2 uv0 = g${this.bumpMap.uuid.toString().replace(/-/g,"")}_writeUvs0;
5278						vec2 uv1 = g${this.bumpMap.uuid.toString().replace(/-/g,"")}_writeUvs1;
5279						vec2 uv2 = g${this.bumpMap.uuid.toString().replace(/-/g,"")}_writeUvs2;
5280						vec3 weights = g${this.bumpMap.uuid.toString().replace(/-/g,"")}_triplanarWeights;
5281
5282						vec2 grad0 = dHdxy(${t.result}, uv0, ${r});
5283						vec3 n0 = perturbNormalArb(-vViewPosition, normal, grad0, faceDirection);
5284
5285						vec2 grad1 = dHdxy(${t.result}, uv1, ${r});
5286						vec3 n1 = perturbNormalArb(-vViewPosition, normal, grad1, faceDirection);
5287
5288						vec2 grad2 = dHdxy(${t.result}, uv2, ${r});
5289						vec3 n2 = perturbNormalArb(-vViewPosition, normal, grad2, faceDirection);
5290						
5291						bumpNormal = n0 * weights.z + n1 * weights.x + n2 * weights.y;
5292						bumpNormal = normalize(bumpNormal);
5293					}
5294
5295					normal = bumpNormal;
5296					`:`
5297					vec2 bumpMapCachedUv = g${this.bumpMap.uuid.toString().replace(/-/g,"")}_writeUvs;
5298					vec2 grad = dHdxy(${t.result}, bumpMapCachedUv, ${r});
5299					normal = perturbNormalArb( - vViewPosition, normal, grad, faceDirection );
5300					`,m.push(`// Call the Texture Layer's function once here so that it writes out its procedural UV coordinates
5301					${i.result};
5302					${s}
5303					`)}if(m.push(s.code,"	vec3 diffuseColor = "+s.result+";","	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );",o.code,"	float metalnessFactor = "+o.result+";"),this.roughnessMap){let t=this.roughnessMap.texture.flow(e,"t"),i=this.roughnessMap.flow(e,"v3"),r="";r=4===this.roughnessMap.projection.value?`
5304					float roughnessChange = 1.0;
5305					{
5306						vec2 uv0 = g${this.roughnessMap.uuid.toString().replace(/-/g,"")}_writeUvs0;
5307						vec2 uv1 = g${this.roughnessMap.uuid.toString().replace(/-/g,"")}_writeUvs1;
5308						vec2 uv2 = g${this.roughnessMap.uuid.toString().replace(/-/g,"")}_writeUvs2;
5309						vec3 weights = g${this.roughnessMap.uuid.toString().replace(/-/g,"")}_triplanarWeights;
5310
5311						float r0 = luminance(texture(${t.result}, uv0).rgb) * roughnessScale;
5312						float r1 = luminance(texture(${t.result}, uv1).rgb) * roughnessScale;
5313						float r2 = luminance(texture(${t.result}, uv2).rgb) * roughnessScale;
5314
5315						roughnessChange = (r0 * weights.z + r1 * weights.x + r2 * weights.y);
5316					}
5317					float roughnessFactor = roughnessChange * ${a.result};
5318					`:`
5319					vec2 roughnessMapCachedUv = g${this.roughnessMap.uuid.toString().replace(/-/g,"")}_writeUvs;
5320
5321					vec4 vals = texture(${t.result},  roughnessMapCachedUv);
5322					float roughnessFactor = luminance(vals.rgb) * ${a.result};
5323					`,m.push(`// Call the Texture Layer's function once here so that it writes out its procedural UV coordinates
5324					${i.result};
5325
5326					const float roughnessScale = 1.0;
5327
5328					${r}
5329				`)}else m.push(a.code,"	float roughnessFactor = "+a.result+";");u&&m.push(u.code,"#ifdef ALPHATEST","	if ( "+u.result+" <= ALPHATEST ) discard;","#endif"),m.push("vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );","float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );"),m.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 );"),f?m.push(f.code,"material.specularColor = mix( vec3( 0.16 * pow2( "+f.result+" ) ), diffuseColor, metalnessFactor );"):m.push("material.specularColor = mix( vec3( 0.04 ), diffuseColor, metalnessFactor );"),m.push("#include <lights_fragment_begin>"),m.push("#include <lights_fragment_end>"),m.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 g="1.0";this.mask&&(this.mask.analyze(e),g=`luminance(${this.mask.flow(e,"v3").result})`),m.push(`
5330				if (outgoingLight != diffuseColor) {
5331					float lightAccu = clamp( length( reflectedLight.directSpecular + reflectedLight.indirectSpecular ), 0.0, 1.0 );
5332					accumAlpha += ( 1.0 - accumAlpha ) * ${h.result} * ${g} * lightAccu;
5333					outgoingLight = spe_blend( diffuseColor, outgoingLight, ${h.result} * ${g}, ${c.result} );
5334					
5335					outgoingLight *= ao;
5336				}
5337				`),d&&m.push(d.code,`outgoingLight = spe_blend(outgoingLight, ${d.result}, 1.0, SPE_BLENDING_NORMAL);`),u?m.push(`gl_FragColor = vec4( outgoingLight, accumAlpha * ${u.result} );`):m.push("gl_FragColor = vec4( outgoingLight, 1.0 );"),p&&m.push(`gl_FragColor.a *= ${p.result};`),m.push("#include <encodings_fragment>","#include <fog_fragment>","#include <dithering_fragment>"),t=m.join(`
5338`)}return t}},Mk=class extends Cg{constructor(){super("toon"),this.nodeType="Toon",this.color=new C3(5526619),this.specular=new C3(1118481),this.shininess=new CB(30),this.previousModelViewMatrix=new Mt,this.previouseProjectionMatrix=new Mt,this.shadingAlp
vendor: 1,387 bytes, lines 5338-5357
5338ha=new CB(1),this.shadingBlend=new C4(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:MS.frameIndex}),e.mergeUniform({resolution:MS.resolution}),e.mergeUniform({previousModelViewMatrix:this.previousModelViewMatrix}),e.mergeUniform({previousProjectionMatrix:this.previouseProjectionMatrix}),e.mergeUniform(r1([su.fog,su.lights])),e.addParsCode(["varying vec3 vViewPosition;","varying vec3 vWPosition;","#include <fog_pars_vertex>","#include <skinning_pars_vertex>","#include <normal_pars_vertex>","#include <morphtarget_pars_vertex>","#include <shadowmap_pars_vertex>","#include <clipping_planes_pars_vertex>"].join(`
5339`));let r=["#include <beginnormal_vertex>","#include <morphnormal_vertex>",`
5340				#include <skinbase_vertex>
5341				#include <skinnormal_vertex>
5342				#ifndef USE_LAYER_DISPLACE
5343					#include <defaultnormal_vertex>
5344				#endif
5345
5346				vec3 displaced_position = position;
5347				vec3 displaced_normal = objectNormal;
5348
5349				#ifdef USE_LAYER_DISPLACE
5350					vec3 transformed;
5351					vec3 transformedNormal;
5352				#endif
5353				`,"#include <normal_vertex>",`
5354				#ifndef USE_LAYER_DISPLACE
5355					#include <begin_vertex>
5356				#endif
5357				`];i&&r.push(i.code,i.result?"displaced_position = "+i.result+";
5357":""),r.push("transformed = displaced_position;","#include <morphtarget_vertex>","#include <skinning_vertex>","transformedNormal = normalMatrix * displaced_normal;","#ifndef FLAT_SHADED","    vNormal = transformedNormal;","#endif"),r.push("	#include <project_vertex>","	#include <fog_vertex>","	#include <clipping_planes_vertex>","	vViewPosition = - mvPosition.xyz;","	#include <worldpos_vertex>","	#include <shadowmap_vertex>","	#include <fog_vertex>"),r.push("vWPosition = ( modelMatrix * vec4( transformed, 1.0 ) ).xyz;"),t=r.join(`
5358`)}else{e.mergeUniform({penumbraSize:MS.penumbraSize}),e.mergeUniform({frameIndex:MS.frameIndex}),e.mergeUniform({aoMap:MS.aoRenderTarget}),e.mergeUniform({aoEnabled:MS.aoEnabled}),void 0===this.color&&(this.color=new C3(5526619)),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"),o=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;e.requires.transparent=void 0!==c,e.addParsCode(["uniform float penumbraSize[5];","uniform sampler2D aoMap;","uniform bool aoEnabled;","varying vec3 vWPosition;","#include <normal_pars_fragment>","#include <gradientmap_pars_fragment>","#include <fog_pars_fragment>","#include <bsdfs>","#include <lights_pars_begin>","#include <dithering_pars_fragment>",`
5359					varying vec3 vViewPosition;
5360					struct ToonMaterial {
5361						vec3	diffuseColor;
5362						vec3	specularColor;
5363						float	specularShininess;
5364						float	specularStrength;
5365					};
5366					void RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
5367						vec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;
5368			
5369						reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
5370						reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularShininess ) * material.specularStrength;
5371					}
5372					void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
5373						reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
5374					}
5375					#define RE_Direct				RE_Direct_Toon
5376					#define RE_IndirectDiffuse		RE_IndirectDiffuse_Toon
5377					#define Material_LightProbeLOD( material )	(0)
5378					`,"#include <shadowmap_pars_fragment>","#include <bumpmap_pars_fragment>","#include <normalmap_pars_fragment>"].join(`
5379`));let u=["#include <normal_fragment_begin>",`
5380				// NOTE: gl_FrontFacing alternative using face normal estimation.
5381				vec3 viewdx = dFdx(vViewPosition);
5382				vec3 viewdy = dFdy(vViewPosition);
5383				vec3 faceNormal = normalize(cross(viewdx,viewdy));
5384				if (dot(normal, faceNormal) < 0.0) {
5385					normal *= -1.0;
5386				}
5387				`,"	ToonMaterial material;"];if(this.bumpMap){e.include(ML.dHdxy),e.include(ML.perturbNormalArb);let t=this.bumpMap.texture.flow(e,"t"),i=this.bumpMap.flow(e,"v3"),r=this.bumpMapIntensity?this.bumpMapIntensity.flow(e,"f").result:"1.0",s="";s=4===this.bumpMap.projection.value?`
5388					vec3 bumpNormal = vec3(0.0);
5389					{
5390						vec2 uv0 = g${this.bumpMap.uuid.toString().replace(/-/g,"")}_writeUvs0;
5391						vec2 uv1 = g${this.bumpMap.uuid.toString().replace(/-/g,"")}_writeUvs1;
5392						vec2 uv2 = g${this.bumpMap.uuid.toString().replace(/-/g,"")}_writeUvs2;
5393						vec3 weights = g${this.bumpMap.uuid.toString().replace(/-/g,"")}_triplanarWeights;
5394
5395						vec2 grad0 = dHdxy(${t.result}, uv0, ${r});
5396						vec3 n0 = perturbNormalArb(-vViewPosition, normal, grad0, faceDirection);
5397
5398						vec2 grad1 = dHdxy(${t.result}, uv1, ${r});
5399						vec3 n1 = perturbNormalArb(-vViewPosition, normal, grad1, faceDirection);
5400
5401						vec2 grad2 = dHdxy(${t.result}, uv2, ${r});
5402						vec3 n2 = perturbNormalArb(-vViewPosition, normal, grad2, faceDirection);
5403						
5404						bumpNormal = n0 * weights.z + n1 * weights.x + n2 * weights.y;
5405						bumpNormal = normalize(bumpNormal);
5406					}
5407
5408					normal = bumpNormal;
5409					`:`
5410					vec2 bumpMapCachedUv = g${this.bumpMap.uuid.toString().replace(/-/g,"")}_writeUvs;
5411					vec2 grad = dHdxy(${t.result}, bumpMapCachedUv, ${r});
5412					normal = perturbNormalArb( - vViewPosition, normal, grad, faceDirection );
5413					`,u.push(`// Call the Texture Layer's function once here so that it writes out its procedural UV coordinates
5414					${i.result};
5415					${s}
5416					`)}u.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;"),c&&u.push(c.code,"#ifdef ALPHATEST","if ( "+c.result+" <= ALPHATEST ) discard;","#endif"),u.push("material.diffuseColor = diffuseColor;"),u.push("material.specularColor = specular;","material.specularShininess = shininess;","material.specularStrength = specularStrength;","#include <lights_fragment_begin>","#include <lights_fragment_end>"),u.push("vec3 ao = aoEnabled ? tex2D(aoMap, gl_FragCoord.xy / resolution).rgb : vec3(1.0);","vec3 outgoingLight = ((reflectedLight.directDiffuse + reflectedLight.indirectDiffuse) * ao) + reflectedLight.directSpecular;");let p="1.0";this.mask&&(this.mask.analyze(e),p=`luminance(${this.mask.flow(e,"v3").result})`),u.push(`
5417				if (outgoingLight != diffuseColor) {
5418					float lightAccu = clamp( length( reflectedLight.directSpecular + reflectedLight.indirectSpecular ), 0.0, 1.0 );
5419					accumAlpha += ( 1.0 - accumAlpha ) * ${a.result} * ${p} * lightAccu;
5420					outgoingLight = spe_blend( diffuseColor, outgoingLight, ${a.result} * ${p}, ${o.result} );
5421				}
5422				`),h&&u.push(h.code,`outgoingLight = spe_blend(outgoingLight, ${h.result}, 1.0, SPE_BLENDING_NORMAL);`),c?u.push(`gl_FragColor = vec4( outgoingLight, accumAlpha * ${c.result} );`):u.push("gl_FragColor = vec4( outgoingLight, 1.0 );"),d&&u.push(`gl_FragColor.a *= ${d.result};`),u.push("#include <encodings_fragment>","#include <fog_fragment>","#include <dithering_fragment>"),t=u.join(`
5423`)}return t}},MB=class{constructor(e=1e4){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(){}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).prev=this.head,this.head.next=t;this.head.next!==this.tail?this.scheduleCleanup():this.log("no more cleanup")},this.timeout+1e3))}has(e){return this.cache.get(e)?.data}load(e){let t=Date.now(),i=this.cache.get(e);return void 0===i?(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}},Mz=class extends MB{create(e){return URL.createObjectURL(new Blob([e]))}dispose(e,t){URL.revokeObjectURL(t)}},MN=class{constructor(e,t){this.data=e,this.cache=t,this.refCount=0}deref(){this.refCount,this.refCount-=1,0===this.refCount&&(this.cache.remove(this),this.dispose())}dispose(){this.refCount}},MF=class{constructor(){this.cache=new Map}remove(e){this.cache.delete(e.data)}load(e){let t=this.cache.get(e);return void 0===t&&(t=this.create(e),this.cache.set(e,t)),t.refCount+=1,t}},Mj=class extends MN{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="video"===e.type,this.isBuffer=!0===e.isWebGLRenderTarget,this.loadPromise=this.updateSrc(this.isBuffer?e:e.data)}async updateSrc(e){if(typeof document>"u")return;this.disposeTextures(),this.loaded=!1;let t=()=>{for(let e of(this.loaded=!0,Object.values(this._cache)))for(let t of Object.values(e))for(let e of Object.values(t))e&&(e.image=this.img,e.needsUpdate=!0);this.shared.requestRender()};if(this.isBuffer)this.img=e,this.loaded=!0;else if(this.isVideo){if(this.img=document.createElement("video"),this.img.preload="auto",this.img.playsInl
5423ine=!0,this.img.currentTime=.01,"string"!=typeof e){let t;var i=new FileReader;i.readAsDataURL(new Blob([e],{type:"video/mp4"})),await new Promise(e=>{i.onloadend=i=>{t=i.target?.result,e(null)}}),this.img.src=t}else this.img.src=e;this.img.onloadeddata=()=>{t()}}else this.img=new Image,this.img.src="string"==typeof e?e:(MT||(MT=new Mz),MT.load(e)),this.img.onload=t,await new Promise(e=>{this.img.onload=()=>{t(),e(null)}})}getTexture(e,t=1008,i=1006){let r=this._cache[e]?.[t]?.[i];if(r)return r;{let r;return r=this.isBuffer?this.img.texture:this.isVideo?new nq(this.img,void 0,e,e):new ic(this.img,void 0,e,e,i,t),this.loaded&&(r.needsUpdate=!0),void 0===this._cache[e]&&(this._cache[e]={}),void 0===this._cache[e][t]&&(this._cache[e][t]={}),this._cache[e][t][i]=r,r}}setNeedsUpdate(e){for(let t of Object.values(this._cache))for(let i of Object.values(t))for(let t of Object.values(i))t&&(t.needsUpdate=e)}disposeTextures(){for(let[e,t]of Object.entries(this._cache))for(let[i,r]of Object.entries(t))for(let[t,s]of Object.entries(r))s?.dispose(),void 0!==this._cache[e]&&void 0!==this._cache[e][i]&&(this._cache[e][i][t]=void 0)}dispose(){super.dispose(),this.disposeTextures()}},MU=class extends Mj{},MV={year:0,month:1,day:2,hour:3,minute:4,second:5},MW={};function MH(e,t,i,r,s,a,o){var h=new Date(0);return h.setUTCFullYear(e,t,i),h.setUTCHours(r,s,a,o),h}var MG=/^(Z)$/,Mq=/^([+-]\d{2})$/,MX=/^([+-]\d{2}):?(\d{2})$/;function MY(e,t,i){if(!e||(r=MG.exec(e)))return 0;if(r=Mq.exec(e))return MZ(a=parseInt(r[1],10))?-(36e5*a):NaN;if(r=MX.exec(e)){var r,s,a=parseInt(r[1],10),o=parseInt(r[2],10);return MZ(a,o)?(s=36e5*Math.abs(a)+6e4*o,a>0?-s:s):NaN}if(function(e){if(MK[e])return!0;try{return new Intl.DateTimeFormat(void 0,{timeZone:e}),MK[e]=!0,!0}catch{return!1}}(e)){t=new Date(t||Date.now());var h,c=MQ(i?t:MH((h=t).getFullYear(),h.getMonth(),h.getDate(),h.getHours(),h.getMinutes(),h.getSeconds(),h.getMilliseconds()),e);return-(i?c:function(e,t,i){var r=e.getTime()-t,s=MQ(new Date(r),i);if(t===s)return t;var a=MQ(new Date(r-=s-t),i);return s===a?s:Math.max(s,a)}(t,c,e))}return NaN}function MQ(e,t){var i,r,s,a,o,h=(o=function(e){if(!MW[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"));MW[e]="06/25/2014, 00:00:00"===t||"‎06‎/‎25‎/‎2014‎ ‎00‎:‎00‎:‎00"===t?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 MW[e]}(t)).formatToParts?function(e,t){try{for(var i=e.formatToParts(t),r=[],s=0;s<i.length;s++){var a=MV[i[s].type];a>=0&&(r[a]=parseInt(i[s].value,10))}return r}catch(e){if(e instanceof RangeError)return[NaN];throw e}}(o,e):(i=o,r=e,s=i.format(r).replace(/\u200E/g,""),[(a=/(\d+)\/(\d+)\/(\d+),? (\d+):(\d+):(\d+)/.exec(s))[3],a[1],a[2],a[4],a[5],a[6]]),c=MH(h[0],h[1]-1,h[2],h[3]%24,h[4],h[5],0).getTime(),d=e.getTime(),u=d%1e3;return c-(d-=u>=0?u:1e3+u)}function MZ(e,t){return -23<=e&&e<=23&&(null==t||0<=t&&t<=59)}var MK={},MJ=tS(tA(),1),M$=tS(tT(),1),M0=/^([0-9W+-]+)(T| )(.*)/,M1=/^([0-9W+-]+)(.*)/,M2=/^(\d{2})$/,M3=[/^([+-]\d{2})$/,/^([+-]\d{3})$/,/^([+-]\d{4})$/],M4=/^(\d{4})/,M5=[/^([+-]\d{4})/,/^([+-]\d{5})/,/^([+-]\d{6})/],M6=/^-(\d{2})$/,M8=/^-?(\d{3})$/,M9=/^-?(\d{2})-?(\d{2})$/,M7=/^-?W(\d{2})$/,Ee=/^-?W(\d{2})-?(\d{1})$/,Et=/^(\d{2}([.,]\d*)?)$/,Ei=/^(\d{2}):?(\d{2}([.,]\d*)?)$/,Er=/^(\d{2}):?(\d{2}):?(\d{2}([.,]\d*)?)$/,Es=/(Z|[+-]\d{2}(?::?\d{2})?| UTC| [a-zA-Z]+\/[a-zA-Z_]+(?:\/[a-zA-Z_]+)?)$/;function Ea(e,t,i){t=t||0,i=i||0;var r=new Date(0);r.setUTCFullYear(e,0,4);var s=7*t+i+1-(r.getUTCDay()||7);return r.setUTCDate(r.getUTCDate()+s),r}var En=[31,28,31,30,31,30,31,31,30,31,30,31],Eo=[31,29,31,30,31,30,31,31,30,31,30,31];function El(e){return e%400==0||e%4==0&&e%100!=0}function Eh(e,t,i){if(t<0||t>11)return!1;if(null!=i){if(i<1)return!1;var r=El(e);if(r&&i>Eo[t]||!r&&i>En[t])return!1}return!0}function Ec(e,t,i){return!(t<0||t>52||null!=i&&(i<0||i>6))}function Ed(e,t,i){return!(null!=e&&(e<0||e>=25)||null!=t&&(t<0||t>=60)||null!=i&&(i<0||i>=60))}function Eu(e,t){return t.color(e)}function Ep(e=new Date,t){var i,r,s,a,o,h;let c,d,u=t.format,p=e.getSeconds(),f=e;t&&null!==t.timeZone&&(i=new Date,r=t.timeZone,s=function(e,t){if(arguments.length<1)throw TypeError("1 argument required, but only "+arguments.length+" present");if(null===e)return new Date(NaN);var i=t||{},r=null==i.additionalDigits?2:(0,MJ.default)(i.additionalDigits);if(2!==r&&1!==r&&0!==r)throw RangeError("additionalDigits must be 0, 1 or 2");if(e instanceof Date||"object"==typeof e&&"[object Date]"===Object.prototype.toString.call(e))return new Date(e.getTime());if("number"==typeof e||"[object Number]"===Object.prototype.toString.call(e))return new Date(e);if("string"!=typeof e&&"[object String]"!==Object.prototype.toString.call(e))return new Date(NaN);var s=function(e){var t,i={},r=M0.exec(e);if(r?(i.date=r[1],t=r[3]):(r=M1.exec(e))?(i.date=r[1],t=r[2]):(i.date=null,t=e),t){var s=Es.exec(t);s?(i.time=t.replace(s[1],""),i.timeZone=s[1].trim()):i.time=t}return i}(e),a=function(e,t){var i,r=M3[t],s=M5[t];if(i=M4.exec(e)||s.exec(e)){var a=i[1];return{year:parseInt(a,10),restDateString:e.slice(a.length)}}if(i=M2.exec(e)||r.exec(e)){var o=i[1];return{year:100*parseInt(o,10),restDateString:e.slice(o.length)}}return{year:null}}(s.date,r),o=a.year,h=function(e,t){if(null===t)return null;if(0===e.length)return(a=new Date(0)).setUTCFullYear(t),a;if(i=M6.exec(e))return a=new Date(0),Eh(t,r=parseInt(i[1],10)-1)?(a.setUTCFullYear(t,r),a):new Date(NaN);if(i=M8.exec(e)){var i,r,s,a=new Date(0),o=parseInt(i[1],10);return!function(e,t){if(t<1)return!1;var i=El(e);return!(i&&t>366||!i&&t>365)}(t,o)?new Date(NaN):(a.setUTCFullYear(t,0,o),a)}if(i=M9.exec(e)){a=new Date(0),r=parseInt(i[1],10)-1;var h=parseInt(i[2],10);return Eh(t,r,h)?(a.setUTCFullYear(t,r,h),a):new Date(NaN)}if(i=M7.exec(e))return Ec(t,s=parseInt(i[1],10)-1)?Ea(t,s):new Date(NaN);if(i=Ee.exec(e)){s=parseInt(i[1],10)-1;var c=parseInt(i[2],10)-1;return Ec(t,s,c)?Ea(t,s,c):new Date(NaN)}return null}(a.restDateString,o);if(isNaN(h)||!h)return new Date(NaN);var c,d=h.getTime(),u=0;if(s.time&&isNaN(u=function(e){var t,i,r;if(t=Et.exec(e))return Ed(i=parseFloat(t[1].replace(",",".")))?i%24*36e5:NaN;if(t=Ei.exec(e))return Ed(i=parseInt(t[1],10),r=parseFloat(t[2].replace(",",".")))?i%24*36e5+6e4*r:NaN;if(t=Er.exec(e)){i=parseInt(t[1],10),r=parseInt(t[2],10);var s=parseFloat(t[3].replace(",","."));return Ed(i,r,s)?i%24*36e5+6e4*r+1e3*s:NaN}return null}(s.time)))return new Date(NaN);if(s.timeZone||i.timeZone){if(isNaN(c=MY(s.timeZone||i.timeZone,new Date(d+u))))return new Date(NaN)}else c=(0,M$.default)(new Date(d+u)),c=(0,M$.default)(new Date(d+u+c));return new Date(d+u+c)}(i,void 0),a=MY(r,s,!0),o=new Date(s.getTime()-a),(h=new Date(0)).setFullYear(o.getUTCFullYear(),o.getUTCMonth(),o.getUTCDate()),h.setHours(o.getUTCHours(),o.getUTCMinutes(),o.getUTCSeconds(),o.getUTCMilliseconds()),f=h);let m=f.getHours(),g=f.getMinutes(),v;"12ampm"===t.format12h24h&&(v=m>=12?"PM":"AM");let y=m;switch("24"!==t.format12h24h&&0==(y=m%12)&&(y=12),u){case"HH:mm:ss":c=[y,g,p];break;case"HH:mm":c=[y,g];break;case"HH":c=[y],v=void 0;break;case"mm":c=[g],v=void 0;break;case"ss":c=[p],v=void 0;break;case"year":d=f.getFullYear();break;case"month":d=f.getMonth()+1;break;case"dayOfYear":d=Math.floor((f.getTime()-new Date(f.getFullYear(),0,0).getTime())/864e5);break;case"dayOfMonth":d=f.getDate();break;case"secondOfDay":d=60*m*60+60*g+p;break;default:console.error("Unknown time format",u),d=0}return void 0!==c?{textValue:c,suffix:v}:d}function Ef(e,t){let{alpha:i,mode:r,isMask:s}
5423=e,a="string"==typeof i?(Number(t.getVariable(i))??100)/100:i;return{...{type:e.type},alpha:a,mode:r,isMask:s}}var Em=class extends xA{},Eg={noise:["noiseType"],texture:["projection","axis","side"],video:["projection","axis","side"],displace:["noiseType"],light:["roughnessMap","bumpMap"],depth:["smooth","isWorldSpace","gradientType","isVector"],pattern:["style","projection","axis"]},Ev={depth:["colors"]};function Ey(e,t,i){let r=i.uniforms[`f${i.id}_texture`];if(!r)return!1;if("image"in e){let i=e.image,s=t.image(i);r.image instanceof MU||r.image.deref(),r.image=s}if("video"in e){let i=e.video,s=t.video(i);r.image instanceof MU||r.image.deref(),r.image=s}if("wrapping"in e&&(r.wrap=e.wrapping),"minFilter"in e&&(r.minFilter=e.minFilter),"magFilter"in e&&(r.magFilter=e.magFilter),"rotation"in e&&i.uniforms[`f${i.id}_rotation`])return i.uniforms[`f${i.id}_rotation`].value=(e.rotation??0)*tQ.DEG2RAD,!1;if("repeat"in e||"offset"in e||"rotation"in e){let t=i.uniforms[`f${i.id}_mat`];"repeat"in e&&(t.repeat=e.repeat),"offset"in e&&(t.offset=e.offset),"rotation"in e&&(t.rotation=e.rotation??0),t.updateMatrix()}return!1}var Ex=(e,t,i)=>Math.max(0,Math.min(1,Number(t.getVariable("number"==typeof e?100*e:e,i)??100)/100))??1,Eb=class{constructor(e,t,i,r,s){for(let s in this.id=e,this.uuid=t,this.data=i,this.uniforms={},r)this.uniforms[`f${this.id}_${s}`]=r[s];for(let e in i)EM(e,this,i,s)}get type(){return this.data.type}static create(e,t,i,r){if("light"===i.type)return ES.createLightLayer(e,t,i,r);if("texture"===i.type||"video"===i.type){let s="texture"===i.type?r.uiBuffer(i.texture.image)??r.image(i.texture.image):r.video(i.texture.video),a=new C7(s,i.texture.wrapping,i.texture.minFilter??1008,i.texture.magFilter??1006),o=new C9(s),h=new Mr(i.texture.repeat,i.texture.offset,i.texture.rotation??0),c=new CB(+!!i.crop),d=new C4(i.projection??0),u=new C4(["x","y","z"].indexOf(i.axis)??0),p=new C4(i.side??0),f=new Cw(i.size?new tZ(i.size[0],i.size[1]):new tZ(100,100)),m=new CB(i.blending??0),g=new CB(Ex(i.alpha,r)),v=new C4(i.mode??0),y=new C5(i.isMask??!1),x=new Ml(a,o,c,d,u,p,f,m,h,g,v,y),b=new CR(x.calpha,"f");return new Ew(e,t,i,{texture:a,textureSize:o,crop:c,projection:d,axis:u,side:p,size:f,blending:m,mat:h,alpha:g,mode:v,isMask:y},x,v,b,y,r)}if("matcap"===i.type){let s=new C7(r.image(i.texture.image),i.texture.wrapping,i.texture.minFilter??1008,i.texture.magFilter??1006),a=new CB(Ex(i.alpha,r)),o=new C4(i.mode??0),h=new C5(i.isMask??!1),c=new CB((i.texture.rotation??0)*tQ.DEG2RAD),d=new Mu(s,a,o,h,c),u=new CR(d.calpha,"f");return new Ew(e,t,i,{texture:s,alpha:a,mode:o,isMask:h,rotation:c},d,o,u,h,r)}if("displace"!==i.type){var s,a,o,h;let c;return s=e,a=t,c=function(e,t){var i,r,s,a,o,h,c,d,u,p,f,m;switch(e.type){case"fresnel":return function(e,t){let{bias:i,scale:r,intensity:s,factor:a,color:o}=e;return{...Ef(e,t),color:Eu(o,t),bias:i,scale:r,intensity:s,factor:a}}(e,t);case"gradient":return function(e,t){let{gradientType:i,smooth:r,colors:s,steps:a,angle:o,offset:h,morph:c}=e;return{...Ef(e,t),gradientType:i,smooth:r,colors:s.map(e=>new id(e[0],e[1],e[2],e[3])),num:s.length,steps:a,offset:new tZ(...h),morph:new tZ(...c),angle:o}}(e,t);case"depth":return function(e,t){let{gradientType:i,near:r,far:s,isVector:a,isWorldSpace:o,origin:h,direction:c,colors:d,steps:u,smooth:p}=e;return{...Ef(e,t),gradientType:i,near:r,far:s,isVector:a,isWorldSpace:o,origin:new iy(...h),direction:c?new iy(...c):new iy(1,0,0),colors:d.map(e=>void 0!==e?new id(e[0],e[1],e[2],e[3]):new id(0,0,0,0)),steps:u.slice(0,d.length),smooth:p}}(e,t);case"normal":return function(e,t){let{cnormal:i}=e;return{...Ef(e,t),cnormal:new iy(i[0],i[1],i[2])}}(e,t);case"noise":return{...Ef(i=e,r=t),scale:i.scale,move:i.move,fA:new tZ(...i.fA),fB:new tZ(...i.fB),size:new iy(...i.size),distortion:new tZ(...i.distortion),colorA:Eu(i.colorA,r),colorB:Eu(i.colorB,r),colorC:Eu(i.colorC,r),colorD:Eu(i.colorD,r),noiseType:i.noiseType,voronoiStyle:i.voronoiStyle,highCut:i.highCut,lowCut:i.lowCut,smoothness:i.smoothness,seed:i.seed,quality:i.quality};case"rainbow":return{...Ef(s=e,t),filmThickness:s.filmThickness,movement:s.movement,wavelengths:new iy(...s.wavelengths),noiseStrength:s.noiseStrength,noiseScale:s.noiseScale,offset:new iy(...s.offset)};case"toon":return{...Ef(a=e,o=t),positioning:a.positioning,colors:a.colors.map(e=>new id(e[0],e[1],e[2],e[3])),num:a.colors.length,steps:a.steps,source:new iy(...a.source),isWorldSpace:a.isWorldSpace,noiseStrength:a.noiseStrength,noiseScale:a.noiseScale,shadowColor:Eu(a.shadowColor,o),offset:new iy(...a.offset)};case"outline":return{...Ef(h=e,c=t),outlineColor:Eu(h.outlineColor,c),c
5423ontourColor:Eu(h.contourColor,c),outlineWidth:h.outlineWidth,contourWidth:h.contourWidth,outlineThreshold:h.outlineThreshold,contourThreshold:h.contourThreshold,outlineSmoothing:h.outlineSmoothing,contourFrequency:h.contourFrequency,contourDirection:new iy(...h.contourDirection),positionalLines:h.positionalLines,compensation:h.compensation};case"transmission":return{...Ef(d=e,t),thickness:d.thickness,ior:d.ior,roughness:d.roughness};case"color":return{...Ef(u=e,p=t),color:Eu(u.color,p)};case"pattern":return{...Ef(f=e,m=t),style:f.style,projection:f.projection,axis:f.axis,blending:f.blending,offset:new tZ(...f.offset),colorA:Eu(f.colorA,m),colorB:Eu(f.colorB,m),frequency:new tZ(...f.frequency),size:f.size,variation:f.variation,smoothness:f.smoothness,zigzag:f.zigzag,rotation:f.rotation,vertical:new tZ(...f.vertical),horizontal:new tZ(...f.horizontal),sides:f.sides}}}(o=i,h=r),function(e,t,i,r,s){switch(e.type){case"color":{let a=new C3(r.color??5526619),o=EC(r),h=new Mn(a,o.alpha),c=new CR(h.calpha,"f");return new Ew(t,i,e,{color:a,...o},h,o.mode,c,o.isMask,s)}case"fresnel":{let a=new C3(r.color??0xffffff),o=new CB(r.bias??.1),h=new CB(r.scale??1),c=new CB(r.intensity??2),d=new CB(r.factor??1),u=EC(r),p=new Mc(a,o,h,c,d,u.alpha,u.mode,u.isMask),f=new CR(p.calpha,"f");return new Ew(t,i,e,{color:a,bias:o,scale:h,intensity:c,factor:d,...u},p,u.mode,f,u.isMask,s)}case"rainbow":{let a=new CB(r.filmThickness??30),o=new CB(r.movement??0),h=new C_(r.wavelengths??new iy(0,0,0)),c=new CB(r.noiseStrength??0),d=new CB(r.noiseScale??1),u=new C_(r.offset??new iy(0,0,0)),p=EC(r),f=new Mv(a,o,h,c,d,u,p.alpha,p.isMask),m=new CR(f.calpha,"f");return new Ew(t,i,e,{filmThickness:a,movement:o,wavelengths:h,noiseStrength:c,noiseScale:d,offset:u,...p},f,p.mode,m,p.isMask,s)}case"transmission":{let a=new CB(r.thickness??10),o=new CB(r.ior??1.5),h=new CB(r.roughness??.5),c=MS.transmissionSize,d=MS.transmissionRenderTarget,u=MS.transmissionRenderTargetDepth,p=window.innerWidth,f=window.innerHeight,m=p>=f?new Cw(f/p,1):new Cw(1,p/f),g=EC(r),v=new Mb(a,o,h,c,d,u,m,g.alpha),y=new CR(v.calpha,"f");return new Ew(t,i,e,{thickness:a,ior:o,roughness:h,aspectRatio:m,...g},v,g.mode,y,g.isMask,s)}case"toon":{let a,o=new C4(r.positioning??0),h;r.colors?h=new Ms(r.colors.length,r.colors):(h=new Ms(10,new id(0,0,0,1))).value[1]=new id(1,1,1,1),r.steps?a=new C6(r.steps.length,r.steps):(a=new C6(10,1)).value[0]=0;let c=new C_(r.source??new iy(0,0,0)),d=new C5(r.isWorldSpace??!0),u=new CB(r.noiseStrength??0),p=new CB(r.noiseScale??1),f=new CS(r.shadowColor),m=new C_(r.offset??new iy(0,0,0)),g=EC(r),v=new My(o,h,a,c,d,u,p,f,m,g.alpha),y=new CR(v.calpha,"f");return new Ew(t,i,e,{positioning:o,colors:h,steps:a,source:c,isWorldSpace:d,noiseStrength:u,noiseScale:p,shadowColor:f,offset:m,...g},v,g.mode,y,g.isMask,s)}case"outline":{let a=new C3(r.outlineColor??0xffffff),o=new C3(r.contourColor??0xffffff),h=new CB(r.outlineWidth??.1),c=new CB(r.contourWidth??.1),d=new CB(r.outlineThreshold??.1),u=new CB(r.contourThreshold??.1),p=new CB(r.outlineSmoothing??.1),f=new CB(r.contourFrequency??.1),m=new C_(r.contourDirection??new iy(0,1,0)),g=new C5(r.positionalLines??!1),v=new C5(r.compensation??!0),y=MS.normalRenderTarget,x=MS.normalRenderTargetDepth,b=MS.pixelRatioNode,w=MS.resolution,_=EC(r),S=new Mm(a,o,h,c,d,u,p,f,m,g,v,w,y,x,b,_.alpha),C=new CR(S.calpha,"f");return new Ew(t,i,e,{outlineColor:a,contourColor:o,outlineWidth:h,contourWidth:c,outlineThreshold:d,contourThreshold:u,outlineSmoothing:p,contourFrequency:f,contourDirection:m,positionalLines:g,compensation:v,..._},S,_.mode,C,_.isMask,s)}case"depth":{let a,o=new C4(r.gradientType??0),h=new C5(r.smooth??!1),c=new CB(r.near??50),d=new CB(r.far??200),u=new CB(r.isVector??1),p=new CB(r.isWorldSpace??0),f=new C_(r.origin??new iy),m=new C_(r.direction??new iy),g;r.colors?g=new Ms(r.colors.length,r.colors):(g=new Ms(2,new id(0,0,0,1))).value[1]=new id(1,1,1,1),r.steps?a=new C6(r.steps.length,r.steps):(a=new C6(2,1)).value[0]=0;let v=EC(r),y=new Mh(o,h,c,d,u,p,f,m,g,a,v.alpha,v.isMask),x=new CR(y.calpha,"f");return new Ew(t,i,e,{gradientType:o,smooth:h,near:c,far:d,isVector:u,isWorldSpace:p,origin:f,direction:m,colors:g,steps:a,...v},y,v.mode,x,v.isMask,s)}case"noise":{let a=new CB(r.scale??1),o=new C_(r.size??new iy(100,100,100)),h=new CB(r.move??1),c=new Cw(r.fA??new tZ(1.7,9.2)),d=new Cw(r.fB??new tZ(8.3,2.8)),u=new Cw(r.distortion??new tZ(1,1)),p=new CS(r.colorA),f=new CS(r.colorB),m=new CS(r.colorC),g=new CS(r.colorD),v=new C4(r.noiseType??0),y=new C4(r.voronoiStyle??0),x=new CB(r.highCut??1),b=new CB(r.lowCut??0),w=new CB(r.smoothness??.5),_=new CB(r.seed??.5),S=new C4(r.quality??1),C=EC(r),M=new Mf(a,o,h,c,d,u,p,f,m,g,C.alpha,v,C.isMask,y,x,b,w,_,S),E=new CR(M.calpha,"f");return new Ew(t,i,e,{scale:a,size:o,move:h,fA:c,fB:d,distortion:u,colorA:p,colorB:f,colorC:m,colorD:g,noiseType:v,...C,voronoiStyle:y,highCut:x,lowCut:b,smoothness:w,seed:_,quality:S},M,C.mode,E,C.isMask,s)}case"normal":{let a=new C_(r.cnormal??new iy(1,1,1)),o=EC(r),h=new Mo(a,o.alpha),c=new CR(h.calpha,"f");return new Ew(t,i,e,{cnormal:a,...o},h,o.mode,c,o.isMask,s)}case"gradient":{let a,o=new C4(r.gradientType??0),h=new C5(r.smooth??!1),c;r.colors?c=new Ms(r.colors.length,r.colors):(c=new Ms(10,new id(0,0,0,1))).value[1]=new id(1,1,1,1),r.steps?a=new C6(r.steps.length,r.steps):(a=new C6(10,1)).value[0]=0;let d=new Cw(r.offset??new tZ(0,0)),u=new Cw(r.morph??new tZ(0,0)),p=new CB(r.angle??0),f=EC(r),m=new Md(o,h,c,a,d,u,p,f.alpha,f.isMask),g=new CR(m.calpha,"f");return new Ew(t,i,e,{gradientType:o,smooth:h,colors:c,steps:a,offset:d,morph:u,angle:p,...f},m,f.mode,g,f.isMask,s)}case"pattern":{let a=new C4(r.style??0),o=new C4(r.projection??0),h=new C4(["x","y","z"].indexOf(r.axis)??0),c=new CB(r.blending??0),d=new Cw(r.offset??new tZ(0,0)),u=new CS(r.colorA),p=new CS(r.colorB),f=new Cw(r.frequency??new tZ(10,10)),m=new CB(r.size??.5),g=new CB(r.variation??0),v=new CB(r.smoothness??.5),y=new CB(r.zigzag??0),x=new CB(r.rotation??0),b=new Cw(r.vertical??new tZ(0,1)),w=new Cw(r.horizontal??new tZ(0,1)),_=new C4(r.sides??6),S=EC(r),C=new Mg(a,o,h,c,d,u,p,f,m,g,v,y,x,b,w,_,S.alph
5423a,S.isMask),M=new CR(C.calpha,"f");return new Ew(t,i,e,{style:a,projection:o,axis:h,blending:c,offset:d,colorA:u,colorB:p,frequency:f,size:m,variation:g,smoothness:v,zigzag:y,rotation:x,vertical:b,horizontal:w,sides:_,...S},C,S.mode,M,S.isMask,s)}default:{let a=new C3(1,0,0,1),o=EC(r),h=new Mn(a,o.alpha),c=new CR(h.calpha,"f");return new Ew(t,i,e,{color:a,...o},h,o.mode,c,o.isMask,s)}}}(o,s,a,c,h)}if("noise"===i.displacementType){let s=new C_(new iy(...i.offset)),a=new CB(i.scale??10),o=new CB(i.intensity??8),h=new CB(i.movement??1),c=new C4(i.noiseType??0),d=new C4(i.voronoiStyle??0),u=new CB(i.smoothness??.5),p=new CB(i.seed??0),f=new CB(i.highCut??1),m=new CB(i.lowCut??0),g=new C4(i.quality??1),v=new M_(o,h,s,d,u,p,f,m,g,a,c);return new E_(e,t,i,{offset:s,scale:a,intensity:o,movement:h,noiseType:c,voronoiStyle:d,smoothness:u,seed:p,highCut:f,lowCut:m,quality:g},v,r)}throw Error()}updateByOp(e,t,i){if(void 0===e.path[0]){if(0===e.type)return"type"in e.props||"category"in e.props||"visible"in e.props||"noiseType"in e.props?(i.scene.markNeedsUpdateRendererDirty(),!0):function(e,t,i,r){let s=!1;for(let[a,o]of Object.entries(e)){if("bumpMap"===a||"roughnessMap"===a){s=!0;continue}if(!a||void 0===o)continue;if(EM(a,i,r,t)){"visible"===a&&"light"===i.type&&(s=!0);continue}i.visible=r.visible;let e=i.uniforms[`f${i.id}_${a}`];if(e&&!(e instanceof C8))switch(s=s||function(e,t,i){if("isMask"===t)return!0;let r=Eg[e.type],s=Ev[e.type];if(void 0!==s){let r=e.color;if(s.includes(t)){let e=r[t]?.value?.length;if(void 0!==e&&e!==i.length)return!0}}return void 0!==r&&r.includes(t)}(i,a,o),e.constructor){case C3:if("string"==typeof o){let i=t.getColor(o);i&&(e.value=i);break}e.value instanceof Em?e.value=new xA(o.r,o.g,o.b,o.a):e.setRGBA(o);break;case CS:if("string"==typeof o){let i=t.getColor(o);i&&(e.value=i);break}e.value instanceof Em?e.value=new xA(o.r,o.g,o.b,o.a):e.value.setRGBA(o.r,o.g,o.b,o.a);break;case Cw:e.value.setX(o[0]),e.value.setY(o[1]);break;case C_:e.value.setX(o[0]),e.value.setY(o[1]),e.value.setZ(o[2]);break;case Ck:Ey(o,t,i);break;case Ms:e.value=o.map(e=>new id(...e));break;default:e.value=o}}return s}(e.props,i.shared,this,t)}else if("texture"===e.path[0])return!("texture"in t)&&!("video"in t)||Ey(e.props,i.shared,this);return!1}dispose(){var e;let t;if(e=this,"texture"===(t=e instanceof Eb?e.type:e)||"video"===t||"displace_map"===t||"matcap"===t){let e=this.uniforms[`f${this.id}_texture`];if(!e)return!1;e.image instanceof MU||e.image.deref()}}hasValueByKey(e){return void 0!==this.uniforms[e]}hasValue(e){return this.hasValueByKey(`f${this.id}_${e}`)}setValue(e,t){let i=`f${this.id}_${e}`;this.hasValueByKey(i)&&void 0!==t&&(this.uniforms[i].value=t)}getNode(e){let t=`f${this.id}_${e}`;if(this.hasValueByKey(t))return this.uniforms[t]}getValue(e){let t=`f${this.id}_${e}`;if(this.hasValueByKey(t))return this.uniforms[t].value}getName(e){let t=/f\d+_(.*)/.exec(e);if(t&&t.length>1)return t[1];console.log(`Layer.getName: error ${e}`)}getNames(){let e=[];for(let t in this.uniforms){let i=this.getName(t);i&&e.push(i)}return e}},Ew=class extends Eb{constructor(e,t,i,r,s,a,o,h,c){super(e,t,i,r,c),this.params=r,this.color=s,this.mode=a,this.alpha=o,this.isMask=h}},E_=class extends Eb{constructor(e,t,i,r,s,a){super(e,t,i,r,a),this.position=s}},ES=class extends Eb{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 CB(Ex(i.alpha,r)),o=new C4(i.mode),h=new CB(i.bumpMapIntensity),c=new CB(Ex(i.alphaOverride,r)),d;if(i.visible)if("lambert"===i.category){s=new MO;let e=new C3(r.color(i.emissive)??0),t=new C5(i.occlusion??!0);d={emissive:e,occlusion:t},s.emissive=e,s.occlusion=t}else if("toon"===i.category){s=new Mk;let e=new CB(i.shininess??30),t=new C3(r.color(i.specular)??1118481);d={shininess:e,specular:t},s.shininess=e,s.specular=t}else if("physical"===i.category){s=new MR;let e=new CB(i.roughness??.3),t=new CB(i.metalness??0),r=new CB(i.reflectivity??.5),a=new C5(i.occlusion??!0);d={roughness:e,metalness:t,reflectivity:r,occlusion:a},s.roughness=e,s.metalness=t,s.reflectivity=r,s.occlusion=a}else{s=new MI;let e=new CB(i.shininess??30),t=new C3(void 0!==i.specular?r.color(i.specular)??1118481:1118481),a=new C5(i.occlusion??!0);d={shininess:e,specular:t,occlusion:a},s.shininess=e,s.specular=t,s.occlusion=a}else s=new MD,d={};
5423return s.alpha=new CB(1),s.shadingAlpha=a,s.shadingBlend=o,s.bumpMapIntensity=h,s.alphaOverride=c,d.alpha=s.shadingAlpha,d.mode=s.shadingBlend,d.bumpMapIntensity=s.bumpMapIntensity,d.alphaOverride=s.alphaOverride,new ES(e,t,i,s,d,r)}get category(){return this.node.category}};function EC(e){return{alpha:new CB(e.alpha??1),mode:new C4(e.mode??0),isMask:new C5(e.isMask??!1)}}function EM(e,t,i,r){if("displace"===i.type&&("intensity"===e||"visible"===e)){let e=t.uniforms[`f${t.id}_intensity`];return e?(e.value=!!i.visible*i.intensity,e):void 0}if("displace"!==i.type&&("alpha"===e||"visible"===e)){let s=t.uniforms[`f${t.id}_alpha`];if(!s)return;if(s.value=Ex(i.alpha,r)*!!i.visible,"outline"===i.type&&"visible"===e){let e=t.uniforms[`f${t.id}_compensation`];e&&(e.value=i.compensation&&i.visible)}return s}}function EE(e,t){let i=0,r=e.layers.find(e=>"light"===e.data.type);if(r){let e=r.data,i=Number(t.getVariable(e.alphaOverride));if(("string"==typeof e.alphaOverride?i/100:e.alphaOverride)<1)return!0}for(let r of e.layers){if("displace"!==r.data.type&&r.data.isMask)return!0;if("displace"!==r.data.type&&"alpha"in r.data&&"light"!==r.data.type&&"fresnel"!==r.data.type&&"texture"!==r.data.type&&"matcap"!==r.data.type&&"rainbow"!==r.data.type&&"outline"!==r.data.type&&"pattern"!==r.data.type){let e=r.data.visible?r.data.alpha:0;if("string"==typeof e&&(e=Math.max(0,Math.min(1,Number(t.getVariable(e)??100)/100))),1===e&&"depth"===r.data.type||"gradient"===r.data.type){for(let t of r.data.colors)if(t[3]<1){e=t[3];break}}else if(1===e&&"noise"===r.data.type){let i=Math.min(t.color(r.data.colorA).a,Math.min(t.color(r.data.colorB).a,Math.min(t.color(r.data.colorC).a,t.color(r.data.colorD).a)));i<1&&(e=i)}i+=(1-i)*e}}return i<1}var EA=class extends r5{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""}},ET=class extends EA{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()}},EP=class extends EA{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,Cg.startContext(this),this.reset0(e,t),Cg.endContext(this)}get nodeMaterial(){return this}getFlavor(e,t,i,r){let s=i?6:3*!!e+t;if(0===(s+=((r?.resolutionLevel??0)-4*!!r?.useChildrenColors)*7))return this;void 0===this.flavors&&(this.flavors=[]),s-=1;let a=this.flavors[s];return void 0===a&&((a=new ET(e,t,i,this)).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)),a}get fragment(){return this.lightLayer.node}get category(){return this.lightLayer.category}get hasAO(){return this.lightLayer.getNode("occlusion")?.value??!1}reset(e,t,i=!1){Cg.startContext(this),(this.data!==e||i)&&this.reset0(e,t),Cg.endContext(this)}reset0(e,t){this.data=e;let i=e.layers??g3.defaultTwoLayerData("phong").layers;try{this.layers=i.map(e=>Eb.create(this.layerIdGen++,e.id,e.data,t.shared))}catch{this.layers=[]}this.layers.reverse(),this.name=e.name??"Untitled Material",this.onUpdate(t.shared),this.transparent=EE(e,t.shared),this.saveVariableLocations(t)}onVariableUpdate(e,t,i){if("alphaOverride"===e[0])this.transparent=EE(this.data,i.shared),this.lightLayer.setValue("alphaOverride",Math.max(0,Math.min(Number(t)/100,1)));else if("layer"===e[0]){let r=e[1],s=e[2];if(r&&s){let e=this.layers.find(e=>e.uuid===r);e?.hasValue(s)&&("alpha"===s?(this.transparent=EE(this.data,i.shared),e.setValue(s,Math.max(0,Math.min(Number(t)/100,1)))):e.setValue(s,t))}}}saveVariableLocations(e){if(!this.allowVariableSaves)return;let t=this.data.layers.find(e=>"light"===e.data.type);t&&e.shared.getVariable(t.data.alphaOverride,["material",this.uuid,"alphaOverride"]),this.data.layers.forEac
vendor: 4,368 bytes, line 5423
5423h(t=>{"alpha"in t.data&&"string"==typeof t.data.alpha&&e.shared.getVariable(t.data.alpha,["material",this.uuid,"layer",t.id,"alpha"])})}getLayersOfType(e){return this.layers.filter(t=>t.type===e)}getLayerByUuid(e){return this.layers.find(t=>t.uuid===e)}onUpdate(e){for(let t of(this.lightLayer=this.layers.find(e=>e instanceof ES),void 0===this.lightLayer&&(this.lightLayer=new ES(0,"",{...gW.defaultData("light","phong"),visible:!1},new MD,{},e)),this.dispose(),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(e=>e instanceof ES);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 t=0;t<this.layers.length;++t){let s=this.layers[t];s instanceof Ew&&s.color instanceof Ml&&(s.uuid===i&&(e.node.bumpMap=s.color),s.uuid===r&&(e.node.roughnessMap=s.color))}}updateByOp(e,t,i){if(Cg.startContext(this),void 0!==t?this.data=t:t=this.data,this.transparent=EE(t,i.shared),"layers"===e.path[0]){let r=i.shared,s=e.path[1];if(void 0===s)i.scene.markNeedsUpdateRendererDirty(),this.reset0(t,i);else{0===e.type&&void 0!==e.props.occlusion&&i.scene.markNeedsUpdateRendererDirty();let a=this.layers.find(e=>e.uuid===s);if(a){let o=t.layers.data(s),h;0===e.type&&("alpha"in e.props||"alphaOverride"in e.props)&&(h="alpha"in e.props?{...e.props,alpha:Ex(e.props.alpha,r,["material",this.uuid,"layer",s,"alpha"])}:{...e.props,alphaOverride:Ex(e.props.alphaOverride,r,["material",this.uuid,"alphaOverride"])}),a.updateByOp({...e,...h?{props:h}:{},path:e.path.slice(2)},o,i)&&this.reset0(t,i)}}}else this.reset0(t,i);Cg.endContext(this)}applyMasks(){for(let e=0;e<this.layers.length;++e){let t=this.layers[e];t instanceof Ew?t.color.mask=void 0:t instanceof ES&&(t.node.mask=void 0)}for(let e=0;e<this.layers.length;++e){let t=this.layers[e];if(t instanceof Ew&&t.isMask.value&&t.data.visible&&e>0){let i=e-1,r=this.layers[i];r instanceof ES?r.node.mask=new CN(t.color,t.alpha,CN.MUL):r instanceof Ew&&(r.isMask.value||(r.color.mask=new CN(t.color,t.alpha,CN.MUL)))}}}blendColors(){let e=this.layers.findIndex(e=>e instanceof Ew),t=this.layers.findIndex(e=>e instanceof ES);if(-1!==e&&e<t){let i=this.layers[e].color;for(let r=e+1;r<t;++r){let e=this.layers[r];if(e instanceof Ew){if(e.isMask.value)continue;i=new Ma(i,e.color,e.alpha,e.mode)}}this.fragment.color=i}else this.fragment.color=void 0}blendAfterColors(){let e=new CR("outgoingLight","f"),t=this.layers.findIndex(e=>e instanceof ES);if(this.layers.length>t+1){for(let i=t+1;i<this.layers.length;++i){let t=this.layers[i];if(t instanceof Ew){if(t.isMask.value)continue;e=new Ma(e,t.color,t.alpha,t.mode)}}this.fragment.afterColor=e}else this.fragment.afterColor=void 0}blendPositions(){let e=this.layers.filter(e=>e instanceof E_);if(e.length>0){let t=e[0].position;for(let i=1;i<e.length;++i)e[i]&&(t=new CN(t,e[i].position,CN.ADD),t=new CN(t,new CB(.5).setReadonly(!0),CN.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=!0===this.extensions.derivatives,e.extensionFragDepth=!0===this.extensions.fragDepth,e.extensionDrawBuffers=!0===this.extensions.drawBuffers,e.extensionShaderTextureLOD=!0===this.extensions.shaderTextureLOD}clampUniformsForPreview(e,t){let i=(e,t,i)=>Math.min(Math.max(e,t),i);for(let r of this.layers)if("displace"===r.type){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 C2;for(let t of(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,this.flavors))t&&t.updateAfterBuild();return this.shadersPatchedForShapeBlend=!1,this}
5423nodeMaterialDispose(){for(let e of(this.layers.forEach(e=>e.dispose()),super.dispose(),this.flavors))e&&e.dispose()}assetsLoaded(){for(let e of this.layers)if(e instanceof Ew){let t=e.params.texture;if(t instanceof C7&&!t.image.loaded)return!1}return!0}};Object.defineProperties(EA.prototype,{properties:{get:function(){return this.fragment.properties}}});var ED,EO=class extends EP{constructor(e,t,i){super(e,t,!1),this.uuid=i,this.allowVariableSaves=!0,this.saveVariableLocations(t)}},EL=new Map,EI=new Promise(e=>{ED=e}),ER=!1;function Ek(e,t){e.forEach(e=>{"dragDropActions"in e.data?(t.push(...e.data.dragDropActions.drag),t.push(...e.data.dragDropActions.drop)):"inActions"in e.data?(t.push(...e.data.inActions),t.push(...e.data.outActions)):"gameActions"in e.data?(t.push(...e.data.gameActions.idle),t.push(...e.data.gameActions.move),t.push(...e.data.gameActions.jump),t.push(...e.data.gameActions.run)):"breakpoints"in e.data?e.data.breakpoints.forEach(e=>{t.push(...e.data.actions)}):"actions"in e.data&&(t.push(...e.data.actions),e.data.actions.forEach(e=>{"Conditional"===e.data.type&&e.data.ifActions&&(t.push(...e.data.ifActions),t.push(...e.data.elseActions))}))})}EI.then(e=>Ez=e);var EB,Ez,EN,EF=class{constructor({src:e,volume:t,delay:i,loop:r}){let s;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)},s="string"==typeof e?{src:e}:{src:function(e){if("string"==typeof e)return e;let t=EL.get(e);return t||(t={url:URL.createObjectURL(new Blob([e]))},EL.set(e,t)),t.url}(e),format:"wav"},this.sound=new Ez.Howl(s),this.sound.on("end",this.onEnd),this.src=e,void 0!==t&&(this.volume=t),void 0!==i&&(this.delay=i),void 0!==r&&(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(){"playing"===this._status||this.sound.playing()||("paused"===this._status?(0===this.sound.seek()?this.replay():this.sound.play(),this._status="playing"):"stopped"===this._status&&(this.replay(),this._status="playing"))}pause(){"playing"===this._status&&(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()}},Ej=class{constructor(){this.type="ShapePath",this.color=new ir,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new oa,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath?.lineTo(e,t),this}quadraticCurveTo(e,t,i,r){return this.currentPath?.quadraticCurveTo(e,t,i,r),this}bezierCurveTo(e,t,i,r,s,a){return this.currentPath?.bezierCurveTo(e,t,i,r,s,a),this}splineThru(e){return this.currentPath?.splineThru(e),this}toShapes(){let e={loc:0,t:0};function t(t,i,r){let s=r.x-i.x,a=r.y-i.y,o=t.x-i.x,h=t.y-i.y,c=s*h-o*a;if(t.x===i.x&&t.y===i.y){e.loc=0,e.t=0;return}if(t.x===r.x&&t.y===r.y){e.loc=1,e.t=1;return}if(c<-Number.EPSILON){e.loc=3;return}if(c>Number.EPSILON){e.loc=4;return}if(s*o<0||a*h<0){e.loc=5;return}if(Math.sqrt(s*s+a*a)<Math.sqrt(o*o+h*h)){e.loc=6;return}e.loc=2,e.t=0!==s?o/s:h/a}let i=0,r=0x3b9ac9ff,s=-0x3b9ac9ff,a=[];this.subPaths.forEach(e=>{let t=e.getPoints(),o=-0x3b9ac9ff,h=0x3b9ac9ff,c=-0x3b9ac9ff,d=0x3b9ac9ff;for(let e=0;e<t.length;e++){let i=t[e];i.y>o&&(o=i.y),i.y<h&&(h=i.y),i.x>c&&(c=i.x),i.x<d&&(d=i.x)}s<=c&&(s=c+1),r>=d&&(r=d-1),t.length&&a.push({curves:e.curves,points:t,isCW:oT.isClockWise(t),identifier:i++,boundingBox:new lB(new tZ(d,h),new tZ(c,o))})});let o=a.map(i=>(function(i,r,s,a,o){var h,c;let d,u;(null==o||""===o)&&(o="nonzero");let p=new tZ;i.boundingBox.getCenter(p);let f=(h=[new tZ(s,p.y),new tZ(a,p.y)],c=i.boundingBox,d=new tZ,c.getCenter(d),u=[],r.forEach(i=>
5423{i.boundingBox.containsPoint(d)&&(function(i,r){let s=[],a=[];for(let o=1;o<i.length;o++){let h=i[o-1],c=i[o];for(let i=1;i<r.length;i++){let o=function(i,r,s,a){let o=i.x,h=r.x,c=s.x,d=a.x,u=i.y,p=r.y,f=s.y,m=a.y,g=(d-c)*(u-f)-(m-f)*(o-c),v=(m-f)*(h-o)-(d-c)*(p-u),y=g/v,x=((h-o)*(u-f)-(p-u)*(o-c))/v;if(0===v&&0!==g||y<=0||y>=1||x<0||x>1)return null;if(0===g&&0===v){for(let c=0;c<2;c++)if(t(0===c?s:a,i,r),0===e.loc){let t=0===c?s:a;return{x:t.x,y:t.y,t:e.t}}else if(2===e.loc)return{x:+(o+e.t*(h-o)).toPrecision(10),y:+(u+e.t*(p-u)).toPrecision(10),t:e.t};return null}for(let o=0;o<2;o++)if(t(0===o?s:a,i,r),0===e.loc){let t=0===o?s:a;return{x:t.x,y:t.y,t:e.t}}return{x:+(o+y*(h-o)).toPrecision(10),y:+(u+y*(p-u)).toPrecision(10),t:y}}(h,c,r[i-1],r[i]);null!==o&&void 0===s.find(e=>e.t<=o.t+Number.EPSILON&&e.t>=o.t-Number.EPSILON)&&(s.push(o),a.push(new tZ(o.x,o.y)))}}return a})(h,i.points).forEach(e=>{u.push({identifier:i.identifier,isCW:i.isCW,point:e})})}),u.sort((e,t)=>e.point.x-t.point.x),u);f.sort((e,t)=>e.point.x-t.point.x);let m=[],g=[];f.forEach(e=>{e.identifier===i.identifier?m.push(e):g.push(e)});let v=m[0].point.x,y=[],x=0;for(;x<g.length&&g[x].point.x<v;)y.length>0&&y[y.length-1]===g[x].identifier?y.pop():y.push(g[x].identifier),x++;if(y.push(i.identifier),"evenodd"===o){let e=y.length%2==0,t=y[y.length-2];return{identifier:i.identifier,isHole:e,for:t}}if("nonzero"===o){let e=!0,t=null,s=null;for(let i=0;i<y.length;i++){let a=y[i];r[a]&&(e?(s=r[a].isCW,e=!1,t=a):s!==r[a].isCW&&(s=r[a].isCW,e=!0))}return{identifier:i.identifier,isHole:e,for:t}}console.warn('fill-rule: "'+o+'" is currently not implemented.')})(i,a,r,s,this.userData?.style.fillRule)),h=[];return a.forEach(e=>{let t=o[e.identifier];if(t&&!t.isHole){let t=new od;t.curves=e.curves,o.filter(t=>t?.isHole&&t.for===e.identifier).forEach(e=>{if(e){let i=a[e.identifier],r=new oa;r.curves=i.curves,t.holes.push(r)}}),h.push(t)}}),h}},EU=!1,EV=new Promise(e=>{EN=e}),EW=!1;async function EH(e){return await (await fetch(e)).arrayBuffer()}var EG=new class{async load(e,t,i=()=>{}){let{load:r}=await EV;r(e,(e,r)=>{e||!r?i(e??"Something went wrong"):t(r)})}async parse(e){let{parse:t,Bidi:i}=await EV;try{let r=t(e),s=new i;return s.registerModifier("glyphIndex",null,e=>r.charToGlyphIndex(e.char)),s.applyFeatures(r,r.defaultRenderOptions.features),{font:r,bidi:s}}catch(e){console.error(e)}}};async function Eq(e){let t,i,r=!1;if(e.url?(t=await EH(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(!EU)return{font:void 0,url:i,intercepted:r,arr:t,bidi:null};else{let e=await EG.parse(t);if(e)return{font:e.font,url:i,intercepted:r,arr:t,bidi:e.bidi}}}var EX=class{constructor(e){this._arrayBuffer=new ArrayBuffer(1),this._isLoaded=!1,this._intercepted=!1,this._isUserFont=e.isUserFont??!1,this._loadingPromise=Eq(e).then(e=>{e&&(this._arrayBuffer=e.arr,this._url=e.url,this.font=e.font,this._intercepted=e.intercepted,this._isLoaded=!0,this._bidi=e.bidi)})}update(e){this._isLoaded=!1,this._isUserFont=e.isUserFont??!1,this._loadingPromise=Eq(e).then(e=>{e&&(this._arrayBuffer=e.arr,this._url=e.url,this.font=e.font,this._intercepted=e.intercepted,this._isLoaded=!0,this._bidi=e.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=[],o=0,h=i.length===s.length;for(let r=0;r<i.length;r++){let c=i[r].index,d=String.fromCharCode(i[r].unicode),u=s[o];if(u.state.glyphIndex===c||u.state.fina===c||u.state.medi===c||u.state.init===c||h)a.push({char:d,index:c,replacements:[u.state.glyphIndex],replacementChars:[u.char]}),o++;else{let i=u.char,r="",s=[u.state.glyphIndex],h=[],p=!1;for(;!p;)o++,i+=r=t.charAt(o),s.push(e.charToGlyphIndex(r)),1===(h=e.stringToGlyphs(i)).length&&h[0].index===c&&(p=!0),o>t.length&&(p=!0);a.push({char:d,index:c,replacements:s,replacementChars:Array.from(i)}),o++}}return a}generateShapes(e,t,i){if(!this._isLoaded)return;let r=this.font,s=t.fontSize/this.unitsPerEm,a=t.fontSize*t.lineHeight,o=e.map(e=>this.getTextWidth(e,t)),h="string"==typeof t.width?Number(i.getVariable(t.width)):t.width,c="string"==typeof t.height?Number(i.getVariable(t.height)):t.height,d=this.getCharWidth(`
5424`,t),u=1===t.horizontalAlign?d:0,p=this.getLineInitialOffsetX(o[0],h,t.horizontalAlign,e[0],d),f=this.getLineInitialOffsetY(a,e.length,c,s,t.verticalAlign),m=[],g=e.map(e=>[]),v=e.map(e=>[]);for(let c=0;c<e.length;c++){let y=e[c],x={features:{liga:!0},letterSpacing:t.letterSpacing},b=[];try{b=r.stringToGlyphs(y,x)}catch(e){console.warn(e)}p=this.getLineInitialOffsetX(o[c],h,t.horizontalAlign,y,d);let w=[];try{w=this.reverseLigaturesTable(r,y,b)}catch(e){console.warn(e)}let _=this.computeSpaceWidthForLine(e,c,t,i),S=0,C=b[0];C&&2===t.horizontalAlign&&void 0!==C.leftSideBearing&&(p-=C.leftSideBearing*s),this.font?.forEachGlyph(y,p,f,t.fontSize,x,(e,i,a,o,h)=>{let d=0===e.index?`
5425`:e.unicode?String.fromCharCode(e.unicode):void 0,p=w[S],f=0;if(d===`
5426`)f=u;else if(" "===d)f=_;else{let r=this.createPath(e,s,i,a,t);r&&(f=r.offsetX,m.push(r.path))}if(1===p.replacements.length)v[c].push([i,a]),g[c].push(f);else{let e=p.replacements.map(e=>(r.glyphs.get(e).advanceWidth??0)*s),t=e.reduce((e,t)=>
vendor: 6,070 bytes, lines 5426-5427
5426e+=t,0),o=e.map(e=>e/t),h=i;for(let e=0;e<o.length;e++){let t=f*o[e];v[c].push([h,a]),g[c].push(t),h+=t}}S++}),f-=a}let y=[];for(let e=0,t=m.length;e<t;e++)y.push(...m[e].toShapes());return{shapes:y,charWidths:g,lineWidths:o,charCoords:v}}get isUserFont(){return this._isUserFont}get arrayBuffer(){return this._arrayBuffer}get ascender(){return this.font?.ascender??0}get descender(){return this.font?.descender??0}get familyName(){return this.font?.names.fontFamily??""}get subfamilyName(){return this.font?.names.fontSubfamily??""}get unitsPerEm(){return this.font?.unitsPerEm??1}getLineInitialOffsetX(e,t,i,r,s){return(3===i||2===i)&&r.indexOf(`
5427`)>=0&&(e-=s),3===i?.5*t-.5*e:2===i?t-e:0}getLineInitialOffsetY(e,t,i,r,s){let a=t*e,o=Math.abs(this.ascender-this.descender)*r,h=-this.ascender*r-(e-o)/2;return 3===s?-(i-a-h):2===s?-(.5*i-.5*a-h):h}createPath(e,t,i,r,s){let a=e.getPath(i,-r,s.fontSize,{kerning:!1,letterSpacing:s.letterSpacing});if(!a)return void console.error('THREE.Font: character "'+e+'" does not exists in font family '+this.familyName+".");let o=new Ej,h=(e.advanceWidth??1)*t;if(e)for(let e of a.commands){let t=o.currentPath?.currentPoint;if(!(t&&"Z"!==e.type&&t.x===e.x&&-t.y===e.y))switch(e.type){case"M":o.moveTo(e.x,-e.y);break;case"L":o.lineTo(e.x,-e.y);break;case"Q":o.quadraticCurveTo(e.x1,-e.y1,e.x,-e.y);break;case"C":o.bezierCurveTo(e.x1,-e.y1,e.x2,-e.y2,e.x,-e.y)}}return o.subPaths.forEach(e=>{let t=function(e){if(e.length){let t=e[0];if(t instanceof n9)return t.v1;if(t instanceof n6||t instanceof oe)return t.v0}}(e.curves);void 0!==t&&e.currentPoint.distanceTo(t)>0&&e.lineTo(t.x,t.y)}),{offsetX:h,path:o}}getCharWidth(e,t){return this.font?.getAdvanceWidth(e,t.fontSize,{kerning:!0,letterSpacing:t.letterSpacing})??0}getTextWidth(e,t){return this.font?.getAdvanceWidth(e,t.fontSize,{kerning:!0,letterSpacing:t.letterSpacing})??0}computeSpaceWidthForLine(e,t,i,r){let s=this.getCharWidth(" ",i),a=e[t];if(a){let o=this.countSpaces(a.trimEnd());if(4===i.horizontalAlign&&t<e.length-1&&o)return(("string"==typeof i.width?Number(r.getVariable(i.width)):i.width)-(this.getTextWidth(a,i)-o*s))/o}return s}countSpaces(e){return(e.match(/ /g)||[]).length}},EY=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 void 0===r?(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&&!0!==i.isShared)return this.objects.delete(e),this.objects.set(t,i),i}startGc(){this.unreachable=new Set(this.objects.keys())}markAsReachable(e,t){t===this.objects.get(e)&&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()}},EQ=class extends EY{constructor(e){super(),this.flatShading=e}disposeObject(e){e.dispose()}createObject(e,t,i){let r=SU(e,t,this.flatShading,i);return r.computeBoundingSphere(),r}},EZ={markNeedsUpdateRendererDirty:()=>{}},EK="https://hooks.spline.design/events?hashFile=",EJ=class{constructor(e,t){this.id=e,this.userWebhook=t,this.result=void 0,this._connected=!1,this.emitter=Sg(),this.reconnectWaitFor=1e3,this._onError=e=>{this.eventSource?.removeEventListener("message",this._onMessage),this.eventSource?.removeEventListener("error",this._onError),this.eventSource?.removeEventListener("open",this._onConnected),this._scheduleReconnect()},this._onConnected=e=>{clearTimeout(this.scheduledReconnectHandle),this.reconnectWaitFor=1e3,this._connected=!0},this._onDisconnected=()=>{clearTimeout(this.scheduledReconnectHandle),this.reconnectWaitFor=1e3,this._connected=!1},this._onMessage=e=>{let t=e.data,i;try{i=JSON.parse(t)}catch(e){console.error("Error parsing webhook message",e)}if(i){let e=!1;this.userWebhook.parametersSchemas.forEach(({data:t})=>{var r,s;let a;void 0!==i[t.name]&&(r=i[t.name],s=t.type,a=typeof r,("string"===s||"number"===s)&&a===s||"boolean"===s&&("true"===r||"false"===r||!0===r||!1===r)||"image"===s&&"string"===a&&r.startsWith("http"))&&(void 0===this.result&&(this.result={}),this.result[t.name]=i[t.name],e=!0)}),e&&this.emitter.emit("message",{userWebhookId:this.id})}}}connect(){clearTimeout(this.scheduledReconnectHandle),this.userWebhook.url&&(this.eventSource=new EventSource(EK+this.userWebhook.url),this.eventSource.addEventListener("message",this._onMessage),this.eventSource.addEventListener("error",this._onError),this.eventSource.addEventListener("open",this._onConnected))}disconnect(){this.eventSource?.removeEventListener("message",this._onMessage),this.eventSource?.removeEventListener("error",this._onError),this.eventSource?.removeEventListener("open",this._onConnected),this.eventSource?.close(),this._onDisconnected(),clearTimeout(this.scheduledReconnectHandle)}_scheduleReconnect(){this.reconnectWaitFor*=2,this.reconnectWaitFor>512e3&&(this.reconnectWaitFor=512e3),clearTimeout(this.scheduledReconnectHandle),this.scheduledReconnectHandle=setTimeout(()=>{this.scheduledReconnectHandle=void 0,this.connect()},this.reconnectWaitFor)}update(e){this.userWebhook=e}dispose(){this._connected&&this.disconnect()}get connected(){return this._connected}on(e,t){this.emitter.on(e,t)}off(e,t){this.emitter.off(e,t)}getParametersKeys(){return this.userWebhook.parametersSchemas.map(e=>e.data.name)}getParameterValue(e){if(this.getParametersKeys().includes(e)){if(this.result)return this.result?.[e];for(let t of this.userWebhook.parametersSchemas)if(t.data.name===e)return y0.defaultParameterValueByType(t.data.type)}}},E$=[4186.01,4434.92,4698.63,4978.03,5274.04,5587.65,5919.91,6271.93,6644.88,7040,7458.62,7902.13],E0=["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"],E1=[],E2=[];for(let e=1;e<=8;e++)for(let t=0;t<E$.length;t++){let i=E$[t];E1.push(i/Math.pow(2,8-e)),E2.push(E0[t]+e)}var E3=E1.filter((e,t)=>
5427E1[t]>32&&E1[t]<2e3),E4=E2.filter((e,t)=>E1[t]>32&&E1[t]<2e3),E5=class{static getFrequencies(e,t,i,r="frequency",s=-100,a=-30){i||(i=new Float32Array(e.frequencyBinCount),e.getFloatFrequencyData(i));let o=1/i.length*(t/2),h,c,d;if("music"===r||"voice"===r){let e="voice"===r?E3:E1,t=Array(e.length).fill(s);for(let r=0;r<i.length;r++){let s=r*o,a=i[r];for(let i=e.length-1;i>=0;i--)if(s>e[i]){t[i]=Math.max(t[i],a);break}}h=t,c="voice"===r?E3:E1,d="voice"===r?E4:E2}else d=(c=(h=Array.from(i)).map((e,t)=>o*t)).map(e=>`${e.toFixed(2)} Hz`);return{values:new Float32Array(h.map(e=>Math.max(0,Math.min((e-s)/(a-s),1)))),frequencies:c,labels:d}}};async function E6(e){try{return(await (await fetch("https://relayserver.spline.design/session?uuidfile="+e)).json()).token}catch(e){console.error("Token generation error:",e)}}var E8=class{constructor(e){this.value=0,this.frequencies=new Float32Array(0);let t=new AudioContext;this.source=t.createMediaStreamSource(e),this.analyser=t.createAnalyser(),this.source.connect(this.analyser),this.analyser.fftSize=8192,this.analyser.smoothingTimeConstant=.1}getFrequencies(e=-100,t=-30){if(!this.analyser)throw Error("Not connected, please call .connect() first");return E5.getFrequencies(this.analyser,44100,void 0,"voice",e,t)}update(){let e=this.getFrequencies(),t=e.values.reduce((e,t)=>e+t,0)/e.values.length;this.value=t,this.frequencies=e.values}disconnect(){this.source.disconnect(),this.analyser.disconnect()}},E9=class{constructor(e,t,i){this.data=e,this.id=t,this.shared=i,this.emitter=Sg(),this.rafId=0,this.voice=0,this.frequencies=new Float32Array([0]),this.events=[],this.isConnected=!1,this.isToolsAdded=!1,this.tools=[],this.onMessage=e=>{let t=JSON.parse(e.data);if(this.appendEvent(t),"session.created"===t.type&&this.onSessionCreated(),"response.done"===t.type&&t.response?.output){for(let e of t.response.output)if("function_call"===e.type)for(let[t,i]of this.tools)e.name===t.name&&(i(JSON.parse(e.arguments)),setTimeout(()=>{this.sendClientEvent({type:"response.create",response:{instructions:"notice the user about what you just did"}})}))}},this.onSessionCreated=()=>{this.isToolsAdded||this.registerTools()},this.onOpen=()=>{this.events=[],this.isConnected=!0,this.sendClientEvent({type:"response.create",response:{instructions:"Say hi"}})},this.animate=()=>{if(this.rafId=requestAnimationFrame(this.animate),this.isConnected&&this.analyser){this.analyser.update();let e=this.analyser.value,t=this.analyser.frequencies;this.voice=e,this.frequencies=t,this.emitter.emit("voice",{value:e,frequencies:t})}}}update(e){this.data=e}setColorByName(e,t){let i=this.shared.getColorByName(e);if(i){let{id:e}=i,{r:r,g:s,b:a}=Sd(t)??{r:0,g:0,b:0};this.shared.updateColor(e,{r:r/255,g:s/255,b:a/255})}}async connect(){if(this.isConnected)return;let e=await E6(this.data.integration.hash);this.pc=new RTCPeerConnection,this.audioElement=document.createElement("audio"),this.audioElement.autoplay=!0,this.pc.ontrack=e=>{let t=e.streams[0];this.audioElement.srcObject=t,this.analyser=new E8(t)};let t=await navigator.mediaDevices.getUserMedia({audio:!0});this.pc.addTrack(t.getTracks()[0]),this.dc=this.pc.createDataChannel("oai-events"),this.dc.addEventListener("message",this.onMessage),this.dc.addEventListener("open",this.onOpen);let i=await this.pc.createOffer();await this.pc.setLocalDescription(i);let r={type:"answer",sdp:await (await fetch("https://api.openai.com/v1/realtime?model=gpt-4o-realtime-preview-2024-12-17",{method:"POST",body:i.sdp,headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/sdp"}})).text()};await this.pc.setRemoteDescription(r),this.animate()}appendEvent(e){this.events=[e,...this.events]}sendClientEvent(e){this.dc?(e.event_id=e.event_id||crypto.randomUUID(),this.dc.send(JSON.stringify(e)),this.appendEvent(e)):console.error("Failed to send message - no data channel available",e)}registerTools(){this.isToolsAdded=!0,this.registerTool({type:"function",name:"set_personality_color",description:"returns a color based on the voice personality of the ai assistant. This should be called by the voice assistant each time it is asks to speak differently. If a color cannot be associated to the personality, the color should be a neutral color.",parameters:{type:"object",properties:{color:{type:"string",description:"css hex color string, reflecting the personality"},personality:{type:"string",description:"the personality of the voice assistant"}},required:["color","personality"]}},({color:e})=>{this.setColorByName("Voice Assistant Color",e)});let e=this.shared.getVariablesNames().join(", ");this.registerTool({type:"function",name:"set_variable",description:"Sets a Spline variable value when asked by the user.",parameters:{type:"object",properties:{name:{type:"string",description:`The name of the variable that needs to be set. Here's a list of available variables: ${e}. It the variable does not exist, don't call the function and warn the user about it.`},value:{type:"string",description:"The new value for this variable, should always be a string even for number and boolean variables, assume that the value will be cast to the proper type afterwards."}},required:["name","value","type"]}},({name:e,value:t})=>{let i=this.shared.getVariableByName(e);
5427if(i){let e=this.shared.getVariable(i.id),r;r="number"==typeof e?parseFloat(t):"boolean"==typeof e?"true"===t.toLowerCase():{textValue:t},this.shared.updateVariable(i.id,r)}});let t=this.shared.getColorNames().join(", ");this.registerTool({type:"function",name:"set_color",description:"Sets a Spline color asset value when asked by the user.",parameters:{type:"object",properties:{name:{type:"string",description:`The name of the color asset that needs to be set. Here's a list of available color assets: ${t}. It the color asset does not exist, don't call the function and warn the user about it.`},value:{type:"string",description:"css hex color string"}},required:["name","value"]}},({name:e,value:t})=>{this.setColorByName(e,t)});let i=this.shared.scene,r=[];i.traverseEntity(e=>{e.data.events.forEach(e=>{if("AIAssistantTrigger"===e.data.type){let{description:t}=e.data;r.push(t)}})}),this.registerTool({type:"function",name:"trigger_event",description:"Trigger an event by name, here are the available events, please match what the user is asking for to one of these if it applies, otherwise don't call the function and warn the user.",parameters:{type:"object",properties:{description:{type:"string",description:`The name of the event that needs to be triggered. Here's a list of available events: ${JSON.stringify(r)}.`},direction:{type:"string",description:"default is forward, but can be forward or backward. Always set to forward unless the user ask to reverse or cancel the event, then set to backward."}},required:["description","direction"]}},({description:e,direction:t})=>{this.emitter.emit("trigger_event",{description:e,direction:t})}),this.sendClientEvent({type:"session.update",session:{tools:this.tools.map(([e])=>e)}})}registerTool(e,t){this.tools.push([e,t])}disconnect(){cancelAnimationFrame(this.rafId),this.analyser?.disconnect(),this.voice=0,this.isConnected=!1,this.isToolsAdded=!1,this.dc?.removeEventListener("message",this.onMessage),this.dc?.removeEventListener("open",this.onOpen),this.dc?.close(),this.pc?.getSenders().forEach(e=>{e.track&&e.track.stop()}),this.pc?.close(),this.pc=void 0}computeAnalysisForListenerEvent(e){if("range"===e.analysis){let t=this.frequencies.slice(...e.analysisRange);return t.reduce((e,t)=>e+t,0)/t.length}return"single"===e.analysis?this.frequencies[e.analysisSingle]:this.voice}on(e,t){this.emitter.on(e,t)}off(e,t){this.emitter.off(e,t)}};function E7(e){return"variable_"+e}var Ae=class extends MF{constructor(e){super(),this.shared=e}create(e){return new Mj(e,this.shared)}},At=class{constructor(e,t={},i=!0,r=!1){if(this.data=e,this.needsJitter=i,this.enableLocalStorageForPersistentVariables=r,this.geometryCache=new EQ(!0),this.geometryCache2=new EQ(!1),this.imageHolderCache=new Ae(this),this.thisContext={scene:EZ,shared:this},this.deletedMaterial=new EO(g3.defaultTwoLayerData("phong"),this.thisContext,""),this.deletedImage=new MU(xt.emptyImage,this),this.deletedVideo=new MU(gj.defaultVideo,this),this.materials={},this.images={},this.uiBuffers={},this.videos={},this.colors={},this.audios={},this.particles={},this.fonts={},this.timelineAnimations={},this.variables={},this.userAPIs={},this.userWebhooks={},this.mouseProperty=null,this.raycastProperty=null,this.requestRender=()=>{this._requestRender&&this._requestRender()},t.images)for(let[e,i]of Object.entries(t.images))this.addImage(e,i);if(t.videos)for(let[e,i]of Object.entries(t.videos))this.addVideo(e,i);if(t.audios)for(let[e,i]of Object.entries(t.audios))this.addAudio(e,i);if(t.particles)for(let[e,i]of Object.entries(t.particles))this.addParticle(e,i);this.reset(e)}setRequestRender(e){this._requestRender=e}getImageLoadPromises(){return Object.values(this.images).map(e=>e.loadPromise)}setEntityOpContext(e){this.entityOpContext=e}reset(e,t=!1,i=!1){for(let{id:i,data:r}of(this.data=e,this.resetLib(e.lib),e.variables))this.addVariableHolder(i,r),t&&this.updateVariableHolder(i,r);for(let[t,i]of Object.entries(e.userAPIs))this.addUserAPI(t,i);for(let[t,i]of Object.entries(e.userWebhooks))this.addUserWebhook(t,i);if(!i){for(let[t,i]of Object.entries(e.images))this.addImage(t,i);for(let[t,i]of Object.entries(e.videos))this.addVideo(t,i)}
vendor: 8,816 bytes, line 5427
5427for(let[t,i]of Object.entries(e.colors))this.addColor(t,i);for(let[t,i]of Object.entries(e.materials))this.addMaterial(t,i);for(let[t,i]of Object.entries(e.audios))this.addAudio(t,i);for(let[t,i]of Object.entries(e.particles))this.addParticle(t,i);for(let[t,i]of Object.entries(e.fonts))this.addFont(t,i);for(let[t,i]of Object.entries(e.timelineAnimations??{}))this.addAnimation(t,i)}addMaterial(e,t){if(this.materials[e]){let i=this.materials[e];i.reset(t,this.thisContext),i.dispose()}else{let i=new EO(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"string"==typeof e?this.getMaterialOrDeletedPlaceholder(e):null==e?(console.error("material is undefined or null"),this.deletedMaterial):new EP(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 MU(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"string"==typeof e?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 MU(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 MU(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"string"==typeof e?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 Em(t.r,t.g,t.b,t.a):this.colors[e]=new Em(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("string"!=typeof e)return"a"in e?new xA(e.r,e.g,e.b,e.a):new xA(e.r,e.g,e.b,1);{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 xA(0,0,0,0))}return t}addAudio(e,t){this.audios[e]=t}getAudio(e){let t=this.audios[e];if(t instanceof EF)return t;{let i=new EF({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 EF&&t.dispose(),delete this.audios[e])}addFont(e,t){this.fonts[e]=new EX(t),this.fonts[e].loadingPromise.then(()=>this.requestRender())}getFont(e){return this.fonts[e]}deleteFont(e){this.fonts[e]&&delete this.fonts[e]}addAnimation(e,t){this.timelineAnimations[e]=t}getAnimation(e){return this.timelineAnimations[e]}deleteAniamtion(e){this.timelineAnimations[e]&&delete this.timelineAnimations[e]}dispose(){Object.keys(this.materials).forEach(e=>this.deleteMaterial(e)),this._requestRender=void 0,Object.values(this.audios).forEach(e=>{e instanceof EF&&e.dispose()}),this.audios={},this.particles={},this.geometryCache.dispose(),this.geometryCache2.dispose()}addVariableHolder(e,t){if(void 0===this.variables[e]){let i=t.value;if(this.enableLocalStorageForPersistentVariables&&t.persistent){let r=localStorage.getItem(E7(e));i=null!==r?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)void 0!==this.variables[e].dynamicVariablePlayState&&(this.variables[e].dynamicVariablePlayState="Playing",this.variables[e].dynamicVariableToggleIsForward=void 0)}updateVariableHolder(e,t){this.updateVariable(e,t.value)}updateVariable(e,t){if(void 0===this.variables[e])return!1;this.variables[e].value=t,this.enableLocalStorageForPersistentVariables&&this.variables[e].persistent&&localStorage.setItem(E7(e),JSON.stringify(t));let i=t;for(;"string"==typeof i;)i=this.variables[i].value;let r=this.entityOpContext.scene;for(let t=this.variables[e].locations.length-1;t>=0;t--){let s=this.variables[e].locations[t];if("material"===s[0]){let e=s[1],t=i,a={scene:r,shared:this},o=s.slice(2);r.traverseMaterial(i=>{let r=i.root??i;r.uuid===e&&r.onVariableUpdate(o,t,a)});let h=this.materials[e];h&&h.onVariableUpdate(o,t,a)}else{let a=r.find(s[0]);if(void 0===a){this.variables[e].locations.splice(t,1);continue}if("geometry"!==s[1]&&"particles"!==s[1]){for(let e=1;e<s.length-1;e++)a=a[s[e]];"rotation"===s[1]?a[s[s.length-1]]=i*tQ.DEG2RAD:a[s[s.length-1]]=i}if("ParticleEmitter"===(a=r.find(s[0])).type&&a.updateVariableState(i,s),SL.is(a))if("position"===s[1]||"rotation"===s[1]||"scale"===s[1])a.onVariableUpdate();else if("geometry"===s[1]){let e=a;a.component&&(e=a.component);let t=e.dataPatched;e.chooseGeoemtryCache(this).forceDelete(t.geometry),e.createGeometryDelayed(this.entityOpContext),e.onVariableUpdate(!0),e.invalidateDownstreamBooleanData(),e.instances.forEach(e=>{let t=e.dataPatched;e.chooseGeoemtryCache(this).forceDelete(t.geometry),e.createGeometryDelayed(this.entityOpContext),e.onVariableUpdate(!0),e.invalidateDownstreamBooleanData()})}else"morphTargetInfluences"===s[1]&&a.updateMorphInfluences(s[2],i)}}return this.requestRender(),!0}deleteVariable(e){this.variables[e]&&delete this.variables[e]}getVariable(e,t){if(Array.isArray(e)){if("mouse"===e[0])return this.mouseProperty?.[e[1]]??0;if("raycast"===e[0])return this.raycastProperty?.[e[1]]??0;let t=this.entityOpContext.scene.find(e[0]);if("width"===e[1]||"height"===e[1]||"depth"===e[1])return t.geometry.userData.parameters[e[1]];for(let i=1;i<e.length;i++)t=t[e[i]];return"rotation"===e[1]&&(t*=tQ.RAD2DEG),t}for(let e in this.variables){if(void 0===t)break;let i=this.variables[e],r=i.locations?.findIndex(e=>fn.equal(e,t));void 0!==r&&-1!==r&&i.locations.splice(r,1)}if("string"!=typeof e)return e;{let i=e,r=e;do{if(r=i,void 0===this.variables[i])break;let e=this.variables[i].value;t&&void 0!==this.variables[r]&&this.variables[r].locations.push(t),i=e}while("string"==typeof i)return i}}getVariables(){return this.variables}getVariablesNames(){return this.data.variables.map(e=>e.data.name)}getVariableByName(e){for(let t of this.data.variables)if(t.data.name===e)return{variable:t.data,id:t.id}}getDynamicVariablePlayState(e){return this.variables[e]?.dynamicVariablePlayState}setDynamicVariablePlayState(e,t){void 0!==this.variables[e]&&(this.variables[e].dynamicVariablePlayState=t)}getDynamicVariableToggleIsForward(e){return this.variables[e]?.dynamicVariableToggleIsForward}setDynamicVariableToggleIsForward(e,t){void 0!==this.variables[e]&&(this.variables[e].dynamicVariableToggleIsForward=t)}resetLib(e){for(let[t,i]of Object.entries(e.images))this.addImage(t,i.asset);for(let[t,i]of Object.entries(e.audios))this.addAudio(t,i.asset);for(let[t,i]of Object.entries(e.particles))this.addParticle(t,i.asset);for(let[t,i]of Object.entries(e.colors))this.addColor(t,i.asset);for(let[t,i]of Object.entries(e.fonts))this.addFont(t,i.asset);for(let[t,i]of Object.entries(e.materials))this.addMaterial(t,i.asset);for(let[t,i]of Object.entries(e.videos))this.addVideo(t,i.asset);for(let[t,i]of Object.entries(e.variables))this.addVariableHolder(t,i.asset)}updateLibByOp(e,t){"images"===e.path[0]?1===e.path.length&&1===e.type?this.addImage(e.id,e.data.asset):1===e.path.length&&2===e.type&&this.deleteImage(e.id):"videos"===e.path[0]?1===e.path.length&&1===e.type?this.addVideo(e.id,e.data.asset):1===e.path.length&&2===e.type&&this.deleteVideo(e.id):"audios"===e.path[0]?1===e.path.length&&1===e.type?this.addAudio(e.id,e.data.asset):1===e.path.length&&2===e.type&&this.deleteAudio(e.id):"particles"===e.path[0]?1===e.path.length&&1===e.type?this.addParticle(e.id,e.data.asset):1===e.path.length&&2===e.type&&this.deleteParticle(e.id):"c
5427olors"===e.path[0]?1===e.path.length&&1===e.type?this.addColor(e.id,e.data.asset):1===e.path.length&&2===e.type&&this.deleteColor(e.id):"materials"===e.path[0]?1===e.path.length&&1===e.type?this.addMaterial(e.id,e.data.asset):1===e.path.length&&2===e.type&&this.deleteMaterial(e.id):"fonts"===e.path[0]?1===e.path.length&&1===e.type?this.addFont(e.id,e.data.asset):1===e.path.length&&2===e.type&&this.deleteFont(e.id):"variables"===e.path[0]?1===e.path.length&&1===e.type?this.addVariableHolder(e.id,e.data.asset):1===e.path.length&&2===e.type&&this.deleteVariable(e.id):"components"===e.path[0]&&t.updateByLibOp(e,this)}updateByOp(e,t,i){if(this.data=t,"images"===e.path[0])2===e.path.length&&0===e.type?e.props.data&&this.getImage(e.path[1]).updateSrc(e.props.data):1===e.path.length&&1===e.type?this.addImage(e.id,e.data):1===e.path.length&&2===e.type&&this.deleteImage(e.id);else if("videos"===e.path[0])2===e.path.length&&0===e.type?e.props.data&&this.getVideo(e.path[1]).updateSrc(e.props.data):1===e.path.length&&1===e.type?this.addVideo(e.id,e.data):1===e.path.length&&2===e.type&&this.deleteVideo(e.id);else if("audios"===e.path[0])2===e.path.length&&0===e.type?e.props.data&&this.addAudio(e.path[1],t.audios[e.path[1]]):1===e.path.length&&1===e.type?this.addAudio(e.id,e.data):1===e.path.length&&2===e.type&&this.deleteAudio(e.id);else if("particles"===e.path[0])2===e.path.length&&0===e.type?e.props.data&&this.addParticle(e.path[1],t.particles[e.path[1]]):1===e.path.length&&1===e.type?this.addParticle(e.id,e.data):1===e.path.length&&2===e.type&&this.deleteParticle(e.id);else if("colors"===e.path[0])2===e.path.length&&0===e.type?this.updateColor(e.path[1],e.props):1===e.path.length&&1===e.type?this.addColor(e.id,e.data):1===e.path.length&&2===e.type&&this.deleteColor(e.id);else if("materials"===e.path[0])1===e.path.length&&1===e.type?this.addMaterial(e.id,e.data):1===e.path.length&&2===e.type?this.deleteMaterial(e.id):e.path.length>1&&this.getMaterial(e.path[1]).updateByOp(fs.drop(e,2),t.materials[e.path[1]],{shared:this,scene:i});else if("fonts"===e.path[0])2===e.path.length&&0===e.type?this.updateFont(e.path[1],e,i):1===e.path.length&&1===e.type?this.addFont(e.id,e.data):1===e.path.length&&2===e.type&&this.deleteFont(e.id);else if("variables"===e.path[0])2===e.path.length&&0===e.type?"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):1===e.path.length&&4===e.type?this.addVariableHolder(e.id,e.data):1===e.path.length&&5===e.type&&this.deleteVariable(e.id);else if("userAPIs"===e.path[0]){if(1===e.path.length&&1===e.type)this.addUserAPI(e.id,e.data);else if(1===e.path.length&&2===e.type)this.deleteUserAPI(e.id);else if("string"==typeof e.path[1]){let i=t.userAPIs[e.path[1]];if(i){let t=0===e.type&&void 0===e.props.debounce,r=this.getUserAPI(e.path[1]);r instanceof E9?r.update(i):r?.update(i,this,t)}}}else if("userWebhooks"===e.path[0]){if(1===e.path.length&&1===e.type)this.addUserWebhook(e.id,e.data);else if(1===e.path.length&&2===e.type)this.deleteUserWebhook(e.id);else if("string"==typeof e.path[1]){let i=t.userWebhooks[e.path[1]];i&&this.getUserWebhook(e.path[1])?.update(i)}}else"lib"===e.path[0]&&this.updateLibByOp(fs.drop(e,1),i)}updateFont(e,t,i){if(t.props.url){let r=this.getFont(e),s={...this.data.fonts[e],url:t.props.url};r.update(s),r.loadingPromise.then(()=>this.requestRender()),i.updateFont(e,this)}}addUserAPI(e,t){return this.userAPIs[e]?(this.userAPIs[e].update(t,this),!0):this.openAIRealtime?.id===e?(this.openAIRealtime.update(t),!0):(t.integration?.type==="VoiceAssistant"?this.openAIRealtime=new E9(t,e,this):this.userAPIs[e]=new Sv(e,t,this),!1)}getUserAPI(e){return this.openAIRealtime?.id===e?this.openAIRealtime:this.userAPIs[e]}getUserAPIs(){return this.userAPIs}deleteUserAPI(e){let t=this.userAPIs[e];t&&(t.dispose(),delete this.userAPIs[e])}addUserWebhook(e,t){return this.userWebhooks[e]?(this.userWebhooks[e].update(t),!0):(this.userWebhooks[e]=new EJ(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 At(y8.emptyData());var Ai=class extends Cf{updateByPatchedOp(e,t,i){if(super.updateByPatchedOp(e,t,i),null!==function(e,t){let i=[];if(t.length!==e.length)return null;for(var r=0;r<e.length;){if("*"===t[r])i.push(e[r]);else if(e[r]!==t[r])return null;r+=1}return i}(e.path,["materials"])&&0===e.type&&Array.isArray(this.material))for(let[t,r]of Object.entries(e.props)){let e=i.shared.material(r);this.material[Number(t)]=e}else if(p9(e.path,["material"])&&this.material instanceof EA)"material"in t&&"string"!=typeof t.material&&this.material.updateByOp(fs.drop(e,1),t.material,i);else if(p9(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];"string"!=typeof s&&this.material[r].updateByOp(fs.drop(e,2),s,i)}}}get needsAO(){return void 0!==this.material&&(Array.isArray(this.material)?this.material[0]:this.material).hasAO}updateState(e,t){let i;super.updateState(e,t),void 0!==e.castShadow&&(this.castShadow=e.castShadow),void 0!==e.receiveShadow&&(this.receiveShadow=e.receiveShadow);let r=this.dataPatched;"Mesh"===this.dataPatched.type&&this.dataPatched.geometry.shapeBlendNode&&this.layers.set(9),"Mesh"===this.dataPatched.type&&"ShapeBlendGeometry"===this.dataPatched.geometry.type&&(i={resolutionLevel:this.dataPatched.geometry.resolutionLevel,useChildrenColors:this.dataPatched.geometry.useChildrenColors}),e.geometry?.type!=="NonParametricGeometry"&&"material"in e&&void 0!==e.material&&(this.disposeMaterial(),this.material=t.shared.material(e.material).getFlavor(r.flatShading,r.side,r.wireframe,i),t.scene.markNeedsUpdateRendererDirty()),(e.geometry?.type==="NonParametricGeometry"||"materials"in e)&&("materials"in e&&void 0!==e.materials?(this.disposeMaterial(),this.material=e.materials.map(e=>t.shared.material(e).getFlavor(r.flatShading,r.side,r.wireframe)),t.scene.markNeedsUpdateRendererDirty()):"material"in e&&void 0!==e.material&&(this.disposeMaterial(),this.material=[t.shared.material(e.material).getFlavor(r.flatShading,r.side,r.wireframe)],t.scene.markNeedsUpdateRendererDirty()));let s=this.data;if(s.geometry?.type!=="NonParametricGeometry"&&"materials"in s&&void 0!==s.materials&&(this.disposeMaterial(),this.material=t.shared.material(s.materials[0]).getFlavor(r.flatShading,r.side,r.wireframe)),void 0!==e.flatShading||void 0!==e.wireframe||void 0!==e.side)if(Array.isArray(this.material))for(let e=0;e<this.material.length;e++)this.material[e]=this.material[e].getFlavor(r.flatShading,r.side,r.wireframe);else this.material=this.material.getFlavor(r.flatShading,r.side,r.wireframe,i)}
vendor: 10,588 bytes, line 5427
5427disposeMaterial(){this.material&&u9(this.material).forEach(e=>{e instanceof EA&&(e instanceof EO||e.nodeMaterialDispose())})}dispose(){this.disposeMaterial(),super.dispose()}},Ar=new iy,As=new id,Aa=new id,An=new iy,Ao=new iY,Al=class extends Ai{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 iY().fromArray(t.bindMatrix),this.bindMatrixInverse=new iY)}chooseGeoemtryCache(e){return e.geometryCache}markGeometryAsReachable(e){this.geometryCreateDeleyed instanceof rz&&this.chooseGeoemtryCache(e).markAsReachable(this.dataPatched.geometry,this.geometryCreateDeleyed)}get geometry(){if(void 0!==this.localGeometry)return this.localGeometry;if(this.geometryCreateDeleyed instanceof At){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 g8.is2DParametricMesh(e.type)&&0===e.depth}get is2DType(){return g8.is2DParametricMesh(this.geometry.userData.type)}get isNonParametric(){return"NonParametricGeometry"===this.geometry.userData.type}updateByPatchedOp(e,t,i){super.updateByPatchedOp(e,t,i),p9(e.path,["geometry"])&&this.updateByPatchedOpGeometry(fs.drop(e,1),t.geometry,i)}removeInteractionGeometry(e){this.localGeometry?.dispose(),this.localGeometry=void 0}updateGeometryInteractions(e,t){this.invalidateDownstreamBooleanData();let i=this.data.geometry.type;if("NonParametricGeometry"===i||"SubdivGeometry"===i){let i,r,s;if(void 0===this.localGeometry){let i={...this.data.geometry,...e};this.localGeometry=SU(i,t,this.data.flatShading,this)}e.scaleBaked?[i,r,s]=e.scaleBaked:{width:i,height:r,depth:s}=e;let a=this.localGeometry.userData;void 0!==a.sxPrev&&SW(this.localGeometry.attributes,i/a.sxPrev,r/a.syPrev,s/a.szPrev),a.sxPrev=i,a.syPrev=r,a.szPrev=s}else{let i={...this.data.geometry,...e};this.localGeometry?.dispose(),this.localGeometry=SU(i,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){let r=!1;0===e.type&&0===e.path.length&&Object.keys(e.props).includes("scaleBaked")&&this.geometryCreateDeleyed instanceof SK&&this.chooseGeoemtryCache(i.shared).mutateIfUnique(this.geometryCreateDeleyed.data,t)===this.geometryCreateDeleyed&&(r=!0,this.geometryCreateDeleyed.mutateDirectlyScaleBaked(t,e.props.scaleBaked),this.refreshAttachedCloners(i),this.refreshAttachedPaths(i)),r||(i.scene?.markGeometryCacheDirty(),this.createGeometryDelayed(i)),this.resetBBoxNeedsUpdate(),this.invalidateDownstreamBooleanData()}updateGeometryOnStateUpdate(e,t){this.createGeometryDelayed(t)}updateState(e,t){void 0!==e.geometry&&this.updateGeometryOnStateUpdate(e.geometry,t);let i=e.morphTargetInfluences;if(i)for(let{data:{name:e,value:r}}of(this.updateMorphTargets(),this.geometry.morphTargetsRelative=!0,i))this.updateMorphInfluences(e,t.shared.getVariable(r,[this.uuid,"morphTargetInfluences",e]));super.updateState(e,t)}updateMorphInfluences(e,t){if(void 0===this.morphTargetDictionary)return;let i=this.morphTargetDictionary[e];void 0!==i&&(this.morphTargetInfluences[i]=t)}updateGeometryGroupsIfNeeded(){Array.isArray(this.material)&&0===this.geometry.groups.length&&this.geometry.addGroup(0,Math.max(this.geometry.getIndex()?.count??0,this.geometry.getAttribute("position").count),0)}updateEntityBoxSize(e,t){let i=this.geometry.userData.parameters;this.is2DType?e.set(0,0,.5*i.depth):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),"attached"===this.bindMode?this.bindMatrixInverse.copy(this.matrixWorld).invert():"detached"===this.bindMode&&this.bindMatrixInverse.copy(this.bindMatrix).invert()}bind(e,t){this.skeleton=e,this.isSkinnedMesh=!0,void 0===t&&(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 id,i=this.geometry.attributes.skinWeight;for(let e=0,r=i.count;e<r;e++){t.fromBufferAttribute(i,e);let r=1/t.manhattanLength();r!==1/0?t.multiplyScalar(r):t.set(1,0,0,0),i.setXYZW(e,t.x,t.y,t.z,t.w)}}boneTransform(e,t){let i=this.skeleton;if(void 0===i)return;let r=this.geometry;As.fromBufferAttribute(r.attributes.skinIndex,e),Aa.fromBufferAttribute(r.attributes.skinWeight,e),Ar.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let e=0;e<4;e++){let r=Aa.getComponent(e);if(0!==r){let s=As.getComponent(e);Ao.multiplyMatrices(i.bones[s].matrixWorld,i.boneInverses[s]),t.addScaledVector(An.copy(Ar).applyMatrix4(Ao),r)}}return t.applyMatrix4(this.bindMatrixInverse)}};function Ah(e){if(Array.isArray(e.material)){for(let t of e.material)if(0===t.getLayersOfType("outline").length)return}else if(!(e.material instanceof EA)||0===e.material.getLayersOfType("outline").length)return;e instanceof Al&&e.is2DAndNoDepth?function(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 iy;for(let e=0;e<t.length;e+=3)r.set(t[e],t[e+1],t[e+2]).normalize(),i[e]=r.x,i[e+1]=r.y,i[e+2]=r.z;e.geometry.setAttribute("extrudeNormal",new rP(i,3))}(e):function(e){if(e.geometry.attributes.extrudeNormal||!e.geometry.attributes.position||!e.geometry.attributes.normal)return;let t=new Map,i=e.geometry.attributes,r=i.position.array,s=i.normal.array,a=new Float32Array(r.length);for(let e=0;e<r.length;e+=3){let i=`${r[e]}_${r[e+1]}_${r[e+2]}`,a=new iy(s[e],s[e+1],s[e+2]);t.has(i)?t.get(i)?.normals.push(a):t.set(i,{normals:[a],result:new iy})}t.forEach((e,t)=>{for(let t of e.normals)e.result.add(t);e.result.divideScalar(e.normals.length)});for(let e=0;e<r.length;e+=3){let i=`${r[e]}_${r[e+1]}_${r[e+2]}`,s=t.get(i)?.result;s&&(a[e]=s.x,a[e+1]=s.y,a[e+2]=s.z)}e.geometry.setAttribute("extrudeNormal",new rP(a,3))}(e)}function Ac(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=[tQ.seededRandom(r),tQ.seededRandom(r+1e4),tQ.seededRandom(r+2e4)];for(let e=0;e<t.length;e++)i[e]=s[e%3];e.geometry.setAttribute("randomColor",new rE(i,3))}var Ad=new iw,Au=new iy,Ap=class extends Al{constructor(e,t,i){super(e,t,i),this.data=t,this.hiddenMatrixOld=new iY,this.smoothShading=!0,this.skipReactionUpdate=!1}chooseGeoemtryCache(e){return this.dataPatched.flatShading?e.geometryCache:e.geometryCache2}get subdivPointerNew(){return void 0!==this.localGeometry?this.subdivPointer:this.geometry.ensureSubdivPointer()}get originalGeometryNew(){return void 0!==this.localGeometry?this.originalGeometry:this.geometry.originalGeometry}get phongAngle(){return this.data.geometry.phongAngle??45}updateEntityBoxSize(e,t){let i=this.geometry.userData.parameters;e.copy(this.originalGeometryNew.boundingSphere.center),t.set(i.width,i.height,i.depth??0).multiplyScalar(.5)}createGeometryByControls(e){if(!0===this.skipReactionUpdate)return;let t=this.localGeometry?.uuid,{originalGeometry:i,subdividedGeometry:r,subdivPointer:s}=SK.build(e,this.subdivPointer,this.smoothShading,this.hasNonUniformScale?this.shearScale:void 0);this.subdivPointer=s,void 0!==i&&(this.originalGeometry?.dispose(),this.originalGeometry=i),void 0!==r&&(this.subdividedGeometry?.dispose(),this.subdividedGeometry=r??void 0),this.localGeometry=this.subdividedGeometry??this.originalGeometry,Ah(this),Ac(this),this.calcBoundingBox(),t&&(this.localGeometry.uuid=t)}updateState(e,t){if(super.updateState(e,t),void 0!==e.flatShading){let i=this.material;this.material=Array.isArray(i)?i.map(e=>e.getFlavor(!1,e.side,e.wireframe)):i.getFlavor(!1,i.side,i.wireframe),this.smoothShading=!e.flatShading,this.createGeometryDelayed(t)}}updateMesh(e=!1){SK.buildLevel(this.subdivPointer,!0,this.smoothShading?this.phongAngle:-1,this.originalGeometry,e&&this.hasNonUniformScale?this.shearScaleInv:void 0),this.subdividedGeometry&&SK.buildLevel(this.subdivPointer,!1,this.smoothShading?this.phongAngle:-1,this.subdividedGeometry,e&&this.hasNonUniformScale?this.shearScaleInv:void 0)}updateTopology(){this.originalGeometry.dispose(),this.originalGeometry=SK.buildLevel(this.subdivPointer,!0,this.smoothShading?this.phongAngle:-1),this.subdividedGeometry&&(this.subdividedGeometry.dispose(),this.subdividedGeometry=SK.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,Cf.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;null===e.boundingSphere&&(e.boundingSphere=new iF,this.subdividedGeometry&&(this.subdividedGeometry.boundingSphere=e.boundingSphere));let t=e.attributes.position,i=e.boundingSphere.center;Ad.setFromBufferAttribute(t),Ad.getCenter(i),e.boundingSphere.radius=i.distanceTo(Ad.max),isNaN(e.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),Ad.getSize(Au),this.hasNonUniformScale&&Au.divide(this.scale);let r={width:Au.x,height:Au.y,depth:Au.z};return this.geometry.userData.parameters=r,r}updateBoundingSphere(e){let t=this.originalGeometry;Ad.min.set(e[0],e[2],e[4]),Ad.max.set(e[1],e[3],e[5]),this.hasNonUniformScale&&(Ad.min.applyMatrix4(this.shearScaleInv),Ad.max.applyMatrix4(this.shearScaleInv)),null===t.boundingSphere&&(t.boun
5427dingSphere=new iF);let i=t.boundingSphere.center;Ad.getCenter(i),t.boundingSphere.radius=i.distanceTo(Ad.max)}freeSubdivPointer(){this.subdivPointer&&(SK.freeSubdivPointer(this.subdivPointer),this.subdivPointer=0),this.localGeometry=void 0,this.originalGeometry?.dispose(),this.subdividedGeometry?.dispose()}dispose(){super.dispose(),this.freeSubdivPointer()}updateByPatchedOpGeometry(e,t,i){super.updateByPatchedOpGeometry(e,t,i),this.localGeometry&&this.createGeometryByControls(t)}},Af={x:[1,0,0],"-x":[-1,0,0],y:[0,1,0],"-y":[0,-1,0],z:[0,0,1],"-z":[0,0,-1]},Am={polygon_center:0,edge:1,vertex:2},Ag=(e,t)=>(i,r)=>t&&0!==i&&0!==e?e*r/100:0,Av=(e,t)=>{let i=Math.abs(t),r=-1*i;return(e- -1)*(i-r)/2+r},Ay=new iy,Ax=new iy,Ab=new iy,Aw=new iy;function A_(e,t){let i=Ab.fromArray(e),r=Aw.fromArray(t);Ax.copy(r).sub(i);let s=Ax.length();return Ax.normalize().multiplyScalar(.5*s),Ay.copy(i).add(Ax).toArray()}var AS=new rb,AC=new iy,AM=new iy,AE=new iy,AA=e=>.5*(1-Math.cos(e*Math.PI)),AT=class{constructor(){this.perlin=Array(4096)}noise(e,t=0,i=0){if(null==this.perlin){this.perlin=Array(4096);for(let e=0;e<4096;e++)this.perlin[e]=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),o=e-r,h=t-s,c=i-a,d,u,p=0,f=.5,m,g,v;for(let e=0;e<4;e++){let e=r+(s<<4)+(a<<8);d=AA(o),u=AA(h),m=this.perlin[4095&e],m+=d*(this.perlin[e+1&4095]-m),g=this.perlin[e+16&4095],g+=d*(this.perlin[e+16+1&4095]-g),m+=u*(g-m),e+=256,g=this.perlin[4095&e],g+=d*(this.perlin[e+1&4095]-g),v=this.perlin[e+16&4095],v+=d*(this.perlin[e+16+1&4095]-v),g+=u*(v-g),m+=AA(c)*(g-m),p+=m*f,f*=.5,r<<=1,s<<=1,h*=2,a<<=1,c*=2,(o*=2)>=1&&(r++,o--),h>=1&&(s++,h--),c>=1&&(a++,c--)}return p}noiseSeed(e){let t,i,r={setSeed(e){i=t=(e??0x100000000*Math.random())>>>0},getSeed:()=>t,rand:()=>(i=(1664525*i+0x3c6ef35f)%0x100000000)/0x100000000};r.setSeed(e),this.perlin=Array(4096);for(let e=0;e<4096;e++)this.perlin[e]=r.rand()}},AP=new iy,AD=new iY,AO=new iX;function AL(e){let t=!1;return e.scene.objects.traverse((e,i)=>{"Mesh"===i.type&&("TextGeometry"===i.geometry.type||"InputGeometry"===i.geometry.type)&&(t=!0)}),t}var AI,AR,Ak,AB,Az,AN=class extends Al{constructor(e,t,i){super(e,t,i),this.data=t}get textGeometry(){return this.geometry}get charWidths(){return this.textGeometry.charWidths}get charCoords(){return this.textGeometry.charCoords}get wrappedText(){return this.textGeometry.wrappedText}get font(){return this.textGeometry.font}get initialOffsetY(){let e=this.dataPatched;return this.font?.getLineInitialOffsetY(this.lineHeight,this.wrappedText.length,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(){return(this.font?.ascender??1)*this.fontScale}get descender(){return(this.font?.descender??1)*this.fontScale}get lineHeight(){let e=this.dataPatched;return e.geometry.fontSize*e.geometry.lineHeight}raycast(e,t){let{matrixWorld:i}=this;if(!(isNaN(e.ray.origin.x)||0===this.scale.x||0===this.scale.y||0===this.scale.z)&&(AD.copy(i).invert(),AO.copy(e.ray).applyMatrix4(AD),AO.intersectBox(this.singleBBox,AP))){let r=AP.applyMatrix4(i),s=e.ray.origin.distanceTo(r);t.push({distance:s,point:r.clone(),object:this})}}},AF=new iy,Aj=new iy;SN.then(e=>{Ak=[(AR=e).get_face_center,AR.get_edge_midpoint,AR.get_vertex_position],AB=[AR.get_face_normal,AR.get_edge_normal,AR.get_vertex_normal],Az=[AR.face_count,AR.edge_count,AR.vertex_count]});var AU=new iY,AV=new iY,AW=new iy,AH=new iy,AG=new iy,Aq=new iy,AX=new iy,AY=new iy,AQ=class{constructor(e,t){this.data=e,this.is3D=t,this.perlin=new AT,"perlin"===e.noiseType?(this.perlin.noiseSeed(e.seed),t?this.noise=(e,t,i)=>this.perlin.noise(e,t,i):this.noise=e=>this.perlin.noise(e)):t?this.noise=function(e=Math.random){let t=b3(e),i=new Float64Array(t).map(e=>b2[e%12*3]),r=new Float64Array(t).map(e=>b2[e%12*3+1]),s=new Float64Array(t).map(e=>b2[e%12*3+2]);return function(e,a,o){let h,c,d,u,p=(e+a+o)*bJ,f=b0(e+p),m=b0(a+p),g=b0(o+p),v=(f+m+g)*b$,y=e-(f-v),x=a-(m-v),b=o-(g-v),w,_,S,C,M,E;y>=x?x>=b?(w=1,_=0,S=0,C=1,M=1,E=0):(y>=b?(w=1,_=0,S=0):(w=0,_=0,S=1),C=1,M=0,E=1):x<b?(w=0,_=0,S=1,C=0,M=1,E=1):y<b?(w=0,_=1,S=0,C=0,M=1,E=1):(w=0,_=1,S=0,C=1,M=1,E=0);let A=y-w+b$,T=x-_+b$,P=b-S+b$,D=y-C+2*b$,O=x-M+2*b$,L=b-E+2*b$,I=y-1+3*b$,R=x-1+3*b$,k=b-1+3*b$,B=255&f,z=255&m,N=255&g,F=.6-y*y-x*x-b*b;if(F<0)h=0;else{let e=B+t[z+t[N]];F*=F,h=F*F*(i[e]*y+r[e]*x+s[e]*b)}let j=.6-A*A-T*T-P*P;if(j<0)c=0;else{let e=B+w+t[z+_+t[N+S]];j*=j,c=j*j*(i[e]*A+r[e]*T+s[e]*P)}let U=.6-D*D-O*O-L*L;if(U<0)d=0;else{let e=B+C+t[z+M+t[N+E]];U*=U,d=U*U*(i[e]*D+r[e]*O+s[e]*L)}let V=.6-I*I-R*R-k*k;if(V<0)u=0;else{let e=B+1+t[z+1+t[N+1]];V*=V,u=V*V*(i[e]*I+r[e]*R+s[e]*k)}return 32*(h+c+d+u)}}((0,bQ.default)(e.seed)):this.noise=function(e=Math.random){let t=b3(e),i=new Float64Array(t).map(e=>b1[e%12*2]),r=new Float64Array(t).map(e=>b1[e%12*2+1]);return function(e,s){let a=0,o=0,h=0,c=(e+s)*bZ,d=b0(e+c),u=b0(s+c),p=(d+u)*bK,f=e-(d-p),m=s-(u-p),g,v;f>m?(g=1,v=0):(g=0,v=1);let y=f-g+bK,x=m-v+bK,b=f-1+2*bK,w=m-1+2*bK,_=255&d,S=255&u,C=.5-f*f-m*m;if(C>=0){let e=_+t[S],s=i[e],o=r[e];C*=C,a=C*C*(s*f+o*m)}let M=.5-y*y-x*x;if(M>=0){let e=_+g+t[S+v],s=i[e],a=r[e];M*=M,o=M*M*(s*y+a*x)}let E=.5-b*b-w*w;if(E>=0){let e=_+1+t[S+1],s=i[e],a=r[e];E*=E,h=E*E*(s*b+a*w)}return 70*(a+o+h)}}((0,bQ.default)(e.seed))}},AZ=class extends wt(rh){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(null===this.parent)this.updateState(this.parameters,e);else for(let e of this.children)e instanceof wr&&e.expand()}invalidateTransform(e){this.matrixWorldNeedsUpdate=!0,this.traverse(t=>{t instanceof wr&&t.object===e&&(t.matrixWorldNeedsUpdate=!0)})}onObjUpdateMatrix(){"toObject"!==this.parameters.type&&(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(t=void 0!==e?e:"grid"===this.parameters.type?Math.round(this.parameters.grid.count[0])*Math.round(this.parameters.grid.count[1])*Math.round(this.parameters.grid.count[2]):this.parameters.count,"toObject"===this.parameters.type)if(this.parameters.toObject.object){if(void 0===e&&"random"!==this.parameters.toObject.
5427spreadType)return}else t=0;if("toObject"===this.parameters.type&&this.objectForSample){let e=this.children;if(e.length===t)return;if(e.length<t)for(let i=0,r=t-e.length;i<r;++i){let e=new wr(this.object);e.expand(),this.add(e)}else for(let i=0,r=e.length-t;i<r;++i)this.remove(e[i])}else{if(this.children.length===t)return;if(this.children.length<t)for(let e=0,i=t-this.children.length;e<i;++e){let e=new wr(this.object);e.expand(),this.add(e)}else for(let e=0,i=this.children.length-t;e<i;++e)this.remove(this.children[e])}}getRandom(e,t=!1){return(null===this.random||this.random.data.seed!==e.seed||this.random.is3D!==t)&&(this.random=new AQ(e,t)),this.random}_updateRadial(e){let t=e.radial,i=t.start*tQ.DEG2RAD,r=i-t.end*tQ.DEG2RAD,s=new i4(t.rotation[0],t.rotation[1],t.rotation[2]),a;switch(t.axis){case"z":a=new iy(0,0,1);break;case"y":a=new iy(0,1,0);break;default:a=new iy(1,0,0)}let o=e.randomnessObject??gD.defaultData([1,1,1]).randomnessObject,h=this.getRandom(o),c=Ag(o.strength,this.parameters.randomness);for(let[d,u]of this.children.entries()){let p=d*(o.freqScale/10)+o.movement,f=h.noise(p,p,p),m=d+1;u.scale.x=t.scale[0]+c(m,Av(f,o.scale[0]))||1e-4,u.scale.y=t.scale[1]+c(m,Av(f,o.scale[1]))||1e-4,u.scale.z=t.scale[2]+c(m,Av(f,o.scale[2]))||1e-4,u.position.setScalar(0);let g=r/e.count*d-i;switch(t.axis){case"x":u.rotation.set(0,g,0);break;case"y":u.rotation.set(0,0,g);break;case"z":u.rotation.set(g,0,0)}u.translateOnAxis(a,t.radius),u.position.x+=t.position[0]+c(m,Av(f,o.position[0])),u.position.y+=t.position[1]+c(m,Av(f,o.position[1])),u.position.z+=t.position[2]+c(m,Av(f,o.position[2]));let v=c(m,Av(f,o.rotation[0])),y=c(m,Av(f,o.rotation[1])),x=c(m,Av(f,o.rotation[2]));!0===t.alignment?(u.rotation.x+=s.x+v,u.rotation.y+=s.y+y,u.rotation.z+=s.z+x):u.rotation.set(s.x+v,s.y+y,s.z+x)}}_updateLinear(e){if("linear"!==e.type)throw Error();let t=e.linear,i=new i4(t.rotation[0],t.rotation[1],t.rotation[2]),r=e.randomnessObject??gD.defaultData([1,1,1]).randomnessObject,s=this.getRandom(r),a=Ag(r.strength,this.parameters.randomness);for(let[e,o]of this.children.entries()){let h=e*(r.freqScale/10)+r.movement,c=s.noise(h,h,h),d=e+1,u=a(d,Av(c,r.rotation[0])),p=a(d,Av(c,r.rotation[1])),f=a(d,Av(c,r.rotation[2]));o.scale.x=1+(t.scale[0]-1)*e+a(d,Av(c,r.scale[0]))||1e-4,o.scale.y=1+(t.scale[1]-1)*e+a(d,Av(c,r.scale[1]))||1e-4,o.scale.z=1+(t.scale[2]-1)*e+a(d,Av(c,r.scale[2]))||1e-4,o.rotation.x=i.x*e+u,o.rotation.y=i.y*e+p,o.rotation.z=i.z*e+f,o.position.x=t.position[0]*e+a(d,Av(c,r.position[0])),o.position.y=t.position[1]*e+a(d,Av(c,r.position[1])),o.position.z=t.position[2]*e+a(d,Av(c,r.position[2]))}}_updateGrid(e){let t=0,i=e.grid,r=e.randomnessObject??gD.defaultData([1,1,1]).randomnessObject,s=this.getRandom(r,!0),a=Ag(r.strength,this.parameters.randomness);if(!0===i.useCenter){let e={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 iy(i.size[0]*(i.count[0]-e.x)*.5,i.size[1]*(i.count[1]-e.y)*.5,i.size[2]*(i.count[2]-e.z)*.5);for(let e=0;e<i.count[0];e++)for(let h=0;h<i.count[1];h++)for(let c=0;c<i.count[2];c++){let d=s.noise((e+1)*(r.freqScale/10)+r.movement,(h+1)*(r.freqScale/10)+r.movement,(c+1)*(r.freqScale/10)+r.movement),u=this.children[t++];
5427u.scale.x=1+a(t,Av(d,r.scale[0]))||1e-4,u.scale.y=1+a(t,Av(d,r.scale[1]))||1e-4,u.scale.z=1+a(t,Av(d,r.scale[2]))||1e-4;let p=a(t,Av(d,r.rotation[0])),f=a(t,Av(d,r.rotation[1])),m=a(t,Av(d,r.rotation[2]));u.rotation.set(p,f,m),u.position.x=i.size[0]*e-o.x+a(t,Av(d,r.position[0])),u.position.y=i.size[1]*h-o.y+a(t,Av(d,r.position[1])),u.position.z=i.size[2]*c-o.z+a(t,Av(d,r.position[2]))}}else for(let e=0;e<i.count[0];e++)for(let o=0;o<i.count[1];o++)for(let h=0;h<i.count[2];h++){let c=s.noise((e+1)*(r.freqScale/10)+r.movement,(o+1)*(r.freqScale/10)+r.movement,(h+1)*(r.freqScale/10)+r.movement),d=this.children[t++];d.scale.x=1+a(t,Av(c,r.scale[0]))||1e-4,d.scale.y=1+a(t,Av(c,r.scale[1]))||1e-4,d.scale.z=1+a(t,Av(c,r.scale[2]))||1e-4;let u=a(t,Av(c,r.rotation[0])),p=a(t,Av(c,r.rotation[1])),f=a(t,Av(c,r.rotation[2]));d.rotation.set(u,p,f),d.position.x=i.size[0]*e+a(t,Av(c,r.position[0])),d.position.y=-i.size[1]*o+a(t,Av(c,r.position[1])),d.position.z=-i.size[2]*h+a(t,Av(c,r.position[2]))}}_updateToObject(e){if("toObject"!==e.type)throw Error();let{toObject:t}=e,i=new i4(t.rotation[0],t.rotation[1],t.rotation[2]),r=e.randomnessObject??gD.defaultData([1,1,1]).randomnessObject,s=this.getRandom(r),a=Ag(r.strength,this.parameters.randomness);if(!t.object){for(let[,e]of this.children.entries())e.position.set(0,0,0),e.scale.setScalar(1),e.rotation.set(0,0,0);this.objectForSample=void 0;return}if(!this.objectForSample)return;if(this.objectForSample instanceof AN)if(this.objectForSample.font?.isLoaded&&void 0!==this.objectForSample.geometry.attributes.position)this._pendingMediaLoad=!1;else{this._pendingMediaLoad=!0;return}if(void 0===this.objectForSample.geometry&&this.objectForSample.isAncestorOf(this.object.uuid))return void 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.`);let o=this.getSubdivData();if(o.length>0){let e=Math.round(o.length*t.count/100);this._updateCount(e)}else{let e=this.objectForSample.geometry.getAttribute("position");if(!e||isNaN(e.count)||0===e.count)return void 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.`)}this.objectForSample.updateMatrixWorld();let h=new b6(this.objectForSample).build(),c=Af[t.axis],d=this.children;for(let[e,u]of(h.setRandomGenerator((0,bQ.default)(this.object.uuid+t.seed)),d.entries())){let d=e*(r.freqScale/10)+r.movement,p=s.noise(d,d,d),f=e+1,m=a(f,Av(p,r.rotation[0])),g=a(f,Av(p,r.rotation[1])),v=a(f,Av(p,r.rotation[2]));"random"===t.spreadType?h.sample(AG,Aq):(o.length&&(AG.fromArray(o[e].pos),Aq.fromArray(o[e].norm)),this.objectForSample instanceof Ap&&AG.applyMatrix4(AU.copy(this.objectForSample.matrixWorld).invert())),AG.applyMatrix4(this.object.hiddenMatrix.clone().invert()),u.position.copy(AG),AW.fromArray(c);let y="normal"===t.align?Aq:this.object.getWorldDirection(AY),x=AH.fromArray(t.position);AH.x+=a(f,Av(p,r.position[0])),AH.y+=a(f,Av(p,r.position[1])),AH.z+=a(f,Av(p,r.position[2]));let b=Math.acos(y.dot(AW)),w=AX.crossVectors(AW,y).normalize(),_=AV.makeRotationAxis(w,b),S=y.clone().cross(this.object.up).normalize(),C=S.clone().cross(y).normalize(),M=new iY().makeBasis(S,y,C),E=new iy(AW.y,AW.z,AW.x).normalize(),A=E.clone().cross(AW).normalize(),T=new iY().makeBasis(E,AW,A).invert(),P=new iY().multiplyMatrices(M,T);u.rotation.setFromRotationMatrix(P),x.applyMatrix4(_),u.position.add(x),u.rotation.x=u.rotation.x+i.x+m,u.rotation.y=u.rotation.y+i.y+g,u.rotation.z=u.rotation.z+i.z+v,u.scale.setScalar(1),u.scale.x=u.scale.x+t.scale[0]+a(f,Av(p,r.scale[0]))||1e-4,u.scale.y=u.scale.y+t.scale[1]+a(f,Av(p,r.scale[1]))||1e-4,u.scale.z=u.scale.z+t.scale[2]+a(f,Av(p,r.scale[2]))||1e-4,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=(e,i)=>{let r=Math.round(1e4*e[0])+"_"+Math.round(1e4*e[1])+"_"+Math.round(1e4*e[2]),s=t.get(r);s?(s.pos[0]+=e[0],s.pos[1]+=e[1],s.pos[2]+=e[2],s.norm[0]+=i[0],s.norm[1]+=i[1],s.norm[2]+=i[2],s.c
5427ount+=1):t.set(r,{pos:[...e],norm:[...i],count:1})};if("random"===e)return[];if(this.objectForSample instanceof Ap){let t=this.objectForSample,r=Am[e],s=Az[r],a=Ak[r],o=AB[r],h=s(t.subdivPointerNew);for(let e=0;e<=h-1;e++){let r=a(t.subdivPointerNew,e),s=o(t.subdivPointerNew,e);AF.fromArray(r).applyMatrix4(t.matrixWorld),Aj.fromArray(s),i(AF.toArray(),Aj.toArray())}}else(this.objectForSample.geometry.index?function(e){let t=[];for(let i=0;i<=e.index.count;i++)if(AC.fromArray(e.index.array,3*i),AS.setFromAttributeAndIndices(e.attributes.position,AC.x,AC.y,AC.z),AS.getNormal(AM),AS.getMidpoint(AE),!(isNaN(AE.x)||isNaN(AE.y)||isNaN(AE.z))){let{a:e,b:i,c:r}=AS,s=e.toArray(),a=i.toArray(),o=r.toArray(),h=e.distanceTo(i),c=i.distanceTo(r),d=r.distanceTo(e),u=A_(s,a),p=A_(a,o),f=A_(o,s),m=[h,c,d],g=Math.max(...m),v=m.filter(e=>Math.round(e)===Math.round(g)).length>1,y=[],x=AS.getMidpoint(AE).toArray();g!==h||v||(y=[p,f,f],x=u),g!==c||v||(y=[u,f,f],x=p),g!==d||v||(y=[u,p,p],x=f),v&&(y=[u,p,f]),t.push({vertices:[s,a,o],faceCenters:y,midpoint:x,norm:AS.getNormal(AM).toArray()})}return t}(this.objectForSample.geometry):function(e){let t=[],{position:i}=e.attributes;for(let e=0;e<i.count;e++){AS.setFromAttributeAndIndices(i,3*e,3*e+1,3*e+2),AS.getNormal(AM),AS.getMidpoint(AE);let r=AS.a.toArray(),s=AS.b.toArray(),a=AS.c.toArray();t.push({vertices:[r,s,a],faceCenters:[A_(r,s),A_(s,a),A_(a,r)],midpoint:AE.toArray(),norm:AM.toArray()})}return t}(this.objectForSample.geometry)).forEach((t,r)=>{"polygon_center"===e&&i(t.midpoint,t.norm),"vertex"===e&&(i(t.vertices[0],t.norm),i(t.vertices[1],t.norm),i(t.vertices[2],t.norm)),"edge"===e&&(i(t.faceCenters[0],t.norm),i(t.faceCenters[1],t.norm),i(t.faceCenters[2],t.norm))});let r=Array.from(t.values());for(let e of r)e.pos[0]/=e.count,e.pos[1]/=e.count,e.pos[2]/=e.count,e.norm[0]/=e.count,e.norm[1]/=e.count,e.norm[2]/=e.count;return r}updateState(e,t){if(this.parameters=uy(e),"toObject"!==this.parameters.type)(null===this.parent||this.parent!==this.object)&&(this.removeFromParent(),this.object.parent?.add(this),this.matrix=this.object.matrix,this.hiddenMatrix=this.object.hiddenMatrix,this.matrixWorldNeedsUpdate=!0,this.matrixAutoUpdate=!1);else if(null===this.parent||this.parent.uuid!==this.parameters.toObject.object){this.removeFromParent();let e=t.find(this.parameters.toObject.object);e instanceof Cf?this.objectForSample=e:this.objectForSample=void 0,this.matrix=new iY,this.hiddenMatrix=new iY,this.matrixWorldNeedsUpdate=!0,this.matrixAutoUpdate=!1,e&&e.add(this)}this.update()}get pendingMediaLoad(){return this._pendingMediaLoad}},AK=e=>{var t;return(t=class extends e{}).geometryHelper=new r$(30,30,30),t},AJ=new iX,A$=new iF,A0=new iY,A1=(e,t,i,r,s=!1,a=e)=>{let o=a.matrixWorld;if(null===t.boundingSphere&&t.computeBoundingSphere(),A$.copy(t.boundingSphere),A$.applyMatrix4(o),!1===i.ray.intersectsSphere(A$)||(A0.copy(o).invert(),AJ.copy(i.ray).applyMatrix4(A0),null!==t.boundingBox&&!1===AJ.intersectsBox(t.boundingBox)))return;let h,c,d=t.index,u=t.attributes.position,p=t.drawRange,f;if(!1===s){let t=Math.max(0,p.start),s=Math.min(d.count,p.start+p.count);for(f=t;f<s;f+=3)if(c=d.getX(f),h=function(e,t,i,r,s,a,o){let h=new iy,c=new iy,d=new iy,u=new iy,p=new iy;if(h.fromBufferAttribute(r,s),c.fromBufferAttribute(r,a),d.fromBufferAttribute(r,o),null===i.intersectTriangle(h,c,d,!1,u))return null;p.copy(u),p.applyMatrix4(e.matrixWorld);let f=t.ray.origin.distanceTo(p);return f<t.near||f>t.far?null:{faceIndex:1,distance:f,point:p.clone(),object:e}}(e,i,AJ,u,c,d.getX(f+1),d.getX(f+2))){h.faceIndex=Math.floor(f/3),r.push(h);return}}else{let s=t.attributes.position,o=new iy,h=new iy,c=new iy,d=new iy,u=1/((a.scale.x+a.scale.y+a.scale.z)/3),f=u*u,m=Math.max(0,p.start),g=Math.min(s.count,p.start+p.count);for(let t=m,u=g-1;t<u;t+=2){if(o.fromBufferAttribute(s,t),h.fromBufferAttribute(s,t+1),AJ.distanceSqToSegment(o,h,d,c)>f)continue;d.applyMatrix4(a.matrixWorld);let u=i.ray.origin.distanceTo(d);u<i.near||u>i.far||r.push({distance:u,point:c.clone().applyMatrix4(a.matrixWorld),object:e})}}},A2=new iy,A3=new r6,A4=class extends nG{constructor(e){let t=new rz,i=new nB({color:0xffffff,vertexColors:!0,toneMapped:!1}),r=[],s=[],a={},o=new ir(0xefbc22),h=new ir(0xefbc22),c=new ir(2857471);function d(e,t,i){u(e,i),u(t,i)}function u(e,t){r.push(0,0,0),s.push(t.r,t.g,t.b),void 0===a[e]&&(a[e]=[]),a[e].push(r.length/3-1)}d("n1","n2",o),d("n2","n4",o),d("n4","n3",o),d("n3","n1",o),d("f1","f2",o),d("f2","f4",o),d("f4","f3",o),d("f3","f1",o),d("n1","f1",o),d("n2","f2",o),d("n3","f3",o),d("n4","f4",o),d("p","n1",h),d("p","n2",h),d("p","n3",h),d("p","n4",h),d("u1","u2",c),d("u2","u3",c),d("u3","u1",c),t.setAttribute("position",new rP(r,3)),t.setAttribute("color",new rP(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;A3.projectionMatrixInverse.elements=[.5112609807824982,-0,-0,-0,-0,.41421356237309503,-0,-0,-0,-0,-0,-.099999,-0,-0,-1.0000000000000002,.100001],A5("n1",t,e,A3,-1,-1,.8),A5("n2",t,e,A3,1,-1,.8),A5("n3",t,e,A3,-1,1,.8),A5("n4",t,e,A3,1,1,.8),A5("f1",t,e,A3,-1,-1,.8),A5("f2",t,e,A3,1,-1,.8),A5("f3",t,e,A3,-1,1,.8),A5("f4",t,e,A3,1,1,.8),A5("u1",t,e,A3,.35,1.1,.8),A5("u2",t,e,A3,-.35,1.1,.8),A5("u3",t,e,A3,0,1.55,.8),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}};function A5(e,t,i,r,s,a,o){A2.set(s,a,o).unproject(r);let h=t[e];if(void 0!==h){let e=i.getAttribute("position");for(let t=0,i=h.length;t<i;t++)e.setXYZ(h[t],A2.x,A2.y,A2.z)}}var A6=class extends AK(A4){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){A1(this.object,this.geometry,e,t,!0)}};(DM||(DM={})).is=e=>"objectHelper"in e;var A8=(e,t)=>
vendor: 4,582 bytes, line 5427
5427class extends w_(e){constructor(){super(...arguments),this.objectHelper=new t(this),this.gizmos={}}get geometryHelper(){return t.geometryHelper}raycast(e,t){this.objectHelper.raycast(e,t)}showGizmos(){for(let e in this.gizmos){let t=this.gizmos[e];t instanceof lK&&(t.visible=!0)}}updateEntityBoxSize(e,t){this.objectHelper.visible&&this.geometryHelper instanceof r$?(e.setScalar(0),t.set(this.geometryHelper.parameters.width,this.geometryHelper.parameters.height,this.geometryHelper.parameters.height).multiplyScalar(.5)):super.updateEntityBoxSize(e,t)}hideGizmos(){for(let e in this.gizmos){let t=this.gizmos[e];t instanceof lK&&(t.visible=!1)}}},A9=new iy,A7=new iy,Te=new iv,Tt=new iy,Ti=new iy,Tr=new iy,Ts=class extends A8(r6,A6){constructor(e="",t={...yF.defaultData,name:""}){super(),this._cameraType="OrthographicCamera",this.targetOffset=gP.DefaultTargetOffset,this.isUpVectorFlipped=!1,this.angleOffsetFromUp=0,this.wasMovedByUser=!1,this.wasMovedBySwitchCameraAction=!1,this.super_Entity(e,t),this.previousProjectionMatrix=new iY,this.matrixAutoUpdate=!0,this.width=window.innerWidth,this.height=window.innerHeight;let i=this.width,r=this.height;this.orthoCamera=new sw(-.5*i,.5*i,.5*r,-.5*r,-5e4,1e4),this.perspCamera=new r8(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"PerspectiveCamera"===this.cameraType}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){"PerspectiveCamera"===e?this.perspCamera.near=t:this.orthoCamera.near=t}setZoom(e,t){t>=0&&("PerspectiveCamera"===e?this.perspCamera.zoom=t:this.orthoCamera.zoom=t)}set cameraType(e){"PerspectiveCamera"===e?this.toPerspective():"OrthographicCamera"===e&&this.toOrthographic()}get near(){return"PerspectiveCamera"===this._cameraType?this.perspCamera.near:this.orthoCamera.near}set near(e){"PerspectiveCamera"===this._cameraType?this.perspCamera.near=e:this.orthoCamera.near=e}get zoom(){return"PerspectiveCamera"===this._cameraType?this.perspCamera.zoom:this.orthoCamera.zoom}set zoom(e){e>=0&&("PerspectiveCamera"===this._cameraType?this.perspCamera.zoom=e:this.orthoCamera.zoom=e)}lookAt(e,t,i){"number"==typeof e&&(e=new iy(e,t,i)),super.lookAt(e),this.getWorldPosition(A9),this.targetOffset=A9.distanceTo(e)}getTarget(e=new iy){return this.getWorldDirection(A7),this.getWorldPosition(A9),A7.multiplyScalar(this.targetOffset),e.copy(A9).add(A7),e}getDistanceToTarget(){let e=this.getTarget();return this.getWorldPosition(A9),A9.distanceTo(e)}updateUp(){this.getWorldQuaternion(Te),Tt.set(0,0,1).applyQuaternion(Te),Ti.copy(rh.DEFAULT_UP),this.isUpVectorFlipped&&Ti.negate(),Ti.applyQuaternion(Te),Tr.copy(rh.DEFAULT_UP).projectOnPlane(Tt),this.angleOffsetFromUp=Tr.angleTo(Ti),this.angleOffsetFromUp*=Tr.cross(Ti).dot(Tt)>=0?1:-1}updateTransformState(e,t){let i=super.updateTransformState(e,t);return void 0!==e.isUpVectorFlipped&&(this.isUpVectorFlipped=e.isUpVectorFlipped),this.updateUp(),i}getViewFrontToObject(e){let t=e.getWorldPosition(new iy),i=e.getWorldDirection(new iy).multiplyScalar(this.targetOffset);return{position:t.clone().add(i),target:t}}getViewToTarget(e){let t=this.getWorldDirection(new iy).multiplyScalar(this.targetOffset);return{position:e.clone().sub(t),target:e}}getViewToObject(e){let t=new iy;return e.getWorldPosition(t),this.getViewToTarget(t)}setViewplaneSize(e,t,i=!1){if(this.aspect=e/t,i){let i=e>t?this.aspect:1,r=e>t?1:this.aspect;this.left=-395*i,this.right=395*i,this.top=1/r*395,this.bottom=-(1/r*395)}else this.left=-(.5*e),this.right=.5*e,this.top=.5*t,this.bottom=-(.5*t);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="Orthogra
5427phicCamera",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){"PerspectiveCamera"===this._cameraType?this.perspCamera.setViewOffset(e,t,i,r,s,a):this.orthoCamera.setViewOffset(e,t,i,r,s,a)}clearViewOffset(){"PerspectiveCamera"===this._cameraType?(this.perspCamera.clearViewOffset(),this.toPerspective()):(this.orthoCamera.clearViewOffset(),this.toOrthographic())}copyHistory(){this.previousProjectionMatrix&&this.previousProjectionMatrix.copy(this.projectionMatrix)}updateProjectionMatrix(){"PerspectiveCamera"===this._cameraType?this.toPerspective():"OrthographicCamera"===this._cameraType&&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=null===e.view?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=[]){return uq({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},e)}updateCameraSubtype(e,t){let i="perspective"===e?"PerspectiveCamera":"OrthographicCamera";void 0!==t.zoom&&this.setZoom(i,t.zoom),void 0!==t.near&&this.setNear(i,t.near),void 0!==t.fov&&"PerspectiveCamera"===i&&(this.fov=t.fov)}updateState(e,t){this.updateCameraState(e,t)}updateCameraState(e,t){this.updateState_Entity(e,t),void 0!==e.far&&(this.far=e.far),void 0!==e.orthographic&&this.updateCameraSubtype("orthographic",e.orthographic),void 0!==e.perspective&&this.updateCameraSubtype("perspective",e.perspective),void 0!==e.type&&(this.cameraType=e.type),void 0!==e.up&&this.up.fromArray(e.up),void 0!==e.targetOffset&&(this.targetOffset=e.targetOffset),void 0!==e.isUpVectorFlipped&&(this.isUpVectorFlipped=e.isUpVectorFlipped),this.updateProjectionMatrix()}updateByPatchedOp(e,t,i){super.updateByPatchedOp(e,t,i),1===e.path.length&&0===e.type&&this.updateCameraSubtype(e.path[0],e.props)}toState(e){return{...super.toState(e),...this.toCameraState(e),type:this.cameraType}}},Ta=new iY,Tn=new iY;function To(e){let t=!1;return e.scene.objects.traverse((e,i)=>{i.geometry?.type==="BooleanGeometry"&&(t=!0)}),t}var Tl=class extends Ai{constructor(e,t,i){super(e,t),this.data=t,this.meshSetAddresses=[],this.needsTransformForDownstream=!1,this.geometry=new rz,this.onAfterRender=(e,t,i,r,s,a)=>{super.onAfterRender(e,t,i,r,s,a),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),1===e.path.length&&"geometry"===e.path[0]&&0===e.type&&void 0!==e.props.operation&&(this.freeBooleanPointer(),this.resetBBoxNeedsUpdate())}freeBooleanPointer(){super.freeBooleanPointer(),this.geometry.dispose()}recomputeBoolean(e,t=!0){if(-1!==this.booleanMeshSetAddress&&!e)return;for(let i=0;i<this.children.length;i++){let r=this.children[i];r instanceof Tl&&!0===r.dataPatched.visible&&r.recomputeBoolean(!0===e,t)}this.meshSetAddresses=[];for(let i=0;i<this.children.length;i++){let r=this.children[i];if(r instanceof Cf&&!0===r.dataPatched.visible&&r.geometry.attributes.position?.count>0&&r.geometry.drawRange.count>0&&0!==r.booleanMeshSetAddress){Ta.multiplyMatrices(r.hiddenMatrix,r.matrix);try{if(-1===r.booleanMeshSetAddress){if((r.geometry.index??r.geometry.getAttribute("position")).count/3<15e5&&(r.booleanMeshSetAddress=S5.getMeshSet(r.geometry,!0===e,t)),-1===r.booleanMeshSetAddress)return;S5.transformMeshSet(r.booleanMeshSetAddress,Ta),r.booleanMatrixInvOld.copy(Ta).invert(),r.booleanWasTransformed=!1}else r instanceof Tl&&!0===r.needsTransformForDownstream?(S5.transformMeshSet(r.booleanMeshSetAddress,Ta),r.needsTransformForDownstream=!1):!0===r.booleanWasTransformed&&(S5.transformMeshSet(r.booleanMeshSetAddress,Tn.multiplyMatrices(Ta,r.booleanMatrixInvOld)),r.booleanMatrixInvOld.copy(Ta).invert(),r.booleanWasTransformed=!1)}catch(e){console.error(e),r.booleanMeshSetAddress=0,r.geometry.userData.booleanOperationDidFail=!0;continue}!1===S5.hasOpenEdges(r.booleanMeshSetAddress)||i===this.children.length-1&&2===this.booleanOp?(this.meshSetAddresses.push(r.booleanMeshSetAddress),r.geometry.userData.booleanOperationDidFail=!1):r.geometry.userData.booleanOperationDidFail="openEdges"}}if(0===this.meshSetAddresses.length){this.geometry.setAttribute("position",new rP([],0)),this.geometry.setDrawRange(0,0);return}if(!0===e)return S5.calcBooleanTopological(this.meshSetAddresses,this.booleanOp);let i=this.geometry;i.dispose(),this.geometry=new rz,this.geometry.userData=i.userData,this.geometry.boundingSphere=i.boundingSphere;try{this.booleanMeshSetAddress=S5.calcBoolean(this.meshSetAddresses,this.booleanOp,this.geometry,this.phongAngle)}catch(e){this.booleanMeshSetAddress=0,this.geometry.userData.booleanOperationDidFail=!0,console.error(e)}
vendor: 16,384 bytes, lines 5427-5546
5427this.booleanMatrixInvOld.copy(this.matrix).invert(),this.needsTransformForDownstream=!0,Ah(this),Ac(this)}dispose(){super.dispose(),this.geometry.dispose()}};(DE||(DE={})).is=function(e){return SL.is(e)&&e instanceof o7};var Th=(e,t)=>class extends A8(e,t){updateState_Light(e,t){this.updateState_Entity(e,t),void 0!==e.color&&(this.color=t.shared.color(e.color)),void 0!==e.intensity&&(this.intensity=e.intensity),void 0!==e.depth&&(this.shadow.camera.far=e.depth,this.shadow.needsUpdate=!0),void 0!==e.shadows&&(this.castShadow=e.shadows)}},Tc=e=>e instanceof Cf,Td=e=>null!==e&&e instanceof Tl,Tu=e=>DM.is(e),Tp=new iy(1,1,1),Tf=new iy,Tm=new iy,Tg=new iv,Tv=class extends AK(lJ){constructor(e,t=15){super(t),this.object=e,this.dummy=new nd,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){A1(this.object,Tv.geometryHelper,e,t,!1,this.dummy)}update(){}updateMatrix(){}updateMatrixWorld(e){this.object.matrixWorld.decompose(Tf,Tg,Tm),this.matrix.compose(Tf,Tg,Tp),super.updateMatrixWorld(e)}updateWorldMatrix(e,t){}},Ty=class extends A8(nd,Tv){constructor(e,t){super(),this.super_Entity(e,t),this.objectHelper.update()}updateState(e,t){this.updateState_Entity(e,t),"buffer"in e&&1===Object.keys(e).length&&t.scene.reloadSplats()}},Tx=class extends A8(nd,Tv){constructor(e,t,i){super(),this.super_Entity(e,t),this.context=i,this.objectHelper.update()}updateState(e,t){this.updateState_Entity(e,t)}},Tb="varying vec2 vUv;void main(){vUv=position.xy*0.5+0.5;gl_Position=vec4(position.xy,1.0,1.0);}",Tw=`#ifdef FRAMEBUFFER_PRECISION_HIGH
5428uniform mediump sampler2D inputBuffer;
5429#else
5430uniform lowp sampler2D inputBuffer;
5431#endif
5432uniform lowp sampler2D cocBuffer;uniform vec2 texelSize;uniform float scale;uniform vec4 kernel64[32];varying vec2 vUv;void main(){
5433#ifdef FOREGROUND
5434vec2 CoCNearFar=texture2D(cocBuffer,vUv).rg;float CoC=CoCNearFar.r*scale;
5435#else
5436float CoC=texture2D(cocBuffer,vUv).g*scale;
5437#endif
5438if(CoC==0.0){gl_FragColor=texture2D(inputBuffer,vUv);}else{
5439#ifdef FOREGROUND
5440vec2 step=texelSize*max(CoC,CoCNearFar.g*scale);
5441#else
5442vec2 step=texelSize*CoC;
5443#endif
5444vec4 acc=vec4(0.0);for(int i=0;i<32;++i){vec4 kernel=kernel64[i];vec2 uv=step*kernel.xy+vUv;acc+=texture2D(inputBuffer,uv);uv=step*kernel.zw+vUv;acc+=texture2D(inputBuffer,uv);}gl_FragColor=acc/64.0;}}`,T_=class extends r5{constructor(e=!1,t=!1){super({name:"BokehMaterial",defines:{PASS:e?"2":"1"},uniforms:{kernel64:new lD(null),kernel16:new lD(null),inputBuffer:new lD(null),cocBuffer:new lD(null),texelSize:new lD(new tZ),scale:new lD(1)},blending:0,depthWrite:!1,depthTest:!1,fragmentShader:Tw,vertexShader:Tb}),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=new Float32Array(128),t=new Float32Array(32),i=0,r=0;for(let s=0;s<80;++s){let a=2.39996323*s,o=Math.sqrt(s)/Math.sqrt(80),h=o*Math.cos(a),c=o*Math.sin(a);s%5==0?(t[r++]=h,t[r++]=c):(e[i++]=h,e[i++]=c)}let s=[],a=[];for(let t=0;t<128;)s.push(new id(e[t++],e[t++],e[t++],e[t++]));for(let e=0;e<32;)a.push(new id(t[e++],t[e++],t[e++],t[e++]));this.uniforms.kernel64.value=s,this.uniforms.kernel16.value=a}setTexelSize(e,t){this.uniforms.texelSize.value.set(e,t)}setSize(e,t){this.uniforms.texelSize.value.set(1/e,1/t)}};function TS(e,t,i){return Math.min(Math.max((e+t)/(t-i),0),1)}var TC=`#include <common>
5445#include <packing>
5446#ifdef GL_FRAGMENT_PRECISION_HIGH
5447uniform highp sampler2D depthBuffer;
5448#else
5449uniform mediump sampler2D depthBuffer;
5450#endif
5451uniform float focusDistance;uniform float focusRange;uniform float cameraNear;uniform float cameraFar;varying vec2 vUv;float readDepth(const in vec2 uv){
5452#if DEPTH_PACKING == 3201
5453return unpackRGBAToDepth(texture2D(depthBuffer,uv));
5454#else
5455return texture2D(depthBuffer,uv).r;
5456#endif
5457}void main(){float depth=readDepth(vUv);
5458#ifdef PERSPECTIVE_CAMERA
5459float viewZ=perspectiveDepthToViewZ(depth,cameraNear,cameraFar);float linearDepth=viewZToOrthographicDepth(viewZ,cameraNear,cameraFar);
5460#else
5461float linearDepth=depth;
5462#endif
5463float signedDistance=linearDepth-focusDistance;float magnitude=smoothstep(0.0,focusRange,abs(signedDistance));gl_FragColor.rg=magnitude*vec2(step(signedDistance,0.0),step(0.0,signedDistance));}`,TM=class extends r5{constructor(e){super({name:"CircleOfConfusionMaterial",defines:{DEPTH_PACKING:"0"},uniforms:{depthBuffer:new lD(null),focusDistance:new lD(0),focusRange:new lD(0),cameraNear:new lD(.3),cameraFar:new lD(1e3)},blending:0,depthWrite:!1,depthTest:!1,fragmentShader:TC,vertexShader:Tb}),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=3200){this.depthBuffer=e,this.depthPacking=t}get focusDistance(){return this.uniforms.focusDistance.value}set focusDistance(e){this.uniforms.focusDistance.value=e}get worldFocusDistance(){var e,t;return-(e=this.focusDistance,e*((t=this.near)-this.far)-t)}set worldFocusDistance(e){this.focusDistance=TS(-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(){var e,t;return-(e=this.focusRange,e*((t=this.near)-this.far)-t)}set worldFocusRange(e){this.focusRange=TS(-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 r8?this.defines.PERSPECTIVE_CAMERA="1":delete this.defines.PERSPECTIVE_CAMERA,this.needsUpdate=!0)}},TE=`#include <common>
5464#include <dithering_pars_fragment>
5465#ifdef FRAMEBUFFER_PRECISION_HIGH
5466uniform mediump sampler2D inputBuffer;
5467#else
5468uniform lowp sampler2D inputBuffer;
5469#endif
5470varying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;void main(){vec4 sum=texture2D(inputBuffer,vUv0);sum+=texture2D(inputBuffer,vUv1);sum+=texture2D(inputBuffer,vUv2);sum+=texture2D(inputBuffer,vUv3);gl_FragColor=sum*0.25;
5471#include <encodings_fragment>
5472#include <dithering_fragment>
5473}`,TA=class extends r5{constructor(e=new tZ){super({name:"KawaseBlurMaterial",uniforms:{inputBuffer:new lD(null),texelSize:new lD(new tZ),halfTexelSize:new lD(new tZ),kernel:new lD(0),scale:new lD(1)},blending:0,depthWrite:!1,depthTest:!1,fragmentShader:TE,vertexShader:"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);}"}),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)}},TT=`#ifdef FRAMEBUFFER_PRECISION_HIGH
5474uniform mediump sampler2D inputBuffer;
5475#else
5476uniform lowp sampler2D inputBuffer;
5477#endif
5478uniform float opacity;varying vec2 vUv;void main(){vec4 texel=texture2D(inputBuffer,vUv);gl_FragColor=opacity*texel;
5479#include <encodings_fragment>
5480}`,TP=class extends r5{constructor(){super({name:"CopyMaterial",uniforms:{inputBuffer:new lD(null),opacity:new lD(1)},blending:0,depthWrite:!1,depthTest:!1,fragmentShader:TT,vertexShader:Tb}),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}},TD=`varying vec2 vUv;varying vec2 vUv0;varying vec2 vUv1;
5481#if THREE_REVISION < 143
5482#define luminance(v) linearToRelativeLuminance(v)
5483#endif
5484#if EDGE_DETECTION_MODE != 0
5485varying vec2 vUv2;varying vec2 vUv3;varying vec2 vUv4;varying vec2 vUv5;
5486#endif
5487#if EDGE_DETECTION_MODE == 1
5488#include <common>
5489#endif
5490#if EDGE_DETECTION_MODE == 0 || PREDICATION_MODE == 1
5491#ifdef GL_FRAGMENT_PRECISION_HIGH
5492uniform highp sampler2D depthBuffer;
5493#else
5494uniform mediump sampler2D depthBuffer;
5495#endif
5496float readDepth(const in vec2 uv){
5497#if DEPTH_PACKING == 3201
5498return unpackRGBAToDepth(texture2D(depthBuffer,uv));
5499#else
5500return texture2D(depthBuffer,uv).r;
5501#endif
5502}vec3 gatherNeighbors(){float p=readDepth(vUv);float pLeft=readDepth(vUv0);float pTop=readDepth(vUv1);return vec3(p,pLeft,pTop);}
5503#elif PREDICATION_MODE == 2
5504uniform sampler2D predicationBuffer;vec3 gatherNeighbors(){float p=texture2D(predicationBuffer,vUv).r;float pLeft=texture2D(predicationBuffer,vUv0).r;float pTop=texture2D(predicationBuffer,vUv1).r;return vec3(p,pLeft,pTop);}
5505#endif
5506#if PREDICATION_MODE != 0
5507vec2 calculatePredicatedThreshold(){vec3 neighbours=gatherNeighbors();vec2 delta=abs(neighbours.xx-neighbours.yz);vec2 edges=step(PREDICATION_THRESHOLD,delta);return PREDICATION_SCALE*EDGE_THRESHOLD*(1.0-PREDICATION_STRENGTH*edges);}
5508#endif
5509#if EDGE_DETECTION_MODE != 0
5510uniform sampler2D inputBuffer;
5511#endif
5512void main(){
5513#if EDGE_DETECTION_MODE == 0
5514const vec2 threshold=vec2(DEPTH_THRESHOLD);
5515#elif PREDICATION_MODE != 0
5516vec2 threshold=calculatePredicatedThreshold();
5517#else
5518const vec2 threshold=vec2(EDGE_THRESHOLD);
5519#endif
5520#if EDGE_DETECTION_MODE == 0
5521vec3 neighbors=gatherNeighbors();vec2 delta=abs(neighbors.xx-vec2(neighbors.y,neighbors.z));vec2 edges=step(threshold,delta);if(dot(edges,vec2(1.0))==0.0){discard;}gl_FragColor=vec4(edges,0.0,1.0);
5522#elif EDGE_DETECTION_MODE == 1
5523float l=luminance(texture2D(inputBuffer,vUv).rgb);float lLeft=luminance(texture2D(inputBuffer,vUv0).rgb);float lTop=luminance(texture2D(inputBuffer,vUv1).rgb);vec4 delta;delta.xy=abs(l-vec2(lLeft,lTop));vec2 edges=step(threshold,delta.xy);if(dot(edges,vec2(1.0))==0.0){discard;}float lRight=luminance(texture2D(inputBuffer,vUv2).rgb);float lBottom=luminance(texture2D(inputBuffer,vUv3).rgb);delta.zw=abs(l-vec2(lRight,lBottom));vec2 maxDelta=max(delta.xy,delta.zw);float lLeftLeft=luminance(texture2D(inputBuffer,vUv4).rgb);float lTopTop=luminance(texture2D(inputBuffer,vUv5).rgb);delta.zw=abs(vec2(lLeft,lTop)-vec2(lLeftLeft,lTopTop));maxDelta=max(maxDelta.xy,delta.zw);float finalDelta=max(maxDelta.x,maxDelta.y);edges.xy*=step(finalDelta,LOCAL_CONTRAST_ADAPTATION_FACTOR*delta.xy);gl_FragColor=vec4(edges,0.0,1.0);
5524#elif EDGE_DETECTION_MODE == 2
5525vec4 delta;vec3 c=texture2D(inputBuffer,vUv).rgb;vec3 cLeft=texture2D(inputBuffer,vUv0).rgb;vec3 t=abs(c-cLeft);delta.x=max(max(t.r,t.g),t.b);vec3 cTop=texture2D(inputBuffer,vUv1).rgb;t=abs(c-cTop);delta.y=max(max(t.r,t.g),t.b);vec2 edges=step(threshold,delta.xy);if(dot(edges,vec2(1.0))==0.0){discard;}vec3 cRight=texture2D(inputBuffer,vUv2).rgb;t=abs(c-cRight);delta.z=max(max(t.r,t.g),t.b);vec3 cBottom=texture2D(inputBuffer,vUv3).rgb;t=abs(c-cBottom);delta.w=max(max(t.r,t.g),t.b);vec2 maxDelta=max(delta.xy,delta.zw);vec3 cLeftLeft=texture2D(inputBuffer,vUv4).rgb;t=abs(c-cLeftLeft);delta.z=max(max(t.r,t.g),t.b);vec3 cTopTop=texture2D(inputBuffer,vUv5).rgb;t=abs(c-cTopTop);delta.w=max(max(t.r,t.g),t.b);maxDelta=max(maxDelta.xy,delta.zw);float finalDelta=max(maxDelta.x,maxDelta.y);edges*=step(finalDelta,LOCAL_CONTRAST_ADAPTATION_FACTOR*delta.xy);gl_FragColor=vec4(edges,0.0,1.0);
5526#endif
5527}`,TO=`uniform vec2 texelSize;varying vec2 vUv;varying vec2 vUv0;varying vec2 vUv1;
5528#if EDGE_DETECTION_MODE != 0
5529varying vec2 vUv2;varying vec2 vUv3;varying vec2 vUv4;varying vec2 vUv5;
5530#endif
5531void main(){vUv=position.xy*0.5+0.5;vUv0=vUv+texelSize*vec2(-1.0,0.0);vUv1=vUv+texelSize*vec2(0.0,-1.0);
5532#if EDGE_DETECTION_MODE != 0
5533vUv2=vUv+texelSize*vec2(1.0,0.0);vUv3=vUv+texelSize*vec2(0.0,1.0);vUv4=vUv+texelSize*vec2(-2.0,0.0);vUv5=vUv+texelSize*vec2(0.0,-2.0);
5534#endif
5535gl_Position=vec4(position.xy,1.0,1.0);}`,TL=class extends r5{constructor(e=new tZ,t=2){super({name:"EdgeDetectionMaterial",defines:{THREE_REVISION:"149".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 lD(null),depthBuffer:new lD(null),predicationBuffer:new lD(null),texelSize:new lD(e)},blending:0,depthWrite:!1,depthTest:!1,fragmentShader:TD,vertexShader:TO}),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=3200){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=(.1*e).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)}},TI=`#include <common>
5536#include <packing>
5537#include <dithering_pars_fragment>
5538#define packFloatToRGBA(v) packDepthToRGBA(v)
5539#define unpackRGBAToFloat(v) unpackRGBAToDepth(v)
5540#ifdef FRAMEBUFFER_PRECISION_HIGH
5541uniform mediump sampler2D inputBuffer;
5542#else
5543uniform lowp sampler2D inputBuffer;
5544#endif
5545#ifdef GL_FRAGMENT_PRECISION_HIGH
5546uniform highp sampler2D depthBuf
5546fer;
5547#else
5548uniform mediump sampler2D depthBuffer;
5549#endif
5550uniform vec2 resolution;uniform vec2 texelSize;uniform float cameraNear;uniform float cameraFar;uniform float aspect;uniform float time;varying vec2 vUv;
5551#if THREE_REVISION < 143
5552#define luminance(v) linearToRelativeLuminance(v)
5553#endif
5554#if THREE_REVISION >= 137
5555vec4 sRGBToLinear(const in vec4 value){return vec4(mix(pow(value.rgb*0.9478672986+vec3(0.0521327014),vec3(2.4)),value.rgb*0.0773993808,vec3(lessThanEqual(value.rgb,vec3(0.04045)))),value.a);}
5556#endif
5557float readDepth(const in vec2 uv){
5558#if DEPTH_PACKING == 3201
5559return unpackRGBAToDepth(texture2D(depthBuffer,uv));
5560#else
5561return texture2D(depthBuffer,uv).r;
5562#endif
5563}float getViewZ(const in float depth){
5564#ifdef PERSPECTIVE_CAMERA
5565return perspectiveDepthToViewZ(depth,cameraNear,cameraFar);
5566#else
5567return orthographicDepthToViewZ(depth,cameraNear,cameraFar);
5568#endif
5569}FRAGMENT_HEADvoid main(){FRAGMENT_MAIN_UVvec4 color0=texture2D(inputBuffer,UV);vec4 color1=vec4(0.0);FRAGMENT_MAIN_IMAGEgl_FragColor=color0;
5570#ifdef ENCODE_OUTPUT
5571#include <encodings_fragment>
5572#endif
5573#include <dithering_fragment>
5574}`,TR={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"},Tk=class extends r5{constructor(e,t,i,r,s=!1){super({name:"EffectMaterial",defines:{THREE_REVISION:"149".replace(/\D+/g,""),DEPTH_PACKING:"0",ENCODE_OUTPUT:"1"},uniforms:{inputBuffer:new lD(null),depthBuffer:new lD(null),resolution:new lD(new tZ),texelSize:new lD(new tZ),cameraNear:new lD(.3),cameraFar:new lD(1e3),aspect:new lD(1),time:new lD(0)},blending:0,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=3200){this.depthBuffer=e,this.depthPacking=t}setShaderParts(e){return this.fragmentShader=TI.replace(TR.FRAGMENT_HEAD,e.get(TR.FRAGMENT_HEAD)).replace(TR.FRAGMENT_MAIN_UV,e.get(TR.FRAGMENT_MAIN_UV)).replace(TR.FRAGMENT_MAIN_IMAGE,e.get(TR.FRAGMENT_MAIN_IMAGE)),this.vertexShader="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);}".replace(TR.VERTEX_HEAD,e.get(TR.VERTEX_HEAD)).replace(TR.VERTEX_MAIN_SUPPORT,e.get(TR.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){for(let t of(this.extensions={},e))this.extensions[t]=!0;return this}get encodeOutput(){return void 0!==this.defines.ENCODE_OUTPUT}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 r8?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 TR}},TB=`#include <common>
5575#if THREE_REVISION < 143
5576#define luminance(v) linearToRelativeLuminance(v)
5577#endif
5578#ifdef FRAMEBUFFER_PRECISION_HIGH
5579uniform mediump sampler2D inputBuffer;
5580#else
5581uniform lowp sampler2D inputBuffer;
5582#endif
5583#ifdef RANGE
5584uniform vec2 range;
5585#elif defined(THRESHOLD)
5586uniform float threshold;uniform float smoothing;
5587#endif
5588varying vec2 vUv;void main(){vec4 texel=texture2D(inputBuffer,vUv);float l=luminance(texel.rgb);
5589#ifdef RANGE
5590float low=step(range.x,l);float high=step(l,range.y);l*=low*high;
5591#elif defined(THRESHOLD)
5592l=smoothstep(threshold,threshold+smoothing,l);
5593#endif
5594#ifdef COLOR
5595gl_FragColor=vec4(texel.rgb*l,l);
5596#else
5597gl_FragColor=vec4(l);
5598#endif
5599}`,Tz=class extends r5{constructor(e=!1,t=null){super({name:"LuminanceMaterial",defines:{THREE_REVISION:"149".replace(/\D+/g,"")},uniforms:{inputBuffer:new lD(null),threshold:new lD(0),smoothing:new lD(1),range:new lD(null)},blending:0,depthWrite:!1,depthTest:!1,fragmentShader:TB,vertexShader:Tb}),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 void 0!==this.defines.COLOR}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 null!==this.luminanceRange}set useRange(e){this.luminanceRange=null}get luminanceRange(){return this.uniforms.range.value}set luminanceRange(e){null!==e?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}},TN=`#ifdef FRAMEBUFFER_PRECISION_HIGH
5600uniform mediump sampler2D inputBuffer;
5601#else
5602uniform lowp sampler2D inputBuffer;
5603#endif
5604#ifdef MASK_PRECISION_HIGH
5605uniform mediump sampler2D maskTexture;
5606#else
5607uniform lowp sampler2D maskTexture;
5608#endif
5609#if MASK_FUNCTION != 0
5610uniform float strength;
5611#endif
5612varying vec2 vUv;void main(){
5613#if COLOR_CHANNEL == 0
5614float mask=texture2D(maskTexture,vUv).r;
5615#elif COLOR_CHANNEL == 1
5616float mask=texture2D(maskTexture,vUv).g;
5617#elif COLOR_CHANNEL == 2
5618float mask=texture2D(maskTexture,vUv).b;
5619#else
5620float mask=texture2D(maskTexture,vUv).a;
5621#endif
5622#if MASK_FUNCTION == 0
5623#ifdef INVERTED
5624mask=step(mask,0.0);
5625#else
5626mask=1.0-step(mask,0.0);
5627#endif
5628#else
5629mask=clamp(mask*strength,0.0,1.0);
5630#ifdef INVERTED
5631mask=1.0-mask;
5632#endif
5633#endif
5634#if MASK_FUNCTION == 2
5635gl_FragColor=vec4(mask*texture2D(inputBuffer,vUv).rgb,mask);
5636#else
5637gl_FragColor=mask*texture2D(inputBuffer,vUv);
5638#endif
5639}`,TF=class extends r5{constructor(e=null){super({name:"MaskMaterial",uniforms:{maskTexture:new lD(e),inputBuffer:new lD(null),strength:new lD(1)},blending:0,depthWrite:!1,depthTest:!1,fragmentShader:TN,vertexShader:Tb}),this.toneMapped=!1,this.setColorChannel(0),this.setMaskFunction(0)}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,1009!==e.type&&(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 void 0!==this.defines.INVERTED}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}},Tj
vendor: 7,736 bytes, lines 5639-5664
5639=`#define sampleLevelZeroOffset(t, coord, offset) texture2D(t, coord + offset * texelSize)
5640#if __VERSION__ < 300
5641#define round(v) floor(v + 0.5)
5642#endif
5643#ifdef FRAMEBUFFER_PRECISION_HIGH
5644uniform mediump sampler2D inputBuffer;
5645#else
5646uniform lowp sampler2D inputBuffer;
5647#endif
5648uniform lowp sampler2D areaTexture;uniform lowp sampler2D searchTexture;uniform vec2 texelSize;uniform vec2 resolution;varying vec2 vUv;varying vec4 vOffset[3];varying vec2 vPixCoord;void movec(const in bvec2 c,inout vec2 variable,const in vec2 value){if(c.x){variable.x=value.x;}if(c.y){variable.y=value.y;}}void movec(const in bvec4 c,inout vec4 variable,const in vec4 value){movec(c.xy,variable.xy,value.xy);movec(c.zw,variable.zw,value.zw);}vec2 decodeDiagBilinearAccess(in vec2 e){e.r=e.r*abs(5.0*e.r-5.0*0.75);return round(e);}vec4 decodeDiagBilinearAccess(in vec4 e){e.rb=e.rb*abs(5.0*e.rb-5.0*0.75);return round(e);}vec2 searchDiag1(const in vec2 texCoord,const in vec2 dir,out vec2 e){vec4 coord=vec4(texCoord,-1.0,1.0);vec3 t=vec3(texelSize,1.0);for(int i=0;i<MAX_SEARCH_STEPS_INT;++i){if(!(coord.z<float(MAX_SEARCH_STEPS_DIAG_INT-1)&&coord.w>0.9)){break;}coord.xyz=t*vec3(dir,1.0)+coord.xyz;e=texture2D(inputBuffer,coord.xy).rg;coord.w=dot(e,vec2(0.5));}return coord.zw;}vec2 searchDiag2(const in vec2 texCoord,const in vec2 dir,out vec2 e){vec4 coord=vec4(texCoord,-1.0,1.0);coord.x+=0.25*texelSize.x;vec3 t=vec3(texelSize,1.0);for(int i=0;i<MAX_SEARCH_STEPS_INT;++i){if(!(coord.z<float(MAX_SEARCH_STEPS_DIAG_INT-1)&&coord.w>0.9)){break;}coord.xyz=t*vec3(dir,1.0)+coord.xyz;e=texture2D(inputBuffer,coord.xy).rg;e=decodeDiagBilinearAccess(e);coord.w=dot(e,vec2(0.5));}return coord.zw;}vec2 areaDiag(const in vec2 dist,const in vec2 e,const in float offset){vec2 texCoord=vec2(AREATEX_MAX_DISTANCE_DIAG,AREATEX_MAX_DISTANCE_DIAG)*e+dist;texCoord=AREATEX_PIXEL_SIZE*texCoord+0.5*AREATEX_PIXEL_SIZE;texCoord.x+=0.5;texCoord.y+=AREATEX_SUBTEX_SIZE*offset;return texture2D(areaTexture,texCoord).rg;}vec2 calculateDiagWeights(const in vec2 texCoord,const in vec2 e,const in vec4 subsampleIndices){vec2 weights=vec2(0.0);vec4 d;vec2 end;if(e.r>0.0){d.xz=searchDiag1(texCoord,vec2(-1.0,1.0),end);d.x+=float(end.y>0.9);}else{d.xz=vec2(0.0);}d.yw=searchDiag1(texCoord,vec2(1.0,-1.0),end);if(d.x+d.y>2.0){vec4 coords=vec4(-d.x+0.25,d.x,d.y,-d.y-0.25)*texelSize.xyxy+texCoord.xyxy;vec4 c;c.xy=sampleLevelZeroOffset(inputBuffer,coords.xy,vec2(-1,0)).rg;c.zw=sampleLevelZeroOffset(inputBuffer,coords.zw,vec2(1,0)).rg;c.yxwz=decodeDiagBilinearAccess(c.xyzw);vec2 cc=vec2(2.0)*c.xz+c.yw;movec(bvec2(step(0.9,d.zw)),cc,vec2(0.0));weights+=areaDiag(d.xy,cc,subsampleIndices.z);}d.xz=searchDiag2(texCoord,vec2(-1.0,-1.0),end);if(sampleLevelZeroOffset(inputBuffer,texCoord,vec2(1,0)).r>0.0){d.yw=searchDiag2(texCoord,vec2(1.0),end);d.y+=float(end.y>0.9);}else{d.yw=vec2(0.0);}if(d.x+d.y>2.0){vec4 coords=vec4(-d.x,-d.x,d.y,d.y)*texelSize.xyxy+texCoord.xyxy;vec4 c;c.x=sampleLevelZeroOffset(inputBuffer,coords.xy,vec2(-1,0)).g;c.y=sampleLevelZeroOffset(inputBuffer,coords.xy,vec2(0,-1)).r;c.zw=sampleLevelZeroOffset(inputBuffer,coords.zw,vec2(1,0)).gr;vec2 cc=vec2(2.0)*c.xz+c.yw;movec(bvec2(step(0.9,d.zw)),cc,vec2(0.0));weights+=areaDiag(d.xy,cc,subsampleIndices.w).gr;}return weights;}float searchLength(const in vec2 e,const in float offset){vec2 scale=SEARCHTEX_SIZE*vec2(0.5,-1.0);vec2 bias=SEARCHTEX_SIZE*vec2(offset,1.0);scale+=vec2(-1.0,1.0);bias+=vec2(0.5,-0.5);scale*=1.0/SEARCHTEX_PACKED_SIZE;bias*=1.0/SEARCHTEX_PACKED_SIZE;return texture2D(searchTexture,scale*e+bias).r;}float searchXLeft(in vec2 texCoord,const in float end){vec2 e=vec2(0.0,1.0);for(int i=0;i<MAX_SEARCH_STEPS_INT;++i){if(!(texCoord.x>end&&e.g>0.8281&&e.r==0.0)){break;}e=texture2D(inputBuffer,texCoord).rg;texCoord=vec2(-2.0,0.0)*texelSize+texCoord;}float offset=-(255.0/127.0)*searchLength(e,0.0)+3.25;return texelSize.x*offset+texCoord.x;}float searchXRight(vec2 texCoord,const in float end){vec2 e=vec2(0.0,1.0);for(int i=0;i<MAX_SEARCH_STEPS_INT;++i){if(!(texCoord.x<end&&e.g>0.8281&&e.r==0.0)){break;}e=texture2D(inputBuffer,texCoord).rg;texCoord=vec2(2.0,0.0)*texelSize.xy+texCoord;}float offset=-(255.0/127.0)*searchLength(e,0.5)+3.25;return-texelSize.x*offset+texCoord.x;}float searchYUp(vec2 texCoord,const in float end){vec2 e=vec2(1.0,0.0);for(int i=0;i<MAX_SEARCH_STEPS_INT;++i){if(!(texCoord.y>end&&e.r>0.8281&&e.g==0.0)){break;}e=texture2D(inputBuffer,texCoord).rg;texCoord=-vec2(0.0,2.0)*texelSize.xy+texCoord;}float offset=-(255.0/127.0)*searchLength(e.gr,0.0)+3.25;return texelSize.y*offset+texCoord.y;}float searchYDown(vec2 texCoord,const in float end){vec2 e=vec2(1.0,0.0);for(int i=0;i<MAX_SEARCH_STEPS_INT;i++){if(!(texCoord.y<end&&e.r>0.8281&&e.g==0.0)){break;}e=texture2D(inputBuffer,texCoord).rg;texCoord=vec2(0.0,2.0)*texelSize.xy+texCoord;}float offset=-(255.0/127.0)*searchLength(e.gr,0.5)+3.25;return-texelSize.y*offset+texCoord.y;}vec2 area(const in vec2 dist,const in float e1,const in float e2,const in float offset){vec2 texCoord=vec2(AREATEX_MAX_DISTANCE)*round(4.0*vec2(e1,e2))+dist;texCoord=AREATEX_PIXEL_SIZE*texCoord+0.5*AREATEX_PIXEL_SIZE;texCoord.y=AREATEX_SUBTEX_SIZE*offset+texCoord.y;return texture2D(areaTexture,texCoord).rg;}void detectHorizontalCornerPattern(inout vec2 weights,const in vec4 texCoord,const in vec2 d){
5649#if !defined(DISABLE_CORNER_DETECTION)
5650vec2 leftRight=step(d.xy,d.yx);vec2 rounding=(1.0-CORNER_ROUNDING_NORM)*leftRight;rounding/=leftRight.x+leftRight.y;vec2 factor=vec2(1.0);factor.x-=rounding.x*sampleLevelZeroOffset(inputBuffer,texCoord.xy,vec2(0,1)).r;factor.x-=rounding.y*sampleLevelZeroOffset(inputBuffer,texCoord.zw,vec2(1,1)).r;factor.y-=rounding.x*sampleLevelZeroOffset(inputBuffer,texCoord.xy,vec2(0,-2)).r;factor.y-=rounding.y*sampleLevelZeroOffset(inputBuffer,texCoord.zw,vec2(1,-2)).r;weights*=clamp(factor,0.0,1.0);
5651#endif
5652}void detectVerticalCornerPattern(inout vec2 weights,const in vec4 texCoord,const in vec2 d){
5653#if !defined(DISABLE_CORNER_DETECTION)
5654vec2 leftRight=step(d.xy,d.yx);vec2 rounding=(1.0-CORNER_ROUNDING_NORM)*leftRight;rounding/=leftRight.x+leftRight.y;vec2 factor=vec2(1.0);factor.x-=rounding.x*sampleLevelZeroOffset(inputBuffer,texCoord.xy,vec2(1,0)).g;factor.x-=rounding.y*sampleLevelZeroOffset(inputBuffer,texCoord.zw,vec2(1,1)).g;factor.y-=rounding.x*sampleLevelZeroOffset(inputBuffer,texCoord.xy,vec2(-2,0)).g;factor.y-=rounding.y*sampleLevelZeroOffset(inputBuffer,texCoord.zw,vec2(-2,1)).g;weights*=clamp(factor,0.0,1.0);
5655#endif
5656}void main(){vec4 weights=vec4(0.0);vec4 subsampleIndices=vec4(0.0);vec2 e=texture2D(inputBuffer,vUv).rg;if(e.g>0.0){
5657#if !defined(DISABLE_DIAG_DETECTION)
5658weights.rg=calculateDiagWeights(vUv,e,subsampleIndices);if(weights.r==-weights.g){
5659#endif
5660vec2 d;vec3 coords;coords.x=searchXLeft(vOffset[0].xy,vOffset[2].x);coords.y=vOffset[1].y;d.x=coords.x;float e1=texture2D(inputBuffer,coords.xy).r;coords.z=searchXRight(vOffset[0].zw,vOffset[2].y);d.y=coords.z;d=round(resolution.xx*d+-vPixCoord.xx);vec2 sqrtD=sqrt(abs(d));float e2=sampleLevelZeroOffset(inputBuffer,coords.zy,vec2(1,0)).r;weights.rg=area(sqrtD,e1,e2,subsampleIndices.y);coords.y=vUv.y;detectHorizontalCornerPattern(weights.rg,coords.xyzy,d);
5661#if !defined(DISABLE_DIAG_DETECTION)
5662}else{e.r=0.0;}
5663#endif
5664}if(e.r>0.0){vec2 d;vec3 coords;coords.y=searchYUp(vOffset[1].xy,vOffset[2].z);coords.x=vOffset[0].x;d.x=coords.y;float e1=texture2D(inputBuffer,coords.xy).g;coords.z=searchYDown(vOffset[1].zw,vOffset[2].w);d.y=coords.z;d=round(resolution.yy*d-vPixCoord.yy);vec2 sqrtD=sqrt(abs(d));float e2=sampleLevelZeroOffset(inputBuffer,coords.xz,vec2(0,1)).g;weights.ba=area(sqrtD,e1,e2,subsampleIndices.x);coords.x=vUv.x;detectVerticalCornerPattern(weights.ba,coords.xyxz,d);}gl_FragColor=weights;}`,
vendor: 16,956 bytes, line 5664
5664TU=class extends r5{constructor(e=new tZ,t=new tZ){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 lD(null),searchTexture:new lD(null),areaTexture:new lD(null),resolution:new lD(t),texelSize:new lD(e)},blending:0,depthWrite:!1,depthTest:!1,fragmentShader:Tj,vertexShader:"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);}"}),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 void 0===this.defines.DISABLE_DIAG_DETECTION}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 void 0===this.defines.DISABLE_CORNER_DETECTION}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)}},TV=new r6,TW=null,TH=class{constructor(e="Pass",t=new nb,i=TV){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();null!==t&&(t.needsUpdate=!0),this.rtt=!e}}setRenderer(e){this.renderer=e}isEnabled(){return this.enabled}setEnabled(e){this.enabled=e}get fullscreenMaterial(){return null!==this.screen?this.screen.material:null}set fullscreenMaterial(e){let t=this.screen;null!==t?t.material=e:((t=new rK(function(){if(null===TW){let e=new Float32Array([-1,-1,0,3,-1,0,-1,3,0]),t=new Float32Array([0,0,2,0,0,2]);void 0!==(TW=new rz).setAttribute?(TW.setAttribute("position",new rE(e,3)),TW.setAttribute("uv",new rE(t,2))):(TW.addAttribute("position",new rE(e,3)),TW.addAttribute("uv",new rE(t,2)))}return TW}(),e)).frustumCulled=!1,null===this.scene&&(this.scene=new nb),this.scene.add(t),this.screen=t)}getFullscreenMaterial(){return this.fullscreenMaterial}setFullscreenMaterial(e){this.fullscreenMaterial=e}getDepthTexture(){return null}setDepthTexture(e,t=3200){}render(e,t,i,r,s){throw 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(null!==t&&"object"==typeof t&&"function"==typeof t.dispose){if(t instanceof nb||t===this.renderer)continue;this[e].dispose()}}}},TG=class extends TH{constructor(e,t=!0){super("CopyPass"),this.fullscreenMaterial=new TP,this.needsSwap=!1,this.renderTarget=e,void 0===e&&(this.renderTarget=new iu(1,1,{minFilter:1006,magFilter:1006,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){void 0!==i&&(this.renderTarget.texture.type=i,1009!==i?this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1":3001===e.outputEncoding&&(this.renderTarget.texture.encoding=3001))}},Tq=class extends TH{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)}},TX=new ir,TY=class extends TH{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,o=this.overrideClearAlpha,h=e.getClearAlpha(),c=null!==a,d=o>=0;c?(TX.copy(e.getClearColor(TX)),e.setClearColor(a,d?o:h)):d&&e.setClearAlpha(o),e.setRenderTarget(this.renderToScreen?null:t),e.clear(this.color,this.depth,this.stencil),c?e.setClearColor(TX,h):d&&e.setClearAlpha(h)}},TQ=class extends tk{constructor(e,t=-1,i=-1,r=1){super(),this.resizable=e,this.base=new tZ(1,1),this.preferred=new tZ(t,i),this.target=this.preferred,this.s=r}get width(){let{base:e,preferred:t,scale:i}=this;return -1!==t.width?t.width:-1!==t.height?Math.round(t.height*(e.width/Math.max(e.height,1))):Math.round(e.width*i)}set width(e){this.preferredWidth=e}get height(){let{base:e,preferred:t,scale:i}=this;return -1!==t.height?t.height:-1!==t.width?Math.round(t.width/Math.max(e.width/Math.max(e.height,1),1)):Math.round(e.height*i)}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(-1),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 -1}},TZ=!1,TK=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=e=>{if(e.isMesh){let t;if(e.material.flatShading)switch(e.material.side){case 2:t=this.materialsFlatShadedDoubleSide;break;case 1:t=this.materialsFlatShadedBackSide;break;default:t=this.materialsFlatShaded}else switch(e.material.side){case 2:t=this.materialsDoubleSide;break;case 1:t=this.materialsBackSide;break;default:t=this.materials}this.originalMaterials.set(e,e.material),e.isSkinnedMesh?e.material=t[2]:e.isInstancedMesh?e.material=t[1]:e.material=t[0],++this.meshCount}}}setMaterial(e){if(this.disposeMaterials(),this.material=e,null!==e){let t=this.materials=[e.clone(),e.clone(),e.clone()];for(let i of t)i.uniforms=Object.assign({},e.uniforms),i.side=0;t[2].skinning=!0,this.materialsBackSide=t.map(t=>{let i=t.clone();return i.uniforms=Object.assign({},e.uniforms),i.side=1,i}),this.materialsDoubleSide=t.map(t=>{let i=t.clone();return i.uniforms=Object.assign({},e.uniforms),i.side=2,i}),this.materialsFlatShaded=t.map(t=>{let i=t.clone();return i.uniforms=Object.assign({},e.uniforms),i.flatShading=!0,i}),this.materialsFlatShadedBackSide=t.map(t=>{let i=t.clone();return i.uniforms=Object.assign({},e.uniforms),i.flatShading=!0,i.side=1,i}),this.materialsFlatShadedDoubleSide=t.map(t=>{let i=t.clone();return i.uniforms=Object.assign({},e.uniforms),i.flatShading=!0,i.side=2,i})}}render(e,t,i){let r=e.shadowMap.enabled;if(e.shadowMap.enabled=!1,TZ){let r=this.originalMaterials;for(let s of(this.meshCount=0,t.traverse(this.replaceMaterial),e.render(t,i),r))s[0].material=s[1];this.meshCount!==r.size&&r.clear()}else{let r=t.overrideMaterial;t.overrideMaterial=this.material,e.render(t,i),t.overrideMaterial=r}e.shadowMap.enabled=r}disposeMaterials(){if(null!==this.material)for(let e of this.materials.concat(this.materialsBackSide).concat(this.materialsDoubleSide).concat(this.materialsFlatShaded).concat(this.materialsFlatShadedBackSide).concat(this.materialsFlatShadedDoubleSide))e.dispose()}dispose(){this.originalMaterials.clear(),this.disposeMaterials()}static get workaroundEnabled(){return TZ}static set workaroundEnabled(e){TZ=e}},TJ=class extends TH{constructor(e,t,i=null){super("RenderPass",e,t),this.needsSwap=!1,this.clearPass=new TY,this.overrideMaterialManager=null===i?null:new TK(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 null!==e?e.material:null}set overrideMaterial(e){let t=this.overrideMaterialManager;null!==e?null!==t?t.setMaterial(e):this.overrideMaterialManager=new TK(e):null!==t&&(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,o=this.camera,h=this.selection,c=o.layers.mask,d=a.background,u=e.shadowMap.autoUpdate,p=this.renderToScreen?null:t;null!==h&&o.layers.set(h.getLayer()),this.skipShadowMapUpdate&&(e.shadowMap.autoUpdate=!1),(this.ignoreBackground||null!==this.clearPass.overrideClearColor)&&(a.background=null),this.clearPass.enabled&&this.clearPass.render(e,t),e.setRenderTarget(p),null!==this.overrideMaterialManager?this.overrideMaterialManager.render(e,a,o):e.render(a,o),o.layers.mask=c,a.background=d,e.shadowMap.autoUpdate=u}},T$=class extends TH{constructor(e,t,{resolutionScale:i=1,width:r=TQ.AUTO_SIZE,height:s=TQ.AUTO_SIZE,renderTarget:a}={}){super("DepthPass"),this.needsSwap=!1,this.renderPass=new TJ(e,t,new ni({depthPacking:3201}));let o=this.renderPass;o.skipShadowMapUpdate=!0,o.ignoreBackground=!0;let h=o.getClearPass();h.overrideClearColor=new ir(0xffffff),h.overrideClearAlpha=1,this.renderTarget=a,void 0===this.renderTarget&&(this.renderTarget=new iu(1,1,{minFilter:1003,magFilter:1003,stencilBuffer:!1}),this.renderTarget.texture.name="DepthPass.Target");let c=this.resolution=new TQ(this,r,s,i);c.addEventListener("change",e=>this.setSize(c.baseWidth,c.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)}};new Float32Array([255/256/0x1000000,255/256/65536,255/256/256,255/256]);var T0={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},T1=new Map([[T0.SKIP,null],[T0.ADD,"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);}"],[T0.ALPHA,"vec3 blend(const in vec3 x,const in vec3 y,const in float opacity){return y*opacity+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));}"],[T0.AVERAGE,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return(x+y)*0.5*opacity+x*(1.0-opacity);}"],[T0.COLOR_BURN,"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);}"],[T0.COLOR_DODGE,"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);}"],[T0.DARKEN,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return min(x,y)*opacity+x*(1.0-opacity);}"],[T0.DIFFERENCE,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return abs(x-y)*opacity+x*(1.0-opacity);}"],[T0.EXCLUSION,"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);}"],[T0.LIGHTEN,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return max(x,y)*opacity+x*(1.0-opacity);}"],[T0.MULTIPLY,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return x*y*opacity+x*(1.0-opacity);}"],[T0.DIVIDE,"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);}"],[T0.NEGATION,"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);}"],[T0.NORMAL,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return y*
5664opacity+x*(1.0-opacity);}"],[T0.OVERLAY,"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);}"],[T0.REFLECT,"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);}"],[T0.SCREEN,"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);}"],[T0.SOFT_LIGHT,"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);}"],[T0.SUBTRACT,"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);}"]]),T2=class extends tk{constructor(e,t=1){super(),this.f=e,this.opacity=new lD(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 T1.get(this.blendFunction)}},T3=class extends tk{constructor(e,t,{attributes:i=0,blendFunction:r=T0.SCREEN,defines:s=new Map,uniforms:a=new Map,extensions:o=null,vertexShader:h=null}={}){super(),this.name=e,this.renderer=null,this.attributes=i,this.fragmentShader=t,this.vertexShader=h,this.defines=s,this.uniforms=a,this.extensions=o,this.blendMode=new T2(r),this.blendMode.addEventListener("change",e=>this.setChanged())}getName(){return this.name}setRenderer(e){this.renderer=e}getDefines(){return this.defines}getUniforms(){return this.uniforms}getExtensions(){return this.extensions}getBlendMode(){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=3200){}update(e,t,i){}setSize(e,t){}initialize(e,t,i){}dispose(){for(let e of Object.keys(this)){let t=this[e];if(null!==t&&"object"==typeof t&&"function"==typeof t.dispose){if(t instanceof nb||t===this.renderer)continue;this[e].dispose()}}}};function T4(e,t,i){for(let r of t){let t="$1"+e+r.charAt(0).toUpperCase()+r.slice(1),s=RegExp("([^\\.])(\\b"+r+"\\b)","g");for(let e of i.entries())null!==e[1]&&i.set(e[0],e[1].replace(s,t))}}var T5=class extends TH{constructor(e,...t){super("EffectPass"),this.fullscreenMaterial=new Tk(null,null,null,e),this.effects=t.sort((e,t)=>t.attributes-e.attributes),this.skipRendering=!1,this.uniformCount=0,this.varyingCount=0,this.minTime=1,this.maxTime=1/0}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=Tk.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,o=0,h=0,c=0,d=!1,u=!1;for(let e of this.effects)if(e.blendMode.blendFunction===T0.SKIP)c|=1&e.getAttributes();else if((c&e.getAttributes()&2)!=0)console.error("Convolution effects cannot be merged",e);else{c|=e.getAttributes();let p=function(e,t,i,r,s,a,o){let h=new Map([["fragment",t.getFragmentShader()],["vertex",t.getVertexShader()]]),c=void 0!==h.get("fragment")&&/mainImage/.test(h.get("fragment")),d=void 0!==h.get("fragment")&&/mainUv/.test(h.get("fragment")),u=[],p=[],f=!1,m=!1;if(void 0===h.get("fragment"))console.error("Missing fragment shader",t);else if(d&&(2&o)!=0)console.error("Effects that transform UV coordinates are incompatible with convolution effects",t);else if(c||d){let g=/(?:\w+\s+(\w+)\([\w\s,]*\)\s*{[^}]+}
5664)/g,v=Tk.Section;if(d){let t=`	${e}MainUv(UV);
5665`;i.set(v.FRAGMENT_MAIN_UV,i.get(v.FRAGMENT_MAIN_UV)+t),f=!0}if(null!==h.get("vertex")&&/mainSupport/.test(h.get("vertex"))){let t=`	${e}MainSupport(`;t+=/mainSupport *\([\w\s]*?uv\s*?\)/.test(h.get("vertex"))?`vUv);
5666`:`);
5667`,i.set(v.VERTEX_MAIN_SUPPORT,i.get(v.VERTEX_MAIN_SUPPORT)+t),u=u.concat([...h.get("vertex").matchAll(/(?:varying\s+\w+\s+(\w*))/g)].map(e=>e[1])),p=p.concat(u).concat([...h.get("vertex").matchAll(g)].map(e=>e[1]))}p=(p=(p=p.concat([...h.get("fragment").matchAll(g)].map(e=>e[1]))).concat([...t.defines.keys()].map(e=>e.replace(/\([\w\s,]*\)/g,"")))).concat([...t.uniforms.keys()]),t.uniforms.forEach((t,i)=>a.set(e+i.charAt(0).toUpperCase()+i.slice(1),t)),t.defines.forEach((t,i)=>s.set(e+i.charAt(0).toUpperCase()+i.slice(1),t)),T4(e,p,s),T4(e,p,h);let y=t.blendMode;if(r.set(y.blendFunction,y),c){let t=`${e}MainImage(color0, UV, `;(1&o)!=0&&/MainImage *\([\w\s,]*?depth[\w\s,]*?\)/.test(h.get("fragment"))&&(t+="depth, ",m=!0),t+=`color1);
5668	`;let r=e+"BlendOpacity";a.set(r,y.opacity),t+=`color0 = blend${y.blendFunction}(color0, color1, ${r});
5669
5670	`,i.set(v.FRAGMENT_MAIN_IMAGE,i.get(v.FRAGMENT_MAIN_IMAGE)+t),t=`uniform float ${r};
5671
5672`,i.set(v.FRAGMENT_HEAD,i.get(v.FRAGMENT_HEAD)+t)}i.set(v.FRAGMENT_HEAD,i.get(v.FRAGMENT_HEAD)+h.get("fragment")+`
5673`),null!==h.get("vertex")&&i.set(v.VERTEX_HEAD,i.get(v.VERTEX_HEAD)+h.get("vertex")+`
5674`)}
vendor: 12,306 bytes, lines 5674-5684
5674else console.error("The fragment shader contains neither a mainImage nor a mainUv function",t);return{varyings:u,transformedUv:f,readDepth:m}}("e"+o++,e,t,i,r,s,c);if(h+=p.varyings.length,d=d||p.transformedUv,u=u||p.readDepth,null!==e.extensions)for(let t of e.extensions)a.add(t)}let p=/\bblend\b/g;for(let r of i.values()){let i=r.getShaderCode().replace(p,`blend${r.blendFunction}`);t.set(e.FRAGMENT_HEAD,t.get(e.FRAGMENT_HEAD)+i+`
5675`)}if((1&c)!=0){if(u){let i=`float depth = readDepth(UV);
5676
5677	`;t.set(e.FRAGMENT_MAIN_IMAGE,i+t.get(e.FRAGMENT_MAIN_IMAGE))}this.needsDepthTexture=null===this.getDepthTexture()}else this.needsDepthTexture=!1;if(d){let i=`vec2 transformedUv = vUv;
5678`;t.set(e.FRAGMENT_MAIN_UV,i+t.get(e.FRAGMENT_MAIN_UV)),r.set("UV","transformedUv")}else r.set("UV","vUv");t.forEach((e,t,i)=>i.set(t,e.trim().replace(/^#/,`
5679#`))),this.uniformCount=s.size,this.varyingCount=h,this.skipRendering=0===o,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=3200){for(let i of(this.fullscreenMaterial.depthBuffer=e,this.fullscreenMaterial.depthPacking=t,this.effects))i.setDepthTexture(e,t)}render(e,t,i,r,s){for(let i of this.effects)i.update(e,t,r);if(!this.skipRendering||this.renderToScreen){let s=this.fullscreenMaterial;s.inputBuffer=t.texture,s.time+=r,e.setRenderTarget(this.renderToScreen?null:i),e.render(this.scene,this.camera)}}setSize(e,t){for(let i of(this.fullscreenMaterial.setSize(e,t),this.effects))i.setSize(e,t)}initialize(e,t,i){for(let r of(this.renderer=e,this.effects))r.initialize(e,t,i),r.addEventListener("change",e=>this.handleEvent(e));this.updateMaterial(),this.verifyResources(),void 0!==i&&1009!==i&&(this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1")}dispose(){for(let e of(super.dispose(),this.effects))e.dispose()}handleEvent(e){"change"===e.type&&this.recompile()}},T6=[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])],T8=class extends TH{constructor({resolutionScale:e=.5,width:t=TQ.AUTO_SIZE,height:i=TQ.AUTO_SIZE,kernelSize:r=Pi.LARGE}={}){super("KawaseBlurPass"),this.renderTargetA=new iu(1,1,{minFilter:1006,magFilter:1006,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 TQ(this,t,i,e);s.addEventListener("change",e=>this.setSize(s.baseWidth,s.baseHeight)),this.blurMaterial=new TA,this.ditheredBlurMaterial=new TA,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,o=this.camera,h=this.renderTargetA,c=this.renderTargetB,d=T6[this.kernelSize],u=this.blurMaterial,p=t,f,m;for(this.fullscreenMaterial=u,f=0,m=d.length-1;f<m;++f){let t=(1&f)==0?h:c;u.kernel=d[f],u.inputBuffer=p.texture,e.setRenderTarget(t),e.render(a,o),p=t}this.dithering&&(u=this.ditheredBlurMaterial,this.fullscreenMaterial=u),u.kernel=d[f],u.inputBuffer=p.texture,e.setRenderTarget(this.renderToScreen?null:i),e.render(a,o)}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){void 0!==i&&(this.renderTargetA.texture.type=i,this.renderTargetB.texture.type=i,1009!==i?(this.blurMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1",this.ditheredBlurMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1"):3001===e.outputEncoding&&(this.renderTargetA.texture.encoding=3001,this.renderTargetB.texture.encoding=3001))}static get AUTO_SIZE(){return TQ.AUTO_SIZE}},T9=class extends TH{constructor({width:e=TQ.AUTO_SIZE,height:t=TQ.AUTO_SIZE,renderTarget:i,luminanceRange:r,colorOutput:s}={}){super("LuminancePass"),this.fullscreenMaterial=new Tz(s,r),this.needsSwap=!1,this.renderTarget=i,void 0===this.renderTarget&&(this.renderTarget=new iu(1,1,{minFilter:1006,magFilter:1006,stencilBuffer:!1,depthBuffer:!1}),this.renderTarget.texture.name="LuminancePass.Target",this.renderTarget.texture.generateMipmaps=!1);let a=this.resolution=new TQ(this,e,t);a.addEventListener("change",e=>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){this.fullscreenMaterial.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){void 0!==i&&1009!==i&&(this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1")}},T7=class extends TH{constructor(e,t){super("MaskPass",e,t),this.needsSwap=!1,this.clearPass=new TY(!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(),o=e.state.buffers,h=this.scene,c=this.camera,d=this.clearPass,u=+!this.inverted;o.color.setMask(!1),o.depth.setMask(!1),o.color.setLocked(!0),o.depth.setLocked(!0),o.stencil.setTest(!0),o.stencil.setOp(a.REPLACE,a.REPLACE,a.REPLACE),o.stencil.setFunc(a.ALWAYS,u,0xffffffff),o.stencil.setClear(1-u),o.stencil.setLocked(!0),this.clearPass.enabled&&(this.renderToScreen?d.render(e,null):(d.render(e,t),d.render(e,i))),this.renderToScreen?e.setRenderTarget(null):(e.setRenderTarget(t),e.render(h,c),e.setRenderTarget(i)),e.render(h,c),o.color.setLocked(!1),o.depth.setLocked(!1),o.stencil.setLocked(!1),o.stencil.setFunc(a.EQUAL,1,0xffffffff),o.stencil.setOp(a.KEEP,a.KEEP,a.KEEP),o.stencil.setLocked(!0)}},Pe=class extends TH{constructor(e,t="inputBuffer"){super("ShaderPass"),this.fullscreenMaterial=e,this.inputBufferUniform=null,this.setInput(t)}setInput(e){if(this.inputBufferUniform=null,null!==this.fullscreenMaterial){let t=this.fullscreenMaterial.uniforms;void 0!==t&&void 0!==t[e]&&(this.inputBufferUniform=t[e])}}render(e,t,i,r,s){null!==this.inputBufferUniform&&null!==t&&(this.inputBufferUniform.value=t.texture),e.setRenderTarget(this.renderToScreen?null:i),e.render(this.scene,this.camera)}initialize(e,t,i){void 0!==i&&1009!==i&&(this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1")}},Pt=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"u">typeof document&&void 0!==document.hidden&&(e?document.addEventListener("visibilitychange",this):document.removeEventListener("visibilitychange",this),this.autoReset=e),this}getDelta(){return .001*this.delta}getFixedDelta(){return .001*this.fixedDelta}setFixedDelta(e){return this.fixedDelta=1e3*e,this}getElapsed(){return .001*this.elapsed}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=void 0!==e?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)}},Pi={MEDIUM:2,LARGE:3,HUGE:5},Pr=`#ifdef FRAMEBUFFER_PRECISION_HIGH
5680uniform mediump sampler2D map;
5681#else
5682uniform lowp sampler2D map;
5683#endif
5684uniform float intensity;void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){outputColor=clamp(texture2D(map,uv)*intensity,0.0,1.0);}`,Ps=class extends T3{constructor({blendFunction:e=T0.SCREEN,luminanceThreshold:t=.9,luminanceSmoothing:i=.025,resolutionScale:r=.5,intensity:s=1,width:a=TQ.AUTO_SIZE,height:o=TQ.AUTO_SIZE,kernelSize:h=Pi.LARGE}={}){super("BloomEffect",Pr,{blendFunction:e,uniforms:new Map([["map",new lD(null)],["intensity",new lD(s)]])}),this.renderTarget=new iu(1,1,{minFilter:1006,magFilter:1006,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 T9({renderTarget:this.renderTarget,colorOutput:!0}),this.luminanceMaterial.threshold=t,this.luminanceMaterial.smoothingFactor=i,this.blurPass=new T8({resolutionScale:r,width:a,height:o,kernelSize:h});let c=this.blurPass.getResolution();c.addEventListener("change",e=>this.setSize(c.baseWidth,c.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),void 0!==i&&(this.renderTarget.texture.type=i,3001===e.outputEncoding&&(this.renderTarget.texture.encoding=3001))}},Pa=class extends T3{constructor({blendFunction:e=T0.NORMAL,brightness:t=0,contrast:i=0}={}){super("BrightnessContrastEffect","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);}",{blendFunction:e,uniforms:new Map([["brightness",new lD(t)],["contrast",new lD(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}},Pn=class extends T3{constructor(e=T0.NORMAL){super("ColorAverageEffe
5684ct","void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){outputColor=vec4(vec3(average(inputColor.rgb)),inputColor.a);}",{blendFunction:e})}},Po=class extends T3{constructor({blendFunction:e=T0.NORMAL,offset:t=new tZ(.001,5e-4)}={}){super("ChromaticAberrationEffect","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));}",{vertexShader:"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;}",blendFunction:e,attributes:2,uniforms:new Map([["offset",new lD(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}},Pl=`#ifdef FRAMEBUFFER_PRECISION_HIGH
5685uniform mediump sampler2D nearColorBuffer;uniform mediump sampler2D farColorBuffer;
5686#else
5687uniform lowp sampler2D nearColorBuffer;uniform lowp sampler2D farColorBuffer;
5688#endif
5689uniform lowp sampler2D nearCoCBuffer;uniform float scale;void mainImage(const in vec4 inputColor,const in vec2 uv,const in float depth,out vec4 outputColor){vec4 colorNear=texture2D(nearColorBuffer,uv);vec4 colorFar=texture2D(farColorBuffer,uv);float CoCNear=texture2D(nearCoCBuffer,uv).r;CoCNear=min(CoCNear*scale,1.0);vec4 result=inputColor*(1.0-colorFar.a)+colorFar;result=mix(result,colorNear,CoCNear);outputColor=result;}`,Ph=class extends T3{constructor(e,{blendFunction:t=T0.NORMAL,worldFocusDistance:i,worldFocusRange:r,focusDistance:s=0,focalLength:a=.1,focusRange:o=a,bokehScale:h=1,width:c=TQ.AUTO_SIZE,height:d=TQ.AUTO_SIZE}={}){super("DepthOfFieldEffect",Pl,{blendFunction:t,attributes:1,uniforms:new Map([["nearColorBuffer",new lD(null)],["farColorBuffer",new lD(null)],["nearCoCBuffer",new lD(null)],["scale",new lD(1)]])}),this.camera=e,this.renderTarget=new iu(1,1,{minFilter:1006,magFilter:1006,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 Pe(new TM(e));let u=this.cocMaterial;u.focusDistance=s,u.focusRange=o,void 0!==i&&(u.worldFocusDistance=i),void 0!==r&&(u.worldFocusRange=r),this.blurPass=new T8({kernelSize:Pi.MEDIUM,width:c,height:d});let p=this.blurPass.getResolution();p.addEventListener("change",e=>this.setSize(p.getBaseWidth(),p.getBaseHeight())),this.maskPass=new Pe(new TF(this.renderTargetCoC.texture));let f=this.maskPass.fullscreenMaterial;f.maskFunction=1,f.colorChannel=1,this.bokehNearBasePass=new Pe(new T_(!1,!0)),this.bokehNearBasePass.fullscreenMaterial.cocBuffer=this.renderTargetCoCBlurred.texture,this.bokehNearFillPass=new Pe(new T_(!0,!0)),this.bokehNearFillPass.fullscreenMaterial.cocBuffer=this.renderTargetCoCBlurred.texture,this.bokehFarBasePass=new Pe(new T_(!1,!1)),this.bokehFarBasePass.fullscreenMaterial.cocBuffer=this.renderTargetCoC.texture,this.bokehFarFillPass=new Pe(new T_(!0,!1)),this.bokehFarFillPass.fullscreenMaterial.cocBuffer=this.renderTargetCoC.texture,this.target=null,this.bokehScale=h}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){for(let t of[this.bokehNearBasePass,this.bokehNearFillPass,this.bokehFarBasePass,this.bokehFarFillPass])t.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;return TS(-t.position.distanceTo(e),t.near,t.far)}
5689setDepthTexture(e,t=3200){this.circleOfConfusionMaterial.depthBuffer=e,this.circleOfConfusionMaterial.depthPacking=t}update(e,t,i){let r=this.renderTarget,s=this.renderTargetCoC,a=this.renderTargetCoCBlurred,o=this.renderTargetMasked;if(null!==this.target){let e=this.calculateFocusDistance(this.target);this.circleOfConfusionMaterial.focusDistance=e}this.cocPass.render(e,null,s),this.blurPass.render(e,s,a),this.maskPass.render(e,t,o),this.bokehFarBasePass.render(e,o,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(i=>i.setSize(e,t)),(a=[this.renderTarget,this.renderTargetNear,this.renderTargetFar,this.renderTargetCoCBlurred]).forEach(e=>e.setSize(r,s)),[this.bokehNearBasePass,this.bokehNearFillPass,this.bokehFarBasePass,this.bokehFarFillPass].forEach(e=>e.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,1009),void 0!==i&&(this.renderTarget.texture.type=i,this.renderTargetNear.texture.type=i,this.renderTargetFar.texture.type=i,this.renderTargetMasked.texture.type=i,3001===e.outputEncoding&&(this.renderTarget.texture.encoding=3001,this.renderTargetNear.texture.encoding=3001,this.renderTargetFar.texture.encoding=3001,this.renderTargetMasked.texture.encoding=3001))}};new iy,new iY;var Pc=class extends T3{constructor({blendFunction:e=T0.NORMAL,hue:t=0,saturation:i=0}={}){super("HueSaturationEffect","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);}",{blendFunction:e,uniforms:new Map([["hue",new lD(new iy)],["saturation",new lD(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(){return Math.acos((3*this.uniforms.get("hue").value.x-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 ir;var Pd=`void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){vec3 noise=vec3(rand(uv*time));
5690#ifdef PREMULTIPLY
5691outputColor=vec4(min(inputColor.rgb*noise,vec3(1.0)),inputColor.a);
5692#else
5693outputColor=vec4(noise,inputColor.a);
5694#endif
5695}`,Pu=class extends T3{constructor({blendFunction:e=T0.SCREEN,premultiply:t=!1}={}){super("NoiseEffect",Pd,{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}},Pp=class extends T3{constructor(e=30){super("PixelationEffect","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));}}",{uniforms:new Map([["active",new lD(!1)],["d",new lD(new tZ)]])}),this.resolution=new tZ,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 iy,new iy;var Pf="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAAAQCAYAAACm53kpAAAAeElEQVRYR+2XSwqAMAxEJ168ePEqwRSKhIIiuHjJqiU0gWE+1CQdApcVAMUAuARaMGCX1MIL/Ow13++9lW2s3mW9MWvsnWc/2fvGygwPAN4E8QzAA4CXAB6AHjG4JTHYI1ey3pcx6FHnEfhLDOIBKAmUBK6/ANUDTlROXAHd9EC1AAAAAElFTkSuQmCC",Pm
vendor: 6,469 bytes, line 5695
5695="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKAAAAIwCAYAAAABNmBHAAAgAElEQVR4Xuy9CbhlV1ktOvbpq09DkiIkUBI6kxASIH0DlAQiIK1wRfSJTx+i4JX7vKIigs8HXpXvqVcvrcC9agQ7IDTSSWgqCQQliDRBJKkkhDSkqVPNqVOnP+8b//rH3P+eZ+199tlznVTlvVrft7+1T7OaueZY42/m37QALKNk2wHg1pITlB17mC+Pp11W3X/LHyT32vhg48/5SOv+PnwpsHA70JoGlueB1iKApeqzvOzn44GatTB76Xzhd7suBR7+WWADgDEAwwCG/L54b/poDLrHuvvm70Z2Avhsc+PVcxscBU8F8C8ADg5+ipIjD/PlGwfgju8B924E5seARUfLsiNmqQW0IjL8+7L2NYD/7COBzfcCm+aB8SVgdAkYIRCXKyDax4EdAanL5PuNPllNvXDlAHwFgP8AcC2AhRIoDXbsYb48dl5WkVFTE3LGDcC9m4CZCWBuFFgeAZaGAYJQQCRqDHT+McJrVb8zwATUXH02MHYfMHEIGFsAxgjApQqACYQORjtd/B7Axt/z79sC0+cMPgjjlwPwVwHcA+DfAHzTxcVgWBroqMN8+cYBeM71wH0TwKExYHYUWCIAHYRLTlkCYgcIBcAgU/n3qy8GRu4HRgnAOWBkERhddPAJhGJDBxkvw7cqimr+zFM/ZLnZF64cgL8BYD+AWwB8x/dlWuWagHiYL984AJ/0RWBy1AE4AizyM1yxYAcTigW55xMbAkxEiwEdkJ/ZCQxPAiOHgBECcKEC4TBZcKkSv+mTieNcNPNC26mLNsj45QD8LQDTAO4GcJt/7iw2bfoG4WG+vAGwm9ExiEg69zpg/wgwPQLMjgALzn4E4aIzoJjQ9g4024uygkj+pyuAoX0VAIfngOH5NgCHMhAm8Sv2y3XDZeBhNIp8OzJE8OsBzAKYBHAXgDt8/4O+MVT0j4f58o0D8Pxrgf3DwMwIMEPQEYRkNwfgsuuDZLskip0No0gWMD/9HGDoADAkAC4Aw/wsAgZAgs2Z0ABI0GU6IVmKv+f28KDnHxkA/G0A8y6G73N9kOCjXnh/Ebb6OvgwX75xAF5wLTA1VIHPADgMLDj4yIA5AAm6aCUnv4oz46eeDwxNAUMzwJAz4BABSNDFTwSfg7DDKHE23MG5PqIY8A1u/dINs9dBdy8AgnGPM2NfUBrsnw7z5RsH4IXXAAcJviFgluAbygBINnSLWOAjGxJ4pgOKDV0v/OSLKp8iGXBovhLBBOCQM2ACoTOhnYrAdItYbCij5JFzRyIAqRccAnDAQUjg6UNQ7hsMXP0cRQAexss3DsCLCECCLwCQzMcPwUi2MwAScAKbfnY/YRLFQ8DHX+IAJAMSfDkAF13kLvleIjhjQQHxUVS3jjgGpKeeNzYVQEjgUS8k+PghONdhIwAP4+XXBYCHKIJbwJyDTgaIAdCBJx3Q2M8tYAHP9m4df/ylQOsQ0JqtRLCx30K1wtLBggScQOgsKBGcWHAJeOwRC0BSM1mQIKRbhh+Bj98JQP6t4U0APEyXXxcAEnxkQAFwoVUxID9kvQg+c1C7vidRbIDkc24B//hTQGumDcCWA5DgMxASdNIFBUI5pCML8v8API5zfEQx4BudgqiczviSnJhQwCP4BMCGl+wO8+U7AJi/W4O4YS6+pmK/2ciADsAOBhTIIiAJnPB7AvNjP+0AnANaYkAHX2JBAc+tYaJXOqBZv24Vc386XW5dtkHGW+4HFAJonpOe+YYQZAShgKjv3PNvPQaxVoI8zJdfFwASfPzMUwS3Kt1v0UFIlos6oDFdAGFcliMAP/ryAEAGNwQRnDOgLbdlIEwrIs6AZ/QgkMMHQF6ZAKQcJAsSYPwIeAIk9wJgoPK1gi7+PwF4GC/fOAAvIQPSs0URTPBJ/Pp3GSEGRHfBCIQ0xowBtUbcAj7ys5X4Jfu1HIAGQrIgQRXEsAFQIORDFhiDY/rMHmrU4QUgR08AkgUjCAW6CD6CkwBsAIQC4GG6fPMA3OXiNzCg2I9gNCMksmAAoemDzoimFwL48M85AKkiuQVMAAp8CYRRDAt8GQiJ67N6GJODAXAHlsGguscA2AJg1IPGYmxOpBxFWkRN9LsATgIwXnNs/v/5z/9XCf8BO3YAtxbc/46/KDt+5+ea1Yku2VUxHz/z0v24FwMGK1gWsK2OUUxHHdCBeRUB6OxHABr4ZICIBd0QWSF+XRdMTAjgCdTrG9cBNwE4F8CpDkICyYLGsuhFt6zs+gISwUen8zEAjgMw4cfx2H6O/90yAFo84Cbg4ID3/9TfLTt+5+ebnRABkODjx0SwPi5ec/FrYpmqSAxM8Dn60CsqAFI6GfhqAMiDE/gokmvEr0C4PgDkBQm40wE8zMFEUDKEVoxIMLl/KS73mE7H9d+vcKHQQcjwW0Yu9nP8m8sAmOIBuWY6wP2/4s0ezjjg8TuvaR6ABJ70vxUApGrm7EbGE+i472BAB+WHfqHS/eoAaEwY2E9+wLSXTqhI7CXgnB6LCoOJ4BiST+hTnG0HcCwAglCx3ARoZEVFXnBPp/O/A/hXACc7CPs9/i1lAOyIB+RDX+P9/+pbQjjjAMfv/PL6AFDs1wFAgs/9fgKfgdE/ZEpuiQlbwAde6QAMBgiRmsSwA9BY0JfjovGRDBMH4TlcXGhcBOc6HkF0gjPhZgchxTLZMAci/04W/B6Ab3t09EPXcPyflgFwRTwgJ2MN9/8bf5qFM67x+B/aW4XQz42FeL0YrRyikztUFw0704mf9kXgxhOAqc3AAsPyRxxQCs/PdXOFY0W1KHy3QIUGtx+6vdnx1vsB+dsTncm2AogglFgVEAlUWrOMB2RyEmMCGQ/Y7/HvKns6tfGAnJQ+r/9b76oJZ1zD8WdyQjYBh8aBhVEHjELouQ8ukQ7VRSCJAALwkr+sALhnGzDD3JAJYJHg9uhoi4bx8ytkWUtvHT/7+Zc4dw1uZ3612fH2dkQf7yxIEEockwkJQn4IQoq8unhAhmPRKKFx0uv4K8ueTs94wD7u//VX9ghn7OP4c+4G7h8HpseB+dF2AKlFLwuAIZ8jD6NPrOhAffmfA9/ZBuzZCkyRWSeqBCWyoYGQ5yQrBpDbum/ME1HoPo0XEkSD2zlfbna8q6+EUJcTCxKEtHL5EQjP6BEPyIgYAZBvYt3xHyx7OqvGA65y/7/9wVXCGVc5/sl7qxD66dEqiYgRzAqhN1A4CBNAAlDyAFI+iZ9/N3DLJuC+jcDUBmCWyUnOrmTYCMIOkNclLg0B8/RsNLg9+UvNjnd1APLmmQpFHyEBROuWACQT8nN+H/GAvY7/VNnT6SsesMf13/CpahGnZzhjj+PPmwX2MYdDIfQexWyBAwEUOQDrRDN/98p3A7dvAO6fAA5sqHJDBEAyoUVGkwEd6HR12XU4kwzfl6fCXTZzjy57vvnR513X7Hj7AyDvggAUi9EyFgiZqNxPQF6345nOWbD1HQ/Y5fpvuLa/2+82/vNHgAPDFQDnhoF5j2C2qBWCI8bw1eRw5CL5l94L3DEOTI4DB8Y9OWmsEu/zBJ3rgsaybqBob/7A4C7jtWcooRrczr+u2fH2D0AOQgAUCxKEP7aGgLy64+m6KdjWFA9Yc/03/Osa4glrjr+AupqHz1sEs0cxG0BC9HIePLoit9eNkVf9L+DuUWByDJgaq4ybGYLPAWgiXmLedUE7dwC7saL7CqfPKXi4NYdaykCD410bAHlDEsNiwZ9wAPYbkJcfz6T2gm3N8YDZ9d/wHxUA+739fPwXPrSKYGb+BuP3jAFDElFH9HIWwbzCIGkBr/or4J4RYO8oMOW6ZVcAuvi1Cgoha04BCwT5gfMKHm7NoRde2+x41w5A3hQZkADk5+cGiAeMx3+/7AENFA8Yrv/G71cAXFM4Yzj+otOAaQLQA0gZxaIIZtMDFTigKJV8H9Iq6aZ59ZXAvSPAvpEKgBTtBODcSCWCZeRYtpzrmLyeGNCAyFl1v+Hei8qeb370Rdc2O97BAMi7EgB/2QG41nhAHU9LuWAbOB7Qr//GPRUA13r7Gv9FZwIMoVcEswEwfDoimEP0shKKtIphaZQAXv1+YM+wA3DEdcvRKkGJADQQEsQuhi1Tjt95vBsh5nx2IO59SsHDrTmUOStNjndwAAqEry0IyCMICkOyiuIBNwBvPFQQT7gBuPjc9oRYAIHyOEL4vIFEYVNaOou5vCGE/tV/A0wOVcnpzI47NOri3QFIBpSeaSDUdYLOSWvYImSGgftpJDa4MWJbAGxivGUA5MAOc0Be6eVLj7/4Mk+hzCOYPYpZDBiNkLh+G/M3yFyv/ltgL3W3YQfgcFUhgRY2PwY+Z7/EhAR1SFyXCOb57r28QfQBsJQBMn5D4y0HYLPje9Cd7RIC0PM3EiMofF4gVCBp1P840ix/gyz56r+vAMjk9Gl375iB4+CzveuZdLkkEPJ8ZEfX/6R73vOjzT5Si9hucLxHAVg4PwJgRwh9CKOXK8YA4ZEqKZXSQWh5P+5AftXfA/uGKvYjCKn72cctbFrZNECka5L5CPwIPtMH3TVz17MLB5gdLgA2Nd6jACycHwLQxFEUSR5ASvARDB0h9AQb9bXIgCGk6lUfAPYTgEPAITKgg1BObk58srTJgG58WMkWMaAbQQT1nc8rHGANAJsc71EAFs4PAagQestgC1lsBJ4BMCSOK6dDUcwqqaFiQr/0QeAAAdjy+jBiQQeeMSBZT3nCPUDIa9z+/MIB1gCwyfEeBWDh/BCAeQSzgkjFfGLBBD5nxQ4DxN0wv3hVxX5TBGDwL5obxvVA5YqYL5BeMLd66YYxJpRB0gK+96LCAdYAsMnxHgVg4fwIgMrhUPKQ2C+Bz0PmBTqBMQehAbDlIjj4F80KJguSVZ0FuXpjoCOgXawLjALhbT9eOMAuAGxqvEcBWDg/l1IE05Ed0ygZnyHdz0VwCqEPIfNyx0QQvvLDFQCp+8nfZk5und8tXwIgWcHSNX0N2CJmnAl3v6RwgNnhl17T7HiPArBwfghAS7mV/hey2JS9FvM3BLpUUi1YwDRMXvkRYJoAlAh2l0dcZ04s6JUTDIjyBcrl4yDc/dLCAdYAsMnxHgVg4fxwKVwJgGEJNmWtxpQMpX9on2eRhVA+O56AjMfnP+e3Xvf3NwG4xIPTleiY55bpGh6UbafNU0l0z0p+5Jh5HqYJ6b51nP6XP8cx12XNHQVgIQB/bFPVg2OC7Q+WgVFWng/FvtWLI06uWh5oguKEcXVS/9sEAF//VGD7t4ETDgJbF4CNi8CGZWBs2fPL/H6Vwp2KEtVk4fJ+v/EIYPN9wKa5qu+IncfPwXHVZe/aOL3EbwS7xv8A1rQvnO0j8PArTgTGZ4BxFv9mIxhOCGsv+0OPYDRghcLfkWkEuq0+G00x4OtfDGz+d2DbHmDLjL8si8AYP/7CGIAiEEMTG92zXqSbH+d9R2aA0XnvO+JjthiIrOVDHHPOkBrzUQAWAPsZp3oPDpa/Xag6EVkLBK+5rAnJC3/nYk/APD704WiEAV8OTHwX2LQH2DgFbJgFNrBhjd8r79deGoEwsllgNBOzy8CdjweG9wBj08AIAci2D6HafmyAk4/Z7SJ72hGYRwFYAMDLTwOGp4FRFgD3HhzqRGQiyeurqOdG6r0Rm8IEZjzRlkiqCWoEgK8Axm4BJu4HJhyAbFhDxmbDGnZO4j0SgLGDkpibgEq66TJw/1nA0F5gdLpq+zDqFfd5LMeWqu5HNST0uJOIllg+qgMWgI+HPv0xwLA3gWHpW2sC441gCECbmKziaGrnUdMO4aHeh6MxAP4SMHI7ML4HGD8AjHvHJGNAgpDgY/ck3stipRemvVhc+uASMPUEYGh/9dIRgGx8Y+MNbR/00uVtH0wEx94j/v0oAxaA8Ed+GBieAYZZg5kADC0QWGOFzGJlcGPzl1BxNLXD8sk4xftwNAbA/wwM3wGMUmxOOQBnHXzetIYvibonmSiuYTNjriVg7glAiwBk0fNZH6+PmX9P6kfNmCXGpftJ7TgKwBIAnln14BAAYxMYm5C6RjCyCoOyr0qkD/c+HI0B8DXA8N3AyCQwesD1VQKH7EcASm1Q+y4CkN9pUKiVF5nLvy+fBbTUd8QBaH1HvNBROiZvfsNnrF4kcvPwpdsBLBeU18Nf7AB23Dp4ecHC8oBgUlJJecLS+7+WOpE3gbE+HKw+yoevCYkMGKqPJrdEKARutaFYRs1fiEZ0wP8CDN8LDO8FRqYq3W10pgKgfYLaYCzootgA6KXaTA90y374TKB1sBozy77xHFZ536utRgAmEaw6g5kUSFZwSXnA330qsOlfgHMPDlZesLA8IOjoLypPWHj/11EnCiVwkz7kAExtsGraYUWdSDX5TmsagL8KDBGA7Bd30JsW0oWivnEOQNP7yGTSB
vendor: 60,312 bytes, line 5695
5695R101AlZSUtGyfgZDkCWY1HnJdcBVe6325hTvelg2CQjZNDygG/2An0j1wKnL6y9vGBheUC8prQ8YeH9X39OVQSc7Mc6fCaKvAeHdCIVf4yMYCynTpX+nb97NJmlSQb8r8DQHm9YOFUZTKOzoXGhs6AxF0HIexcLBvWBuiHN8s2ne98R3qc6L4Vyb2oBVjfm9MIFHbjDCh6kPOBbQoG+oW8CO5bWVl6wsDwgfr20PGHh/X/1iaEIuDcCTIW/1Q4rFv8OnYiW3c+W2iKwUjKbyjQNwL1uuR6sAEgDgq1brXOmV81PxhNB6DUDBSYzQJwFtz623XcktX1Q1VWKaTF/zZhVazBVYA1tX5MazsGvobwe/jQr0Ne6BTh5uf/ygoXlAfG60vKEhff/rSe1i4DnTWDUACY1guFTDqLYdCBvf6DJYSMYATBfOx1kLfj1v1axH10nQ3Sd0GUkBnTfpemtBJgseIKQAHLQcVxa2TnuMW0Aqui5es8xBIegVdVVE8VhzHnLh65WMB9An+X18K6aAn2tO4ETl6vqbKuVFywsDwhevqg8YeH93/Rk70JE90nowxZbIJjvS3WYNSGUwGHJTpPxwwcbBuBrgRYBeKACn7VtpdUu/c0NJxO9BIxcKu4TTODzbkonPLoaL0vyUQRb2y8HsL1ckfWzMeuFi40Qezqi+yiPhyt7FOjr6/gCFwgP7Xb5vssTFt7/nQRg6MGRWmDRoeyTlpgw68GRTwgZgo1gGmXAX6/8dtaylSKY/koyID9BhzML3q1gAos2AcOrZYSoq/pJp1VtODRm9Z3LS/7WjVkvXOzEtOpKyGrlAT+4SoG+VY8vBGCvy/dVnrDw/vee65NBJiAjBIVcAJQjOm+DkCZEeiGAMw6sAwDZsJrAdhFM9rPGhd4904Co5oVuCZPV6kD40Ec6+9W8dBTBsfdc3nkpvnB82fp2RPcs79dHgb51LA9ofsDV6vut5/3PnxcAmLVBiDqgevDaJLkYrpuQxzcNwN8AWgIgRbB8loEBzXDwl4cGiDGft58SCOWGedgjvOJ+bPvgRkiuA+ZjzhnQQOiFNVbloa7l/fos0LdO5QENgEXlCfs8Qbf7HyMA3QVjYihYhLENgjX9y/qwxQmRU/asfd0ZcLU2CHVGyusJQLKfVi98CS12T5f7iECkHpsMkAhCF8+nshWH2I/jXsOYO144GV/9ApAIrS3vt4YCfetQHtAA2G+/4PW4/2PPbzMgmUMi2NoeSCRxIt2/FvuxWURIWCXg357gfTjEDNIHnTRXRCpH5ugKwGl3HpMBXQc0v6WLYVm/5limj04rG762K2uYY9jBkr9+rI03NL5ZbczS/dJ+LQyoga4o77fGAn0NlwdMAOy3vl/T938KAcj121z8Bn+Y9eWQJRz8Y6kNagDh2ey5EvxjxQD8TWdAuneCCO4An1vw5vdzQMmdktwq7pLZQR+dM34+ZumAxvY1Y04uqOAJ6FsExzeto7zfAAX6GiwPaLWR1lrfr8n7f/Rl3QGzmsis+/uO71V9OFgP2gpPhgr7TGRqRUT6dyvr4aIs/pm/2zVUNbBSv6G8e5pEv0Cvec7Po7+bTtjlBRlkvAMBkDeQyvsNWKCvofKACYBrre/X1P0/oWEAnnFD1YdjhtXxR73mX10FfCHHE9pVWcGAI/S0gKsfA2y+twrFZw6Hxf/F0Pk8Ri/kpGSnMuDx5T0iACgQHioo0NdAecBUHW6QdsV2/cL7v/Cyqr5gnc42CCOcfX1VIZ/V8We9IDmTzVXwPDJiXuKXPxtDBma8+lzP4WAgKkPxCUAPE4v5GzEuMX0PYJPLhB6FJsc7MAMmkVxaYC/K9gG+F1++8AQ7Gwbgk78I7GFpXgIwFiRXOwaJZPUbiR0yCUDRk+cHf+YpwMj9HgfI8ClGPyvsSiH0WSKRuYlitLb/zHM/JOSs5C/YIC9cMQDZr/dwxgOW9gtGYUBi0wA8l304vDQvAchilFbpIBQhZ7Ejq6ZQ0/Yhil8y4j89Axie9DAsD6FX9HOK3QtROTFkviN83kG4felIY8DCeLrSeMDSfsEovAECUFsTjHD+tcB+tkFgcXKvBRir7qtFl9owmO4Xy/1G3bAFfPrZHorFNWBFwHjQAFctIghj2kBarw06If/+MM9ZqTN6DgsDojCerjQesLRfMApvoGkAWh8Ob/tgAPSKWCp8ngNQtadjmTdltvNvn3peFYhgQQgh+iUmEaUAUoXM1yRLmWuFLaE9Z+XIAWBhPF1pPGBpv2AU3kDTALzwmqo6qtVh9kJErAudABia38TC5wJgS2xIhAwBn3yhByL4EhzXfRXxYsDTJ4IvrNN2JFMxZcBzVo4cABbG05XGA5b2C0bhDTQNQLZBYH1AVsQSAAU+imI1obHyblnjG/kJk3U8BHz8xVUQAhnQIl5CyNgKAGp5LKSSCoAySh5Jj79vTagcxUaIBeRNe79g9gq+DXig4wGzy+PONfT7RWFA4noAkGXZVAhcBckJQgNgrLiaNb3paIDo1vHHX+oA9LQBi4DxJcOUPJUnTgU2NJUyROs8irGARxQAC+PpCtsFd40H/AEf0gMQkLgeACT41PiGoLOKqyrJq3K/Ya9mNyr5FusN/uPLPIeDa8Bc+w3rtyl4VFHaMZc3i9RWBM9jjzgAFsbTFbYLRmm/YBTeQNMAtD4cBKDXBTQGdAB2MGBo8SCLmEuS1AFVAJ3A/NhPt0PoCcA8bSDG76XI7aySg6JYuGfKwJHFgH0E5B3ueMCe/Y4L+xVHAOZ+9EHcEgQgwbeiEYx6jwTdz4qfu7EhEJqxGqruf/RnHIAEnxgwBM0aC8aUAYWNBRCmoIll4HTqO122QcZbrgMWxtMVtgvuOx6wa7/jwhtoGoDWh4MBJ16WN4lfr8AqI0TVV1O1fa9BbQzovkAy4Ed+NgCQUSxZCFWvCOaOFREXyUwZOPIA2GdA3uGOB6wPaOz+QPv5S+MA3OXiN9aclghW+d3IgupBF2pPqxcxGenDPxfSRh2ASiKKiVP2PaZScvAKoA0VDc6cOlIB2GdA3uGOB1zR77iwX/F6AFB9ONSOQW0frA50sILVcckWJyIDSgwPAVcJgFbYuZ3FJvAlEHbJ3IsgJLGedeBIA+AAAXmHOx6wo99xYb/i9QKg2iAIfDJEJHqj4SExbEty0gkdhB/6P9oZbBZIGiKYVb9GKaN50lRHBLOvhDxh/5EKwDUG5B3ueMB2QGM/grb7/6wHAPNGMAY+GSGUjC52VX2f2CD4+HO0gqkZfegXKgBaHkcWtS0AWii9xG1ImrLlN5XR8L8fmQD05BVrmEENmpYSP9QX+KHiqj2/82+HqqDWwnbBRfGATdzAegGwru2DpRq7Mzq2fpAf0Nq0Rl2wBXzglZ4yUAPAmDSVWDBPHQjLcgTqOZ6zUvdKHh4ruDCerox/Dnu7YqwXAC1NI/QcEQuK6WK/kdgCTGC0PYAP/KIDMBgglq+hIkrOfsaCviLSofcJgJ5AdM7kkSaCj/HqQKVIGvD4swF8bcBjmzjsaQ2H5D/6acBd9wALB4DFWWB5AVherMp4GKIYEOp7+26UF0aSfT/xYuDG7wDjrIpAERytXf2vajj7ueryQXSFl10K/ON3gIWDwCLvjfGB8Z54O+Ee4ve6513uB2R1yzsqC+twbC8HcNVhfAeaBuDP/TvwtS3A/ePAIfYFVlPq2HHTuyulZCTlhbjhETF5yxTQGgPGhoHhIWC4VSXGD3n0tLkMHXHxu+YyB+MlPwDuZs5K6FlsbCzdVO9DuKfkHM8AEkP7B8fOkwDcD+B7np42+JkGOvKdAL4E4K8P0zvQdET0b14D3DgB3D0B7B8HZka9WzrD88N6sFm+YcUjrn7E1ZDvMtF9DBgeAYaHgSGB0PNHCD4BLwLRsByAyX/ij0/dDUxuqlIG5hix7eFhvLcOVUAtyPSydAFmOQNe6EYGV/9ZESiKgIEgtbaD/gHALQC4ovY5r5KwtjOU/XfTAHzzLuCmIeDuMWDvKHBwpMoN0WQzNtAaYSs0K4ZlOSAjGG9kPjCBRwZ0ABKEBJexYAZEAU3A7Oi1BeDym4EDnjQ1TwCGWMW8MXcKks0YOyZNlQOQjcgYIUHllEzYQ0ktm+r6oz8G4F4AXwXwRd8/kO9A0wB8y65KmPxgGJgcqYJTKYpTv2CCzyddQJRDOjKivn+Deh8BF8BnwBtaCUA+YYEyAU8h+c6Az9gNHHRmrgOgmDA3jHQ+iWupCeUAvNSrA9HNwqx+muk9nJVNg/CTfrmbAPwbgK8D+PcHkIibjob5o13A3XypWsAkG1cPA9PDFQDZM1id0i1KxsWfOrKnAFXlifCFFMMRcASigOcs2MGAIfE9iWXplS6On7UbmPaUUTXQrgsVMzcRj5Folg2V5ayUA5BWYKwOxKUafnosWjcJwk+7W5F2EKvlE3xcXaNYfiCYsGkA/smuqug6hcleAnAImPbO6YwRpMgjCAVAm/yQmKTv5hNsAf/i7SyNBSl2a8Qv/4/M1yF+BZSYlNQCnnVrpbC+mToAACAASURBVJcaI7sOSEY2NpaDXLqpR+vE/OVksDgImgGgghHoYJbTWc7oJtFWc65/cg2AYvh2ALsB3AzgVv95nS/f4QdsIkT9T3cBrGtITWZfC5hqtQHInsEGQn3UDDvEDEY/ICf7SxMOrAg8T+c00JGkvHGd2DABUYZIAONzCUDppCFhSukCBsLQrFtZe/IixYQpSyEoJoqnuPWrVRAubQh83HNlZB23z7j1ywmj6CIIqUPxw2Xeu9bx2jx10wz4Z7sqTYZaDD8EIDuoE3hMVEphWg66JIp90k0sBxBcy+iPIIaT1RtEsHS/yIAqw+VSNPWQfe5tlVEk8auXgVa5BUsEJuT5uoliAbE5AGotmIAjCPnR9xDG3TQernYAUupTdBGEFMf83OkApHG+XlvTAPwfuyrgSZOhas3u6cwTsUBVn2gTwyFMi8wjHZAA1M9fYGHDULJD1m8Cpa8fRxDad+l+Ykf/3XNvd11U+qiL39SxXevSsshdDFvgbI1O2AwAtRZMZzTBRuDFjxe1Xg8QEIB8yyj5yYIUxfQIkfkIRnmHCM712JoG4FsdgHHp3ACoMH2G6jM4lWzoQarSvwQ6MSB/vporVaFkh+mCLlpVR8Z+dqDZLoDOpHSiQeAFDkBjPrlgCHgCUaFifg67H/9uYjn4Ai1vpTERTAASBaoQJBAKeNqHlL6mwPDZYAOROag/EYRkPX34MwHIvzW9rQcA+TLpI22G7EcQKlJGsYIJhC6ClUMiXfBTbFUQAej6nPS/OuAl9pOOqIc2BLzg++3VmWgIEUz82cRuCAtLIHQQm0gO52uOAb22sC3JEWgRfPpZf2sQBQIgLydPEIFGwPEj8MlF2bSbsulghLftqsCXq9HGgHysznrGgi5qzTUTFH8FLhAUn3hIJwCN0HLncw37qaF2zoYvuKNivmQIuUNc7GvWt6sHNs26twA6vhyq8NEMAHlyntFrDCcQehyaPTl+FwAbXDcmAKMRThakEk8Q8kPg8SPL0qzLBl+A9QCgR6uZGs3vfHz8TtBZvkgGQrEPBVAUg2Sij50QAOjiVKI3saADJRm7dSLYWfSFDkCem/dhZeMy9pPY5QvSDYQyUJoDIK8qMezh3wY6fSL49PcGgCAA8pScJLIgAUYQEmz8RPA17StvGoBv39W24eREiBoNQSgWNI1HBkdgxJSw1AI+dFIbgOYmkjimQ1r6XXC3rAbCHycAgytohf8vsB/r2KRaRq7zpZ+D37HMX0s3DDcCUGLYaw53MJ4YUODzusqlGCQAOQCejuxA8UULUkxIwAmMAp8Wa3qkN/R9W+sBwOhIEPjk5SLr8HeKFbTQfb77csPIMHGl/4MPbReslPhNe4+MiTpi9AFGV4nI7MfvagNQLh/pfrYnDAS8aJQ42A2w4em2cAyWQUuJVQTGWLs1uL7DG9J1RjhA+jvYk4t3KXeMqijpzrud4At9z3XtP16yGfjKZmCGooYh1tZzvv8xXPFl4PoJYC97k9FlwZWD+Azi/deMZWeP13eQCGEyoERudChIjbb3mJYwH7V0QIKuCwj/gfMj0asn2I0FXRSHXfL/iRkNgLyeVj8ccMY//J1fyxzTAXT2+xoQViKYD/1hDqLxPiYxTgSvQrphphG97tz4Slqafnj7uk1kIQDZrvWTw8B3jwEW+RLxPgSiCERdPwPR7+wCPg/gulFgfruDkOMQkFc5x84e708JAMmCuRNBXi4TIg5CGRzGiBGE/D4E/C2r2vcAYJoify62i0aJSMhB+2IHoNwu0fkcjQ85pu3ack5nIBREqneYFyWLkAXIJHESe00Cyx5QyeL6F/tyEcDcrOW2n7fX8df0mME+/vQ/PQjhoy3gzo3AISYf80MQaQx1peH9wb7v2mrtmCBkIMMejp3jIJD1MsaxaMZ8v5N/67INAsB3BAYU4JL4DSo1J15AFPAEwuQHZJzkKfUAtOHLJSOQRWndBYQvCQA01cfnNopfsaCJaD2baBn79QjSTiOEP1EcawIpkq2kegBTNgHWEpOKF8Uwq2NRFPM4AqCf46/rA2U9/uVDvurB01zvAJpiiwOl3fEeciCGF+Ij11f+QkbSfMPfIzqw57mEFZ9Dl3Ps5HXWAYByHJAJKV7N+s0cCQQhwSlfm4lGZ0KB8C/rABgZUS6ZHITBSEhCowUYAAksF7cStWREyxRwtuPpOlgw+5s9sq6OaIJIIlUgEhA1edoTgHxa9HVw5jibZNF+j/9yGQA/7pbujZ4bwv2+cWB6tFo0NzYnkxFA+cvEAo43VBoEo2e+48EMXEOmD9F6xhCE8RwZEJ80VblKvDlmzwicfqy93/o+8K8TwB2jVSgW138FrJQTXBNlnJgmrjZwanow9CBP/rL9wF0jwAGWDtFyoN9PHutnIHT05mPXz93dMGQAPniJsjiBXiTbxDZFMF9NLUPQxKR5qezz1Y6/YZDH0D6GkdAkYJIvRalAdHAMmPZoYhb6NhDWvEyf/ma737CXN7R1ZC7hUbPgcFgqt/ZZjADnM1xqEVhYBpb4CUk5UsL7jQvj///5buDrLeCOEeD+YQchYwG9VIfyg1NaZszFiCH6DkRGLze5/dgk8IMWcMCjdCiCzR8od1B8OTwvJM8JEShFut1fzMhi+eRJr6LI7hYP2M/xVLwKNoZjUTwRMAQQmYyhWGQxsSADOflZ4kukj7PhZ75bETjBpkAGahMkcrGgwhsXeCyBHBj1wmOBQwvAwqKzoFeRV8ZaerjKYAuirmPY/o9X7q5Cyr7fAvYMAftCPGAEoYlBiVtFwLjtp2U4irj7yOANbi+crHyrfCbTquJV44O0F1FrwQGIMZFqdQDyP/gGSZ8TC0ZRRsOlVzzgasd/u+zpMByLehAfCgMQCDyGZJHFCCgLZ2f8mgI5qauEcVx9e5vACTgCTwEMWr5TdIpWKJb5MvrnoocDswvAPAG4VLGg6UKeqmi4iuDz4er30oX0FP7u5moMvIf7W8B+jwlUNAzFnlZCIhvGFRCeWzrgXSSIBreXTFZSgVLHAp4UHOFuociEEsn2PJwl/XEk0dzfSojeerFg1IOo5BKAveIBex1P67lgUzgWQaJwLAKRH04i14ItgDKEtGsRnWx49b2Vkk9wUefTGrKCF7R0JxZMqxN8cmPAxWcAcxGABKEAKPA5u9lEaAbCmKMI+sDN1X3z+ro24wEZFc0VEE64ABgT180PF9ZdBcDb6JpqcPtPk+1ACbmKjJnllwyuILunEAWjZHkBsrsRUnfD0qEiC5IJfyisgMhzWhcP2O14Ro4WbASgAMQJ48SJwchmBCDFa8qpyBbSP7OvU4PQ0p2W7+LSnSJUFOrI4V7w5IoBTQQTfJ6oTSYk2mQcpGRyH2syGjIF6EM3V/fM++C1CfwUExhCsmzCaQT43lZC3e1hBpEHh36XEqrB7Scmq5dV0XZxmV8WuDFzAF9iwhow9seAGoBcGtKjqAc+1l9rLb/1igesO55ysmCrC8ei6IxRMAKTWNBi6Xw98xNTFUi0jEcmpYgRAPhddpVi9OIEPP5cYD4CcLkCooHPwaW9kV+iwWrQHT8uA1fd3F7DFvgUHUP2k8jTiogAqLoxFpDgbMj9jXSuN7i9dLIdaxzBp5XVBMIMgFEnFAPKT9qPd6A9BIGI7MfPmf4U+40HzI8nWgq2PBxL4FEkjKJixGRRFyQQPzzd1iAUzCAQas1YOmAEoFjwkecDC/PAwhKw6CxIkCXwOdVJLxTobMjBdyIgfvimNvNJ7Evf4jWtdnRYD1YNGVuG93VWuWs4Jf+mlZCCZxwP/cnJ6mXVKk2+tK8lQQVHRTGc64SDAZB3Ey3JcxyACkToJx4wHl+YwqloGDICmYmTFgMQFBET8yyYzyAG/AfWX8mCGQg0BTRoHwt9KVaPE/HQ890AIfgWK+CRAaMRYnVdxHbhdY8Wslw1V93UDsmPIj9GxgiAioRRMIJNvoti+SW/Ikd0gwAU8+XxJcbGITJPDvI6XdCFREFSknTB83xka40H1PGF9dnycCxFwygkK0bASJQSVAbAYeD98xUAe5U3jKIwBosSgNsuABYogl3/IwgFPrOIg1Xc4ZrpAsSrvruykl2ucykapkMMh4CExD5DwJfWAYAxwk4MKPAJgOIjGSEGwuCakRhemw6Yv0UUwRf7L00L9pnsNx6Qx4feY4O8pDEcixOjsoTKKpMYjSFYYjOC8Eq3Wnnr0YYS+0Tmi2HysrPGLqwASNYzBnT2Mz2QD91laxLB0gs12GAh81cf/o/OcHyJ+qj0S/zxnhUZbSyYWaL8+Rq2S29wowiWkJPan4MvgrDDGAlRe7KIywDIgR3meEDWg9HbJgApNTkXo8o0i7oVgxnEgFr8F7jEdnU5GvqfJQKQKyEOPlsNIQvyvupAGHS/Okv4qv9oh+PHxMLk8ggBCRxvAmEN+AiEzz2iQfQBeNmkh4K52hJBKOaNe/FSLobLRXCz43rQnu2yi9oMSMDxs2jo8303ERz1wsCGZECF4kd3DwEYYwJjhoNlQrgIjlYodbBPrwMAZfEmyzcIv27gs6XDzC/IR1DOgA9a6DRz4wZAsZ+LYXvQYsHoD4ziOFklna6YD3+nnU6dZ7bGDAcBUImIAmEUw/zbJ1i/scGNDJiLXmle3RhQ+l/aq57gUQCWzwwBKPeLsZ/LFrGg/ShRXAe64Ajkv30kALAjF8R11Dy3K7KRwJcsUTaqWScARou3w/INVnCH+A36n8RvM3nB5XP4oD6DATBYwGb5ajlOLOh6X8JaBKRG77+7ygGYp1bn+V25/01AzBnwQ1ypanD7KWfA1QDYC3zJIj7KgOUzc9nFbetX/r+O5biwNhyX5uSEDr5o0xsJwLp8/m4A7GaJUv/j3/5+HQFYJ3oFPPkho/hNeqBcMkcB2BAA6XrxmMBkfFAci/m0JpwzXw0TXvXtzrz+PKc/Ml/ugzM9MDqCAbz/keVjjGcQA/YLvjoguo1mRslRI6RwfsiA5nqhL5D6nscF8gfTdfxpS+/hLzvWfzMQCoB1Fq/8b3VWaPIDZqsRV64DALsZHVHs1gEvsqFAeBSApQC8pHK90Oql4UEAyvCwNeGcBXNLOPMLftgZsI75ouUr9ousp2TEyIJ/sU4AzC1e+WIFshyAHPZREVwItrrD3wGAhibTYBhxVpe/xePyrNBuWaoNp3DgFwC81O+RAepK/a5Lfe51jxr7JwA83nPXYgq1asl0yX5N48+f4VEGLATlK1vAo5YB1gBSRmsM+NFE57lcfPD5pPFWCJImtyvGgGfOAacBYO59zFglgHgPefZsXV6/gPXBYeC0RVgyJNOGYuJjPka9eHWgjL9bWzhWk0/n/wPn+k8bgFNmgYcsVflZnBRmIShtJM/m7JGibGBoOIIez9wKPP4AcNpylfbNlGfdI+9NjBjz8JVzppckZuJ+dBw4aQ44drk6j1LIY9JkPD7P4s2lwVEGLHwJnncscNIh4Nh5YMsSsHm5ndOu1BGFThJ8/K6JrZtoslST2+XHA6ftB05ZAE5crgAups5TfaL6EF+UyIif3gAcOwtsXep82eIYY9JkXpMgMp/AeZQBC2b8OduBYw8C2+aALQvARgJwGZhY7swEzbNa88IRvAVO1qkF91J36DNOBE7eD2yfB45fqphLnevzdGeBKBfL8UX5/CZgyyyweRHYsFwxYHzRNK6oetSBMDLjUQAWTPqPngpsnQK2zgKbCMAlYMMSME4ALrcnR6JYQIwsoUnjpDRstOLy7cBJB4CHUGwuAtuW2nUDVH1EFUhycSwWjGD64mZg0xywcaECoI0z5P3X5P6nWlHdgHgUgAUAfOYOYMtBYNMssHEe2LgITBCADkIzSJZXpCOnIg25uPrhgnupO/TyhwLHHwSOmwW2LVSik2pCrDsQskzNIBGIpBdGI+VfNgMb5oENCxX4yPRjPj4xaJ0+WGeEHRXBDUz2Mx4FbDoIbJypADixUAFwzAFI8KUJChMV2SUaAGc1cE/xFJef3FYRti64nkqWDrqqEhbrsm5zvZCdPCd8nHzJOLZuABRz9hTHZwPL7LnLnoNMIY2VyaKcjtZLHOAbNgNPngKe4BacfGF1pnydD+hphQ/8XV5UiEueLGnDN1tWXj/3/4cTwAUzwGPcRcFJiDpPt3FLmf5vjwE2HAQ2zPrEzDv7OQg5OSM+ScYQy5Xbo8465u/ZfLTJ7fKHAdumKxVh8wKwealSE6inEoSy2MWCdbUHIghv3AqMzwHji9VLZuDzD8cXxxWZs5c7apmW0fMBnIHKn5X7d6I5npvRz94O7LgXuGIReJSb+Xl1tzqflybwRwqf9i97BQRWomWJQ7oZVFtJoqDX/b/oGODsvcBTATB9gsfGqmzdjtVz+G+PAyamgYmZCoDjFE2anCVg1CeJwOMnTRB/DmUINVkkgia3y08BtkwDW+YqAFJFMD1VAAw6XG61R31O9/fdrcDYPDDmY0zjc1UjivBuAMx1QdMB+WAYXU8dhEU16dOSkppbcHFSrng8MHwnsGMPcN5ypURHp2xMIa7zDz2z8Gn/kVe0YomO0wEwBYKujL7v/zHA6C3AxfOVh58g5AsZxx4fZM7sf3h6BcDxWWeGBZ+cMEFiwGEHHRnDzun7ONHs/djkRgBunql0VDOSHIDU3cxSD4aEajhFXS4H4S1bgVGN0V8we7E0Fh9jVDG6Obr1LJMRwn+kOCaTEYT0dsfqZHXl/p7PrLi9wIY7gO0H2yAgCAWCWCowKrYE8nMLn/a7PQn9X7zIJPPkCcK+758y7x7guNsB6l98gZjLLYet3Ay5n0sv4R+fCYxPA2MOwLEAQLIDPyP8uBg2cRYmzFweAYilKkn+OC8/Fdh0CNhEA4nGA40kd6FES13WLO8v1qHKAfh9B+DoYjU2Ak/js/8NAIwg7OUb7LCC+WAfB4CpBJoIiTRNRmS1l13kqWh3Adv2A8cdqqp1MB+aIOSxWv6pq5D2kkIAvt8rF7BLJksN/jMqfa7v+7/Ak4B3A6ceqpasKMq5akAmlLWY37t8ZW97PDB2qALg2BxgAFwANEGcnI5JcrDZRPlkaXL4u1KJUAfAjbTQ59x6dSvdLPXAgGYshZWR6JIRaXB/NwFI8C1WwLMXzMeSwLfcXuKrA2G+wrLCDcN/IIg4ERRn0qvyySAQX6mG1XuA4fuAbTOVwktRRr2MLCoQyvEZ/UY/WwjAj3jtFJZkU79g1ghkgEBf98+0Umb/3A2M3lkBl/fOcdMok2EjkZyv8773LAfgHDDKjwNwxEUw9yailpwdxBAEYhBbAuGzG3aKkQEJwAkCkOCjlb7Y6SYyf2UwlAS+vKYnAXjfNmDEX7DEfA5CjUcsnzvbu1nDtUMmCDkRZEEyGdlAk6G6lQTSa6m0MP6HuY73AxNTlcJLZ6WOJYC5/CNxLpHMgdKIKNl69Qvu6/75AjHOiTU87gKOOViJb748BKCWrnK/maTA+58AjM0Ao7PA6Lx/xBAupoYDC9okBRAmPdBZ47lNA/DhwMRsxX7mPgl+SrmK5EaRNRslXFQ9CKB9DkADn79cZtkHFkysJ103eBbqlh97DpmTQTYgk9VNxu+xYbXKU3lhFoJPOgdFGY+lPkgQxokkgF9Xgj4AvfoFs84eX4Ke9x9fIC+tRfDxvvniif358sSir2LCj5wNjBKAc8CIi2AxxLCzIAGY9L7AhGIKgpATw4l8wToB0JjPrfTkp+SLQbHrOqm5jNyajS6VCMIpApDAWwQ4LrGgXqzIfnq5cv0vN0ZXHTInME5GBNLb1DGdOYQsI7AfGKFjlgqve8wJwG4T+fuFAFytXzCLb+VgWnH/fIGYfc46Hs7iHC8ZkPcdXx4VfVXJw8+cA4wIgM6AHSLKWZCTESfLfg7WsIyRF3ckiRQ+HACXkwHptyP4KHrpJvKVGnOhRF9eBF9wE0mUEogz2wC+WGI/vVxiQQIxAs9+rmHA6E1YFYB8DJwQMZl0OrLZ++i7sfT8zroYHLS9df4RACWKxSZvLXzG/fQLZqk2gqn2/vUCUQ9UZaM9wDaPeSPrC4A5C1KV+NITKwCS/SiCR/jRBDlLmP7nHynsxno1IPwJSyRpbiMADXzuPDYfZfBTEoAmcuVQdiaW0zwXwQsCYDYmMaDA1wG8TBSvaoR0G77EcGSET6hjOvVApfRPAUN0zjr45JzVcSqiTxD+VeGzXku/4Nr7JwDJOkxFIwt6j6+RqUrlkO4bXzp1gCAAv04AzgLDDsBhKugLFUvQUhTwCEKbnKCw14HwJ9cDgGQ9WegRgDI8XEcVEDvAl7lVlglAgi+I4CR+Zf1mLGgMmDFhBGFfDCicRJFERviSABjLS7FC0MFKMU+07wOPE0kGvaoQgGvtF9z1/iODkwn3VWoEXxres5ib9xx1wZufBAwLgAQexbAD0JiQwJOuJBA68/H3Zhk6+3CifqqwWNMKN8wjKgbk6gWJgC+FMaBb5vJVmsUbV2vCqo3cRWZcCIACoax53+ulkqNd7iqOcU1WcC9cxEm5kQBUdZ+sTnSL/jEtTWngi21jhJNJBivZBukXvOL+yYBkcOqxKjJ4AGgxzMrBVwdAMmHrZOAYF2l6y/mwV6xD17zmWo6MbRyeWtOHwxJ91IIhr6rqZS70DPPLXDVUrfBwzHKr1EUp6/h0T/6L/GcCqslt4IhoTcwdAqDSs7I60WQH6R329pHuFyuXDJmEjuOSbdB+wSvuP5bGUjmsA5XoUvcvBXKKAQnApUdXwah0b8jXR2YzJTsC0ZHB33FL+2yiX3h/1YeD1fFZGT81g/H6yqkVa9YEpqMhTADle8erHA6t7Mh6j4ZBXdBGjFyO4CSIm9wGBiBvgqxwIAJQlXIyEJLyI/i0SkAG/FbhaEr6BXfcv+5dLKhCg4z1C1HEBJ8+BODQGZXfk/quAZC6ketAZEQCTWAU8PIJt0fgwHzZvVWNaKqi7JLOmtDWFy42g1FxH/XfqGkII0C+a0tnDkfsGxQjn3VPsk7tXmuy+Xp0JhtoJosAaFcUAJUYKiYJxcqHqKAH9rPlG2cMrmCUbMX9guMLpGTcCMKDlZGhMK8IPnPIn1X5PA2AwegwEEYmDGBMjOI5whGQP3NPBT7VJlRNaKvF4t2IWHbDErtDlSk1p4lJ7/zd246tglGZryIfrFhQ7pU8WCAX0ZENG+57U14Z4YrCeLrSxXdev6TfLwrbxT7znMrfKQXfHLQCnyvmRIv0Q3430ezMmL98P393G3wqz6am1NYzzoGn+svqRmTAU2citctqAX/2EI8F9ACEmLHXLZGoFxtSl2xyK2bAYwrj6Xr12+1noL/jUTCD9vvFrn6u0v1/nvGkaoVBAQi0eummMAuXQHMWJAA7gCixG8U0gFfcXdlBKk4Z6zELgAJfZEKrxpC1xOIl/+Sk7jkcdYlSco90y9+gK6vJrRiADD0piad7RuFo3udNCgft94vCdrGXn+tujgV3QAcHLcFnroelivHkchEL8ue0uQ74S3eubAITS3IQhKkMRjBMokgWG3L//2z3VSnP4VDgQWxUEEUxAZFHL0eR3HDfm3IRbDHkBfF0zy4EIKNhSvr9goGEBdvTz/MIYQLQdVsTwRTFDj5jQmdArRDYJQNDSs961R3tPhx5NXoVgoxleHnarjohgLec3D2HI492yQNvIwvqO9fJm9zKGbAwnu6FhaP5pFuMg/b7tTbpBdvTz68cz/zI8azVj8iAHTqgmFHXDUB89R2dtaC7tUGw4kDOgFb0R2wYRDGZ8g9O8aU4XwPOczhiwGlMjqqLWiFYGu570wADFsbTvaxg8nkow7E8nM/atfKzln6/1mS4YHv6BQ4+Z0BbqHcd0NwwYbVD3+1yWhXJxPBrbq8AqE/XApSqAxiBV2MZ/54DMOZwKE00rnDUWcR5KiV/brjtSAMALIyn+/mCyeehjIYp6fdrvVELth8RAClyHXxmhPi6r1m8FM0ucgk8+y4RHC1kAK/5XgW+2hZYofafWcPq1B5AqDqEYsQ3nepR2gqhV2yiol1COkD0C+aOaoGx4aL7DQCwMJ7uVwomn4fm7VrX2u/XAlELth+5sHPtN+l/Ap6sX2dCsZ/phZkIJgv9l++1wbcq+2WFv2NXIjNKAPzuw7MUAV8DTuynFIEsQy83RgTAhiv+NgBABaQOGE/3mwWTLwAqHnaQfr9GnwUbARgDNBUlkpzQboyYCyYDYdILdf0l4NduW9kGoa4geNdazLElKoA3Prx7DofiETtC6XvE7hGEzJlpcis3Qgrj6d5UOJoYDcMglrX2+y0NPtl5UZUjkfx/Hqbecoe0OZzdF1gHQrln9Bhee4s3f3Zxm4MvAk9VSFdUIw0i+Q2PaBtISiBSSFgCYMjMW00MP7pwvvLDmwFgQTzdHxcOSGvBg/b7ZRZByWYAlOERluKM3Ra9CKWc0q73dTBhMFT4ZwIw9l5Lrpes+HjeBiGCUOKXeuBvPcKTiEIOR0f+RhDBMYi0Lhea4GTaa5NbOQAVDzhgPB1La5RssV3rIP1+7yy5OAADoAchEHBkFbKfGRpiweAPtMs5IFNokyOGk/7rAYC9OhBFwNXVY1at5tftCBHaWVS2AJdEcEinrDNC+Lumiyc1B8AB4+muLARAXTDCWvr93lR4/Z0Xt6ODFQkj8WtumEwHTKDLQejAfN3uds/dfjoQdatGLxb8jQBAYz6/boxiFgAVudzNIc2/s3xLk1szAORoB4yn+2DhaATAGJCtbpkCYq9+v4V+aBgAQ4i66XtaC85YkDog/zdZvzUgfN1N7a633Xqv6fe9msDIHfNaB6Ay2JRE1AHAEDIfI5nzZCLeN4Nbm9yaA+CA8XSsul6yqV0rJ2WQfr+splCyCYBR/HJyKX4phs0PKBZ0lqOYTpvniAiUAmAd+HKjo1cvDjHgr+3wPJQsVCymUZrPMuRsRBDG4AQCsunyJtFGHwAAIABJREFUcc0BUJlxQoH62q8ST8cggpKNAFRGwCD9fkuvbwAkyGgJE3C+Nz1P1q9/T3F1EZBxvZh50s6AEYC5yyUHXt5/Q8zI5/KrAmAIkkipkyGPYwXz1aRT8v5ZO6jJrRyAvKOvNXlLazsXs9bo/ztc29Pohgotp5J49Rcj/pzfIwGS//3OM4CNd1dpntQpFUmjEH4LYIgnyn/OLjL8FeDGhwJbNgFjI8DIEDA8BAy1PFK7FSKf43cNKrvHx+8C/vmxwMgmYHgEaA35J0StpvvzL/nP8RbLAfhyT207TChgDRiu/ZL9DsfWNABvYzbhCDBKoBAk/pEobGWTqp819hzQ1/0k0PoaMDEJbJjxVZFgDad0SaUO5LksWVj+XScDmw5UEUDJ6U4d0nVbC91S3ovfVHp5al64cgC+k7mZAP768KCA0WD3A/ieLz090CDceVmlAuhBljLgrfcAw6PAyDAwPFwBkCAbItM4a/FiNtERjBl76W9ffD2AbwJDdwFj+6syImRXrd5Y2FjIYcnzWPLEqnsfC0zsr6qBMQmfIDR/pyJ6xMhKyMrSDiKD2xja6TADTt0/AGAs1KcAUCFrOLF6tbtiRVFavT/wuMCa7MfVTlH098YBeBcwNAIMEYAUlS4uBULOmK3LCnwOPANlEIOSoF9+C4DvVoWXhvdWZVOYqWgi3vOXDUQhgieB0EElViMYJ08HxqeqnG8D4IIDkAzo51DKQQJvBKUmKACzbM4+5hUivwrgiwC4LzvjmgCh6nBcgiMTcv9Abo0D8E6g5eCjfpUA6AxoQIzgi8ALmWwC4z//DxcPPwBak8DQFDB8yJPpPZHeGCyC0KN5DFCByfh9/+OAsekKgEzCTwD047X0SCPM1IYQjCv2E/MJoGVwUUQoPboq0MdqkWVn7RtDDMahB4g+P6qhXFpjVtkDtRGA2nKjos7IyOyHFUbIrXe0FXsTuzIYfNb4O2M3ATGIYQOmPn6hG6gi3eUkQQAeAIYOAUOzALMVh2pAlESqGFBAXAYOMQVjxll03iO/yYKRAT0FQXkwZkjp1pz51LO2XAT3KtD3AIAwj4Wg05kfiuUHYlsXAJLVnP0INLM0OYFx78AzcRySeTsw2AJueI+Dj2Fne4EWKz5MA0MzDkCCkAByUWqsJzarEanzj2zXwjEGFHuGY+pYsMojzZL1G9EBexXou339IRBrC3lJGmNDuSHX+w7WC4Cm6wWxm8DngLTImgC8pBcGBuTXf/1fXnyTugnFwxTQOgi0CECyIFlsvvJfEnh0mhsYI/s5uxFYi1xZof7oOqSAawwYjRGBzYGXbtWXaCIrlvHUagX6SP/ruMVYCEbEqECXAMjfree2HgA0ESur1/0vtnNwGSsG0RsZME20/+/XWH6Mugk/yngPAGy5GDYALjiIHIgRUIrsZjM7Ax+BSx1S4pfffQVIep8dL7dMDsTGjJB+CvQxTHmdtrw4l0CovFruC2NOe975egDQsCXRK/eK634JhBK90q2C7I1i+Gt0jxF40k1cPJAB7UP2m3MGJAAFQrGei9iUTH9yBUDTHfU3B5+BOIKQ43BWtNtPcWIOzEZE8FoK9K0DCGNxLi3FqaKA9gTgeoFwPQAoI0OulWT11oEwiFz7cwbErzNxWtEYBB+VY76Vh4DWrH8IOoGQ7Ocg1CqMRLPltmxvs1/SHaP4dcAJePYyyUCRIzrTB8tE8FoL9DUMwl61kQQ87Rmy2PS2rgB0a1ci18RudEJH57OsY02y/+83/sZdBKr4FXQTApBvprGgQCg9UEAM+h9F6ugJDkC3gJPBEvRGrYoYCBX9IxEcS5K4i6cZAHIw8oXQ4mLBb35YH5d7OekadtTV1UZSjaEIPH4nQzYNwgjAHNwDuWGYpZc7lzPfX1cQur5oBorfzDf+zi0yVTuSkuxBI2Q+PhQDIUEnMLo1TBCZLufGw/ixbQa0KB8CTODjPohdY78IQmfDjmW7Yo/doAX6GqIiAtDHaYswSmeMubV81kp11L6hy2PdAcgblfslOKC1IiKRmyRxZgV/8++DS8BFrxXi5Hd/U6MeSKdqEsEKhpBRsgRMbAtuG4KU/+9ry5brzP/lPVMv1EPOQegharrVcgZUhVHFxNPcp9VFtlOWkL437C0WABWypFRGsV0sb5Hn2zYBwvUGoKl10v1knDgo0y7XA8Pfv0UACnjaK33Co9gJQAOe64FkNvtZAHQdjz9v2Nz2GSa3jYej2W3KGuZ9ixGdIVSoKT13B2s5AHkGheST6qn0erHv5AIgAAU+LVfw/wq3CEAV7clBKDDGZG9/5oVXx/oyYARczcqH5GyH8eFplTawFvAtrtXLGpNrQDGbejupB3omlIHQGc/ErzOcGSRs8zrhAbbuL1Tco/JfbLlNwHOmi2kIcs3owbdwNpYtynDQhsFcgvuG9/YapGFvYX22zZcAU0/GwA2LJ/4AmGF9mwEbBu98Y3cMF+uAGQCj2HVp3BbPuo3IlqxAy5wHAq4OfARmEBXGfNIBa0BIsG0ecwC67merHgRpZLwocrWaovuTxew/V0txJQ2DWeae3WAGbdhb2DB4+wRw7w5g8Qpv88liyGtoWHzMi4C9fAEHbBi8kwUKu2xNAdBxaGBLbJdZux1LwAGECYAEm6wyfpelJrEgFnRDxESwgyUxIUsVMwjVy5AYO0bG89Auu1/5BF38KqjBHlUAYXsteNCGwTeWNuwtk4JMkrlzGNizA1hm69g1Nix+zDOBW0aBeRZZGqBh8M4emfWNADDT+zqMjQyESdQFHfDbZECCLRgdHeCTe8CBaKJY1rDnBRCIAuGW4TYAZeFG8ZuMkGiQ1IEwGCJtHZBmy1obBsvVMnDD3jIAerti3LEBOMjGcOpa3WfD4ic9t6oveDtLfw7QMHjnH6wPAybW6yaG4+8D4HIQfvtDIVtLejpBFsVvUI7NIBHw3DUjRzL3rDVtsYPOkAScuX3coNDynT2VYJCkn+PjqvUD8hVbS8NgjphGxcANe8sAGNoVY/824BCBtIaGxRe8pLKZdpMkTvXiJ2toGHzSNHDPScAyq3er4qPyGaNc7JCRXWLT2TjwGmCOeQashq6+qSpZmp8vojQpheF58ncdZVjLnjWPHr4VWKTKxrHGUqq97qXu3jp0wPy+eEC/DYNZsZAO6IEb9pY9lNCuGPcNV830ZmkM9dmw+OKfbdcXvJMPdY0Ng0/7GnDXKcDMccBS7MwdKz8KCAKQIgY0MWGCtr4TOHAasMwOkTqf6unyuLykfd254nkb7qsw/iVg7jhgmSX31Vpd9yRHeLx+zRhjEGRbB6wDYT8NdymyubzDzCCGfpMJWfSRYfr9HP/aMgBm7YoxNQHMbQHm+ID6aFh8yS93tAvGQb7da2gYfPoXgbtPAqaPA+a3AEubgGU1RM6B060fgkRoCzj+TcD+04CFE4BldZdRc4/YxlxgjJMewSiwN1zWfsOngdljq3EmY08vm5i/7j5yIMqpvupKyGoNg9lngYosl9wY/0dZdrMzYl8Ne8sAWNOu2MA3zw/F2CoNiy99XbvftrcLriz6PhsGn3U9cM9xMODObQYWCMANwPJ49UliuW6SaqqBn/gGYP8pwPyJwNIxwDK76ahDeN6uXYCuYyABkEza4LbpY5WEWdSLxjF26/dQB0SJ6r4ByAN6NQxmkWcqrnQ00x1DEDJFjR8CcNWGvWVPp6ZdMQ6OVOCb3wAscPJ6NCy+7PerkP5Q3tBY1PrT9tEw+JwbgPu2AlNbgVkCcCOwtAFYcgAuiwWlM/XqDjMEbP9t4MB2YO54YJFMo/5gHIcALV1TRZ17FXOhPtvgtvkqf9H4kvHDlyKK4l6VzvVSBF22uwjOb7pbw+CfcwBSkyeFEHAUx/yw9JTyEbo27C17Ol3aFWNuAlgIn9QxO2tYfNlbK6MvaxeMRYquvL9rTcPgJ30TuH8LcHAzMOugX3QALo21WXBZLEHwRF1OgHS2eOgbgIPHA7PHAezNu7QFWFZ7JnXJ5rnqxHEulvlzwyVNN3+wern5Yovl7SXLGwvn4riLWO4fgMRJXcPd/+pmOymELEhRzBxJAo9gVL4kwVnbsLccgHEpWi3epocCAMeBRU5eTcPiy/6qtl0wpvhA+2gYfO7NwOQm4OBGYGaDs+5ExYDGgqP+ccAkINaVpB8GTv4d4OBxwNw2YGFrxYCmV0YxLNYheCXau7EhV3ga3Lb8g4+R45uoGLADgHWqhsBXA8K1AZADyRvuvtkBSArh+i9DsQhCOtf0UUgW/7aiYW/Z0+nRrhizoxXwFhyAi5y4rGHxU66qAFhT3rDSIVdpGHzencDejcDBDcDsBDBP1uX1CMJRwFiQIBzxieL3KIY1YW5MPOxNwLRb8gs0aghAss1GZ1O+SFHsdRPt0i/PLHu++dFb/x4mXfhcbWxhfCtYMFr/uWvKxfDaAcg7ipPCvFOVpuo3HrCjYW/ZA+rRrti6TS6MVQ+L4NPH2nx698GnXF0BsKa8Iab4dFZpGHz+JLBvApieqAA4J8CPOQuOBBAOV0CUYbIskRkAecrvAdNbXc/aDCxSpyT4CEIyTgRgneiLIp3nP6fs+a4A4N8B8/48CUC+ZGJA29fpuLmxJW+5h5kNFg2jiWHSi0r0Uv4pCoZsxw8DUfnhd4Vk0XGdGvaWPaBV2hVjdjgA0BlpkQ/K9bmn/HOVqtClvKEBqlfD4AtmgP3jDsBxB6DA7tdbcvYzJvQJkii2n4NOeMpbgJktbYPGACiF3wFoEx1ZMNe/4jnPLXu+KwD4t/5SO/iMBcXuesHylyACMBPDgzGg7opM8mEHIGdwrfGA1rC37AH10a64Yr4APvvOSdwEPOVbKxu+K2pdKRTmdI3dqkPPVgbSTBGAY8AsATjWniBdx0QxJylOFCcr6HBiw1P/CDgU3EgEIMW52M8YkLolQRddIN1AyKWiBretf9MJQN6HsaCPxe4rvgDdHOcOxDIAcmDFDXvLnk4f7Yqt63gEIB/Yoj+4p9xaAbBHeUPM8qF2aRh84QQwNQYcGgdmx4C50WqCFngNsgSvQ+Dxu4MuiawhwIAXVk1O+e/A7CZgThY1dcno1nHL2oDIyZULpBsAFTBZ9pjT0QQgn2V6ufRicS8QRgbs5ZYpEsENDejBfpoLrwAOjgIzZMBRZ0AHoUC+SOA56xJwNlEyTFw5FxBPeWvlzpnbANCdQ1eSGTRybMuydgMggVBsKmtYoC6Mt8znZxsZMLzAxoAOvsh+ydDqtXx4FIDl8L/omQ7A0QqA82S/ERdTI22mNfaTuBIIxR4BhKe+y61punQC+MytI/Zz/c9EuvyBeetLAfGZ5WOMZ9j2/gqABB1fMLsHAVBqhfTcyH5d9MByEdzs+B50Z7voGZX+NzNSsd8cwUcG5ASRKYbdHRNYwhhDIHRgGmO0gFP+HJh15jOXjnyKblVT5Cbfoq+yJOszF8P8+VnNPlICkMAzds/YLxlYznrJwIpO6egTPMqA5ZNDAB6iCCYAyYBcBqTRQ0e4630SxZyQJQIvMJ8mSeLrYe+p/GzGfnTpEIBy6US/out+K1wg+brs88rHmDOgAVCMnrEfxxMte1Mt6j7u9zzKgIXzczEBOJIB0BnCJoqgIfDEhM58SWzJEPGJe9hfVH42un/Mfxl9bgSiBySIBWnAJBDGEDAB8QWFA8wO3/a+wH4+rg4RLPYLul8tCI8CsJmJMQAOuwFC9qMI9g9Z0CxhZz65K0wfFBPqu7PEyVdWAOTHVlTcpxhXHZLz1w0ZA6EDLhkCskRf0sw4dRYC0PQ/vVSRAYPo7QCdj7GqVOSMeBSAzUzMxZcDMwLgcKX/zbv45SQlHXDIgagJc+bjZBqAWhUoH/Y+B2D0J7rFa6LYDRmzomsAaOeKqxEvbWacHQB08JkRIteSXiSBLYJOLB+X4xrzAzY7vgfd2S4RAKkDDgPzNEAIxMASSWF38WsgkuXLyXTRSRCe/DduSZMBMwe6ObTd8JBj24Aot07uDObPP9XsIzUGFPs5+JJ/M6oT4buxHv9X7BeY8KgOWDg/Z58GTC9Xq5FxTXOw9c3Cm6k5fPcjgbHbgAlvVG2tH1T3Oavoq6BlniZ+12n5u/2sDbOvasqoFg8x2Lnbcd1GdhSAhXN+7qMrAC4sA8sORJ6yHwD28z+Ft4fdv8UyqUDrDmCEBcpZ39kLS6aq9l4D2rLb/KYsFTPWdfbvh86vQu2s1K/K+zIjTsXIVQ9a59Egs4Y6sZfIA/EcSp/jEXv8BWcAhxaA+SVgSQAkGAMICcwVlNLlqTc9Gbv/HAA7MrL4+f1VlXwrUq7SvCoyGcrrWpGhuur2fNGYwM8YT67hT3s1LaZvqn5MLM0bzmHMmIFSgdFNj/mIBct63NhFZwEzDsBFgpDPeanNgATfCtGsX9TIKwNrg9tuVkhlng7TI/YArX1VkXKrEe1l2SynN1RCsFJsqnQv3UIMxhwIRjU5AGN9QUteVz3BUAvahuNgjC3HxLAND7nBp/cgONXF5wCz8xUDGgCjKPbvevlzcKUHH2ag6cnYzepYBB9Zi2FxDJdjoXJv1WDFiLJ6MKqKZUzoQFTfj2HmwTKcTpVWvcxHKm6kKgoORAEvVclPD6NdzLXpMT8IYNPcLV7yJGB2AVhYrAC4SNA5AxKM9ryDPE5fs6eeVKWGZ2M3S3MQfEyJUKV8L1ZpJXpVJ9pLilmlAxWkVJHKwIhjjD9TtVXVm1HdOy/pJiaMFRWM+bo0rWl4yM1N7oPhTJecC8wRgAttBjQWdBBGESwgSiV0Pb9DRgu0TY19N+M1mRKh8niqFx3rRDsLqjgl9yaGXT80vcL1wnE252PAZCzAHQCoiqoW3yYWFIt664fUpKaREr1NPakH6XkuOQ+YDwy4FMSwgU8GSRSz0UJx3Vx/5vFNbrs/EiLRY+v4ACITww6iJEodQKwBIyBRv9vwhKzUW6z66TUGEwhDS3ezqusAyNxnJn8xa1KRPSFts9YfFB/QDZcAm78CnDBT5U8rCqjfc3yh8Gn/hGd/MsKf1+QzYJ4891Jye13iy1cAE9cDJ+6FpYrEkidxDN3OtXR+FwBGMezoMmxJLOumAuD4J4rxJrfdH/XCoLGFVKiUbw+LAPQqWWaMMLrd6/+JycSIm85w9lOpt1j1MwAwFTiqAWEUxeYH5ENn/jInUVHeMXQ/f/jRePvCa4DhTwLHfBc4frGqqaNJzLPw6iZxV+HTplFGvZrXZT45N39+HW3TujlZv8D6fp8HRq8Dts9XIOR5YtakgBgdrrrt5Qsq8Ssd0BhQ4HMwmVitAWHAY/LbLDQNQDaTVJ8Q6W4qVB51OOqDZDPVB3TLOBepW5jmqaLbec3jGgBGMSxvvemDYkQ9GoKF1ShUCSKCqBeQrvmfVZPC1keBjXcCmw911tTJ8q5XgOLaQgA+x/OdWA2EGZ98gbjleTHdQHQN+2iwls3nK3/Zhj3VeQhovYzdxmArSwQgDRA3QiSCJUrTnjfl4KozRCSCCeYmt90EoJJbVCk/1+FiCwFZxLk4dRfLFia6x8LbYkD9v9cXtLG6+O4AYQRfrgPygVIcqyhTXcWFOJH8fh3rz7EKwnUArq8mcGwK2MCC1i7WY7Zenh56feHT/jE3yliE4TZncd636gPFCKWavGhcRx2J+cvs9MlSw0Ty3cCm+c7n0G0MExdW4BMIbTXE9UCynvyCCX+Ovm4gbByA/xisVgJPpXrzLj4EoRJjJIZrWHArS9iprK+KcefgiyB0XVKGjOmCmW9xhRVMUSyRFnNeFGEdI2q+/HFXclkp9WsAbgTG9wGj08CI64WxRk/OTDcUAvBHXSLQxcVCDMQSWbzv+1e7WVbz+k5w2tJtsbcCYV6WJY7hmAsDA7r1Sz3OgOgoM+KTOJbcjSI5yGIaNE1uuwlAAU/MF+tF5/0sIghVLdVdM2S0bSzHx2Mi+FTxXf8X925NC4BycK8QwfmgVX1LlcFiykEMcL2BndJJ7aQfijKfxLGDwAhByM7aC5U4qwPzNwufNnNuOH4VZaCPlPo2AahqFqoPVFc14ga2m+WEEL0cAz9kdPrOmMu8r1o/rTsXz7f9oswFs+jO6LAqkvC3Ggg5Fg6mwW03CUI6X12h8lyfcz3QHqr3DIl64DbqaQKc9mI87QXACD6vpJqY0EVxz2CEyCI5eMSGX2e7VtI5J4yTRyZhscrvt1nQuivOAaNLlYESwcySgiVbr37Bfd0/u31yEgg2FVaiPCeVOguqAfGov0iR0R9JABJ0bnwk9nMxw+fOh55EbgRhzozrBUA1polN9CLwok5HEEUQBjFMQB7D+j656PW+IrJ8O/bBCo4sGFdGejqiyYCx3mKe9/JtTiBvmI5OFiTisg9LtJFF7gZGDrUbHKs79+hyu5hSaUvh1foFr3r/6vZJCiXgCDwVVFJ7MVmRLsrGltuFCc68yFdACMDAflwR4QM3HPoKgIExt4gz42SuaQb8hBOE2oZmlu+KFlKR3QSssMJxDPWbbjpfLoJrxG8CYT8MKGZSVTCxYFTIb84nkCxCIPLDiby30gXFghaF4c2ReR466Uu2fvoFr3r/fKAEFxvpqMcd9yonIrkuK5LLV7MVCM+/uDJCyIC2J8a0z1iwqyESgMl15Sa33QKgmtPEBnp11mwuXgO70Ud4DHWzfgDYC3zBEOk7HlA6XKyHQzb8HgGoCSQLqsxorIy1Bxie7Wx0rFaf+wr9Xv32C+56/7HbJ5VHtRYT+GJrsehHcya57PyKAQk6+vBkBZPpjPEExlwU59awg3C24W6KBsC6tqHR+MidyVG3i3rdAnAsH2T093XT+zLr197MTA80h3SfsZP2UqpCrPQ46oF317VrpeiKXTJ9MhMLkgGdCacKG/mupV9w1/vnwyGgCDCKWzJe3lqsyzLWZWe6/kc/oKzgKH4jC7oolhdC4jiuzM0WPo+cPQ2AsX1obFCTO5Jzn566PwbReiwnfTWjI4KvDoh1juh+aT+WKSYD3i8Aql2rJk+VsVQly5kkddv2FvHT61icqO7Fr71/IkLNXOi0FQjV0046oBy6wZ922Q95ICqDEaL4XWw3COcf9Mw73DFB9AqE6wZAAS8XuzGQIDKf+oVkqxt00ttAc+YT0PJ9qRFSB8xoye5Xu1ZVeCSgCLbYLVNswoncHxoeLwCzBGjBNki/4BX3z9lXgUCyIIGmhova83cRgO5Te9yLgP3MfmsBS8xs8/U67ePQOqy9umBUruDchqo8sHSd3PMfT5ifo+ack8eFHI6QEcnT5GvdOnVdXof+ptJ+BVPWceiaRHA8Us/nkACo8mzqlqmWrbFDppT5A5UIZm7CPA2Vgm3QfsEd909kKIqB1qJAKCBG8ZstZz3xHOAAiwmpDIdng1maZQAkZzsHZ537YfQrwNyxoQ+HakrnS0h1mUA1C96TdJTmORyhC3oeqdwROi+GDhkFI6bYNrcNDEDeAkXwQizPRpmnIs3OdqZPSaRFUcbchHlgie6agq2kX7Dd/+d8lUJVXuUzk8ERmS+2vfd4uvN2VOV5rSwb0y3JhgIh9wJeN3YMQCIgR78Q+nDEVYBYZUrUpbXFnM7COSdf7N4IPvtDnT2BY/h8Chh10MXQeYGS+7GGjaQiABpuNIFiECnzdWJMIUHcazLptC7YivsF8/7FgLFMqpiQL5TuNbKfA/DC46rqqAbAwIKWK+timRUBEiNGsOQsyQm+Gpjd4n046hbT84KPuYjOmHHyp92gcgDS2OoIuVIeh/xyUkaVwyEWdLrewHE3uBUDcKIwnq40HpDXL+n3CzbaKdguel5VnFJl2awaghLQBTzteZ0cjLq2A2n0M6EPh2pC57Wg41poLzZsAZNso0Hw6eVR/J8bF9YjWGmVCpGKwQLBRCcrbiSxNLgVAxCF8XSl8YDHHFPW7xeFBRwv/rGqOKUBkODzqgdWPYAM53vTASMQu4Bx9J+69OHIF+N71F1O1gUB+AsBfFqKC+4Wi4BWX+CYgOTAU36wdMVNVKka3MoBWBhPxyiuko3xkSX9fvGMkqsDlzzHC1N6SQ4DoINOe7KelWWTheziObeKCdARApD1AdVnRH048gKUAmAEYi6Oh4DJV4VoGDWqjq4XLbO5o1jBoimEPhPJmwu9FvnTLgdgYTwd2wyXbMyRKen3i2eXXB245FlVYUpVxUpGiLtmGBlrTEhVUwV8dEkVKAq3MHJ1uzRbRx+OOgDWFX6MsXJU/36lJoEoA2AKvw8+uwTEDIBbStdOs8ddDsDCeDom7ZdszBIs6fcL9ror2C75US9IxJJsEsHdGFBil4yYuUwknofJgF4XcEUfjrz+X7fKo4EJJ//PkMORO6FrVjQMeL5kJhZMMXzLwNZCt1nzDFgYT8cQwpLt4hDON0i/X7ys5OrAJVe0S/ISgFY7j9ZvnQ7I3+lyqpYaL98CWp/N+nDkZdhi6bW8An1kP3fRTLKVWlwF6RZCH2L4zDDR0k1IqeTNb2OQSYNbOQMWxtMxeqtkY6I+ny9VEz6btfb7xc+XXB249AoXv85+tIBVgJJ6n4lf6oV+mfjdDJNMH0wAVFX90GMk1f5TxlS3Fggh92DyN0IORy5665KIfCktsl+K3VsGtpVOWOMiuDCerlSnjQ2rB+n3C+pIBdulz8wqonrNPLKgwKaC5B3s53qhXVq6oDNg6sOhqvqhEr3V2VNLBjmnSSNdrOLJ1zkAu6VPRjFcFz4fXDJ8i45hG94Gt3IGjOFYA8TTlQZ/qGH1oP1+8ZtlT1MAtHK8mQg25zOZUSCLIliWcbw8wfW5Ln04ssqnHX04euiCk6/3de66MPpuAQVZAEFkw2MKFw6a1wEL4+lSBvmAOMhD8vkOkFX77feLNw14YT/ssmc4A6oOdHBEkwXlgjH2k4Nal6wB4fIuX9LzZjAmorNeHMo5Tc0OewHwDTUh9HXxfGJsYkAbAAAgAElEQVS/uvCpoAcew6zBBrdyBlQwwoDxdLZWXLDFkHyF8xGE/fb7xR8XXByAAVC1oB18HQYIT+8uGfP75SCUs1o64he8v4j6cIQ+IqkPhxrBCHjdjBH6AblQkAeY1ondukSiELmsUPpjbyp7XuvDgAXxdNZVvWCLIfmKg6Bbhrjup98v3lVwcQLw8gqA5v9zC9jErutltg8gMxDWWMBaMVkmANWFyEV6R0uH2I1IzW7ypbkQOTP5f2ch9KsFkwp0kQlDAOmxzHpscGuGAQvi6VD4RgmAg/b7xZVlT5MATNXwqQc6KGwf2U2uGV2uzg3D4ua7fDnPwZcKgIdq9GaIBPZb0YdD7hgyIFWMXiH0eQ5vXS5HcMkc++9lz2t9GLAgns7KxxZsCkgdtN8vWD+vYDMAUpcja7lOR9eLVcIP4tcuob/3AOHCdW02VTX62ApB4Mv1v24gnPy9HiH03fJ366KYHYTHsgBBg1s5AxbG0+HLZaOp65i+ln6/YM5EwdYBwGj1cmUkE7+8THLNdAHhwrUOXtcrO/pwhF4cct2oN68BMDCfmsJM/n6PEPoYPp8bH3kCkbtjji2tJJA962YAWBBPZ0WBCrbYsFoOf9pDAiENk179fkuvf9nTXewKcBSjsn7ldonWbgQpx+26otaLIwAlfi2QQSJY3Yjy5i9dmsFM/oEDMM/Z7Uf0RiYUA7J+ToNbOQC3e0WBBm9qLad6HICG1ZK1XB5PoxnuOOIcxSXe/Of8xHV/P+FpwN47gKUpYHmuSve0pKZgCKSq5wqniWE1WZz/xouBm74KTMwBI17lVBXwtWSs+8/vL45Ff3vhpcAnvwos8d48DZX3M2hx9XIAnu0IIO0chu35AOgLL0yuG/jOmwbg028G/mNz1YWdETbm4I5BrFlov+EtD2wIo7l+Atg8D2xY7iw3V5diEqO54mnj6XdMAYcU+6gon7A3NSO2qFjlyZYDkAX6uD5Iam44YaUfVNDNxaJcLIPXcGGpfi6PnZdVD1wPspQBX/wl4OaNwN6Jqg+xwrxslcVFuYJblehkcYYZGPS3L20BxueBcS8nwg5H5kZkx6TQSbXFZcCQKadx5Cz5mPurAFxrRaa17pAR2PFC+ElSHKQ/0QjQcgCyGyM9v3SnsDBRJgL6msWCf6IfWeUJac8UFlpY8500DcCfvgb43hiwZwyYVhd2D/VSrKGAmIDnBkiafEcN9cprHgKMzgNjS1V7rRjRlceyrqif6KAkMgXIM+6tAnDl+zSL36O9+U8p9jGHQo285/2XA/AnXeNnKAorDXH/AILwbSvLEz6Ql2+cAf/3XcCdw8DkKHBwpOpFbE2wadzIdyh3jjNQirYWEwYq+/zJwMh8pf+xKNSwM6DZMmzNRRbM2K+2Ii6TlFrAWfd5V3i/F7IgT2LBF5LbIdkqxLPWvtzlAGQ3RpU3Y7AiixMxLOUB2t7pKQ8M0qCTnp8HkojJgNqaMEJesQv4AR3Iw8DB4QqAs+6SWRiqgJgY0HVDAdBA4Ba4xN7ndlSFAAjAYX4IPO5dBDMAdS2i+Jx7XTf1eEdTDfgAQnR34p/wQkRmjNAoByDT/ugFphXAmjAEn8qaPQAgZCs0lSckCNmVigEbFMsPBBE3DcBX7gLuawH7hoAD7EM8DMw48AhATrjtQwiXoqkTEwWd7LOneXNCbz6Tiq/TInb2M8ZzIFrTQbGiy92oGz7pXl/7jvdAJnb2470IbB3T77Sai+hyAP5voTqW6sKwFAc/TAdc5+3dvcsTrvPVYSK4SQb8xV3+6IaAqSHg0FDVh3iOIFTIFxtit9orL5Z/LD1Q4s+B8OnHVuXwhhdd5DoLGsgCCJ04q66X/Ju/vSaeAxDPvbdtmdtKDV90gVEPIl/xySkviOhmAEjrlzSkwj40SlQZYZ39I+8JBMx8mZryhOsKwqYB+KpdVSDFvhYwPVR9BD7uyX4SwRS59nNI+bRck/DzJ05v12M0nY8fAk8iWL5BB5qASPGRCi8EVjzv3mqpkC9ACrrwhKukB67GhpqRRowQMqCiYbj8oOoHeUWpdYIBAUj8c8WjrjyhNIJ1unzjDPjqXdUjJAAP8TMEzLYq9uOHICQALe/EwWe+QgddAqCzzD8+vgIgg0qp+5nYjaDzCgjmnCYone0klqP4JSgvvK+6LoFPoFMlkPGh+0rPWta4RHTNJJQz4M8EAGoNTPVU8opS64CC9zoAWTFChcq7lCdch6s3L4J/2QFIEBKA1P9mHIBmhPh3Ai354RyAAmWsR/PRs6vOR8Z8FMPS97yxtIlYgVB/I7jC0rIKSfLXF1EEB+BFFjQ3jCLA49OWsRTTEPzvzQEwry7VrZ5KwzAQAPssT9jw1dcHgCrORQCS/bgn+1HsCYQSveaHkzvGv1scgU/6R55Y1YIxhvOm1EZekQWl8wVDxJgwc88QiJc6AKX/meHDawX9z16M/Em7bO8Q08GBP/jEkAEVjMBoAFWXUjRA3KtNwOBXW3EkAZhrALktpC6lKtTV4OU7RHB+3kHWgv/zrnYZl2kCkF4uF8MGQGc+MqEYUCA0n1tkwxbw4ScHAHr71Q7W4++c8czwcBAmHVB/c7Bcek9b3FuwbdD/kjGWgzJjQ3thGmVA3jhfOyU+RxB6FamOFp8NrhsTgLy8Cpzm5QlVptAU+6CiNgXCaIQ0BcDYV8b0P4pi30vfIxD5+w72C9aliegW8MHzqrmh/meuFhYi0pKbs6D9fsh/n1XFMrYMbPgUByCZz6J+uEknDA9AornWFRb01WZEsACoHhOqyC7wdetT0QAK2KqOb5MCUvPyhLE0oQxzqaYNXL5xBvyVXe12vByLADjXAvgxBvSPGFGMIjCmJbEW8HfntxtQmxT0cmxp9UPAdKAZ1upA6EB7qgDo6oCUxXRtPVSpAwJpnUhuxAqWCCYK1MBExZljY5S8SYr+pxAFAuBayhNG26jw8usCQLX0SAAkwwcAEngyQizaXoziIli+Oe7/9kJvNk1LmBMe9ECO3XRB7aPeF0EYHNVPdT8gj016YBcWtBfBVYJuz7mF7VgGY/pO8f5WdQ1/7U67nIKNS7j0wIbDPFZsyNHHY7od/xdlEHj8CcC3TgCWHgGAPSxiSdt4312u/8SPAl8/Dlh4pDeZW2PD4J1c9+uyDaIDkgEJQKnTfG/N8nUAmu5HUnMW5ARbPfEuIHy/ACjRK7FL5pOR4RaxgTHofKl8r/S1ZWBnAGDKefbn3AFIPRPXB7sFiVQimKVgGdl5ooNwLQ1/1U+DQGSXQ9r5Evy1q9rZbP1lGQDZsPpzI8APHgXgod7qUx11YtBbFzC+/C+BL7SAWwhgdoLkONSLqy5oLogYft3ZI1F7EAC+phsAnekokhP4HIzml/PvthQWmPB9LJ7jxkcSr14jWj4/0wFlgJD5eoDw6fe4DzAYPHokWhHJZ3TFSkn4h7YOSOBwEtiMTv1aY0uktFYTmI2/43EMQmCuAJmUE0gmVD8EFdPpdnxhVhqzDr8F4NMtYM9Jfg98EVTeNu9Q2OFZBX7vr9vtgm/lcezczZ61ZNN8DCvilYCdPXqNDQpAlfGTKm0M6AA0PTAyoMSx64cRfPQHXsniOTI+fEWDFGp+Qb9BeySRBV2kpl0QxxGAlHDmkI56X6z+EP7UDYSdRgh/IouwIZ36lHabBE0GJ0r10Rgb/xA/tt/j/6aMAf+7R4CxzuBXWRGULwBfIrY6UNfpvLae7n0I+LO/reoLMqiVMbW38oUhkNkQIzZO7tIweGePcmWlAFTjAYHPVGwXxWoLYblEDkLuTT8MDPhXLJ4jALpaJB+ggU6xfgJknT7IKXIQXh4Y0FZCog+wxiUTwSkXUbSMV1rB/A31OXWuFpPUda/mRHKi1e6U+hA7Zq7l+A+UAfDtHg/LrptkQpZ727cRWOL9542Pa3rOvuOqagUltgtmJM08j4/PILbIDKz6w5PAHsbraTnMGdZWIwIzxIfeK0rn578J3LAVuH8CODRahV/FFQ/1IumIvXP1QudNfyNT8oVqcHviPcBd48A0g2RDuoDqHdb2SalZAdG9dnfDkAE0gXnH5ijWCDbKCq5/MRiV0QD8HgHQ63jG0hdsLGxA3x9Bw1Asli7hO3BwApgng/Gjvq01IHrXJ7q3Cz7E++YziF2rs1ZLZ+8H9jJsSoECWXj6igmR87aLgfbGq4GvbgLu2gjsHwdmCEIPSI1h+SkCRjpfUC3iNWcpoRrcnrYbuGsUOMBo7QBCxSTG/igxVcBIVGPWM1h1JYQPnyKNExGZMDIJ9b66eEBGxPDY1Y5nv+GCjfGAxD+DDpiawphABWZPjwNzNLAEIH4XCH0M7/5c93bBfI8Yk2cgVAdvdT10ifDkBWC/r9lGH51NhIsnsWHOfPmEUKT94WeAG8eAO8aAfWPAwVEHISNQlKQUglJjJExqC+H6Nq93kOpUg9szbwLuHa66QzFWkaFieXxi6hgVHOMCYGRuJ+5V4jYJIDKI9KlsAvFDq8QDrnb8NWVPh9EwdFkQ79TlSMIsN0Mi5s9MoOGno4U6f3YAvefL7Y7rvdoFLxOANSA8f7xSgWmd0kCQbmZ6mTLEnJ0UqWLhUkxlrBn6n3wWuGkYuGukCsufGq2iojnRFpafsU7MDxErJuZhYCsJosHtWTcBe1oeq+hxigJgXBrMmTBPnJKLrr+VED54ibHYvZos8sO+DNcrHrDX8YVVyglAKud0LtMjFPtNMz6QLDY7VomLJd671AEH4Xu+3g7nWq28ISvX58/hguOBg8vtFQvV/hEzxfqOevuTfpjri8vAWz8L3NYCfjBc6ZYHmBcitnFd06pxyb8W4gPlgonBqffTtdTg9pybqiVNBssyUsdUD7eGO9amnf3sXtxQipl7Wg/sD4A8AwHIyZMYky50Tp/xgN2OL8y051qw2hXzwRCEdT2nmck1RxHG+w5jeO9NFQBpR6ldMIMXlFWgVndqF2dVFsJzuOgRwMElB6DcI6rznemD0RnbwQiSRS3g7Z+tVIl7PC9kahiYZm6IizuLigliT/VoUog+p8P9l3wJ7qGEanB77k3VczroUToWLCsABud4ypaLCUoxf9i/9w9ADiICULrQRWuIB6w7nuZrwaZwLBGwClSqSyz3AhHbaRGEFGOmC44D72UVgjW2C2Z4lIF4ArjodODQcqUGqAxfcpG4mJVuVqcL5tbs2z/veV0tYK/nhTAqesYNHdO5PCJZos+WuzxHJIViuXFyJxupNLg976ZK2lizUKodilGUgzyGhokF8yw5Mf+qRkjdjfuDtwkkm7DTkNaBaQ2ox1q3eMD8+B6O3H6em8Kx1Ccx9ptWl9iYIUAAWrI3I3nHgPdOtsO5eOuxXXBdj0V1vOL/so3Cxef60tlSpYwveKf0pAu6ohfdJ8k4CUqgvr5jV6VGTBKALeCAh+VbZLTnh5gu6D44A6H8cVlkNK95O1WkBrfn31R5HSy+JCwPplAxRegE/2T+AloGncNmbQyogUQx/KwB4gHj8YWNTwRAOW0FIIIndoqNkTAxz/bd09XDGLBdMM6/pLKi5whAX60gCK2ujxzEAqGL2pQ1Jis5AJEAFHvTujYAKjRf+SEugm1d2COQLU/DAwQ44caEw8AtZzSIPgAvuKkdrWMM6M7xCMBoiBn4YpCE2NCfxWAA5MEuwvCCEICwlnhAHV+YORfDsWJGgPpMKwg1b9QpFnzHbD2BK2JGul9s8KkYW17vLALQRTCBpzXZpS4gtCXXMAkduuAy8E7PijPWprXJ5CR38ygw1fJDohh2BlRAgq2OeN7uTWc1D0AFNtmL54ESBsCaJcLkDajxj5ZXRiCIGA0waDwgjy8sk5+HY+X9ppUbJSCp6TnFCMXwny1WAFQ8rUAc2wUrRL6mXTAefWnFfnz3FpbagQKLAqAzoZjAKkkpXkNO5GCEvOMLFXOnnC4xIKOjnQGNdWSM+GqHQGd7JSsxUf+JzQLwhTdV4je1nQvr1MkPGtlf9yP2Dy+gAqZ6rQytfvdHSDxgLwBF8AmAYjHWluEDiKGMiqOVvtejXTBOuRSYJwDJAARgZAGWL9Nk+IM3SzgTydE4eec1nZHbtDaNAf1Dpd/SMx2END6kD0oXtFhBXmcY+OY6AFChnKnzl7NfdMR3qCAae2B+VVMYXASvDs3/X/zHJZcB84vuiqABEo0QPnhnwqQLyRURmZBPytnwHde0M1vN2lR6picoKULaxHDIEdHkW2iWg4/7b5zb7DSQAVd0/griV2JYojfpwRGEYsGBrOBmx/OgP5sAKANkcbFzNWTRnX/GSGImMYH/LYlk+gGvdT+bW+SWH+Ig1GqL5QeTtR2EYj5LVHfjw/ZDwL8yJ6TB7UU3VVoTjTYxYDK+Ivv7dzNAZIxpZSiU8jjKgIWTcykZkBawDBBnQdMr5QeTKI5iWCB09AmEb7+ucnOQ/aTPWn6wuzyS4u+R0Ob6CUGqJpIDA97AdqINbgRgBJ69CG4Jp6q/ckjXqB/RKla4WpkO2ODgHoynigA0JiLwaNiEt95YQKJ4FRC+7brKzRH9jZbN6iJYuSHm9I5iOAOhHNJfZkh+gxsBKPbLu3+JgaWDdojhMO5kkDWSlNTg4B6MpyIAjf3IggJgMD4MCARjFMU9QCgAykhSKnUCYHB9JB0wy5aTRUxmup4h+Q1uAmDs+hpXgFLnB6ULONOn5xACNJqxghsc3IPxVBGAiQG9aLeilWUJW1FvVXEN0TKp1C6At19TMSCBpz1dHtT/JH7N9yaxp6QkF73KBxYIr10nAMproB44qQGTj6sjUrtOFPtLeFQHLES9AdDFrq1E6M13MaxVCTNAXNFThIylLcor40zxtgDAPKuVwDMrOKw+SBTbtR2MND7sZwC7Qvm4wqHa4T/uIrhb+7n0EgbQdTijoyg+agWXT8llDsAFWr/B8qP1K7bT0pvtVwHhW6+t2C/m8svvZlawi2CKe37nhFtapkDnILRqBQA+v04AjMyn79EIkXO/DnzyCBwVweX4wxs9B4rRZgyPVFqykgDd+5JSpBU5r0vHyHz+jsc3ub0KABsZMCyQgeExKyFPVIz3lmcM6OfPAGCADYPE67Jfs6h7G0o+xvi7oyK4cLZfOgpsXwC2Lq9MwuuVERonKn4nSJrcXnQKcM7dwMMXgYcsVxkSebJgzOWPqdB1ad2f3gpsnwK2LXWeR9m3danUIV1lBSCPArBwtp+7DThuBti6UDWDmWA/DvXk8LRptfPtNUlihYZTOPCi04GH3wFsnwGOW6iAs5n3GeJJ+KLoE+9VDClQ8R6vOQHYegDYwuY3S6H/iJ8jb11ck0q9Qhoc9QMWgPBZJwFbpoFN88DGRWBiqQIgWyJY3lPozaGJ1KTEPh36zpTkJrcXPRE44S7g+Cng2DlgyyKwaclfFoIwvCwx9Zn3Q1DmIPx/2/sSaMuusszvjfXq1ZRUElJkKsBEGQyYhJCBSkUqAW1tsBdpuxEVaBzowXZqe1g90G2LotjQdmMjKqtBxQERdAWUAkUlZNBGkQRNyIAEMAkxpFKpqjfUG3t9//m/c/+737njPq9uVeqcte66b7jnnn32/s6///3v//++Tz0dmD0KzC4DM6vAFpd/0L3Gh6yTDgnvLwKzAWDGiH/ThcC2OWDrErB1pRgQisIQhAa+AED+HEEY6uNLyrRnZLSl6tSbrgLOeBQ44yiw8ziwfaV4UGbdegmA5QMTLFlqsfn7XecDW+eAmePAltXiXnkuZSBkRcm4UGXtU2uo3xsAZgz6y54JzMwDWzkgBOAqMMVBCSAUObh8QuN/CiTgcWAuyWhL1amvvBbY+VgxbW477paa7gIBqCnUrbUBiQuhAKDUot13IbBlDtiyBEyvtO5VDxvvVfxW/JkWNFrCeK8NAGsY7BsvKQC4hQCkJNaKy2LRIsg6SJ3IQSe1onKKC2CsOYMeN+0Dtj0ObDsGbFsEZmWp5S74g2Ir2uA22BScAJGA+dJFwPQ8ML0ETAUAkgDTPq9zdK/+sMWpPF19NxYwA4g3PtsHxAE4SQC6FdSgmGWRRIJLZJll8EGKjHiX1jwaN10HzD4BbD0GzC4WrsKMW2pNobZoCu6CLCDfCTqzgg6sr+wFphaAKQfgZHKvpRSYg7HN5XCL2AbAZwPrZGaj6ippXhgn0kqmU1woxnHedg5AATuWHig2FE1uVRwoxoX+Wcbg89S3AqCKPONcCi8oPtVP+9++G3j+oSK2xRBFDElUxbTS+3nvc4FpDsjxllXQoJg8FgdCQoGJJTTicLcQ6vPL6wbg9cDM4cJv27oAzFA5ky9/UOSvmg8oP86n0dICBn25JwjARWDSAUgBHN6vfdbv10AbARh8X91vDM2ss+NvAECKPVLCsHoyUgRqrlbnRwB933OBc+4DXrIC0IEmiLnE75di8HsyAcjzWUVGUi6uICMpVwwJVMXdeOk3XAxc+Hng+vV2esAYw+sWoP31r3eLcLwQBeQUrEHh4Jo2h4vDmJPuAyMLGAeEn7uqbgB+I7DlSWBGCwe31Gb9aL20kGDb/EGRxY6WTz8f2wtM8l4pgL1SgM8esHCvsuylME4nn9cfQLtldg6TZ0kUKorAfij23vAPCmqp3fcCl60XFINid1PlZrf41/dnApB6wSQjutUfIDJR8CGIQOwWEH7DywpKrWc8CFzqRLHkVYrB2jS2FQH5vkuBycXCAlIUUAAkCM2iRBA6+ARCe7DjYmQduLYTleiQ/XTTS4DpI+6nLhZW2nzVCEBaMLd+soIGqjD1ampdugiYWCpeBKA9bBJC9ActAk8LES26SqsftInLZ44dQif4Igdhym5WLrPDyuYH/7HTCNwDnPko8LXrBccjQaioe6BiKad3+QY/MGTH6rS3OBvCnQDuAIyqhiDkQ9RX+29yE3on8IwjxQPI8zkTiApGU3oVkD/4fGDieAuAdMw5MFQjEgg1DYsUku+a3uI0TGBfV7PotwHwaOEmbHEATvuDIutni6UAQoFRIFRYhfe/dhEw7tbe9Of0Si1g8HkrwRcevDajz07gIJ7n05rYyWIpb4ya/7vv8PRdFpj/LXDmkQLAnA4jCCOlTBRN/rFMAJKgkkVHpGUjySSBSFeg7/azqk8EgbSEq8UDRACLKDXSyaQ7Br//DcA4LSCtwnKhTEkQcmAIQhtM+Uaajl0uS9NatITXWzpzfcdNB4DpY+6nBgDaCtanYLN6fCj4u1ay0QIqtML/EYC61wSA9tAJeP6eWsAoDysFpg1eB0HIQRCIIkVeCqQf/05P3WCB+UPA+CPAzvmCaFWDKEuYcl1yMN+Y2dckqGTeHPEvvWDSNhOAfbefX0A6rS8CUw8X9066bFIfdqMHJID++DJgLACQumyc3gyAEYRRKFCLD1eu5ODLF6QvXedx0w3A1BwwxdAJLTXjd8seQnGrZ9bPFxLyA7WIKON63tYtCQBN/sv9QPm6BkLp0vl9t/m6ietR6fbyBA4gnXtORwRRpNnTtPpW6gWLH83lKqcOFTEnDiKtoHwy8RNFhrefyeztbnrBfbWfgttsP+kIyO32ELD1cHHvInrlvWs6TsnB7qAUlg/suFtAWkE55zYQ0QpqcALoNCXTEt7A3KoaDwGQfqoAOEUBa7fUbKctltwCajVbxvSiyvoasM0BaBKwwdKb9fN7NfcqBWGiSWykWXER0umeacUEonQgCKRfIgDFjya5yq8Wfsfs8dYgiuMxgpAg/vnMzu6mF0z6Zj5APdvPQec0TEosnvQosGOhaLuIYvnwEYSithE52F1XFAA0p5yigD4otCqygFKnpHUpLYP0OcKURYv6Mj4MNR433QhM0gL6QongawOg+6rl9CswKoSkEIxPyTsuAPigCYBmAXVfYcVf+n0SRYw6dP1YwNgHsgSajiJP429RrpWOM6cxDiJB6NINM4w7LbUGMQUwB/M9mZ3dSy+YVG0EoBiDBST5ddZ+PkCsAiIlQZDa3LVatJ0WXG2PbL98AB+4omB3oP/HgTUhmGgBfRqWf2TTrUSjExDSP/qWzQDgfAFAWyzR8rkFtDAKX75jo6nUguZxZ8NByHbvvqBQ36T1swcsBaBAGGRg40Ir+rt9WUDhQ5ZAU7Es2e9LLzglqHRxNkbeuW+oQRRls5jaMjnK0a9ecNf2R4LAwO829kQB3LTtEYQPUwzQAWgW0AGo8AQH0ljp/V17pm0KRcEifGuNOnocO1rACQbKPXhs8TtNwVr5uh+n6Zf3wDgu29g2FdMtOc8B6PdpFj08ZFrplw+ZA5FTvAQQ0/BT36FPDkRqBT9Jag7xYlQItY0f88j78sZzCcKPZlrAQfSCK9uvB4h577SCotUiEJ8opq8IQFl/PUBPEoBLxbRE62LSqG4dFB8r5bHcOtiOQSqT5T7RKzYDgJx+BUCCTxZQCwhaQc9oKcEnEBKknj5FsJ1LAPo9xoWWPWDy+6IIoqbeaO0VA+zHB0zxIQDKkn1GgtXiRxMIAx0Vn0Db+lkuFjLRCt5WEwD71Qvu2H5OfekD5FaciQay/GIbFgBXriwAyGmJADR1ck3DwTE3TQ4B0LetzBJErTYAr2BBSI3HTS8tLKBZPo/fWQDZp197Z3scjGb5BDp/L3+njMweB6B83Gj9wj3atOsPWin9WgXCFlVO/3ctf4iD8XkBkH5USlAZlNPZAQqARr5vxu1yjmH0givbX0UQKI63o0Wun/xHuR8E4VnPK5JQLd4VNttTBvK2uoiKOUf/f+GjwMNBh0NMV6J0c0NpcRv7mrYv3kh8/uHxYp+bVpwLp3R7sts2YzouSq3KGa+q7+x7Co4nazAerRKsVlV1QitF59dyyFZaYY0HMu9mWL3gtvZXMbymBIFMZ1ov2h0B+LTLisxgW+Eq5uU92iZ72ud9vvR+4JFp4NjkRh2ONi0OB1/UBCkvEYRhfuNs4OmhhiPKnFQlx6aAjMnSXJUAACAASURBVPjmz1w41nnwO4cCIBvBwZgTAOUHRq3gyDExD4zRGVYEnpm5LqmQc0M5esFt7acFl0SlHiBxuTkYxxdaihUC4QVXFu5FCUD5QtJl85sjGA0ziQxqeu/fem+hw0F2fLLQGxFlYMRvo7v1WmIVtpt1DFkXvOR7LwJ2HSkyoZmEypoVVe8p7b6qEMnidGG/Vl/L2aPOIwuA1pAIQE3DAmFa4j9f7CPaFpCHKujr5xzZesGdHqAqKz5X+FLRAl58le+jui+kTBALMcgZ73CDBkpN2/7+bfcWOhwUyCEAjQTcAVhKdjkPc2RajewKyu/n1//qJcA2uhBMRGXQOcn9U6JIOjXHQqSYOsVoQp1HNgAvz8yny80H5PVz9H6RqVd849WtXQ/zA0Ow2ayGLJ474L0G79vvbulwkJi8BGCg4S01SKqofoNvSIC+5zkhFUupV8rUTpJN06KpaBkFQm5M1HlkA3AyM5/u9Zl38zrk6f0iU6/4hmscgK5ISUtCTowyDqb7UxwsqFJW3fo/vbuIBJEZ1YRgyHwQKNi0KEl1OKTCZJdxtPDn//v8ooaDaVgqFyiTD2IKfcjZS4Fo+7g+HXOPv84jG4DIzKfLzQf8KVfI/FNKrQ6h94tfz+vOA9cGAAbrpylY2SDlVTTt+uCnV3/V3a7DQQAysJAwobZJgUXi78Qayhd812WeiOAZzEyUiAkHMeu5BF5FwZQAWLPwknkLQy9CrPMy8+lIHZFzvN3T+YbV+8X7c64OHHix74V6zIxB+RJ0wQ+UU992tYoFy3fcXcTDxQkoPsCUhFIczKVCegSg5B8A/PILN9ZwxBSxtiKiUAOi7JW0dLTustF8AGbm0/1o3vjjnSGdj+lYlGwdRO8XN+c1wABIoHk6k61yuSCJITq3jDY9Vx0BqK++uwAfX6JkI/hME0SC1EGguiQ+isqcQRLrF6/0jO2w+6FMnZhyZYsQ1W50qOHgPX1NXndtODsfgMwHzMin+0+ZN0S9YOllMzWfLwKQSS396P3iY3kNOLDPM1y065H4gOW3p4uTDkB8zWdb7FgbdDhEgJkCUDRvogTmd/vPv3BVAUBuvylNzAAYi4hisVQnEHoIqWblrxqm4Mx8ujfljT+YjsWBYgIOc0oJPsq1slCpH71fKybJOEoAuuVTRSCnYlmU6P/Z4iSJEcbLv+Yu9/1EAh7JKEXDKxq4ChUiKymRbwjgHdcUWTARgLYXHSr2LOU+BV7MVwzxwOfkOWybYAGZD5iRT0edjpxD6VhcOQ6j94tP51wdOHBdMeXa9OqWRcmWXA1XLUIUH6zyCwlAs3z+YBkfs1u+VIejJEF3ckrjI9T0y/aMA2+/tgAg08VURKT8vbKMUgAMIGzzAcOi5HknHQAz8+l+MW/829KxhtH7tTz+jIMAJPCYMULAWd6fvi+EY9ouoZBM/Kx/4LUBgFLgNC5o16FrE8JJVJgkiFhaQQBv3+dVbMrWVsC8UxFRkjjaVsW2DtRdOJ/vAyohVYK7A+bTvTdj8HlqTMcaRu/XxHkzjgNkIOWuDr8jnYYDKDutgpUhra0uAlAyCCUAK8BXcjBXgLCk/h0D/hcByDxFAdAzoFUqUBYRJTUcMWdPP7ONL6i5bLQeALJRQ+bT/W7G4AuAOXq/lsGdcRgAY+glLkYclJVTsa6ptCX3uQjAKINQstFrAZKIwWxQIhIJuovB/Nx+r2LzFCwlj8Y0evl/MYk0kieVtcvrwGUnHQCVjjVkPl3mItQsIPuElx9G79dOzDgMgGkAWlNyBJn8xKprBRC+zgEo4LWRgcdVcOCjjlNvmx84DrzNAahaFZWLygKWxUNibIhTcPD9BMLLa65bzreAMSGVoXvJ/Cgh1WUfO+XTZS5CDYDs9GH1fnOrIDcAkABTTDCCLYK0Cwi/586WcKJUiEpC8CCBYDsiiSplqUIUmOjf+o2tIiKVUJbgU5uSWl4DWwX4+PcXnrQATBNS+8yny1yEopdcay+930y5YhgAg+9n2OoUeI5TdQer+32fdhmGoOBZanBo+g1yEKU4dYgFSvqB//vZBIBt9RshkTbW8ZZZ2hUgvDL3iU3uux4LSBM0ZD7dPRnTH08VAIfV+2XAOucQAMuVcKfFSD/+IAABsEoGwYAoHZIKEEYxRIHwLS8pUuhjFVs6/ZZhIVWyxVKBBIRXnbQATBNS+8ynI4tBzkEACv+chlUVIKE/5cRGsWmlKfIzudc3APLQSlg3E2OCyVRc1kpU3DgBmKoQsWtlBcswjPu+nfTYtBL+GQdgOf16GCZW6pXlBCqWSgqJypoOAFfXXDifbwFJLvi5HAjlnUsiIe6AjOp4iQNQHRlT2PlgJCUbbc2s+v/hFwFb/q7gm6HlYpBbmTV2sscQyy/qFBj2v0/cAdz/HGD7NDA1AUyOOU+1CwWOewNjKj6/O03F1/WuugW4/XJgfBoYmwDGdH7IxB5kLPIB+I8AfNwZgga5ck2fJbEm8V9zNWPfrasbgMuPAcuseJ8Exsb9FdBhA+7gaQNKB6TfcgCYug+YJT+g89aoBDMmIMScP12uTKj13uDv8zsKig/uJ1uQOsnojm3qB5P5ACRBH3OhPuzzRN9DV88HqQLEWPJnvTy5nm/t/1s4BcuSpRZtGAu4fi+wtBVYEyccrYwn6hF8/FkJp9bKxAKVFsn/d8urgbHPA9NPOEOWl4+2cfoFHhfVrJTZPKHSj5daOtup6JyCpPx8rHWRVQ7WOlrYCMx8AHIzlxkALPD9c0VB+x/A3E/+E2fUYHXdF7KTGwdvTd0AHP9r4PgWYG0KWBdfsBdsMPfPrKKsoL9XAVLAvO2fFylCE4cKliyrDVZNcGS1CqEYhWFiAZV+XntaURdTLmpCEbpchTYLqi6NrkMCzLzt5Xc4HwyJmmkJ+Z73jQOh4NWeDUZiK1K08f0EXt7CMHVawIk7gaVpYJUA9LI1Ao8bzKX1cytoFtFfpdCIWz7rgzHgth8u0oPGDwETc8CEMySUzFaikgtlpW1Ta8JqNba7lVljSRgW+Q6ZP/57WQvj6fydBjXfAjKbgEvMLwWCvhNoipgNpnQshlS4IGFWzIk6ylWwAz93ETLxGWB5ClidLABoIOS7pmGfG+33YAG5mND0G8F4678vkiPJczNOAC4UyQm2N8w94kirFlfIAl7i402d6dbPWWAtrsjOFiuCvAJZOQE0pHTFsckHYDeCvhNgipQNxoAz8/8IPr5nbvH2jd+6AThJAE4AqwTdZKEBLDoDgU4+YVkPHIBoPwareOt/BkDexsMFAFnbzNJYm0IDnVwbt4uyur1kwL7Tp+iZM/08WT9Rc7DHUmuYTr/x+6o4ovvu9fjBbgR9JyA+omwwxvZI5ULg6ZW7y9FPf9QNwKm/CgCcKABovh8ByVy/UCtJq2f+X1yYJPGU27lIZLbuEWDsWBHesZeDz4iURLUWa1TE47LqK12fZmd3OXidFctqm92KatVs1jAEsNv6sdymaa2g8+xUL4I+Pn2beCgbLGWHI/h8G3oTr45iK86POlbBU9yKI/AcfLR+ouQwH9BfmmbLlTHboOnZ/T9+5vaf8FUaAThXsFOQ45mUcgZCWTAxe0UQ+urYMO1/37GtxQmoLCBtRSp30LrDp2SFdzYMgk/R+VNwvwR9mwQDsaspGSfJgYDYNTbp8psCQFJxEIBkQjDrxt8dXCUIY+COH5MVFPi8SOn2n/QYLZ9Gp0cxANIP5IvAkzVzxivRydnKNzBa8fddM84b6AFyAriMF2pajk9kYIeoClXmA3AQgr5NQEHMBqMVFMNaIOayNRL/vhlH3RZwmhbQQUcAasrVVGz4EtjCu/3dfb/ID3PbT7uKAZ/MhcIC0vqRTo4W0IBIEAmEtFwCYqjW03bcmdwBYeoWgetUbrR8snrloiR2drpACf+rD4D9EvTVjIJu7HBV+781X752Czj9lwUZkTEgcPoNPp5Nv4oBRhCG6dd+1DkMz1JIhR1BAHJ7zwqO3fIRRM5tmDK5CoQKsSgOeBYBKFZULTqcB9r6Ni5KYmd3WKDUA0BlhNLM8EbT1QBXBU72aI5ZjUcVOxz7WLkQ8d37vsart/uA6RcPsxNSAtAXHDYNC1AEpf9s01kKwuBwGU7HgVt/1jtD1e60fgQigSe/j5bQp+KYpGB+H62jT7P8/ZypBIC8Dhcx8eY9wF015abhmnoAyJ5WSrKeNgKO9SHxnT/LSasJBim5lRjWBEIVeROInKL1qunybRawLgASdEy74qjaNNzJCgqEEYzBGvK0297mAFSHEIB6ebKDgc8J1ksmV8t29f1en6L5v6cxIK5iK6Xne/5jCTiFcTqVn/r/tWDPWwXnEPTVgIKUHU7ljASawKefIwDpMdRxRB+wFgD+RREDJABpwSzz2c0LfxczVjkVKwaYgtBBezu3SvX08d39P5uO3QKahXMQciourZRAGKZWar/YZ1xXRPe8wQr2AUK7TvbOVTZBXx4MBECRnConUBSFEXT6mf/TK+/qmzAF/0UBOPqBZYF52HrTFCw2LH5G8UCzJEko5nZqmRnPh/uCXmpnVpDTsIPPwKApOaSA2QLDLSHf97iPx0tpISLfz7bl4iFfsUsnj+HZWEeOYDCDnDmCvZkEgedcCjxGseIhBYt3vx049HwMLRh8gA9gh2MoH9ABqKJzxf0McO7XlSAU4HzhYYFq+5D7hwBu/98OQLlIBCKnW39SlXNY+nqeiq2dkQg+gnGPb9/ZpT0lq6MV5D96gLCwgDmCwbdnCvZmCgY/dxy47xxg5SWuUjigYPHFbwA+fyGwfr2rXrMvPB+vp3L3GHCgi9JOHQCkRVPppeUBigXLFymyejYTB4YsgfA20ofRAlYB0FfAlvQqP0/TsX5PLOB5DNu471cmIwiBaRww/F01J+mz2pqChxUMZvpJlmBv3iTocsW4dzewfhkGFix+2febXDAeJO/YEILBB7pU1g8LQFo98QASVGYNQ6DZfEG3fnEqrgLhbf/HV15anbkFNCvohWSl9XPQ2XTM/2s3I4DwPIZwBEDfgitH0Ek6N6x+u/iD7T4g/YdBBYPpWHEaHlqwNw+AQa4Yj54JrJO+aQDB4pt+oCAyYvOPEIQDCgYfeF/9U3AbAMX7ItAlVtAspKZdz5SOlvA2pstxjES3wJ+92NgAGK2gwi78QoVfEhBeQACqNNP1RdoA18kKdgDhxkUI/zKIYDCnqyzB3jwAJnLFOEIW7QEEi1/1Y21ywVglCAcQDD5/Efj7M4CVrZ5AKlkhxeQUaxBI4nvFzxf8IfCVC4HV7cC6ZEX5nen3VX1vAGLZq8ysrvHY+QBwbGfI2E6JpLvdX+ksthpUvQrmX/sVDGZVUJZgb17vJHLFeGQcmCdVb5+Cxd/5xjZ6QzzMLOQBBIOfTV2Ps4HFHQ7CLQUQmUrV0rgKJMsCjsxGAqTn/hzw0EXA4tnAyg5gbTYBorKkUyLnkB9YVhTxu+kT13iccwtwdBewPAus+b2ar9xJAafqfgMQO4dh+J9+BHe5gqZZZzYok1JJUcpaR6bp93P+W/N6p0KuGIemgEWKgPQhWPxdP7NBLhiHKYHUp2DwpZ8rLOD8tmJQVplOLxAqmbRKC6EDYC7/CeCRPcCx3cDSrsISrs04CPm9ArZk55UvKAspYLqPaPdR4/H0g8DRHcDyVr/X6VabLHk2PhjpPVZY7d5xwF6CwS9y/4LbbVyQsEKIufGiKe0p2JvXOx3kinF0GjhOQY+oNRtljji9TQPf/fOV9IZY4Gq4D8Hgy/4W+Oo2YG5bUUy04vUcLCqSJVRWszJbNgxSmMau+q/Ao2cBR88EjtOqbgNWWaTkIFz3YiWrF4nAjtN0nBZrJnU+/8PA3CxwfMYB6LUra3oglL0tps6wlVha5rLiqd9AdDfB4Je6U0s/0BXTDYh80Sr2FOzNA2AXuWIszABL1JaKWq1R+nwGeM17OsoFY5XTVw/B4Cv+Djg0C8xvLYqJCECzgsxmZlq9T8e0XGUyaUizavPtxoFr/zvw2BnA0Z3A8e2FVV3x6c4sqwObckeyhiXAowUSADhD1XhceDMwx37lvU4XxVN2n3rJIocygkr/Vbs7fe+EdBLcfaXXQ3IPWIrpBB6XlnwpR76jYG9e7/SQKzarxM7qJFj8mg8UarMV9IZ4gvNDD8HgKx8HDs8A8zMFAFnPYQPDl0Co2g4fpDZLqKCxT0/7fhJ4fCdwbFvhRiwRgJruCOwUgCpeCvUjZmEFxhfk9W969kW/B8xvKQqnVgg+B6CB0MsI7P70AHgmd2n1NQ0rv7FvALIlVYK73MnQCDLThSGZoDpuP7uCeuX5n8zroB5yxThGnQ0CgyBMxY63Aq/5aBHG6EBviDlOLV0Eg1+0AByZLgbl+HRxnZXJoqqttA4ODovlJZVuSjTQFtq+NwNPbHMAzramdVpVs6wEoPtdNg37wJfvsYiJP9NFqvHY+7vAwjSwxAeNxVO8T6aNVRRRlT6hHrJ0Ovaw0WDJCKng7g86APvNB9wg2JvXO33IFWOBgn8EIf2nRLD4tbe1+AU7yAWbZeskGHwVdd2mgAUCcNKnJgLQrZ/V9/Jnn5JUYmnAE3hCmv3+t8AWQfSzyPK/POOgJgDdsgqA5nfJAvLdLV+bz0kK4RqPZ3wQWJxyAPqDVhZQyQr7gyaXI9axWCFVAGLvRUhV46PgLnUWBs0HbBPszeudPuWKsTRZAJDTo8l8ui/42juL5veQC7ZpsEow+OrZQlqVVuH4FLA8WVyDAOTAmHUQCAWQkOlsQAwDt/9/AE8SgPQpNa07+AhAA6HLXbb5Xr4IaAMfv/eGvP5NzyYA7UGjBWTWjh40v9fSyscHLtaxhJWxFVsNNAXH1khw983+DYPmA5aCvXkdNIBccemfceooAfhAAcA+6A2xLuAGucxrzgKOMexDfV9OwbS2BB/BEoqLSrBoYGgJ3E8qLcIEsP/ngCPuUy7S13L3wb6PU56/m/Xj4Ps0TKCXQA6AXuNeZY3HMz5QANAeND1kwcKXlj6wOZQ+b7R+Pi0PD0DeFAfk590CKg8qncfoFzIRVWVqfFfBhgn25vXOAHLFWCDbvPstBsJZ4LUPt+jdesgFg+qVptWq11bg2gtgfuLiRAAgQeg+oEmsOujsXb5SsAoCIN/3vx04OlNM6Yv0tdx1MKvK7/TFjVmeCD4HQQQhf159eV7/pmc/kwCcKABoeYvR0oept7SEoZQ0Tr1lPuPQFlAtO0nyAcWhpzw/FSjFzGjLx+RGvxzoSeC1hwsA9klvaFN5FAy+9mJgnhaQ0qqagglADo4c9AhCDpJPl5ZommQ8738HcGw6AJBW1VecZv0cePwOY0/wl1lAD/WUCx0mMlDLr8bjmb+Dwp3x4nkDYbD0thIO5aNtfmDi/xGEeRawxhs7Vb/q2huABQJwAlhyy2cC0xoggjAAUCWWAkksOiIY978TmOOqeqqwqAx3WGhHK06n7TDwOcAV/iipPAKjwgrZm2o8nkUA0gKmAHTrp+o9MTrEYvq44o9pZIOtgmu8mafCV72YAKT/RwAy5OPOuVlAAk9Oule6xQRTWUKlWtkU/IvAHAHti5oIwDK841ZPFtCmdr0U8PaC9hVultd4CIC8P2Ztt/m5/qC11TJXlJDGGpfGAmYODgFoCxACkLpuWh3KCgqE8gNVZK4KtxgjJAB/2X1Krao1rfN7CWZf3LSBT4uAEIyWBVpipL7GgwA0AW25GbGENBTRx3rm1M2w39mmrFVwjTd1Kn+VAZALEE5LtIDyMWUBvbLNLGHgd5H/V07BDp7r3uU+Jadgn3ptxekA5MBri0/Wp4wzBjDbCnkMWMqVpE8GJwLQqvfc0pqbkVj5aNk7gbCxgJno30cAjntowtXNaZ1suvSKNhsYTcVKmw9F5xGE+94dfEoP+JYhD/8OC8eIPUsUHokVVKB78XszbzAF4Pvd//PCKVGIpOAr78mn4DZOm8YC1jco+w6EFTDDPJqeCEBZBa5GffVbhmQ8DtZW5TYOvPhXip0GTuu22lTMLSw+aAVl9QhEWjurI/aQiLJkTMLsX9R3r/ymZ73fp1+37OU9hunXSkdl7T3QrhKCtlCM59k2i5CMMSIAGdqxEIwrmptzTsCEut5yilKoJLAcxCq3fe8tLCDBFwO+tKjyuxSCMdYEXoeDrHcHvu0tTwLzmwHA4N/Gh6zNCqqeOSxC2lb8tQSiMwbuqXIqAcjFh2JjBKGJyShQG6ygVbfJegULWBYcMR3rvb6oCRaQwFPgl1M5rR7/JtBZOIZWx/0+s4QeY5z/1/X2tFnAxPpFELaVkdLN8MWGVr4pCBsfMHN8bmTKfCjZ0Ncp456/x58zLzfw6Qf3ABd8pUgEYmqk5bGyek06IQl1bkXScnlN/u8L24Gdx1qVq91KQvrpgwaAAw9p+wnXPw1YjyWMGtDo2ASOFGMU7SIEUzdYD34vMPmXwLbHgdkFYAtlGiim6DpxJtvq9LtlVr/aWKEB8pUXAOOPAFPzwBTZ9r04vdQ9Ts4pAZ3cd+yHxgfMAOH+vcA69/9Uxijmz/AerYpdar1lNSMYzV+vWY/34I8DY58Gph8Bpo8A04vAFEFIknIHohGVR62QhFRSYjQE6qFri2z3iaPAhHNNlxKwArI0Q1IAxwfReacbC5gBPp66/5ICgLKCtqnsrKKlrFZUFPKOr7osMTtdsxzqQRZ93Q1MPARMPllohUxRqkEK6gShOP0S+dY2hlRv99y+ovRi7IiTnTvLqmg6xDPYpqAUgRgsoR7MxgJmgHD/c4E1FXu7FRRbvEgd7evXWlbPpp9EgUjiJpwe6zwOMlvpAWCMVusJYPIYMOlSDZRpoGiNxKzbdIQlXONMWJbGtw4svdgz3El47nzTRvPrrKptAJT6ZrzfintvAJgx4vsvdQvIXK5VYF3sUZxmJUvgA1FOvwF8spKyBtM1y6EepI4LqVMedbEaTp0EIKdPKh5FqYYqSxgo2jgFr13j6XXHnOiSZOeBVSvyC8qC2r05FVvVw9cAMAOA178AWPMp2LJaaekiCPXExwHw660n1oB/niGQazwOkkSepbJ/72I1x4CJ+cJ6lYI1riccrVicUuVSmIW82pkwnHHVOKbFsOozQGkFkwewnBES37ABYMaAX39ZAUCCb82nIlo+40p2gNnvsoKunxH1xGwA/LOzdQOQJPIuHzV2GBg7Cow7AI0l33XfjOsv6oVodes6ISbBsAZMX+kJxU56KY7pkmFVhOciuvTzSt05v0+ryuT/9gDrZNe4wPMsI7VJP3GcP7gUOOdvgL1rRYJ0ZI5IV3hV4/wrGYPPU3/AiRhYusy2K7mU999P+z90ObD7LuBZK0Xdkeq9NSX2+o4HLwfWlopFCC0fgciBMtAFC8CGrYXVoVjnU2G7rTXrzh4kfRzLY1kyGwBoeiGcPiXb5eAzdXWnazPCSScb4j3xfmav8Cx2p50lAMW0VXINitCogl2r9H2dcctWwQxQsn6ZTBbMNtcgdKIbiZj51VcBk38CXPxoQcfCUg8pjcYgZScw/momACnXyr4leBhs5QaBTHpf7X8dMPYJYO8XgAv9e8QJlAZZq8D4xSuANYKPJQn0AR2AHKy1MACKe9nfFI6IEqduEWoHIJ9wlsVKLekoMCa9EAegSTYQeM4TXco2SEMkAHEbBZoj4bbYtdyCVrFqGXgTSxgXYTZeHLi9AMjEQRCVUXP/n4KUaaT8vVTi+Rtg7GPAuYcAWlMCgUVkQfJ2Q12yBvPXMwHImhDWwf81imsTiLSEvHZkr+jY/p9CQRD4p8DOBwteItai05qn31FFdfLlFxYWgCDUIkRkj/TxbCEi/89jfPZ3X2VqYSJQbmUNQY3HQT7hbv2sLoerVwKQHNEEoCsm8R4MhPRjXUGzVEIKIoY7yaEYuY4dgGb5RXruoSgtSCLLarkICQ9f6QNykGjFdjsIBaI4kGlt8W+Rg5g0HJ8qAp47nihAzFpuWtPIMBZJlASILvR6fQ0DCVbJCkJOJCqnk4pGpb99tZ8MopyiKDX7WWDiwYKXiEQOehCrgKh+eJQ+EQHo1Lby/zRlyf8TIbf9XS5ftIb8I92YugH4ay2pLusorl7dAoonWtMwQSTdOFuQSLTGHyIC8kxSIQuA4hwU2WUAoO4/grBcDbsfWElSzg+JCoYDoEGM1ixSkHzgF/wG7y8sIa3J7JPAGWuFJSQIaU01iJHUiYP4e33BrPOHmG/JMaOfTZVYRhwGav87vWKPJ9/rSH4IOGO5sITqg/ggxXs4TOaBAECbeoOsgfl+DrQShFqcEIhyyt0MbMusEkx76iAZXKM8BvXiZAGlF+KaIbaadYpem4aDgpJZQz6YJABV5VcHAJZ0v4FxX6KG5UpYs0KnqjhRuagEVgPglYAl9ciHf8mdUrJh0Qx9vkDBzBywfbkYQIGwahA/kglATsHsDzKA0BATiPyZ4NEDwIeoa/uFYKKXL2f24nQoIgd9R3yQCMTFqwIAfdBWI7+yB5ZLECYLETd85YJl+2YAUNosLIel/xYlu4Jsl6bhNhD6it4WJCvA2Zc4Gxo73RcgJeOqFmGR6rcChLYACyGojmEYdj59KnZ+tIQRhH9IvWA2hiREjDeRI9Cly7fMF3EtWRFawhQIf5IJwE56wdTIYdt7tp9ys1K8JnoJvod9Wn682PNkP4hUy1ndWgstAtBDMLYN5/6PAc5DGNoF4SrZfN+4+IhT8jqwg2Cp8ThIJ5vfSWBXAVCrWN9SMxDK+skaOvhoAc8me654pmUB3f0wyt+E8FyRAGmPlOEoiSD2qgvmAKoOm52fAuiTDHSyIRxx+lI0QxxADubfF5vffMmSajrWlP7nmZ3dSy+4r/ZzAUEHnQ8R70HsXlK+PgJsW68G4XYGZj0EY2EYATCAT6tAhmE0DXcC4faapcwMgAIfLb0kuzT9Qmw5uwAAIABJREFUSi+EfeALkSrpBovbrQDnkm8wAo8/E3i+CCsZ98NCpAp8cUekZyBavI4ET/TnaAk/RQCyAXy6uNSPA0i+wMeB6ePA5HFgZq2wpNGK3FUDAHmv3fSCe7afX8CB4UNEEOolVi/3obastNwJ9cO5BOBKEQMsAcifHWzRAigWWAlCn5K2bQYAOe1KMjTIR2kRUhKVS7IrLia0v+3xwHMZMCbYNP0KfG79zAqK5DxOvyEuWu6VD5KSHy2YAEQAfpaRdl5UkuUctIpBnCIIl4psD03FtIIP1ADAlBuJM47EqqUX3LX9kSBQcuuyftK78xUkHyQ+RLqHZ3Fv1KcgLj5kAQ1s0Qo6IA1nHhNLQzA8ZxvBXuNx8DcS5UYpNnoYxsCnUIqvZo0F3wPTMa7Hv53HOJVbS/l+5bumX7d+5WLE44hxIRJB2NMCqj9ixwuE90svWCaIA6bAp959EKeWChAyA0PTOV2unGMQveCO7bfqHbcS4rJR7Ewqnw5AWhLuImg2uFQAXAVs8RGmntW4+g2hB3P79L/EJ9zGvqrxOPibiVihAOgrWQOf/EBfBcsPNBBqW9Hv6zzGqFzmoXz3B9AePgXiq6bgiv4YOB9QHS8AfpkAFMMjrWAcQA0iO9XJiQyAnos2vV7ESHOOQfWCO7Zf7F40mZFQScRKAYBaSU6vAVcTgN7xXHiUFpDTMK2dFh56912BTiDcvpkATIXzCL4g3WXTZ4jpGfjoF/oihL+fx+0yWUABLwIwtYKKIabgCzHQvi2ggBKn0McEQDaKT5cGkIOo6SuyYzEfjQB0EM5nZgAPoxe8of3sgSqCQM3jkdFLvpRvR13+7UVRuhUFSavNO6otwp88ZZ3+t4M6HLtch6OT9AG/q9cmtf//gV1JDYcnQ2zY6/YakfSrU+Pg1M45NqPt3IEtoM7WFHokyrWKkooglCMWLYjiUXMtK3g8Uzd1WL3gDe3vRRCoUEYCwGtYFxxqgA2E/jI20F5hhmQod98BHNnlxOTig1aGiDanO21yV4DygWuB8YeB6fnC9WEtiKVVKeE0ZGiXWczeJoWMIig5a9V5DA1ANoKDeDylZ9NSXxyAsiKawrQqmCv2HVf5e8aRoxfc1n7xs+khItAUvojvyWryxVcWJZksVSyZoQRA3dcAoHzax4Gj2wtu6FVKM7gMgti02jbV476oUJJs1j/AbA1mQ3Pm8eTRsoZDtR+xZKCiEKmMXTIeXHPGdhYArX8FwG4DGMEnAHIK4yvT58nWC2b73cexaZgWWaEKgU1gjNbPP7PvOYGsUSBkv3hBtmRWNzxjTk9RWktvxp6POj0vARjY9sWkFel8RWxegjIF4RjwAOnZWMPBTGjqvHmszxJOBUD3xyznL2bqROvoP3N3q84jG4C7M/PpcvMBef0cvV9k6hXv+2Yno5QfGArRbaCC0mWv2YtF3ecerNDhkNZIIsXQRv5dlTtGADJSz2gEE1EJQM//026HdIEZLC8B6A0tk0g1Ja8DuzJdphS82QBEZj5dbj7gxZN5er/IZI+67pscgE7QaDOUMyC0Wb8+gXjuR4F5J6YsaXnFhBoAGEVvUhb60jISgCQnoh/OLBgvIrL8v7DdFkEYM5dtNg97tvz5zJqzdfIBmJlPl5sP+DJP5xtW7xffnzeh7H+Z+3+RpkyWT1YxuURJYVtx6T0fCTocouQV85VkHRIGegEuEv/YKpkA/JceVmL8kv6t5/9pu62tfiPWcFQVEa0DZ9WcLJEPwMx8uvfnjT9IgZyj94t/ldeA/S9tMaGa9SNdmsIxbvVscVJ1GScoMt4UPwhAsmMZ0aXzQBsvdGRBjQz0FUpEJRAJQOq4KAnBdz+sfiPJ3bOYn8fsykyVWMfiN3BOzckS+QDMzKe7OW/88aqQzsfE5kH1fvGjeQ0wADodmVGwOeiMsUqHrGOnS4UFy9P/wAEojkEnI+IqOIJQNLgpCXhcmLAtD/D+kgQE235L93tj+YBqgTX9BiCeW/NedT4AmQ+YkU/3sbzxBymQuZhm8g1T+QbV+wWFdjKO/Te2mEFNlCb6gPF708VJ1TXHgKd91GnZpDfi1k/gM2vqU3DUnCuBmNQe3P9vw6pe229KOvB0K1k+ZS+rnrfM2AlA3JMZtah/EZKZT3drxuDz1O/yxAwu9JgJxr3lQfR+8aa8Buy/wdWQZAVl+ZzCrG3q9c/YrkmHy3IRYryAAqAkEBIlopJxNNUbER+fA/H+/+AAdP9PmS9dazicJybm7mlB8nR2dI1HvgVkOlZGPt2nM29GCamcGZjAwlQ+vvrV+8X/zGsAAUiLVPp/wd+zaTMFWw+/kAA0GQQnpCw5mDsAMIrcRB5mC/+MAffTwgfwKY2KfmCZ6ZIkUShrxXxBX4yYaV8Hzmcn13jUA8CMfDqWYeQcSkhVOl8U6uxH7xekrsg49h8oiCENgC5TUG5vKxxT8f2aRtOtcAKQ1s8soPuOVUIwpchNlEEIOyNSIrrvv3hwnckWIZPZsnbcDyzTpvg3lU8mpZQqozyfK74aj3wAKh1LgrsD5tMxiz/nkGD1sHq/YNFOxkEAcuW7oqmXlisuQOT7VV2jwi/kTgj1RkoZhBje8Z83SCAEEJZW0C3gff8tADCt4VASaWIBK0HI9q8BF5yUAMzIp8tNx5Jg9bB6v/jdDPSRns0BWIZeUitIo9IhHmhXTvzCPQddccnZ76U1V/IvC4SBCFyg26DFNg7c++Mhhb6qiCikT7WVUmr6lYn2nRKyrdZ51GMBlZIc07GUBdMjny6XCiUmpA6j94vMZbgBMFo552pu27PXAqXTyAUQcitOQjAm9xX0N9pIwIPmSCmH5QuPqER0L4kDYgp9zOUL6fYxkbZcFceyAreAF3GlV+NRDwAz8uksnT3jiILVSmpWNlhMze+k94vMZfgGAPJeHDjpCrgM01Tdry9OzvmYAzAqLVWIwEShwzbRwwSEn+MqP6bQK5tZlWyhjCCCsC19Xv7gOnBRbgp7cu/5AOyVjqVMmA75dJZ9nHF0yohWNlhMxKnS+0XmMtwAmFq4imnYbrEqNJPc+9kfd62RKh0On8qV9hXZ9askEPgAfI56ziocUgVbzGT28lEtRMoKtg7lBHtznfZNA+CQ+XQWM8k4uglWK/NLYKzS+8U9GReXD0g/Tyvh4Ne17Yb4Zbr6g6y7/aNWcoPpjKRTsJIags5IJwkEAv6en05S6GUBfRWsUExZyVZVQCQwrgN7Wfdd41GPBczIp8ODeXfTSbBa6YYxlY8/p3q/udc3C+jTbtvqt2oadnB2m4oNgMn0W0p+hYWHWbwg9yU/0Kb9EIy+5y2hiCit4UgKyTeAkN8Valk4Le/ldlONRz4AWWBRM6fdIPfHstw/G+SE5rMnVQ/kA5AkLHS0ak7V7reXfhgACaBqDtD3e/nmc5k9kA/A80JReq+U38zGVp3ObJo/BvAOD3dtwiWar9zEHsgHIGlFubqSx7+Jja36anLLcDvvgwA+NDpDfILv+qlzuXwAXuSjrkKemlO2e3U1uWUYnL8dwB/5e2apca9LNv+vsQfyAUheX4VguB+mzIsaG9ntqxhF4Xbe3QD+n7/uHLAW9wQ1tblMRQ/UA0CaHC7plXEh+q4T0OWcfhleYTSHBK0EH/mi+fcRuKQn4I6fWpeoB4AevCz3HOOm9yb3F5mBlZBNclYCj1aRfyfrbgPCTR6AzK+vD4CyglX7jpmN7HY66d1E0ctdIrEEE4wEIMlam+Pk7YF6AMj7EwAVbU82vTerCwhAXopJN9zVI+AYrOeULLZgErY2x8nZA/kAJGWr0naUWdFpy2cT+oCWjpdjLFxE5UzYIBBpEUX5nLnlvAktb76SPVAfAOUHpiAMm96bsVtCAMaKALICMyxDq6cXfycA+b/mOLl6oF4AiqBRIEzBp7/X2Af0+fi1XIioMIlAI+AIPIGPmeROWV3j1Zuvyu2B+gHoFfZiDS2lC0LiY52WUADkQoTTMH1BFSYRdHoRfKSu5v9qrizMHYPT+vx6ARhSuDcAzzmDo5ZGHT1PAKYMwQxME2jiSo/gEwBrrq+u41ZOy++oD4BaCcsXTPiSI3ey8s4KGoG8QwCMFM+0ggQhLR0BF19SXuD/ayakz7uR0/TsMcxg3SjfqWNA0hsrga/ojaq/8WPcC+YIk4Ke4CMSuB2XVht1Oj8zIfXlU8BtU8DhmYRXWdfrdF1fgr3+S8At48CD04DVjXQSDO70PTUnaJ5uOCwsIIFHSSFy1pKPWCDsZxCpw8UVgKSPxLXM937OzxxAljzcPAbcswU4Qh4V3UN8mKoeKm/bu78IfKJQa8VD48CylHQiL3O3/qg5Rf30BKACMtJXjXKQcfBSK8Dfqc3KVCwuN2VFGRnm/yKZtq4Re5ifyQQgM2A+BeB3GHaZBo5MAIue0l7Kt3cC4xhw+5eL7TuCkJk1jBtyerbUfYG5ExjZ/pqrxE5fAOrOq5SmowVIrRp1IyT2R6+fg0bgVYG4CsyZe2UsaiOGKXr4Sfp9k8CxCYAFSKyvXeY1o1BxQux91yMtfsHPutgnnyUuUvhc0ZsgUXib+nVkq6+ZKaABIHsgVZnuwD9sVo66rrR4ImdhLGSQ8zPL/JgBQxeU1ouWkO9PTgDzbgmXxrzMkatl3keivfG5x4r4IRcz5BfkO5vEZ0kgpIfBZ8yKjlL17syy0tMNcOn9dl4Fy6dLFabj1Mpvow9Ify+I4Nlo9Xt+ZqU9VdJpqZh4QDDyxUyYOYJwHDg+DhgI/WUVZl7aSEt93+GO9Ia2iuZKOfA7lhp9JpvAVy61w2mOwO5hmCgMHC1H9O24gu6UD9jP+ZmbtLRaSsei9SL4XDPbAEh/kGQ/pSUcc0lbApFWb67lQUhpVnLBsoKqqZclFMmUtrxPcwxl3X7vOCAtYLSCcugFQmqhdssH7HU+RznjiOlYXA8wqkOfkItTAom+oKygca4ES8jY+N3z7fSG4hfUtp3ihUHruVSsFy1iRvNP+1N7A5BdJACmVpAgZPhGOyCigEjlPLudn7kvFtOxuB4g6OjD8UWLRkCZFRwrLCEXJQQhp2K+37lQeBCRX1A7KPQto1prFEmSYn2mB9EAsO+kYfk8KQhZF8yjVz5gp/MztyOUjiW9bCUhEBhKRCCgSis45uQ/PhX/xfFWMgOnWu2gxB0TF/o0kEZ/kCDM1Ts+3RHYnwVUL6XhDFrAswfIB6w6P1MrTulY0sum1VICglKwCEACqvQFCUK3gHcsFQCM/ILayqP1k9JshVqrncMalOYYvgcGAyCvIwuod8YBJQmZpmGJeyRwkGw4n8jJOJQNw3idLFhMRNB0SgASTJyKoy/4ieXCeFfJBUeV2SoAclFyR0bbm1OHTUiN0/DTAwD7zQeM52dqj8VsGEkVE2jKetG7AEhQ0frJAv6RC0trC1skl+IWlNinGLbSaZg7Mc0xfA8MbgF1LQV1z08A2G8+oM7PVF9Ms2GUE0gQyp+Lwu2yagLgR9ZaYpkSypQ6a6Q2DCqzpkvietXIFdoZfuieGmcOD0DeP0HEbBhNwYPmA/L8zJQsATAKnguEqS+XTqkE4YfWWwCUFZTksYAYwZfIBeN9Tw0cjOwu8gDIZqsoSSvhEeQDiiGYFoyWiSDRypWgi69UP5sc5fIcquSCNeXqe2X9ZAHfM7Khe2pcOB+AT41+aO5iRD3QAHBEHd9ctuiBBoANEkbaAw0AR9r9zcUbADYYGGkPNAAcafc3F28A2GBgpD3QAHCk3d9cvAFgg4GR9kADwJF2f3PxBoANBkbaAw0AR9r9zcUbADYYGGkPNAAcafc3F28A2GBgpD3QAHCk3d9cfOxqYJ2au9RdPtdp/khoEOlglDYT39V1PzQFXLsMXAlgt9PCxJKPbufyf8/KHIPfBPAZABf79Xc5XQ0ZQ1Q7360NbxoHrlsDvs5ZRsgo0une06by6X1mZvtP99PNAp4F4LsBXA5gjw8EGTeqaGF4QhzQF80CX7cAvGIdeDYAfhdZ2sTKUcVrpE7nd31N5gj8e2dIo2osk7NZpMdK0Z19tv+bJ4F9K8D1ACj8yfNSikHeg+5Z969m57Y/8/ZP+dPLKZhP/rcA+AYAF7g1oRUhEMUzFMt6eSJfX78b2DkPfM0i8GIAX+uWlAMppreUUErn8p2gzTl+2flg/sDbTkvIOik+CP20//mzwAXzwDcCuNTPJeFXpEpM6QEjIHm/zTF8D7T5gATYNQCe69aAloRTGulfBESBSYNyxR5g/Bhw7hKwZwl4vk9LnM5JmsBzUyDGAX3B8G23Mz/g9BuUa/0IiutfMkj7zwKmngAuXSvOpUvAWYBtF4BTnspIj/O8zPaf7qdvWITw6eZA0JLQEhKEGgxZhUj/dz3NzSKwbR44exnYvVKcy+mM5Km0JhxInUtrGkmzCPicg3W5LMGkQiZZTm9xS9Z3+4m2o8C5c4X15pTKW2Lb+fCx7WLtjYxzqiql29Icw/dA5SqYf6RTTilg+lYCIXmICKQ4IK9wxfSJY8AZK8CuFWDnanEua9ZTAMsaCog3Dt92O/MvnRGBtGwkqKRmMEkqCaa+2k+0LQDTh4rP88UHj74kF1WaATo9QHQ7mmP4HugYhtEKj4PB6ZQ+FS0hQahpldPya1kXTOqNY8DscgG+HavAttUCvBxInitrkgL4lcO33c7spBdM3kAuSnq2nx9gQfAh4JyVwvrxwel2z3p4aMlzH6DM2z/lT+8aB+Q/OT4EEqckWQSBkGD6EQKQnDCLwBSnYgcf32fXioGUFawC4esyu7CXXnDP9tOCsyD4KLB1rmgvX7zfbu2WG/Jtme0/3U/vKxBNAMoi0KcjkATCN3HOEr3UAjDrwOP71rXixYEkeKMFlSX8ocwR6KUXTJ7AaNE2tF8WfA4Ye7Kw1mwvX/yZn+eKnvcrfzC6IK/ObP/pfnpfAGQnySoISBqUXyAASS1AK0JfagWYcRDOrAF66TxZQU7jBOEbM0egH71gcgXSFZAV54NQtj9YcNIpbONCyh8Ygi8CVospApDuB63g92W2/3Q/vW8AsqM4gLIKBBIH8bcJwMCNMX68BTqBb8s6sGWtsIA6jwDk662ZI9CvXjA5A6NVa2t/IAicnC/aGV+8T74IQPm/AmGuBc+8/VP+9IEAyLslAKMV/LgAyIUInfnjwPQqMOOgI/DstQ5Mr7UAqMF8V2YXDqoXXNl+EQQ6N9v29aKdesUpWJZbAPyPme0/3U8fGIDssDid/pUASCvCaXgJmFguAEfgEXT27gDkuwaUg/nbmSMwjF7whvbLhSDL5TwwvdRqo9oqHzACkCB8U2b7T/fThwIgO01T1IMCoAZxGRhbKoAXQUcQTjkI+a4B5e5FzjGsXvCG9gdqrLGFYrpVG/UuHzBOw2/LaXxzbh43DKeoJwlAHqLndSs4udoCoIBHQE45EPk3DuitmYOQoxdctp8+rFwIWsGFYiFFoLGNchcEQC6e+OJC5J2Z7T/dTx/aApYdJ37AyJK/DIwvFxYvWr0IwEn/H1Opco5sveDUhSAAF4HJpQJkWixp6k2n4IYfMGf0amDHev2I8+l4/UbvNw8Eozw72wJePOJ8und7EkKj9ztKGA1/7WwATo44n45pWI3e7/AAGPWZ2QBkYHCU+XTMfGGQmYIxjd7vqOE0+PXzATjifDrKtTZ6v4MP/MlyRj4AR5xPF+VaqZLJF1UzKdPV6P2eLDDr3I58AI44n07ZMARbo/d78gMubWE+AEecT8e9YOn2Uheu0fs9tUCYD8AR59MpG6bR+z21gKfW1gNAz4geRT5dTEZo9H5PPRDmAzBmRM8BJzqfLiYjSKKr0fs9dYBYDwBHmE9XtRfMsIz04aQZ1+j9npygrA+Akqs8wfl0BCCTWRq935MTYL1aVQ8Ao1zlAnAi8+kEQGZTNXq/vYb75Pt/fQAcUT5dBGCj93vyAaxXi+oDoFLyT3A+3Rcavd9eY3xS/z8fgCQX/LPR3SOzkon55jg1eyAfgD8M4NcAPD6aDmBtB1e4NMDNcer1QD4AbwbwxwDe4UvRE9wHZG1gNSXDLlwLNcep1QP5APxzzwj9IIAPnXhT5ORc5EYCA9HNcWr1QD4AmRH6FQBMTSZZH98ZmD5Bh5g1FopiNns1x6nTA/kAvAfAEwDudnI+EvQxPfkEzYfaCXRSBluQMB7YHKdGD+QDsBNBH/9+AkAobqTADGK7Inw1x8nfA/kA7EXQt8kgrGAGMfBxZ5Cv5ji5eyAfgL0I+r68uR0QmUFoBQU8vfNvzXHy9kA9AORoMw7CdGQCjoUZDwL4kv/+8OZ1gJhBIjGDgMh3vTavBc035/RAPgD7JegjODfhiMwgoqeJwNPPTaB6Ezq/hq+sB4AcXeXEP+ZhGVo9vRimIQD5v5oPAZCupgDI9wg8/qz/1Xz55usyeyAfgMMQ9GU2Op4eAchpOIJQQEz/VuPlm6/K7IH6AMjgGzdl6QtyX5jWjpQFevF3lq3xf6yhrOlIAUgQCojR8gmE+l9Nl2++JrMH6gEgR5UA5KYsc+AZmCbQCDi+IvgEQMob1XBEAHIajgBMLV+0kCdws6aGu3zqfkV9AGTwjftg3JRVVRAtHQEXX/wbAcoXP5d5CID8GoJKvqDAloKOoIz/y7x8c3pmD4zhaqwjRzCYyQg5gr2ZgsFTLweWr8XQgsXjbwLWrnNtMlKgNoLBmZAa7PTCAuYIBlMvlWQswwr2UlUw45jdDSx8HbD+Ctd+HVCwePKbgJV9aASDM8Yg59TWFDysYPBtmYK91IbNOHaPA/M7gUXKXA4hWDz79cA8+W0aweCMURj+1HYfcBjBYO54MMY3tGDv8I3nmWSHOzYOLJ0LLPGXAQWLz3oB8MQUsEa16kYwOG8whjh74yJkUMFgbsNlCfYO0epwissVY34bsHw2sEIRkAEEi/dcU0SP5qhF1ggG5w3GEGdXr4L5134Fg4kAjuDQgr1DtDqcUmZETwArZwAru4BVqsv0KVh8/o3F4v0QXZBGMDhvMIY4u3MYhv95Zh+Cu1xBcxuOU/HfeDIq5cv7FuwdotXhlCBXjOXZAnyrO4BV6in0IVh8wStLuWCsUAyvEQzOG5ABz+4eB+R/ewnu/kOP/3G/l4kJTERlljQtIot2e53/IwO2OPl4FLtcnCqAp9cahT56CBZf+LpSLhhz1N5qBIPzBmTAs/sLRHcTDKbiNHdBGGymOC/3hglEvgjAnoK9A7Y4+XgiV4zVWYDAs/etxaubYPFFP1QkLtCIP8neaASD8wZkwLP7AyC/tJNg8L/xLNBu+YBdBXsHbHEFAINcMVamgdWZAoRrfPdXm8KitLdmgYveWAq+2y7iMqfuRjA4b1AGOLt/APJLqwSD3+y5T1yI0AoSbAxMMzGV1o8/My2ro2DvAK2t+GgiV4zj4+3AIwDXtwBrVJeuECze+9aW4Dut4PxkIhYsdetGMDhvoDqcPRgA+SWp4O4veQ5Uv/mAGwR78+6rQq4Yq9PAOi2fA4/vBkKudKVU7VZw77uKvWFuZbtcMNb5v0YwOG9g+jx7cADyi6Pg7gccgIxlcA5TKhaD01yYKBmVFpBZMfx/m2Bvny3t8LGqoqTliZbVI+gMgHwnMAnCIFi897cLAAZ6QyzFzzSCwXkD1OPs4QDIL5XgLmk5JHk/SD5gKdibd38VcsVYGmuBTaAzEHLHgyCcaokB7/1IkUET5IKxwF5pBIPzBqbPs4cHIC/AaeqvPL9pmHxAE+zts6VdLCD/lcgVY3UyWD0Bj1ZwqgCggXA7sPfWAoAJvaEtZBrB4Lyx6efsPADyCtmCvf00s/NnOsgVY3m8BTRZPZuGBUACdArY+5lWDqGmYbIrLHEx0ggG5w1OH2fnA7CPizQfaXqgUw80AGywMdIeaAA40u5vLt4AsMHASHugAeBIu7+5eAPABgMj7YEGgCPt/ubiDQAbDIy0BxoAjrT7m4s3AGwwMNIeaAA40u5vLt4AsMHASHugAeBIu7+5eAPABgMj7YEGgCPt/ubiDQAbDIy0B8ZYNMbkX+ZekpuIiOQrPar+xs889HJg6jZg5jAwvVZ8B+ll9PlO5/Fc/o+ECjnHfi8zYfkvM5ulmp4qJXVqx5deD4zfAkw/CGxdAZgoHfuh131QkaI5hu8Bs4Ds8B0AWLnIRGCBsFfn87JffDMwdjOw5R5g8giwZa34jnQQUwDo99wBfJ4TM7COiNdlaj2rA/jeV/vfDeATAP4UGH8I2Lrc6gc+SHqY4oMZ74VSKM0xfA+UUzB/oBUUCKMl6zSQ/PsXqZD5KQC/A0w/DEwcAcYXgYnVwppwADuBkefnCim90FmBWXwnK87Uen53BI8sbuwqaz9p5UgnQhBS+ZN1zE8Ak0utviCwq8DI8/nx5hi+Bzb4gJzKZE1SEFZZgS9/2pWR/gTAJ4HJQ8DEMWB8ARhfBsaWCwDquwQKvvNgHXvOcYVbPFJPkw+dDxC/W1Y4tWDpw/Rlgo4lo1T4/KxTihDNpJwj3/UiMLXemprjffC7eWpzDN8DlYsQDiKtVxzEqoHkyX9HRizW+nIgaQnvAiaeBCbmC0s4tgSMu2rMePAR9X252jXklaTFU108K0MHav/nvJ6ZxVVk9OI7GR2IZoGQNc/HgbHgIwqILIVujuF7oOMqWFawCoRxkfEIB5CWgkREBCNf9wMTc8A4QciBWyoGz16rwNgaML5eWKpctYZL3N+TWLX0gvtuP0HHk2n16JDyxXmVhfU0qywbJbr5GSuXKxA/sV5Y9UYWdnjwyS3qKKgarWA69Wg6fjQOIK0HadnIjPVFB+AiME4AuiUkCFnESyCSkmAuU7Cjm15wX+2X2ifBRn9A8mKcW2UFjULVQcgVDl80u40SYh763FfvquhLCxitoBYUsoJfjXKttByMq9CKcHn4sPuCbgXNJwyWkECcz5Q376UX3LNncZyQAAADEklEQVT9fFgIJs6lBBwtn3Tt6FpIz4RWnuQxPh2XIGzm4CwQ9hWIFgBTK0gQHiIAJddKq0ELQh+KL1qUR4MvSEsoENIKrgALHNiMox+94K7tl9qnnMio8MSf6SNwGpYVjCDk/Ju7isq496fCqX0BkDeqlWwKwic1gAQSpzGREnFgREz01eALLvvq2Kfi45m6cf3qBXdsfxRbJMho8dimqOhEK8cXQRr9QVpvPoDNMXQP9A3ACELFxPh+jACkP0fLIKFCCRRqKuPUdqjlC9o07JZwKVNHeBC94DQcZO0XAAkmgotAk9QYrR9f/BvByYfMSATDVMzwTXMM3QMDAVAgVHCZ7/MaQK4QZUHiNCbBQlqUw74YCb7gcmYkelC9YFlwvVv7RRAorTuBkECU9asCID9/x9B935zYzyKkqpfiNHxcA0gLQgvBAaPVkCqm3h2AtC5m/RyEqzw/4xhGL3hD++MmslgqCbgUfLKAcRrmTlBzDN0DA1tAXUlWcDm1IOIIJAjlT/Fd05lbFQFwjdtgGcewesFt7Rc/Gx8iWjUCjGCT1YvWT1MwgUqrf3NG45tTbcu0aximWx9xENcEQHGbcYAEwtSXSqY0gnCdgeuMI0cvuGx/FUGgFhwEYrR80QckWN+X0fjm1DwAWv8RgJFilJZBznz0pQg+AZAAlVWh1GvGka0XzB0cCQi30aSGVa9AF62fLOB7MhrfnJoPwPER59Px+o3e76mL5Kwp2G57xPl0kxc3er+nLvyKtLmhfUC78RHn081ONnq/pzcAR5xPR9mRRu/31IVgvgUccT4dNaobvd/TGYAjzqejumqj93s6A3DE+XRUg2VSCjdaGr3fUw+I+VPwiPPpqJjO8J1Nw43e7ymHwHoAKMFd7QErAeEE5NNJMb3R+z3lsGcNzgfgiPPpomJ6o/d76oGwPgCOKJ8uKqY3er+nKwBHmE+noqRG7/fUA199U/AI8+kEwEbv93QHoEhZTnA+nYqSGr3fBoAtaiqBUImdm5hPJwA2er+nKwBHnE+X1gUzSbnR+z11wPj/AeCpPDD3t7rvAAAAAElFTkSuQmCC"
vendor: 2,104 bytes, line 5695
5695,Pg=class extends T3{constructor({preset:e=1,edgeDetectionMode:t=2,predicationMode:i=0}={}){let r,s;super("SMAAEffect","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;}",{vertexShader:"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);}",blendFunction:T0.NORMAL,attributes:3,uniforms:new Map([["weightMap",new lD(null)]])}),arguments.length>1&&(r=arguments[0],s=arguments[1],arguments.length>2&&(e=arguments[2]),arguments.length>3&&(t=arguments[3])),this.renderTargetEdges=new iu(1,1,{minFilter:1006,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 TY(!0,!1,!1),this.clearPass.overrideClearColor=new ir(0),this.clearPass.overrideClearAlpha=1,this.edgeDetectionPass=new Pe(new TL),this.edgeDetectionMaterial.edgeDetectionMode=t,this.edgeDetectionMaterial.predicationMode=i,this.weightsPass=new Pe
5695(new TU);let a=new o1;a.onLoad=()=>{let e=new ic(r);e.name="SMAA.Search",e.magFilter=1003,e.minFilter=1003,e.generateMipmaps=!1,e.needsUpdate=!0,e.flipY=!0,this.weightsMaterial.searchTexture=e;let t=new ic(s);t.name="SMAA.Area",t.magFilter=1006,t.minFilter=1006,t.generateMipmaps=!1,t.needsUpdate=!0,t.flipY=!1,this.weightsMaterial.areaTexture=t,this.dispatchEvent({type:"load"})},a.itemStart("search"),a.itemStart("area"),void 0!==r&&void 0!==s?(a.itemEnd("search"),a.itemEnd("area")):"u">typeof Image&&(r=new Image,s=new Image,r.addEventListener("load",()=>a.itemEnd("search")),s.addEventListener("load",()=>a.itemEnd("area")),r.src=Pf,s.src=Pm),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 0:t.edgeDetectionThreshold=.15,i.orthogonalSearchSteps=4,i.diagonalDetection=!1,i.cornerDetection=!1;break;case 1:t.edgeDetectionThreshold=.1,i.orthogonalSearchSteps=8,i.diagonalDetection=!1,i.cornerDetection=!1;break;case 2:t.edgeDetectionThreshold=.1,i.orthogonalSearchSteps=16,i.diagonalSearchSteps=8,i.cornerRounding=25,i.diagonalDetection=!0,i.cornerDetection=!0;break;case 3:t.edgeDetectionThreshold=.05,i.orthogonalSearchSteps=32,i.diagonalSearchSteps=16,i.cornerRounding=25,i.diagonalDetection=!0,i.cornerDetection=!0}}setDepthTexture(e,t=3200){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;null!==e&&null!==t&&(e.dispose(),t.dispose()),super.dispose()}static get searchImageDataURL(){return Pf}static get areaImageDataURL(){return Pm}},Pv=`uniform float offset;uniform float darkness;void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){const vec2 center=vec2(0.5);vec3 color=inputColor.rgb;
5696#if VIGNETTE_TECHNIQUE == 0
5697float d=distance(uv,center);color*=smoothstep(0.8,offset*0.799,d*(darkness+offset));
5698#else
5699vec2 coord=(uv-center)*vec2(offset);color=mix(color,vec3(1.0-darkness),dot(coord,coord));
5700#endif
5701outputColor=vec4(color,inputColor.a);}`,Py=class extends T3{constructor({blendFunction:e=T0.NORMAL,technique:t=0,eskil:i=!1,offset:r=.5,darkness:s=.5}={}){super("VignetteEffect",Pv,{blendFunction:e,defines:new Map([["VIGNETTE_TECHNIQUE",t.toFixed(0)]]),uniforms:new Map([["offset",new lD(r)],["darkness",new lD(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 1===this.technique}set eskil(e){this.technique=1*!!e}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}};function Px(e,t,i,r){var s;return(s=e+(t-e)*.75)+(i+(r-i)*.75-s)*.875}new Float32Array(3),new Float32Array(3),new Float32Array(3),new Float32Array(3),new Float32Array(3),new Float32Array(3),new Float32Array([0,0,0]),new Float32Array([1,0,0]),new Float32Array([1,1,0]),new Float32Array([1,1,1]),new Float32Array([0,0,0]),new Float32Array([1,0,0]),new Float32Array([1,0,1]),new Float32Array([1,1,1]),new Float32Array([0,0,0]),new Float32Array([0,0,1]),new Float32Array([1,0,1]),new Float32Array([1,1,1]),new Float32Array([0,0,0]),new Float32Array([0,1,0]),new Float32Array([1,1,0]),new Float32Array([1,1,1]),new Float32Array([0,0,0]),new Float32Array([0,1,0]),new Float32Array([0,1,1]),new Float32Array([1,1,1]),new Float32Array([0,0,0]),new Float32Array([0,0,1]),new Float32Array([0,1,1]),new Float32Array([1,1,1]),new Float32Array(2),new Float32Array(2),new Float32Array([0,-.25,.25,-.125,.125,-.375,.375]),new Float32Array([0,0]),new Float32Array([.25,-.25]),new Float32Array([-.25,.25]),new Float32Array([.125,-.125]),new Float32Array([-.125,.125]),new Uint8Array([0,0]),new Uint8Array([3,0]),new Uint8Array([0,3]),new Uint8Array([3,3]),new Uint8Array([1,0]),new Uint8Array([4,0]),new Uint8Array([1,3]),new Uint8Array([4,3]),new Uint8Array([0,1]),new Uint8Array([3,1]),new Uint8Array([0,4]),new Uint8Array([3,4]),new Uint8Array([1,1]),new Uint8Array([4,1]),new Uint8Array([1,4]),new Uint8Array([4,4]),new Uint8Array([0,0]),new Uint8Array([1,0]),new Uint8Array([0,2]),new Uint8Array([1,2]),new Uint8Array([2,0]),new Uint8Array([3,0]),new Uint8Array([2,2]),new Uint8Array([3,2]),new Uint8Array([0,1]),new Uint8Array([1,1]),new Uint8Array([0,3]),new Uint8Array([1,3]),new Uint8Array([2,1]),new Uint8Array([3,1]),new Uint8Array([2,3]),new Uint8Array([3,3]),Px(0,0,0,0),new Float32Array([0,0,0,0]),Px(0,0,0,1),new Float32Array([0,0,0,1]),Px(0,0,1,0),new Float32Array([0,0,1,0]),Px(0,0,1,1),new Float32Array([0,0,1,1]),Px(0,1,0,0),new Float32Array([0,1,0,0]),Px(0,1,0,1),new Float32Array([0,1,0,1]),Px(0,1,1,0),new Float32Array([0,1,1,0]),Px(0,1,1,1),new Float32Array([0,1,1,1]),Px(1,0,0,0),new Float32Array([1,0,0,0]),Px(1,0,0,1),new Float32Array([1,0,0,1]),Px(1,0,1,0),new Float32Array([1,0,1,0]),Px(1,0,1,1),new Float32Array([1,0,1,1]),Px(1,1,0,0),new Float32Array([1,1,0,0]),Px(1,1,0,1),new Float32Array([1,1,0,1]),Px(1,1,1,0),new Float32Array([1,1,1,0]),Px(1,1,1,1),new Float32Array([1,1,1,1]);var Pb=class{constructor(e,t){this.enabled=!1,this.effect=new e(t),Object.defineProperty(this,"opacity",{enumerable:!0,set(e){this.effect.blendMode.opacity.value=e},get(){return this.effect.blendMode.opacity.value}}),Object.defineProperty(this,"blendFunction",{enumerable:!0,set(e){this.effect.blendMode.setBlendFunction(Number(e))},get(){return this.effect.blendMode.blendFunction}}),this.blendFunction=T0.NORMAL}},Pw=class extends Pb{constructor(){super(Ps),this.blendFunction=T0.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}},P_=class extends Pb{constructor(){super(Pa)}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}},PS=class extends Pb{constructor(){super(Po),this.effect.offset=new tZ(.01,.01)}set offset(e){this.effect.offset.set(e[0]/1e3,e[1]/1e3)}get offset(){return[1e3*this.effect.offset.x,1e3*this.effect.offset.y]}},PC=class extends Pb{constructor(){super(Pn)}},PM=class extends Pb{constructor(){super(Pc),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}},PE=class extends Pb{constructor(){super(Pu),this.blendFunction=T0.OVERLAY}},PA=class extends Pb{constructor(){super(Py)}get eskil(){return this.effect.eskil}
vendor: 5,773 bytes, lines 5701-5728
5701set 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}},PT=class extends Pb{constructor(e){super(Ph)}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&&!1===this.isPerspectiveCamera||!e.isPerspectiveCamera&&!0===this.isPerspectiveCamera)&&(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()}},PP=class extends Pb{constructor(){super(Pp)}get granularity(){return this.effect.getGranularity()}set granularity(e){this.effect.setGranularity(e)}},PD=`#define GLSLIFY 1
5702varying vec2 vUv;varying vec2 vTexCoords[9];uniform vec2 resolution;void main(){vUv=position.xy*0.5+0.5;vec2 texelSize=vec2(1.0)/resolution;vTexCoords[0]=vUv+vec2(-texelSize.x,-texelSize.y);vTexCoords[1]=vUv+vec2(0.0,-texelSize.y);vTexCoords[2]=vUv+vec2(texelSize.x,-texelSize.y);vTexCoords[3]=vUv+vec2(-texelSize.x,0.0);vTexCoords[4]=vUv+vec2(0.0,0.0);vTexCoords[5]=vUv+vec2(texelSize.x,0.0);vTexCoords[6]=vUv+vec2(-texelSize.x,texelSize.y);vTexCoords[7]=vUv+vec2(0.0,texelSize.y);vTexCoords[8]=vUv+vec2(texelSize.x,texelSize.y);gl_Position=vec4(position.xy,1.0,1.0);}`,PO=`#define GLSLIFY 1
5703#include <common>
5704varying vec2 vUv;varying vec2 vTexCoords[9];uniform sampler2D inputBuffer;uniform sampler2D historyBuffer;uniform sampler2D velocityBuffer;uniform sampler2D depthBuffer;uniform vec2 resolution;
5705#define USE_YCOCG
5706#define USE_CATMULL_ROM
5707const float feedback_min=0.5;const float feedback_max=0.95;vec3 RGB_YCoCg(vec3 c){return vec3(c.x/4.0+c.y/2.0+c.z/4.0,c.x/2.0-c.z/2.0,-c.x/4.0+c.y/2.0-c.z/4.0);}vec3 YCoCg_RGB(vec3 c){return clamp(vec3(c.x+c.y-c.z,c.x+c.z,c.x-c.y-c.z),vec3(0.0),vec3(1.0));}vec4 sample_color(sampler2D tex,vec2 uv){
5708#ifdef USE_YCOCG
5709vec4 c=texture(tex,uv);return vec4(RGB_YCoCg(c.rgb),c.a);
5710#else
5711return texture(tex,uv);
5712#endif
5713}vec4 sample_catmull_rom(sampler2D tex,vec2 uv,vec2 texSize){vec2 samplePos=uv*texSize;vec2 texPos1=floor(samplePos-0.5)+0.5;vec2 f=samplePos-texPos1;vec2 w0=f*(-0.5+f*(1.0-0.5*f));vec2 w1=1.0+f*f*(-2.5+1.5*f);vec2 w2=f*(0.5+f*(2.0-1.5*f));vec2 w3=f*f*(-0.5+0.5*f);vec2 w12=w1+w2;vec2 offset12=w2/(w1+w2);vec2 texPos0=texPos1-1.0;vec2 texPos3=texPos1+2.0;vec2 texPos12=texPos1+offset12;texPos0/=texSize;texPos3/=texSize;texPos12/=texSize;vec4 result=vec4(0.0);result+=texture2D(tex,vec2(texPos12.x,texPos0.y))*w12.x*w0.y;result+=texture2D(tex,vec2(texPos0.x,texPos12.y))*w0.x*w12.y;result+=texture2D(tex,vec2(texPos12.x,texPos12.y))*w12.x*w12.y;result+=texture2D(tex,vec2(texPos3.x,texPos12.y))*w3.x*w12.y;result+=texture2D(tex,vec2(texPos12.x,texPos3.y))*w12.x*w3.y;return result;}vec3 choose_motion_vector(){
5714#ifdef CHOOSE_LONGEST_MOTION_VECTOR
5715float longest=-1.0;vec3 v_choose=vec3(-1.0);for(int i=0;i<9;i++){vec3 v=texture2D(velocityBuffer,vTexCoords[i]).rgb;float l=length(v.xy);if(l>longest){longest=l;v_choose=v;}}return v_choose;
5716#else
5717float closest_depth=1000.0;vec2 closest_uv_offset=vec2(0.0);for(int i=0;i<9;i++){float neighbor_depth=texture2D(depthBuffer,vTexCoords[i]).r;if(neighbor_depth<closest_depth){closest_uv_offset=vTexCoords[i];closest_depth=neighbor_depth;}}return texture2D(velocityBuffer,closest_uv_offset).rgb;
5718#endif
5719}vec4 clipAabb(vec3 aabb_min,vec3 aabb_max,vec4 avg,vec4 input_texel){const float FLT_EPS=0.00000001;vec3 p_clip=0.5*(aabb_max+aabb_min);vec3 e_clip=0.5*(aabb_max-aabb_min)+FLT_EPS;vec4 v_clip=input_texel-vec4(p_clip,avg.w);vec3 v_unit=v_clip.xyz/e_clip;vec3 a_unit=abs(v_unit);float ma_unit=max(a_unit.x,max(a_unit.y,a_unit.z));if(ma_unit>1.0){return vec4(p_clip,avg.w)+v_clip/ma_unit;}else{return input_texel;}}vec3 clip_aabb_variance(in vec3 cOld,in vec3 cNew,in vec3 centre,in vec3 halfSize){if(all(lessThanEqual(abs(cOld-centre),halfSize))){return cOld;}vec3 dir=(cNew-cOld);vec3 near=centre-sign(dir)*halfSize;vec3 tAll=(near-cOld)/dir;float t=0.0001;for(int i=0;i<3;i++){if(tAll[i]>=0.0&&tAll[i]<t){t=tAll[i];}}if(t>=0.0001){return cOld;}return cOld+dir*t;}void main(){vec3 v=choose_motion_vector();vec2 velocity=v.rg;vec2 previousPixelPos=vUv-velocity;vec4 currentColor=sample_color(inputBuffer,vUv);
5720#ifdef USE_CATMULL_ROM
5721vec4 previousColor=sample_catmull_rom(historyBuffer,previousPixelPos,resolution);
5722#else
5723vec4 previousColor=sample_color(historyBuffer,previousPixelPos);
5724#endif
5725#ifdef USE_YCOCG
5726previousColor=vec4(RGB_YCoCg(previousColor.rgb),previousColor.a);
5727#endif
5728vec4 ctl=sample_color(inputBuffer,vTexCoords[0]);vec4 ctc=sample_color(inputBuffer,vTexCoords[1]);vec4 ctr=sample_color(inputBuffer,vTexCoords[2]);vec4 cml=sample_color(inputBuffer,vTexCoords[3]);vec4 cmc=sample_color(inputBuffer,vTexCoords[4]);vec4 cmr=sample_color(inputBuffer,vTexCoords[5]);vec4 cbl=sample_color(inputBuffer,vTexCoords[6]);vec4 cbc=sample_color(inputBuffer,vTexCoords[7]);vec4 cbr=sample_color(inputBuffer,vTexCoords[8]);vec4 cmin=min(ctl,min(ctc,min(ctr,min(cml,min(cmc,min(cmr,min(cbl,min(cbc,cbr))))))));vec4 cmax=max(ctl,max(ctc,max(ctr,max(cml,max(cmc,max(cmr,max(cbl,max(cbc,cbr))))))));
5728vec4 cavg=(ctl+ctc+ctr+cml+cmc+cmr+cbl+cbc+cbr)/9.0;vec4 cmin5=min(ctc,min(cml,min(cmc,min(cmr,cbc))));vec4 cmax5=max(ctc,max(cml,max(cmc,max(cmr,cbc))));vec4 cavg5=(ctc+cml+cmc+cmr+cbc)/5.0;cmin=0.5*(cmin+cmin5);cmax=0.5*(cmax+cmax5);cavg=0.5*(cavg+cavg5);
5729#ifdef USE_YCOCG
5730vec2 chroma_extent=vec2(0.25*0.5*(cmax.r-cmin.r));vec2 chroma_center=currentColor.gb;cmin.yz=chroma_center-chroma_extent;cmax.yz=chroma_center+chroma_extent;cavg.yz=chroma_center;
5731#endif
5732vec4 previousColorClipped=clamp(previousColor,cmin,cmax);
5733#ifdef LUMINANCE_DIFFERENCES
5734#ifdef USE_YCOCG
5735float lum0=currentColor.r;float lum1=previousColorClipped.r;
5736#else
5737float lum0=luminance(currentColor.rgb);float lum1=luminance(previousColorClipped.rgb);
5738#endif
5739float unbiased_diff=abs(lum0-lum1)/max(lum0,max(lum1,0.2));float unbiased_weight=1.0-unbiased_diff;float unbiased_weight_sqr=unbiased_weight*unbiased_weight;float k_feedback=mix(feedback_min,feedback_max,unbiased_weight_sqr);vec4 result=mix(currentColor,previousColorClipped,vec4(k_feedback));
5740#else
5741const float alpha=0.1;vec4 result=mix(currentColor,previousColorClipped,1.0-alpha);
5742#endif
5743#ifdef USE_YCOCG
5744gl_FragColor=vec4(YCoCg_RGB(result.rgb).rgb,result.a);
5745#else
5746gl_FragColor=result;
5747#endif
5748}`,PL=`#define GLSLIFY 1
5749varying vec2 vUv;void main(){gl_Position=vec4(position.xy,1.0,1.0);vUv=position.xy*0.5+0.5;}`,PI=`#define GLSLIFY 1
5750layout(location=1)out vec4 gVelocity;varying vec2 vUv;uniform sampler2D inputBuffer;void main(){gl_FragColor=texture2D(inputBuffer,vUv);gVelocity=vec4(0.0);}`,PR=class extends r5{constructor(){super({name:"PassthroughMaterial",uniforms:{inputBuffer:new lD(null)},blending:0,depthWrite:!1,depthTest:!1,vertexShader:PL,fragmentShader:PI})}set inputBuffer(e){this.uniforms.inputBuffer.value=e}},Pk=class extends TH{constructor(){super("TAAResolvePass"),this.MRTCompatible=!0,this.needsSwap=!1,this.passThroughMaterial=new PR,this.resolutionVector=new tZ,this.resolveMaterial=new r5({name:"TAAResolveMaterial",uniforms:{inputBuffer:new lD(null),historyBuffer:new lD(null),velocityBuffer:new lD(null),depthBuffer:new lD(null),resolution:new lD(new tZ)},blending:0,depthWrite:!1,depthTest:!1,vertexShader:PD,fragmentShader:PO}),this.historyRenderTarget=new iu(1024,1024,{minFilter:1006,stencilBuffer:!1,depthBuffer:!1}),this.historyRenderTarget.texture.name="TAA.History",this.resultRenderTarget=new iu(1024,1024,{minFilter:1006,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()}},PB=class extends TH{constructor(e,t,i){super("TransmissionPass",void 0,t),this.MRTCompatible=!0,this.depthPass=new T$(e,t,{renderTarget:i.transmissionDepthTarget}),this.passThroughMaterial=new PR,this.splineScene=e,this.needsSwap=!1}updatePasses(e){this.passThroughMaterial=new PR,this.depthPass=new T$(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;e.setRenderTarget(e.transmissionRenderTarget),this.fullscreenMaterial=this.passThroughMaterial,this.passThroughMaterial.inputBuffer=t.texture[0],e.clear(),e.render(this.scene,this.camera),this.camera.layers.disable(3),this.depthPass.render(e,t,i),e.shadowMap.needsUpdate=!1,e.shadowMap.autoUpdate=!1;let s=this.renderToScreen?null:t;this.camera.layers.set(3),e.setRenderTarget(s),e.render(this.splineScene,this.camera),this.camera.layers.mask=r}},Pz=new nb,PN=new r5({transparent:!0,vertexShader:`
5751        void main() {
5752            gl_Position = vec4(0.0);
5753        }
5754    `,fragmentShader:`
5755        layout(location = 1) out vec4 gVelocity;
5756
5757        void main() {
5758            gl_FragColor = vec4(0.0);
5759			gVelocity = vec4(0.0);
5760        }
5761    `}),PF=class extends TH{constructor(e,t,i){super("OpaquePass",t??Pz,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??Pz}getScene(){return this.scene}render(e,t){this.camera.layers.enable(3),this.hasTransmissionPass&&(this.originalMaterials.length=0,this.scene.traverse(e=>{e.layers.isEnabled(3)&&e instanceof Cf&&(this.originalMaterials.push([e,e.material]),e.material=PN)}),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
5761h(e=>{e[0].material=e[1]})}},Pj=class{constructor(e,{depthBuffer:t=!0,stencilBuffer:i=!1,multisampling:r=0,frameBufferType:s=0}={}){this.renderer=e,this.helperStartIndex=0,this.copyPass=new TG,this.depthTexture=null,this.timer=new Pt,this._width=1,this._height=1,this.passes=[],this.helperPasses=[],this.autoRenderToScreen=!0,this.inputBuffer=this.createBuffer(t,i,s,r,!0,"input buffer mrt"),this.inputBufferSingle=this.createBuffer(t,i,s,r,!1," input buffer single"),this.inputBufferSingle.texture.dispose(),this.inputBufferSingle.depthTexture.dispose(),this.inputBufferSingle.texture=this.inputBuffer.texture[0],this.inputBufferSingle.depthTexture=this.inputBuffer.depthTexture,this.outputBuffer=this.inputBuffer.clone(),this.outputBuffer.name="output buffer mrt",this.outputBufferSingle=this.createBuffer(t,i,s,r,!1,"output buffer single"),this.outputBufferSingle.texture.dispose(),this.outputBufferSingle.depthTexture.dispose(),this.outputBufferSingle.texture=this.outputBuffer.texture[0],this.outputBufferSingle.depthTexture=this.outputBuffer.depthTexture,this.setRenderer(e)}get multisampling(){return this.inputBuffer.samples||0}set multisampling(e){let t=this.inputBuffer,i=this.multisampling;i>0&&e>0?(this.inputBuffer.samples=e,this.outputBuffer.samples=e,this.inputBuffer.dispose(),this.outputBuffer.dispose()):i!==e&&(this.inputBuffer.dispose(),this.outputBuffer.dispose(),console.log("creating new input buffer"),this.inputBuffer=this.createBuffer(t.depthBuffer,t.stencilBuffer,t.texture.type,e,!0,"new input buffer"),this.inputBuffer.depthTexture=this.depthTexture,this.outputBuffer=this.inputBuffer.clone())}getTimer(){return this.timer}getRenderer(){return this.renderer}setRenderer(e){if(this.renderer=e,null!==e){let t=e.getSize(new tZ),i=e.getContext().getContextAttributes()?.alpha??!1,r=this.inputBuffer.texture[0].type;for(let s of(1009===r&&3001===e.outputEncoding&&(this.inputBuffer.texture[0].encoding=3001,this.outputBuffer.texture[0].encoding=3001,this.inputBuffer.dispose(),this.outputBuffer.dispose(),console.log("doing some kinda dispose??")),e.autoClear=!1,this.setSize(t.width,t.height,!1),this.passes))s.initialize(e,i,r)}}replaceRenderer(e,t=!0){let i=this.renderer,r=i.domElement.parentNode;return this.setRenderer(e),t&&null!==r&&(r.removeChild(i.domElement),r.appendChild(e.domElement)),i}createDepthTexture(){let e=this.depthTexture=new nf(this._width,this._height);return this.inputBuffer.depthTexture=e,this.inputBuffer.stencilBuffer?(e.format=1027,e.type=1020):e.type=1014,e}deleteDepthTexture(){if(null!==this.depthTexture)for(let e of(this.depthTexture.dispose(),this.depthTexture=null,this.inputBuffer.depthTexture=null,this.inputBuffer.dispose(),this.passes))e.setDepthTexture(null)}createBuffer(e,t,i,r,s,a){let o=this.renderer,h=null===o?new tZ:o.getDrawingBufferSize(new tZ),c={minFilter:1006,magFilter:1006,wrapS:1001,wrapT:1001,stencilBuffer:t,depthBuffer:e},d;return r>0?(d=new iu(h.width,h.height,c)).samples=r:(s?(d=new ig(h.width,h.height,2,c)).texture[1].type=1016:d=new iu(h.width,h.height,c),d.depthTexture=new nf(2048,2048),d.depthTexture.type=1015),1009===i&&null!==o&&3001===o.outputEncoding&&(Array.isArray(d.texture)?d.texture.forEach(e=>e.encoding=3001):d.texture.encoding=3001),Array.isArray(d.texture)?d.texture.forEach((e,t)=>{e.name=`EffectComposer.Buffer ${s} ${t}`,e.generateMipmaps=!1}):(d.texture.name=`EffectComposer.Buffer ${s}`,d.texture.generateMipmaps=!1),d.name=a,d}addPass(e,t){let i=this.passes,r=this.renderer,s=r.getDrawingBufferSize(new tZ),a=r.getContext().getContextAttributes()?.alpha??!1,o;if(e.MRTCompatible&&(o=this.inputBuffer.texture[0].type),e.MRTCompatible||(o=this.inputBuffer.texture.type),e.setRenderer(r),e.setSize(s.width,s.height),e.initialize(r,a,o),this.autoRenderToScreen&&(i.length>0&&(i[i.length-1].renderToScreen=!1),e.renderToScreen&&(this.autoRenderToScreen=!1)),void 0!==t?i.splice(t,0,e):i.push(e),this.autoRenderToScreen&&(i[i.length-1].renderToScreen=!0),e.needsDepthTexture||null!==this.depthTexture)if(null===this.depthTexture){let t=this.createDepthTexture();for(e of i)e.setDepthTexture(t)}else e.setDepthTexture(this.depthTexture)}setHelperStartIndex(e){this.helperStartIndex=e}removePass(e){let t=this.passes,i=t.indexOf(e);-1!==i&&t.splice(i,1).length>0&&(null!==this.depthTexture&&(t.reduce((e,t)=>
5761e||t.needsDepthTexture,!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,o=this.outputBufferSingle,h=!1,c,d,u,p;for(let f of(void 0===e&&(e=this.timer.update().getDelta()),this.passes))f.enabled&&(f.MRTCompatible?f.render(t,r,s,e,h):f.render(t,a,o,e,h),f.needsSwap&&(h&&(i.renderToScreen=f.renderToScreen,c=t.getContext(),(d=t.state.buffers.stencil).setFunc(c.NOTEQUAL,1,0xffffffff),i.render(t,r,s,e,h),d.setFunc(c.EQUAL,1,0xffffffff)),u=r,p=a,r=s,a=o,s=u,o=p),f instanceof T7?h=!0:f instanceof Tq&&(h=!1))}setSize(e,t,i){let r=this.renderer;if(this._width=e,this._height=t,void 0===e||void 0===t){let i=r.getSize(new tZ);e=i.width,t=i.height}r.setSize(e,t,i);let s=r.getDrawingBufferSize(new tZ);for(let e of(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),this.passes))e.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=[],null!==this.inputBuffer&&this.inputBuffer.dispose(),null!==this.outputBuffer&&this.outputBuffer.dispose(),null!==this.inputBufferSingle&&this.inputBufferSingle.dispose(),null!==this.outputBufferSingle&&this.outputBufferSingle.dispose(),this.deleteDepthTexture(),this.copyPass.dispose(),this.timer.dispose()}},PU=new r5({name:"CombineMaterial",uniforms:{inputBufferA:new lD(null),inputBufferB:new lD(null)},blending:0,depthWrite:!1,depthTest:!1,vertexShader:`
5762varying vec2 vUv;
5763void main() {
5764    gl_Position = vec4(position.xy, 1.0, 1.0);
5765    vUv = position.xy * 0.5 + 0.5;
5766}
5767`,fragmentShader:`
5768    varying vec2 vUv;
5769    uniform sampler2D inputBufferA;
5770    uniform sampler2D inputBufferB;
5771
5772    // TODO: Why do we need these when postpro of framemode is enabled???
5773    layout(location = 1) out vec4 gVelocity;
5774
5775    void main() {
5776	vec4 resA = texture2D(inputBufferA, vUv);
5777	vec4 resB = texture2D(inputBufferB, vUv);
5778    float a = resA.a + resB.a * ( 1.0 - resA.a );
5779
5780	vec4 res;
5781	res.rgb =  resA.rgb + (resB.rgb * (1.0 - resA.a));
5782	res.a = resA.a + resB.a * (1.0 - resA.a);
5783	gl_FragColor = res;
5784    gVelocity = vec4(0.0);
5785    }
5786`}),PV=class extends TH{constructor(e){super("HelperPass",void 0,e),this.MRTCompatible=!1,this.fullscreenMaterial=PU,this.helperPass=new PF(!1,void 0,this.camera),this.helperPass.hasTransmissionPass=!1,this.helperPass.clear=!1,this.helperPass.renderToScreen=!1,this.helperPassOnTop=new PF(!1,void 0,this.camera),this.helperPassOnTop.hasTransmissionPass=!1,this.helperPassOnTop.clear=!1,this.helperPassOnTop.renderToScreen=!1;let t=new Pg({preset:0,edgeDetectionMode:2});this.effectPass=new T5(this.camera,t),this.rt=new iu(10,10,{minFilter:1006,magFilter:1006,wrapS:1001,wrapT:1001,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)}},PW=`#define GLSLIFY 1
5787out vec2 v_uv;void main(){v_uv=uv;gl_Position=vec4(position.xy,1.0,1.0);}`,PH=`#define GLSLIFY 1
5788in 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);}
5789#define USE_GBUFFER_NORMALS
5790void main(){vec3 view_space_p=get_view_position(v_uv);
5791#ifdef USE_GBUFFER_NORMALS
5792vec3 view_space_n=texture(texture_normals,v_uv).rgb;view_space_n.z*=-1.0;
5793#else
5794vec3 view_space_n=-rebuild_normal(v_uv,view_space_p);
5795#endif
5796float 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>
5796=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);}`,PG=`#define GLSLIFY 1
5797out vec2 v_uv;void main(){gl_Position=vec4(position.xy,1.0,1.0);v_uv=uv;}`,Pq=`#define GLSLIFY 1
5798in 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(){
5799#ifdef DEBUG
5800float 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);
5801#else
5802vec2 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;
5803#endif
5804}`,PX=[[.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]],PY=new r5({vertexShader:`#define GLSLIFY 1
5805#include <skinning_pars_vertex>
5806#include <morphtarget_pars_vertex>
5807out vec3 n;void main(){
5808#include <beginnormal_vertex>
5809#include <morphnormal_vertex>
5810#include <skinbase_vertex>
5811#include <skinnormal_vertex>
5812#include <defaultnormal_vertex>
5813#include <begin_vertex>
5814#include <morphtarget_vertex>
5815#include <skinning_vertex>
5816vec4 view_space=viewMatrix*modelMatrix*vec4(transformed,1.0);gl_Position=projectionMatrix*view_space;n=normalize(transformedNormal);}`,fragmentShader:`#define GLSLIFY 1
5817in vec3 n;void main(){gl_FragColor=vec4(n,1.0);}`}),PQ=new r5({vertexShader:PG,fragmentShader:Pq,uniforms:{texture_ao_lrez:new lD(null),texture_depth_lrez:new lD(null),texture_depth_hrez:new lD(null),near:new lD(null),far:new lD(null)}}),PZ=class extends TH{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,this.gBuffer=new iu(1024,1024,{type:u3?1016:1015,depthTexture:new nf(1024,1024),minFilter:1006,magFilter:1006}),this.depthBufferHighRes=new iu(1024,1024,{depthTexture:new nf(1024,1024)}),this.aoBuffer=new iu(1024,1024,{minFilter:1006,magFilter:1006}
5817),this.splineScene=e,this.splineCamera=t;let i=new Float32Array(2*PX.length);for(let e=0;e<PX.length;e++){let t=2*e;i[t+0]=PX[e][0],i[t+1]=PX[e][1]}this.blueNoiseInDiskTexture=new nM(i,PX.length,1,1030,1015),this.blueNoiseInDiskTexture.wrapS=1e3,this.blueNoiseInDiskTexture.wrapT=1e3,this.blueNoiseInDiskTexture.needsUpdate=!0,this.hbaoMaterial=new r5({vertexShader:PW,fragmentShader:PH,uniforms:{near:new lD(null),far:new lD(null),fov:new lD(null),proj_info:new lD(new id),is_ortho:new lD(!1),resolution:new lD(new tZ),radius_of_influence:new lD(8),radius_in_screen_space:new lD(1),exponent:new lD(1),ao_color:new lD(new iy),bias:new lD(.5),texture_depth:new lD(null),texture_normals:new lD(null),texture_blue_noise:new lD(null),texture_blue_noise_in_disk:new lD(this.blueNoiseInDiskTexture),frame_index:new lD(0),fog_enabled:new lD(!1),fog_near:new lD(1),fog_far:new lD(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 iu(1024,1024,{minFilter:1006,magFilter:1006,wrapS:1001,wrapT:1001,depthBuffer:!1,type:1015});let r=new Pg({preset:3,edgeDetectionMode:2});this.effectPass=new T5(this.camera,r)}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,PQ.uniforms.texture_depth_hrez.value=e,PQ.needsUpdate=!0}render(e,t,i){this.splineScene.overrideMaterial=PY;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.bias.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 e=this.splineCamera.perspCamera.projectionMatrix.elements,t=2/e[0],i=2/e[5],r=-(1-e[8])/e[0],s=-(1+e[9])/e[5];this.hbaoMaterial.uniforms.proj_info.value.set(t,i,r,s);let a=this.splineCamera.perspCamera.fov*(Math.PI/180),o=this.hbaoMaterial.uniforms.resolution.value.y/(2*Math.tan(.5*a)),h=.5*this.hbaoMaterial.uniforms.radius_of_influence.value*o;this.hbaoMaterial.uniforms.radius_in_screen_space.value=h,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 e=this.splineCamera.orthoCamera.projectionMatrix.elements,t=2/e[0],i=2/e[5],r=-(1+e[12])/e[0],s=-(1-e[13])/e[5];this.hbaoMaterial.uniforms.proj_info.value.set(t,i,r,s);let a=.5*(this.hbaoMaterial.uniforms.resolution.value.y/i),o=this.hbaoMaterial.uniforms.radius_of_influence.value*a;this.hbaoMaterial.uniforms.radius_in_screen_space.value=o,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=PQ,PQ.uniforms.texture_ao_lrez.value=this.aoBuffer.texture,PQ.uniforms.texture_depth_lrez.value=this.gBuffer.depthTexture,PQ.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()}},PK=`
5818varying vec2 vUv;
5819void main() {
5820    vUv = uv;
5821    gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
5822}`,PJ=`
5823uniform sampler2D tInput;
5824uniform sampler2D tMap;
5825uniform vec2 resolution;
5826varying vec2 vUv;
5827
5828uniform vec2 uResolution;
5829uniform vec2 uCoords;
5830
5831// Draws a rectangle at center <st> with size <size>
5832float rectangle(vec2 st, vec2 size) {
5833    size = vec2(0.5) - size * 0.5;
5834    vec2 uv = vec2(step(size.x, st.x), step(size.y, st.y));
5835    uv *= vec2(step(size.x, 1.0 - st.x), step(size.y, 1.0 - st.y));
5836
5837    return uv.x * uv.y;
5838}
5839
5840uniform vec2 uSize;
5841uniform float uScale;
5842uniform float uDPR;
5843uniform float uCurrent;
5844uniform vec3 uSceneColor;
5845
5846void main() {
5847    vec2 screenUv = gl_FragCoord.xy / uResolution.xy;
5848    screenUv *= 1.0 / uDPR;
5849
5850    vec2 center = vec2(0.5, -0.5);
5851    vec2 outsideUv = screenUv;
5852    outsideUv += center;
5853    outsideUv -= uCoords.xy / uResolution.xy;
5854    outsideUv = (outsideUv - 0.5) + 0.5;
5855    outsideUv -= center;
5856    vec2 s = (uSize / uResolution) * uScale;
5857    float isOutside = 1.0 - rectangle(outsideUv, s);
5858    
5859    vec2 mid = vec2(0.5);
5860    vec2 insideUv = (screenUv - mid + s * mid) / s;
5861    vec4 background = texture2D(tInput, screenUv);
5862    vec4 image = texture2D(tMap, insideUv);
5863    gl_FragColor = mix(image, background, isOutside);
5864}
5865`,P$=class extends Pe{constructor(){super(new r5({vertexShader:PK,fragmentShader:PJ,uniforms:{tInput:new lD(null),tMap:new lD(null),uResolution:new lD(new tZ),uSize:new lD(new tZ),uCoords:new lD(new tZ),uScale:new lD(1),uSceneColor:new lD(new ir(0xff0000)),uDPR:new lD(1),uCurrent:ne
5865w lD(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}},P0=`
5866void main() {
5867    gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
5868}`,P1=`
5869uniform sampler2D toScene;
5870uniform sampler2D fromScene;
5871uniform vec2 resolution;
5872
5873uniform vec2 uResolution;
5874uniform float uDPR;
5875
5876uniform float mixRatio;
5877uniform sampler2D tMixTexture;
5878uniform int useTexture;
5879uniform float threshold;
5880
5881void main() {
5882	vec2 screenUv = gl_FragCoord.xy / uResolution.xy;
5883	screenUv *= 1.0 / uDPR;
5884
5885	vec4 texel1 = texture2D( fromScene, screenUv );
5886	vec4 texel2 = texture2D( toScene, screenUv );
5887
5888	if (useTexture==1) {
5889		
5890		vec4 transitionTexel = texture2D( tMixTexture, screenUv );
5891		float r = mixRatio * (1.0 + threshold * 2.0) - threshold;
5892		float mixf=clamp((transitionTexel.r - r)*(1.0/threshold), 0.0, 1.0);
5893		
5894		gl_FragColor = mix( texel1, texel2, mixf );
5895	} else {
5896		
5897		gl_FragColor = mix( texel1, texel2, mixRatio );
5898		
5899	}
5900}
5901`,P2=class extends Pe{constructor(){super(new r5({vertexShader:P0,fragmentShader:P1,uniforms:{toScene:new lD(null),fromScene:new lD(null),uResolution:new lD(new tZ),uDPR:new lD(1),mixRatio:new lD(0),threshold:new lD(.1),useTexture:new lD(0),tMixTexture:{value:void 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}},P3=`
5902void main() {
5903    gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
5904}`,P4=`
5905uniform sampler2D inputBuffer;
5906uniform sampler2D blurredInputBuffer;
5907uniform sampler2D overlay;
5908uniform float blurIntensity;
5909
5910uniform vec2 uResolution;
5911uniform float uDPR;
5912
5913void main() {
5914	vec2 screenUv = gl_FragCoord.xy / uResolution.xy;
5915	screenUv *= 1.0 / uDPR;
5916
5917	vec4 texel1 = texture2D( overlay, screenUv );
5918	vec4 texel2 = texture2D( inputBuffer, screenUv );
5919	vec4 texel3 = texture2D( blurredInputBuffer, screenUv );
5920
5921	float blurMask2 = max(sign(texel1.a), 0.0) * blurIntensity;
5922    gl_FragColor = mix( mix(texel2, texel3, blurMask2), texel1, texel1.a );
5923}
5924`,P5=class extends Pe{constructor(){super(new r5({vertexShader:P3,fragmentShader:P4,uniforms:{inputBuffer:new lD(null),blurredInputBuffer:new lD(null),overlay:new lD(null),uResolution:new lD(new tZ),uDPR:new lD(1),blurIntensity:new lD(0)}})),this._blurEnabled=!1,this.blurTarget=new iu(1,1,{minFilter:1006,magFilter:1006,wrapS:1001,wrapT:1001}),this.blurPass=new T8({width:window.innerWidth,height:window.innerHeight,kernelSize:Pi.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 e=t.data.backgroundBlur,i=e.radius;this._blurEnabled=e.enabled,this.uniforms.blurIntensity.value=+!!this._blurEnabled,this.blurPass.scale=i/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)}},P6=`
5925varying vec2 vUv;
5926void main() {
5927    vUv = uv;
5928    gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
5929}`,P8=`
5930uniform sampler2D tInput;
5931uniform sampler2D tOverlayImage;
5932varying vec2 vUv;
5933uniform vec2 uResolution;
5934uniform vec2 uRightBottom;
5935uniform vec2 uImageSize;
5936uniform float uScale;
5937uniform float uDPR;
5938
5939vec3 blendNormal(vec3 base, vec3 blend) {
5940	return blend;
5941}
5942
5943vec3 blendNormal(vec3 base, vec3 blend, float opacity) {
5944	return (blendNormal(base, blend) * opacity + base * (1.0 - opacity));
5945}
5946
5947vec4 drawFixedSizeImage(sampler2D image, vec2 screenUV, vec2 imageSize, vec2 imageCoords, vec2 screenSize, float dpr) {
5948	vec2 uv = (screenUV * screenSize * dpr - imageCoords) / (imageSize * dpr);
5949	if (uv.x < 0.0 || uv.x > 1.0 || uv.y < 0.0 || uv.y > 1.0) {
5950		return vec4(0.0);
5951	}
5952	return texture2D(image, uv);
5953}
5954
5955void main() {
5956    vec2 screenUV = gl_FragCoord.xy / (uResolution.xy * uDPR);
5957	vec2 imageCoords = vec2(uResolution.x * uDPR - uImageSize.x * uScale * uDPR - uRightBottom.x * uDPR, uRightBottom.y * uDPR);
5958    vec4 background = texture2D(tInput, screenUV);
5959    vec4 image = drawFixedSizeImage(tOverlayImage, screenUV, uImageSize * uScale, imageCoords, uResolution, uDPR);
5960    gl_FragColor = vec4(blendNormal(background.rgb, image.rgb, image.a), max(background.a, image.a));
5961}
5962`,P9=class extends Pe{constructor(){super(new r5({vertexShader:P6,fragmentShader:P8,uniforms:{tInput:new lD(null),tOverlayImage:new lD(null),uResolution:new lD(new tZ),uImageSize:new lD(new tZ),uRightBottom:new lD(new tZ(20,20)),uScale:new lD(.25),uDPR:new lD(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 P7(e,t){return t&&t.enabled&&e.push(t.effect),e}var De=e=>Object.values(T0).includes(e)?e:T0.NORMAL,Dt=class extends tk{constructor(e,t){super(),this._needsDOFResize=t,this.postprocessingState=vt.defaultData,this._scene=new nb,this._camera=new Ts,this.effects=new Map,this.blueNoiseTexture=new nM,this._renderToScreen=!0,this._isUIOverlayEnabled=!1,this.clock=new lg,this.renderer=e,this.debug=!1,this.effects.set("bloom",new Pw),this.effects.set("chromaticAberration",new PS),this.effects.set("vignette",new PA),this.effects.set("noise",new PE),this.effects.set("colorAverage",new PC),this.effects.set("hueSaturation",new PM),this.effects.set("brightnessContrast",new P_),this.effects.set("depthOfField",new PT),this.effects.set("pixelation",new PP),this.effectComposer=new Pj(this.renderer),this.effectComposer.autoRenderToScreen=!1,this.opaquePass=new PF(!0,this.scene,this.camera),this.opaquePass.clear=!0,this.transmissionPass=new PB(this.scene,this.camera,this.renderer),this.aoPass=new PZ(this.scene,this.camera),this.taaPass=new Pk,this.taaPass.renderToScreen=!1,this.helperPass=new PV(this.camera),this.helperPass.renderToScreen=!1,this.stylesOverlayPass=new P$,this.stylesOverlayPass.enabled=!1,this.uiOverlayPass=new P5,this.uiOverlayPass.enabled=!1,this.logoOverlayPass=new P9,this.logoOverlayPass.enabled=!1,this.sceneTransitionPass=new P2,this.sceneTransitionPass.enabled=!1,this._initCopyPass(),this._initPasses()}set overlayTexture(e){void 0!==e?(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(!0===i.enabled&&!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 nM(e,128,128),this.blueNoiseTexture.wrapS=1e3,this.blueNoiseTexture.wrapT=1e3,this.blueNoiseTexture.minFilter=1003,this.blueNoiseTexture.magFilter=1003,this.blueNoiseTexture.needsUpdate=!0}setAmbientOcclusionParams(e,t,i,r,s,a,o,h){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=o,!h!==this.aoPass.runHalfRes&&(this.aoPass.runHalfRes=!h)}setTransmissionPassEnabled(e){this.transmissionPass.enabled=e,this.opaquePass.hasTransmissionPass=e}
5962_initPasses(){if(this.uvEffectPass?.dispose(),this.effectPass?.dispose(),this.effectComposer.removeAllPasses(),this.transmissionPass.updatePasses(this.renderer),this.effectComposer.addPass(this.aoPass),this.effectComposer.addPass(this.opaquePass),this.effectComposer.addPass(this.transmissionPass),this.effectComposer.addPass(this.taaPass),this.postprocessingState.enabled){let e=[this.effects.get("pixelation")].reduce(P7,[]);e.length>0&&(this.uvEffectPass=new T5(this.camera,...e),this.uvEffectPass.renderToScreen=!1,this.effectComposer.addPass(this.uvEffectPass));let t=[this.effects.get("chromaticAberration"),this.effects.get("bloom"),this.effects.get("depthOfField"),this.effects.get("colorAverage"),this.effects.get("hueSaturation"),this.effects.get("brightnessContrast"),this.effects.get("vignette"),this.effects.get("noise")].reduce(P7,[]);if(t.length>0&&(this.effectPass=new T5(this.camera,...t),this.effectPass.renderToScreen=!1,this.effectComposer.addPass(this.effectPass),this._needsDOFResize&&this.effects.get("depthOfField")?.enabled&&void 0!==window)){let e=this.renderer.viewportWidth,t=this.renderer.viewportHeight;this.renderer.setSize(e-1,t-1),this.renderer.setSize(e,t)}}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 tZ;this.renderer.getDrawingBufferSize(e),this._rt=new iu(e.x,e.y,{depthBuffer:!1,stencilBuffer:!1,wrapS:1e3,wrapT:1e3}),this._rt.samples=0,this._savePass=new TG(this._rt,!1),this._savePass.renderToScreen=!1}setCopyPass(e){this._rt=e,this._savePass=new TG(this._rt,!1),this.renderToScreen=!1}get renderToScreen(){return this._renderToScreen}set renderToScreen(e){if(this._renderToScreen===e)return;let t=this.effectComposer;t&&(!0===e?t.removePass(this._savePass):t.addPass(this._savePass),this._renderToScreen=e,this.updateRenderToScreen())}set sceneTransitionFromTexture(e){e!==this.sceneTransitionPass.texture&&(null!==e?this.sceneTransitionPass.enabled=!0:(this.sceneTransitionPass.enabled=!1,this.updateRenderToScreen()),this.sceneTransitionPass.texture=e)}setWatermark(e){this.logoOverlayPass.enabled=null!==e,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;for(let e of(t!==this.postprocessingState.enabled&&(r=!0),Object.entries(i))){let t=e[1],i=this.effects.get(e[0]);if(i)for(let[e,s]of(i.enabled!==t.enabled&&(r=!0),i.enabled=t.enabled,Object.entries(t)))"blendFunction"===e?i.blendFunction=De(s):i[e]=s}this.postprocessingState=e,r&&this._initPasses()}render(){this.effectComposer.render(this.clock.getDelta())}setScissor(e,t,i,r){e instanceof id?(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 id?(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 i=this.renderer.getPixelRatio();this._rt.setSize(e*i,t*i)}}dispose(){this.uvEffectPass?.dispose(),this.effectPass?.dispose(),this.effectComposer.dispose()}},Di=sd.lights_fragment_begin,Dr=sd.shadowmask_pars_fragment,Ds=null,Da=new r5({vertexShader:`
5963attribute vec3 randomColor;
5964varying vec3 vNormal;
5965flat out vec3 vColor;
5966#include <skinning_pars_vertex>
5967#include <morphtarget_pars_vertex>
5968	
5969void main()
5970{
5971#include <beginnormal_vertex>
5972#include <morphnormal_vertex>
5973#include <skinbase_vertex>
5974#include <skinnormal_vertex>
5975vec3 transformed = vec3(position);
5976#include <morphtarget_vertex>
5977#include <skinning_vertex>
5978
5979vNormal = normal;
5980vColor = randomColor;
5981gl_Position = projectionMatrix * (modelViewMatrix * vec4(transformed, 1.0));
5982}
5983`,fragmentShader:`
5984uniform float depthContrast;
5985varying vec3 vNormal;
5986flat in vec3 vColor;
5987void main()
5988{
5989vec3 normal = (normalize(vNormal)).rgb;
5990
5991float contrastDepth = (gl_FragCoord.z - 0.5) * depthContrast + 0.5;
5992
5993vec3 resultColor = mix(mix(vColor, normal, 0.2), vec3(contrastDepth), 0.4);
5994gl_FragColor = vec4(resultColor, vColor.r);
5995gl_FragColor = vec4(resultColor, vColor.r);
5996}
5997`,uniforms:{depthContrast:{value:1}}}),Dn=new ic,Do=new tZ,Dl=class extends ny{constructor(e){super(e),this._pixelRatio=this.getPixelRatio(),this.viewportWidth=1,this.viewportHe
5997ight=1,this.resolution=new tZ,this.dummyCamera=new Ts,this.sceneTransitionDuration=0,this.sceneTransitionTimeRemaining=-1,this.isXRCopyPassSet=!1,this.clear=(e=!0,t=!0,i=!0)=>{let r=this.getContext(),s=0;e&&(s|=r.COLOR_BUFFER_BIT),t&&(s|=r.DEPTH_BUFFER_BIT),i&&(s|=r.STENCIL_BUFFER_BIT),r.clear(s),r.clearBufferfv(r.COLOR,1,[0,0,0,1])},this.pipeline=new Dt(this,e?.needsDOFResize??!1),this.autoClear=!1;let t=this.setPixelRatio.bind(this),i=this.setSize.bind(this);this.shadowMap.enabled=!0,this.shadowMap.type=1,this.dummyCamera.matrixAutoUpdate=!1,this.domElement.removeAttribute("data-engine");let r=this.getContext();if(r&&"drawingBufferColorSpace"in r)try{r.drawingBufferColorSpace="display-p3"}catch(e){console.warn(e)}this.setPixelRatio=e=>{this._pixelRatio!==e&&(this._pixelRatio=e,t(e))},this.setSize=(e,t,r=!0)=>{(this.viewportWidth!==e||this.viewportHeight!==t)&&(this.viewportWidth=e,this.viewportHeight=t,i(e,t,r),this.normalRenderTarget?.setSize(e*this._pixelRatio,t*this._pixelRatio),this._resizeTransmission(e,t),this.transmissionDepthTarget?.setSize(e*this._pixelRatio/2,t*this._pixelRatio/2),this.pipeline.resize(e,t,r))},this._superDispose=this.dispose,this.dispose=this._currentDispose}createAORenderTarget(){void 0===this.aoRenderTarget&&(this.aoRenderTarget=new iu(this.viewportWidth*this._pixelRatio,this.viewportHeight*this._pixelRatio,{generateMipmaps:!1,minFilter:1006,magFilter:1006,wrapS:1001,wrapT:1001,depthBuffer:!1}))}_resizeTransmission(e,t){this.transmissionRenderTarget?.setSize(e*this._pixelRatio/(this.hdTransmission?1:2),t*this._pixelRatio/(this.hdTransmission?1:2)),this.aoRenderTarget?.setSize(e*this._pixelRatio/1,t*this._pixelRatio/1)}get hdTransmission(){return 1===MS.transmissionLod.value}set hdTransmission(e){MS.transmissionLod.value=!0===e?1:2,this._resizeTransmission(this.viewportWidth,this.viewportHeight)}createTransmissionRenderTarget(){void 0===this.transmissionRenderTarget&&(this.transmissionRenderTarget=new iu(this.viewportWidth*this._pixelRatio/(this.hdTransmission?1:2),this.viewportHeight*this._pixelRatio/(this.hdTransmission?1:2),{generateMipmaps:!0,minFilter:1008,magFilter:1006,wrapS:1001,wrapT:1001,depthBuffer:!1}),this.transmissionDepthTarget=new iu(this.viewportWidth*this._pixelRatio/2,this.viewportHeight*this._pixelRatio/2,{minFilter:1003,magFilter:1003,depthBuffer:!1}))}createNormalRenderTarget(){void 0===this.normalRenderTarget&&(this.normalRenderTarget=new iu(this.viewportWidth*this._pixelRatio,this.viewportHeight*this._pixelRatio,{generateMipmaps:!1,minFilter:1003,magFilter:1003,type:1015,depthTexture:new nf(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(e=>{e.layers.isEnabled(8)&&(e.copyPreviousMatrix=!1)}),this.setRenderTarget(this.normalRenderTarget),this.clear(),i instanceof Ts?Da.uniforms.depthContrast.value=(i.far-i.near)/1e4:Da.uniforms.depthContrast.value=1,t.overrideMaterial=Da,this.render(t,i),this.setClearColor(t.bgColor,t.bgColor.a),this.setRenderTarget(null),t.overrideMaterial=e.wireframeState?Lx:null,i.layers.enable(0),i.layers.enable(3),t.traverseEntity(e=>{e.layers.isEnabled(8)&&(e.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 t=0;t<i;t++)this.renderSplineScene(e,this.dummyCamera)}renderSplineScene(e,t,{sceneHelpers:i=this.sceneHelpers,sceneHelpersOnTop:r=this.sceneHelpersOnTop,overrideTransmission:s,overrideNormal:a}={}){let o=e instanceof Lw?e.activePage:e,h=o.visible;o.visible=!0;let c=o.scene;this.xr.enabled&&(!1===this.isXRCopyPassSet&&null!==this.getRenderTarget()&&(this.pipeline.setCopyPass(this.getRenderTarget()),this.isXRCopyPassSet=!0),this.xr.updateCamera(t)),this.setClearColor(o.bgColor,o.bgColor.a),o.penumbraSizeArray.forEach((e,t)=>{MS.penumbraSize.value[t]=e}),MS.pixelRatioNode.value=this.getPixelRatio(),0!==this.resolution.x&&0!==this.resolution.y?MS.resolution.value.set(this.resolution.x,this.resolution.y):MS.resolution.value.set(this.viewportWidth*this._pixelRatio,this.viewportHe
5997ight*this._pixelRatio),void 0!==a?(MS.normalRenderTarget.value=a,MS.normalRenderTargetDepth.value=Dn):c.needsNormal()&&(this.createNormalRenderTarget(),MS.normalRenderTarget.value=this.normalRenderTarget.texture,MS.normalRenderTargetDepth.value=this.normalRenderTarget.depthTexture,this.renderNormal(c,o,t));let d=o.data.ao,u=d.occlusion;if(u&&(this.createAORenderTarget(),MS.aoRenderTarget.value=this.aoRenderTarget.texture),MS.aoEnabled.value=u,this.pipeline.setAmbientOcclusionParams(d.occlusion,d.radius,d.bias,o.aoColor,null!==o.fog,o.backupFog.near,o.backupFog.far,d.aoFullRes&&!u3),this.pipeline.aoPass.setBlueNoiseTexture(this.pipeline.blueNoiseTexture),this.pipeline.isUIOverlayEnabled&&o.uiCanvas?.enabled&&o.uiCanvas.texture&&o.uiCanvas.texture.image.width>0){let e=this.getSize(Do),t=this.getPixelRatio();(o.uiCanvas.width!==this.viewportWidth||o.uiCanvas.height!==this.viewportHeight||o.uiCanvas.dpr!==t)&&o.uiCanvas.applySize({width:this.viewportWidth,height:this.viewportHeight},t),o.uiCanvas.render(this),this.pipeline.uiOverlayPass.uiCanvas=o.uiCanvas,this.pipeline.uiOverlayPass.enabled=!0,this.pipeline.uiOverlayPass.setResolution(e.x,e.y,t),this.pipeline.updateRenderToScreen()}else this.pipeline.uiOverlayPass.enabled=!1,this.pipeline.updateRenderToScreen();if(this.pipeline.logoOverlayPass.enabled){let e=this.getSize(Do),t=this.getPixelRatio();this.pipeline.logoOverlayPass.uniforms.uResolution.value.set(e.x,e.y),this.pipeline.logoOverlayPass.uniforms.uDPR.value=t}let p=!1;if(void 0!==s)MS.transmissionRenderTarget.value=s,MS.transmissionRenderTargetDepth.value=Dn,this.pipeline.setTransmissionPassEnabled(!1);else{var f,m;let e=c.needsTransmission();e&&(void 0===this.transmissionRenderTarget&&(p=!0),this.createTransmissionRenderTarget(),MS.transmissionRenderTarget.value=this.transmissionRenderTarget.texture,MS.aspectRatio.value=(f=this.viewportWidth)>=(m=this.viewportHeight)?new tZ(m/f,1):new tZ(1,f/m),MS.transmissionRenderTargetDepth.value=this.transmissionDepthTarget.texture),this.pipeline.setTransmissionPassEnabled(e)}t.layers.enable(3),t.layers.enable(8),this.pipeline.sceneHelpers=i,this.pipeline.sceneHelpersOnTop=r,this.pipeline.scene=o,this.pipeline.camera=t,p&&this.pipeline.transmissionPass.updatePasses(this),this.pipeline.postprocessingState!==o.postprocessing&&(this.pipeline.updatePostprocessing(o.postprocessing),i||r||this.pipeline.disableHelpers()),void 0!==this.clearAlphaOverride&&this.setClearAlpha(this.clearAlphaOverride),c.shapeBlendIntances.forEach(e=>{e.onBeforeShadowPass(this)}),o.overrideMaterial=c.wireframeState?Lx:null,this.pipeline.render(),MS.frameIndex.value=(MS.frameIndex.value+1)%16,t instanceof Ts&&t.copyHistory(),o.visible=h}renderFromSceneForSceneTransitionPass(e,t,i){this.pipeline.renderToScreen=!1,this.pipeline.renderTarget,this.renderSplineScene(e,t),this.pipeline.sceneTransitionFromTexture=this.pipeline.renderTarget.texture,this.sceneTransitionDuration=i,this.sceneTransitionTimeRemaining=i,this.pipeline.renderToScreen=!0;let r=this.pipeline.sceneTransitionPass.uniforms;r.uDPR.value=window.devicePixelRatio,r.uResolution.value.set(this.domElement.width,this.domElement.height).divideScalar(window.devicePixelRatio)}_currentDispose(){this._superDispose(),this.pipeline.dispose(),this.aoRenderTarget?.dispose(),this.transmissionRenderTarget?.dispose(),this.transmissionDepthTarget?.dispose(),this.normalRenderTarget?.dispose(),this.normalRenderTarget?.depthTexture?.dispose()}},Dh=class extends AK(lq){constructor(e,t=15,i=0x999999){super(e,t,i),this.object=e,this.added=!1,this.name=`DirectionalLightHelper: ${e.uuid}`}raycast(e,t){A1(this.object,Dh.geometryHelper,e,t)}},Dc=class extends AK(lV){constructor(e,t=15,i=6710886){super(e,t,i),this.object=e,this.name=`PointLightHelper: ${e.uuid}`}raycast(e,t){A1(this.object,Dc.geometryHelper,e,t)}},Dd=class extends AK(lU){constructor(e,t=6710886){super(e,t),this.object=e,this.name=`SpotLightHelper: ${e.uuid}`}raycast(e,t){A1(this.object,Dd.geometryHelper,e,t)}update(){if(void 0!==this.object){let e=Dd._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=void 0!==this.color?this.color:this.light.color;if(this.cone.material instanceof Array)for(let e=0,t=this.cone.material.length;e<t;e++)this.cone.material[e].color.set(r);else this.cone.material.color.set(r)}}},Du=Dd;Du._vector=new iy;var Dp=class extends nd{constructor(){super(),this.caretIndex=0,this._caretVisibleAlpha=1,this._selectionVisibleAlpha=.3,this.current={start:0,end:void 0},this.matrixAutoUpdate=!1,this.caretMesh=new rK(new sc(1,1),new rS({transparent:!0,opacity:0,side:2})),this.add(this.caretMesh),this.selectionMesh=new rK(new sc(1,1),new rS({color:2857471,transparent:!0,depthTest:!1,depthWrite:!1,opacity:0,side:2})),this.add(this.selectionMesh),this.hide()}get caretHeight(){return this.object?.AD??0}show(e){this.visible=!0,this.object=e,this.caretMesh.scale.set(1,this.caretHeight,1),this.caretMesh.position.y=-(.5*this.caretHeight),this.setCaretPosition(this.caretIndex),this.update()}hide(){this.visible=!1}update(){if(void 0===this.object)return;this.updateHelperMatrix();let{depth:e}=this.object.geometry.userData.parameters;this.caretMesh.position.z=e,this.selectionMesh.position.z=e}updateHelperMatrix(){if(void 0===this.object)return;let e=this.object,t=e.parent;for(let i of(null!==t&&t.updateWorldMatrix(!0,!1),e.matrixAutoUpdate&&e.updateMatrix(),null!==t?(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),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(void 0===this.object)return;this.caretIndex=e;let i=this.object.wrappedText,[r,s]=Dm(i,e),[a,o]=e>0?Dm(i,e-1):[null,null];(e>0&&i.length?i[a].charAt(o):null)===`
5998`&&(r++,s=0),this.current.start=e,this.current.end=void 0;let[h,c]=Df(this.object,r,s),{AD:d,descender:u}=this.object,{width:p,height:f,depth:m}=this.object.geometry.userData.parameters;this.caretMesh.scale.set(1,this.caretHeight,1),this.caretMesh.position.set(h-.5*("string"==typeof p?0:p),c+(u+.5*d
vendor: 4,588 bytes, line 5998
5998)+.5*("string"==typeof f?0:f),m),this.hideSelectionMesh(),this.showCaretMesh()}setSelection(e,t){if(void 0===this.object)return;let i=this.object.wrappedText;this.current.start=e,this.current.end=t;let r=[],s=[],a=function(e,t,i){let[r,s]=Dm(e,t),[a,o]=Dm(e,i),h=[];s>=e[r].length&&(r++,s=0);for(let t=r;t<=a;t++){let i=e[t],c=t===r?s:0,d=t===a?o:i.length;h.push([t,c,d])}return h}(i,e,t),{lineHeight:o,AD:h,descender:c}=this.object,d=c+.5*h-.5*o;for(let[e,t,i]of a)if(t!==i){let[a,h]=Df(this.object,e,t),[c,u]=Df(this.object,e,i);h+=d,u+=d,u+=o;let p=r.length/3;r.push(a,h,0),r.push(c,h,0),r.push(c,u,0),r.push(a,u,0),s.push(p+0,p+1,p+2),s.push(p+2,p+3,p+0)}let u=new rz;u.setIndex(s),u.setAttribute("position",new rP(r,3));let{width:p,height:f,depth:m}=this.object.geometry.userData.parameters;this.selectionMesh.geometry.dispose(),this.selectionMesh.geometry=u,this.selectionMesh.position.x=-(.5*("string"==typeof p?0:p)),this.selectionMesh.position.y=.5*("string"==typeof f?0:f),this.selectionMesh.position.z=m,this.showSelectionMesh(),this.hideCaretMesh()}getSelectionFromPosition(e,t,i="previous"){if(void 0===this.object||void 0===this.object.font)return;let r=this.object.wrappedText,s=r.length,a=this.object.lineHeight,o=s*a,{height:h,verticalAlign:c}=this.object.geometry.userData.parameters,d="string"==typeof h?0:h,u=0;3===c?u=d-o:2===c&&(u=.5*d-.5*o);let p=Math.min(Math.floor(Math.max(Math.min(-t-u,o),0)/a),s-1),f=this.object.charCoords[p],m=this.object.charWidths[p],g=0,v=!1;if("previous"===i){for(let t=0;t<f.length;t++)if(f[t][0]+.5*m[t]-e>0){g=t,v=!0;break}}else if("closest"===i){let t=1/0;for(let i=0;i<f.length;i++){let r=Math.abs(f[i][0]+.5*m[i]-e);r<t&&(t=r,g=i,v=!0)}}else for(let t=0;t<f.length;t++){let i=f[t][0],r=f[t][0]+m[t];if(e>=i&&e<r){g=t,v=!0;break}}return v||(g=f.length),{index:this.getGlobalIndexFromLineAndCharIndexes(r,p,g),lineIndex:p,characterIndex:g}}getGlobalIndexFromLineAndCharIndexes(e,t,i){return e.slice(0,t).reduce((e,t)=>e+=t.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 Df(e,t,i){let{charCoords:r,charWidths:s,initialOffsetY:a,lineHeight:o}=e;if(r[t]&&0===r[t].length||0===r.length){let i=0,{horizontalAlign:r}=e.data.geometry,s=e.wrappedText,{width:h}=e.geometry.userData.parameters;return 1===s.length&&0===s[0].length&&(3===r?i=.5*h:2===r&&(i=h)),[i,a-o*t]}let h=r[t];if(void 0===h||0===h.length)return[0,0];let[c,d]=h[Math.min(i,h.length-1)];return i>=h.length&&(c+=s[t][i-1]),[c,d]}function Dm(e,t){let i=0;for(let r=0;r<e.length;r++){let s=e[r],a=t-i;if(a<=s.length)return[r,a];i+=s.length}return[Math.max(0,e.length-1),e[e.length-1]?.length??0]}var Dg=class extends Th(lp,Dh){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 lQ(this.shadow.camera);s.visible=!1,this.gizmos.shadowmap=s}update(){for(let e in this.shadow.camera.updateProjectionMatrix(),this.gizmos){let t=this.gizmos[e];t instanceof lQ&&t.update()}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.objectHelper&&this.objectHelper.update()}updateState(e,t){var i;this.updateState_Light(e,t);let r=void 0!==e.depth&&e.depth!==this.shadow.camera.far||void 0!==e.size&&e.size/2!==this.shadow.camera.right;void 0!==e.size&&(i=e.size,this.shadow.camera.right=i/2,this.shadow.camera.left=-i/2,this.shadow.camera.top=i/2,this.shadow.camera.bottom=-i/2,this.shadow.needsUpdate=!0),void 0!==e.shadowRadius&&(this.shadow.radius=e.shadowRadius),void 0!==e.shadowResolution&&(this.shadow.mapSize.set(e.shadowResolution,e.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null)),void 0!==e.penumbraSize&&t.scene.markPenumbraSizeDirty(),r&&this.update()}},Dv=new iy,Dy=new iy,Dx=new iv,Db=class extends Th(ln,Du){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=2*tQ.RAD2DEG*this.angle,r.aspect=1,r.near=100,r.far=2500;let s=new lQ(this.shadow.camera);s.visible=!1,this.gizmos.shadowmap=s,this.update()}update(){for(let e in this.shadow.camera.updateProjectionMatrix(),this.gizmos){let t=this.gizmos[e];
5998t instanceof lQ&&t.update()}}updateMatrixWorld(e){super.updateMatrixWorld(e),Dy.setFromMatrixPosition(this.matrixWorld),Dx.setFromRotationMatrix(this.matrixWorld),Dv.copy(this.up).applyQuaternion(Dx).negate().multiplyScalar(this.distance),this.target.position.copy(Dy).add(Dv),this.target.updateMatrixWorld(),this.objectHelper&&this.objectHelper.update()}updateState(e,t){this.updateState_Light(e,t),void 0!==e.distance&&(this.distance=e.distance),void 0!==e.decay&&(this.decay=e.decay),void 0!==e.angle&&(this.angle=e.angle),void 0!==e.penumbra&&(this.penumbra=e.penumbra),void 0!==e.shadowRadius&&(this.shadow.radius=e.shadowRadius),void 0!==e.penumbraSize&&t.scene.markPenumbraSizeDirty(),void 0!==e.shadowResolution&&(this.shadow.mapSize.set(e.shadowResolution,e.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null))}};function Dw(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 D_(e){return[[e[0][0],e[1][0]],[e[0][1],e[1][1]]]}var DS=DA||(DA={});function DC(e){return[e[0],e[3],e[1],e[4],e[2],e[5]]}DS.identity=function(){return[1,0,0,0,1,0,0,0,1]},DS.copy=function(e,t=DS.identity()){for(let i=0,r=e.length;i<r;i++)t[i]=e[i];return t},DS.create=function(e,t,i,r,s,a){return DS.setAbcdef(DS.identity(),e,t,i,r,s,a)},DS.setAbcdef=function(e,t,i,r,s,a,o){return e[0]=t,e[1]=r,e[2]=a,e[3]=i,e[4]=s,e[5]=o,e},DS.append=function(e,t){let[i,r,s,a,o,h]=DC(e),[c,d,u,p,f,m]=DC(t);return DS.create(c*i+d*s,c*r+d*a,u*i+p*s,u*r+p*a,f*i+m*s+o,f*r+m*a+h)},DS.prepend=function(e,t){let[i,r,s,a,o,h]=DC(e),[c,d,u,p,f,m]=DC(t),g=i,v=r,y=s,x=a;return(1!==c||0!==d||0!==u||1!==p)&&(g=i*c+r*u,v=i*d+r*p,y=s*c+a*u,x=s*d+a*p),DS.create(g,v,y,x,o*c+h*u+f,o*d+h*p+m)},DS.getAbcdef=DC,DS.invert=function(e){let[t,i,r,s,a,o]=DS.getAbcdef(e),h=t*s-i*r;return DS.create(s/h,-i/h,-r/h,t/h,(r*o-s*a)/h,-(t*o-i*a)/h)},DS.apply=function([e,t],i){let[r,s,a,o,h,c]=DS.getAbcdef(i);return[r*e+a*t+h,s*e+o*t+c]},DS.applyInverse=function(e,t){let[i,r,s,a,o,h]=DS.getAbcdef(t),c=1/(i*a+-(s*r)),[d,u]=e;
5998return[a*c*d+-s*c*u+(h*s-o*a)*c,i*c*u+-r*c*d+(-h*i+o*r)*c]},DS.scale=function(e,t,i=t){let[r,s,a,o,h,c]=DS.getAbcdef(e);return DS.setAbcdef(e,r*t,s*i,a*t,o*i,h*t,c*i),e},DS.rotate=function(e,t){let i=Math.cos(t),r=Math.sin(t),[s,a,o,h,c,d]=DS.getAbcdef(e);return DS.setAbcdef(e,s*i-a*r,s*r+a*i,o*i-h*r,o*r+h*i,c*i-d*r,c*r+d*i),e},DS.rotateAround=function(e,t,i){let[r,s]=i,a=DS.translate(e,-r,-s);return a=DS.rotate(a,t),a=DS.translate(a,r,s)},DS.translate=function(e,t,i){let[r,s,a,o,h,c]=DS.getAbcdef(e);return DS.setAbcdef(e,r,s,a,o,h+t,c+i),e},DS.setTranslate=function(e,t,i){let[r,s,a,o]=DS.getAbcdef(e);return DS.setAbcdef(e,r,s,a,o,t,i),e},DS.setPosition=function(e,t,i){let[r,s,a,o]=DS.getAbcdef(e);return DS.setAbcdef(e,r,s,a,o,t,i),e},DS.getScale=function(e){let[t,i,r,s]=DS.getAbcdef(e);return[Math.sqrt(t*t+i*i),Math.sqrt(r*r+s*s)]},DS.getPosition=function(e){let[,,,,t,i]=DS.getAbcdef(e);return[t,i]},DS.getRotation=function(e,t){return DS.decompose(e,t).rotation},DS.decompose=function(e,t){let[i,r,s,a,o,h]=DS.getAbcdef(e),{rotation:c,scale:d,shear:u}=function(e){let t,i,r,s,a,o,h,c,d,u,p,f,[m,g,v]=(t=(e[0][0]+e[1][1])/2,i=(e[0][0]-e[1][1])/2,r=(e[1][0]+e[0][1])/2,a=Math.sqrt(t*t+(s=(e[1][0]-e[0][1])/2)*s),o=Math.sqrt(i*i+r*r),h=Math.atan2(r,i),d=((c=Math.atan2(s,t))-h
5998)/2,p=[[Math.cos(u=(c+h)/2),Math.sin(u)],[-Math.sin(u),Math.cos(u)]],f=[[Math.cos(d),Math.sin(d)],[-Math.sin(d),Math.cos(d)]],p[0][0]*=-1,p[0][1]*=-1,f[0][0]*=-1,f[1][0]*=-1,[p,[[a+o,0],[0,a-o]],f]),y=Dw(m,D_(v)),x=Dw(Dw(v,g),D_(v));return{rotation:Math.atan2(y[1][0],y[0][0]),scale:[x[0][0],x[1][1]],shear:[x[0][1]/x[1][1],x[1][0]/x[0][0]]}}([[i,s],[r,a]]);return{position:[o+(t[0]*i+t[1]*s)-t[0],h+(t[0]*r+t[1]*a)-t[1]],scale:d,rotation:c,shear:u,pivot:t}},DS.compose=function(e,t,i,r,s=[0,0]){let[a,o]=e,[h,c]=r,[d,u,p,f]=function({rotation:e,scale:t,shear:i}){let r=Math.cos(e),s=Math.sin(e),a=Dw([[r,-s],[s,r]],[[t[0],i[0]*t[1]],[i[1]*t[0],t[1]]]);return[a[0][0],a[1][0],a[0][1],a[1][1]]}({rotation:i,scale:t,shear:s});return DS.create(d,u,p,f,a-(h*d+c*p)+h,o-(h*u+c*f)+c)};var DM,DE,DA,DT,DP=Math.PI/180,DD=class{constructor(e,t,i){this.uuid=e,this.data=t,this.localMatrix=DA.identity(),this.worldMatrix=DA.identity(),this.ignoreCameraZoom=!1,this.visible=!0,this._singleBBox=new Dk,this._recursiveBBox=new Dk,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=Sg(),this.dpr=i.dpr??1,this.dataPatched=t}project(e,t){let i=this.worldMatrix;return t&&(i=DA.append(t.worldMatrix,i)),DA.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=DA.compose(this.position,this.scale,this.rotation*DP,xy.getPivot(this.dataPatched),this.shear)}updateWorldMatrix(e,t,i){let r=this.parent;t&&null!=r&&r.updateWorldMatrix(e,!0,!1),e&&this.updateLocalMatrix(),this.parent?this.worldMatrix=DA.append(this.parent.worldMatrix,this.localMatrix):this.worldMatrix=DA.copy(this.localMatrix),this.singleBBoxNeedsUpdate=!0,this.recursiveBBoxNeedsUpdate=!0}get pivot(){return xy.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;void 0!==e.position&&(t=!0,this.position=e.position),void 0!==e.rotation&&(t=!0,this.rotation=e.rotation),void 0!==e.scale&&(t=!0,this.scale=e.scale),void 0!==e.shear&&(t=!0,this.shear=e.shear),t&&(this.updateWorldMatrix(!0,!1,!0),this.resetBBoxNeedsUpdate())}updateByOp(e,t,i){0===e.type&&void 0!==e.props.visible&&(this.visible=e.props.visible),this.data=t,this.data=t;let r=e,s=p9(e.path,["states","*"]);if(null!==s){if(0===e.type){let[t]=s;if(this?.stateSelection===t){let t={...e.props};if(delete t.name,Object.values(e.props).some(e=>void 0===e)){let i=this.data;if(void 0!==i){let r=fn.zoom(i,e.path.slice(2));if(r)for(let i in e.props)void 0===e.props[i]&&i in r&&(t[i]=r[i])}}r={...e,props:t,path:e.path.slice(2)}}}}else if(0===e.type){let t=this.stateSelection?this.data.states.data(this.stateSelection):void 0;if(void 0!==t){if(void 0!==e.props.name&&t.name){let{name:e,...i}=t;t=i}let i=fn.removeOverridden(e.path,e.props,t);r={...e,props:i}}}this.updateByPatchedOpBase(r,xo.patch(this.data,this.stateSelection?this.data.states.data(this.stateSelection):void 0),i)}changeSelectedState(e,t,i=!1){if(!(0===this.data.states.length&&!i)){for(let e of this.data.states)xo.toOps(this.data,e.data).forEac
vendor: 4,150 bytes, line 5998
5998h(e=>{let i=fr.replaceProps(e,this.data);this.dataPatched=this.data,this.updateByPatchedOp(i,this.data,t)});if(null!==e){let i=this.data.states.data(e);i&&(this.dataPatched=xo.patch(this.data,i),xo.toOps(this.data,i).forEach(e=>{this.updateByPatchedOp(e,this.dataPatched,t)}))}i&&this.updateTransformState(this.dataPatched),this.stateSelection=e}}updateState(e,t){void 0!==e.name&&(this.name=e.name),void 0!==e.visible&&(this.visible=e.visible),this.updateTransformState(e)}updateByPatchedOpBase(e,t,i){this.dataPatched=t,this.updateByPatchedOp(e,t,i)}updateByPatchedOp(e,t,i){0===e.path.length&&0===e.type&&this.updateState(e.props,i),this.requestRender()}traverseFrameAncestors(e){this.traverseAncestors(t=>{"frame2d"===t.data.type&&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 DD(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 DD&&(e=e.uuid);let t=this;for(;t.parent;){if(t.parent.uuid===e)return!0;t=t.parent}return!1}},DO=class extends DD{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 DO&&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(!0!==t)for(let i of this.children)i instanceof DO?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 DO&&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 DO&&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 t of this.children)t.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 DO(this.uuid,this.data,e);for(let i of(t.parent=void 0,this.children))t.add(i.clone(e));return t}},DL=class extends DO{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 DL(this.uuid,this.data,e);for(let i of(t.parent=void 0,this.children))t.add(i.clone(e));return t}},DI=[[-1,1],[-1,-1],[1,-1],[1,1]],DR=(e,t,i)=>{let r=e.getCenter(),s=e.getHalfSize(),a=DA.append(t,e.worldMatrix);0===s[0]&&0===s[1]?i.push(DA.apply(r,a)):DI.forEach(e=>{let t=[e[0]*s[0]+r[0],e[1]*s[1]+r[1]];i.push(DA.apply(t,a))})},Dk=class{constructor(){this.matrix=DA.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(),DA.copy(e.worldMatrix,this.matrix);let i=DA.invert(e.worldMatrix);this.expandByObjectSize(e,i,t)}expandByObjectSize(e,t,i=!1){let r=[];!0===i&&e instanceof DO?e.traverse(e=>{e.visible&&DR(e,t,r)}):DR(e,t,r),this.setFromPoints(r)}setFromSize(e,t,i){this.makeEmpty(),DA.copy(i,this.matrix),this.expandBySize(e,t,i)}expandBySize(e,t,i){[DA.apply([0,0],i),DA.apply([0,t],i),DA.apply([e,t],i),DA.apply([e,0],i)].forEach(e=>this.expandByPoint(e))}getCenter(){let[e,t]=this.min,[i,r]=this.getHalfSize();
5998return DA.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){for(let t of(this.makeEmpty(),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,o]=DA.getAbcdef(this.matrix),h=DA.create(r,s,a,o,i[0],i[1]);this.vertices=DI.map(([i,r])=>DA.apply([i*e,r*t],h))}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=DA.append(t.worldMatrix,i)),DA.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,o]=this.max;return t>=r&&t<=a&&i>=s&&i<=o}intersectsBBox2D(e){for(let t=0,i=this.edges.length;t<i;t++){let i=this.edges[t];for(let t=0,r=e.edges.length;t<r;t++)if(function(e,t){let[[i,r],[s,a]]=e,[[o,h],[c,d]]=t,u=(i-s)*(h-d)-(r-a)*(o-c);if(0===u)return!1;let p=((i-o)*(h-d)-(r-h)*(o-c))/u,f=-((i-s)*(r-h)-(r-a)*(i-o))/u;return p>=0&&p<=1&&f>=0&&f<=1}(i,e.edges[t]))return!0}for(let t=0,i=e.vertices.length;t<i;t++){let i=e.vertices[t];if(this.containsPoint(i))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],DA.copy(e.matrix,this.matrix),this.computeVertices(),this.computeEdges()}clone(){let e=new Dk;return e.copy(this),e}},DB=new Promise(e=>{DT=e}),Dz=!1;function DN(e){let t=!1;return e.scene.objects.traverse((e,i)=>{("Mesh"===i.type&&"UIGeometry"===i.geometry.type||"Page"===i.type&&void 0!==i.uiFrame)&&(t=!0)}),t}async function DF(e){let t=await DB;DG||(Dq||(Dq=t({locateFile:()=>e})),DG=await Dq)}var Dj=DA.identity(),DU=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=gl.transparent,this._innerShadowBlur=0,this._innerShadowOffsetX=0,this._innerShadowOffsetY=0,this._innerShadowSpread=0,this._innerShadowColor=gl.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=Dj,this._currentTransform=new Float32Array(Dj)}get dpr(){return this._dpr}set dpr(e){this._dpr=e,this._isSizeDirty=!0}
5998async init(){if(!this.wasmURL)throw Error("Your must set the wasm binary url with renderer.wasmURL = ... before you can call renderer.init");await DF(this.wasmURL),this._surface=DG.MakeWebGLCanvasSurface(this.canvas),this.ctx=this._surface?.getCanvas(),this._paint=new DG.Paint,this._paint.setAntiAlias(!0),this._paintFill=this._paint.copy(),this._paintFill.setStyle(DG.PaintStyle.Fill),this._paintStroke=this._paint.copy(),this._paintStroke.setStyle(DG.PaintStyle.Stroke),this.ctx?.scale(this.dpr,this.dpr)}get currentTransform(){return this._currentM3Transform}get currentTransformBuffer(){return this._currentTransform}set currentTransform(e){this._currentM3Transform=e,this._currentTransform.set(e)}async loadFont(e,t){let i=await (await fetch(e)).arrayBuffer();this.registerFont(i,t)}registerFont(e,t){if(this._fonts.has(t))return;let i=DG.FontMgr.FromData(e);if(i)this._fonts.set(t,i);else throw Error("Invalid font data for "+t)}get width(){return this._width}get height(){return this._height}set strokeColor(e){this._paintStroke&&this._paintStroke.setColor(DW(e),DG.ColorSpace.DISPLAY_P3)}set fillColor(e){this._paintFill&&this._paintFill.setColor(DW(e),DG.ColorSpace.DISPLAY_P3)}set lineWidth(e){this._paintStroke&&this._paintStroke.setStrokeWidth("center"===this._strokeMode?e:2*e)}set strokeMode(e){this._strokeMode=e}set dropShadowBlur(e){this._dropShadowBlur=e}set dropShadowColor(e){this._dropShadowColor=e}set dropShadowOffsetX(e){this._dropShadowOffsetX=e}set dropShadowOffsetY(e){this._dropShadowOffsetY=e}set innerShadowBlur(e){this._innerShadowBlur=e}set innerShadowColor(e){this._innerShadowColor=e}set innerShadowOffsetX(e){this._innerShadowOffsetX=e}set innerShadowOffsetY(e){this._innerShadowOffsetY=e}set innerShadowSpread(e){this._innerShadowSpread=e}set layerBlur(e){this._layerBlur=e}set backgroundBlur(e){this._backgroundBlur=e}clear(){this.ctx?.clear(DG.TRANSPARENT)}save(){this.ctx?.save()}restore(){this.ctx?.restore()}beginPath(){this._currentPath?.delete(),this._currentPath=new DG.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,o=0,h=0){let c=DG.XYWHRect(e,t,i,r);if(0===s&&0===a&&0===h&&0===o)this.ctx?.clipRect(c,DG.ClipOp.Intersect,!0);else{let e=DG.RRectXY(c,s,s);e[4]=e[5]=s,e[6]=e[7]=a,e[8]=e[9]=o,e[10]=e[11]=h,this.ctx?.clipRRect(e,DG.ClipOp.Intersect,!0)}}_applyShadowOffsetMatrix(){if(this.ctx){let e=DA.invert(this.currentTransform);this.ctx.concat(e);let t=DA.translate(DA.identity(),this._dropShadowOffsetX,this._dropShadowOffsetY);this.ctx.concat(t),this.ctx.concat(this._currentTransform)}}_applyEffectsToPaint(e,t,i=!0){if(this.ctx&&this._currentPath){let r,s=!1;if(i&&this._hasDropShadow()){let i,r=e.copy();r.setColor(DW(this._dropShadowColor)),this._dropShadowBlur>0&&(i=DG.MaskFilter.MakeBlur(DG.BlurStyle.Normal,this._dropShadowBlur*this.dpr*(this.camera?.scale??1),!1),r.setMaskFilter(i)),this.ctx.save(),this.ctx.clipPath(this._currentPath,DG.ClipOp.Difference,!0),this._applyShadowOffsetMatrix(),t(r),this.ctx.restore(),r.delete(),i?.delete()}if(this._backgroundBlur>0&&i){this.ctx.save(),this.ctx.clipPath(this._currentPath,DG.ClipOp.Intersect,!0);let t=DG.ImageFilter.MakeBlur(this._backgroundBlur,this._backgroundBlur,DG.TileMode.Clamp,null),i=e.copy();i.setImageFilter(t),i.setAlphaf(1);let r=this._currentPath.computeTightBounds();this.ctx.saveLayer(i,r,null,DG.SaveLayerInitWithPrevious),this.ctx.drawColor(e.getColor()),this.ctx.restore(),this.ctx.restore(),i.delete(),t.delete(),s=!0}if(this._layerBlur>0){let i=e.copy();r=DG.MaskFilter.MakeBlur(DG.BlurStyle.Normal,this._layerBlur*this.dpr*(this.camera?.scale??1),!1),i.setMaskFilter(r),t(i),i.delete(),r.delete(),s=!0}if(s||t(e),i&&this._hasInnerShadow()){let e,t=new DG.Paint;t.setAntiAlias(!0),t.setStyle(DG.PaintStyle.Fill),t.setColor(DW(this._innerShadowColor)),this._innerShadowBlur>0&&(e=DG.MaskFilter.MakeBlur(DG.BlurStyle.Normal,this._innerShadowBlur*this.dpr*(this.camera?.scale??1),!1),t.setMaskFilter(e));let i=this._currentPath.computeTightBounds(),[r,s,a,o]=i;this.ctx.save(),this.ctx.clipPath(this._currentPath,DG.ClipOp.Intersect,!0),this.ctx.saveLayer(t,i,null,DG.SaveLayerInitWithPrevious),this.ctx?.translate(this._innerShadowOffsetX,this._innerShadowOffsetY),this.ctx.drawRect(DG.XYWHRect(-1e3-this._innerShadowOffsetX,-1e3-this._innerShadowOffsetY,2e3+(a-r)+Math.abs(2*this._innerShadowOffsetX),2e3+(o-s)+Math.abs(2*this._innerShadowOffsetY)),t),t.setBlendMode(DG.BlendMode.Clear),this.ctx.drawPath(this._currentPath,t),this.ctx.restore(
5998),this.ctx.restore(),t.delete(),e?.delete()}}}_paintInner(e,t=!0){if(this.ctx&&this._currentPath&&e){let i=this.ctx,r=this._currentPath;this._applyEffectsToPaint(e,e=>{let s=!1;t||"center"===this._strokeMode||(i.save(),i.clipPath(r,"outside"===this._strokeMode?DG.ClipOp.Difference:DG.ClipOp.Intersect,!0),s=!0),i.drawPath(r,e),s&&i.restore()},t)}}_hasDropShadow(){return this._dropShadowColor?.a>0}_hasInnerShadow(){return this._innerShadowColor?.a>0}path(e){this._currentPath?.addPath(DG.Path.MakeFromSVGString(e))}ellipse(e,t,i,r,s,a,o,h){if(!DV([e,t,i,r])||!this._currentPath)return;if(i<0||r<0)throw Error("radii cannot be negative");let c=DG.XYWHRect(e-i,t-r,2*i,2*r);this._currentPath?.addOval(c)}rect(e,t,i,r,s=0,a=0,o=0,h=0){let c=DG.XYWHRect(e,t,i,r);if(DV(c))if(0===s&&0===a&&0===h&&0===o)this._currentPath?.addRect(c);else{let e=DG.RRectXY(c,s,s);e[4]=e[5]=s,e[6]=e[7]=a,e[8]=e[9]=o,e[10]=e[11]=h,this._currentPath?.addRRect(e)}}getHorizontalAlign(e){switch(e){case 2:return DG.TextAlign.Right;case 3:return DG.TextAlign.Center;case 4:return DG.TextAlign.Justify;default:return DG.TextAlign.Left}}drawTextInner(e,t,i,[r,s,a,o],h,c,d=!0){let u=0,{ctx:p}=this;if(!p)return u;let f=c.copy(),m=c.copy();return m.setAlphaf(0),this._applyEffectsToPaint(f,c=>{t.pushPaintStyle(i,c,m),t.addText(e);let d=t.build();d.layout(a);let f=s;2===h?f+=(o-d.getHeight())/2:3===h&&(f+=o-d.getHeight()),p.drawParagraph(d,r,f),u=d.getHeight(),t.reset(),d.delete()},d),f.delete(),m.delete(),u}drawText(e,t){let i=0,r=this._fonts.get(t.font),{ctx:s,_paintFill:a,_paintStroke:o}=this;if(r&&s){let s=new DG.TextStyle({fontFamilies:[t.font],fontSize:t.fontSize,heightMultiplier:t.lineHeight,letterSpacing:t.letterSpacing}),h=new DG.ParagraphStyle({textStyle:s,textAlign:this.getHorizontalAlign(t.horizontalAlign)}),c=DG.XYWHRect(t.x,t.y,t.width,t.height),d=DG.ParagraphBuilder.Make(h,r);a&&(i=this.drawTextInner(e,d,s,c,t.verticalAlign,a,!0)),o&&(i=this.drawTextInner(e,d,s,c,t.verticalAlign,o,!1)),d.delete()}return{height:i}}render(){this._surface?.flush()}moveTo(e,t){this._currentPath?.moveTo(e,t)}lineTo(e,t){this._currentPath?.lineTo(e,t)}bezierCurveTo(e,t,i,r,s,a){this._currentPath?.cubicTo(e,t,i,r,s,a)}quadraticCurveTo(e,t,i,r){this._currentPath?.quadTo(e,t,i,r)}setTransform(e,t=!1){if(!this.ctx)return;let i=this.ctx.getTotalMatrix(),r=DA.invert(i);if(r&&this.ctx.concat(r),this.ctx?.scale(this.dpr,this.dpr),this.camera?.enabled&&(this.ctx?.concat(this.camera.worldMatrix),t)){let e=DA.getScale(this.camera.worldMatrix);this.ctx?.scale(1/e[0],1/e[1])}this.ctx?.concat(e),this.currentTransform=e}transform(e){this.ctx?.concat(e)}setSize(e,t){!this._isSizeDirty&&e===this._width&&t===this._height||(this._isSizeDirty=!1,this._width=e,this._height=t,this.canvas.style.width=e+"px",this.canvas.style.height=t+"px",this.canvas.width=e*this.dpr,this.canvas.height=t*this.dpr,this._surface&&(this._surface=DG.MakeWebGLCanvasSurface(this.canvas),this.ctx=this._surface?.getCanvas()))}};function DV(e){for(let t=0;t<e.length;t++)if(void 0!==e[t]&&!Number.isFinite(e[t]))return!1;return!0}function DW({r:e,g:t,b:i,a:r}){return DG.Color4f(e,t,i,r)}var DH,DG,Dq,DX,DY=class{constructor(e,t,i){this.uuid=e,this.data=t,this.enabled=!1,this.color=gl.transparent,this.blurRadius=0,this.offset=[0,0],this.spread=0,this.update(t)}update(e){void 0!==e.color&&(this.color=e.color),void 0!==e.enabled&&(this.enabled=e.enabled),void 0!==e.blurRadius&&(this.blurRadius=e.blurRadius),void 0!==e.offset&&(this.offset=e.offset),void 0!==e.spread&&(this.spread=e.spread)}},DQ=class{constructor(e,t,i){this.uuid=e,this.data=t,this.enabled=!1,this.radius=0,this.update(t)}update(e){void 0!==e.enabled&&(this.enabled=e.enabled),void 0!==e.radius&&(this.radius=e.radius)}},DZ=class{constructor(e,t,i){this.uuid=e,this.data=t,this.enabled=!1,this.color=gl.transparent,this.update(t)}update(e){void 0!==e.enabled&&(this.enabled=e.enabled),void 0!==e.color&&(this.color=e.color)}},DK=class{constructor(e,t,i){this.uuid=e,this.data=t,this.enabled=!1,this.color=gl.transparent,this.thickness=0,this.mode="inside",this.update(t)}update(e){void 0!==e.enabled&&(this.enabled=e.enabled),void 0!==e.color&&(this.color=e.color),void 0!==e.thickness&&(this.thickness=e.thickness),void 0!==e.mode&&(this.mode=e.mode)}}
vendor: 6,968 bytes, line 5998
5998,DJ=class extends DD{constructor(e,t,i){super(e,t,i),this.uuid=e,this.data=t,this.autoClose=!0,this.fill=new DZ(e+"-fill",t.fill,i),this.stroke=new DK(e+"-stroke",t.stroke,i),this.dropShadow=new DY(e+"-dropShadow",t.dropShadow,i),this.innerShadow=new DY(e+"-innerShadow",t.innerShadow,i),this.backgroundBlur=new DQ(e+"-backgroundBlur",t.backgroundBlur,i),this.layerBlur=new DQ(e+"-layerBlur",t.layerBlur,i)}applyFillStroke(e){e.fillColor=this.fill.enabled?this.fill.color:gl.transparent,e.strokeColor=this.stroke.enabled&&this.stroke.thickness>0?this.stroke.color:gl.transparent,e.strokeMode=this.stroke.mode,e.lineWidth=this.stroke.thickness}applyFilters(e){this.layerBlur.enabled?e.layerBlur=5*this.layerBlur.radius:e.layerBlur=0,this.backgroundBlur.enabled?e.backgroundBlur=5*this.backgroundBlur.radius:e.backgroundBlur=0,this.dropShadow.enabled?(e.dropShadowBlur=5*this.dropShadow.blurRadius,e.dropShadowColor=this.dropShadow.color,e.dropShadowOffsetX=this.dropShadow.offset[0],e.dropShadowOffsetY=this.dropShadow.offset[1]):e.dropShadowColor=gl.transparent,this.innerShadow.enabled?(e.innerShadowSpread=this.innerShadow.spread,e.innerShadowBlur=5*this.innerShadow.blurRadius,e.innerShadowColor=this.innerShadow.color,e.innerShadowOffsetX=this.innerShadow.offset[0],e.innerShadowOffsetY=this.innerShadow.offset[1]):e.innerShadowColor=gl.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())}updateByPatchedOp(e,t,i){super.updateByPatchedOp(e,t,i),0===e.type&&(p9(e.path,["fill"])?this.fill.update(e.props):p9(e.path,["stroke"])?this.stroke.update(e.props):p9(e.path,["dropShadow"])?this.dropShadow.update(e.props):p9(e.path,["innerShadow"])?this.innerShadow.update(e.props):p9(e.path,["layerBlur"])?this.layerBlur.update(e.props):p9(e.path,["backgroundBlur"])?this.backgroundBlur.update(e.props):this.resetBBoxNeedsUpdate())}updateState(e,t){super.updateState(e,t),void 0!==e.fill&&this.fill.update(e.fill),void 0!==e.stroke&&this.stroke.update(e.stroke),void 0!==e.dropShadow&&this.dropShadow.update(e.dropShadow),void 0!==e.innerShadow&&this.innerShadow.update(e.innerShadow),void 0!==e.layerBlur&&this.layerBlur.update(e.layerBlur),void 0!==e.backgroundBlur&&this.backgroundBlur.update(e.backgroundBlur)}clone(e){let t=new DJ(this.uuid,this.data,e);return t.parent=void 0,t}},D$=class extends DJ{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(.5*this.width,.5*this.height,.5*this.width,.5*this.height,0,0,2*Math.PI)}intersectsInLocalSpace(e,t){var i,r,s,a;let o,h;return i=.5*this.width,r=.5*this.height,s=.5*this.width,a=.5*this.height,(o=e-i)*o/(s*s)+(h=t-r)*h/(a*a)<=1}getCenter(){return[.5*this.width,.5*this.height]}getHalfSize(){return[.5*this.width,.5*this.height]}updateSizeState(e){let t=!1;void 0!==e.width&&(this.width="number"==typeof e.width?e.width:this.width,t=!0),void 0!==e.height&&(this.height="number"==typeof e.height?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 D$(this.uuid,this.data,e);return t.parent=void 0,t}},D0=class extends DJ{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[.5*this.width,.5*this.height]}getHalfSize(){return[.5*this.width,.5*this.height]}updateCornerState(e){void 0!==e.cornerRadius&&(this.cornerRadius=e.cornerRadius)}updateSizeState(e){let t=!1;void 0!==e.width&&(this.width="number"==typeof e.width?e.width:this.width,t=!0),void 0!==e.height&&(this.height="number"==typeof e.height?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 D0(this.uuid,this.data,e);return t.parent=void 0,t}},D1=class extends DJ{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:gl.transparent,e.strokeColor=this.stroke.enabled&&this.stroke.thickness>0?this.stroke.color:gl.transparent,e.strokeMode="center",e.lineWidth=this.stroke.thickness}innerDraw(e){this._fontHolder?.arrayBuffer&&this._fontHolder.arrayBuffer.byteLength>1&&this.data.font&&e.registerFont(this._fontHolder.arrayBuffer,this.data.font);let t=this.data.textTransform,i=this.data.text.textValue.toString(),r=2===t?i.toUpperCase():3===t?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[.5*this.width,.5*this.height]}getHalfSize(){return[.5*this.width,.5*this.height]}updateSizeState(e){let t=!1;void 0!==e.width&&(this.width="number"==typeof e.width?e.width:this.width,t=!0),void 0!==e.height&&(this.height="number"==typeof e.height?e.height:this.height,t=!0),t&&this.updateWorldMatrix(!0,!1,!0)}updateFontState(e,{shared:t}){void 0!==e.font&&(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 D1(this.uuid,this.data,e);return t.parent=void 0,t}},D2=class extends DJ{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(){0===this.curves.length&&this.computeCurves();let e=this.curves.map(e=>DX.extremas(e)),t=[1/0,1/0],i=[-1/0,-1/0];for(let r=0,s=e.length;r<s;r++){let s=e[r];s[0][0]<t[0]&&(t[0]=s[0][0]),s[0][1]<t[1]&&(t[1]=s[0][1]),s[1][0]>i[0]&&(i[0]=s[1][0]),s[1][1]>i[1]&&(i[1]=s[1][1])}return this.extremasBBox.min=[t[0],t[1]],this.extremasBBox.max=[i[0],i[1]],this.extremasBBox}computeCurves(){this.curves=[];for(let e=1,t=this.data.points.length;e<t;e++){let t=this.data.points[e].data,i=this.data.points[e-1].data,r={start:i.position,cp1:i.controlNext.position,cp2:t.controlPrevious.position,end:t.position};this.curves.push(r)}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;
vendor: 6,905 bytes, line 5998
5998return[(t[0]-e[0])*.5,(t[1]-e[1])*.5]}innerDraw(e){for(let t=0,i=this.data.points.length;t<i;t++){let i=this.data.points[t].data;if(0===t){let[t,r]=i.position;e.moveTo(t,r)}else{let r=this.data.points[t-1].data,[s,a]=r.controlNext.position,[o,h]=i.controlPrevious.position,[c,d]=i.position,u={start:r.position,cp1:r.controlNext.position,cp2:i.controlPrevious.position,end:i.position};DX.derive(u),e.bezierCurveTo(s,a,o,h,c,d)}}let t=this.data.points[0].data,i=this.data.points[this.data.points.length-1].data;if(this.data.isClosed){let[r,s]=i.controlNext.position,[a,o]=t.controlPrevious.position,[h,c]=t.position;e.bezierCurveTo(r,s,a,o,h,c)}}updateState(e,t){super.updateState(e,t),this.computeExtremas()}clone(e){let t=new D2(this.uuid,this.data,e);return t.parent=void 0,t}},D3=DX||(DX={});function D4(e,t,i,r=!1){let s=e-2*t+i;if(0!==s){let r=-Math.sqrt(Math.abs(t*t-e*i)),a=-e+t;return[-(r+a)/s,-(-r+a)/s]}return t!==i&&0===s?[(2*t-i)/(2*(t-i))]:[]}D3.derive=function(e){let t=e.start,i=e.cp1,r=e.cp2,s=e.end,a={start:[3*(i[0]-t[0]),3*(i[1]-t[1])],cp:[3*(r[0]-i[0]),3*(r[1]-i[1])],end:[3*(s[0]-r[0]),3*(s[1]-r[1])]};return e.derivative=a,a.derivative=Lu.derive(a),a},D3.droot=function(e){let t=e.derivative??D3.derive(e),i=t.start,r=t.cp,s=t.end;return[D4(i[0],r[0],s[0]),D4(i[1],r[1],s[1])]},D3.extremas=function(e){let[t,i]=D3.droot(e),r=[e.start[0],e.end[0]],s=[e.start[1],e.end[1]];for(let i of t)r.push(D3.compute(e,Math.min(1,Math.max(0,i)))[0]);for(let t of i)s.push(D3.compute(e,Math.min(1,Math.max(0,t)))[1]);return r.sort((e,t)=>e-t),s.sort((e,t)=>e-t),[[r[0],s[0]],[r[r.length-1],s[s.length-1]]]},D3.compute=function(e,t){if(0===t)return[...e.start];if(1===t)return[...e.end];let i=1-t,r=i*i,s=t*t,a=r*i,o=r*t*3,h=i*s*3,c=t*s;return[a*e.start[0]+o*e.cp1[0]+h*e.cp2[0]+c*e.end[0],a*e.start[1]+o*e.cp1[1]+h*e.cp2[1]+c*e.end[1]]},(Lc=Lu||(Lu={})).derive=function(e){let t=e.start,i=e.cp,r=e.end,s={start:[2*(i[0]-t[0]),2*(i[1]-t[1])],end:[2*(r[0]-i[0]),2*(r[1]-i[1])]};return s.derivative=Lp.derive(s),e.derivative=s,s},Lc.droot=function(e){let t=e.derivative??Lc.derive(e),i=t.start,r=t.end;return[i[0]!==r[0]?i[0]/(i[0]-r[0]):0,i[1]!==r[1]?i[1]/(i[1]-r[1]):0]},Lc.compute=function(e,t){if(0===t)return[...e.start];if(1===t)return[...e.end];let i=1-t,r=i*i,s=i*t*2,a=t*t;return[r*e.start[0]+s*e.cp[0]+a*e.end[0],r*e.start[1]+s*e.cp[1]+a*e.end[1]]},(Ld=Lp||(Lp={})).derive=function(e){let t=e.start,i=e.end;return e.derivative=[i[0]-t[0],i[1]-t[1]],e.derivative},Ld.compute=function(e,t){if(0===t)return[...e.start];if(1===t)return[...e.end];let i=e.start,r=e.end;return[i[0]+(r[0]-i[0])*t,i[1]+(r[1]-i[1])*t]};var D5=class extends DO{constructor(e,t,i){super(e,t,i),this.uuid=e,this.width=0,this.height=0,this.clipped=!0,this.background=new D0(e+"-background",xu.defaultData,i),this.background.parent=this,this.updateState(t,i)}get fill(){return this.background.fill}get stroke(){return this.background.stroke}get backgroundBlur(){return this.background.backgroundBlur}get layerBlur(){return this.background.layerBlur}get dropShadow(){return this.background.dropShadow}get innerShadow(){return this.background.innerShadow}get cornerRadius(){return this.background.cornerRadius}set cornerRadius(e){this.background.cornerRadius=e}updateLocalMatrix(){super.updateLocalMatrix(),this.background?.updateLocalMatrix()}updateWorldMatrix(e,t,i){super.updateWorldMatrix(e,t,i),this.background?.updateWorldMatrix(e,t,i)}draw(e){if(!this.visible)return;e.save();let t=this.width,i=this.height;this.applyTransforms(e),this.background.width=t,this.background.height=i,this.background.draw(e),this.clipped&&e.clipRect(0,0,t,i,...this.cornerRadius),this.innerDrawChildren(e),e.restore()}getCenter(){return[.5*this.width,.5*this.height]}getHalfSize(){return[.5*this.width,.5*this.height]}updateCornerState(e){void 0!==e.cornerRadius&&(this.cornerRadius=e.cornerRadius)}updateSizeState(e){let t=!1;void 0!==e.width&&(this.width="number"==typeof e.width?e.width:this.width,t=!0),void 0!==e.height&&(this.height="number"==typeof e.height?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),void 0!==e.fill&&this.fill.update(e.fill),void 0!==e.stroke&&this.stroke.update(e.stroke),void 0!==e.dropShadow&&this.dropShadow.update(e.dropShadow),void 0!==e.innerShadow&&this.innerShadow.update(e.innerShadow),void 0!==e.layerBlur&&this.layerBlur.update(e.layerBlur),void 0!==e.backgroundBlur&&this.backgroundBlur.update(e.backgroundBlur),void 0!==e.clipped&&(this.clipped=e.clipped)}requestRender(){super.requestRender(),this.dispatchEvent({type:"render"})}dispose(){this.removeEventListener("render")}updateByPatchedOp(e,t,i){super.updateByPatchedOp(e,t,i),0===e.type&&(p9(e.path,["fill"])?this.fill.update(e.props):p9(e.path,["stroke"])?this.stroke.update(e.props):p9(e.path,["dropShadow"])?this.dropShadow.update(e.props):p9(e.path,["innerShadow"])?this.innerShadow.update(e.props):p9(e.path,["layerBlur"])?this.layerBlur.update(e.props):p9(e.path,["backgroundBlur"])?this.backgroundBlur.update(e.props):this.resetBBoxNeedsUpdate())}clone(e){let t=new D5(this.uuid,this.data,e);for(let i of(t.parent=void 0,this.children))t.add(i.clone(e));return t}},D6=tS(tD(),1),D8=class extends DJ{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(){var e;let t=this.path;e=this.path,/NaN/.test(e)&&(console.warn("Invalid SVG path",this.uuid),t="");let i=document.createElementNS("http://www.w3.org/2000/svg","svg"),r=document.createElementNS("http://www.w3.org/2000/svg","path");document.body.appendChild(i),r.setAttribute("d",t),i.appendChild(r),this._pathBBox=r.getBBox(),i.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),void 0!==e.path&&(this.path=e.path,this.computeSVGBBox())}clone(e){let t=new D8(this.uuid,this.data,e);return t.parent=void 0,t}};function D9(e){let t=["rx","ry","xAxisRotation","largeArc","sweep","x1","y1","x2","y2","x","y"],i;return e.map(e=>{let r=[];t.forEach(t=>{if(t in e){let i=+e[t];r.length&&i>=0&&r.push(","),r.push(i)}});let s=(i===e.code?r[0]<0?"":",":e.code)+r.join("");return i=e.code,s}).join("")}var D7=class{constructor(e,t,i){this.uuid=e,this.data=t,this.group=new DL(D7.GROUP_ID,{...xg.defaultData},i),this.createChildrenObjects(t.objects,this.group,i)}createObject(e,t,i,r,s,a){let o=function(e,t,i){switch(t.type){case"ellipse2d":return new D$(e,t,i);
vendor: 4,590 bytes, lines 5998-6009
5998case"rectangle2d":return new D0(e,t,i);case"text2d":return new D1(e,t,i);case"vector2d":return new D2(e,t,i);case"path2d":return new D8(e,t,i);case"frame2d":return new D5(e,t,i);default:return new DL(e,t,i)}}(e,t,a);o&&(r.add(o),r.children.splice(s,0,r.children.pop()),o.updateWorldMatrix(),i.length>0&&(o instanceof DL||o instanceof D5)&&this.createChildrenObjects(i,o,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(e){console.error(e)}}updateTreeByOp(e,t){if(0===e.path.length&&7===e.type){let i=null===e.parent?this.group:this.find(e.parent);void 0!==i&&i instanceof DO&&(this.createObject(e.id,e.data,e.children,i,e.localIndex,t),i.requestRender())}else if(0===e.path.length&&8===e.type){let t=this.find(e.id);if(void 0!==t&&void 0!==t.parent&&t.parent instanceof DO){let e=t.parent;t.resetBBoxNeedsUpdate(),e?.remove(t),e?.requestRender()}}else if(0===e.path.length&&9===e.type){let t=this.find(e.id);if(void 0!==t){let i=t.parent,r=null===e.parent?this:this.find(e.parent);if(r instanceof DO||r===this){r.add(t);let s=e.localIndex;r.children.splice(s,0,r.children.pop()),t.updateWorldMatrix(!0,!1,!0),i?.requestRender(),t.requestRender()}t.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(void 0===t)return;let i=[],r=t;for(;r!==this.group;){let e=r,t=(r=r.parent).children.indexOf(e);i.splice(0,0,t)}return{entity:t,sortKey:i}}getAllSorted(e){let t=[];for(let i of e){let e=this.getWithSortKey(i.id);void 0!==e&&t.push(e)}return t.sort((e,t)=>u7(e.sortKey,t.sortKey)),t.map(e=>e.entity)}};function Oe({constraints:e,newParentWidth:t,newParentHeight:i,initialParentWidth:r,initialParentHeight:s,objectInitialWidth:a,objectInitialHeight:o,objectInitialPosition:h}){let{horizontalConstraint:c,verticalConstraint:d}=e,u=t-r,p=i-s,f=a,m=o,g=h[0],v=h[1];if(0!==c){if(1===c)g+=u;else if(3===c)g+=u/2;else if(2===c)f=Math.max(1,f+u);else if(4===c){let e=t/r;f*=e,g*=e}}if(0!==d){if(1===d)v+=p;else if(3===d)v+=p/2;else if(2===d)m=Math.max(1,m+p);else if(4===d){let e=i/s;m*=e,v*=e}}return{width:f,height:m,position:[g,v]}}D7.GROUP_ID="scene2d",tS(tD(),1);var Ot=`
5999	varying vec2 vUv;
6000	void main() {
6001		vUv = uv;
6002		gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
6003	}`,Oi=`
6004	uniform sampler2D tDiffuse;
6005	varying vec2 vUv;
6006	void main() {
6007		vec4 texel = texture2D( tDiffuse, vUv );
6008		gl_FragColor = texel;
6009	}`,Or=new sw(-1,1,1,-1,0,1),Os=new class extends rz{constructor(){super(),this.setAttribute("position",new rP([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new rP([0,2,0,0,2,0],2))}},Oa=class{constructor(e){this._mesh=new rK(Os,e)}dispose(){this._mesh.geometry.dispose()}render(e){e.render(this._mesh,Or)}get material(){return this._mesh.material}set material(e){this._mesh.material=e}},On=new r5({defines:{},uniforms:{tDiffuse:new lD(null)},vertexShader:Ot,fragmentShader:Oi}),Oo=new Oa(On),Ol=null,Oh=null,Oc=DA.identity(),Od=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 e=this.width,t=this.height,i=this.dpr;this.renderer.dpr=this.isScreenSpace?i:Math.floor(2048/Math.max(e,t)),this.renderer.setSize(e,t)},this.onFrameOverrideObjectEvent=e=>{if(e.target?.uuid!==void 0){let t=this.frameRoot?.find(e.target.uuid);t&&t.dispatchEvent({...e,target:t})}},this.scene2d=new D7(tQ.generateUUID(),xx.defaultData,{dpr:window.devicePixelRatio,shared:r.shared}),this.canvas=(null===Ol&&(Ol=document.createElement("canvas")),Ol),this.renderer=(e=>(null===Oh&&(Oh=new DU(e)),Oh))(this.canvas),this.promise=this.init(),this.renderTarget=new iu(1,1,{type:1016,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 nX(this.canvas)),this._canvasTexture}
6009async init(){this.renderer instanceof DU&&(this.renderer.wasmURL=MP.skiaWasmUrl),await this.renderer.init()}render(e){if(this.isFrameDirty){this.isFrameDirty=!1,this._innerApplySize(),this.renderer.clear(),this.frameOverride?.draw(this.renderer),this.renderer.render(),On.uniforms.tDiffuse.value=this.canvasTexture,this.canvasTexture.needsUpdate=!0;let t=e.getRenderTarget();e.setRenderTarget(this.renderTarget),e.clear(),Oo.render(e),e.setRenderTarget(t),this.textureHolder?.setNeedsUpdate(!0)}}updateEntity2DByOp(e,t,i,r){this.scene2d.updateEntityByOp(e,t,i,r),this.applySize()}updateTreeByOp(e,t){this.scene2d.updateTreeByOp(e,t),this.applySize()}applyOverrides(e){if(this.frameOverride&&this.frameRoot){this.frameOverride.position=[0,0],this.frameOverride.rotation=0;let t=e?.width??this.width,i=e?.height??this.height;this.frameOverride.width=t,this.frameOverride.height=i,this.frameOverride.localMatrix=Oc,this.isScreenSpace&&(this.frameOverride.fill.color=gl.from0to1([0,0,0,0])),this.frameOverride.data={...this.frameOverride.data,width:t,height:i},function e({objectOverride:t,objectRoot:i,newParentWidth:r,newParentHeight:s,initialParentWidth:a,initialParentHeight:o}){if(t instanceof D5&&i instanceof D5||t instanceof DL&&i instanceof DL)for(let h=0,c=t.children.length;h<c;h++){let c=t.children[h],d=i.children[h];c&&d&&c.uuid===d.uuid&&function({objectOverride:t,objectRoot:i,newParentWidth:r,newParentHeight:s,initialParentWidth:a,initialParentHeight:o}){let[h,c]=function(e){if(Ou(e))return[e.width,e.height];if(e instanceof D8){let[t,i]=e.getHalfSize();return[2*t,2*i]}if(e instanceof DL){let[t,i]=e.recursiveBBox.getHalfSize();return[2*t,2*i]}return[0,0]}(i),{width:d,height:u,position:p}=Oe({constraints:t.data,newParentWidth:r,newParentHeight:s,initialParentWidth:a,initialParentHeight:o,objectInitialWidth:h,objectInitialHeight:c,objectInitialPosition:i.position});if(t.position=p,t.data={...t.data,position:p},t.states)for(let e in t.states)!function({stateId:e,objectOverride:t,objectRoot:i,newParentWidth:r,newParentHeight:s,initialParentWidth:a,initialParentHeight:o}){let h=t.states?.[e],c=i.states?.[e];if(h&&c){let{width:i,height:d,position:u}=Oe({constraints:t.data,newParentWidth:r,newParentHeight:s,initialParentWidth:a,initialParentHeight:o,objectInitialWidth:xy.isResizeable(c)?c.width:0,objectInitialHeight:xy.isResizeable(c)?c.height:0,objectInitialPosition:c.position});Object.assign(t.states[e],{position:u}),xy.isResizeable(h)&&Object.assign(t.states[e],{width:i,height:d})}}({stateId:e,objectOverride:t,objectRoot:i,newParentWidth:r,newParentHeight:s,initialParentWidth:a,initialParentHeight:o});if(Ou(t)||t instanceof DL)Ou(t)&&(t.width=d,t.height=u,t.data={...t.data,width:d,height:u}),e({objectOverride:t,objectRoot:i,newParentWidth:d,newParentHeight:u,initialParentWidth:h,initialParentHeight:c});else if(t instanceof D8){let e=0!==h?d/h:1,r=0!==c?u/c:1;t.path=function(e,t=1,i=1){if(t<=0||i<=0)return e;if(/NaN/.test(e))return console.warn("Cannot scale invalid path",e),D9([]);try{let r=(0,D6.parseSVG)(e).map(e=>{let r={...e};return"x"in r&&(r.x=r.x*t),"y"in r&&(r.y=r.y*i),"x1"in r&&(r.x1=r.x1*t),"x2"in r&&(r.x2=r.x2*t),"y1"in r&&(r.y1=r.y1*i),"y2"in r&&(r.y2=r.y2*i),"rx"in r&&(r.rx=r.rx*t),"ry"in r&&(r.ry=r.ry*i),r});return D9(r)}catch(e){return console.warn("Error parsing SVG path",e),D9([])}}(i.path,e,r),t.data={...t.data,path:t.path}}}({objectOverride:c,objectRoot:d,newParentWidth:r,newParentHeight:s,initialParentWidth:a,initialParentHeight:o})}}({objectOverride:this.frameOverride,objectRoot:this.frameRoot,newParentWidth:this.frameOverride.width,newParentHeight:this.frameOverride.height,initialParentWidth:this.frameRoot.width,initialParentHeight:this.frameRoot.height}),this.frameOverride.updateWorldMatrix(!0,!1,!0)}}applySize(e,t=window.devicePixelRatio){let i=Math.max(1,e?.width??this.width),r=Math.max(1,e?.height??this.height);this.dpr=t,this.width=i,this.height=r,this._innerApplySize();let s=1;(i*t<512||r*t<512)&&(s=Math.max(512/(i*t),512/(r*t))),this.renderTarget.setSize(i*t*s,r*t*s),this._canvasTexture?.dispose(),this._canvasTexture=void 0,this.applyOverrides(e),this.frameOverride?.requestRender()}applyFrame(e){let t=this.context.scene.find2D(e);if(!(!t||!(t instanceof D5)))return this.disposeFrameOverride(),this.frameRoot=t,this.frameOverride=t.clone({dpr:this.renderer.dpr,shared:this.context.shared}),this.scene2d.add(this.frameOverride),this.applySize(),this.frame?.addEventListener("render",this.onRenderRequestedDownstream),this.frameOverride.traverse(e=>{e.addEventListener("beginState",this.onFrameOverrideObjectEvent)}),this.frameOverride.traverse(e=>{e.addEventListener("completeState",this.onFrameOverrideObjectEvent)}),this.frame?.requestRender(),t}get frame(){return this.frameOverride}get frameId(){return this.frame?.uuid}find(e){return this.scene2d.find(e)}get texture(){return this.textureHolder?.getTexture(1001)}disposeFrameOverride(){this.frameOverride?.removeEventListener("render",this.onRenderRequestedDownstream),this.frameOverride?.traverse(e=>{e.removeEventListener("beginStateChange",this.onFrameOverrideObjectEvent)}),this.frameOverride?.traverse(e=>{e.removeEventListener("completeState",this.onFrameOverrideObjectEvent)}),this.frameOverride&&this.scene2d.remove(this.frameOverride)}};function Ou(e){return e instanceof D0||e instanceof D5||e instanceof D$||e instanceof D1}var Op=class extends w_(nb){constructor(e,t,i){super(),this.data=t,this.bgColor=new xA(1,1,1,1),this.fog=null,this.backupFog=new nx(0xffffff,.1,2e3),this.fogUseBGColor=!1,this.isActive=!1,this.aoColor=new ir,this.penumbraSizeArrayCache=null,this.super_Entity(e,t),this.personalCamera=new Ts(mE,{...yF.defaultData,...t.camera,name:"Personal Camera"}),this.personalCamera.objectHelper.visible=!1,this.add(this.personalCamera),this.activeCamera=this.personalCamera,this.ambientLight=new le(0xd3d3d3,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 D7((Array.isArray(e)?e[0]:e)+"-ui",t.uiScene,{dpr:window.devicePixelRatio,shared:i.shared}):t.uiFrame&&this.createUICanvas(t.uiFrame,i)}get scene(){return this.parent}get postprocessing(){return this.data.postprocessing}get frameId(){return this.data.uiFrame}get frame(){return this.uiCanvas?.frame}createUICanvas(e,t){this.uiCanvas=new Od(this.uuid+"-uiscreen",window.innerWidth,window.innerHeight,t),this.uiCanvas.isScreenSpace=!0,this.uiCanvas.promise.then(()=>{this.uiCanvas?.applyFrame(e),this.uiCanvas?.applySize()})}updateVisible(){}
6009setBackgroundColor(e){this.bgColor=e,!0===this.fogUseBGColor&&(this.backupFog.color=e)}entityChildrenCount(){return this.uiScene?this.uiScene.children.length:super.entityChildrenCount()}updateAmbientLight(e,t){void 0!==e.color&&(this.ambientLight.color=Eu(e.color,t)),void 0!==e.intensity&&(this.ambientLight.intensity=e.intensity),void 0!==e.enabled&&(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(e=>{e instanceof Tl&&e.recomputeBoolean()}),this.updateShadow(this.data.shadow)}forceMaterialsUpdate(){this.traverseEntity(e=>{if(e instanceof Ai)if(Array.isArray(e.material))for(let t of e.material)t.needsUpdate=!0;else e.material.needsUpdate=!0,e.material.dispose()})}updateShadow(e){void 0!==e.softShadowQuality&&this.isActive&&((e="medium")=>{let t;if(Ds===e)return!1;Ds=e,t=(e=>{switch(e){case"low":return 8;case"medium":default:return 16;case"high":return 32}})(e),sd.shadowmap_pars_fragment=`
6010
6011// PCSS implementation based on:
6012// https://www.gamedev.net/articles/programming/graphics/contact-hardening-soft-shadows-made-fast-r4906/
6013// NOTE: This number affects how big the shadow blur can
6014// possibly get. Bigger number == bigger blur, but less precise results
6015
6016const float  gPenumbraFilterSize = 80.0;
6017const int   gPenumbraSamples = ${t};
6018const int gShadowSamples = ${t};
6019const float gShadowSamplesRpc = 1.0f / float(gShadowSamples);
6020
6021#ifdef USE_SHADOWMAP
6022    #if NUM_DIR_LIGHT_SHADOWS > 0
6023
6024        uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
6025        varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
6026
6027        struct DirectionalLightShadow {
6028            float shadowBias;
6029            float shadowNormalBias;
6030            float shadowRadius;
6031            vec2 shadowMapSize;
6032        };
6033
6034        uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
6035
6036    #endif
6037
6038    #if NUM_SPOT_LIGHT_SHADOWS > 0
6039
6040        uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
6041        varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_SHADOWS ];
6042
6043        struct SpotLightShadow {
6044            float shadowBias;
6045            float shadowNormalBias;
6046            float shadowRadius;
6047            vec2 shadowMapSize;
6048        };
6049
6050        uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
6051
6052    #endif
6053
6054    #if NUM_POINT_LIGHT_SHADOWS > 0
6055
6056        uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
6057        varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
6058
6059        struct PointLightShadow {
6060            float shadowBias;
6061            float shadowNormalBias;
6062            float shadowRadius;
6063            vec2 shadowMapSize;
6064            float shadowCameraNear;
6065            float shadowCameraFar;
6066        };
6067
6068        uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
6069
6070    #endif
6071
6072    /*
6073    #if NUM_RECT_AREA_LIGHTS > 0
6074
6075        // TODO (abelnation): create uniforms for area light shadows
6076
6077    #endif
6078    */
6079
6080float computePenumbra(int index, sampler2D shadowMap, float temporalAngle, float texelSize, vec2 uv, float compare, float texelScalar, float shadowRadius)
6081{
6082    float penumbra = 1.0;
6083    float blockerDepthAvg = 0.0;
6084    float blockerCount = 0.0;
6085
6086    #pragma unroll_loop_start
6087    for(int i = 0; i < gPenumbraSamples; i ++)
6088    {
6089        vec2 offset = (vogelDiskSample(i, gShadowSamples, temporalAngle) * texelSize) * texelScalar;
6090        float depth = unpackRGBAToDepth( texture2D( shadowMap, uv + offset ) );
6091
6092        if(depth < compare + 0.0001)
6093        {
6094            blockerDepthAvg += depth;
6095            blockerCount++;
6096        }
6097    }
6098    #pragma unroll_loop_end
6099
6100    if (blockerCount > 0.0)
6101    {
6102        blockerDepthAvg /= blockerCount;
6103
6104        // Compute penumbra
6105        penumbra = (compare - blockerDepthAvg) / (blockerDepthAvg);
6106        penumbra *= penumbra;
6107        penumbra *= 200.0 * penumbraSize[min(index, 5 - 1)]; // Magic number that affects how quickly the penumbra grows
6108
6109        return clamp(penumbra, 0.00, 1.0);
6110    }
6111    return 0.0;
6112}
6113
6114float vogelShadow(int index, sampler2D shadowMap, vec2 uv, float texelSize, float compare, float shadowRadius)
6115{
6116    float shadow         = 0.0f;
6117
6118    // NOTE: When using TAA, we should use screen space interleaved gradient noise
6119    vec2 halton = haltonSequence[frameIndex];
6120    float temporalOffset = getNoiseInterleavedGradient(gl_FragCoord.xy + halton);
6121    float temporalAngle  = temporalOffset * PI2;
6122
6123    float texelScalar = (gPenumbraFilterSize) / (texelSize * 1024.);
6124    float penumbra = computePenumbra(index, shadowMap, temporalAngle, texelSize, uv, compare, texelScalar, shadowRadius);
6125    if (penumbra == -1.0) {
6126        return 1.0;
6127    }
6128
6129    #pragma unroll_loop_start
6130    for (int i = 0; i < gShadowSamples; i++)
6131    {
6132        vec2 vogelSample =  vogelDiskSample(i, gShadowSamples, temporalAngle) * texelSize;
6133        // Overall blurring offset
6134        vec2 offset = vogelSample * (shadowRadius * 2.);
6135
6136        // Penumbra offset
6137        offset += vogelSample * (penumbra * texelScalar);
6138
6139        shadow += step( compare, unpackRGBAToDepth( texture2D( shadowMap, uv + offset ) ) );
6140    }
6141    #pragma unroll_loop_end
6142
6143    return shadow * gShadowSamplesRpc;
6144}
6145
6146
6147    float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {
6148
6149        return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );
6150
6151    }
6152
6153    vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {
6154
6155        return unpackRGBATo2Half( texture2D( shadow, uv ) );
6156
6157    }
6158
6159    float VSMShadow (sampler2D shadow, vec2 uv, float compare ){
6160
6161        float occlusion = 1.0;
6162
6163        vec2 distribution = texture2DDistribution( shadow, uv );
6164
6165        float hard_shadow = step( compare , distribution.x ); // Hard Shadow
6166
6167        if (hard_shadow != 1.0 ) {
6168
6169            float distance = compare - distribution.x ;
6170            float variance = max( 0.00000, distribution.y * distribution.y );
6171            float softness_probability = variance / (variance + distance * distance ); // Chebeyshevs inequality
6172            softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); // 0.3 reduces light bleed
6173            occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );
6174
6175        }
6176        return occlusion;
6177
6178    }
6179
6180    float getShadow( int i, sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
6181
6182        float shadow = 1.0;
6183
6184        shadowCoord.xyz /= shadowCoord.w;
6185        shadowCoord.z += shadowBias;
6186
6187        // if ( something && something ) breaks ATI OpenGL shader compiler
6188        // if ( all( something, something ) ) using this instead
6189
6190        bvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );
6191        bool inFrustum = all( inFrustumVec );
6192
6193        bvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );
6194
6195        bool frustumTest = all( frustumTestVec );
6196
6197        if ( frustumTest ) {
6198
6199        #if defined( SHADOWMAP_TYPE_PCF )
6200
6201            vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
6202            return vogelShadow(i, shadowMap, shadowCoord.xy, texelSize.x, shadowCoord.z, shadowRadius );
6203
6204        #elif defined( SHADOWMAP_TYPE_PCF_SOFT )
6205
6206            vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
6207            float dx = texelSize.x;
6208            float dy = texelSize.y;
6209
6210            vec2 uv = shadowCoord.xy;
6211            vec2 f = fract( uv * shadowMapSize + 0.5 );
6212            uv -= f * texelSize;
6213
6214            shadow = (
6215                texture2DCompare( shadowMap, uv, shadowCoord.z ) +
6216                texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +
6217                texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +
6218                texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +
6219                mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),
6220                     texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),
6221                     f.x ) +
6222                mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),
6223                     texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),
6224                     f.x ) +
6225                mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),
6226                     texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),
6227                     f.y ) +
6228                mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),
6229                     texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),
6230                     f.y ) +
6231                mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),
6232                          texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),
6233                          f.x ),
6234                     mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),
6235                          texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),
6236                          f.x ),
6237                     f.y )
6238            ) * ( 1.0 / 9.0 );
6239
6240        #elif defined( SHADOWMAP_TYPE_VSM )
6241
6242            shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );
6243
6244        #else // no percentage-closer filtering:
6245
6246            shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );
6247
6248        #endif
6249
6250        }
6251
6252        return shadow;
6253
6254    }
6255
6256    // cubeToUV() maps a 3D direction vector suitable for cube texture mapping to a 2D
6257    // vector suitable for 2D texture mapping. This code uses the following layout for the
6258    // 2D texture:
6259    //
6260    // xzXZ
6261    //  y Y
6262    //
6263    // Y - Positive y direction
6264    // y - Negative y direction
6265    // X - Positive x direction
6266    // x - Negative x direction
6267    // Z - Positive z direction
6268    // z - Negative z direction
6269    //
6270    // Source and test bed:
6271    // https://gist.github.com/tschw/da10c43c467ce8afd0c4
6272
6273    vec2 cubeToUV( vec3 v, float texelSizeY ) {
6274
6275        // Number of texels to avoid at the edge of each square
6276
6277        vec3 absV = abs( v );
6278
6279        // Intersect unit cube
6280
6281        float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );
6282        absV *= scaleToCube;
6283
6284        // Apply scale to avoid seams
6285
6286        // two texels less per square (one texel will do for NEAREST)
6287        v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );
6288
6289        // Unwrap
6290
6291        // space: -1 ... 1 range for each square
6292        //
6293        // #X##         dim    := ( 4 , 2 )
6294        //  # #         center := ( 1 , 1 )
6295
6296        vec2 planar = v.xy;
6297
6298        float almostATexel = 1.5 * texelSizeY;
6299        float almostOne = 1.0 - almostATexel;
6300
6301        if ( absV.z >= almostOne ) {
6302
6303            if ( v.z > 0.0 )
6304                planar.x = 4.0 - v.x;
6305
6306        } else if ( absV.x >= almostOne ) {
6307
6308            float signX = sign( v.x );
6309            planar.x = v.z * signX + 2.0 * signX;
6310
6311        } else if ( absV.y >= almostOne ) {
6312
6313            float signY = sign( v.y );
6314            planar.x = v.x + 2.0 * signY + 2.0;
6315            planar.y = v.z * signY - 2.0;
6316
6317        }
6318
6319        // Transform to UV space
6320
6321        // scale := 0.5 / dim
6322        // translate := ( center + 0.5 ) / dim
6323        return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );
6324
6325    }
6326
6327    float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
6328
6329        float shadow = 1.0;
6330        vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );
6331
6332        // for point lights, the uniform @vShadowCoord is re-purposed to hold
6333        // the vector from the light to the world-space position of the fragment.
6334        vec3 lightToPosition = shadowCoord.xyz;
6335
6336        // dp = normalized distance from light to fragment position
6337        float compare = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); // need to clamp?
6338        compare += shadowBias;
6339
6340        // bd3D = base direction 3D
6341        vec3 bd3D = normalize( lightToPosition );
6342
6343        vec2 halton = haltonSequence[frameIndex];
6344        float temporalOffset = getNoiseInterleavedGradient(gl_FragCoord.xy + halton);
6345        float temporalAngle  = temporalOffset * PI2;
6346
6347        #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_VSM )
6348            for (int i = 0; i < gShadowSamples; i++) {
6349                vec2 vogelSample = vogelDiskSample(i, gShadowSamples, temporalAngle) * texelSize;
6350
6351                // Overall blurring offset
6352                vec3 offset = vec3(vogelSample.x, vogelSample.y, -vogelSample.x) * (shadowRadius + 5.);
6353
6354                // NOTE: Removed for now
6355                // Penumbra offset
6356                //offset += vec3(vogelSample.x, vogelSample.y, vogelSample.y)  * (penumbra * gPenumbraFilterSize);
6357
6358                shadow += texture2DCompare( shadowMap, cubeToUV( bd3D + offset, texelSize.y ), compare );
6359
6360            }
6361            return shadow * gShadowSamplesRpc;
6362
6363        #elif defined( SHADOWMAP_TYPE_PCF_SOFT )
6364            for (int i = 0; i < 16; i++) {
6365                vec2 vogelSample = vogelDiskSample(i, gShadowSamples, temporalAngle) * texelSize;
6366
6367                // Overall blurring offset
6368                vec3 offset = vec3(vogelSample.x, vogelSample.y, -vogelSample.x) * (shadowRadius + 5.);
6369
6370                shadow += texture2DCompare( shadowMap, cubeToUV( bd3D + offset, texelSize.y ), compare );
6371
6372            }
6373            return shadow * (1.0 / 16.0);
6374        #else // no percentage-closer filtering
6375
6376            return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), compare );
6377
6378        #endif
6379
6380    }
6381
6382#endif
6383`;let i=Di.slice();sd.lights_fragment_begin=i=(i=i.replace("getShadow( spotShadowMap[ i ]","getShadow( UNROLLED_LOOP_INDEX + 3, spotShadowMap[ i ]")).replace("getShadow( directionalShadowMap[ i ]","getShadow( UNROLLED_LOOP_INDEX, directionalShadowMap[ i ]");let r=Dr.slice();return sd.shadowmask_pars_fragment=r=r.replaceAll("getShadow(","getShadow( UNROLLED_LOOP_INDEX, "),!0}
vendor: 5,873 bytes, line 6383
6383)(e.softShadowQuality)&&this.forceMaterialsUpdate()}updateFog(e,t){e.enabled?this.fog=this.backupFog:this.fog=null,this.isActive&&(this.scene.fog=this.fog),this.fogUseBGColor=e.useBackgroundColor,e.useBackgroundColor?this.backupFog.color.set(this.bgColor):this.backupFog.color=Eu(e.color,t),this.backupFog.near=e.near,this.backupFog.far=e.far}updateAo(e,t){void 0!==e.aoColor&&(this.aoColor=Eu(e.aoColor,t))}updateByOp(e,t,i,r){let s=this.data.uiFrame;super.updateByOp(e,t,i,r),p9(e.path,["fog"])?this.updateFog(t.fog,i.shared):p9(e.path,["ao"])?this.updateAo(t.ao,i.shared):p9(e.path,["ambient"])?this.updateAmbientLight(t.ambient,i.shared):p9(e.path,["shadow"])?this.updateShadow(t.shadow):0===e.type&&0===e.path.length&&(void 0!==e.props.uiFrame||s!==t.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),void 0!==e.backgroundColor&&this.setBackgroundColor(Eu(e.backgroundColor,t.shared)),void 0!==e.fog&&this.updateFog(e.fog,t.shared),void 0!==e.ambient&&this.updateAmbientLight(e.ambient,t.shared),void 0!==e.ao&&this.updateAo(e.ao,t.shared),void 0!==e.shadow&&this.updateShadow(e.shadow)}createFrame(e,t){}raycast(e,t){super.raycast(e,t)}switchActiveCamera(e){e&&e.isDescendantOf(this)&&(this.activeCamera!==this.personalCamera&&(this.activeCamera.objectHelper.visible=!0),this.activeCamera=e,e.objectHelper.visible=!1)}get playCamera(){return this.scene?.find(this.data.publish.playCamera)??this.personalCamera}switchToPlayCamera(){this.switchActiveCamera(this.playCamera)}get penumbraSizeArray(){return null===this.penumbraSizeArrayCache&&this.updatePenumbraSizeArray(),this.penumbraSizeArrayCache}updatePenumbraSizeArray(){this.penumbraSizeArrayCache=[,,,,,].fill(.5);let e=0,t=0;this.traverseEntity(i=>{if(!i.visible)return!0;i instanceof Dg&&i.visible&&e<3&&(this.penumbraSizeArrayCache[e]=i.data.penumbraSize??.5,e+=1),i instanceof Db&&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 r=s.cloner;SL.is(s)&&(s.visible||r?.object.data.visible)&&((Tc(s)||Tu(s)&&this.scene.enableHelpers&&s.objectHelper.visible)&&(e.intersectObject(s,!1,t),Lr(s,e,t,!0)),i(s))}};return i(this),t}updateEntity2DByOp(e,t,i,r){this.uiCanvas?.updateEntity2DByOp(e,t,i,r)}},Of=class extends Th(ld,Dc){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 lK(new iw(new iy(-r.far+this.position.x,-r.far+this.position.y,-r.far+this.position.z),new iy(r.far+this.position.x,r.far+this.position.y,r.far+this.position.z)),new ir(0xffaa00));s.visible=!1,this.gizmos.shadowmap=s,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 lK){let e=this.shadow.camera,i=new iy(-e.far+this.position.x,-e.far+this.position.y,-e.far+this.position.z),r=new iy(e.far+this.position.x,e.far+this.position.y,e.far+this.position.z);t.box.set(i,r),t.updateMatrixWorld(!0)}}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.objectHelper&&this.objectHelper.update()}updateState(e,t){this.updateState_Light(e,t),void 0!==e.distance&&(this.distance=e.distance),void 0!==e.decay&&(this.decay=e.decay),void 0!==e.shadowRadius&&(this.shadow.radius=e.shadowRadius),void 0!==e.shadowResolution&&(this.shadow.mapSize.set(e.shadowResolution,e.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null))}},Om=class extends Al{get forceComputeSize(){return!0}get shape(){return this.geometry.userData.shape}updateEntityBoxSize(e,t){let i=this.geometry.getAttribute("position");void 0!==i?Cd(i,this.geometry.drawRange.start,this.geometry.drawRange.count<1/0?this.geometry.drawRange.count:i.count,e,t):super.updateEntityBoxSize(e,t)}},Og=class extends Al{constructor(e,t,i){super(e,t,i),this._shapeId=null,this._context=i}updateState(e,t){super.updateState(e,t),this.updateShape(),this.refreshAttachedCloners(t)}updateShape(){let e,t={...this.data.geometry.extrusion.shape};for(let e in t)"string"==typeof t[e]&&(t[e]=this._context.shared.getVariable(t[e],[this.uuid,"geometry","extrusion","shape",e]));if("Custom"===t.type){let i=t.shapeId;if(i!==this._shapeId&&this.detachShape(),i){this._shapeId=i;let t=this._context.scene.find(i);t?.data&&(t.attachedPaths.add(this),e=t.geometry.userData?.shape),e||this._context.scene.addPendingCommand(()=>this.updateShape())}}else{let i;switch(t.type){case"Rectangle":i=St;break;case"Ellipse":i=_A;break;case"Polygon":i=_6;break;case"Star":i=Sn;break;default:throw Error(`Unknown shape type: ${t.type}`)}e=i.create({parameters:t}).userData.shape}let i=this.geometry;e&&i.inputs&&(i.inputs.shapeData=e,i.build())}detachShape(){null!==this._shapeId&&this._context.scene.find(this._shapeId)?.attachedPaths.delete(this)}createGeometryDelayed(e){this.geometryCreateDeleyed=e.shared,this.updateShape(),this.refreshAttachedPaths(e)}updateTransformState(e,t){return super.updateTransformState(e,t)}updateGeometryInteractions(e,t){super.updateGeometryInteractions(e,t),this.updateShape()}updateEntityBoxSize(e,t){let i=this.geometry.getAttribute("position");void 0!==i?Cd(i,this.geometry.drawRange.start,this.geometry.drawRange.count<1/0?this.geometry.drawRange.count:i.count,e,t):super.updateEntityBoxSize(e,t)}},Ov=class extends AN{constructor(e,t,i){super(e,t,i),this.data=t}},Oy=class extends A8(nd,Tv){constructor(e,t,i){super(),"Instance"===t.type&&"string"==typeof e&&(t=this.transformAssignData(t,i)),this.super_Entity(e,t),this.objectHelper.update(
6383)}get isComponentRoot(){return"Component"===this.data.type&&"string"==typeof this.identity}get isInstanceRoot(){return"Instance"===this.data.type&&"string"==typeof this.identity}transformAssignData(e,t){let i=xe.getComponentData({scene:t.scene.data,shared:t.shared.data},e.component);if(!i)return{...vd.defaultData,...e,...uQ(vd.defaultData,yV.rootOverrideProps)};{let t,r;for(let s of yV.rootOverrideProps)void 0===e[s]?(void 0===t&&(t={...e}),t[s]=i.data[s]):(void 0===r&&(r={}),r[s]=e[s],void 0===t&&(t={...e}),t[s]=pI.apply(i.data[s],e[s]));return this.overrideData=r,t}}updateByOp(e,t,i,r){let s;if(this.isInstanceRoot&&!r){if(t=this.transformAssignData(t,i),0===e.type&&0===e.path.length&&this.component)for(let t of yV.rootOverrideProps)t in e.props&&void 0===e.props[t]&&(void 0===s&&(s={...e,props:{...e.props}}),s.props[t]=this.component.data[t]);else if(0===e.type&&e.path.length>0&&yV.rootOverrideProps.includes(e.path[0])){let i=e.path[0];void 0===s&&(s={...e,path:[],props:{[i]:t[i]}})}}super.updateByOp(s??e,t,i,r)}updateState(e,t){this.updateState_Entity(e,t)}expandInstanceChildren(e){let t=this.data;if(void 0===this.component){let i=e.scene.find(t.component)??null,r=!1;if(i!==this.oldComponent){if(this.oldComponent){let t=0;for(let i of this.children)if(SL.is(i))e.scene.disposeAndUnregisterEntityRecursivelyIfNotReregistered(i),Ox(i),t+=1;else break;this.children.splice(0,t)}r=!0}if(i){let s={};for(let a of(function e(t,i,r,s,a,o,h,c,d){if(h>50)return!1;if(s.component!==a){if(s.component){let e=s.component.instances.indexOf(s);e>=0&&s.component.instances.splice(e,1)}a.instances.find(e=>e===s)||a.instances.push(s),s.component=a}a instanceof Oy&&a.isInstanceRoot&&a.expandInstanceChildren(t);let u=0;for(let p of a.children)if(SL.is(p)){let a=[...i,..."string"==typeof p.identity?[p.identity]:p.identity],f=yU.resolve(r,a,1);null==f||f instanceof pR||(Object.setPrototypeOf(f,pR.prototype),console.error("wrong prototype"));let m=null,g;if(!c){let e=s.children[u];if(null!==(m=SL.is(e)?e:null)){let e=Ob(m,p,f,a);g=e>=1?m.stateSelection:void 0,2!==e&&(m=null)}if(null===m&&null!==(m=t.scene.findInstance(a)??null)){let e=Ob(m,p,f,a);if(g=e>=1?m.stateSelection:void 0,2!==e)m=null;else{let e=m.parent.children.indexOf(m);m.parent.children.splice(e,1),s.children.splice(u,0,m),m.parent===s?e<=u&&console.error("not possible"):(m.parent=s,m.matrixWorldNeedsUpdate=!0,m.resetBBoxNeedsUpdate(),m.updateVisible(),t.pendingDeletes.delete(m))}}}if(null===m){let e=f?pI.apply(p.data,f):p.data;gT.is(e.type)&&(e={...e,type:"Empty"}),(m=wu.createEntity(a,e,t)).overrideData=f,s.add(m),s.children.splice(s.children.length-1,1),s.children.splice(u,0,m),m.updateState(m.data,t),g&&m.changeSelectedState(g,t),t.scene.registerInstanceAndSetUuid(m)}m.isBone&&(d[m.identity[m.identity.length-1]]=m.uuid),u+=1,e(t,i,r,m,p,o,h+1,c,d)}if(!c){let e=u;for(;;){let e=s.children[u];if(SL.is(e))t.pendingDeletes.add(e);else break;u+=1}s.children.splice(e,u-e)}return!0}(e,[this.uuid],t.overrides,this,i,i,0,r,s),this.children))if(SL.is(a)){let t=a.data;"Empty"===t.type&&t.animations&&a.traverseEntity(t=>{let i=t.dataPatched;if(t instanceof Al&&i.bones&&i.boneInverses){let i=t.dataPatched;if(i.bones&&i.boneInverses){let r=new nT(i.bones.map(t=>e.scene.find(s[t])),i.boneInverses.map(e=>new iY().fromArray(e)));t.bind(r,t.bindMatrix)}}else t.matrixAutoUpdate=!0})}}this.oldComponent=this.component}}};function Ox(e){if(e.component){let t=e.component.instances.indexOf(e);for(let i of(t>=0&&e.component.instances.splice(t,1),e.children))SL.is(i)&&Ox(i)}}function Ob(e,t,i,r){return e.component===t&&uV(e.identity,r)?e.overrideData===i?2:1:0}var Ow=class extends A8(nC,Tv){constructor(e,t){super(),this.super_Entity(e,t),this.objectHelper.update(),this.matrixAutoUpdate=!0}updateState(e,t){this.updateState_Entity(e,t)}},O_=class extends Al{constructor(e,t,i){super(e,t,i),this.onBeforeRender=e=>{this.uiCanvas.render(e)},this.uiCanvas=new Od(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),0===e.type&&(void 0!==e.props.frame&&this.applyFrame(e.props.frame,i.shared),(void 0!==e.props.width||void 0!==e.props.height)&&this.applySize(e.props,i.shared))}applySize(e,t){let i=e?.width??this.dataPatched.geometry.width,r=e?.height??this.dataPatched.geometry.height;this.uiCanvas.applySize({width:i,height:r}
6383),this.applyGeometryParametersFromFrame(t)}applyFrame(e,t){this.uiCanvas.applyFrame(e),this.applyGeometryParametersFromFrame(t),this.applyMaterialParametersFromFrame({shared:t})}applyGeometryParametersFromFrame(e){let t=this.frame;t&&(Object.assign(this.data,{geometry:Object.assign(this.data.geometry,{cornerRadius:t.cornerRadius,cornerType:0})}),Object.assign(this.dataPatched,{geometry:Object.assign(this.dataPatched.geometry,{cornerRadius:t.cornerRadius,cornerType:0})}),this.localGeometry?.dispose(),this.localGeometry=SU(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}),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}),this.material.reset?.(this.dataPatched.material,e,!0)}}updateEntity2DByOp(e,t,i,r){this.uiCanvas.updateEntity2DByOp(e,t,i,r),e===this.frameId&&0===t.type&&(void 0!==t.props.cornerRadius?this.applyGeometryParametersFromFrame(r):p9(t.path,["backgroundBlur"])&&this.applyMaterialParametersFromFrame({shared:r}))}get frame(){return this.uiCanvas.frame}get frameId(){return this.frame?.uuid}removeInteractionGeometry(e){super.removeInteractionGeometry(e),this.applySize({},e)}updateGeometryInteractions(e,t){super.updateGeometryInteractions(e,t),this.applySize({width:e.width,height:e.height},t);let i={...this.data.geometry,...e};this.localGeometry?.dispose(),this.localGeometry=SU(i,t,this.data.flatShading,this)}},OS=class{constructor(e,t,i){this.variables=[],this.currentTextureIndex=0;let r=1015,s=new nb,a=new r6;a.position.z=1;let o={passThruTexture:{value:null}},h=u(`uniform sampler2D passThruTexture;
6384
6385void main() {
6386
6387	vec2 uv = gl_FragCoord.xy / resolution.xy;
6388
6389	gl_FragColor = texture2D( passThruTexture, uv );
6390
6391}
6392`,o),c=new rK(new sc(2,2),h);function d(i){i.defines.resolution="vec2( "+e.toFixed(1)+", "+t.toFixed(1)+" )"}function u(e,t){let i=new r5({uniforms:t=t||{},vertexShader:`void main()	{
6393
6394	gl_Position = vec4( position, 1.0 );
6395
6396}
6397`,fragmentShader:e});return d(i),i}s.add(c),this.setDataType=function(e){return r=e,this},this.addVariable=function(e,t,i){let r={name:e,initialValueTexture:i,material:this.createShaderMaterial(t),dependencies:null,renderTargets:[],wrapS:null,wrapT:null,minFilter:1003,magFilter:1003};return this.variables.push(r),r},this.setVariableDependencies=function(e,t){e.dependencies=t},this.init=function(){if(!1===i.capabilities.isWebGL2&&!1===i.extensions.has("OES_texture_float"))return"No OES_texture_float support for float textures.";if(0===i.capabilities.maxVertexTextures)return"No support for vertex shader textures.";for(let i=0;i<this.variables.length;i++){let r=this.variables[i];r.renderTargets[0]=this.createRenderTarget(e,t,r.wrapS,r.wrapT,r.minFilter,r.magFilter),r.renderTargets[1]=this.createRenderTarget(e,t,r.wrapS,r.wrapT,r.minFilter,r.magFilter),this.renderTexture(r.initialValueTexture,r.renderTargets[0]),this.renderTexture(r.initialValueTexture,r.renderTargets[1]);let s=r.material,a=s.uniforms;if(null!==r.dependencies)for(let e=0;e<r.dependencies.length;e++){let t=r.dependencies[e];if(t.name!==r.name){let e=!1;for(let i=0;i<this.variables.length;i++)if(t.name===this.variables[i].name){e=!0;break}if(!e)return"Variable dependency not found. Variable="+r.name+", dependency="+t.name}a[t.name]={value:null},s.fragmentShader=`
6398uniform sampler2D `+t.name+`;
6399`+s.fragmentShader}}return this.currentTextureIndex=0,null},this.compute=function(){let e=this.currentTextureIndex,t=+(0===this.currentTextureIndex);for(let i=0,r=this.variables.length;i<r;i++){let r=this.variables[i];if(null!==r.dependencies){let t=r.material.uniforms;for(let i=0,s=r.dependencies.length;i<s;i++){let s=r.dependencies[i];t[s.name].value=s.renderTargets[e].texture}}this.doRenderTarget(r.material,r.renderTargets[t])}this.currentTextureIndex=t},this.getCurrentRenderTarget=function(e){return e.renderTargets[this.currentTextureIndex]},this.getAlternateRenderTarget=function(e){return e.renderTargets[+(0===this.currentTextureIndex)]},this.dispose=function(){c.geometry.dispose(),c.material.dispose();let e=this.variables;for(let t=0;t<e.length;t++){let i=e[t];i.initialValueTexture&&i.initialValueTexture.dispose();let r=i.renderTargets;for(let e=0;e<r.length;e++)r[e].dispose()}},this.addResolutionDefine=d,this.createShaderMaterial=u,this.createRenderTarget=function(i,s,a,o,h,c){return a=a||1001,o=o||1001,h=h||1003,c=c||1003,new iu(i=i||e,s=s||t,{wrapS:a,wrapT:
vendor: 4,806 bytes, lines 6399-6442
6399o,minFilter:h,magFilter:c,format:1023,type:r,depthBuffer:!1})},this.createTexture=function(){let i=new nM(new Float32Array(e*t*4),e,t,1023,1015);return i.needsUpdate=!0,i},this.renderTexture=function(e,t){o.passThruTexture.value=e,this.doRenderTarget(h,t),o.passThruTexture.value=null},this.doRenderTarget=function(e,t){let r=i.getRenderTarget(),o=i.xr.enabled,d=i.shadowMap.autoUpdate,u=i.outputEncoding,p=i.toneMapping;i.xr.enabled=!1,i.shadowMap.autoUpdate=!1,i.outputEncoding=3e3,i.toneMapping=0,c.material=e,i.setRenderTarget(t),i.render(s,a),c.material=h,i.xr.enabled=o,i.shadowMap.autoUpdate=d,i.outputEncoding=u,i.toneMapping=p,i.setRenderTarget(r)}}},OC=new rb,OM=new iy,OE=class{constructor(e){let t=e.geometry;if(!t.isBufferGeometry||3!==t.attributes.position.itemSize)throw 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 r=0;r<e.count;r+=3){let s=1;t&&(s=t.getX(r)+t.getX(r+1)+t.getX(r+2)),OC.a.fromBufferAttribute(e,r),OC.b.fromBufferAttribute(e,r+1),OC.c.fromBufferAttribute(e,r+2),s*=OC.getArea(),i[r/3]=s}this.distribution=new Float32Array(e.count/3);let r=0;for(let e=0;e<i.length;e++)r+=i[e],this.distribution[e]=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(0===a||t[a-1]<=e&&t[a]>e){s=a;break}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),OC.a.fromBufferAttribute(this.positionAttribute,3*e),OC.b.fromBufferAttribute(this.positionAttribute,3*e+1),OC.c.fromBufferAttribute(this.positionAttribute,3*e+2),t.set(0,0,0).addScaledVector(OC.a,s).addScaledVector(OC.b,a).addScaledVector(OC.c,1-(s+a)),void 0!==i&&OC.getNormal(i),void 0!==r&&void 0!==this.colorAttribute&&(OC.a.fromBufferAttribute(this.colorAttribute,3*e),OC.b.fromBufferAttribute(this.colorAttribute,3*e+1),OC.c.fromBufferAttribute(this.colorAttribute,3*e+2),OM.set(0,0,0).addScaledVector(OC.a,s).addScaledVector(OC.b,a).addScaledVector(OC.c,1-(s+a)),r.r=OM.x,r.g=OM.y,r.b=OM.z),this}};function OA(e,t){let i=new Float32Array(4*t*t);for(let r=0;r<t*t;r++)i[4*r]=e[3*r],i[4*r+1]=e[3*r+1],i[4*r+2]=e[3*r+2],i[4*r+3]=0;let r=new nM(i,t,t,1023,1015);return r.needsUpdate=!0,r}var OT=`
6400// uniform sampler2D uCurrentPosition; // Pass in the variable from GPGPU
6401// uniform sampler2D uCurrentVelocity; // Pass in the variable from GPGPU
6402// uniform sampler2D uCurrentEmissionRate; // Pass in the variable from GPGPU
6403uniform sampler2D uOriginalPosition;
6404uniform float uTime;
6405uniform float uSpeed;     // update speed of the particles
6406uniform vec3 uWorldOffset;    
6407uniform vec4 uWorldQuaternion;
6408uniform float uMaxLifeTime;
6409uniform vec3 uEmitterSize;
6410uniform float uFPSRatio;     // 1  for 60 FPS
6411
6412float random (vec2 st) {
6413    return fract(sin(dot(st.xy,
6414        vec2(12.9898,78.233)))*
6415        43758.5453123);
6416}
6417vec3 applyQuaternionToVector( vec4 q, vec3 v ){
6418    return v + 2.0 * cross( q.xyz, cross( q.xyz, v ) + q.w * v );
6419}
6420
6421vec3 applyForce(vec3 force, float mass) {
6422    vec3 acceleration = force / mass;
6423    
6424    return acceleration;
6425  }
6426  
6427
6428void main() {
6429    vec2 vUv = gl_FragCoord.xy / resolution.xy;
6430    vec3 position = texture2D( uCurrentPosition, vUv ).xyz;
6431    float currentLife = texture2D( uCurrentPosition, vUv ).w;   // from 1 to 0
6432    float isSpawning = texture2D( uCurrentEmissionRate, vUv ).r;        // 1. = spawning, 0. = not spawning
6433    float isActive = texture2D( uCurrentEmissionRate, vUv ).g;          // 1. = active, 0. = not active
6434    float timeStart = texture2D( uCurrentEmissionRate, vUv ).b;         // timeStart in seconds when the particle was emitted
6435    vec3 originalPosition = ((texture2D( uOriginalPosition, vUv ).xyz) * uEmitterSize);
6436    vec3 velocity = texture2D( uCurrentVelocity, vUv ).xyz;
6437    float collisionFlag = texture2D( uCurrentVelocity, vUv ).w;             // 1. = collided, 0. = not collided
6438    float lifeTime = uMaxLifeTime;
6439
6440    // Calculate the position adjustment based on collision
6441    //     if (collisionFlag > .5) {  
6442    float isColliding = step(0.5, collisionFlag);
6442 // 1.0 if collisionFlag > 0.5, otherwise 0.0
6443    float bounceOffset = 3.0 * isColliding; // Becomes 3.0 if colliding, 0.0 otherwise
6444    vec3 collisionAdjustedVelocity = velocity * (1.0 + bounceOffset);
6445
6446    // Update position based on collision or normal movement
6447    vec3 fpsVelocity = velocity * min(uFPSRatio, 5.0);
6448    position += mix(fpsVelocity, collisionAdjustedVelocity, isColliding);
6449
6450    // EMISSION RATE - BIRTH
6451    // if (isSpawning == 1.0) {
6452    // Better Approach to avoid If statement
6453    vec3 newPosition = applyQuaternionToVector(uWorldQuaternion, originalPosition) + uWorldOffset;
6454    originalPosition = mix(originalPosition, newPosition, isSpawning);
6455    position = mix(position, originalPosition, isSpawning);;
6456    timeStart = mix(timeStart, uTime, isSpawning);
6457
6458    // Calculate timeLeft for life normalization
6459    float timeLeft = max(lifeTime - (uTime - timeStart), 0.0);
6460    float life_Normalize = timeLeft / lifeTime;
6461
6462    // Use isActive to blend between the calculated color and black
6463    vec4 activeColor = vec4(position, life_Normalize);
6464    // if (isActive == 1.0) {
6465    gl_FragColor = mix(vec4(0.0), activeColor, isActive);
6466
6467}
6468`,OP=`
6469  #ifdef USE_COLLIDER
6470    float restitution = max(uBounce * 2., .01); // Energy Loss
6471    // SPHERE COLLIDER
6472    // **************************************************************
6473    #ifdef USE_SPHERE_COLLIDER       
6474      // Convert collider size to radii (assuming uColliderSize is the diameter in each axis)
6475      vec3 radii = uColliderSize;
6476      // Adjust position relative to collider
6477      vec3 relPos = position - uColliderPos;
6478      // Apply rotation of the collider to the relative position
6479      relPos = applyQuaternionToVector(uColliderQuaternionInvert, relPos);            
6480      // Scale relative position by radii (for ellipsoid collision detection)
6481      vec3 scaledPos = relPos / radii;
6482      // Calculate ellipsoidal distance
6483      float dist = length(scaledPos); // Distance in terms of ellipsoid
6484      
6485      // Check for collision
6486      if (dist <= 1. + particleSize / length(radii) && collisionFlag == 0.0) {
6487          // Compute the normal at the collision point, accounting for particle size
6488        vec3 adjustedPos = scaledPos * (1.0 + particleSize / length(radii));          
6489        // Compute the normal at the collision point
6490        vec3 normal = ellipsoidNormal(adjustedPos, radii);
6491        // Rotate the normal back to world space
6492        normal = applyQuaternionToVector(uColliderQuaternion, normal);
6493        // Reflect the velocity vector off the normal
6494        velocity = reflect(velocity, normal) * restitution;
6495
6496        collisionFlag = 1.0;
6497      } else {
6498        collisionFlag = 0.0;
6499      }
6500    #endif
6501
6502    // BOX COLLIDER or PLANE COLLIDER 
6503    // **************************************************************
6504    #ifdef USE_BOX_COLLIDER
6505      // Box dimensions and repulsion variables
6506      vec3 boxHalfSize = uColliderSize / 2.0;
6507      // Convert world position to box's local space
6508      vec3 localPos = applyQuaternionToVector(uColliderQuaternionInvert, position - uColliderPos);      
6509      // Collision detection
6510      vec3 localDistance = abs(localPos) - boxHalfSize;
6511      float distToSurface = max(localDistance.x, max(localDistance.y, localDistance.z));    
6512
6513      // Collision Detected
6514      if (distToSurface <= particleSize * 0.5 && collisionFlag == 0.0) {      
6515        // Find the nearest face normal for bounce direction
6516        vec3 normal;
6517        if (localDistance.x > localDistance.y && localDistance.x > localDistance.z) {
6518            normal = vec3(sign(localPos.x), 0.0, 0.0);
6519        } else if (localDistance.y > localDistance.z) {
6520            normal = vec3(0.0, sign(localPos.y), 0.0);
6521        } else {
6522            normal = vec3(0.0, 0.0, sign(localPos.z));
6523        }            
6524        // Rotate normal back to world space
6525        normal = applyQuaternionToVector(uColliderQuaternion, normal);      
6526        // Reflect velocity and apply repulsion force
6527        velocity = reflect(velocity, normal) * restitution;
6528        
6529        collisionFlag = 1.0;
6530      } else {
6531        collisionFlag = 0.0;
6532      }
6533    #endif      
6534  #endif      
6535  // END COLLIDER    
6536`,OD=`
6537  #ifdef USE_ATTRACTOR
6538
6539      #ifdef USE_SPHERE_COLLIDER      
6540        // Convert collider size to radii (assuming uColliderSize is the diameter in each axis)
6541        vec3 radii = uColliderSize;
6542        // Adjust position relative to collider
6543        vec3 relPos = position - uColliderPos;
6544        // Apply rotation of the collider to the relative position
6545        relPos = applyQuaternionToVector(uColliderQuaternionInvert, relPos);            
6546        // Scale relative position by radii (for ellipsoid collision detection)
6547        vec3 scaledPos = relPos / radii;
6548        // Calculate ellipsoidal distance
6549        float distToSurface = length(scaledPos); // Distance in terms of ellipsoid
6550        float insideCheck = 1.0;
6551
6552      #endif
6553
6554
6555      #ifdef USE_BOX_COLLIDER
6556        // Box dimensions
6557        vec3 boxHalfSize = uColliderSize / 2.0;
6558        // Convert world position to box's local space
6559        vec3 localPos = applyQuaternionToVector(uColliderQuaternionInvert, position - uColliderPos);      
6560        vec3 localDistance = abs(localPos) - boxHalfSize;
6561        float distToSurface = max(localDistance.x, max(localDistance.y, localDistance.z));
6562        float insideCheck = particleSize;
6563      #endif      
6564  
6565      // Apply vortex force inside the Helper
6566      #ifdef USE_FORCE_LOCAL_SPACE
6567        if (distToSurface <= insideCheck ) {    
6568            // Define parameters for the attractor field
6569            #ifdef USE_SPHERE_COLLIDER      
6570              float attractorStrength = (1.0 - distToSurface ) * uForceIntensity; // Adjust as needed
6571            #endif
6572
6573            #ifdef USE_BOX_COLLIDER
6574              float attractorStrength = max((1.0 - insideCheck / distToSurface), 0.) * uForceIntensity; // Adjust as needed
6575              #endif
6576
6577            float attractorDamping = uForceDamping;  // Adjust as needed (higher values will attenuate velocity more)
6578          
6579            // Use the same radii calculation code as for the collider
6580            vec3 attractorRadii = uColliderSize;
6581            // Adjust position relative to attractor center
6582            vec3 relPos = position - uColliderPos;
6583            // Apply rotation of the collider to the relative position
6584            relPos = applyQuaternionToVector(uColliderQuaternionInvert, relPos);            
6585            // Scale relative position by radii (for ellipsoid attraction)
6586            vec3 scaledPos = relPos / attractorRadii;
6587
6588            // Calculate ellipsoidal distance as attractor radius
6589            float attractorRadius = length(scaledPos);
6590            // Calculate the distance from the attractor center
6591            vec3 relativePosition = position - uColliderPos;
6592            // Calculate the force vector towards the attractor center
6593            vec3 attractorForce = normalize(relativePosition) * attractorStrength;
6594            // Apply the attractor force to the particle
6595            velocity -= attractorForce;
6596            // Attenuate the particle's velocity
6597            velocity *= attractorDamping;
6598        }
6599      #else 
6600            // Calculate the distance from the attractor center
6601            vec3 relativePosition = position - uColliderPos;
6602            // Calculate the force vector towards the attractor center
6603            vec3 attractorForce = normalize(relativePosition) * uForceIntensity;
6604            // Apply the attractor force to the particle
6605            velocity -= attractorForce;
6606            // Attenuate the particle's velocity
6607            velocity *= uForceDamping;
6608      #endif    
6609  #endif      
6610`,OO=`
6611  #ifdef USE_VORTEX
6612    // Box dimensions
6613    vec3 boxHalfSize = uColliderSize / 2.0;
6614    // Convert world position to box's local space
6615    vec3 localPos = applyQuaternionToVector(uColliderQuaternionInvert, position - uColliderPos);      
6616    vec3 localDistance = abs(localPos) - boxHalfSize;
6617    float distToSurface = max(localDistance.x, max(localDistance.y, localDistance.z));
6618
6619    // Apply vortex force inside the box
6620    if (distToSurface <= particleSize) {
6621      float vortexStrength = uForceIntensity;
6622      vec3 localTopCenter = vec3(0.0, 0., 0.0);
6623
6624      // Transform the local top center to the world space
6625      vec3 vortexCenter = uColliderPos + applyQuaternionToVector(uColliderQuaternion, localTopCenter);
6626      // Calculate the vector from particle to vortex center
6627      vec3 vortexVector = vortexCenter - position;
6628
6629      // Calculate the rotation axis from the inverse of the collider's quaternion and the fixed up vector
6630      // Note: important to add a tiny z component to the up vector to avoid instability
6631      vec3 upVector = vec3(0.0, 1.0, 0.01);
6632      vec3 rotationAxis = cross(upVector, applyQuaternionToVector(uColliderQuaternion, vortexVector));
6633      rotationAxis = normalize(rotationAxis);
6634
6635      // Add rotational component to velocity
6636      float rotationSpeed = length(vortexVector * vortexStrength * 3.0) ; 
6637
6638      vec3 rotationVelocity = rotationAxis * rotationSpeed;
6639      // velocity += rotationVelocity * 0.005 ;
6640      velocity = rotationVelocity * 0.005 ;
6641
6642      // Calculate vortex force
6643      // vec3 vortexForce = normalize(vortexVector) * uSpeed * .1 ;
6644      // Apply the vortex force to the particle
6645      vec3 originDirection = applyQuaternionToVector(uWorldQuaternion, directions);
6646      velocity += applyForce( originDirection * uSpeed * (1. - uForceDamping) , mass * .5);
6647    }
6648  #endif      
6649`,OL=`
6650// uniform sampler2D uCurrentPosition; // Pass in the variable from GPGPU
6651// uniform sampler2D uCurrentVelocity; // Pass in the variable from GPGPU
6652// uniform sampler2D uCurrentEmissionRate; // Pass in the variable from GPGPU
6653uniform sampler2D uOriginalPosition;
6654uniform sampler2D uDirections;     
6655uniform vec3 uDirectionsAxis;
6656uniform vec4 uWorldQuaternion;
6657uniform vec3 uGravity;        
6658uniform float uNoiseStrength;     // Variation of the noise
6659uniform float uNoiseScale;        // Scale of the noise
6660uniform float uNoiseSeed;         // Seed of the noise
6661uniform float particleSize;
6662uniform float uSpeed;     // update speed of the particles
6663uniform float uRandomMassFactor;
6664
6665// COLLIDER
6666uniform vec3 uColliderPos;                // Collider Position
6667uniform vec3 uColliderSize;               // Collider Dimension
6668uniform vec4 uColliderQuaternion;         // Collider Rotation
6669uniform vec4 uColliderQuaternionInvert;   // Collider Rotation
6670uniform float uBounce;                    // Bounce factor
6671uniform float uForceDamping;
6672uniform float uForceIntensity;
6673
6674
6675
6676
6677    vec3 mod289(vec3 x) {
6678      return x - floor(x * (1.0 / 289.0)) * 289.0;
6679    }
6680    
6681    vec4 mod289(vec4 x) {
6682    return x - floor(x * (1.0 / 289.0)) * 289.0;
6683    }
6684    
6685    vec4 permute(vec4 x) {
6686        return mod289(((x*34.0)+1.0)*x);
6687    }
6688    
6689    vec4 taylorInvSqrt(vec4 r)
6690    {
6691    return 1.79284291400159 - 0.85373472095314 * r;
6692    }
6693    
6694    vec3 fade(vec3 t) {
6695  return t*t*t*(t*(t*6.0-15.0)+10.0);
6696}
6697
6698    float snoise(vec3 v)
6699    {
6700    const vec2  C = vec2(1.0/6.0, 1.0/3.0) ;
6701    const vec4  D = vec4(0.0, 0.5, 1.0, 2.0);
6702    vec3 i  = floor(v + dot(v, C.yyy) );
6703    vec3 x0 =   v - i + dot(i, C.xxx) ;
6704    vec3 g = step(x0.yzx, x0.xyz);
6705    vec3 l = 1.0 - g;
6706    vec3 i1 = min( g.xyz, l.zxy );
6707    vec3 i2 = max( g.xyz, l.zxy );
6708    vec3 x1 = x0 - i1 + C.xxx;
6709    vec3 x2 = x0 - i2 + C.yyy; // 2.0*C.x = 1/3 = C.y
6710    vec3 x3 = x0 - D.yyy;      // -1.0+3.0*C.x = -0.5 = -D.y
6711    
6712    // Permutations
6713    i = mod289(i);
6714    vec4 p = permute( permute( permute(
6715                i.z + vec4(0.0, i1.z, i2.z, 1.0 ))
6716              + i.y + vec4(0.0, i1.y, i2.y, 1.0 ))
6717              + i.x + vec4(0.0, i1.x, i2.x, 1.0 ));
6718    
6719    // Gradients: 7x7 points over a square, mapped onto an octahedron.
6720    // The ring size 17*17 = 289 is close to a multiple of 49 (49*6 = 294)
6721    float n_ = 0.142857142857; // 1.0/7.0
6722    vec3  ns = n_ * D.wyz - D.xzx;
6723    
6724    vec4 j = p - 49.0 * floor(p * ns.z * ns.z);  //  mod(p,7*7)
6725    
6726    vec4 x_ = floor(j * ns.z);
6727    vec4 y_ = floor(j - 7.0 * x_ );    // mod(j,N)
6728    
6729    vec4 x = x_ *ns.x + ns.yyyy;
6730    vec4 y = y_ *ns.x + ns.yyyy;
6731    vec4 h = 1.0 - abs(x) - abs(y);
6732    
6733    vec4 b0 = vec4( x.xy, y.xy );
6734    vec4 b1 = vec4( x.zw, y.zw );
6735    
6736    vec4 s0 = floor(b0)*2.0 + 1.0;
6737    vec4 s1 = floor(b1)*2.0 + 1.0;
6738    vec4 sh = -step(h, vec4(0.0));
6739    
6740    vec4 a0 = b0.xzyw + s0.xzyw*sh.xxyy ;
6741    vec4 a1 = b1.xzyw + s1.xzyw*sh.zzww ;
6742    
6743    vec3 p0 = vec3(a0.xy,h.x);
6744    vec3 p1 = vec3(a0.zw,h.y);
6745    vec3 p2 = vec3(a1.xy,h.z);
6746    vec3 p3 = vec3(a1.zw,h.w);
6747    
6748    //Normalise gradients
6749    vec4 norm = taylorInvSqrt(vec4(dot(p0,p0), dot(p1,p1), dot(p2, p2), dot(p3,p3)));
6750    p0 *= norm.x;
6751    p1 *= norm.y;
6752    p2 *= norm.z;
6753    p3 *= norm.w;
6754    
6755    // Mix final noise value
6756    vec4 m = max(0.6 - vec4(dot(x0,x0), dot(x1,x1), dot(x2,x2), dot(x3,x3)), 0.0);
6757    m = m * m;
6758    return 42.0 * dot( m*m, vec4( dot(p0,x0), dot(p1,x1),
6759                                  dot(p2,x2), dot(p3,x3) ) );
6760    }
6761    
6762    vec3 snoiseVec3( vec3 x ){
6763    
6764      float s  = snoise(vec3( x ));
6765      float s1 = snoise(vec3( x.y - 19.1 , x.z + 33.4 , x.x + 47.2 ));
6766      float s2 = snoise(vec3( x.z + 74.2 , x.x - 124.5 , x.y + 99.4 ));
6767      vec3 c = vec3( s , s1 , s2 );
6768      return c;
6769    
6770    }
6771    
6772      
6773    vec3 curlNoise( vec3 p, float seed){
6774      p += seed;
6775      const float e = .1;
6776      vec3 dx = vec3( e   , 0.0 , 0.0 );
6777      vec3 dy = vec3( 0.0 , e   , 0.0 );
6778      vec3 dz = vec3( 0.0 , 0.0 , e   );
6779    
6780      vec3 p_x0 = snoiseVec3( p - dx );
6781      vec3 p_x1 = snoiseVec3( p + dx );
6782      vec3 p_y0 = snoiseVec3( p - dy );
6783      vec3 p_y1 = snoiseVec3( p + dy );
6784      vec3 p_z0 = snoiseVec3( p - dz );
6785      vec3 p_z1 = snoiseVec3( p + dz );
6786    
6787      float x = p_y1.z - p_y0.z - p_z1.y + p_z0.y;
6788      float y = p_z1.x - p_z0.x - p_x1.z + p_x0.z;
6789      float z = p_x1.y - p_x0.y - p_y1.x + p_y0.x;
6790    
6791      const float divisor = 1.0 / ( 2.0 * e );
6792      return normalize( vec3( x , y , z ) * divisor );
6793    
6794    }
6795
6796
6797// Classic Perlin noise
6798float cnoise(vec3 P)
6799{
6800  vec3 Pi0 = floor(P); // Integer part for indexing
6801  vec3 Pi1 = Pi0 + vec3(1.0); // Integer part + 1
6802  Pi0 = mod289(Pi0);
6803  Pi1 = mod289(Pi1);
6804  vec3 Pf0 = fract(P); // Fractional part for interpolation
6805  vec3 Pf1 = Pf0 - vec3(1.0); // Fractional part - 1.0
6806  vec4 ix = vec4(Pi0.x, Pi1.x, Pi0.x, Pi1.x);
6807  vec4 iy = vec4(Pi0.yy, Pi1.yy);
6808  vec4 iz0 = Pi0.zzzz;
6809  vec4 iz1 = Pi1.zzzz;
6810
6811  vec4 ixy = permute(permute(ix) + iy);
6812  vec4 ixy0 = permute(ixy + iz0);
6813  vec4 ixy1 = permute(ixy + iz1);
6814
6815  vec4 gx0 = ixy0 * (1.0 / 7.0);
6816  vec4 gy0 = fract(floor(gx0) * (1.0 / 7.0)) - 0.5;
6817  gx0 = fract(gx0);
6818  vec4 gz0 = vec4(0.5) - abs(gx0) - abs(gy0);
6819  vec4 sz0 = step(gz0, vec4(0.0));
6820  gx0 -= sz0 * (step(0.0, gx0) - 0.5);
6821  gy0 -= sz0 * (step(0.0, gy0) - 0.5);
6822
6823  vec4 gx1 = ixy1 * (1.0 / 7.0);
6824  vec4 gy1 = fract(floor(gx1) * (1.0 / 7.0)) - 0.5;
6825  gx1 = fract(gx1);
6826  vec4 gz1 = vec4(0.5) - abs(gx1) - abs(gy1);
6827  vec4 sz1 = step(gz1, vec4(0.0));
6828  gx1 -= sz1 * (step(0.0, gx1) - 0.5);
6829  gy1 -= sz1 * (step(0.0, gy1) - 0.5);
6830
6831  vec3 g000 = vec3(gx0.x,gy0.x,gz0.x);
6832  vec3 g100 = vec3(gx0.y,gy0.y,gz0.y);
6833  vec3 g010 = vec3(gx0.z,gy0.z,gz0.z);
6834  vec3 g110 = vec3(gx0.w,gy0.w,gz0.w);
6835  vec3 g001 = vec3(gx1.x,gy1.x,gz1.x);
6836  vec3 g101 = vec3(gx1.y,gy1.y,gz1.y);
6837  vec3 g011 = vec3(gx1.z,gy1.z,gz1.z);
6838  vec3 g111 = vec3(gx1.w,gy1.w,gz1.w);
6839
6840  vec4 norm0 = taylorInvSqrt(vec4(dot(g000, g000), dot(g010, g010), dot(g100, g100), dot(g110, g110)));
6841  g000 *= norm0.x;
6842  g010 *= norm0.y;
6843  g100 *= norm0.z;
6844  g110 *= norm0.w;
6845  vec4 norm1 = taylorInvSqrt(vec4(dot(g001, g001), dot(g011, g011), dot(g101, g101), dot(g111, g111)));
6846  g001 *= norm1.x;
6847  g011 *= norm1.y;
6848  g101 *= norm1.z;
6849  g111 *= norm1.w;
6850
6851  float n000 = dot(g000, Pf0);
6852  float n100 = dot(g100, vec3(Pf1.x, Pf0.yz));
6853  float n010 = dot(g010, vec3(Pf0.x, Pf1.y, Pf0.z));
6854  float n110 = dot(g110, vec3(Pf1.xy, Pf0.z));
6855  float n001 = dot(g001, vec3(Pf0.xy, Pf1.z));
6856  float n101 = dot(g101, vec3(Pf1.x, Pf0.y, Pf1.z));
6857  float n011 = dot(g011, vec3(Pf0.x, Pf1.yz));
6858  float n111 = dot(g111, Pf1);
6859
6860  vec3 fade_xyz = fade(Pf0);
6861  vec4 n_z = mix(vec4(n000, n100, n010, n110), vec4(n001, n101, n011, n111), fade_xyz.z);
6862  vec2 n_yz = mix(n_z.xy, n_z.zw, fade_xyz.y);
6863  float n_xyz = mix(n_yz.x, n_yz.y, fade_xyz.x); 
6864  return 2.2 * n_xyz;
6865}
6866
6867
6868vec3 fbm_vec3(vec3 p, float frequency, float offset)
6869{
6870  return vec3(
6871    cnoise((p+vec3(offset))*frequency),
6872    cnoise((p+vec3(offset+20.0))*frequency),
6873    cnoise((p+vec3(offset-30.0))*frequency)
6874  );
6875}
6876
6877
6878float rand(vec2 co){
6879    return fract(sin(dot(co, vec2(12.9898, 78.233))) * 43758.5453);
6880}
6881vec3 applyQuaternionToVector( vec4 q, vec3 v ){
6882    return v + 2.0 * cross( q.xyz, cross( q.xyz, v ) + q.w * v );
6883 } 
6884vec3 applyForce(vec3 force, float mass) {
6885  vec3 acceleration = force / mass;
6886  
6887  return acceleration;
6888}
6889
6890vec4 conjugate(vec4 q) {
6891  return vec4(q.w, -q.x, -q.y, -q.z);
6892}
6893
6894// Function to compute the normal of the ellipsoid at a given point
6895vec3 ellipsoidNormal(vec3 p, vec3 radii) {
6896  return normalize(p / (radii * radii));
6897}
6898
6899float friction = .3;
6900
6901void main() {
6902    vec2 vUv = gl_FragCoord.xy / resolution.xy;
6903    vec3 position = texture2D( uCurrentPosition, vUv ).xyz;
6904    vec3 originalPosition = texture2D( uOriginalPosition, vUv ).xyz;
6905    float timeLeft = texture2D( uCurrentPosition, vUv ).w;
6906    vec3 directions = texture2D( uDirections, vUv ).xyz;    
6907    vec3 velocity = texture2D( uCurrentVelocity, vUv ).xyz;
6908    float mass = rand(originalPosition.xy) * 0.5 + 0.5;
6909    float isSpawning = texture2D( uCurrentEmissionRate, vUv ).x;        // 1. = spawning, 0. = not spawning
6910    float isActive = texture2D( uCurrentEmissionRate, vUv ).y;          // 1. = active, 0. = not active
6911    float collisionFlag =texture2D( uCurrentVelocity, vUv ).w;          // Indicate collision
6912
6913    // Randomness Mass
6914    mass = (1.0 - (uRandomMassFactor * mass));
6915    
6916    if (isActive == 1.0) {
6917      // **************************************************************
6918      // FORCES NOISES
6919      // **************************************************************
6920      #ifdef USE_CURL_NOISE
6921        if (uNoiseScale > 0.0 ) {
6922          velocity = curlNoise(position * uNoiseScale * .002, uNoiseSeed) * ( uNoiseStrength + 1.0) * .05 * uSpeed;
6923        }
6924        // Variation of the noise Over Time
6925        if (uNoiseStrength > 0.0 && uNoiseScale == 0.0 ) {
6926          velocity += curlNoise( position, uNoiseSeed)  * uNoiseStrength * 0.05 * uSpeed;
6927        }
6928      #endif
6929      // **************************************************************
6930      #ifdef USE_SIMPLEX_NOISE
6931        if (uNoiseScale > 0.0 ) {
6932          velocity = vec3(snoise(position * uNoiseScale * .001) * ( uNoiseStrength + 1.0) * .1);
6933          velocity *= uSpeed;
6934        }
6935        // Variation of the noise Over Time
6936        if (uNoiseStrength > 0.0 && uNoiseScale == 0.0) {
6937          velocity += vec3(snoise(position * uNoiseStrength * .001) * .05 * uSpeed);
6938        }
6939      #endif
6940      // ************************************************************** 
6941      #ifdef USE_FBM_NOISE
6942        if (uNoiseScale > 0.0 ) {
6943          velocity = fbm_vec3(position * uNoiseScale * .001, ( uNoiseStrength + 1.0), uNoiseSeed);
6944          velocity *= uSpeed;
6945        }
6946        // Variation of the noise Over Time
6947        if (uNoiseStrength > 0.0 && uNoiseScale == 0.0 ) {      
6948          velocity += fbm_vec3(position * uNoiseStrength * .001, ( uNoiseStrength + 1.0), uNoiseSeed) * .1 * uSpeed;
6949        }
6950      #endif
6951
6952      // COLLIDER
6953      ${OP}
6954      // ATTRACTION
6955      ${OD}  
6956      // VORTEX
6957      ${OO}
6958    } 
6959    // End isActive
6960
6961    // SPAWN BIRTH 
6962    // **************************************************************
6963    // if (isSpawning == 1.)
6964    #ifdef USE_NORMALS
6965      velocity = mix(velocity, applyQuaternionToVector(uWorldQuaternion, directions) * uSpeed, isSpawning);
6966    #else
6967      velocity = mix(velocity, applyQuaternionToVector(uWorldQuaternion, uDirectionsAxis) * uSpeed, isSpawning);    
6968    #endif
6969    
6970    // if (collisionFlag == 0.0)
6971    velocity += applyForce(uGravity, mass * .5) * (1.0 - collisionFlag);
6972
6973    gl_FragColor = vec4(velocity, collisionFlag);
6974}
6975`,OI=`
6976
6977  // Linear Fade In
6978  float linearFadeIn(float t) {
6979    return t;
6980  }
6981
6982
6983  // linear fade out
6984  float linearFadeOut(float t) {
6985    return 1.0 - t;
6986  }
6987  
6988  float linearInOut(float t) {
6989    return t < 0.5 ? t :  (1.0 - t);  
6990  }
6991
6992    // lerp
6993    float lerp(float a, float b, float t) {
6994      return a + (b - a) * t;
6995    }
6996
6997  // Ease In Out Quart
6998  float exponentialInOut(float t) {
6999    return t < 0.4 ? lerp(0.0, 1.0, t / 0.4) :
7000    t > 0.6 ? lerp(1.0, 0.0, (t - 0.6) / 0.4) :
7001    1.0;
7002   }
7003
7004  // constant
7005  float constant(float t) {
7006    return 1.0;
7007  } 
7008`,OR=`
7009
7010float rand(vec3 co){
7011  return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);
7012}
7013
7014vec3 applyQuaternionToVector( vec4 q, vec3 v ){
7015  return v + 2.0 * cross( q.xyz, cross( q.xyz, v ) + q.w * v );
7016}
7017
7018vec3 applyForce(vec3 force, float mass) {
7019  vec3 acceleration = force / mass;
7020    
7021  return acceleration;
7022}
7023`,Ok=`
7024vec3 rgb2xyz (in vec3 rgb) {
7025    float r = rgb.r;
7026	float g = rgb.g;
7027	float b = rgb.b;
7028
7029	r = r > 0.04045 ? pow(((r + 0.055) / 1.055), 2.4) : (r / 12.92);
7030	g = g > 0.04045 ? pow(((g + 0.055) / 1.055), 2.4) : (g / 12.92);
7031	b = b > 0.04045 ? pow(((b + 0.055) / 1.055), 2.4) : (b / 12.92);
7032
7033	float x = (r * 0.4124) + (g * 0.3576) + (b * 0.1805);
7034	float y = (r * 0.2126) + (g * 0.7152) + (b * 0.0722);
7035	float z = (r * 0.0193) + (g * 0.1192) + (b * 0.9505);
7036    
7037    vec3 xyz = vec3(
7038        (r * 0.4124) + (g * 0.3576) + (b * 0.1805) * 100.0,
7039        (r * 0.2126) + (g * 0.7152) + (b * 0.0722) * 100.0,
7040        (r * 0.0193) + (g * 0.1192) + (b * 0.9505) * 100.0
7041    );
7042    return(xyz);
7043}
7044
7045vec3 xyz2lab (in vec3 xyz) {
7046	float x = xyz.x / 95.047;
7047	float y = xyz.y / 100.0;
7048	float z = xyz.z / 108.883;
7049
7050	x = x > 0.008856 ? pow(x, 1.0 / 3.0) : (7.787 * x) + (16.0 / 116.0);
7051	y = y > 0.008856 ? pow(y, 1.0 / 3.0) : (7.787 * y) + (16.0 / 116.0);
7052	z = z > 0.008856 ? pow(z, 1.0 / 3.0) : (7.787 * z) + (16.0 / 116.0);
7053
7054    vec3 lab = vec3((116.0 * y) - 16.0, 500.0 * (x - y), 200.0 * (y - z));
7055    return(lab);
7056}
7057
7058vec3 rgb2lab(in vec3 rgb) {
7059    vec3 xyz = rgb2xyz(rgb);
7060    vec3 lab = xyz2lab(xyz);
7061    return(lab);
7062}
7063
7064vec3 xyz2rgb (in vec3 xyz) {
7065	float x = xyz.x / 100.0;
7066	float y = xyz.y / 100.0;
7067	float z = xyz.z / 100.0;
7068	
7069    
7070	float r = (x *  3.2406) + (y * -1.5372) + (z * -0.4986);
7071	float g = (x * -0.9689) + (y *  1.8758) + (z *  0.0415);
7072	float b = (x *  0.0557) + (y * -0.2040) + (z *  1.0570);
7073
7074	r = r > 0.0031308 ? ((1.055 * pow(r, 1.0 / 2.4)) - 0.055) : r * 12.92;
7075	g = g > 0.0031308 ? ((1.055 * pow(g, 1.0 / 2.4)) - 0.055) : g * 12.92;
7076	b = b > 0.0031308 ? ((1.055 * pow(b, 1.0 / 2.4)) - 0.055) : b * 12.92;
7077
7078	r = min(max(0.0, r), 1.0);
7079	g = min(max(0.0, g), 1.0);
7080	b = min(max(0.0, b), 1.0);
7081
7082	return(vec3(r, g, b));
7083}
7084
7085vec3 lab2xyz (in vec3 lab) {
7086    float l = lab.x;
7087	float a = lab.y;
7088	float b = lab.z;
7089
7090  	float y = (l + 16.0) / 116.0;
7091	float x = a / 500.0 + y;
7092	float z = y - b / 200.0;
7093
7094	float y2 = pow(y, 3.0);
7095	float x2 = pow(x, 3.0);
7096	float z2 = pow(z, 3.0);
7097
7098  	y = y2 > 0.008856 ? y2 : (y - 16.0 / 116.0) / 7.787;
7099	x = x2 > 0.008856 ? x2 : (x - 16.0 / 116.0) / 7.787;
7100	z = z2 > 0.008856 ? z2 : (z - 16.0 / 116.0) / 7.787;
7101
7102	x *= 95.047;
7103	y *= 100.0;
7104	z *= 108.883;
7105
7106	return(vec3(x, y, z));
7107}
7108vec3 lab2rgb (in vec3 lab) {
7109    vec3 xyz = lab2xyz(lab);
7110    vec3 rgb = xyz2rgb(xyz);
7111    return(rgb);
7112}
7113
7114`,OB=`
7115  uniform sampler2D uPosition;
7116  uniform float uSize;
7117  uniform float uSizeEnd;
7118  uniform vec3 uWorldOffset;
7119  uniform vec4 uWorldQuaternion;
7120  // Billboard Behavior - Currently at Zero, but we can change that
7121  uniform float uRotation;
7122  uniform float uRotationEnd;
7123  uniform vec2 center;
7124
7125  // Randomness
7126  uniform float uRandScaleFactor;
7127  uniform float uRandRotationFactor;
7128
7129  attribute vec2 ref;
7130
7131  varying float v_LifeLeft;    // normalized lifetime 1 to 0
7132  varying vec2 vUv;
7133  varying vec2 vRef;
7134
7135  ${OR}
7136  ${OI}
7137`,Oz=`
7138  uniform vec4 uColor;                // start color
7139  uniform vec4 uColor2;               // end color
7140  uniform sampler2D uTexture;         // texture
7141  varying float v_LifeLeft;   // normalized lifetime 1 to 0
7142  varying vec2 vUv;
7143  varying vec2 vRef;
7144
7145  float random(vec2 co) {
7146    return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);
7147  }
7148  `+OI+`  
7149  ${Ok}
7150
7151`,ON=class extends r5{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=[],Cg.startContext(Cg.globalContext),this.lightLayer=new ES(0,"",{...gW.defaultData("light","phong"),visible:!1},new MD,{},t.shared),Cg.endContext(Cg.globalContext),this.build()}updateState(e){void 0!==e.coloring&&(this.isColoringRandom="random"===e.coloring),void 0!==e.color&&(e.color instanceof Array?this.uniforms.uColor.value=e.color:this.uniforms.uColor.value=this.context.shared.color(e.color)),void 0!==e.color2&&(e.color2 instanceof Array?this.uniforms.uColor2.value=e.color2:this.uniforms.uColor2.value=this.context.shared.color(e.color2)),void 0!==e.size&&(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),void 0!==e.ease&&(this.easeOpacity=e.ease,this.build()),void 0!==e.easeSize&&(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 C2;return e.needsJitter=this.needsJitter,e.addFragmentParsCode(CZ),e.buildShader("vertex",this.fragment),e.buildShader("fragment",this.fragment),e.addFragmentFinalCode(CK),this.isColoringRandom&&e.define("USE_RANDOM_COLORING"),this.useSizeEnd&&e.define("USE_SIZE_END"),e.addVertexParsCode(OB),e.addFragmentParsCode(Oz),e.addVertexFinalCode((({easeSize:e="linearFadeOut"})=>`
7152  vUv = uv;  
7153  vRef = ref;
7154  // Normalized LifeTime 1 to 0
7155  float lifeLeft = texture2D(uPosition, ref).w;
7156  v_LifeLeft = lifeLeft;
7157  // Position From DataTexture Simulation
7158  vec3 pos = texture2D(uPosition, ref).rgb - uWorldOffset;
7159  // Apply World Quaternion
7160  pos = applyQuaternionToVector(uWorldQuaternion, pos);  
7161            
7162  #ifdef  USE_SIZE_END
7163    // Scaled Over Time
7164    float t = 1. - lifeLeft;
7165    float currentSize = mix(uSize, uSizeEnd, t); // Linearly interpolate between uSize and uSizeEnd
7166    vec3 scaledPosition = position * vec3(currentSize);
7167  #else
7168    // Change Size Behavior over LifeTime
7169    float easeSize = ${e}(1. - lifeLeft);
7170    // Scaled Over Time
7171    vec3 scaledPosition = position * vec3(uSize * easeSize);
7172  #endif
7173
7174  // Billboard Behavior
7175  vec2 scale;
7176  scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );
7177  scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );    
7178  // Randomness 
7179  float randRef = rand(ref);
7180  scale *= (1.0 - (uRandScaleFactor * randRef));
7181  // Rotation
7182  float randRotation =  2.0 * PI * ( uRandRotationFactor * randRef);
7183  float originalRotation = (1.0 - uRotation) * 2.0 * PI;
7184  float originalRotationEnd = (1.0 - uRotationEnd) * 2.0 * PI;
7185  // OverTime
7186  float finalRotation = mix(originalRotation + randRotation, originalRotationEnd + randRotation, lifeLeft);
7187
7188  vec2 alignedPosition = ( scaledPosition.xy - ( center - vec2( 0.5 ) ) ) * scale;
7189  vec2 rotatedPosition;
7190  rotatedPosition.x = cos( finalRotation ) * alignedPosition.x - sin( finalRotation ) * alignedPosition.y;
7191  rotatedPosition.y = sin( finalRotation ) * alignedPosition.x + cos( finalRotation ) * alignedPosition.y;
7192  
7193  mat4 instanceMatrix = mat4(
7194    vec4(1.0, 0.0, 0.0, 0.0),
7195    vec4(0.0, 1.0, 0.0, 0.0),
7196    vec4(0.0, 0.0, 1.0, 0.0),
7197    vec4(pos.x, pos.y, pos.z, 1.0)
7198  );  
7199
7200  mvPosition = modelViewMatrix * instanceMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );
7201  mvPosition.xy += rotatedPosition;
7202  gl_Position = projectionMatrix  * mvPosition;   
7203`)({easeSize:this.easeSize})),e.addFragmentFinalCode((({easeOpacity:e="linearFadeOut"})=>`  
7204  // if Particle is dead, hide it
7205  if (v_LifeLeft <= 0.005 ) {
7206    discard;
7207  }
7208
7209  #ifdef USE_RANDOM_COLORING
7210    float randVal = random(vRef); // Generate a random value based on the reference
7211    vec4 color = mix(uColor, uColor2, randVal); // Interpolate between the two colors
7212  #else
7213    vec4 color = mix(uColor, uColor2, 1. - v_LifeLeft);
7214  #endif
7215
7216  // Opacity over Life Time
7217  float finalAlpha = ${e}(1. - v_LifeLeft);  
7218  vec4 textureColor = texture2D(uTexture, vUv).rgba; 
7219  finalColor = textureColor.rgb * color.rgb;
7220  finalAlpha = color.a * textureColor.a * finalAlpha;
7221  
7222  gl_FragColor = vec4(finalColor, finalAlpha);     
7223
7224`)({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: 9,855 bytes, lines 7224-7271
7224nodeMaterialDispose(){this.layers.forEach(e=>e.dispose()),super.dispose()}},OF=class{constructor(e,t,i,r){this.type="SphereEmitterShape",this.targetMesh=void 0,this.size=e,this.type=i,this.textureSize=function(e){return Math.max(Math.ceil(Math.sqrt(e)),1)}(t),this.targetMesh=r?.geometry.type==="BufferGeometry"||r?.type==="Mesh"&&r&&r.geometry.hasAttribute("position")&&r.geometry.hasAttribute("normal")?r:this.getMesh(i,1);let{positions:s,dataTexture:a,dataTextureNormals:o}=this.createPositions(this.textureSize,this.targetMesh??this.getMesh(i,1));this.positionsTexture=a,this.positionsAttribute=s,this.directionsTexture=o}createPositions(e,t){let{positions:i,normals:r}=function(e,t){let i=new rK(e.geometry,e.material),r=[],s=[],a=new iy,o=new iy;null!==i.geometry.index&&(i.geometry=i.geometry.toNonIndexed());let h=new OE(i).build();for(let e=0;e<t;e++)h.sample(a,o),r.push(a.x,a.y,a.z),s.push(o.x,o.y,o.z);return{positions:new Float32Array(r),normals:new Float32Array(s)}}(t,e*e);return{dataTexture:OA(i,e),positions:i,dataTextureNormals:OA(r,e)}}getMesh(e,t){let i=null;switch(e){case"SphereEmitterShape":i=new oL(.5*t,32,32);break;case"TorusEmitterShape":i=new oI(.5*t,.3,15,40);break;case"ConeEmitterShape":i=new ol(t,t,15);break;case"BoxEmitterShape":i=new r$(t,t,t);break;case"PlaneEmitterShape":(i=new sc(t,t)).rotateX(-Math.PI/2);break;default:i=new oL(t,32,32)}return new rK(i,new rS({color:0xff0000}))}applyToShader(e,t){this.size=new iy().fromArray(t.size),e.uEmitterSize.value=this.size}dispose(){this.positionsTexture.dispose(),this.directionsTexture.dispose(),this.positionsAttribute=new Float32Array}};function Oj(e){let t={...e},i=gR.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 OU=`
7225// uniform sampler2D uCurrentPosition; // Pass in the variable from GPGPU
7226// uniform sampler2D uCurrentVelocity; // Pass in the variable from GPGPU
7227// uniform sampler2D uCurrentEmissionRate; // Pass in the variable from GPGPU
7228
7229uniform sampler2D uIndex; // Texture with corresponding index
7230uniform float uLastIndexEmitted; // Last emitted index
7231uniform float uParticlesToEmit; // Number of particles to emit on that frame
7232uniform float uTime;
7233
7234void main() {
7235    vec2 vUv = gl_FragCoord.xy / resolution.xy;
7236    float particleIndex = texture(uIndex, vUv).x;
7237    float timeLeft = texture2D( uCurrentPosition, vUv ).w;
7238    float isActive = texture2D( uCurrentEmissionRate, vUv ).g;    // 1. = active, 0. = not active
7239    float timeStart = texture2D( uCurrentEmissionRate, vUv ).b;
7240
7241
7242    // ********** Detect Colision to Create a flag and use it in position **********
7243    // We are doing this here, so
7244
7245    // ********** Emit Particles **********
7246    // X = isSpawning 0.0 or 1.0
7247    // Y = isActive 0.0 or 1.0
7248    // Check if the vertex index is between the first value and the last value
7249    // if (particleIndex >= uLastIndexEmitted && particleIndex < uLastIndexEmitted + uParticlesToEmit) {
7250    //     // Emit a particle by writing 1 to the red channel of the color output
7251    //     // r: 1. == emit the particle
7252    //     // g: 1. == particle is now active
7253    //     timeStart = uTime;
7254    //     gl_FragColor = vec4(1.0, 1.0, timeStart, 1.0);
7255    // } else {
7256    //     // The Particle is either already emitted or not in the range of the particles to emit
7257    //     // Do not emit a particle by writing 0 to the red channel of the color output        
7258    //     gl_FragColor = vec4(0.0, isActive, timeStart, 1.0);
7259    // }
7260    // Determine if the particle is within the emission range
7261    float emitLowerBound = step(uLastIndexEmitted, particleIndex);
7262    float emitUpperBound = step(particleIndex, uLastIndexEmitted + uParticlesToEmit - 1.0);
7263    float emitParticle = emitLowerBound * emitUpperBound; // 1.0 if in range, 0.0 otherwise
7264
7265    // Set timeStart and color
7266    timeStart = mix(timeStart, uTime, emitParticle);
7267    gl_FragColor = vec4(emitParticle, mix(isActive, 1.0, emitParticle), timeStart, 1.0);
7268
7269
7270}
7271`,OV=class extends rh{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 o9,this.currentWorldPosition=new iy,this.systemQuaternion=new iv,this.worldGravity=new iy(0,0,0),this.directionAxis=new iy(0,0,0),this.colliderV3=new iy(0,0,0),this.colliderQuaternion=new iv(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 ON(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 iy(0,0,0)},uEmissionData:{value:new iy(0,0,0)},uTexture:{value:this.defaultTexture},uWorldOffset:{value:new iy(0,0,0)},uWorldQuaternion:{value:new id(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("string"==typeof t){let i=new ic(this.shared.image(t).img);i.needsUpdate=!0,e.uTexture.value=i;return}if("string"!=typeof i){let t=new Image;t.onload=()=>{let i=new ic(t);i.needsUpdate=!0,e.uTexture.value=i};let r=new Blob([i],{type:"image/*"});t.src=URL.createObjectURL(r)}}updateGeometryAttributes(e,t){let i=function(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[2*s+0]=i/(e-1),t[2*s+1]=r/(e-1)}return t}(t);this.emitterShape?.positionsAttribute&&e.geometry.setAttribute("ref",new nP(i,2))}applyWorldSpace(){if(!this.system.started||!this.worldSpace||!this.positionSimRT||!this.velocitySimRT)return;let e=this.system;e.getWorldQuaternion(this.systemQuaternion),this.systemQuaternion.invert(),e.getWorldPosition(this.currentWorldPosition),this.material.uniforms.uWorldOffset.value=this.currentWorldPosition,this.material.uniforms.uWorldQuaternion.value.copy(this.systemQuaternion.normalize()),this.positionSimRT.material.uniforms.uWorldOffset.value=this.currentWorldPosition,this.systemQuaternion.invert(),this.positionSimRT.material.uniforms.uWorldQuaternion.value.copy(this.systemQuaternion.normalize()),this.velocitySimRT.material.uniforms.uWorldQuaternion.value.copy(this.systemQuaternion.normalize())}update(e,t){if(!this.gpuCompute||!this.positionSimRT||!this.velocitySimRT||!this.emissionRateSimRT||this.hasBeenReset)return;if(this.checkIfAllParticlesAreDead()&&!this.hasBeenReset)return void this.reset();this.applyWorldSpace(),this.globalTime=e,this.positionSimRT.material.uniforms.uTime.value=e,this.emissionRateSimRT.material.uniforms.uTime.value=e;let i=this.targetFPS/(1e3/t),r=this.previousRatio+(i-this.previousRatio)*this.lerpFactor;this.positionSimRT.material.uniforms.uFPSRatio.value=r,this.previousRatio=r;let s=this.isEmitting?this.GoEmitSomeParticles(e,this.system.data.birthRatePerSec):0;this.emissionRateSimRT.material.uniforms.uLastIndexEmitted.value=this.emittedParticlesAmount,this.emissionRateSimRT.material.uniforms.uParticlesToEmit.value=s,this.material.uniforms.uPosition.value=this.gpuCompute.getCurrentRenderTarget(this.positionSimRT)?.texture,this.system.colliderEntities.length>0&&this.renderColliders(),this.gpuCompute.compute()}renderColliders(){if(!this.velocitySimRT)return;let e=this.system.colliderEntities[0],t=this.simFeaturesDefinition.USE_COLLIDER||this.simFeaturesDefinition.USE_ATTRACTOR||this.simFeaturesDefinition.USE_VORTEX;if(e.destroyedInAction&&t&&this.init(Oj({...this.system.data,colliderEntityId:null})),!e||e.destroyedInAction)return;e.getWorldPosition(this.colliderV3),0===this.colliderV3.y&&(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;"size"===t[2]&&this.material.updateState({size:[e,this.material.uniforms.uSizeEnd.value]}),"sizeEnd"===t[2]&&this.material.updateState({size:[this.material.uniforms.uSize.value,e]});let i=(e,t)=>{let i=[...this.system.data.shape.size];i[e]=t,this.updateParticleState({shape:{...this.system.data.shape,size:i}})};"shape_size_0"===t[2]&&i(0,e),"shape_size_1"===t[2]&&i(1,e),"shape_size_2"===t[2]&&i(2,e),"speed"===t[2]&&(this.velocitySimRT.material.uniforms.uSpeed.value=e/10),"gravity"===t[2]&&this.worldGravity.set(0,e/100,0),"noiseStrength"===t[2]&&(this.noiseStrength=e,this.velocitySimRT.material.uniforms.uNoiseStrength.value=this.noiseStrength),"n
7271oiseScale"===t[2]&&(this.noiseScale=e,this.velocitySimRT.material.uniforms.uNoiseScale.value=this.noiseScale),"direction_x"===t[2]&&(this.directionAxis=this.getDirectionAxis([Number(e),this.system.data.direction[1],this.system.data.direction[2]])),"direction_y"===t[2]&&(this.directionAxis=this.getDirectionAxis([this.system.data.direction[0],Number(e),this.system.data.direction[2]])),"direction_z"===t[2]&&(this.directionAxis=this.getDirectionAxis([this.system.data.direction[0],this.system.data.direction[1],Number(e)]))}updateMaterialState(e){this.material.updateState({...e,size:e.size?[Number(this.shared.getVariable(e.size[0],[this.uuid,"particles","size"])),Number(this.shared.getVariable(e.size[1],[this.uuid,"particles","sizeEnd"]))]:[0,0]}),e.texture&&(this.setTexture(this.material.uniforms,e.texture),this.material.needsUpdate=!0)}updateParticleState(e){if(!(!this.positionSimRT||!this.velocitySimRT)){if(this.shouldReInitGPUCompute(e)&&this.init(Oj(this.system.data)),void 0!==e.life&&(this.positionSimRT.material.uniforms.uMaxLifeTime.value=e.life),void 0!==e.speed&&(this.velocitySimRT.material.uniforms.uSpeed.value=Number(this.shared.getVariable(e.speed,[this.uuid,"particles","speed"]))/10),void 0!==e.collisionBounce&&(this.velocitySimRT.material.uniforms.uBounce.value=e.collisionBounce),void 0!==e.noiseStrength&&(this.noiseStrength=Number(this.shared.getVariable(e.noiseStrength,[this.uuid,"particles","noiseStrength"])),this.velocitySimRT.material.uniforms.uNoiseStrength.value=this.noiseStrength),void 0!==e.noiseScale&&(this.noiseScale=Number(this.shared.getVariable(e.noiseScale,[this.uuid,"particles","noiseScale"])),this.velocitySimRT.material.uniforms.uNoiseScale.value=this.noiseScale),void 0!==e.noiseSeed&&(this.velocitySimRT.material.uniforms.uNoiseSeed.value=e.noiseSeed),void 0!==e.randomMass&&(this.velocitySimRT.material.uniforms.uRandomMassFactor.value=e.randomMass),e.renderMaterial?.size!==void 0){let t=this.shared.getVariable(e.renderMaterial.size[0],[this.uuid,"particles","size"]);this.velocitySimRT.material.uniforms.particleSize.value=Number(t)}if(e.renderMaterial?.spriteRotation!==void 0&&(this.material.uniforms.uRotation.value=e.renderMaterial.spriteRotation[0],this.material.uniforms.uRotationEnd.value=e.renderMaterial.spriteRotation[1]),void 0!==e.shape){let t=e.shape.size??this.system.data.shape.size,i=[Number(this.shared.getVariable(t[0],[this.uuid,"particles","shape_size_0"])),Number(this.shared.getVariable(t[1],[this.uuid,"particles","shape_size_1"])),Number(this.shared.getVariable(t[2],[this.uuid,"particles","shape_size_2"]))],r={...Oj(this.system.data).shape,size:i};this.emitterShape?.applyToShader(this.positionSimRT.material.uniforms,r)}if(void 0!==e.gravity&&(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}),void 0!==e.direction){let t=this.getDirectionFromVariable(e.direction);this.directionAxis=this.getDirectionAxis(t),this.velocitySimRT.material.uniforms.uDirectionsAxis.value=this.directionAxis}void 0!==e.randomRotation&&(this.material.uniforms.uRandRotationFactor.value=e.randomRotation),void 0!==e.randomScale&&(this.material.uniforms.uRandScaleFactor.value=e.randomScale)}}updateForceFieldParameters(e){this.velocitySimRT&&(void 0!==e.forceIntensity&&(this.velocitySimRT.material.uniforms.uForceIntensity.value=e.forceIntensity),void 0!==e.forceDambing&&(this.velocitySimRT.material.uniforms.uForceDamping.value=e.forceDambing))}getDirectionAxis(e){let t=[Number(e[0])*tQ.DEG2RAD,Number(e[1])*tQ.DEG2RAD,Number(e[2])*tQ.DEG2RAD],i=new i4(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:o,life:h,directionMode:c,noiseType:d}=e;return void 0!==t||void 0!==i||r||null===r||void 0!==o||void 0!==s||void 0!==h||void 0!==a||void 0!==c||void 0!==d}init(e){this.dispose(),this.particlesAmount=this.getMaxParticlesAmount({birthRatePerSecond:e.b
vendor: 5,331 bytes, line 7271
7271irthRatePerSec,particleMaxLifeTime:e.life,loopDuration:"infinity"===e.emitTimeCycle?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]))return void this.init(e);else clearInterval(t)},100);if(!this.emitterShape)return;let i=new OS(this.emitterShape.textureSize,this.emitterShape.textureSize,this.renderer),r=this.updateSimulationDefinition(e),s=i.addVariable("uCurrentPosition",r+OT,this.emitterShape.positionsTexture),a=i.addVariable("uCurrentVelocity",r+OL,this.emitterShape.directionsTexture),o=i.addVariable("uCurrentEmissionRate",OU,function(e){let t=new Float32Array(4*e*e);for(let i=0;i<e*e;i++)t[4*i]=0,t[4*i+1]=0,t[4*i+2]=0,t[4*i+3]=0;let i=new nM(t,e,e,1023,1015);return i.needsUpdate=!0,i}(this.emitterShape.textureSize));i.setVariableDependencies(s,[s,a,o]),i.setVariableDependencies(a,[s,a,o]),i.setVariableDependencies(o,[s,a,o]);let h=function({size:e}){let t=new Float32Array(4*e*e);for(let i=0;i<e*e;i++)t[4*i]=i,t[4*i+1]=0,t[4*i+2]=0,t[4*i+3]=0;let i=new nM(t,e,e,1023,1015);return i.needsUpdate=!0,i}({size:this.emitterShape.textureSize}),c={uOriginalPosition:{value:this.emitterShape.positionsTexture},uWorldOffset:{value:new iy(0,0,0)},uWorldQuaternion:{value:new id(0,0,0,1)},uTime:{value:0},uFPSRatio:{value:1},uMaxLifeTime:{value:e.life},uEmitterSize:{value:new iy(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=c;let d=this.getDirectionFromVariable(e.direction);this.directionAxis=this.getDirectionAxis(d),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 u=e.colliderEntityId&&this.system.getColliderData(e.colliderEntityId),p={uOriginalPosition:{value:this.emitterShape.positionsTexture},uDirections:{value:this.emitterShape.directionsTexture},uDirectionsAxis:{value:this.directionAxis},uWorldQuaternion:{value:new id(0,0,0,1)},uColliderPos:{value:new iy(0,0,0)},uColliderSize:{value:new iy(0,0,0)},uForceIntensity:{value:u?u.forceIntensity:0},uForceDamping:{value:u?u.forceDambing:0},uColliderQuaternion:{value:new id(0,0,0,1)},uColliderQuaternionInvert:{value:new id(0,0,0,1)},particleSize:{value:0},uGravity:{value:this.worldGravity},uNoiseStrength:{value:this.noiseStrength},uNoiseScale:{value:this.noiseScale},uNoiseSeed:{value:e.noiseSeed},uRandomMassFactor:{value:e.randomMass},uBounce:{value:e.collisionBounce},uSpeed:{value:Number(this.shared.getVariable(e.speed,[this.uuid,"particles","speed"]))/10}};a.material.uniforms=p,o.material.uniforms={uIndex:{value:h},uTime:{value:0},uLastIndexEmitted:{value:0},uParticlesToEmit:{value:0}};let f=[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"]))],m={...Oj(this.system.data).shape,size:f};this.emitterShape.applyToShader(s.material.uniforms,m),i.init(),this.gpuCompute=i,this.positionSimRT=s,this.velocitySimRT=a,this.emissionRateSimRT=o,this.rootObject=this.createPrimaryEmitter(this.emitterShape.textureSize),this.add(this.rootObject),this.material.needsUpdate=!0}getDirectionFromVariable(e){return[Number(this.shared.getVariable(e[0],[this.uuid,"particles","direction_x"])),Number(this.shared.getVariable(e[1],[this.uuid,"particles","direction_y"])),Number(this.shared.getVariable(e[2],[this.uuid,"particles","direction_z"]))]}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 t=this.system.getColliderData(e.colliderEntityId);switch(t?.forceType){case"attractor":this.simFeaturesDefinition.USE_ATTRACTOR=!0;break;case"collider":this.simFeaturesDefinition.USE_COLLIDER=!0;break;case"vortex":this.simFeaturesDefinition.USE_VORTEX=!0}let i=t?.colliderType;"sphere"===i&&(this.simFeaturesDefinition.USE_SPHERE_COLLIDER=!0),"box"===i&&(this.simFeaturesDefinition.USE_BOX_COLLIDER=!0),t?.forceRange==="helper"&&(this.simFeaturesDefinition.USE_FORCE_LOCAL_SPACE=!0)}"normals"===e.directionMode&&(this.simFeaturesDefinition.USE_NORMALS=!0),"curl"===e.noiseType&&(this.simFeaturesDefinition.USE_CURL_NOISE=!0),"simplex"===e.n
7271oiseType&&(this.simFeaturesDefinition.USE_SIMPLEX_NOISE=!0),"fbm"===e.noiseType&&(this.simFeaturesDefinition.USE_FBM_NOISE=!0);let t="";for(let[e,i]of Object.entries(this.simFeaturesDefinition))i&&(t+=`#define ${e}
7272`);return t}createShape(e,t){this.emitterShape&&this.emitterShape.dispose();let i=new iy(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("MeshEmitterShape"!==e.type)return new OF(i,t,e.type);{let r=null;return this.system.context.scene.traverseEntity(t=>{t.uuid===e.fromMeshId&&(r=t)}),r?new OF(i,t,e.type,r):new OF(i,t,"SphereEmitterShape")}}createPrimaryEmitter(e){let t;return t=new nk(new sc(1,1,1),this.material,e*e),this.updateGeometryAttributes(t,e),this.material.needsUpdate=!0,t.onBeforeRender=()=>{this.applyWorldSpace()},t}getMaxParticlesAmount({birthRatePerSecond:e,particleMaxLifeTime:t,loopDuration:i=0}){return Math.ceil(e*(t+i))}dispose(){this.gpuCompute&&(this.rootObject?.parent?.remove(this.rootObject),this.gpuCompute.dispose(),this.material.nodeMaterialDispose(),this.emitterShape?.dispose())}GoEmitSomeParticles(e,t){let i=e-this.lastEmitTime,r=1/t;if(i>=r){let t=Math.max(1,Math.floor(i/r));return this.lastEmitTime=e,this.emittedParticlesAmount+t>this.particlesAmount&&(this.emittedParticlesAmount=0),this.emittedParticlesAmount+=t,t}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(Oj(this.system.data))}startEmitting(e){this.isEmitting=!0,this.hasBeenReset=!1,this.lastEmitTime=e}stopEmitting(){this.isEmitting=!1}},OW=class extends Cf{constructor(e,t,i){super(e,t),this.type="ParticleSystem",this.geometry=new rz,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=e=>{this._hasOnAfterRenderBeenCalled||(this._hasOnAfterRenderBeenCalled=!0,this.init(e))},this.context=i,this.data={...t,...Oj(t)},this.geometry.setAttribute("position",new rP([],3)),this.material=new rS({colorWrite:!1}),this.frustumCulled=!1}init(e){this.renderer=e,this.emitter=new OV(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="one_time"===this.data.emitTimeCycle;if(("loop"===this.data.emitTimeCycle||t)&&this.currentLoopTime>1e3*this.data.emitTimeDuration&&(this.stopped||(this.stop(),t||this.start(1e3*this.data.emitTimeDelay))),this.emitter&&this.started){let t=this.actualTime/1e3;this.emitter.update(t,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(t=>t.identity===e);return t?t.data:null}updateByPatchedOp(e,t,i){super.updateByPatchedOp(e,t,i),p9(e.path,["renderMaterial"])&&this.updateParticleState({renderMaterial:{...this.data.renderMaterial,...fs.drop(e,1).props}}),p9(e.path,["shape"])&&this.updateParticleState({shape:{...this.data.shape,...fs.drop(e,1).props}})}updateState(e,t){super.updateState(e,t),this.updateParticleState(e)}updateParticleState(e){if(this.emitter){if(void 0!==e.colliderEntityId&&null!==e.colliderEntityId){let t=this.context.scene.find(e.colliderEntityId);this.colliderEntities=t?[t]:[]}null===e.colliderEntityId&&(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){if(this.currentLoopTime=0,e){this.timeoutId=window.setTimeout(()=>{this.start(0)},e);return}this.started=!0,this.stopped=!1,this.isFrozen=!1,this.emitter?.startEmitting(this.actualTime/1e3)}froze(){this.isFrozen=!0}unFroze(){this.isFrozen=!1}stop(){this.stopped=!0,this.currentLoopTime=0,this.emitter?.stopEmitting(),clearTimeout(this.timeoutId)}reset(){this.started=!1,this.stopped=!1,this.emitter?.reset()}wakeUp(){this.isIdle=!1}sleep(){this.isIdle=!0,this.reset()}},OH=function(){try{let e=window.location.href;if(e.includes("reducesubdiv=")){let t=e.indexOf("reducesubdiv=")+13;return parseInt(e.slice(t,t+1))}}catch{}}();function OG(e,t,i){return console.assert(void 0!==t.type),"Mesh"===t.type?(void 0!==OH&&(t?.geometry?.subdivisions??0)>OH&&(console.log("reducing subdivisions",t.name,t.geometry.subdivisions),t.geometry.subdivisions=OH),"TextGeometry"===t.geometry.type?new AN(e,t,i):"InputGeometry"===t.geometry.type?new Ov(e,t,i):"SubdivGeometry"===t.geometry.type?new Ap(e,t,i):"PathGeometry"===t.geometry.type?new Og(e,t,i):"VectorGeometry"===t.geometry.type?new Om(e,t,i):"BooleanGeometry"===t.geometry.type?new Tl(e,t,i):"ShapeBlendGeometry"===t.geometry.type?new OJ(e,t,i):"UIGeometry"===t.geometry.type?new O_(e,t,i):new Al(e,t,i)):"Empty"===t.type?new Ty(e,t):"Particle"===t.type?new OW(e,t,i):"ParticleCollider"===t.type?new Tx(e,t,i):"Splat"===t.type?new Ty(e,t):"Bone"===t.type?new Ow(e,t):"Page"===t.type?new Op(e,t,i):"PointLight"===t.type?new Of(e,t,i):"SpotLight"===t.type?new Db(e,t,i):"DirectionalLight"===t.type?new Dg(e,t,i):"Component"===t.type||"Instance"===t.type?new Oy(e,t,i):gT.is(t.type)?new Ts(e,t):(console.error(t),new Ty(e,t))}wu.createEntity=OG,wu.changeEntityProptotype=function(e,t,i){let r=OG(e.identity,t,i),s=e.children,a=e.attachedPaths,o=e.parent,h=e.component,c=e.instances,d=e.overrideData,u=e.uuid,p=e.stateSelection;
7272for(let t of(e.dispose(),Object.keys(e)))delete e[t];for(let t of(Object.setPrototypeOf(e,Object.getPrototypeOf(r)),Object.keys(r)))e[t]=r[t];e.children=[...e.children,...s],e.attachedPaths=a,e.parent=o,e.component=h,e.instances=c,e.uuid=u,e.overrideData=d,e.updateState(e.data,i),p&&e.changeSelectedState(p,i),e.resetBBoxNeedsUpdate()},wu.Cloner=AZ;var Oq=new rz;Oq.setAttribute("position",new rE(new Float32Array([-1,-1,0,3,-1,0,-1,3,0]),3));var OX=class extends ok{constructor(e){super({...e,depthTest:!1,depthWrite:!1,glslVersion:tR,vertexShader:`
7273				precision highp float;
7274				in vec3 position;
7275				void main() {
7276					gl_Position = vec4(position, 1);
7277				}
7278			`})}customProgramCacheKey(){return""}},OY=new r6,OQ=class{constructor(){this.pyramidPassScene=new nb,this.pyramidPassMaterial=new OX({name:"PyramidPass"}),this.pyramidPassUniforms={inputTexture:{value:void 0},inputWidth:{value:0},inputHeight:{value:0},inputShiftX:{value:0},outputShiftX:{value:0}},this.pyramidTopLevelReadPixelBuffer=new Float32Array(4);let e=`
7279			precision highp float;
7280			precision highp sampler2D;
7281			layout(location = 0) out vec4 pc_FragColor;
7282			uniform sampler2D inputTexture;
7283			uniform float inputWidth;
7284			uniform float inputHeight;
7285			uniform float inputShiftX;
7286			uniform float outputShiftX;
7287			const vec2 half_unit_coord = vec2(0.5);
7288			const vec4 one = vec4(1.0);
7289			void main() {
7290				vec2 inputSize = vec2(inputWidth, inputHeight);
7291				vec2 input_pixel_uv = 1. / inputSize;
7292				vec2 coord = gl_FragCoord.xy - half_unit_coord;
7293				coord.x -= outputShiftX;
7294				coord = coord * 2. + half_unit_coord;
7295				coord.x += inputShiftX;
7296
7297				// sample bottom left corner
7298				vec2 input_uv = coord / inputSize;
7299				float bl = texture(inputTexture, input_uv).r;
7300
7301				// sample bottom right corner
7302				input_uv.x += input_pixel_uv.x;
7303				float br = texture(inputTexture, input_uv).r;
7304
7305				// sample top right corner
7306				input_uv.y += input_pixel_uv.y;
7307				float tr = texture(inputTexture, input_uv).r;
7308
7309				// sample top left corner
7310				input_uv.x -= input_pixel_uv.x;
7311				float tl = texture(inputTexture, input_uv).r;
7312
7313				pc_FragColor.a = bl;
7314				pc_FragColor.b = pc_FragColor.a + br;
7315				pc_FragColor.g = pc_FragColor.b + tr;
7316				pc_FragColor.r = pc_FragColor.g + tl; 
7317			}
7318		`;this.pyramidPassMaterial.fragmentShader=e,this.pyramidPassMaterial.uniforms=this.pyramidPassUniforms,this.pyramidPassMaterial.depthTest=!1,this.pyramidPassMaterial.depthWrite=!1;let t=new rK(Oq,this.pyramidPassMaterial);t.frustumCulled=!1,this.pyramidPassScene.add(t)}renderPyramid(e,t,i,r,s){new lB().min.setScalar(0);let a=t.length-1,o=new id;i.getViewport(o),this.pyramidPassUniforms.inputShiftX.value=0,this.pyramidPassUniforms.outputShiftX.value=0;let h=a-1;for(let a=h;a>=0;a--){let o=a%2==h%2?s[0]:s[1],c=a===h?r:a%2==h%2?s[1]:s[0];this.pyramidPassUniforms.inputTexture.value=Array.isArray(c.texture)?c.texture[1]:c.texture,this.pyramidPassUniforms.inputWidth.value=c.width,this.pyramidPassUniforms.inputHeight.value=c.height,i.setRenderTarget(o);let d=t[a],u=i.getPixelRatio();i.setViewport(this.pyramidPassUniforms.outputShiftX.value/u,0,d/u,d/u),2===a&&e%2!=0&&i.setViewport(this.pyramidPassUniforms.outputShiftX.value/u,0,3/u,3/u),i.render(this.pyramidPassScene,OY);let p=this.pyramidPassUniforms.inputShiftX.value;this.pyramidPassUniforms.inputShiftX.value=this.pyramidPassUniforms.outputShiftX.value,this.pyramidPassUniforms.outputShiftX.value=p,a<h&&(this.pyramidPassUniforms.outputShiftX.value+=t[a+1])}i.setViewport(o);let c=+(t.length%2!=0);return i.readRenderTargetPixelsAsync(s[c],s[c].width-1,0,1,1,this.pyramidTopLevelReadPixelBuffer).then(()=>this.pyramidTopLevelReadPixelBuffer[0])}},OZ={shapeInput:()=>`
7319			const float posRowCoord = 0.1;  // vec4: px py pz opType
7320			const float quatRowCoord = 0.3;  // vec4: qx qy qz qw
7321			const float param1RowCoord = 0.5;// vec4: type param1 param2 param3
7322			const float param2RowCoord = 0.7;// vec4: blendRange roundness scale param4
7323			const float colorRowCoord = 0.9; // vec4: r g b a
7324			uniform sampler2D shapesDataTexture;
7325			vec4 shapePos(float iin) { 
7326				vec4 r = texture(shapesDataTexture, vec2(iin, posRowCoord));
7327				return r;
7328			}
7329			vec4 shapeQuat(float iin) {
7330				vec4 r = texture(shapesDataTexture, vec2(iin, quatRowCoord));
7331				return r;
7332			}
7333			vec4 shapeParams1(float iin) {
7334				vec4 r = texture(shapesDataTexture, vec2(iin, param1RowCoord));
7335				return r;
7336			}
7337			vec4 shapeParams2(float iin) {
7338				vec4 r = texture(shapesDataTexture, vec2(iin, param2RowCoord));
7339				return r;
7340			}
7341			vec4 shapeColor(float iin) {
7342				vec4 r = texture(shapesDataTexture, vec2(iin, colorRowCoord));
7343				return r;
7344			}
7345		`,getxyzi:`
7346			// this code must complement lookup
7347			float xi = mod(gl_FragCoord.x - 0.5, VOXEL_RESOLUTION);
7348			float yi = mod(gl_FragCoord.y - 0.5, VOXEL_RESOLUTION);
7349			float zi = floor((gl_FragCoord.x - 0.5) * INV_VOXEL_RESOLUTION) + floor((gl_FragCoord.y - 0.5) * INV_VOXEL_RESOLUTION) * Z_LAYERS_PER_ROW;
7350		`,lookup:`
7351			uniform sampler2D potentialPassTexture;
7352			uniform sampler2D voxelPassTexture; // includes normal (in xyz) and key (in w)
7353			
7354			// box or marching cube lookup value in value texture, integer box coord inputs
7355			// this code must complement codebits.getxyzi
7356			vec4 look(float xi, float yi, float zi, sampler2D rt) {// range 0 .. numv etc
7357				vec2 uv = vec2(
7358					mod(zi, Z_LAYERS_PER_ROW) + (xi + 0.5) / VOXEL_RESOLUTION,
7359					floor(zi / Z_LAYERS_PER_ROW) + (yi + 0.5) / VOXEL_RESOLUTION
7360				); 
7361				uv /= Z_LAYERS_PER_ROW;
7362				return texture(rt, uv);
7363			}
7364		`,getpart:`
7365			float getpart(inout float a, float b) {
7366				float t = floor(a/b);
7367				float r = a - t*b;
7368				a = t;
7369				return r;
7370			}
7371		`,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,
vendor: 7,748 bytes, line 7371
73716,-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])},OK=class extends Al{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 nb,this.potentialPassScene=new nb,this.voxelPassScene=new nb,this._spatialPassRenderTargets=[],this._potentialPassRenderTargets=[],this._voxelPassRenderTargets=[],this._pyramidRenderTargets=[],this.geometry=new rz,this.geometry.drawRange.count=0,this.spatialPassUniforms={span:{value:-1},shapesDataTexture:this.shapesDataTexture,npart:{value:this.npart},spatialn:{value:this.spatialn}},this.spatialMesh=new rK(Oq,this.spatialPassMaterial()),this.spatialMesh.frustumCulled=!1,this.spatialscene.add(this.spatialMesh);let r=new nM(OZ.triTable,16,256,1028,1015);r.needsUpdate=!0;let s=new nM(OZ.numTrisTable,256,1,1028,1015);s.needsUpdate=!0,this.voxelPassUniforms={potentialPassTexture:{value:void 0},numTrisTable:{value:s}},this.voxelMesh=new rK(Oq,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 rK(Oq,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}
7371,pyramidTexture2Size:{value:void 0}},this.frustumCulled=!1,this.onBeforeShadowPass=e=>{if(O8.call(this),0===this.npart){this.geometry.drawRange.count=0;return}let t=this.material.root;if(t.shadersPatchedForShapeBlend){if(this.customDepthMaterialNeedsUpdate){this.customDepthMaterialNeedsUpdate=!1,this.customDepthMaterial=new r5({vertexShader:t.vertexShader,fragmentShader:`
7372						#include <packing>
7373						void main()
7374						{
7375							gl_FragColor = packDepthToRGBA(gl_FragCoord.z);
7376						}
7377					`,uniforms:t.uniforms,defines:this.material.defines}),this.isMeshDepthMaterial=!0,this.customDistanceMaterial=new r5({vertexShader:t.vertexShader,fragmentShader:`
7378					#include <common>
7379					#include <packing>
7380					uniform vec3 referencePosition;
7381					uniform float nearDistance;
7382					uniform float farDistance;
7383					// World-space position
7384					varying vec3 vWPosition;
7385					void main()
7386					{
7387						float dist = length(vWPosition - referencePosition);
7388						dist = (dist - nearDistance) / (farDistance - nearDistance);
7389						dist = saturate(dist);
7390						// Required by Three.js for this to work
7391						gl_FragColor = packDepthToRGBA( dist );
7392					}`,uniforms:{nearDistance:{value:0},farDistance:{value:0},referencePosition:{value:new iy},opacity:{value:0},...t.uniforms},defines:this.material.defines});let e=this.customDistanceMaterial;e.referencePosition=new iy,e.nearDistance=0,e.farDistance=0,e.opacity=1,e.isMeshDistanceMaterial=!0}}else this.patchVertexShaderForShapeBlend(t),t.shadersPatchedForShapeBlend=!0,this.customDepthMaterialNeedsUpdate=!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),this.material.needsUpdate=!0;let e=+(this.pyramidLevelSizes.length%2!=0),t=+(this.pyramidLevelSizes.length%2==0);this.marchPassUniforms.pyramidTexture2.value=this.pyramidRenderTarget[e].texture,this.marchPassUniforms.pyramidTexture2Size.value=new tZ(this.pyramidRenderTarget[e].width,this.pyramidRenderTarget[e].height),this.marchPassUniforms.pyramidTexture1.value=this.pyramidRenderTarget[t].texture,this.marchPassUniforms.pyramidTexture1Size.value=new tZ(this.pyramidRenderTarget[t].width,this.pyramidRenderTarget[t].height),Object.assign(this.material.uniforms,this.marchPassUniforms)}let i=e.shadowMap.enabled;e.shadowMap.enabled=!1;let r=e.getRenderTarget();e.setRenderTarget(this.spatialPassRenderTarget),e.render(this.spatialscene,OY),e.setRenderTarget(this.potentialPassRenderTarget),e.render(this.potentialPassScene,OY),e.setRenderTarget(this.voxelPassRenderTarget),e.render(this.voxelPassScene,OY),OK.streamCompaction.renderPyramid(this.resolutionLevel,this.pyramidLevelSizes,e,this.voxelPassRenderTarget,this.pyramidRenderTarget).then(e=>{this.material.wireframe&&(3*e>this.geometry.attributes.position.count||this.drawRangeNeedsForceUpdate)&&(this.geometry.dispose(),this.geometry=new rz,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 rE(new Float32Array(3*e*2),3)),(3*e>this.geometry.drawRange.count||this.drawRangeNeedsForceUpdate)&&(this.geometry.drawRange.count=3*Math.floor(1.2*e)),this.drawRangeNeedsForceUpdate=!1}),e.shadowMap.enabled=i,e.setRenderTarget(r)}}set npart(e){e!==this._npart&&(this.drawRangeNeedsForceUpdate=!0,this._npart=e,this.spatialn=Math.ceil(e/96))}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=496,this.bboxOffset=-8;break;case 6:this.pyramidLevelSizes=[1,2,4,8,16,32,64,128,256,512],this.bboxSize=504,this.bboxOffset=-4;break;case 7:this.pyramidLevelSizes=[1,2,4,6,12,24,48,96,192,384,768,1536],this.bboxSize=508,this.bboxOffset=-2;break;case 8:this.pyramidLevelSizes=[1,2,4,8,16,32,64,128,256,512,1024,2048,4096],this.bboxSize=510,this.bboxOffset=-1}this.pyramidTexture1Width=0,this.pyramidTexture2Width=0,this.pyramidTexture1Height=this.pyramidLevelSizes[this.pyramidLevelSizes.length-2],this.pyramidTexture2Height=this.pyramidLevelSizes[this.pyramidLevelSizes.length-3];for(let e=this.pyramidLevelSizes.length-2;e>=0;e--)(this.pyramidLevelSizes.length-2)%2==e%2?this.pyramidTexture1Width+=this.pyramidLevelSizes[e]:this.pyramidTexture2Width+=this.pyramidLevelSizes[e];this.basePyramidSize=this.pyramidLevelSizes[this.pyramidLevelSizes.length-1],this.zLayersPerRow=this.basePyramidSize/this.resolution,this.numLevels=this.pyramidLevelSizes.length-1,this.geometry.userData.parameters={width:this.bboxSize,height:this.bboxSize,depth:this.bboxSize,centerOffset:[this.bboxOffset,this.bboxOffset,this.bboxOffset]},this.needsRebuild=!0,this.customDepthMaterialNeedsUpdate=!0}}get resolutionLevel(){return this._resolutionLevel}get spatialPassRenderTarget(){let e=this._spatialPassRenderTargets[this.resolutionLevel];return e||(e=new iu(this.spatialDivisions*this.spatialn,this.spatialDivisions**2,{format:1023,type:1015,stencilBuffer:!1,depthBuffer:!1,generateMipmaps:!1,minFilter:1003,magFilter:1003}),this._spatialPassRenderTargets[this.resolutionLevel]=e),e}get potentialPassRenderTarget(){let e=this._potentialPassRenderTargets[this.resolutionLevel];return e||(e=new iu(this.basePyramidSize,this.basePyramidSize,{format:1023,type:1015,stencilBuffer:!1,depthBuffer:!1,generateMipmaps:!1,minFilter:1003,magFilter:1003}),this._potentialPassRenderTargets[this.resolutionLevel]=e),e}get voxelPassRenderTarget(){let e=this._voxelPassRenderTargets[this.resolutionLevel];return e||((e=new ig(this.basePyramidSize,this.basePyramidSize,2,{stencilBuffer:!1,depthBuffer:!1,generateMipmaps:!1,minFilter:1003,magFilter:1003})).texture[0].format=1023,e.texture[0].type=1015,e.texture[1].format=1028,e.texture[1].type=1015,this._voxelPassRenderTargets[this.resolutionLevel]=e),e}get pyramidRenderTarget(){let e=this._pyramidRenderTargets[this.resolutionLevel];return e||(e=[new iu(this.pyramidTexture1Width,this.pyramidTexture1Height,{format:1023,type:1015,stencilBuffer:!1,depthBuffer:!1,magFilter:1003,minFilter:1003}),new iu(this.pyramidTexture2Width,this.pyramidTexture2Height,{format:1023,type:1015,stencilBuffer:!1,depthBuffer:!1,magFilter:1003,minFilter:1003})],this._pyramidRenderTargets[this.resolutionLevel]=e),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 rE(new Float32Array(3*this.geometry.drawRange.count),3)):!e.wireframe&&this.geometry.getAttribute("position")&&this.geometry.deleteAttribute("position")}spatialPassMaterial(){return new OX({name:"Spatial Pass",fragmentShader:`
7393			precision highp float;
7394			out vec4 pc_FragColor;
7395			const float spatialDivisions = ${this.spatialDivisions}.;
7396			uniform float span;
7397			uniform float npart;
7398			uniform float spatialn;
7399			${OZ.shapeInput()}
7400
7401			vec3 low, high;     // range of current div; subset of -1 .. 1 with span border
7402
7403			// lookup one element/channel's worth of spheres for current division
7404			// stating with low sphere number lowi
7405			// gives a key to which spheres from lowi..lowi+23 are active within given div (low..high)
7406			float spatialKey(float lowi) {
7407				float t = 0.;
7408				for (float ii = 23.; ii >= 0.; ii--) {
7409					float i = ii + lowi;
7410					float iin = (i + 0.5) / 96.;
7411					vec4 shape = shapePos(iin);
7412					vec3 d = shape.xyz;
7413					float op = shape.w;
7414	
7415					t *= 2.;
7416					t += (
7417						low.x < d.x && d.x < high.x &&
7418						low.y < d.y && d.y < high.y &&
7419						low.z < d.z && d.z < high.z &&
7420						i < npart || op == -2. // always include if op is -2, which is the intersection operation
7421					) ? 1. : 0.;
7422				}
7423				return t;
7424			}
7425
7426			${OZ.getpart}
7427
7428			void main() {               // spatialial fragment shader
7429				// find active div
7430				vec3 div;                               // which div is current
7431				// out holds x=> x, lowi faster moving and y=> z, y faster moving
7432				float yz = float(gl_FragCoord.y - 0.5);     // contains  z, y faster moving
7433				div.y = getpart(yz, spatialDivisions);
7434				div.z = yz; // getpart(yz, spatialDivisions.z); // what's left, should be the same as getpart
7435
7436				float lx = float(gl_FragCoord.x - 0.5);     // contains x, lowi faster moving
7437				float lowi = getpart(lx, spatialn) * 96.;
7438				div.x = lx;
7439
7440				low = div / spatialDivisions * 2. - 1. - span;
7441				high = (div+1.) / spatialDivisions * 2. - 1. + span;
7442
7443				// find active range of spheres
7444				pc_FragColor.x = spatialKey(lowi);
7445				pc_FragColor.y = spatialKey(lowi+24.);
7446				pc_FragColor.z = spatialKey(lowi+48.);
7447				pc_FragColor.w = spatialKey(lowi+72.);
7448			}
7449		`,uniforms:this.spatialPassUniforms})}potentialPassMaterial(){return new OX({name:"PotentialPass",fragmentShader:`
7450			precision highp float;
7451			out vec4 pc_FragColor;
7452
7453			${OZ.shapeInput()}
7454			uniform sampler2D spatialPassTexture;
7455
7456			const float res = float(RES);
7457			const float VOXEL_RESOLUTION = pow(2., res);
7458			const float Z_LAYERS_PER_ROW = ceil(pow(2., res / 2.));
7459			const float VOXEL_RESOLUTION_SUB1 = VOXEL_RESOLUTION - 1.;
7460			const float INV_VOXEL_RESOLUTION = 1.0 / VOXEL_RESOLUTION;
7461
7462			uniform float npart;
7463			uniform float spatialn;
7464			const float spatialDivisions = ${this.spatialDivisions}.;
7465			const float spatialDivisions2 = spatialDivisions * spatialDivisions;
7466			const float spatialDivisionsSub1 = spatialDivisions - 1.;
7467
7468			${OZ.getpart}
7469
7470			vec3 packRGBAToVec3(vec4 color) {
7471				uint r = uint(color.r * 255.);
7472				uint g = uint(color.g * 255.);
7473				uint combined = (r << 8) | g; 
7474				return vec3(float(combined) * 0.00001525902, color.b, color.a); // 1/65535
7475			}
7476
7477			void applyQuaternionToVector(in vec4 q, inout vec3 v) {
7478				v += 2.0 * cross(q.xyz, cross(q.xyz, v) + q.w * v);
7479			}
7480
7481			/**
7482			 * SDF functions (reference: https://iquilezles.org/articles/distfunctions/)
7483			 */
7484
7485			// branchless version of "Smooth Union, Subtraction and Intersection - bound, bound, bound" in above reference
7486			float smoothOperation(float op, float sdf, float d, float k) {
7487			  //        union: op =  1 =>
7487 signSubtract =  1, signIntersection =  1
7488			  //     subtract: op = -1 => signSubtract = -1, signIntersection =  1
7489				// intersection: op = -2 => signSubtract = -1, signIntersection = -1
7490
7491				float signSubtract = clamp(op, -1., 1.);
7492				float signIntersection = 2. * (op - signSubtract) + 1.;
7493				float h = clamp(
7494					0.5 + signSubtract * 0.5 * (sdf - signSubtract * signIntersection * d) / k,
7495					0.0,
7496					1.0
7497				);
7498				return mix(sdf, signSubtract * signIntersection * d, h) - 
7499							 signSubtract * k * h * (1.0 - h);
7500			}
7501
7502			float sdSphere( vec3 p, float s )
7503			{
7504				return length(p)-s;
7505			}
7506
7507			float sdEllipsoid( vec3 p, vec3 r )
7508			{
7509				float k0 = length(p/r);
7510				float k1 = length(p/(r*r));
7511				return k0*(k0-1.0)/k1;
7512			}
7513
7514			float sdBox( vec3 p, vec3 b )
7515			{
7516				vec3 q = abs(p) - b;
7517				return length(max(q,0.0)) + min(max(q.x,max(q.y,q.z)),0.0);
7518			}
7519
7520			float sdTorus( vec3 p, vec2 t )
7521			{
7522				vec2 q = vec2(length(p.xy)-t.x,p.z);
7523				return length(q)-t.y;
7524			}
7525
7526			float sdCappedTorus( vec3 p, vec2 sc, float ra, float rb)
7527			{
7528				p.x = abs(p.x);
7529				float k = (sc.y*p.x>sc.x*p.y) ? dot(p.xy,sc) : length(p.xy);
7530				return sqrt( dot(p,p) + ra*ra - 2.0*ra*k ) - rb;
7531			}
7532
7533			float dot2( in vec2 v ) { return dot(v,v); }
7534			float sdCappedCone( vec3 p, float h, float r1, float r2 )
7535			{
7536				vec2 q = vec2( length(p.xz), p.y );
7537				vec2 k1 = vec2(r2,h);
7538				vec2 k2 = vec2(r2-r1,2.0*h);
7539				vec2 ca = vec2(q.x-min(q.x,(q.y<0.0)?r1:r2), abs(q.y)-h);
7540				vec2 cb = q - k1 + k2*clamp( dot(k1-q,k2)/dot2(k2), 0.0, 1.0 );
7541				float s = (cb.x<0.0 && ca.y<0.0) ? -1.0 : 1.0;
7542				return s*sqrt( min(dot2(ca),dot2(cb)) );
7543			}
7544
7545			float sdCappedCylinder( vec3 p, float h, float r )
7546			{
7547				vec2 d = abs(vec2(length(p.xz),p.y)) - vec2(r,h);
7548				return min(max(d.x,d.y),0.0) + length(max(d,0.0));
7549			}
7550
7551			float maxBlend = 0.0;
7552			// compute potential from A (=24) spheres, using the bit flags in 'activeKey'
7553			// to avoid lookup/compute for inactive spheres
7554			// return field potential, side effect updates track,
7555			// compute and return +ve and -ve values separately
7556			void fillSpatialInner(
7557				float ii,
7558				float activeKey,
7559				vec3 corner,
7560				inout float sdf,
7561				inout float colorDivisor,
7562				inout vec4 trackColor
7563			) {
7564				for (float i = 0.; i < 24.; i++) {
7565					if (activeKey < 1.) break; // activeKey exhausted, no more active spheres
7566					activeKey *= 0.5;
7567					if (fract(activeKey) < 0.5) continue;
7568
7569					float iin = (i + ii + 0.5) * 0.010416666666666666;
7570					vec4 shape = shapePos(iin);
7571					vec4 quat = shapeQuat(iin);
7572					vec4 params1 = shapeParams1(iin);
7573					vec4 params2 = shapeParams2(iin);
7574
7575					vec3 p = corner - shape.xyz;
7576					applyQuaternionToVector(quat, p);
7577					p /= params2.z; // scale
7578					float d; // d in -1..1 coordinates
7579					switch (int(params1.x)) {
7580						case 0: d = sdSphere(p, params1.y); break;
7581						case 1: d = sdEllipsoid(p, params1.yzw); break;
7582						case 2: d = sdBox(p, params1.yzw); break;
7583						case 3: d = sdCappedCylinder(p, params1.y, params1.z); break;
7584						case 4: d = sdCappedCone(p, params1.y, params1.z, params1.w); break;
7585						case 5: d = sdTorus(p, params1.yz); break;
7586						case 6: d = sdCappedTorus(p, params1.yz, params1.w, params2.w); break;
7587					}
7588					d -= params2.y; // rounded edge
7589					d *= params2.z; // scale
7590
7591					float k = params2.x;
7592					float op = shape.w;
7593
7594					sdf = smoothOperation(shape.w, sdf, d, k);
7595
7596					float isNegativeOne = step(-1.5, op) * step(op, -0.5); // 1 when op == -1, 0 otherwise
7597					float colorCull = smoothstep(maxBlend, 0., -d);
7598					float cullFactor = mix(1.0, colorCull, isNegativeOne);
7599					trackColor *= cullFactor;
7600					colorDivisor *= cullFactor;
7601
7602					maxBlend = max(maxBlend, k);
7603
7604					k += 2. * INV_VOXEL_RESOLUTION; // avoid division by zero, and other color artifacts with very small k
7605					float nearness = smoothstep(k, 0., d);
7606
7607					vec4 color = shapeColor(iin);
7608					nearness *= float(color.a >= 0.);
7609
7610					colorDivisor += nearness;
7611					trackColor += color * nearness;
7612				}
7613			}
7614
7615			vec3 div;
7616			// compute potential from all spheres; collect +ve and =ve values separately
7617			// work in blocks of A*4 (=96) spheres, using the bit flags in 4 float channel 'activeKey' values
7618			// TODO check if extra vec3 output useful, not really used at present
7619			float fillSpatial(vec3 corner, inout vec4 trackColor) {
7620				float sdf = 1e3; // hack: initialize to large value
7621				float colorDivisor = 0.;
7622				// spatialPassTexture holds x=> lowi, x faster moving and y=> z, y faster moving
7623				float divyz = (div.y + div.z * spatialDivisions + 0.5) / (spatialDivisions2);
7624				for (float ii = 0.; ii < spatialn; ii++) {
7625					float i = ii * 96.;
7626
7627					vec4 activeKey = texture(spatialPassTexture, vec2((div.x * spatialn + ii + 0.5)/(spatialn * spatialDivisions), divyz));
7628					fillSpatialInner(i, activeKey.x, corner, sdf, colorDivisor, trackColor);
7629					fillSpatialInner(i+24., activeKey.y, corner, sdf, colorDivisor, trackColor);
7630					fillSpatialInner(i+48., activeKey.z, corner, sdf, colorDivisor, trackColor);
7631					fillSpatialInner(i+72., activeKey.w, corner, sdf, colorDivisor, trackColor);
7632				}
7633
7634				trackColor /= colorDivisor;
7635				return mix(sdf, 0.0, step(1e20 - 0.1, sdf));
7636			}
7637
7638			void main() {
7639				${OZ.getxyzi}    // get xi yi zi from 2d position
7640
7641				vec3 xyzi = vec3(xi,yi,zi);
7642				vec3 corner = xyzi / VOXEL_RESOLUTION_SUB1 * 2. - 1.;  // -1..1 coords
7643
7644				div = floor(xyzi / VOXEL_RESOLUTION_SUB1 * spatialDivisionsSub1);
7645
7646				vec4 c = vec4(0.);
7647				float t = fillSpatial(corner, c);
7648
7649				pc_FragColor = vec4(t, packRGBAToVec3(c)); // RGB texture
7650			}
7651		`,uniforms:this.potentialPassUniforms})}voxelPassMaterial(){return new OX({name:"VoxelPass",fragmentShader:`
7652			precision highp float;
7653			layout(location = 0) out vec4 pc_FragColor;
7654			layout(location = 1) out vec4 numTris;
7655
7656			const float res = float(RES);
7657			const float VOXEL_RESOLUTION = pow(2., res);
7658			const float VOXEL_RESOLUTION_SUB1 = VOXEL_RESOLUTION - 1.; 
7659			const float Z_LAYERS_PER_ROW = ceil(pow(2., res / 2.));
7660			const float INV_VOXEL_RESOLUTION = 1.0 / VOXEL_RESOLUTION;
7661			uniform sampler2D numTrisTable; // 256 x 1
7662
7663			float keyi(float f000, float f100, float f010, float f110, float f001, float f101, float f011, float f111) {
7664				return (float(f000 < 0.) * 1.) +
7665							 (float(f100 < 0.) * 2.) +
7666							 (float(f010 < 0.) * 8.) +
7667							 (float(f110 < 0.) * 4.) +
7668							 (float(f001 < 0.) * 16.) +
7669							 (float(f101 < 0.) * 32.) +
7670							 (float(f011 < 0.) * 128.) +
7671							 (float(f111 < 0.) * 64.);
7672			}
7673
7674			${OZ.lookup}
7675
7676			vec3 compNormi(float xi, float yi, float zi) {
7677				float dx = look(xi + 1., yi, zi, potentialPassTexture).r - look(xi - 1., yi, zi, potentialPassTexture).r;
7678				float dy = look(xi, yi + 1., zi, potentialPassTexture).r - look(xi, yi - 1., zi, potentialPassTexture).r;
7679				float dz = look(xi, yi, zi + 1., potentialPassTexture).r - look(xi, yi, zi - 1., potentialPassTexture).r;
7680				// if we allow (common) 0,0,0 case through then NaN can spread
7681				// eg r = vec4(compNorm i(???), 1.) will pollute r.w
7682				if (dx == 0.0 && dy == 0.0 && dz == 0.0) {
7683					return vec3(0.199, 0.299, 0.399);
7684				}
7685				return normalize(vec3(dx, dy, dz));
7686			}
7687
7688			void main() {
7689				${OZ.getxyzi}    // get xi yi zi from 2d
7690
7691				vec3 normal = compNormi(xi, yi, zi);  // even if our key is -1 this may be needed by a neighbouring voxel
7692
7693				if (xi >= VOXEL_RESOLUTION_SUB1 || yi >= VOXEL_RESOLUTION_SUB1 || zi >= VOXEL_RESOLUTION_SUB1) {
7694					pc_FragColor = vec4(normal, 0.);
7695					numTris = vec4(0.);
7696					return;
7697				}
7698
7699				float
7700					f000 = look(xi, yi, zi, potentialPassTexture).r,
7701					f100 = look(xi+1., yi, zi, potentialPassTexture).r,
7702					f010 = look(xi, yi+1., zi, potentialPassTexture).r,
7703					f110 = look(xi+1., yi+1., zi, potentialPassTexture).r,
7704					f001 = look(xi, yi, zi+1., potentialPassTexture).r,
7705					f101 = look(xi+1., yi, zi+1., potentialPassTexture).r,
7706					f011 = look(xi, yi+1., zi+1., potentialPassTexture).r,
7707					f111 = look(xi+1., yi+1., zi+1., potentialPassTexture).r;
7708				float key = keyi(f000, f100, f010, f110, f001, f101, f011, f111);
7709
7710				pc_FragColor = vec4(normal, key);
7711
7712				numTris = texture(numTrisTable, vec2((key + 0.5) / 256., 0.5));
7713			}
7714		`,uniforms:this.voxelPassUniforms})}
vendor: 8,048 bytes, lines 7714-7950
7714patchVertexShaderForShapeBlend(e){let t=`
7715		#ifdef SHAPEBLEND 
7716			precision highp sampler2D;
7717
7718			uniform float isol;
7719
7720			uniform sampler2D triTable;     // 256 x 16
7721			uniform sampler2D pyramidTexture1;
7722			uniform vec2 pyramidTexture1Size;
7723			uniform sampler2D pyramidTexture2;
7724			uniform vec2 pyramidTexture2Size;
7725
7726			const vec2 halfPixelOffset = vec2(0.5, 0.5);
7727
7728			const vec2 rShift = vec2(0., 1.);
7729			const vec2 gShift = vec2(1., 1.);
7730			const vec2 bShift = vec2(1., 0.);
7731
7732			const float res = float(RES);
7733			const float VOXEL_RESOLUTION = pow(2., res);
7734			const float Z_LAYERS_PER_ROW = ceil(pow(2., res / 2.));
7735			const float INV_VOXEL_RESOLUTION = 1.0 / VOXEL_RESOLUTION;
7736
7737			const float scale_factor = 2.;
7738
7739			#if SHAPEBLEND == 5
7740				const float levelShiftX[7] = float[7](4., 6., 12., 24., 48., 96., 192.);
7741				const float scale = 8. * scale_factor;
7742				const vec3 originOffset = vec3(16.);
7743			#elif SHAPEBLEND == 7
7744				const float levelShiftX[10] = float[10](4., 6., 12., 24., 48., 96., 192., 384., 768., 1536.); 
7745				const float scale = 2. * scale_factor;
7746				const vec3 originOffset = vec3(64.);
7747			#elif SHAPEBLEND == 8
7748				const float levelShiftX[11] = float[11](4., 8., 16., 32., 64., 128., 256., 512., 1024., 2048., 4096.);
7749				const float scale = scale_factor;
7750				const vec3 originOffset = vec3(128.);
7751			#else
7752				const float levelShiftX[8] = float[8](4., 8., 16., 32., 64., 128., 256., 512.);
7753				const float scale = 4. * scale_factor;
7754				const vec3 originOffset = vec3(32.);
7755			#endif
7756
7757			${OZ.lookup}
7758
7759			const vec3 offsets[24] = vec3[](
7760				vec3(0., 0., 0.), vec3(1., 0., 0.),
7761				vec3(1., 0., 0.), vec3(1., 1., 0.),
7762				vec3(0., 1., 0.), vec3(1., 1., 0.),
7763				vec3(0., 0., 0.), vec3(0., 1., 0.),
7764				vec3(0., 0., 1.), vec3(1., 0., 1.),
7765				vec3(1., 0., 1.), vec3(1., 1., 1.),
7766				vec3(0., 1., 1.), vec3(1., 1., 1.),
7767				vec3(0., 0., 1.), vec3(0., 1., 1.),
7768				vec3(0., 0., 0.), vec3(0., 0., 1.),
7769				vec3(1., 0., 0.), vec3(1., 0., 1.),
7770				vec3(1., 1., 0.), vec3(1., 1., 1.),
7771				vec3(0., 1., 0.), vec3(0., 1., 1.)
7772			);
7773
7774			vec2 computeShiftedPosition1(vec2 xy, float levelOriginX) {
7775				vec2 xyShifted = xy;
7776				xyShifted.x += levelOriginX;
7777				return (xyShifted + halfPixelOffset) / pyramidTexture1Size;
7778			}
7779
7780			vec2 computeShiftedPosition2(vec2 xy, float levelOriginX) {
7781				vec2 xyShifted = xy;
7782				xyShifted.x += levelOriginX;
7783				return (xyShifted + halfPixelOffset) / pyramidTexture2Size;
7784			}
7785
7786			vec4 unpackVec3ToRGBA(vec3 vec) {
7787				uint combined = uint(vec.x * 65535.0 + 0.5); // Add 0.5 for rounding
7788				float g = float(combined & uint(0xFF)) * 0.00392156862; // 1/255
7789				float r = float((combined >> 8) & uint(0xFF)) * 0.00392156862; 
7790		
7791				return vec4(r, g, vec.y, vec.z);
7792			}
7793
7794			out vec4 marchColor;
7795			// end of marchvertPre
7796		#endif
7797		`,i=`
7798		#ifdef SHAPEBLEND
7799			float triIndex = floor(float(gl_VertexID/3));
7800			float vertexIndex = float(gl_VertexID);
7801			
7802			// Initial pyramid lookup
7803			float levelOriginX1 = pyramidTexture1Size.x - 2.;
7804			float levelOriginX2 = pyramidTexture2Size.x - 1.;
7805			vec2 xy = vec2(0.);
7806			vec4 lookUp = texture(pyramidTexture2, computeShiftedPosition2(xy, levelOriginX2));
7807			
7808			// Early exit check
7809			if (triIndex >= lookUp.r) return;
7810			
7811			// Optimize loop variables
7812			float start = 0.;
7813			vec4 triIndexVec = vec4(triIndex);
7814			
7815			// Main position computation loop
7816			for (int i = 0; i < LOOP;) {
7817				// Compute boundaries
7818				vec4 ends = lookUp + vec4(start);
7819				vec4 starts = vec4(ends.gba, start);
7820				vec4 check = vec4(greaterThanEqual(triIndexVec, starts)) * 
7821											vec4(lessThan(triIndexVec, ends));
7822				
7823				// Update position
7824				xy *= 2.;
7825				xy += check.r * rShift + check.g * gShift + check.b * bShift;
7826				
7827				// Update loop variables
7828				start = dot(check, starts);
7829				levelOriginX2 -= levelShiftX[i];
7830				
7831				// Update lookup
7832				lookUp = texture(pyramidTexture1, computeShiftedPosition1(xy, levelOriginX1));
7833				i++;
7834
7835				ends = lookUp + vec4(start);
7836				starts = vec4(ends.gba, start);
7837				check = vec4(greaterThanEqual(triIndexVec, starts)) * 
7838											vec4(lessThan(triIndexVec, ends));
7839				
7840				// Update position
7841				xy *= 2.;
7842				xy += check.r * rShift + check.g * gShift + check.b * bShift;
7843				
7844				// Update loop variables
7845				start = dot(check, starts);
7846				levelOriginX1 -= levelShiftX[i];
7847				
7848				// Update lookup
7849				lookUp = texture(pyramidTexture2, computeShiftedPosition2(xy, levelOriginX2));
7850
7851				i++;
7852			}
7853
7854			#if HALF == 1
7855				vec4 ends = lookUp + vec4(start);
7856				vec4 starts = vec4(ends.gba, start);
7857				vec4 check = vec4(greaterThanEqual(triIndexVec, starts)) * vec4(lessThan(triIndexVec, ends));
7858			
7859				// Update position
7860				xy *= 2.;
7861				xy += check.r * rShift + check.g * gShift + check.b * bShift;
7862			
7863				// Update loop variables
7864				start = dot(check, starts);
7865			#endif
7866			
7867			// Compute final coordinates
7868			vec3 gridPos;
7869			gridPos.x = mod(xy.x, VOXEL_RESOLUTION);
7870			gridPos.y = mod(xy.y, VOXEL_RESOLUTION);
7871			gridPos.z = floor(xy.x * INV_VOXEL_RESOLUTION) + 
7872									floor(xy.y * INV_VOXEL_RESOLUTION) * Z_LAYERS_PER_ROW;
7873			
7874			// Vertex key computation
7875			vertexIndex -= start * 3.;
7876			float vk = vertexIndex * 0.0625 + 0.03125; // Optimized division by 16 and addition of 1/32
7877			
7878			// Voxel lookup and edge computation
7879			vec4 voxel = look(gridPos.x, gridPos.y, gridPos.z, voxelPassTexture);
7880			float key = (voxel.w + 0.5) * 0.00390625; // Optimized division by 256
7881			
7882			// Edge lookup and offset computation
7883			float edgeNum = texture(triTable, vec2(vk, key)).x;
7884			int edgeIndex = int(edgeNum) * 2;
7885			
7886			// Compute edge positions
7887			vec3 p1 = gridPos + offsets[edgeIndex];
7888			vec3 p2 = gridPos + offsets[edgeIndex + 1];
7889			
7890			// Compute potentials and normals
7891			vec4 potential1 = look(p1.x, p1.y, p1.z, potentialPassTexture);
7892			vec4 potential2 = look(p2.x, p2.y, p2.z, potentialPassTexture);
7893			
7894			// Final position and normal computation
7895			float mu = potential1.r / (potential1.r - potential2.r);
7896
7897			marchColor = mix(
7898				unpackVec3ToRGBA(potential1.gba),
7899				unpackVec3ToRGBA(potential2.gba),
7900				mu
7901			);
7902
7903			transformed = p1 + (p2 - p1) * mu;
7904			transformed -= originOffset;
7905			transformed *= scale;
7906			vec4 data1 = look(p1.x, p1.y, p1.z, voxelPassTexture);
7907			vec4 data2 = look(p2.x, p2.y, p2.z, voxelPassTexture);
7908			objectNormal = normalize(mix(data1.xyz, data2.xyz, mu));
7909			transformedNormal = normalMatrix * objectNormal;
7910			#ifndef FLAT_SHADED
7911				vNormal = transformedNormal;
7912			#endif
7913		#endif
7914		`;e.vertexShader=t+e.vertexShader.replace("#include <project_vertex>",i+`
7915#include <project_vertex>`);let r=e.fragmentShader.match(/vec3 diffuseColor[^\n]*\n/);if(!r)return;let s=`
7916		#ifdef SHAPEBLEND_C
7917			#if SHAPEBLEND_C == 1
7918				${r[0].replace(/nodeU0,/g,"marchColor.rgb,").replace(/nodeU\d+(?=,g_uid\d+_calpha\))/g,"marchColor.a")}
7919			#else
7920				${r[0]}
7921			#endif
7922		#else
7923			${r[0]}
7924		#endif
7925		`;e.fragmentShader=`in vec4 marchColor;
7926`+e.fragmentShader.replace(r[0],s),Object.assign(e.uniforms,this.marchPassUniforms)}initDebugPass(e){console.log("fboToDebug.width",e.width,e.height),this.geometry=new sc(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=e=>{e.vertexShader=`
7927				precision highp float;
7928
7929				varying vec2 vUv;
7930
7931				void main() {
7932						gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
7933						vUv = uv;
7934				}
7935			`,e.fragmentShader=`
7936				layout(location = 1) out vec4 gVelocity;
7937
7938				precision highp float;
7939				
7940				uniform sampler2D inputTexture;
7941				varying vec2 vUv;
7942
7943				uniform vec2 pyramidTextureSize;
7944
7945				void main() {
7946						// Sample the input texture using UV coordinates
7947						gl_FragColor = texture(inputTexture, vUv);
7948						gVelocity = vec4(0.0);
7949				}
7950			`,t.pyramidTextureSize.value=new tZ(this.pyramidRenderTarget.width,this.pyramidRenderTarget.height),Object.assign(e.uniforms,t)};this.material.shapeBlendhack=i,this.material.root.shapeBlendhack=i}},OJ=OK;OJ.streamCompaction=new OQ;
7950var O$=new iY,O0=new iY,O1=new iv,O2=new iy,O3=new iy,O4=new iv;function O5(e,t=0){let i=this.children.length;for(;i--;){let r=this.children[i];b4.is(r)&&O6.call(r,e,t+1)}}function O6(e,t=0){if(!0!==e(this,t)){let i=this.children.length;for(;i--;){let r=this.children[i];b4.is(r)&&O6.call(r,e,t+1)}}}function O8(){if(void 0===this.shapesDataTexture.value){let e=new nM(new Float32Array(1920),96,5,1023,1015);this.shapesDataTexture.value=e}let e=this.shapesDataTexture.value,t=e.image.data;e.needsUpdate=!0;let i=0,r=this.data.geometry.blendRange,s=O$.copy(this.matrixWorld).invert(),a=0;O5.call(this,e=>{let o;if(!1===e.visible)return!0;if(e instanceof AZ||e instanceof Tx||e instanceof OW)return;o=e instanceof wr?e.object:e;let h=e.data?.cloner;if(SL.is(e)&&h&&!h.hideBase&&"radial"!==h.type&&!0!==h.disabled||!(o instanceof Al))return;let c=o.geometry.userData.parameters,d=c.shapeBlendNode;if(void 0===d)return;if(O0.multiplyMatrices(s,e.matrixWorld).decompose(O3,O1,O2),"TorusGeometry"===c.type&&360!==c.arc){let e=c.arc*Math.PI/180;e/=4,O1.multiply(O4.set(0,0,Math.sin(e),Math.cos(e)))}let u=d.overrideGlobalBlend?d.blendRange:r;u=u/this.bboxSize*2,t[4*a]=(O3.x-this.bboxOffset)/this.bboxSize*2,t[4*a+1]=(O3.y-this.bboxOffset)/this.bboxSize*2,t[4*a+2]=(O3.z-this.bboxOffset)/this.bboxSize*2,t[4*a+3]=0===d.operation?1:2===d.operation?-1:-2,t[384+4*a]=-O1.x,t[384+4*a+1]=-O1.y,t[384+4*a+2]=-O1.z,t[384+4*a+3]=O1.w;let p=new Float32Array(4),f=0;if("SphereGeometry"===c.type)c.width===c.height&&c.width===c.depth?p[0]=0:p[0]=1,p[1]=c.width/this.bboxSize,p[2]=c.height/this.bboxSize,p[3]=c.depth/this.bboxSize,i=Math.max(i,p[1]*O2.x+u,p[2]*O2.x+u,p[3]*O2.x+u);else if("CubeGeometry"===c.type){f=c.cornerRadius;let e=c.width,t=c.height,r=c.depth;p[0]=2,p[1]=(e-2*f)/this.bboxSize,p[2]=(t-2*f)/this.bboxSize,p[3]=(r-2*f)/this.bboxSize,i=Math.max(i,Math.sqrt(e**2+t**2+r**2)/this.bboxSize*O2.x+u)}else if("CylinderGeometry"===c.type){f=c.cornerRadius;let e=c.height,t=c.radiusBottom,r=c.radiusTop;if(r>=t){let i=(Math.PI/2-Math.atan2(r-t,e))/2;r-=f/Math.tan(i),t-=f*Math.tan(i)}else if(t>r){let i=(Math.PI/2-Math.atan2(t-r,e))/2;r-=f*Math.tan(i),t-=f/Math.tan(i)}p[1]=(c.height-2*f)/this.bboxSize,t===r?(p[0]=3,p[2]=t/this.bboxSize*2):(p[0]=4,p[2]=t/this.bboxSize*2,p[3]=r/this.bboxSize*2),i=Math.max(i,4*p[1]*O2.x+u)}else if("TorusGeometry"===c.type){if(p[0]=5,p[1]=(c.width-c.depth)/this.bboxSize,p[2]=c.depth/this.bboxSize,360!==c.arc){p[0]=6,p[3]=p[1],t[1152+4*a+3]=p[2];let e=2*Math.atan2(p[2]/2,p[1]),i=c.arc*Math.PI/180/2-e;p[1]=Math.sin(i),p[2]=Math.cos(i)}i=Math.max(i,c.width*O2.x/this.bboxSize+u)}t.set(p,768+4*a),t[1152+4*a]=u,t[1152+4*a+1]=f/this.bboxSize*2,t[1152+4*a+2]=O2.x;let m=o.material,g=m.uniforms.nodeU0.node.value,v=m.uniforms.nodeU1.value;0===d.operation||d.useColor||(v=-1),t[1536+4*a]=g.r,t[1536+4*a+1]=g.g,t[1536+4*a+2]=g.b,t[1536+4*a+3]=v,v<1&&1===this.material.defines.SHAPEBLEND_C&&(this.material.transparent=!0),a++}),this.npart=a,this.spatialPassUniforms.span.value=1.4*i}function O9(e,t){let i=!1,r=512&e.layers.mask,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,Ac(e),Ah(e)),0===s.length&&0===a.length&&e.layers.set(0),r&&e.layers.set(9),e instanceof Ai&&e.needsAO&&e.layers.enable(5),i}function O7(e,t){if(!t.layers)return!1;let i=512&e.layers.mask,r=!1,s=t.getLayersOfType("transmission").filter(e=>e.data.visible),a=t.getLayersOfType("outline").filter(e=>e.data.visible);return s.length>0&&(e.layers.set(3),a.length>0&&e.layers.enable(8),r=!0),0===s.length&&0===a.length&&e.layers.set(0),i&&e.layers.set(9),e.needsAO&&e.layers.enable(5),r}var Le=new lO,Lt=new iY,Li=new iX;function Lr(e,t,i,r=!1){let s=e.cloner;if(s)for(let a of s.children){let s=Lt.copy(a.matrixWorld).invert(),o=Li.copy(t.ray).applyMatrix4(s),h=e.matrixWorld;o.applyMatrix4(h),Le.set(o.origin,o.direction),Le.near=t.near,Le.far=t.far;let c=Le.intersectObject(e,!1);c.length>0&&i.push({...c[0],object:r?a:e})}}var Ls=class{constructor(){this._constraints=new Map}setConstraint(e,t){null===t?this._constraints.delete(e):this._constraints.set(e,t)}removeDependencies(e){this._constraints.delete(e)}
7950applyConstraints(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 i=s.length-2;i>=0;i--)if(!t.has(s[i])){let r=e.find(s[i]);r?r.applyPathSnapping(e):console.warn(`missing entity ${s[i]}`),t.add(s[i])}})}findDependency(e,t){let i=e;for(;this._constraints.has(i);)if((i=this._constraints.get(i))===t)return!0;return!1}},La=class{};function Ln(e){let t,i,r,s,a,o,h,c,d,u,p,f,m,g,v;function y(e,t,o){let h=new Float32Array(u,a,3*i);r=0;let c=new Uint32Array(u,s,i);for(let i=0;i<o.length-1;i++){let s=t[i],a=e[i].elements,d=s.filter(e=>e.enabled&&"Include"===e.mode).map(e=>"Box"===e.type?b(e):_(e)),u=s.filter(e=>e.enabled&&"Exclude"===e.mode).map(e=>"Box"===e.type?b(e):_(e));for(let e=o[i];e<o[i+1];e++){let t=f[3*e],i=f[3*e+1],s=f[3*e+2];if((0===d.length||x(t,i,s,d))&&(0===u.length||!x(t,i,s,u))){let o=1/(a[3]*t+a[7]*i+a[11]*s+a[15]);h[3*r]=(a[0]*t+a[4]*i+a[8]*s+a[12])*o,h[3*r+1]=(a[1]*t+a[5]*i+a[9]*s+a[13])*o,h[3*r+2]=(a[2]*t+a[6]*i+a[10]*s+a[14])*o,c[r]=e,r++}}}}function x(e,t,i,r,s){return r["Intersect"===s?"every":"some"](r=>{var s,a,o,h,c,d,u,p,f,m,g,v,y;let x,b,w,_,S,C,M,E=(s=e,a=t,o=i,h=r.invRotationMatrix,x=s-(c=r.cropCenter)[0],b=a-c[1],w=o-c[2],_=1/(h[3]*x+h[7]*b+h[11]*w+h[15]),{x:(h[0]*x+h[4]*b+h[8]*w+h[12])*_+c[0],y:(h[1]*x+h[5]*b+h[9]*w+h[13])*_+c[1],z:(h[2]*x+h[6]*b+h[10]*w+h[14])*_+c[2]});return Array.isArray(r)?(d=E.x,u=E.y,p=E.z,d>=(f=r)[0]&&d<=f[3]&&u>=f[1]&&u<=f[4]&&p>=f[2]&&p<=f[5]):(m=E.x,g=E.y,v=E.z,S=(m-(y=r).cropCenter[0])*y.invRadiusX,C=(g-y.cropCenter[1])*y.invRadiusY,S*S+C*C+(M=(v-y.cropCenter[2])*y.invRadiusZ)*M<=1)})}function b(e){let t=e.cropSize[0]/2,i=e.cropSize[1]/2,r=e.cropSize[2]/2;return Object.assign([e.cropCenter[0]-t,e.cropCenter[1]-i,e.cropCenter[2]-r,e.cropCenter[0]+t,e.cropCenter[1]+i,e.cropCenter[2]+r],{invRotationMatrix:w(e.cropRotation),cropCenter:e.cropCenter})}function w(e){let t=[],i=e[0]*Math.PI/180,r=e[1]*Math.PI/180,s=e[2]*Math.PI/180,a=Math.cos(i),o=Math.sin(i),h=Math.cos(r),c=Math.sin(r),d=Math.cos(s),u=Math.sin(s),p=a*d,f=a*u,m=o*d,g=o*u;return t[0]=h*d,t[1]=-h*u,t[2]=c,t[4]=f+m*c,t[5]=p-g*c,t[6]=-o*h,t[8]=g-p*c,t[9]=m+f*c,t[10]=a*h,t[12]=0,t[13]=0,t[14]=0,t[3]=0,t[7]=0,t[11]=0,t[15]=1,t}function _(e){let t=2/e.cropSize[0],i=2/e.cropSize[1],r=2/e.cropSize[2],s=w(e.cropRotation);return{invRadiusX:t,invRadiusY:i,invRadiusZ:r,cropCenter:e.cropCenter,invRotationMatrix:s}}e.onmessage=w=>{if(w.data.getCroppedIndexes){let t=new Uint32Array(function(e,t){let i=[],r=t.filter(e=>e.enabled&&"Include"===e.mode).map(e=>"Box"===e.type?b(e):_(e)),s=t.filter(e=>e.enabled&&"Exclude"===e.mode).map(e=>"Box"===e.type?b(e):_(e)),a=e.length;for(let t=0;t<a;t+=3){let a=e[t],o=e[t+1],h=e[t+2];(0===r.length||x(a,o,h,r))&&(0===s.length||!x(a,o,h,s))||i.push(t/3)}return i}(new Float32Array(w.data.positions),w.data.crops)).buffer;e.postMessage({outOfBoundsIndexes:t},[t])}else if(w.data.positions)f=new Float32Array(w.data.positions),g=w.data.meshMatrixWorlds,v=w.data.cropsArray,m=w.data.meshIndexIntervals,y(g,v,m),e.postMessage({sortSetupComplete:!0});else if(w.data.sort||w.data.newMatrixWorlds||w.data.newCropsArray)(w.data.newMatrixWorlds||w.data.newCropsArray)&&(v=w.data.newCropsArray||v,y(g=w.data.newMatrixWorlds||g,v,m)),function(f){let m,g=new Float64Array(u,o,16);for(let e=0;e<16;e++)g[e]=f[e];if(r>1){t.exports.sortIndexes(s,a,d,o,h,c,p.DepthMapRange,r);let e=new Uint32Array(r);m=e.buffer,e.set(new Uint32Array(u,c,r))}else if(1===r){let e=new Uint32Array(r);e[0]=new Uint32Array(u,s,i)[0],m=e.buffer}else m=new ArrayBuffer(0);e.postMessage({sortDone:!0,indexesBuffer:m},[m])}(w.data.sort.view,w.data.sort.cameraPosition);else if(w.data.init){p=w.data.init.Constants,i=w.data.init.splatCount;let r=p.BytesPerInt,f=3*p.BytesPerFloat,m=new Uint8Array(w.data.init.sorterWasmBytes),g=Math.floor((i*(r+f)+(i*p.BytesPerInt*2+p.DepthMapRange*p.BytesPerInt*2)+32*p.MemoryPageSize)/p.MemoryPageSize)+1,v={module:{},env:{memory:new WebAssembly.Memory({initial:2*g,maximum:3*g,shared:!0})}};WebAssembly.compile(m).then(e=>WebAssembly.instantiate(e,v)).then(m=>{t=m,s=0,c=(h=(d=(o=(a=i*r)+i*f)+16*p.BytesPerFloat*2)+i*p.BytesPerInt)+p.DepthMapRange*p.BytesPerInt,u=v.env.memory.buffer,e.postMessage({sortSetupPhase1Complete:!0})})}}}tC(La,"DepthMapRange",65536),tC(La,"MemoryPageSize",65536),tC(La,"BytesPerFloat",4),tC(La,"BytesPerInt",4);var Lo=(tr=new Int32Array((ti=new Float32Array(1)).buffer),function(e){return ti[0]=e,tr[0]}),Ll=new tZ;function Lh(e){let t=!1;
vendor: 5,910 bytes, lines 7950-8056
7950return e.scene.objects.traverse((e,i)=>{if(!1===i.visible)return!0;"Splat"===i.type&&(t=!0)}),t}var Lc,Ld,Lu,Lp,Lf,Lm=class extends rK{constructor(e,t,i,r,s=!1,a=1,o,h){super(i,r),this.splatCount=t,this.meshIndexIntervals=o,this.meshMatrixWorlds=h,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 o=Lm.buildGeomtery(t),h=Lm.buildMaterial(s);return new Lm(e,t,o,h,i,r,s,a)}static buildMaterial(e){let t=`
7951            precision highp float;
7952            #include <common>
7953
7954            attribute uint splatIndex;
7955
7956            uniform highp sampler2D covariancesTexture;
7957            uniform highp usampler2D centersColorsTexture;
7958            uniform vec2 focal;
7959            uniform vec2 viewport;
7960            uniform vec2 basisViewport;
7961            uniform vec2 covariancesTextureSize;
7962            uniform vec2 centersColorsTextureSize;
7963						uniform highp sampler2D meshMatrixWorldsTexture;
7964						uniform uint meshIndexIntervals[257];
7965						uniform float orthoZoom;
7966
7967            varying vec4 vColor;
7968            varying vec2 vUv;
7969
7970            varying vec2 vPosition;
7971
7972            const vec4 encodeNorm4 = vec4(1.0 / 255.0, 1.0 / 255.0, 1.0 / 255.0, 1.0 / 255.0);
7973            const uvec4 mask4 = uvec4(uint(0x000000FF), uint(0x0000FF00), uint(0x00FF0000), uint(0xFF000000));
7974            const uvec4 shift4 = uvec4(0, 8, 16, 24);
7975            vec4 uintToRGBAVec (uint u) {
7976               uvec4 urgba = mask4 & u;
7977               urgba = urgba >> shift4;
7978               vec4 rgba = vec4(urgba) * encodeNorm4;
7979               return rgba;
7980            }
7981
7982            vec2 getDataUV(in int stride, in int offset, in vec2 dimensions) {
7983                vec2 samplerUV = vec2(0.0, 0.0);
7984                float d = float(splatIndex * uint(stride) + uint(offset)) / dimensions.x;
7985                samplerUV.y = float(floor(d)) / dimensions.y;
7986                samplerUV.x = fract(d);
7987                return samplerUV;
7988            }
7989
7990            void main () {
7991                uvec4 sampledCenterColor = texture(centersColorsTexture, getDataUV(1, 0, centersColorsTextureSize));
7992                vec3 splatCenter = uintBitsToFloat(uvec3(sampledCenterColor.gba));
7993                vColor = uintToRGBAVec(sampledCenterColor.r);
7994
7995                vPosition = position.xy * 2.0;
7996
7997								uint meshIndex;
7998								for (int i = 1; i < 257; i++) {
7999									if (splatIndex < meshIndexIntervals[i]) {
8000										meshIndex = uint(i - 1);
8001										break;
8002									}
8003								}
8004
8005								float strideMulmeshIndex = float(4u*meshIndex);
8006								float meshMatrixWorldsTextureLength = float(256*4);
8007
8008								mat4 modelMat = mat4(
8009									texture(meshMatrixWorldsTexture, vec2((strideMulmeshIndex+0.0)/meshMatrixWorldsTextureLength, 0)),
8010									texture(meshMatrixWorldsTexture, vec2((strideMulmeshIndex+1.0)/meshMatrixWorldsTextureLength, 0)),
8011									texture(meshMatrixWorldsTexture, vec2((strideMulmeshIndex+2.0)/meshMatrixWorldsTextureLength, 0)),
8012									texture(meshMatrixWorldsTexture, vec2((strideMulmeshIndex+3.0)/meshMatrixWorldsTextureLength, 0))
8013								);
8014								mat4 modelViewMat = viewMatrix * modelMat;
8015								vec4 viewCenter = modelViewMat * vec4(splatCenter, 1.0); 
8016                vec4 clipCenter = projectionMatrix * viewCenter;
8017
8018                vec2 sampledCovarianceA = texture(covariancesTexture, getDataUV(3, 0, covariancesTextureSize)).rg;
8019                vec2 sampledCovarianceB = texture(covariancesTexture, getDataUV(3, 1, covariancesTextureSize)).rg;
8020                vec2 sampledCovarianceC = texture(covariancesTexture, getDataUV(3, 2, covariancesTextureSize)).rg;
8021
8022                vec3 cov3D_M11_M12_M13 = vec3(sampledCovarianceA.rg, sampledCovarianceB.r);
8023                vec3 cov3D_M22_M23_M33 = vec3(sampledCovarianceB.g, sampledCovarianceC.rg);
8024
8025                // Compute the 2D covariance matrix from the upper-right portion of the 3D covariance matrix
8026                mat3 Vrk = mat3(
8027                    cov3D_M11_M12_M13.x, cov3D_M11_M12_M13.y, cov3D_M11_M12_M13.z,
8028                    cov3D_M11_M12_M13.y, cov3D_M22_M23_M33.x, cov3D_M22_M23_M33.y,
8029                    cov3D_M11_M12_M13.z, cov3D_M22_M23_M33.y, cov3D_M22_M23_M33.z
8030                );
8031                float s = 1.0 / (viewCenter.z * viewCenter.z);
8032
8033                mat3 W = transpose(mat3(modelViewMat));
8034                mat3 T = orthoZoom > 0.0 ? W : W * mat3(
8035									focal.x / viewCenter.z, 0., -(focal.x * viewCenter.x) * s,
8036									0., focal.y / viewCenter.z, -(focal.y * viewCenter.y) * s,
8037									0., 0., 0.
8038								);
8039                mat3 cov2Dm = transpose(T) * Vrk * T;
8040                cov2Dm[0][0] += 0.3;
8041                cov2Dm[1][1] += 0.3;
8042
8043                // We are interested in the upper-left 2x2 portion of the projected 3D covariance matrix because
8044                // we only care about the X and Y values. We want the X-diagonal, cov2Dm[0][0],
8045                // the Y-diagonal, cov2Dm[1][1], and the correlation between the two cov2Dm[0][1]. We don't
8046                // need cov2Dm[1][0] because it is a symetric matrix.
8047                vec3 cov2Dv = vec3(cov2Dm[0][0], cov2Dm[0][1], cov2Dm[1][1]);
8048
8049                vec3 ndcCenter = clipCenter.xyz / clipCenter.w;
8050
8051                // We now need to solve for the eigen-values and eigen vectors of the 2D covariance matrix
8052                // so that we can determine the 2D basis for the splat. This is done using the method described
8053                // here: https://people.math.harvard.edu/~knill/teaching/math21b2004/exhibits/2dmatrices/index.html
8054                //
8055                // This is a different approach than in the original work at INRIA. In that work they compute the
8056                // max extents of the 2D covariance matrix in screen space to form an axis aligned boun
8056ding rectangle
8057                // which forms the geometry that is actually rasterized. They then use the inverse 2D covariance
8058                // matrix (called 'conic') to determine fragment opacity.
8059                float a = cov2Dv.x;
8060                float d = cov2Dv.z;
8061                float b = cov2Dv.y;
8062                float D = a * d - b * b;
8063                float trace = a + d;
8064                float traceOver2 = 0.5 * trace;
8065                float term2 = sqrt(trace * trace / 4.0 - D);
8066                float eigenValue1 = traceOver2 + term2;
8067								float eigenValue2 = max(traceOver2 - term2, 0.00); // prevent negative eigen value
8068
8069                const float maxSplatSize = 1024.0;
8070                vec2 eigenVector1 = normalize(vec2(b, eigenValue1 - a));
8071                // since the eigen vectors are orthogonal, we derive the second one from the first
8072                vec2 eigenVector2 = vec2(eigenVector1.y, -eigenVector1.x);
8073                vec2 basisVector1 = eigenVector1 * min(sqrt(2.0 * eigenValue1), maxSplatSize);
8074                vec2 basisVector2 = eigenVector2 * min(sqrt(2.0 * eigenValue2), maxSplatSize);
8075
8076                vec2 ndcOffset = vec2(vPosition.x * basisVector1 + vPosition.y * basisVector2) * basisViewport;
8077
8078								if (orthoZoom > 0.0) {
8079									ndcOffset *= orthoZoom;
8080								}
8081
8082                gl_Position = vec4(ndcCenter.xy + ndcOffset, ndcCenter.z, 1.0);
8083            }`,i=`
8084            precision highp float;
8085            #include <common>
8086
8087            uniform vec3 debugColor;
8088
8089            varying vec4 vColor;
8090            varying vec2 vUv;
8091
8092            varying vec2 vPosition;
8093						layout(location = 1) out vec4 gVelocity; 
8094
8095            void main () {
8096                // compute the negative squared distance from the center of the splat to the
8097                // current fragment in the splat's local space.
8098                float A = -dot(vPosition, vPosition);
8099                if (A < -4.0) discard;
8100                vec3 color = vColor.rgb;
8101                A = exp(A) * vColor.a;
8102                gl_FragColor = vec4(color.rgb, A);
8103								gVelocity = vec4(0.0); // so it is ignored by TAA
8104            }`;return new r5({uniforms:{covariancesTexture:{type:"t",value:null},centersColorsTexture:{type:"t",value:null},meshIndexIntervals:{value:e},meshMatrixWorldsTexture:{type:"t",value:null},focal:{type:"v2",value:new tZ},viewport:{type:"v2",value:new tZ},basisViewport:{type:"v2",value:new tZ},debugColor:{type:"v3",value:new ir},covariancesTextureSize:{type:"v2",value:new tZ(1024,1024)},centersColorsTextureSize:{type:"v2",value:new tZ(1024,1024)},orthoZoom:{type:"f",value:-1}},vertexShader:t,fragmentShader:i,transparent:!0,alphaTest:1,blending:1,depthTest:!0,depthWrite:!1,side:2})}static buildGeomtery(e){let t=new rz;t.setIndex([0,1,2,0,2,3]);let i=new rE(new Float32Array(12),3);t.setAttribute("position",i),i.setXYZ(0,-1,-1,0),i.setXYZ(1,-1,1,0),i.setXYZ(2,1,1,0),i.setXYZ(3,1,-1,0),i.needsUpdate=!0;let r=new lf().copy(t),s=new nP(new Uint32Array(e),1,!1);return s.setUsage(35048),r.setAttribute("splatIndex",s),r.instanceCount=e,r}resetLocalSplatDataAndTexturesFromSplatBuffer(){this.updateLocalSplatDataFromSplatBuffer(),this.allocateAndStoreLocalSplatDataInTextures()}updateLocalSplatDataFromSplatBuffer(){this.splatBuffers.forEach(e=>e.buildPreComputedBuffers()),this.covariances=new Float32Array(6*this.splatCount),this.colors=new Uint8Array(4*this.splatCount),this.centers=new Float32Array(3*this.splatCount);let e=0,t=0,i=0;for(let r of this.splatBuffers){let s=r.nsplats;this.colors.subarray(e,e+4*s).set(r.colorsA),e+=4*s,this.centers.subarray(t,t+3*s).set(r.decoded.xyz.denormDequant().data),t+=3*s,this.covariances.subarray(i,i+6*s).set(new Float32Array(r.precomputedCovarianceBufferData)),i+=6*s}}allocateAndStoreLocalSplatDataInTextures(){let e,t,i=this.splatCount,r=new tZ(4096,1024);for(;r.x*r.y*2<6*i;)r.y*=2;let s=new tZ(4096,1024);for(;s.x*s.y*4<4*i;)s.y*=2;if(this.halfPrecisionCovariancesOnGPU){t=new Uint16Array(r.x*r.y*2);for(let e=0;e<this.covariances.length;e++)t[e]=l0.toHalfFloat(this.covariances[e]);e=new nM(t,r.x,r.y,1030,1016)}
8104else(t=new Float32Array(r.x*r.y*2)).set(this.covariances),e=new nM(t,r.x,r.y,1030,1015);e.needsUpdate=!0,this.material.uniforms.covariancesTexture.value=e,this.material.uniforms.covariancesTextureSize.value.copy(r);let a=new Uint32Array(s.x*s.y*4);for(let e=0;e<i;e++){var o,h;let t=4*e,i=3*e,r=4*e;a[r]=(o=this.colors[t],h=this.colors[t+1],o+(h<<8)+(this.colors[t+2]<<16)+(this.colors[t+3]<<24)),a[r+1]=Lo(this.centers[i]),a[r+2]=Lo(this.centers[i+1]),a[r+3]=Lo(this.centers[i+2])}let c=new nM(a,s.x,s.y,1033,1014);c.internalFormat="RGBA32UI",c.needsUpdate=!0,this.material.uniforms.centersColorsTexture.value=c,this.material.uniforms.centersColorsTextureSize.value.copy(s);let d=new Float32Array(4096);for(let e=0;e<this.meshMatrixWorlds.length;e++)d.set(this.meshMatrixWorlds[e].elements,16*e);let u=new nM(d,1024,1,1023,1015);u.needsUpdate=!0,this.material.uniforms.meshMatrixWorldsTexture.value=u,this.material.uniformsNeedUpdate=!0,this.splatDataTextures={covariances:{data:t,texture:e,size:r},centerColors:{data:a,texture:c,size:s},meshMatrixWorlds:{data:d,texture:u}}}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&&(Ll.set(e.x*this.devicePixelRatio,e.y*this.devicePixelRatio),this.material.uniforms.viewport.value.copy(Ll),this.material.uniforms.basisViewport.value.set(2/Ll.x,2/Ll.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()}},Lg=new Promise(e=>{Lf=e}),Lv=!1;Lg.then(e=>LB=e);var Ly=class{constructor(e={}){tC(this,"updateView",function(){let e=new iY,t=[],i=new iy(0,0,-1),r=new iy(0,0,-1),s=new iy,a=new iy;return function(o=!1,h){let c=this.updateMatrixWorldsInWorkerIfNeeded(),d=this.cropsChanged();if(!o){r.set(0,0,-1).applyQuaternion(h.quaternion);let e=!1,t=!1;if(.95>=r.dot(i)&&(e=!0),a.copy(h.position).sub(s).length()>=1&&(t=!0),!e&&!t&&!c&&!d&&!this.needsInitialRender)return}this.needsInitialRender=!1,s.copy(h.position),i.copy(r),e.copy(h.matrixWorld).invert(),e.premultiply(this.dummyPerspectiveMatrix),t[0]=h.position.x,t[1]=h.position.y,t[2]=h.position.z;let u={sort:{view:e.elements,cameraPosition:t,splatRenderCount:this.splatRenderCount,splatSortCount:this.splatRenderCount},...c?{newMatrixWorlds:this.meshMatrixWorlds}:{},...d?{newCropsArray:this.cropsArray}:{}};this.sortRunning?this.queuedMessage=u:(this.queuedMessage=null,this.sortRunning=!0,this.sortWorker.postMessage(u))}}()),this.scene=e.scene,this.currentPage=null,this.devicePixelRatio=window.devicePixelRatio,this.sortWorker=null,this.splatRenderCount=0,this.splatSortCount=0,this.splatMesh=null,this.sortRunning=!1,this.meshMatrixWorlds=null,this.meshMatrixWorldsOld=null,this.cropsArray=null,this.splatEntries=null,this.queuedMessage=null,this.needsInitialRender=!0,this.dummyPerspectiveMatrix=new iY().makePerspective(-1,1,-1,1,.1,1e3)}updateSplatMeshUniforms(e,t){let i=new tZ;null!==this.splatMesh&&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 iy().fromArray(e.position)),e.orientation&&(e.orientation=new iv().fromArray(e.orientation)),e.halfPrecisionCovariances=!!e.halfPrecisionCovariances;let t=[];if(this.splatEntries=t,this.activePage.traverseVisibleEntity(e=>{"Splat"===e.data.type&&t.push(e)}),this.splatMesh&&this.splatMesh.dispose(),0===t.length)return this.splatMesh=null,!1;this.meshMatrixWorlds=t.map(e=>e.matrixWorld),this.meshMatrixWorldsOld=t.map(e=>e.matrixWorld.clone()),this.cropsArray=t.map(e=>e.data.crops.map(e=>e.data));let i=t.map(e=>new LB.GSplineBuffer(new Uint8Array(e.data.buffer).buffer)),r=0,s=[0];for(let e of i)r+=e.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,16*t);return this.splatDataTextures.meshMatrixWorlds.texture.needsUpdate=!0,!this.meshMatrixWorlds.every((e,t)=>e.equals(this.meshMatrixWorldsOld[t]))&&(this.meshMatrixWorldsOld=this.meshMatrixWorlds.map(e=>e.clone()),!0)}cropsChanged(){let e=!1;
vendor: 16,894 bytes, line 8104
8104return this.splatEntries.forEach((t,i)=>{t.data.crops.forEach((t,r)=>{void 0===this.cropsArray[i][r]?(e=!0,this.cropsArray[i][r]=t.data):Object.entries(t.data).forEach(([t,s])=>{Array.isArray(s)&&s.some((e,s)=>e!==this.cropsArray[i][r][t][s])?(e=!0,this.cropsArray[i][r][t]=s):s!==this.cropsArray[i][r]?.[t]&&(e=!0,this.cropsArray[i][r][t]=s)})}),t.data.crops.length!==this.cropsArray[i]?.length&&(this.cropsArray[i].length=t.data.crops.length,e=!0)}),e}setupSplatMesh(e,t,i=new iy,r=new iv,s=!1,a=1,o,h){this.splatMesh=Lm.buildMesh(e,t,s,a,o,h),this.splatMesh.position.copy(i),this.splatMesh.quaternion.copy(r),this.splatMesh.frustumCulled=!1,this.splatMesh.renderOrder=99999,this.splatRenderCount=t,this.splatMesh.onBeforeRender=(e,t,i)=>this.update(e,i)}setupSortWorker(e){this.sortWorker=function(e){let t=new Worker(URL.createObjectURL(new Blob(["(",Ln.toString(),")(self)"],{type:"application/javascript"}))),i=atob("AGFzbQEAAAAADwhkeWxpbmsuMAEEAAAAAAETA2AAAGAIf39/f39/f38AYAABfwISAQNlbnYGbWVtb3J5AgMAgIAEAwQDAAECBzkDEV9fd2FzbV9jYWxsX2N0b3JzAAALc29ydEluZGV4ZXMAARNlbXNjcmlwdGVuX3Rsc19pbml0AAIK3gMDAwABC9IDAwF/BnwBfgJAIAdFDQAgAysDUCEMIAMrAzAhDSADKwMQIQ5BACEDRP///////+9/IQtEAAAAAAAAEAAhCgNAIAIgA0ECdGoCfyAOIAEgA0EMbGoiCCoCALuiIA0gCCoCBLuioCAMIAgqAgi7oqBEAAAAAAAAsECiIgmZRAAAAAAAAOBBYwRAIAmqDAELQYCAgIB4CzYCACAJIAsgCSALYxshCyAJIAogCSAKZBshCiADQQFqIgMgB0cNAAsgB0UNACAGuCAKIAuhoyEJQQAhAwNAAn8gCSACIANBAnRqIgEoAgC3IAuhoiIKmUQAAAAAAADgQWMEQCAKqgwBC0GAgICAeAshCCABIAg2AgAgBCAIQQJ0aiIBIAEoAgBBAWo2AgAgA0EBaiIDIAdHDQALCyAGQQJPBEAgBCgCACEIQQEhAwNAIAQgA0ECdGoiASABKAIAIAhqIgg2AgAgA0EBaiIDIAZHDQALCyAHQQFrIgGtIQ8DQCAEIAIgD6dBAnQiA2ooAgBBAnRqIgcgBygCAEEBayIHNgIAIAUgASAHa0ECdGogACADaigCADYCACAPUCEDIA9CAX0hDyADRQ0ACyAGBEAgBEEAIAZBAnT8CwALCwQAQQAL"),r=new Uint8Array(i.length);for(let e=0;e<i.length;e++)r[e]=i.charCodeAt(e);return t.postMessage({init:{sorterWasmBytes:r.buffer,splatCount:e,Constants:{BytesPerFloat:La.BytesPerFloat,BytesPerInt:La.BytesPerInt,DepthMapRange:La.DepthMapRange,MemoryPageSize:La.MemoryPageSize}}}),t}(e),this.sortWorker.onmessage=e=>{e.data.sortDone?(this.sortRunning=!1,this.splatMesh?.updateIndexes(new Uint32Array(e.data.indexesBuffer)),this.lastSortTime=e.data.sortTime,this.queuedMessage&&(this.sortWorker.postMessage(this.queuedMessage),this.queuedMessage=null)):e.data.sortCanceled?this.sortRunning=!1:e.data.sortSetupPhase1Complete?this.sortWorker.postMessage({positions:this.splatMesh.getCenters().buffer,meshMatrixWorlds:this.splatMesh.meshMatrixWorlds,meshIndexIntervals:this.splatMesh.meshIndexIntervals,cropsArray:this.cropsArray}):e.data.sortSetupComplete&&(this.splatDataTextures=this.splatMesh.getSplatDataTextures(),this.scene.activePage.add(this.splatMesh),this.needsInitialRender=!0)}}update(e,t){null!==this.splatMesh&&(this.updateSplatMeshUniforms(e,t),this.updateView(!1,t))}getSplatMesh(){return this.splatMesh}},Lx=new rS;Lx.wireframe=!0;var Lb=new iy,Lw=class extends nb{constructor(e,t){super(),this.data=e,this.sharedAssets=t,this.enableHelpers=!1,this.wireframeState=!1,this.needsTransmissionDirty=!0,this.needsNormalDirty=!0,this._needsTransmission=!1,this._needsNormal=!1,this.geometryCacheChanged=!1,this.splatViewer=null,this.shapeBlendIntances=[],this.entityByUuid={},this.entityIdentityToEntity={},this.toExpandCloner=new Set,this.toUpdateCloner=new Set,this.pendingCommands=[],this.pathConstraints=new Ls,this.invisibleObjects=new Ty("jflkdsafjasdifjaslk",{...yR.defaultData,visible:!1,name:"buildin invisible"}),this.needsRecomputeInstances=!1,this.init(e,t),this.matrixAutoUpdate=!1,this.errorPage=new Op("fdasfa",{...yW.defaultData,name:""},{shared:t,scene:this})}markGeometryCacheDirty(){this.geometryCacheChanged=!0}markNeedsUpdateRendererDirty(){this.needsTransmissionDirty=!0,this.needsNormalDirty=!0}needsTransmission(){let e;return this.needsTransmissionDirty&&(this._needsTransmission=(e=!1,this.traverseEntity(t=>{if(t instanceof Ai)if(Array.isArray(t.material))for(let i=0;i<t.material.length;i++)O7(t,t.material[i])&&(e=!0);else O7(t,t.material)&&(e=!0)}),e),this.needsTransmissionDirty=!1),this._needsTransmission}needsNormal(){let e;return this.needsNormalDirty&&(this._needsNormal=(e=!1,this.traverseEntity(t=>{if(t instanceof Ai)if(Array.isArray(t.material))for(let i=0;i<t.material.length;i++)O9(t,t.material[i])&&(e=!0);else O9(t,t.material)&&(e=!0)}),e),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 Op&&(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(void 0===t)return;let i=[],r=t;for(;r!==this;){let e=r,t=(r=r.parent).children.indexOf(e);i.splice(0,0,t)}return{entity:t,sortKey:i}}getAllSorted(e){let t=[];for(let i of e){let e=this.getWithSortKey(i.id);void 0!==e&&t.push(e)}return t.sort((e,t)=>u7(e.sortKey,t.sortKey)),t.map(e=>e.entity)}nonExistOrDescendantOf(e,t){let i=this.find(e);if(void 0===i)return!0;for(;i;){if(i.uuid===t)return!0;i=i.parent}return!1}find(e){if(this.activePage&&this.activePage.personalCamera.parent&&("f23858d0-4a3b-4bd8-8173-66ed0af7f6fb-personalCamera"===e||e===mE))return this.activePage.personalCamera;if(""===e||void 0===e)return;let t=this.entityByUuid[e];return void 0===t?this.getObjectByProperty("uuid",e):t}find2D(e){for(let t of this.children)if(t instanceof Op&&t.uiScene){let i=t.uiScene.find(e);if(i)return i}}findScene2DfromObject2D(e){for(let t of this.children)if(t instanceof Op&&t.uiScene&&t.uiScene.find(e))return t.uiScene}find2DInUIObjects(e){let t;return this.traverseEntity(i=>{void 0===t&&i instanceof O_&&(t=i.uiCanvas.find(e))}),t}traverse2D(e){for(let t of this.children)t instanceof Op&&t.uiScene&&t.uiScene.traverse(e)}debugEnsureEntity(e){let t=this.find(e);t?Array.isArray(t.identity)&&void 0===this.findInstance(t.identity)&&console.error("not found instance"):console.error("not found")}addPendingExpandCloner(e){this.toExpandCloner.add(e)}addPendingUpdateCloner(e){this.toUpdateCloner.add(e)}markToExpandCloner(e){this.toExpandCloner.add(e),e.traverseEntityAncestors(e=>{this.toExpandCloner.add(e)})}doPendingExpandCloner(){this.toExpandCloner.forEach(e=>{e.expandCloner(this)}),this.toExpandCloner.clear()}doPendingUpdateCloner(){this.toUpdateCloner.forEach(e=>{e.cloner?.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){1===e.path.length&&"components"===e.path[0]&&1===e.type&&this.createChildrenObjects([{...e.data.asset,id:e.id}],this.invisibleObjects,t)}updateTreeByOp(e,t){if(0===e.path.length&&7===e.type){let i=null===e.parent?this:this.find(e.parent);if(void 0===i)throw Error("unexpected");let r=this.createObject(e.id,e.data,e.children,i,e.localIndex,t);r.updateVisible(this),r.resetBBoxNeedsUpdate(),Tc(r)&&Td(r.parent)&&(r.invalidateUpstreamBooleanData(),r.parent.invalidateDownstreamBooleanData().recomputeBoolean()),this.markNeedsRecomputeInstancesForAncessors(i),this.markNeedsRecomputeInstancesForChildren(r),this.markToExpandCloner(r),this.markPenumbraSizeDirty(),r.updatePathSnapping()}else if(0===e.path.length&&8===e.type){let t=this.find(e.id);if(void 0===t)throw Error("unexpected");t.traverseEntity(e=>{e instanceof OJ&&(this.shapeBlendIntances=this.shapeBlendIntances.filter(t=>t!==e))}),this.markToExpandCloner(t),t.resetBBoxNeedsUpdate(),this.unregisterObject(t);let i=t.parent;this.markNeedsRecomputeInstancesForAncessors(i),this.markNeedsRecomputeInstancesForChildren(t),this.markPenumbraSizeDirty(),t.parent.remove(t),Td(t.parent)&&(t.parent.invalidateUpstreamBooleanData(),t.parent.invalidateDownstreamBooleanData().recomputeBoolean()),Tc(t)&&(t.freeBooleanPointer(),i instanceof Tl&&i.invalidateDownstreamBooleanData().recomputeBoolean()),t instanceof Og&&t.detachShape(),this.disposeAndUnregisterEntityRecursivelyIfNotReregistered(t),this.pathConstraints.removeDependencies(t.uuid),t.updatePathSnapping()}else if(0===e.path.length&&9===e.type){let t=this.find(e.id);if(void 0===t)throw Error("unexpected");this.markNeedsRecomputeInstancesForChildren(t);let i=t.parent;this.markNeedsRecomputeInstancesForAncessors(i),t.cloner?.resetOnMove(),this.markToExpandCloner(t);let r=null===e.parent?this:this.find(e.parent);if(void 0===r)throw Error("unexpected");r.add(t),this.markNeedsRecomputeInstancesForAncessors(r),this.markToExpandCloner(t),t.invalidateClonerTransform(t),t.updateVisible(this),t.resetBBoxNeedsUpdate(),this.markPenumbraSizeDirty();let s=e.localIndex;r.children.splice(s,0,r.children.pop()),Tc(t)&&(t.invalidateUpstreamBooleanData(),Td(t.parent)?t.parent.invalidateDownstreamBooleanData().recomputeBoolean():i instanceof Tl&&i.invalidateDownstreamBooleanData().recomputeBoolean()),t.updatePathSnapping()}this.markNeedsUpdateRendererDirty(),this.markGeometryCacheDirty()}get playPage(){return this.find(this.data.publish.playPage)??this.errorPage}updatePage(e){for(let t of(this.activePage&&this.activePage.onDeactive(),this.activePage=this.errorPage,this.children))t instanceof Op&&(t.visible=t.uuid===e,t.visible&&(this.activePage=t,this.activePage.onActive(this)));this.activePage!==this.splatViewer?.activePage&&this.reloadSplats()}updateEntityByOp(e,t,i,r){if(0===t.type){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:e}=t.props;t={...t,props:e},this.markNeedsRecomputeInstances()}"pathSnapping"===t.path[0]&&void 0!==t.props.pathId&&this.pathConstraints.setConstraint(e,t.props.pathId)}let s=this.find(e);if(s)try{var a;a=t,s.updateByOp(a,i,{scene:this,shared:r},!1),s instanceof Al&&s.updateGeometryGroupsIfNeeded()}catch(e){console.error(e)}}updateEntity2DByOp(e,t,i,r,s,a=[]){e.updateEntityByOp(t,i,r,s),this.traverseEntity(e=>{(e instanceof O_||e instanceof Op)&&(a.includes(e.frameId??"")||e.frameId===t)&&e.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((e,t)=>({data:e[1].asset.data,children:e[1].asset.children,id:e[0],fi:t}));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(e=>{e instanceof Ts&&e.updateUp()}),this.doPendingExpandCloner(),this.applyPendingCommands()}markNeedsRecomputeInstances(){this.needsRecomputeInstances=!0}markNeedsRecomputeInstancesForChildren(e){e.traverseEntity(e=>{("Component"===e.data.type||"Instance"===e.data.type)&&this.markNeedsRecomputeInstances()})}markNeedsRecomputeInstancesForAncessors(e){SL.is(e)&&("Component"===e.data.type&&this.markNeedsRecomputeInstances(),e.traverseAncestors(e=>{SL.is(e)&&"Component"===e.data.type&&this.markNeedsRecomputeInstances()}))}relativeizeInner(e,t,i,r,s,a,o){if(e){let h=r.find(e);h&&h!==r&&s.forInstancesRec(r=>{r.data=p3(r.data,s=>{let h=s.events.data(o.id),c=r.goUp(a);if(c){let r=[...u9(c.identity),e].join("-"),s=this.entityIdentityToEntity[r];if(s){let e=s.uuid;fn.zoom(h,t)[i]=e}else console.warn("cannot find instance")}}).data})}}rewriteActions(e,t,i,r,s,a){e.forEach(e=>{"Transition"===e.data.type||"Animation"===e.data.type?this.relativeizeInner(e.data.object,[...t,e.id],"object",i,r,s,a):"Conditional"===e.data.type&&(this.rewriteActions(e.data.ifActions,[...t,e.id,"ifActions"],i,r,s,a),this.rewriteActions(e.data.elseActions,[...t,e.id,"elseActions"],i,r,s,a))})}rewriteEventsBeforeGoToPlayMode(){this.traverseEntity(e=>{if(e instanceof Oy&&"string"==typeof e.identity&&"Component"===e.data.type)return e.traverseEntity((t,i)=>{t.data.events.forEach(r=>{if("GameControl"===r.data.type){let s=!1;if(t.forInstancesRec(e=>{e.data=p3(e.data,t=>{e.isInstanceRoot||(t.events.delete(r.id),s=!0)}).data}),!1===s)for(let s of y9.list)this.rewriteActions(r.data.gameActions[s],["gameActions",s],e,t,i,r)}else"Conditional"===r.data.type?("Distance"===r.data.condition.type?(this.relativeizeInner(r.data.condition.fromObject,["condition"],"fromObject",e,t,i,r),this.relativeizeInner(r.data.condition.toObject,["condition"],"toObject",e,t,i,r)):"State"===r.data.condition.type?this.relativeizeInner(r.data.condition.object,["condition"],"object",e,t,i,r):"Comparison"===r.data.condition.type&&("Property"===r.data.condition.lOperand.type&&this.relativeizeInner(r.data.condition.lOperand.value[0],["condition","lOperand","value"],0,e,t,i,r),"Property"===r.data.condition.rOperand.type&&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;for(let s of(this.traverseEntity(s=>{if(s instanceof Oy&&s.isInstanceRoot)return s.expandInstanceChildren({scene:this,shared:e,pendingDeletes:r}),t||s.resetBBoxNeedsUpdate(),i&&s.traverseEntity(e=>{i.addClip(e)}),!0}),r))this.disposeAndUnregisterEntityRecursivelyIfNotReregistered(s),Ox(s)}recomputeInstances(e,t){this.needsRecomputeInstances&&(this.needsRecomputeInstances=!1,this.traverseEntity(e=>{e instanceof Oy&&e.isInstanceRoot&&(e.component=void 0)}),this.expandInstances(e,!1,t))}disposeAndUnregisterEntityRecursivelyIfNotReregistered(e){e.traverseEntity(e=>{let t="string"==typeof e.identity?e.identity:e.identity.join("-");this.entityIdentityToEntity[t]===e&&(delete this.entityByUuid[e.uuid],delete this.entityIdentityToEntity[t]),e.dispose()})}clearScene(){for(let e of this.children)SL.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 s=a.cloner;if(SL.is(a)&&!a.raycastLock&&(a.visible||s?.object.data.visible))if(!0===t&&a.isInstanceRoot){let t=[];if(e.intersectObject(a,!0,t),t.length){let e=t[0];e.object=a,e.point.applyMatrix4(e.object.matrixWorld);let r=a.matrixWorld.clone().invert();e.point.applyMatrix4(r),i.push(e)}}else(Tc(a)||Tu(a)&&this.enableHelpers&&a.objectHelper.visible)&&(e.intersectObject(a,!1,i),Lr(a,e,i)),r(a)}};return r(this.activePage),i}raycastWithClones(e){let t=[],i=r=>{for(let s of r.children){let r=s.cloner;SL.is(s)&&(s.visible||r?.object.data.visible)&&((Tc(s)||Tu(s)&&this.enableHelpers&&s.objectHelper.visible)&&(e.intersectObject(s,!1,t),Lr(s,e,t,!0)),i(s))}};return i(this),t}forEachEntity(e){for(let t of this.children)SL.is(t)&&e(t)}traverseConcreteEntity(e){for(let t of this.children)SL.is(t)&&t.isConcreteEntity&&t.traverseEntity(e)}traverseEntity(e){for(let t of this.children)SL.is(t)&&t.traverseEntity(e)}updateFont(e,t){this.traverseEntity(i=>{if(i instanceof Al&&"Mesh"===i.data.type&&("TextGeometry"===i.data.geometry.type||"InputGeometry"===i.data.geometry.type)&&i.data.geometry.font===e){let r=i.geometry,s=i.data.geometry;r.updateFont(e,t).then(()=>{r.update(s,t);let e=i.invalidateDownstreamBooleanData();Td(e)&&e.recomputeBoolean()})}})}traverseObject(e){for(let t of this.children)b4.is(t)&&t.traverseObject(e)}traverseVisibleEntity(e){for(let t of this.children)SL.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){for(let t of(delete this.entityByUuid[e.uuid],e.children))this.unregisterObject(t)}createObject(e,t,i,r,s,a){let o={scene:this,shared:a},h=OG(e,t,o);return h instanceof OJ&&this.shapeBlendIntances.push(h),h&&(this.entityByUuid[e]=h,r.add(h),r.children.splice(s,0,r.children.pop()),i.length>0&&(h.isInstanceRoot?console.error("instance should not have children!"):this.createChildrenObjects(i,h,a)),h.updateState(t,o),h instanceof Al&&h.updateGeometryGroupsIfNeeded(),h.updateVisible(this),h.cloner&&this.toExpandCloner.add(h),t.pathSnapping?.pathId&&this.pathConstraints.setConstraint(e,t.pathSnapping.pathId)),"Empty"===t.type&&t.animations&&h.traverseEntity(e=>{let t=e.dataPatched;
8104if(e instanceof Al&&t.bones&&t.boneInverses){let i=new nT(t.bones.map(e=>this.find(e)),t.boneInverses.map(e=>new iY().fromArray(e)));e.bind(i,e.bindMatrix)}else e.matrixAutoUpdate=!0}),h}getCenter(e){let t=[];for(let i=0,r=e.length;i<r;++i){let{id:r,recursive:s}=e[i],a=this.find(r),o=s?a.recursiveBBox:a.singleBBox;t.push(...o.vertices)}let i=new iw;return i.setFromPoints(t),i.getCenter(Lb),Lb}copyMatrixWorld(e,t){if(null===e)return void t.identity();let i=this.find(e);i?t.copy(i.matrixWorld):t.identity()}copyParentMatrixWorld(e,t){if(null===e)return void t.identity();let i=this.find(e)?.parent;i?t.copy(i.matrixWorld):t.identity()}traverseMaterial(e){this.traverseEntity(t=>{if(t instanceof Cf)if(Array.isArray(t.material))for(let i=0;i<t.material.length;i++)t.material[i]instanceof EA&&e(t.material[i]);else t.material instanceof EA&&e(t.material)})}updateViewPlaneSize(e,t,i=!1){this.traverseConcreteEntity(r=>{r instanceof Ts&&r.setViewplaneSize(e,t,i)})}initializeSplatViewer(){this.splatViewer=new Ly({scene:this}),this.reloadSplats()}reloadSplats(){this.splatViewer?.loadSplat()}},L_=(e,t)=>{let i=t.x-e.x,r=t.y-e.y;return Math.sqrt(i*i+r*r)},LS=e=>Math.PI/180*e,LC=new Map,LM=e=>{LC.has(e)&&clearTimeout(LC.get(e)),LC.set(e,setTimeout(e,100))},LE=(e,t,i)=>{let r=t.split(/[ ,]+/g),s;for(let t=0;t<r.length;t+=1)s=r[t],e.addEventListener?e.addEventListener(s,i,!1):e.attachEvent&&e.attachEvent(s,i)},LA=(e,t,i)=>{let r=t.split(/[ ,]+/g),s;for(let t=0;t<r.length;t+=1)s=r[t],e.removeEventListener?e.removeEventListener(s,i):e.detachEvent&&e.detachEvent(s,i)},LT=e=>(e.preventDefault(),e.type.match(/^touch/)?e.changedTouches:e),LP=()=>{if(!(typeof window>"u"))return{x:void 0!==window.pageXOffset?window.pageXOffset:(document.documentElement||document.body.parentNode||document.body).scrollLeft,y:void 0!==window.pageYOffset?window.pageYOffset:(document.documentElement||document.body.parentNode||document.body).scrollTop}},LD=(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")},LO=(e,t,i)=>{let r=LL(e);for(let e in r)if(r.hasOwnProperty(e))if("string"==typeof t)r[e]=t+" "+i;else{let s="";for(let e=0,r=t.length;e<r;e+=1)s+=t[e]+" "+i+", ";r[e]=s.slice(0,-2)}return r},LL=e=>{let t={};return t[e]="",["webkit","Moz","o"].forEach(function(i){t[i+e.charAt(0).toUpperCase()+e.slice(1)]=""}),t},LI=(e,t)=>{for(let i in t)t.hasOwnProperty(i)&&(e[i]=t[i]);return e},LR=(e,t)=>{if(e.length)for(let i=0,r=e.length;i<r;i+=1)t(e[i]);else t(e)};"u">typeof window&&(Lz="ontouchstart"in window,LN=!!window.PointerEvent,LF=!!window.MSPointerEvent);var Lk,LB,Lz,LN,LF,Lj,LU={start:"mousedown",move:"mousemove",end:"mouseup"},LV={};function LW(){}function LH(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),"dynamic"===this.options.mode&&(this.options.restOpacity=0),this.id=LH.id,LH.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}function LG(e,t){this.nipples=[],this.idles=[],this.actives=[],this.ids=[],this.pressureIntervals={},this.manager=e,this.id=LG.id,LG.id+=1,this.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},this.config(t),("static"===this.options.mode||"semi"===this.options.mode)&&(this.options.multitouch=!1),this.options.multitouch||(this.options.maxNumberOfNipples=1);let i=getComputedStyle(this.options.zone.parentElement);return i&&"flex"===i.display&&(this.parentIsFlex=!0),this.updateBox(),this.prepareNipples(),this.bindings(),this.begin(),this.nipples}function Lq(e){var t=this;t.ids={},t.index=0,t.collections=[],t.scroll=LP(),t.config(e),t.prepareCollections();var i=function(){var e;
8104t.collections.forEach(function(i){i.forEach(function(i){e=i.el.getBoundingClientRect(),i.position={x:t.scroll.x+e.left,y:t.scroll.y+e.top}})})};if(typeof window>"u")return t.collections;LE(window,"resize",function(){LM(i)});var r=function(){t.scroll=LP()};return LE(window,"scroll",function(){LM(r)}),t.collections}LN?Lj={start:"pointerdown",move:"pointermove",end:"pointerup, pointercancel"}:LF?Lj={start:"MSPointerDown",move:"MSPointerMove",end:"MSPointerUp"}:Lz?(Lj={start:"touchstart",move:"touchmove",end:"touchend, touchcancel"},LV=LU):Lj=LU,LW.prototype.on=function(e,t){var i,r=e.split(/[ ,]+/g);this._handlers_=this._handlers_||{};for(var s=0;s<r.length;s+=1)i=r[s],this._handlers_[i]=this._handlers_[i]||[],this._handlers_[i].push(t);return this},LW.prototype.off=function(e,t){return this._handlers_=this._handlers_||{},void 0===e?this._handlers_={}:void 0===t?this._handlers_[e]=null:this._handlers_[e]&&this._handlers_[e].indexOf(t)>=0&&this._handlers_[e].splice(this._handlers_[e].indexOf(t),1),this},LW.prototype.trigger=function(e,t){var i,r=this,s=e.split(/[ ,]+/g);r._handlers_=r._handlers_||{};for(var a=0;a<s.length;a+=1)i=s[a],r._handlers_[i]&&r._handlers_[i].length&&r._handlers_[i].forEach(function(e){e.call(r,{type:i,target:r},t)})},LW.prototype.config=function(e){this.options=this.defaults||{},e&&(this.options=((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})(this.options,e))},LW.prototype.bindEvt=function(e,t){var i=this;return i._domHandlers_=i._domHandlers_||{}
8104,i._domHandlers_[t]=function(){"function"==typeof i["on"+t]?i["on"+t].apply(i,arguments):console.warn('[WARNING] : Missing "on'+t+'" handler.')},LE(e,Lj[t],i._domHandlers_[t]),LV[t]&&LE(e,LV[t],i._domHandlers_[t]),i},LW.prototype.unbindEvt=function(e,t){return this._domHandlers_=this._domHandlers_||{},LA(e,Lj[t],this._domHandlers_[t]),LV[t]&&LA(e,LV[t],this._domHandlers_[t]),delete this._domHandlers_[t],this},LH.prototype=new LW,LH.constructor=LH,LH.id=0,LH.prototype.buildEl=function(e){return this.ui={},this.options.dataOnly||(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},LH.prototype.stylize=function(){if(this.options.dataOnly)return this;var e=this.options.fadeTime+"ms",t=((e,t)=>{let i=LL(e);for(let e in i)i.hasOwnProperty(e)&&(i[e]=t);return i})("borderRadius","50%"),i=LO("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)"},LI(r.el,i),"circle"===this.options.shape&&LI(r.back,t),LI(r.front,t),this.applyStyles(r),this},LH.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},LH.prototype.addToDom=function(){return this.options.dataOnly||document.body.contains(this.ui.el)||this.options.zone.appendChild(this.ui.el),this},LH.prototype.removeFromDom=function(){return this.options.dataOnly||!document.body.contains(this.ui.el)||this.options.zone.removeChild(this.ui.el),this},LH.prototype.destroy=function(){clearTimeout(this.removeTimeout),clearTimeout(this.showTimeout),clearTimeout(this.restTimeout),this.trigger("destroyed",this.instance),this.removeFromDom(),this.off()},LH.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),"function"==typeof e&&e.call(this)},t.options.fadeTime)),t},LH.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="dynamic"===t.options.mode?"none":"block";t.ui.el.style.display=i,"function"==typeof e&&e.call(t),t.trigger("hidden",t.instance)},t.options.fadeTime),t.options.restJoystick){let i=t.options.restJoystick,r={};r.x=!0===i||!1!==i.x?0:t.instance.frontPosition.x,r.y=!0===i||!1!==i.y?0:t.instance.frontPosition.y,t.setPosition(e,r)}return t},LH.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=LO("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(){"function"==typeof e&&e.call(i),i.restCallback()},i.options.fadeTime)},LH.prototype.restCallback=function(){var e={};e.front=LO("transition","none",""),this.applyStyles(e),this.trigger("rested",this.instance)},LH.prototype.resetDirection=function(){this.direction={x:!1,y:!1,angle:!1}},LH.prototype.computeDirection=function(e){var t,i,r,s=e.angle.radian,a=Math.PI/4,o=Math.PI/2;if(s>a&&s<3*a&&!e.lockX?t="up":s>-a&&s<=a&&!e.lockY?t="left":s>-(3*a)&&s<=-a&&!e.lockX?t="down":e.lockY||(t="right"),e.lockY||(i=s>-o&&s<o?"left":"right"),e.lockX||(r=s>0?"up":"down"),e.force>this.options.threshold){var h,c={};for(h in this.direction)this.direction.hasOwnProperty(h)&&(c[h]=this.direction[h]);var d={};for(h in this.direction={x:i,y:r,angle:t},e.direction=this.direction,c)c[h]===this.direction[h]&&(d[h]=!0);if(d.x&&d.y&&d.angle)return e;d.x&&d.y||this.trigger("plain",e),d.x||this.trigger("plain:"+i,e),d.y||this.trigger("plain:"+r,e),d.angle||this.trigger("dir dir:"+t,e)}else this.resetDirection();return e},LG.prototype=new LW,LG.constructor=LG,LG.id=0,LG.prototype.prepareNipples=function(){var e=this.nipples;e.on=this.on.bind(this),e.off=this.off.bind(this),e.options=this.options,e.destroy=this.destroy.bind(this),e.ids=this.ids,e.id=this.id,e.processOnMove=this.processOnMove.bind(this),e.processOnEnd=this.processOnEnd.bind(this),e.get=function(t){if(void 0===t)return e[0];for(var i=0,r=e.length;i<r;i+=1)if(e[i].identifier===t)return e[i];return!1}},LG.prototype.bindings=function(){this.bindEvt(this.options.zone,"start"),this.options.zone.style.touchAction="none",this.options.zone.style.msTouchAction="none"},LG.prototype.begin=function(){var e=this.options;if("static"===e.mode){var t=this.createNipple(e.position,this.manager.getIdentifier());t.add(),this.idles.push(t)}},LG.prototype.createNipple=function(e,t){var i=this.manager.scroll,r={},s=this.options,a={x:this.parentIsFlex?i.x:i.x+this.box.left,y:this.parentIsFlex?i.y:i.y+this.box.top};if(e.x&&e.y)r={x:e.x-a.x,y:e.y-a.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",s.zone.appendChild(o);var h=o.getBoundingClientRect();s.zone.removeChild(o),r=e,e={x:h.left+i.x,y:h.top+i.y}}var c=new LH(this,{color:s.color,size:s.size,threshold:s.threshold,fadeTime:s.fadeTime,dataOnly:s.dataOnly,restJoystick:s.restJoystick,restOpacity:s.restOpacity,mode:s.mode,identifier:t,position:e,zone:s.zone,frontPosition:{x:0,y:0},shape:s.shape});return s.dataOnly||(LD(c.ui.el,r),LD(c.ui.front,c.frontPosition)),this.nipples.push(c),this.trigger("added "+c.identifier+":added",c),this.manager.trigger("added "+c.identifier+":added",c),this.bindNipple(c),c},LG.prototype.updateBox=function(){this.box=this.options.zone.getBoundingClientRect()},LG.prototype.bindNipple=function(e){var t,i=this,r=function(e,r){t=e.type+" "+r.id+":"+e.type,i.trigger(t,r)};e.on("destroyed",i.onDestroyed.bind(i)),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)},LG.prototype.pressureFn=function(e,t,i){var r=this,s=0;clearInterval(r.pressureIntervals[i]),r.pressureIntervals[i]=setInterval((function(){var i=e.force||e.pressure||e.webkitForce||0;
8104i!==s&&(t.trigger("pressure",i),r.trigger("pressure "+t.identifier+":pressure",i),s=i)}).bind(r),100)},LG.prototype.onstart=function(e){var t=this,i=t.options,r=e;return e=LT(e),t.updateBox(),LR(e,function(s){t.actives.length<i.maxNumberOfNipples?t.processOnStart(s):r.type.match(/^touch/)&&(Object.keys(t.manager.ids).forEach(function(i){if(0>Object.values(r.touches).findIndex(function(e){return e.identifier===i})){var s=[e[0]];s.identifier=i,t.processOnEnd(s)}}),t.actives.length<i.maxNumberOfNipples&&t.processOnStart(s))}),t.manager.bindDocument(),!1},LG.prototype.processOnStart=function(e){var t,i=this,r=i.options,s=i.manager.getIdentifier(e),a=e.force||e.pressure||e.webkitForce||0,o={x:e.pageX,y:e.pageY},h=i.getOrCreate(s,o);h.identifier!==s&&i.manager.removeIdentifier(h.identifier),h.identifier=s;var c=function(t){t.trigger("start",t),i.trigger("start "+t.id+":start",t),t.show(),a>0&&i.pressureFn(e,t,t.identifier),i.processOnMove(e)};if((t=i.idles.indexOf(h))>=0&&i.idles.splice(t,1),i.actives.push(h),i.ids.push(h.identifier),"semi"!==r.mode)c(h);else if(L_(o,h.position)<=r.catchDistance)c(h);else{h.destroy(),i.processOnStart(e);return}return h},LG.prototype.getOrCreate=function(e,t){var i,r=this.options;return/(semi|static)/.test(r.mode)?(i=this.idles[0])?(this.idles.splice(0,1),i):"semi"===r.mode?this.createNipple(t,e):(console.warn("Coudln't find the needed nipple."),!1):i=this.createNipple(t,e)},LG.prototype.processOnMove=function(e){let t,i,r,s;var a,o,h,c=this.options,d=this.manager.getIdentifier(e),u=this.nipples.get(d),p=this.manager.scroll;if(!(isNaN(e.buttons)?0!==e.pressure:0!==e.buttons))return void this.processOnEnd(e);if(!u){console.error("Found zombie joystick with ID "+d),this.manager.removeIdentifier(d);return}if(c.dynamicPage){var f=u.el.getBoundingClientRect();u.position={x:p.x+f.left,y:p.y+f.top}}u.identifier=d;var m=u.options.size/2,g={x:e.pageX,y:e.pageY};c.lockX&&(g.y=u.position.y),c.lockY&&(g.x=u.position.x);var v,y,x,b,w=L_(g,u.position),_=(v=g,t=(y=u.position).x-v.x,180/Math.PI*Math.atan2(y.y-v.y,t)),S=LS(_),C=w/m,M={distance:w,position:g};if("circle"===u.options.shape?(x=Math.min(w,m),a=u.position,o=x,i={x:0,y:0},h=LS(h=_),i.x=a.x-o*Math.cos(h),i.y=a.y-o*Math.sin(h),b=i):(r=g,s=u.position,x=L_(b={x:Math.min(Math.max(r.x,s.x-m),s.x+m),y:Math.min(Math.max(r.y,s.y-m),s.y+m)},u.position)),c.follow){if(w>m){let e=g.x-b.x,t=g.y-b.y;u.position.x+=e,u.position.y+=t,u.el.style.top=u.position.y-(this.box.top+p.y)+"px",u.el.style.left=u.position.x-(this.box.left+p.x)+"px",w=L_(g,u.position)}}else g=b,w=x;var E=g.x-u.position.x,A=g.y-u.position.y;u.frontPosition={x:E,y:A},c.dataOnly||LD(u.ui.front,u.frontPosition);var T={identifier:u.identifier,position:g,force:C,pressure:e.force||e.pressure||e.webkitForce||0,distance:w,angle:{radian:S,degree:_},vector:{x:E/m,y:-A/m},raw:M,instance:u,lockX:c.lockX,lockY:c.lockY};(T=u.computeDirection(T)).angle={radian:LS(180-_),degree:180-_},u.trigger("move",T),this.trigger("move "+u.id+":move",T)},LG.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(){"dynamic"===i.mode&&(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))},LG.prototype.onDestroyed=function(e,t){this.nipples.indexOf(t)>=0&&this.nipples.splice(this.nipples.indexOf(t),1),this.actives.indexOf(t)>=0&&this.actives.splice(this.actives.indexOf(t),1),this.idles.indexOf(t)>=0&&this.idles.splice(this.idles.indexOf(t),1),this.ids.indexOf(t.identifier)>=0&&this.ids.splice(this.ids.indexOf(t.identifier),1),this.manager.removeIdentifier(t.identifier),this.manager.unbindDocument()},LG.prototype.destroy=function(){for(var e in this.unbindEvt(this.options.zone,"start"),this.nipples.forEac
8104h(function(e){e.destroy()}),this.pressureIntervals)this.pressureIntervals.hasOwnProperty(e)&&clearInterval(this.pressureIntervals[e]);this.trigger("destroyed",this.nipples),this.manager.unbindDocument(),this.off()},Lq.prototype=new LW,Lq.constructor=Lq,Lq.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(e){return!(i=e.get(t))}),i}},Lq.prototype.create=function(e){return this.createCollection(e)},Lq.prototype.createCollection=function(e){var t=new LG(this,e);return this.bindCollection(t),this.collections.push(t),t},Lq.prototype.bindCollection=function(e){var t,i=this,r=function(e,r){t=e.type+" "+r.id+":"+e.type,i.trigger(t,r)};e.on("destroyed",i.onDestroyed.bind(i)),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)},Lq.prototype.bindDocument=function(){this.binded||(this.bindEvt(document,"move").bindEvt(document,"end"),this.binded=!0)},Lq.prototype.unbindDocument=function(e){Object.keys(this.ids).length&&!0!==e||(this.unbindEvt(document,"move").unbindEvt(document,"end"),this.binded=!1)},Lq.prototype.getIdentifier=function(e){var t;return e?void 0===(t=void 0===e.identifier?e.pointerId:e.identifier)&&(t=this.latest||0):t=this.index,void 0===this.ids[t]&&(this.ids[t]=this.index,this.index+=1),this.latest=t,this.ids[t]},Lq.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},Lq.prototype.onmove=function(e){return this.onAny("move",e),!1},Lq.prototype.onend=function(e){return this.onAny("end",e),!1},Lq.prototype.oncancel=function(e){return this.onAny("end",e),!1},Lq.prototype.onAny=function(e,t){var i,r=this,s="processOn"+e.charAt(0).toUpperCase()+e.slice(1);t=LT(t);var a=function(e,t,i){i.ids.indexOf(t)>=0&&(i[s](e),e._found_=!0)};return LR(t,function(e){i=r.getIdentifier(e),LR(r.collections,a.bind(null,e,i)),e._found_||r.removeIdentifier(i)}),!1},Lq.prototype.destroy=function(){this.unbindDocument(!0),this.ids={},this.index=0,this.collections.forEach(function(e){e.destroy()}),this.off()},Lq.prototype.onDestroyed=function(e,t){if(0>this.collections.indexOf(t))return!1;this.collections.splice(this.collections.indexOf(t),1)};var LX=new Lq,LY=new Map,LQ=new Map,LZ=class{constructor(e,t,i,r){this.data=t;let{audio:s,volume:a,delay:o,loop:h}=t;if(!s)throw Error("Missing property");let c="string"==typeof s?r.getAudio(s).src:s.data;this.audioPlayer=new EF({src:c,volume:a,delay:o,loop:h}),LQ.has(i.uuid)?LQ.get(i.uuid).push(this):LQ.set(i.uuid,[this]),LY.set(e,this)}playByToggle(){"stop"===this.data.toggle?"playing"===this.audioPlayer.status?this.audioPlayer.stop():(this.audioPlayer.stop(),this.audioPlayer.play()):"pause"===this.data.toggle?"playing"===this.audioPlayer.status?this.audioPlayer.pause():this.audioPlayer.play():(this.audioPlayer.stop(),this.audioPlayer.play())}dispose(){this.audioPlayer.stop()}},LK=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=LY.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=LQ.get(e);t?.length&&(this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{t.forEach(e=>e.audioPlayer[this.data.interaction]()),this.disposeDelay()},this.data.delay)):t.forEach(e=>e.audioPlayer[this.data.interaction]()))}pauseAllAudios(){let e=[...LQ.values()];e.length&&(this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{e.forEach(e=>{e.forEach(e=>{e.audioPlayer[this.data.interaction]()})}),this.disposeDelay()}
8104,this.data.delay)):e.forEach(e=>{e.forEach(e=>{e.audioPlayer[this.data.interaction]()})}))}disposeDelay(){clearTimeout(this.timeoutId),delete this.timeoutId}dispose(){clearTimeout(this.timeoutId),delete this.timeoutId}},LJ=class{constructor(e,t,i,r,s){if(this.data=t,this.shared=r,this.condition=s,"play"===t.interaction)this.interaction=new LZ(e,t,i,r);else if("pause"===t.interaction||"stop"===t.interaction)this.interaction=new LK(t);else throw Error("Missing property")}dispatchBasic(){if(!1===ID(this.shared,this.condition))return!1;this.interaction instanceof LZ?this.interaction.playByToggle():this.interaction.dispatch()}dispatchConditional(){if(!1===ID(this.shared,this.condition))return!1;this.interaction instanceof LZ?this.interaction.audioPlayer.play():this.interaction.dispatch()}dispatchGameControl(e){if(!1===ID(this.shared,this.condition))return!1;this.interaction instanceof LZ&&("start"===e?this.interaction.audioPlayer.play():this.interaction.audioPlayer.stop())}dispose(){this.interaction.dispose()}},L$=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,void 0!==e.delay&&(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()}}dispatchBasic(){if(!1===ID(this.shared,this.condition)||!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)}}dispatchConditional(){if(!1===ID(this.shared,this.condition)||!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)}}dispatchGameControl(e){if(!1===ID(this.shared,this.condition)||!this.particleSystem)return!1;"start"===e?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)}},L0=(e,t)=>t.some(t=>t instanceof RegExp?t.test(e):t===e),L1=class{constructor({url:e,context:t},i,r,s){if(this.controlsManager=i,this.shared=r,this.condition=s,!e)throw Error("Missing property");this.url=e.startsWith("mailto:")?e:function(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((e,{stripHash:t})=>{let i=/^data:(?<type>[^,]*?),(?<data>[^#]*?)(?:#(?<hash>.*))?$/.exec(e);if(!i)throw Error(`Invalid URL: ${e}`);let{type:r,data:s,hash:a}=i.groups,o=r.split(";");a=t?"":a;let h=!1;"base64"===o[o.length-1]&&(o.pop(),h=!0);let c=(o.shift()||"").toLowerCase(),d=[...o.map(e=>{let[t,i=""]=e.split("=").map(e=>e.trim());return"charset"===t&&"us-ascii"===(i=i.toLowerCase())?"":`${t}${i?`=${i}`:""}`}
vendor: 4,852 bytes, line 8104
8104).filter(Boolean)];return h&&d.push("base64"),(d.length>0||c&&"text/plain"!==c)&&d.unshift(c),`data:${d.join(";")},${h?s.trim():s}${a?`#${a}`:""}`})(e,t);if(/^view-source:/i.test(e))throw 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 Error("The `forceHttp` and `forceHttps` options cannot be used together");if(t.forceHttp&&"https:"===r.protocol&&(r.protocol="http:"),t.forceHttps&&"http:"===r.protocol&&(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 e=/\b[a-z][a-z\d+\-.]{1,50}:\/\//g,t=0,i="";for(;;){let s=e.exec(r.pathname);if(!s)break;let a=s[0],o=s.index;i+=r.pathname.slice(t,o).replace(/\/{2,}/g,"/"),i+=a,t=o+a.length}let s=r.pathname.slice(t,r.pathname.length);r.pathname=i+=s.replace(/\/{2,}/g,"/")}if(r.pathname)try{r.pathname=decodeURI(r.pathname)}catch{}if(!0===t.removeDirectoryIndex&&(t.removeDirectoryIndex=[/^index\.[a-z]+$/]),Array.isArray(t.removeDirectoryIndex)&&t.removeDirectoryIndex.length>0){let e=r.pathname.split("/");L0(e[e.length-1],t.removeDirectoryIndex)&&(r.pathname=(e=e.slice(0,-1)).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 e of[...r.searchParams.keys()])L0(e,t.removeQueryParameters)&&r.searchParams.delete(e);if(!0===t.removeQueryParameters&&(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}(e,{removeTrailingSlash:!1,removeSingleSlash:!1,stripWWW:!1}),this.context=t??"tab"}dispatch(){if(!1===ID(this.shared,this.condition))return!1;u3?window.location.assign(this.url):("tab"===this.context||u1&&"none"===this.context?window.open(this.url,"_blank"):"window"===this.context?window.open(this.url,"_blank",`width=${window.innerWidth}, height=${window.innerHeight}`):window.open(this.url,"_parent"),this.controlsManager.orbitControls?.onPointerUp(pt[0]),pt.splice(0,pt.length))}},L2=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=e=>{this.timeoutIdQueue.shift();let t=this.page.scene.find(e);if(void 0===t)return;let i=this.controlsManager.sharedGameControlGlobals.rapierWorld,r=!i||t.dataPatched.physics?.fusedBody;if(t.cloner){for(let e of t.cloner.children)r?(e.playModeVisible=!1,e.rigidBody&&t.dataPatched.physics?.rigidBody==="positioned"&&(this.controlsManager.sharedGameControlGlobals.colliderToEntity.delete(e.rigidBody.collider(0).handle),i.removeRigidBody(e.rigidBody),e.rigidBody=void 0),e.bvhGeometry&&(e.bvhGeometry=void 0)):void 0===this.clone||this.clone===e?(e.playModeVisible=!1,e.rigidBody&&(this.controlsManager.sharedGameControlGlobals.colliderToEntity.delete(e.rigidBody.collider(0).handle),i.removeRigidBody(e.rigidBody),e.rigidBody=void 0)):void 0===e.playModeVisible&&(e.playModeVisible=!0);(r||void 0===this.clone||!1===this.clone)&&(t.visible=!1,t.rigidBody&&(this.controlsManager.sharedGameControlGlobals.colliderToEntity.delete(t.rigidBody.collider(0).handle),i.removeRigidBody(t.rigidBody),t.rigidBody=void 0),t.bvhGeometry&&(t.bvhGeometry=void 0))}else t.rigidBody&&(this.controlsManager.sharedGameControlGlobals.colliderToEntity.delete(t.rigidBody.collider(0).handle),i.removeRigidBody(t.rigidBody),t.rigidBody=void 0),t.bvhGeometry&&(t.bvhGeometry=void 0),t.visible=!1;void 0===i?this.controlsManager.sharedGameControlGlobals.entitiesWithTransformAnim=this.controlsManager.sharedGameControlGlobals.entitiesWithTransformAnim.filter(e=>void 0!==e.bvhGeometry):this.controlsManager.sharedGameControlGlobals.entitiesWithTransformAnim=this.controlsManager.sharedGameControlGlobals.entitiesWithTransformAnim.filter(e=>void 0!==e.rigidBody),t.destroyedInAction=!0,this.controlsManager.requestRender()},this.objects=[...e.objects]}dispatch(e){if(!1===ID(this.shared,this.condition))return!1;this.clone=e,this.data.delay?this.timeoutIdQueue.push(window.setTimeout(this.dispatchInner,1e3*this.data.delay)):this.dispatchInner()}
8104dispatchFromStart(){if(!1===ID(this.shared,this.condition))return!1;this.timeoutIdQueue.push(window.setTimeout(this.dispatchInner,1e3*this.data.delay))}dispose(){this.timeoutIdQueue.forEach(e=>window.clearTimeout(e))}},L3=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(!1===ID(this.shared,this.condition))return!1;clearTimeout(this.timeoutId),delete this.timeoutId,this.timeoutId=window.setTimeout(()=>{this.shared.reset(this.shared.data,!0),Il(this.page,this.shared,!0),this.eventManager.reset(),this.eventManager.controlsManager.gameControl?.reset(!0),this.page.switchToPlayCamera(),this.eventManager.controlsManager.requestRender(),delete this.timeoutId},(this.data.delay??0)*1e3)}dispose(){clearTimeout(this.timeoutId),delete this.timeoutId}};function L4(e,t,i,r){var s,a;let o=[],h=EE(i,r)||!!t.layers&&EE(t,r);for(let c of(o.push((s=e,a=h,{update:()=>{s.transparent=a}})),e.layers)){let e=t.layers?.data(c.uuid),s=i.layers.data(c.uuid);if(s&&("light"===c.type||(c.visible??!0)&&(s.visible??!0)))for(let t of c.getNames().filter(e=>!gH.some(t=>e.includes(t))))try{let i=c.getValue(t),a;if("colors"===t)a=It(c,e,s,t);else if(Array.isArray(i))"steps"===t&&(a=Ie(c,e,s,t));else if("number"==typeof i)a=L5(c,e,s,t,r);else{if("boolean"==typeof i)continue;i instanceof tZ?a=L6(c,e,s,t):i instanceof iy?a=L8(c,e,s,t,r):i instanceof xA?a=L7(c,e,s,t,r):i instanceof ir?a=L9(c,e,s,t,r):"isTexture"in i&&(a=Ii(c,e,s,t))}a&&(Array.isArray(a)?o.push(...a):o.push(a))}catch(e){console.error(`lerpMaterial: unexpected material layer for ${t}`,e)}}return o}function L5(e,t,i,r,s){if(!e.hasValue(r)||!(r in i))return;let a=t?t[r]:e.getValue(r),o=i[r],h="string"==typeof a?Number(s.getVariable(a)??0):a,c="string"==typeof o?Number(s.getVariable(o)??0):o;if(h!==c)return{update:t=>{e.setValue(r,tQ.lerp(h,c,t))},start:()=>{e.setValue(r,h)},end:()=>{e.setValue(r,c)}}}function L6(e,t,i,r){if(!e.hasValue(r)||!(r in i))return;let s=e.getValue(r),a=t?new tZ().fromArray(t[r]):s.clone(),o=new tZ().fromArray(i[r]);if(!a.equals(o))return{update:e=>{s.lerpVectors(a,o,e)},start:()=>{s.copy(a)},end:()=>{s.copy(o)}}}function L8(e,t,i,r,s){if(!e.hasValue(r)||!(r in i))return;let a=e.getValue(r),o=t?t[r]:void 0,h=i[r],c=o?xk(new iy,o,s):a.clone(),d=xk(new iy,h,s);if(!c.equals(d))return{update:e=>{a.lerpVectors(c,d,e)},start:()=>{a.copy(c)},end:()=>{a.copy(d)}}}function L9(e,t,i,r,s){if(!e.hasValue(r)||!(r in i))return;let a=t?t[r]:void 0,o=i[r],h=e.getValue(r),c=a?"string"==typeof a?s.getColor(a).clone():new ir().setRGB(a.r,a.g,a.b):h.clone(),d="string"==typeof o?s.getColor(o).clone():new ir().setRGB(o.r,o.g,o.b);if(c.equals(d))return;let u=h.clone();return{update:t=>{e.getValue(r)!==u&&e.setValue(r,u),u.lerpColors(c,d,t)},start:()=>{u.copy(c)},end:()=>{u.copy(d)}}}function L7(e,t,i,r,s){if(!e.hasValue(r)||!(r in i))return;let a=t?t[r]:void 0,o=i[r],h=e.getValue(r),c=a?"string"==typeof a?s.color(a).clone():new ir().setRGB(a.r,a.g,a.b):h.clone(),d="string"==typeof o?s.getColor(o).clone():new xA(o.r,o.g,o.b,o.a);if(c.equals(d))return;let u=h.clone();return{update:t=>{e.getValue(r)!==u&&e.setValue(r,u),u.lerpColors(c,d,t)},start:()=>{u.copy(c)},end:()=>{u.copy(d)}}}function Ie(e,t,i,r="steps"){if(!e.hasValue(r)||!(r in i))return;let s=[],a=e.getValue(r),o=t?t[r]:a,h=i[r];return uV(o,h)||s.push({update:t=>{let i=[...a];for(let e=0;e<a.length;++e){let r=o[e],s=h[e];i[e]=tQ.lerp(r,s,t)}e.setValue(r,i)},start:()=>{e.setValue(r,o)},end:()=>{e.setValue(r,h)}}),s.length?s:void 0}function It(e,t,i,r="colors"){if(!e.hasValue(r)||!(r in i))return;let s=[],a=e.getValue(r),o=t?t[r]:a.map(e=>e.toArray()),h=i[r];for(let e=0;e<a.length;++e){let t=[...o[e]],i=[...h[e]];gs.isEqual(t,i)||s.push({update:r=>{a[e].fromArray(gs.lerp(t,i,r))},start:()=>{a[e].fromArray(t)},end:()=>{a[e].fromArray(i)}})}return s.length?s:void 0}function Ii(e,t,i,r="texture"){if(!e.hasValue(r)||!(r in i))return;let s=e.getNode("rotation"),a=t?.[r]?.rotation??0,o=i[r]?.rotation??0;if(s&&a!==o)return{update:e=>{s.value=tQ.lerp(a,o,e)*tQ.DEG2RAD},start:()=>{s.value=a*tQ.DEG2RAD},end:()=>{s.value=o*tQ.DEG2RAD}};let h=e.getNode("mat");if(!h)return;let c=t?t[r]:h,d=i[r],u=[...c.repeat],p=[...c.offset],f=[...d.repeat],m=[...d.offset],g=c.rotation??0,v=d.rotation??0;if(!gi.isEqual(u,f)||!gi.isEqual(p,m)||g!==v)return{update:e=>{h.repeat=gi.lerp(u,f,e),h.offset=gi.lerp(p,m,e),h.rotation=tQ.lerp(g,v,e),h.updateMatrix()},start:()=>{h.repeat=[...u],h.offset=[...p],h.rotation=g,h.updateMatrix()},end:()=>{h.repeat=[...f],h.offset=[...m],h.rotation=v,h.updateMatrix()}}}function Ir(e,t,i,r,s,a,o){if("colors"===e)It(t,i,r,e)?.forEach(e
8104=>e.update(s));else if(Array.isArray(a))"steps"===e&&Ie(t,i,r,e)?.forEach(e=>e.update(s));else if("number"==typeof a)L5(t,i,r,e,o)?.update(s);else{if("boolean"==typeof a)return;a instanceof tZ?L6(t,i,r,e)?.update(s):a instanceof iy?L8(t,i,r,e,o)?.update(s):a instanceof xA&&o?L7(t,i,r,e,o)?.update(s):a instanceof ir&&o?L9(t,i,r,e,o)?.update(s):"isTexture"in a&&Ii(t,i,r,e)?.update(s)}}var Is=new iy,Ia=new i4;function In(e,t,i,r,s){let a=[];return e.data.visible&&a.push(...function(e,t,i,r,s){let a=[],o,h,c,d,u,p,f,m;if(e instanceof DD?((o=xN("position",e,t,i,s))&&a.push(o),(c=xI("rotation",e,t,i,s))&&a.push(c),(d=xN("shear",e,t,i,s))&&a.push(d)):((p=xI("slide",m={slide:t.pathSnapping?.slide??e.updatedPathSnapping?.slide??e.dataPatched.pathSnapping?.slide??0,offset:t.pathSnapping?.offset??e.updatedPathSnapping?.offset??e.dataPatched.pathSnapping?.offset??0},t.pathSnapping??e.updatedPathSnapping??e.dataPatched.pathSnapping,i.pathSnapping??e.dataPatched.pathSnapping,s))&&a.push(p),(f=xI("offset",m,t.pathSnapping??e.updatedPathSnapping??e.dataPatched.pathSnapping,i.pathSnapping??e.dataPatched.pathSnapping,s))&&a.push(f),p||f||((o=xB("position",e,t,i,s))&&a.push(o),(h=xB("scale",e,t,i,s))&&a.push(h),(c=function(e,t,i,r,s){let a=t?.rotation?t.rotation.map(e=>("string"==typeof e?Number(s.getVariable(e)??0):e)*tQ.DEG2RAD):void 0,o=i.rotation?.map(e=>("string"==typeof e?Number(s.getVariable(e)??0):e)*tQ.DEG2RAD);if(!o)return;let h=a?new iy().fromArray(a):new iy().setFromEuler(e.rotation),c=new iy().fromArray(o);if(h.equals(c))return;let d=Is.subVectors(c,h);if(!(r&&d.toArray().every(e=>Math.abs(e)<2*Math.PI)))return{update:t=>{Is.lerpVectors(h,c,t),e.rotation.setFromVector3(Is)},start:()=>{e.rotation.setFromVector3(h)},end:()=>{e.rotation.setFromVector3(c)}};{let t=new iv().setFromEuler(Ia.setFromVector3(h)),i=new iv().setFromEuler(Ia.setFromVector3(c));return{update:r=>{!function(e,t,i,r){if(0===r)return i.copy(e);if(1===r)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 s=1-r;return i.w=s*e.w+r*t.w,i.x=s*e.x+r*t.x,i.y=s*e.y+r*t.y,i.z=s*e.z+r*t.z,i.normalize()}let o=Math.sqrt(a),h=Math.atan2(o,s),c=Math.sin((1-r)*h)/o,d=Math.sin(r*h)/o;i.w=e.w*c+t.w*d,i.x=e.x*c+t.x*d,i.y=e.y*c+t.y*d,i.z=e.z*c+t.z*d}(t,i,e.quaternion,r)},start:()=>{e.rotation.setFromVector3(h)},end:()=>{e.rotation.setFromVector3(c)}}}}(e,t,i,r,s))&&a.push(c),(u=function(e,t,i,r){let s=i[e]?i[e]:void 0,a=r[e];if(!a)return;let o=t[e],h=s?new iY().fromArray(s):o.clone(),c=new iy,d=new iv,u=new iy;h.decompose(c,d,u);let p=new iY().fromArray(a),f=new iy,m=new iv,g=new iy;if(p.decompose(f,m,g),!h.equals(p))return{update:e=>{xL.slerpQuaternions(d,m,e),xD.lerpVectors(c,f,e),xO.lerpVectors(u,g,e),o.compose(xD,xL,xO)},start:()=>{o.compose(c,d,u)},end:()=>{o.compose(f,m,g)}}}("hiddenMatrix",e,t,i))&&a.push(u))),o||h||c||u||p||f){let i=e instanceof DD?()=>{e.updateWorldMatrix(!0,!1,!0),e.resetBBoxNeedsUpdate()}:()=>{e.updateMatrix(),e.hasNonUniformScale&&(e.updateMatrixWorld(),e.updateMatrixWorldSVD()),e.parent?.matrixWorldFusedFalse&&(e.matrixWorld.multiplyMatrices(e.parent.matrixWorldFusedFalse,e.matrix),e.matrixWorldNeedsUpdate=!1),Tc(e)&&Td(e.parent)&&e.invali
8104dateDownstreamBooleanData(!0),e.updatePathSnapping(Object.assign({},t.pathSnapping,m))};a.push({update:i,start:i,end:i})}return a}(e,t,i,s,r)),e instanceof DD?a.push(...function(e,t,i,r){let s=[],a,o,h,c,d,u,p,f,m,g,v,y,x,b,w;if("width"in e&&(a=xI("width",e,t,i,r))&&s.push(a),"height"in e&&(o=xI("height",e,t,i,r))&&s.push(o),e instanceof DJ||e instanceof D5){let a={...t.fill},o={...i.fill};void 0!==a.enabled&&a.enabled!==o.enabled&&(s.push({update:()=>{e instanceof DJ&&(e.fill.enabled=!0)}}),a.enabled||Object.assign(a,{enabled:!0,color:{...a.color,a:0}}),o.enabled||Object.assign(o,{enabled:!0,color:{...o.color,a:0}})),(h=xF("color",e.fill,a,o,r))&&s.push(h)}if(e instanceof DJ){let a={...t.stroke},o={...i.stroke};(a.enabled||o.enabled)&&(s.push({update:()=>{e instanceof DJ&&(e.stroke.enabled=!0)}}),a.enabled||Object.assign(a,{enabled:!0,color:{...a.color,a:0}}),o.enabled||Object.assign(o,{enabled:!0,color:{...o.color,a:0}})),(c=xF("color",e.stroke,a,o,r))&&s.push(c),(d=xI("thickness",e.stroke,a,o,r))&&s.push(d)}if(e instanceof DJ){let a={...t.dropShadow},o={...i.dropShadow};(a.enabled||o.enabled)&&(s.push({update:()=>{e instanceof DJ&&(e.dropShadow.enabled=!0)}}),a.enabled||Object.assign(a,{enabled:!0,color:{...a.color,a:0}}),o.enabled||Object.assign(o,{enabled:!0,color:{...o.color,a:0}})),(u=xF("color",e.dropShadow,a,o,r))&&s.push(u),(p=xI("blurRadius",e.dropShadow,a,o,r))&&s.push(p),(m=xI("spread",e.dropShadow,a,o,r))&&s.push(m),(f=xN("offset",e.dropShadow,a,o,r))&&s.push(f)}if(e instanceof DJ){let a={...t.innerShadow},o={...i.innerShadow};(a.enabled||o.enabled)&&(s.push({update:()=>{e instanceof DJ&&(e.innerShadow.enabled=!0)}}),a.enabled||Object.assign(a,{enabled:!0,color:{...a.color,a:0}}),o.enabled||Object.assign(o,{enabled:!0,color:{...o.color,a:0}})),(g=xF("color",e.innerShadow,a,o,r))&&s.push(g),(v=xI("blurRadius",e.innerShadow,a,o,r))&&s.push(v),(x=xI("spread",e.innerShadow,a,o,r))&&s.push(x),(y=xN("offset",e.innerShadow,a,o,r))&&s.push(y)}if(e instanceof DJ||e instanceof D5){let a={...t.backgroundBlur},o={...i.backgroundBlur};(a.enabled||o.enabled)&&(s.push({update:()=>{e instanceof DJ&&(e.backgroundBlur.enabled=!0)}}),a.enabled||Object.assign(a,{enabled:!0,radius:0}),o.enabled||Object.assign(o,{enabled:!0,radius:0})),(b=xI("radius",e.backgroundBlur,a,o,r))&&s.push(b)}if(e instanceof DJ){let a={...t.layerBlur},o={...i.layerBlur};(a.enabled||o.enabled)&&(s.push({update:()=>{e instanceof DJ&&(e.layerBlur.enabled=!0)}}),a.enabled||Object.assign(a,{enabled:!0,radius:0}),o.enabled||Object.assign(o,{enabled:!0,radius:0})),(w=xI("radius",e.layerBlur,a,o,r))&&s.push(w)}if(e instanceof D5||e instanceof D0){let a=xR("cornerRadius",e,t,i,r);a&&s.push(a)}return s}(e,t,i,r)):(e.data.visible&&a.push(...function(e,t,i,r){let s=[];if(!("cloner"in i)||!e.cloner)return s;let a=e.cloner,o="cloner"in t?t.cloner:{},h=i.cloner;gp.forEach(e=>{let t;(t="count"===e?xI("count",a.parameters,o,h,r,!0):xj(e,a.parameters,o??{},h,r))&&s.push(t)});let c=function(e,t,i,r){if("radial"!==e.parameters.type)return;let s=t.radial,a=i.radial;if(!a)return;let o=e.parameters.radial,h=[];return gf.forEach(e=>{let t=xj(e,o,s??{},a,r);t&&h.push(t)}),h}(a,o,h,r);c?.length&&s.push(...c);let d=function(e,t,i,r){if("linear"!==e.parameters.type)return;let s=t.linear,a=i.linear;if(!a)return;let o=[],h=e.parameters.linear;return gm.forEach(e=>{let t=xj(e,h,s??{},a,r);t&&o.push(t)}),o}(a,o,h,r);d?.length&&s.push(...d);let u=function(e,t,i,r){if("grid"!==e.parameters.type)return;let s=t.grid,a=i.grid;if(!a)return;let o=[],h=e.parameters.grid;return gg.forEach(e=>{let t;(t="count"===e?xR(e,h,s??{},a,r,!0):xj(e,h,s??{},a,r))&&o.push(t)}),o}(a,o,h,r);u?.length&&s.push(...u);let p=function(e,t,i,r){if("toObject"!==e.parameters.type)return;let s=t.toObject,a=i.toObject;if(!a)return;let o=[],h=e.parameters.toObject;return gv.forEach(e=>{let t;(t="count"===e?xI(e,h,s??{},a,r,!0):xj(e,h,s??{},a,r))&&o.push(t)}),o}(a,o,h,r);p?.length&&s.push(...p);let f=function(e,t,i,r){if(!e.parameters.randomness)return;let s=t.randomnessObject,a=i.randomnessObject;if(!a)return;let o=[],h=e.parameters.randomnessObject;
8104return gy.forEach(e=>{let t=xj(e,h,s??{},a,r);t&&o.push(t)}),o}(a,o,h,r);return f?.length&&s.push(...f),s.length&&s.push({update:()=>{a.update()}}),s}(e,t,i,r)),e instanceof Cf?(e instanceof Al&&e.data.visible&&a.push(...function(e,t,i,r){let s=[];if(!("geometry"in i))return s;let a=e.geometry.userData.parameters,o="geometry"in t?t.geometry:{},h=i.geometry;if(e instanceof Ap){let t=function(e,t,i,r){if(void 0===i.scaleBaked)return;let s=(t.scaleBaked??e.data.geometry.scaleBaked).map(e=>"string"==typeof e?Number(r.getVariable(e)??0):e),a=i.scaleBaked.map(e=>"string"==typeof e?Number(r.getVariable(e)??0):e);if(gr.isEqual(s,a))return;let o=[];return o.push({update:t=>{e.updateGeometryInteractions({scaleBaked:[tQ.lerp(s[0],a[0],t),tQ.lerp(s[1],a[1],t),tQ.lerp(s[2],a[2],t)]},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()}}),o}(e,o,h,r);t&&s.push(...t)}else{let t={};if(Object.assign(t,uQ(a,gK),uQ(o,gK)),gK.forEach(e=>{let i=xj(e,t,o,h,r);i&&s.push(i)}),e instanceof Og){Object.assign(t,{extrusion:{...a.extrusion}});let e=function(e,t,i,r){if(!i.extrusion)return;let s=e.extrusion,a=t.extrusion??{},o=i.extrusion,h=[];return gZ.forEach(e=>{let t=xj(e,s,a,o,r);t&&h.push(t)}),h}(t,o,h,r);e&&s.push(...e)}s.length&&s.push({update:i=>{e.updateGeometryInteractions(t,r),e.updateGeometryGroupsIfNeeded(),e.refreshAttachedClonersInteractions()},start:i=>{e.updateGeometryInteractions(t,r),e.updateGeometryGroupsIfNeeded(),e.refreshAttachedClonersInteractions()},end:i=>{e.updateGeometryInteractions(t,r),e.updateGeometryGroupsIfNeeded(),e.refreshAttachedClonersInteractions()}})}return s}(e,t,i,r)),e.data.visible&&a.push(...function(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:[],o=i.materials;e.material.forEach((e,t)=>{if(!o[t])return;let i=a[t]??{},h=o[t];"string"==typeof i||"string"==typeof h||s.push(...L4(e,i,h,r))})}else{if(!("material"in i&&i.material))return s;let a="material"in t&&t.material?t.material:{},o=i.material;if("string"==typeof a||"string"==typeof o)return s;s.push(...L4(e.material,a,o,r))}return s}(e,t,i,r))):DE.is(e)?e.data.visible&&a.push(...function(e,t,i,r){let s=[];if(void 0!==i.intensity){let a=xI("intensity",e,t,i,r);a&&s.push(a)}if(void 0!==i.color){let a=function(e,t,i,r,s){let a=i[e]?i[e]:void 0,o=r[e];if(!o)return;let h=t[e],c=a?"string"==typeof a?s.getColor(a).clone():new ir().setRGB(a.r,a.g,a.b):h.clone(),d="string"==typeof o?s.getColor(o).clone():new ir().setRGB(o.r,o.g,o.b);if(c.equals(d))return;let u=h.clone();return{update:i=>{u.lerpColors(c,d,i),t[e]?.copy?.(u)},start:()=>{u.copy(c)},end:()=>{u.copy(d)}}}("color",e,t,i,r);a&&s.push(a)}return s}(e,t,i,r)):e instanceof Ts&&a.push(...function(e,t,i,r){let s=[],a="OrthographicCamera"===e.cameraType?t.orthographic?.zoom:t.perspective?.zoom,o="OrthographicCamera"===e.cameraType?i.orthographic?.zoom:i.perspective?.zoom;if(void 0!==o){let t=a??e.zoom;t!==o&&s.push({update:i=>{e.zoom=tQ.lerp(t,o,i),e.updateProjectionMatrix()},start:()=>{e.zoom=t,e.updateProjectionMatrix()},end:()=>{e.zoom=o,e.updateProjectionMatrix()}})}if(void 0!==i.targetOffset){let a=xI("targetOffset",e,t,i,r);a&&s.push(a)}return s}(e,t,i,r))),a.length?{update:e=>{a.forEach(t=>t.update(e))},start:e=>{a.forEach(t=>t.start?.(e))},end:e=>{a.forEach(t=>t.end?.(e))}}:void 0}var Io=new iy;function Il(e,t,i=!1){let r=[],s=i=>{let r=i.data;for(let e of(delete i.states,i.currentState=null,i.reversibleToState=null,i.currentTransitionEvent=null,r.states)){let t={...e.data};i.states||(i.states={}),i.states[e.id]=xo.patch(r,t)}Ic(e.scene,i,null,t,void 0!==r.events.find(e=>"Follow"===e.data.type||"LookAt"===e.data.type)),Ih(e)};e.scene.traverse2D(s),e.traverseChildren(a=>{if(i&&(a.rigidBody?.setTranslation(a.position0,!0),a.rigidBody?.setRotation(a.rotation0,!0),a.rigidBody?.setLinvel(Io,!0),a.rigidBody?.setAngvel(Io,!0)),!SL.is(a))return;let o=a.uuid,h=a.data;if(delete a.states,a.uuid===mE)return;let c=!1;for(let t of(r.some(t=>e.scene.find(o)?.isDescendantOf(t))?c=!0:h.physics?.fusedBody===!0&&"dynamic"===h.physics.rigidBody&&r.push(o),a.data=h,a.currentState=null,a.reversibleToState=null,a.currentTransitionEvent=null,h.states)){let i={...t.data};!0===e.data.globalPhysics.usePhysics&&h.physics&&("dynamic"===h.physics.rigidBody||c)&&
8104(void 0!==t.data.position&&delete i.position,void 0!==t.data.rotation&&delete i.rotation,void 0!==t.data.hiddenMatrix&&delete i.hiddenMatrix),a.states||(a.states={}),a.states[t.id]=yG.patch(h,i)}Ic(e.scene,a,null,t,void 0!==h.events.find(e=>"Follow"===e.data.type||"LookAt"===e.data.type)),a instanceof O_&&a.frame&&(a.frame.traverse(e=>s(e)),a.uiCanvas?.applySize())}),Ih(e),e.frame&&(e.frame.traverse(e=>s(e)),e.uiCanvas?.applySize())}function Ih(e){e.traverseEntity(t=>{for(let i of t.data.events){let t=[];switch(i.data.type){case"Follow":case"MouseHover":case"Scroll":case"MouseDown":case"MouseUp":case"MousePress":case"KeyUp":case"KeyDown":case"KeyPress":case"Collision":t.push(...i.data.actions);break;case"GameControl":for(let e of Object.values(i.data.gameActions))t.push(...e);break;case"DragDrop":t.push(...i.data.dragDropActions.drag,...i.data.dragDropActions.drop);break;case"Conditional":t.push(...i.data.inActions,...i.data.outActions)}for(let i of t)if("Create"===i.data.type&&"Yes"===i.data.hideBase){let t=e.scene.find(i.data.object);t&&(t.visible=!1)}}})}function Ic(e,t,i,r,s=!1){if(t instanceof Al&&!(t instanceof OJ)&&t.removeInteractionGeometry(r),t instanceof DD?t.changeSelectedState(i,{shared:r},s):t.changeSelectedState(i,{scene:e,shared:r},s),t instanceof Al&&t.updateGeometryGroupsIfNeeded(),t instanceof Ts&&t.updateCameraState(t.dataPatched,{scene:e,shared:r}),!(t instanceof DD)){if(t.cloner)for(let e of t.cloner.children)e.playModeVisible=void 0;t.updateVisible()}}function Id(e){let t;if(5===e.easing){let{control1:i,control2:r}=e;t=`cubicBezier(
8105			${i[0]}, ${i[1]}, ${r[0]}, ${r[1]}
8106		)`}else if(6===e.easing){let{mass:i,stiffness:r,damping:s,velocity:a}=e;t=`spring( ${i}, ${r}, ${s}, ${a} )`}else{let i;switch(e.easing){case 0:default:i=gA.linear;break;case 1:i=gA.ease;break;case 2:i=gA.easeIn;break;case 3:i=gA.easeOut;break;case 4:i=gA.easeInOut}let[r,s,a,o]=i;t=`cubicBezier( ${r}, ${s}, ${a}, ${o} )`}return{duration:Math.max(e.duration,1e-4),easing:t}}function Iu(e){let t={delay:0,loop:-1===e.repeat||e.repeat+1};if(0===e.repeat)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}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}return"alternate"===t.direction&&(t.delay/=2,t.endDelay/=2,"start"===e.delayDirection?(t.pingPongDelayCorrection=t.delay,"number"==typeof t.loop&&t.loop%2==0&&(t.pingPongEndDelayCorrection=t.delay)):"end"===e.delayDirection?"number"==typeof t.loop&&t.loop%2!=0&&(t.pingPongEndDelayCorrection=t.endDelay):"start-end"===e.delayDirection&&(t.pingPongDelayCorrection=t.delay,t.pingPongEndDelayCorrection=t.endDelay)),t}var Ip={type:"beginState"},If={type:"completeState",isfromEntity:!1},Im=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()),0===this.targets.t||1===this.targets.t?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 e=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=e,this.object.dispatchEvent({type:"beginState",state:e}),this.object instanceof DD||this.object.traverseEntity(e=>{e!==this.object&&e instanceof Ts&&e.dispatchEvent(Ip)})},this.onChangeComplete=()=>{this.firstLoop&&(this.onFirstLoop(),this.firstLoop=!1),this.object.reversibleToState=this.to.id;let e=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=e,this.object.dispatchEvent({type:"completeState",state:e}),this.object instanceof DD||this.object.traverseEntity(e=>{e!==this.object&&e instanceof Ts&&e.dispatchEvent(If)})},this.onFirstLoop=()=>{this.useCurrentState&&(this.callback=In(this.object,this.from.data,this.to.data,this.sharedAssets,this.allowSlerp))},void 0===t){let e=Iv(this.object,this.object.currentState===i?this.object.prevState:this.object.currentState);if(!e)throw Error("Missing property");this.from=e}else{let e=Iv(this.object,t);if(!e)throw Error("Missing property");this.from=e}if(void 0===i)throw Error("Missing property");{let e=Iv(this.object,i);if(!e)throw Error("Missing property");this.to=e}this.useCurrentState=void 0===t||void 0===i,this.params={targets:this.targets,t:1,autoplay:!1,...Iu(r),...Id(r),change:this.onChange},this.callback=In(this.object,void 0===t?{}:this.from.data,void 0===i?{}:this.to.data,this.sharedAssets,this.allowSlerp)}get changeBegan(){return this._changeBegan}get changeCompleted(){return this._changeCompleted}},Ig=class extends tk{constructor(e,t,i,r,s){if(super(),this.eventType=e,this.data=t,this.page=i,this.shared=r,this.condition=s,this.toggleIsForward=!1,this.timelineNeedsRebuild=!1,this.hasPlayedOnce=!1,this.onTimelineChangeComplete=()=>{"normal"!==this.data.tweens[0].data.direction&&(this.toggleIsForward=!this.toggleIsForward),!1!==this.timelineNeedsRebuild&&(this.timeline?.pause(),this.buildTimeline({isForward:this.toggleIsForward,needsRebuild:!1,isRebuild:!0}),this.timeline.play())},!t.object)throw Error("Missing property");let a=this.page.scene.find(t.object)??this.page.uiCanvas?.find(t.object)??this.page.scene.find2DInUIObjects(t.object);if(!a||!a.states||(this.object=a,t.tweens.length<2))throw Error("Missing property");this.tweens=Array(this.data.tweens.length-1),this.startOnceDelay="start-once"===t.tweens[0].data.delayDirection?t.tweens[0].data.delay:0,this.init()}get playing(){return this.timeline?.paused===!1}
8106get changeBegan(){return this.tweens.some(e=>e.changeBegan)??!1}init(){this.initialCurrentState=Iv(this.object,this.object.currentState).id,this.toggleIsForward=!1}get currentState(){return"Toggle"===this.data.runMode&&mb(this.eventType)?this.initialCurrentState:this.object.currentState}buildTimeline({isForward:e=!0,needsRebuild:t=!1,isRebuild:i=!1}={}){try{let r=Iu(this.data.tweens[0].data);i&&"number"==typeof r.loop&&r.loop--,this.timeline?.pause(),this.timeline=xM.timeline({autoplay:!1,...r,...!0===r.loop||r.loop>1?{timelineChangeComplete:this.onTimelineChangeComplete}:{}});let s=this.tweens.findIndex(e=>e?.changeBegan);if(!0===t&&(this.timelineNeedsRebuild=!0),e){let e=-1===s?0:s;for(let t=e;t<this.data.tweens.length-1;t++){let i=this.data.tweens[t],a=this.data.tweens[t+1],o;t===e&&(!0===this.object.wasMovedByUser||this.object.previousAction?.changeBegan===!0)?(o=void 0,this.object instanceof Ts&&(this.object.wasMovedByUser=!1)):o=void 0===i.data.state?this.currentState:i.data.state;let h=new Im(this.object,o,void 0===a.data.state?this.currentState:a.data.state,a.data,this.shared,this.data.allowSlerp??!1);-1!==s&&t===e&&Object.assign(h.params,{startOnceDelay:0}),this.tweens[t]=h,this.timeline.add(h.params,this.timeline.duration+(t===e?r.delay:0))}this.timeline.duration+=r.endDelay}else{let e=-1===s?this.data.tweens.length-1:s+1;for(let t=e;t>0;t--){let i=this.data.tweens[t],a=this.data.tweens[t-1],o;t===e&&(!0===this.object.wasMovedByUser||this.object.previousAction?.changeBegan===!0)?(o=void 0,this.object instanceof Ts&&(this.object.wasMovedByUser=!1)):o=void 0===i.data.state?this.currentState:i.data.state;let h=new Im(this.object,o,void 0===a.data.state?this.currentState:a.data.state,i.data,this.shared,this.data.allowSlerp??!1);-1!==s&&t===e&&Object.assign(h.params,{startOnceDelay:0}),this.tweens[t-1]=h,this.timeline.add(h.params,this.timeline.duration+(t===e?r.endDelay:0))}this.timeline.duration+=r.delay}}catch(e){e instanceof Error&&console.error(e.message)}this.object.previousAction?.playing===!0&&this.object.previousAction.pause(),this.object.previousAction=this}play(){if(!1===ID(this.shared,this.condition)||mb(this.eventType)&&"Once"===this.data.runMode&&this.hasPlayedOnce||(this.hasPlayedOnce=!0,this.playing))return!1;this.startTimeout?.pause();let e=Iu(this.data.tweens[0].data).pingPongDelayCorrection;xM({targets:{},duration:this.startOnceDelay+e,easing:"linear",complete:()=>{try{this.buildTimeline(),this.timeline.play()}catch(e){e instanceof Error&&console.error(e.message)}}})}pause(){this.timeline?.pause(),this.startTimeout?.pause(),this.tweens=Array(this.data.tweens.length-1),delete this.startTimeout}stop(){this.pause();let e=void 0===this.data.tweens[0].data.state?this.initialCurrentState:this.data.tweens[0].data.state;this.object instanceof DD?this.object.changeSelectedState(e,{shared:this.shared}):this.object.changeSelectedState(e,{scene:this.page.scene,shared:this.shared}),this.object.currentState=e}seek(e){if(!1===ID(this.shared,this.condition))return!1;void 0===this.timeline&&this.buildTimeline(),this.timeline?.seek(e*this.timeline.duration,!0)}toggle(e){if(!1===ID(this.shared,this.condition))return!1;this.startTimeout?.pause(),this.toggleIsForward=e??!this.toggleIsForward,this.playing?(this.timeline?.pause(),this.buildTimeline({isForward:this.toggleIsForward,needsRebuild:!0}),this.timeline.play()):xM({targets:{},duration:this.startOnceDelay,easing:"linear",complete:()=>{this.timeline?.pause(),this.buildTimeline({isForward:this.toggleIsForward}),this.timeline.play()}})}playFromCurrent(){this.toggle(!0)}reverseFromCurrent(){this.toggle(!1)}dispose(){this.pause()}};function Iv(e,t){let i,r;if("string"==typeof t?(i=t,r=e.states?.[i]):null===t&&(i=null,r=e.data),void 0!==i&&void 0!==r)return{id:i,data:r}}var Iy={type:"beginState"},Ix={type:"completeState",isfromEntity:!1},Ib={type:"requestRender"},Iw=class extends tk{constructor(e,t,i,r){super(),this.data=e,this.page=t,this.shared=i,this.condition=r,this.toggleIsForward=!1,this.posStart=new iy,this.posEnd=new iy,this.qStart=new iv,this.qEnd=new iv,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 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=xM({targets:i,t:1,...Id(this.data),update:()=>{0===i.t&&("Toggle"!==this.data.runMode||this.toggleIsForward?(this.posEnd.copy(t.position),this.qEnd.copy(t.quaternion),this.zoomEnd=t.zoom,this.fromCamera=this.page.activeCamera,this.switchCamera(t.uuid)):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.page.activeCamera.dispatchEvent(Iy));let e=this.page.activeCamera;e.position.lerpVectors(this.posStart,this.posEnd,i.t),e.quaternion.slerp
8106Quaternions(this.qStart,this.qEnd,i.t),e.zoom=this.zoomStart+(this.zoomEnd-this.zoomStart)*i.t,e.wasMovedBySwitchCameraAction=!0,e.updateMatrix(),e.updateMatrixWorld(),e.updateProjectionMatrix(),e.dispatchEvent(Ib),1===i.t&&e.dispatchEvent(Ix)}})}switchCamera(e){let t=this.page.activeCamera,i=this.page.scene.find(e);if(!i||!i.visible)throw ReferenceError("Target camera not founded or not visible");this.page.switchActiveCamera(i),t.dispatchEvent({type:"cameraChange",camera:i})}play(){if(!1===ID(this.shared,this.condition))return!1;if(!this.playing&&this.page.activeCamera.uuid!==this.data.targetCamera)try{clearTimeout(this.timeoutId),this.timeoutId=window.setTimeout(()=>{delete this.timeoutId,this.data.animate?(this.buildAnimation(),this.animation?.play()):this.switchCamera(this.data.targetCamera)},1e3*this.data.delay)}catch{}}pause(){this.animation?.pause(),clearTimeout(this.timeoutId),delete this.timeoutId}toggle(e){if(!1===ID(this.shared,this.condition))return!1;if(window.clearTimeout(this.timeoutId),delete this.timeoutId,e!==this.toggleIsForward)try{this.playing?(this.animation?.pause(),this.toggleIsForward=e??!this.toggleIsForward,this.buildAnimation(!0),this.animation?.play()):this.timeoutId=window.setTimeout(()=>{this.toggleIsForward=e??!this.toggleIsForward,this.data.animate?(this.animation?.pause(),this.buildAnimation(),this.animation?.play()):(this.toggleIsForward?(this.fromCamera=this.page.activeCamera,this.switchCamera(this.data.targetCamera)):this.fromCamera&&this.switchCamera(this.fromCamera.uuid),this.page.activeCamera.dispatchEvent(Ix),this.page.activeCamera.dispatchEvent(Ib))},1e3*this.data.delay)}catch{}}playFromCurrent(){this.toggle(!0)}reverseFromCurrent(){this.toggle(!1)}dispose(){this.pause(),this.toggleIsForward=!1}},I_=class extends tk{constructor(e,t,i,r){super(),this.id=e,this.data=t,this.scene=i,this.sharedAssets=r,this._finished=!1;try{this.timeline=xM.timeline({...Iu(this.data),autoplay:!1});let e=this.sharedAssets.data.timelineAnimations[this.data.timeline].mapping;Object.entries(e).forEach(([e,t])=>{var i;let r=this.scene.find(e);if(!r)return;let s=r.data.timelineAnimations[t];if(!s)return;let a=bA.addKeyframesToTimeline(r,{...s},(i=this.sharedAssets,{position(e){Object.assign(r.position,e),void 0!==e.z&&(r.updateMatrix(),r.resetBBoxNeedsUpdate(),r.dispatchEvent({type:"requestRender"}))},rotation(e){let t=Object.keys(e)[0];r.rotation[t]=e[t]*tQ.DEG2RAD,void 0!==e.z&&(r.updateMatrix(),r.resetBBoxNeedsUpdate(),r.dispatchEvent({type:"requestRender"}))},scale(e){Object.assign(r.scale,e),void 0!==e.z&&(r.updateMatrix(),r.resetBBoxNeedsUpdate(),r.dispatchEvent({type:"requestRender"}))},shapeSize(e){r instanceof Al&&(r.userData.value={...r.userData.value,...e},void 0!==e.z&&(r.updateGeometryInteractions({width:r.userData.value.x,height:r.userData.value.y,depth:r.userData.value.z},i),r.resetBBoxNeedsUpdate(),r.invalidateDownstreamBooleanData(),r.dispatchEvent({type:"requestRender"})))},material(e,t,s){s&&(Object.entries(s).forEach(([e,{start:r,end:s,t:a}])=>{let o=t.getValue(e);void 0!==o&&Ir(e,t,r,s,a,o,i)}),r.dispatchEvent({type:"requestRender"}))},opacity(e){if(r instanceof Cf&&!Array.isArray(r.material)){let t=r.material.getLayersOfType("light")[0];r.material.transparent=!0,Ir("alphaOverride",t,{alphaOverride:e},{alphaOverride:e+1},0,e,i),r.dispatchEvent({type:"requestRender"})}},light(e,t){(r instanceof Dg||r instanceof Of||r instanceof Db)&&(r[e]=t,r.dispatchEvent({type:"requestRender"}))},cloner(e){e.cloner?.update(),e.dispatchEvent({type:"requestRender"})},pathExtrusion(e,t){e.geometry.userData.parameters.extrusion={...e.geometry.userData.parameters.extrusion,...t},e.updateGeometryInteractions({extrusion:{...e.geometry.userData.parameters.extrusion}},i),e.resetBBoxNeedsUpdate(),e.invalidateDownstreamBooleanData(),e.dispatchEvent({type:"requestRender"})},pathSnapping(e){r.userData.pathSnapping={...r.userData.pathSnapping,...e},r.updatePathSnapping(r.userData.pathSnapping),r.dispatchEvent({type:"requestRender"})}}),this.sharedAssets),o=("start"===this.data.delayDirection?this.data.delay:0)+("start-end"===this.data.delayDirection?this.data.delay:0);
8106a.forEach(e=>{this.timeline?.add(e,o)}),this.timeline.duration=1e3*s.to+o}),this.timeline.delay=0,this.timeline.duration+=("start"===this.data.delayDirection?this.data.delay:0)+("end"===this.data.delayDirection?this.data.delay:0)+("start-end"===this.data.delayDirection?2*this.data.delay:0),this.core=this.timeline,this.core.finished.then(()=>{Object.keys(e).forEach(e=>{let t=this.scene.find(e);t instanceof Ts&&t.dispatchEvent(If)}),this._finished=!0}),this.startOnceDelay="start-once"===this.data.delayDirection?this.data.delay:0}catch(e){throw Error("Missing property")}}get finished(){return this._finished}get paused(){return this.core.paused}play(){this._finished||(this.startTimeout?.pause(),this.startTimeout=xM({targets:{},duration:this.startOnceDelay,easing:"linear",complete:()=>{Object.keys(this.sharedAssets.data.timelineAnimations[this.data.timeline].mapping).forEach(e=>{let t=this.scene.find(e);t instanceof Ts&&t.dispatchEvent(Ip)}),this.core.play()}}))}pause(){this.core.pause(),this.startTimeout?.pause(),delete this.startTimeout}stop(){this.pause(),this.seek(0),this.core.reset(),this._finished=!1}seek(e){let t=e*this.core.duration;this.core.seek(t)}toggle(e){this.core.pause(),this.startTimeout?.pause(),this.core=this.timeline,this.core.finished.then(()=>{this._finished=!0,this.core.reverse()}),this.core.play()}playFromCurrent(){this.toggle(!0)}reverseFromCurrent(){this.toggle(!1)}dispose(){this.pause()}};function IS(e){let t=e?.tracks.filter(e=>"vector"===e.ValueTypeName||"quaternion"===e.ValueTypeName).map(e=>e.times.length);if(t?.length){let e=t&&t.length?uW(t,h1,uU):void 0;return e&&e>2?e:2}return 2}var IC=class extends tk{constructor(e,t,i,r,s){super(),this.data=e,this.page=t,this.animationControls=i,this.shared=r,this.condition=s,this.startOnceDelay=0,this.toggleIsForward=!1;let a=e.object,o=t.scene.find(e.object);o&&Array.isArray(o.identity)&&(a=o.identity[0]),this.data={...e,object:a};let h=this.animationControls.clipIdToAction[e.clipId+"/"+a];if(this.duration=h?.getClip()?.duration??1,this.data.crop2){let e=IS(h?.getClip());this.leftFrameTime=this.data.crop2[0]/(e-1)*this.duration,this.rightFrameTime=this.data.crop2[1]/(e-1)*this.duration}else{let e=h?.getClip()?.tracks[0]?.times.length;e&&e>1?(this.leftFrameTime=this.data.crop[0]/e*this.duration,this.rightFrameTime=this.data.crop[1]/e*this.duration):(this.leftFrameTime=0,this.rightFrameTime=this.duration)}this.startOnceDelay=e.delay}get playing(){return this.threeAnimAction?.isRunning()??!1}play(e=!1){if(!1===ID(this.shared,this.condition))return!1;window.clearTimeout(this.timeoutId),this.timeoutId=window.setTimeout(()=>{if(this.threeAnimAction=this.animationControls.play(this.data),!this.threeAnimAction)return;this.threeAnimAction.reset(),this.threeAnimAction.time=this.leftFrameTime,this.threeAnimAction._clip.start=this.leftFrameTime,this.threeAnimAction._clip.duration=this.rightFrameTime;let t=this.data.object;Object.entries(this.animationControls.clipIdToAction).forEach(([i,r])=>{let s=i.split("/")[1];this.threeAnimAction!==r&&s===t&&r.isRunning()&&(e?r.fadeOut(.2):r.stop())}),e&&this.threeAnimAction?.fadeIn(.2)},this.startOnceDelay)}pause(){this.threeAnimAction&&(this.threeAnimAction.paused=!0),window.clearTimeout(this.timeoutId),delete this.timeoutId}stop(){this.threeAnimAction?.fadeOut(.2)}seek(e){this.threeAnimAction=this.animationControls.play(this.data),this.threeAnimAction&&(this.threeAnimAction.paused=!0,this.threeAnimAction.time=tQ.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(!1===ID(this.shared,this.condition))return!1;this.toggleIsForward=e??!this.toggleIsForward,this.threeAnimAction&&(this.threeAnimAction._loopCount=0),this.playing?this.threeAnimAction&&(this.threeAnimAction.timeScale=this.toggleIsForward?1:-1,this.toggleIsForward?(this.threeAnimAction._clip.start=this.leftFrameTime,this.threeAnimAction._clip.duration=this.rightFrameTime):(this.threeAnimAction._clip.start=this.rightFrameTime,this.threeAnimAction._clip.duration=this.leftFrameTime)):this.timeoutId=window.setTimeout(()=>{if(this.threeAnimAction=this.animationControls.play(this.data),this.threeAnimAction){this.toggleIsForward?(this.threeAnimAction.time=this.leftFrameTime,this.threeAnimAction._clip.start=this.leftFrameTime,this.threeAnimAction._clip.duration=this.rightFrameTime):(this.threeAnimAction.time=this.rightFrameTime,this.threeAnimAction._clip.start=this.rightFrameTime,this.threeAnimAction._clip.duration=this.leftFrameTime),this.threeAnimAction.paused=!1,this.threeAnimAction.timeScale=this.toggleIsForward?1:-1;let e=this.data.clipId.split("/")[1];
vendor: 4,213 bytes, line 8106
8106Object.entries(this.animationControls.clipIdToAction).forEach(([i,r])=>{let s=i.split("/")[1];this.threeAnimAction!==r&&s===e&&r.isRunning()&&(t?r.fadeOut(.2):r.stop())}),t&&this.threeAnimAction?.fadeIn(.2)}},this.startOnceDelay)}playFromCurrent(){this.toggle(!0)}reverseFromCurrent(){this.toggle(!1)}dispose(){let e=this.animationControls.clipIdToAction[this.data.clipId+"/"+this.data.object]?.getClip();e&&(e.duration=this.duration),this.pause()}},IM=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(!1===ID(this.shared,this.condition))return!1;this.data.target!==this.page.uuid&&(window.clearTimeout(this.timeOutId),this.timeOutId=window.setTimeout(()=>{this.play()},1e3*this.data.delay))}dispose(){window.clearTimeout(this.timeOutId)}play(){if(this.scene.children.every(e=>e.uuid!==this.data.target||e.data.uiScene))return;"fade"===this.data.transition&&this.data.duration>0&&this.eventManager.eventContext.renderer.renderFromSceneForSceneTransitionPass(this.scene,this.scene.activeCamera,1e3*this.data.duration),this.eventManager.deactivate(),this.eventManager.controlsManager.deactivate();let e=this.scene.activeCamera;this.scene.updatePage(this.data.target),this.scene.traverseVisibleEntity(e=>{"ParticleSystem"===e.type&&(e.sleep(),e.wakeUp(),e.data.autoPlay?e.start():e.stop())}),this.scene.activePage.switchToPlayCamera(),this.scene.activeCamera.copyViewPlaneSize(e),Il(this.scene.activePage,this.shared),this.eventManager.activate(),this.eventManager.controlsManager.activate(this.eventManager)}},IE=class{constructor(e,t,i,r){this.data=e,this.page=t,this.shared=i,this.condition=r,this.evaluatedCondition=!1}checkConditions(){this.evaluatedCondition=ID(this.shared,this.condition)}dispatch(){if(!1===this.evaluatedCondition)return!1;let e=this.shared.getVariable(this.data.variableId),t=SC(this.data.expression,this.shared,y2.typeOfVariable(e));void 0!==t&&this.shared.updateVariable(this.data.variableId,"string"==typeof t?{textValue:t}:t)}dispose(){}},IA=class{constructor(e,t,i,r){this.data=e,this.page=t,this.shared=i,this.condition=r,this.timeoutId=null}dispatchInner(){if(!1===ID(this.shared,this.condition))return!1;let e=this.shared.getDynamicVariablePlayState(this.data.variableId);if("PlayPause"===this.data.mode)void 0===this.shared.getDynamicVariableToggleIsForward(this.data.variableId)&&this.shared.setDynamicVariableToggleIsForward(this.data.variableId,!0),this.shared.setDynamicVariablePlayState(this.data.variableId,"Playing"===e?"Paused":"Playing");else if("Play"===this.data.mode&&"Playing"!==e)void 0===this.shared.getDynamicVariableToggleIsForward(this.data.variableId)&&this.shared.setDynamicVariableToggleIsForward(this.data.variableId,!0),this.shared.setDynamicVariablePlayState(this.data.variableId,"Playing");else if("Stop"===this.data.mode&&"Stopped"!==e)this.shared.setDynamicVariablePlayState(this.data.variableId,"Stopped");else if("Pause"===this.data.mode&&"Paused"!==e)this.shared.setDynamicVariablePlayState(this.data.variableId,"Paused");else if("Restart"===this.data.mode)this.shared.setDynamicVariablePlayState(this.data.variableId,"Restarted");else if("Toggle"===this.data.mode){let t=this.shared.getDynamicVariableToggleIsForward(this.data.variableId);"Playing"===e?this.shared.setDynamicVariableToggleIsForward(this.data.variableId,void 0!==t&&!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);"PlayPause"===this.data.mode&&"Playing"===t&&(e=this.data.pauseDelay),0!==e?(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)}},IT=class{constructor(e,t,i,r){this.data=e,this.page=t,this.shared=i,this.condition=r}dispatch(){if(!1===ID(this.shared,this.condition))return!1;("single"===this.data.target?this.data.variableId?[this.data.variableId]:[]:Object.keys(this.shared.getVariables())).forEac
8106h(e=>{this.shared.getVariable(e);let t=this.shared.data.variables.data(e)?.value;void 0!==t&&this.shared.updateVariable(e,t),this.shared.enableLocalStorageForPersistentVariables&&localStorage.removeItem(E7(e))})}dispose(){}},IP=class{constructor(e,t,i,r){this.data=e,this.page=t,this.shared=i,this.condition=r}dispatch(){if(!1===ID(this.shared,this.condition))return!1;this.data.userAPIId&&this.shared.getUserAPI(this.data.userAPIId)?.callUserAPI(this.shared)}dispose(){}};function ID(e,t){if(void 0===t)return!0;if(0===t.expression.length)return!1;let i=SC(t.expression,e,"boolean");return t.negate?!i:!!i}function IO(e,t,i,r,s,a){let o={Audio:[],Video:[],Particles:[],Link:[],Destroy:[],Create:[],Reset:[],Transition:[],TimelineAnimation:[],SwitchCamera:[],Animation:[],SceneTransition:[],SetVariable:[],DynamicVariablePlay:[],ClearLocalStorage:[],UserAPI:[]},h=t=>({id:c,data:d})=>{try{"Audio"===d.type?mM[e.type].includes("Audio")&&o.Audio.push(new LJ(c,d,a,r,t)):"Video"!==d.type||a instanceof DD?"Particles"===d.type?mM[e.type].includes("Particles")&&o.Particles.push(new L$(d,i,r,t)):"Link"===d.type?mM[e.type].includes("Link")&&o.Link.push(new L1(d,s.controlsManager,r,t)):"Create"===d.type?mM[e.type].includes("Create")&&o.Create.push(new IW(d,i,s.controlsManager,r,t)):"Destroy"===d.type?mM[e.type].includes("Destroy")&&o.Destroy.push(new L2(d,i,s.controlsManager,r,t)):"Reset"===d.type?mM[e.type].includes("Reset")&&o.Reset.push(new L3(d,i,r,s,t)):"Transition"===d.type?mM[e.type].includes("Transition")&&o.Transition.push(new Ig(e.type,d,i,r,t)):"SwitchCamera"===d.type?mM[e.type].includes("SwitchCamera")&&o.SwitchCamera.push(new Iw(d,i,r,t)):"SceneTransition"===d.type?mM[e.type].includes("SceneTransition")&&o.SceneTransition.push(new IM(d,i,s,r,t)):"Animation"===d.type?mM[e.type].includes("Animation")&&o.Animation.push(new IC(d,i,s.animationControls,r,t)):"SetVariable"===d.type?mM[e.type].includes("SetVariable")&&o.SetVariable.push(new IE(d,i,r,t)):"DynamicVariablePlay"===d.type?mM[e.type].includes("DynamicVariablePlay")&&o.DynamicVariablePlay.push(new IA(d,i,r,t)):"Conditional"===d.type?mM[e.type].includes("Conditional")&&(d.ifActions.forEach(h({expression:d.condition,negate:!1})),d.elseActions.forEach(h({expression:d.condition,negate:!0}))):"ClearLocalStorage"===d.type?mM[e.type].includes("ClearLocalStorage")&&o.ClearLocalStorage.push(new IT(d,i,r,t)):"UserAPI"===d.type?mM[e.type].includes("UserAPI")&&o.UserAPI.push(new IP(d,i,r,t)):"TimelineAnimation"===d.type&&mM[e.type].includes("TimelineAnimation")&&o.TimelineAnimation.push(new I_(c,d,i.scene,r)):mM[e.type].includes("Video")&&o.Video.push(new Iz(c,d,a,r,t))}catch(e){}};return t.forEach(h()),o}function IL(e){Object.values(e).forEach(e=>{e.forEach(e=>{(e instanceof LJ||e instanceof Iz||e instanceof Ig||e instanceof I_||e instanceof L$||e instanceof IC||e instanceof Ig||e instanceof IW||e instanceof L2||e instanceof Iw||e instanceof IM||e instanceof L3||e instanceof IE||e instanceof IA)&&e.dispose()})})}var II=new Map,IR=new Map,Ik=class{constructor(e,t,i){this.data=t,this.delay=0,this.status="stopped";let{layerId:r,loop:s,volume:a,delay:o}=t;if(this.object=i,void 0===r)throw Error("Missing property");let h=function(e,t){let i;if("material"in e&&(i=Array.isArray(e.material)?e.material[0].layers.find(e=>e.uuid===t):e.material.layers.find(e=>e.uuid===t)),i)return i.color.texture.image.img instanceof HTMLVideoElement?i.color.texture.image.img:void 0}(i,r);h&&(this.videoElement=h,this.videoElement.loop=s===1/0,u3&&(this.videoElement.autoplay=!0),void 0!==a&&(this.videoElement.volume=a)),void 0!==o&&(this.delay=o),IR.has(i.uuid)?IR.get(i.uuid).push(this):IR.set(i.uuid,[this]),II.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 e=this.videoElement.play();void 0!==e&&e.then(e=>{}).catch(e=>{this.play()}),this.clearDelay()},this.delay),this.status="playing"}clearDelay(){this.delayTimerId&&(clearTimeout(this.delayTimerId),delete this.delayTimerId)}pause(){this.videoElement&&(this.videoElement.pause(),this.status="paused")}stop(){this.videoElement&&(this.videoElement.pause(),this.videoElement.currentTime=0,this.status="stopped",this.clearDelay())}seek(e){return new Promise((t,i)=>{if(!this.videoElement)return i();let r=this.videoElement.duration;r>0&&(this.videoElement.currentTime=e%r),this.videoElement.addEventListener("seeked",()=>t(),{once:!0})})}
vendor: 13,128 bytes, line 8106
8106playByToggle(){"stop"===this.data.toggle?"playing"===this.status?this.stop():(this.stop(),this.play()):"pause"===this.data.toggle?"playing"===this.status?this.pause():this.play():(this.stop(),this.play())}dispose(){this.videoElement&&(this.stop(),this.videoElement.muted=!0)}},IB=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=II.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=IR.get(e);t?.length&&(this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{t.forEach(e=>e[this.data.interaction]()),this.disposeDelay()},this.data.delay)):t.forEach(e=>e[this.data.interaction]()))}pauseAllVideos(){let e=[...IR.values()];e.length&&(this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{e.forEach(e=>{e.forEach(e=>{e[this.data.interaction]()})}),this.disposeDelay()},this.data.delay)):e.forEach(e=>{e.forEach(e=>{e[this.data.interaction]()})}))}disposeDelay(){clearTimeout(this.timeoutId),delete this.timeoutId}dispose(){clearTimeout(this.timeoutId),delete this.timeoutId}},Iz=class{constructor(e,t,i,r,s){if(this.data=t,this.shared=r,this.condition=s,"play"===t.interaction)this.interaction=new Ik(e,t,i);else if("pause"===t.interaction||"stop"===t.interaction)this.interaction=new IB(t);else throw Error("Missing property")}dispatchBasic(){if(!1===ID(this.shared,this.condition))return!1;this.interaction instanceof Ik?this.interaction.playByToggle():this.interaction.dispatch()}dispatchConditional(){if(!1===ID(this.shared,this.condition))return!1;this.interaction instanceof Ik?this.interaction.play():this.interaction.dispatch()}dispose(){this.interaction.dispose()}},IN=(()=>{let e,t,i,r;function s(i){!e&&!IF()&&t?.sharedGameControlGlobals.createdObjects.length>0&&(e=requestAnimationFrame(a)),i&&(t=i,r=i.requestRender)}function a(s){let o=i?s-i:0,h=t.sharedGameControlGlobals.createdObjects,c=t.sharedGameControlGlobals.nCreatedPerAction,d=h.length,u=0;for(;u<d;){let e=h[u];void 0===e.userData.createdTime&&(e.userData.createdTime=s),void 0===e.userData.lifetime&&void 0===e.userData.quantity||e.userData.lifetime&&s-e.userData.createdTime<e.userData.lifetime||e.userData.quantity&&c[e.userData.actionId]<=e.userData.quantity?(e.userData.velocity&&(e.position.addScaledVector(e.userData.velocity,o/1e3),e.updateMatrix(),r()),u++):(c[e.userData.actionId]>e.userData.quantity&&c[e.userData.actionId]--,h.splice(u,1),e.removeFromParent(),t.sharedGameControlGlobals.rapierWorld&&e.rigidBody?(t.sharedGameControlGlobals.colliderToEntity.delete(e.rigidBody.collider(0).handle),t.sharedGameControlGlobals.rapierWorld.removeRigidBody(e.rigidBody)):(e.bvhGeometry=void 0,t.sharedGameControlGlobals.entitiesWithTransformAnim=t.sharedGameControlGlobals.entitiesWithTransformAnim.filter(e=>void 0!==e.bvhGeometry)),d--,r())}e=u>0?requestAnimationFrame(a):void 0,i=u>0?s:void 0}return"u">typeof document&&document.addEventListener("visibilitychange",function(){IF()?e&&(cancelAnimationFrame(e),e=void 0,i=void 0):s()}),s})();function IF(){return!!document&&document.hidden}var Ij=new iv,IU=new iy,IV=new iy,IW=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=tQ.generateUUID(),this.dispatch=()=>{if(!1===ID(this.shared,this.condition))return!1;this.data.delay?this.timeoutIdQueue.push(window.setTimeout(this.dispatchInner,1e3*this.data.delay)):this.dispatchInner()},this.dispatchFromStart=()=>{if(!1===ID(this.shared,this.condition))return!1;this.timeoutIdQueue.push(window.setTimeout(this.dispatchInner,1e3*this.data.delay))},this.dispatchThrottled=uZ(this.dispatch,1e3/this.data.creationSpeed),this.dispatchStart=()=>{null===this.intervalId&&(this.intervalId=window.setInterval(this.dispatch,1e3/this.data.creationSpeed))},this.dispatchStop=()=>{null!==this.intervalId&&(window.clearInterval(this.intervalId),this.intervalId=null)},this.dispatchInner=()=>{this.timeoutIdQueue.shift();let e=new wr(this.object);if(e.playModeVisible=!0,e.expand(),"world"!==this.data.coordinateSystem){let t=this.data.coordinateSystem,i=this.page.scene.find(t);i&&(i.updateMatrixWorldSVD(),e.hiddenMatrix.copy(i.matrixWorldRigid))}e.scale.copy(this.object.scale),e.position.fromArray(this.data.position),e.rotation.fromArray(this.data.rotation),e.updateMatrix(),this.page.add(e);let t=this.controlsManager.sharedGameControlGlobals;t.createdObjects.push(e),void 0===t.nCreatedPerAction[this.uniqueId]?t.nCreatedPerAction[this.uniqueId]=1:t.nCreatedPerAction[this.uniqueId]++,e.updateWorldMatrix(!0,!0),e.traverseObject(this.traverseObjectCB),IN(),this.controlsManager.requestRender()},this.traverseObjectCB=e=>{let t;if(e.hasNonUniformScale&&e.updateMatrixWorldSVD(),this.controlsManager.sharedGameControlGlobals.rapierWorld){if(e instanceof AZ)if(!e.objectForSample)return!0===e.object.dataPatched.physics.fusedBody&&"dynamic"===e.object.dataPatched.physics.rigidBody||void 0;else{if(e.objectForSample.dataPatched.physics.fusedBody)return;t=e.object}else if(e instanceof wr)t=e.object;else if(t=e,t.dataPatched.cloner?.hideBase)return!0}else{if(e instanceof AZ)return;t=e instanceof wr?e.object:e}"Time"===this.data.destroy?e.userData.lifetime=1e3*this.data.lifetime:"Quantity"===this.data.destroy&&(e.userData.quantity=this.data.destroyAfterQuantity,e.userData.actionId=this.uniqueId);let i=new iy().fromArray(this.data.velocity),r=t.dataPatched;if(!("visibility"===r.physics.enabled?!r.visible:!r.physics.enabled)&&(this.controlsManager.sharedGameControlGlobals.rapierWorld?(this.controlsManager.addRigidBody(e,t,{fromCreate:!0,dynamic:this.data.dynamic}),"Collision"===this.data.destroy&&(e.rigidBody?.collider(0).setActiveEvents(1),e.userData.hasCollisionDestroy=!0),e.matrixWorld.decompose(IU,Ij,IV),i.applyQuaternion(Ij),this.data.velocity.some(e=>0!==e)&&this.data.dynamic&&e.rigidBody?.setLinvel(i.divideScalar(this.controlsManager.pixelsPerMeter),!0)):("geometry"in e.object&&this.controlsManager.addBoundsTree(e),this.data.velocity.some(e=>0!==e)&&this.data.dynamic&&(e.userData.velocity=i)),t.dataPatched.physics?.fusedBody===!0))return!0};let a=this.page.scene.find(this.data.object);if(!a||(this.object=a,"world"!==this.data.coordinateSystem&&!this.page.scene.find(this.data.coordinateSystem)))throw Error("Missing Property");IN(i)}dispose(){null!==this.intervalId&&(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=[]}},IH=new iy,IG=new iy,Iq=new iy,IX=new iy,IY=new iy,IQ=new iy,IZ=new iY,IK=new iY,IJ=new iY,I$=(new iY,new iv),I0=new iv,I1=new i4(0,0,0,"YXZ"),I2=new iy(1,0,0),I3=new iy(0,1,0),I4=new iy(0,0,1),I5=new iy(1,1,1),I6=(new iF,new lF),I8=new iw,I9={type:"requestRender"},I7={type:"updateMatrix"},Re=Math.PI/6,Rt=class extends tk{constructor(e,t,i,r,s,a,o,h,c){super(),this.object=e,this.domElement=t,this.data=i,this.gloabalPhysics=r,this.controlsManager=s,this.cameraFollow=a,this.camera=o,this.page=h,this.sharedAssets=c,this.enableDamping=!0,this.hiddenMatrix0=new iY,this.target0=new iy,this.zoom0=1,this.rotForce=1,this.moveForce=1,this.pixelsPerMeter=200,this.euler0=new i4(0,0,0,"YXZ"),this.position0Cam=new iy,this.quat0Cam=new iv,this.scale0Cam=new iy,this.hiddenMatrix0Cam=new iY,this.threshEndTranslate=.01,this.threshEndRotate=1e-8,this.threshEndRotVel=.005,this.collider={type:"capsule",radius:40,segment:new lF(new iy(0,-40,0),new iy(0,40,0)),matrix:new iY,position:new iy,rotation:new iv},this.euler=new i4(0,0,0,"YXZ"),this.eulerDelta=new iy,this.lastPosition=new iy,this.lastCameraQuaternion=new iv,this.lastCameraPosition=new iy,this.PI_2=Math.PI/2,this.prevMouse=new tZ,this.velocityTarget=new iy,this.velocity=new iy,this.directionXZ=new iy,this.rotVelocityStick=new iy,this.rotVelocityTarget=new iy,this.rotVelocity=new iy,this.rotDirection=new iy,this.nonColliderRotOffset=new iY,this.nonColliderPosOffset=new iY,this.firstPointerId=-1,this.rot=new iy,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 iY,this.objectToTarget=new iy,this.objectToTarget0=new iy,this.objectToCamXZ=new iy,this.objectToCamXZ0=new iy,this.targetToCamera=new iy,this.targetToCamera0=new iy,this.cameraPolarAxis0=new iy,this.targetPos=new iy,this.targetQuat=new iv,this.lerpFactorPos=new iy().setScalar(.3),this.lerpFactorPosStart=.3,this.lerpFactorPosEnd=.3,this.lerpFactorRotStart=.3,this.lerpFactorRotEnd=.3,this.lerpFactorPosCamera=.3,this.lerpFactorRotCamera=.3,this.objXZQuat=new iv,this.objXZQuatInv=new iv,this.objXZRotMat=new iY,this.isFirstPerson=!1,this.didHit=!1,this.groundVelocity=new iy,this.pushedVelocity=new iy,this.groundYRotation=0,this.objectRealQuat=new iv,this.colliderWorldQuat=new iv,this.groundNormal=new iy,this.groundTilt=new iv,this.groundTiltInv=new iv,this.lastHitObj=null,this.isFirstFrame=!0,this.rotationAccumWhenOrientWithCamera=0,this.navMeshPathDest=null,this.position=new iy,this.quaternion=new iv,this.scale=new iy,this.initialAction=!0,this.onPointerDown=e=>{(e.target===this.domElement||e.target instanceof HTMLElement&&"SPLINE-VIEWER"===e.target.tagName&&e.target.shadowRoot?.contains(this.domElement))&&-1===this.firstPointerId&&(this.firstPointerId=e.pointerId,this.domElement.ownerDocument.addEventListener("pointermove",this.onPointerMove),this.domElement.ownerDocument.addEventListener("pointerup",this.onPointerUp),"keys"===this.rotBy||u5||u6||this.domElement.requestPointerLock(),this.prevMouse.set(e.clientX,e.clientY))},this.onPointerUp=e=>{this.firstPointerId=-1,this.domElement.ownerDocument.removeEventListener("pointermove",this.onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this.onPointerUp),"mouse"===e.pointerType&&this.domElement.ownerDocument.exitPointerLock()},this.onPointerMove=e=>{if(e.pointerId!==this.firstPointerId)return;let t=e.clientX-this.prevMouse.x,i=e.clientY-this.prevMouse.y;this.prevMouse.set(e.clientX,e.clientY),"mouse"===e.pointerType&&"keys"!==this.rotBy&&(u6&&u8<15.5&&!u5?(this.eulerDelta.y=-t*this.mouseOrbitSensitivity,this.eulerDelta.x=-i*this.mouseOrbitSensitivity):(this.eulerDelta.y=-e.movementX*this.mouseOrbitSensitivity,this.eulerDelta.x=-e.movementY*this.mouseOrbitSensitivity)),"mouse"!==e.pointerType&&"drag"===this.rotByTouch&&(this.eulerDelta.y=-t*this.mouseOrbitSensitivity*5,this.eulerDelta.x=-i*this.mouseOrbitSensitivity*5),this.controlsManager.requestRender()},this.onPointerlockChange=e=>{this.domElement.ownerDocument.pointerLockElement===this.domElement?Rt.isLocked=!0:Rt.isLocked=!1},this.onPointerlockError=()=>{console.error("SPE.GameControls: Unable to use Pointer Lock API")},this.handleVisibilityChange=()=>{if(document?.hidden)for(let e in this.movementState)this.movementState[e]=0},this.onKeyDown=e=>{for(let t of(e.target instanceof HTMLInputElement||"ArrowLeft"!==e.code&&"ArrowUp"!==e.code&&"ArrowRight"!==e.code&&"ArrowDown"!==e.code&&"Space"!==e.code||e.preventDefault(),this.keyAssignments))if(e.key.toUpperCase()===t[1]||e.key===t[1]){this.movementState[t[0]]=1;break}this.controlsManager.requestRender()},this.onKeyUp=e=>{for(let t of this.keyAssignments)if(e.key.toUpperCase()===t[1]||e.key===t[1]||e.code.slice(3,e.code.length).toUpperCase()===t[1]){this.movementState[t[0]]=0;break}},this.copyVRGamePadValues=(e,t)=>{for(let i=2;i<4;i++){let r=e.axes[i];0===t?2===i?this.movementState.movePosX=r:this.movementState.movePosZ=r:(e.buttons[3].pressed?this.movementState.jump=1:this.movementState.jump=0,2===i?(.3>Math.abs(this.movementState.rotPosY)&&Math.abs(r)>=.3&&(this.vrEulerYOffset+=r<0?1:-1),this.movementState.rotPosY=r):"fly"===this.moveMode&&(this.movementState.moveNegY=r))}},this.sharedGameControlGlobals=s.sharedGameControlGlobals,e===o&&(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 d=this.euler0.clone(),u=d.y;if(this.objectRealQuat.copy(this.quaternion),d.y=0,this.quaternion.setFromEuler(d),this.objXZQuat.copy(this.quaternion),this.objXZQuatInv.copy(this.objXZQuat).invert(),this.objXZ
8106RotMat.makeRotationFromQuaternion(this.quaternion),d.set(0,u,0),this.quaternion.setFromEuler(d),this.rot.setFromEuler(d),this.object.matrixAutoUpdate=!1,(this.isFirstPerson||!0===this.cameraFollow)&&(this.target0.copy(this.camera.getTarget()),this.zoom0=this.camera.zoom),!0===this.cameraFollow){let e,t;this.position0Cam.copy(this.camera.position),this.quat0Cam.copy(this.camera.quaternion),this.scale0Cam.copy(this.camera.scale),this.hiddenMatrix0Cam.copy(this.camera.hiddenMatrix),this.camera.parent?(this.camera.hiddenMatrix.copy(this.camera?.parent.matrixWorld),this.camera.matrix.copy(this.camera.matrixWorld)):this.camera.hiddenMatrix.identity(),this.camera.matrix.copy(this.camera.matrixWorld),this.camera.matrix.decompose(this.camera.position,this.camera.quaternion,this.camera.scale),this.camera.matrixAutoUpdate=!1,this.offsetMatrix.copy(this.object.matrix).invert().multiply(this.camera.matrix);let i=new iy(0,0,-1).applyQuaternion(this.camera.quaternion),r=new iy().subVectors(this.position,this.camera.position);this.objectToCamXZ.copy(r),this.objectToCamXZ.y=0,this.objectToCamXZ0.copy(this.objectToCamXZ),1e-6>Math.abs(i.y)?(r.y=0,i.y=0,t=r.projectOnVector(i)):t=r.y/i.y>0?i.multiplyScalar(r.y/i.y):i.multiplyScalar(r.length()),this.targetToCamera0.copy(t).negate(),e=this.camera.position.clone().add(t),this.objectToTarget0.subVectors(e,this.position);let s=new i4().setFromQuaternion(this.camera.quaternion,"YXZ");this.cameraPolarOffset=-s.x,s.x=0,s.z=0,s.y-=Math.PI/2,this.cameraPolarAxis0.set(0,0,-1).applyEuler(s)}if(this.object instanceof Ts&&(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)*1,this.speedOrbit=(i.speedRotate??100)*.025,this.mouseOrbitSensitivity=(i.speedRotate??100)*16e-6,this.keyAssignments=i.keyAssignments.map(e=>{let t=[e[0],e[1]];return"▲"===t[1]?t[1]="ArrowUp":"◀"===t[1]?t[1]="ArrowLeft":"▼"===t[1]?t[1]="ArrowDown":"▶"===t[1]?t[1]="ArrowRight":"⇧"===t[1]?t[1]="Shift":"↵"===t[1]?t[1]="Enter":"Space"===t[1]?t[1]=" ":"⌘"===t[1]?t[1]="Meta":"Ctrl"===t[1]?t[1]="Control":"Esc"===t[1]&&(t[1]="Escape"),t}),"mouse"===i.rotBy){let e;-1!==(e=this.keyAssignments.findIndex(e=>"rotNegX"===e[0]))&&(this.keyAssignments[e][1]=""),-1!==(e=this.keyAssignments.findIndex(e=>"rotPosX"===e[0]))&&(this.keyAssignments[e][1]=""),-1!==(e=this.keyAssignments.findIndex(e=>"rotPosY"===e[0]))&&(this.keyAssignments[e][1]=""),-1!==(e=this.keyAssignments.findIndex(e=>"rotNegY"===e[0]))&&(this.keyAssignments[e][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??va.defaultData.gravity)*12,this.usePhysics=this.gloabalPhysics.usePhysics??va.defaultData.usePhysics,this.jumpPower=20*i.jumpPower,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??y7.defaultDataThirdPerson.orientWith,this.slopeThresh=65*Math.PI/180,"capsule"===i.collider.type?(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=.02*i.collider.height/this.pixelsPerMeter,this.stepThresh=.3*i.collider.height/this.pixelsPerMeter,this.colliderHeight=i.collider.height):"sphere"===i.collider.type?(this.collider.radius=i.collider.radius,this.collider.segment.start.y=0,this.collider.segment.end.y=0,this.offset=2*i.collider.radius*.02/this.pixelsPerMeter,this.stepThresh=2*i.collider.radiu
vendor: 4,615 bytes, line 8106
8106s*.3/this.pixelsPerMeter,this.colliderHeight=2*i.collider.radius):(this.offset=.02*i.collider.height/this.pixelsPerMeter,this.stepThresh=.3*i.collider.height/this.pixelsPerMeter,this.colliderHeight=i.collider.height),this.collider.type=i.collider.type;let p=new iy().fromArray(i.collider.position),f=new iv().setFromEuler(new i4().fromArray([...i.collider.rotation,"XYZ"]));this.collider.position.copy(p).multiply(this.scale),this.collider.rotation.copy(f),this.collider.matrix.compose(p,f,I5),void 0!==i.cameraXAxis&&(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 m=2*i.navmesh.destinationHelperRadius;if(m>0){let e=new pP;e.push({fi:0,data:{...gW.defaultData("light","phong"),alpha:0},id:"layer1"}),e.push({fi:0,data:{...gW.defaultData("color"),color:i.navmesh.destinationHelperColor,alpha:i.navmesh.destinationHelperColor.a},id:"layer2"});let t=new EP({layers:e},{scene:this.page.scene,shared:this.sharedAssets});this.navMeshPathDest=new rK(wS.create({parameters:{width:m,height:m/10,hollow:.7}}),t),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 e=new i4().setFromQuaternion(this.quaternion,"YXZ"),t=e.y;this.objectRealQuat.copy(this.quaternion),e.y=0,this.quaternion.setFromEuler(e),this.objXZQuat.copy(this.quaternion),this.objXZQuatInv.copy(this.objXZQuat).invert(),this.objXZRotMat.makeRotationFromQuaternion(this.quaternion),e.set(0,t,0),this.quaternion.setFromEuler(e),this.rot.setFromEuler(e),this.euler.setFromQuaternion(this.quaternion,"YXZ"),this.velocityTarget.set(0,0,0),this.velocity.set(0,0,0)}else this.object instanceof Ts?this.object.matrixAutoUpdate=!0:this.object.updateMatrix();!0===this.cameraFollow&&(this.camera.quaternion.copy(this.quat0Cam),this.camera.position.copy(this.position0Cam),this.camera.scale.copy(this.scale0Cam),this.camera.hiddenMatrix.copy(this.hiddenMatrix0Cam),this.camera.matrixAutoUpdate=!0),this.controlsManager.requestRender()}activate(){this.instantiateActions(),this.domElement.ownerDocument.addEventListener("pointerdown",this.onPointerDown),this.domElement.ownerDocument.addEventListener("keydown",this.onKeyDown),this.domElement.ownerDocument.addEventListener("keyup",this.onKeyUp),this.domElement.ownerDocument.addEventListener("pointerlockchange",this.onPointerlockChange),this.domElement.ownerDocument.addEventListener("pointerlockerror",this.onPointerlockError),this.domElement.ownerDocument.addEventListener("visibilitychange",this.handleVisibilityChange)}deactivate(){this.disposeActions(),this.domElement.ownerDocument.removeEventListener("pointerdown",this.onPointerDown),this.domElement.ownerDocument.removeEventListener("keydown",this.onKeyDown),this.domElement.ownerDocument.removeEventListener("keyup",this.onKeyUp),this.domElement.ownerDocument.removeEventListener("pointerlockchange",this.onPointerlockChange),this.domElement.ownerDocument.removeEventListener("pointerlockerror",this.onPointerlockError),this.domElement.ownerDocument.removeEventListener("visibilitychange",this.handleVisibilityChange)}dispose(){this.deactivate(),this.navMeshPathDest?.parent&&this.page.remove(this.navMeshPathDest)}instantiateActions(){let e=this.data,t=this.sharedAssets;void 0!==e.gameActions&&(this.actions={},y9.list.forEach(i=>{this.actions[i]=IO({...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"),IL(this.actions.idle),IL(this.actions.move),IL(this.actions.run),IL(this.actions.jump)}dispatchStartEvent(e){void 0!==this.actions[e]&&(this.actionState[e]||(this.actionState[e]=!0,this.actions[e].Transition.forEach(e
vendor: 15,907 bytes, line 8106
8106=>{e.play()}),this.actions[e].Animation.forEach(e=>{e.play(!1===this.initialAction)}),this.actions[e].TimelineAnimation.forEach(e=>{e.play()}),this.actions[e].Create.forEach(e=>{e.dispatchStart()}),this.actions[e].Audio.forEach(e=>{e.dispatchGameControl("start")}),this.actions[e].Particles.forEach(e=>{e.dispatchGameControl("start")})))}dispatchStopEvent(e){void 0!==this.actions[e]&&this.actionState[e]&&(this.actionState[e]=!1,this.actions[e].Transition.forEach(e=>{e.stop(),null!==e.object.currentState&&e.object.changeSelectedState(null,{scene:this.page.scene,shared:this.sharedAssets})}),this.actions[e].TimelineAnimation.forEach(e=>{e.stop()}),this.actions[e].Create.forEach(e=>{e.dispatchStop()}),this.actions[e].Audio.forEach(e=>{e.dispatchGameControl("stop")}),this.actions[e].Particles.forEach(e=>{e.dispatchGameControl("stop")}))}get colliderWorldPosition(){return IX.copy(this.collider.position).applyQuaternion(this.objectRealQuat).add(this.position)}update(e,t,i){if(this.gravity<0?this.position.y<this.resetYPosition:this.position.y>this.resetYPosition)return this.reset(!0),!0;this.sharedGameControlGlobals.gamePads.forEach(this.copyVRGamePadValues);let r=(this.isFirstFrame?16.6:e)/1e3;this.isFirstFrame&&(this.isFirstFrame=!1);let s=60*r,a=!1;if(this.usePhysics&&this.collisionEnabled){let e=IY.set(0,(0===this.velocity.y?this.pixelsPerMeter*Math.max(Math.abs(this.gravity)/120,1)*(this.gravity>0?1:-1):this.velocity.y)*r,0).divideScalar(this.pixelsPerMeter),t=this.sharedGameControlGlobals.rapierWorld.castShape(this.colliderWorldPosition.divideScalar(this.pixelsPerMeter),this.colliderWorldQuat,e,this.object.rigidBody?.collider(0).shape,1,!1,16,void 0,void 0,this.object.rigidBody);if(t){this.onObject=!0,this.groundNormal.set(t.normal2.x,t.normal2.y,t.normal2.z).applyQuaternion(this.colliderWorldQuat).negate(),this.alignToGround&&this.groundTiltAdjustment(this.groundNormal),Math.acos(this.groundNormal.y)<this.slopeThresh&&(a=!0),t.collider.parent()?.bodyType()===0&&Math.acos(this.groundNormal.y)*(180/Math.PI)>45&&(this.onObject=!1);let e=t.collider.parent();for(let t of(this.groundYRotation=0,this.groundVelocity.set(0,0,0),this.sharedGameControlGlobals.entitiesWithTransformAnim))if(t.rigidBody===e&&t.userData.isFollowingObj!==this.object.uuid){(t.hasNonUniformScale?t.matrixWorldRigid:t.matrixWorld).decompose(IX,I0,IY),this.groundVelocity.subVectors(IX,t.prevT),this.object.getWorldPosition(IY).add(this.collider.position).sub(IX),this.groundYRotation=I1.setFromQuaternion(I0).y-t.prevR.y,IQ.copy(IY).applyAxisAngle(I3,this.groundYRotation),this.groundVelocity.add(IQ.sub(IY)).divideScalar(r);break}}else this.onObject=!1}if("walk"===this.moveMode&&this.collisionEnabled&&(1===this.movementState.jump&&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),"fly"===this.moveMode&&(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,"+z"===this.forwardDir&&this.directionXZ.multiplyScalar(-1),this.directionXZ.manhattanLength()>0&&(this.path=[]),this.navMeshPathDest){let e=this.navMeshPathDest.material;if("walk"===this.moveMode&&this.path.length>1){this.navMeshPathDest.position.copy(this.path[this.path.length-1]),this.navMeshPathDest.parent||this.page.add(this.navMeshPathDest);let t=IX.subVectors(this.path[1],this.position),i=IY.subVectors(this.path[1],this.path[0]);0>t.dot(i)?this.path.shift():(this.directionXZ.x=i.x,this.directionXZ.z=i.z),e.opacity=e.userData.opacity0}else e.opacity-=.05*e.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,("walk"===this.moveMode?this.velocityTarget.x+this.velocityTarget.z===0:0===this.velocityTarget.manhattanLength())?this.lerpFactorPos.setScalar(this.lerpFactorPosEnd):this.lerpFactorPos.setScalar(this.lerpFactorPosStart),"walk"===this.moveMode&&(this.lerpFactorPos.y=1),!1===this.didHit&&0===this.pushedVelocity.manhattanLength()||!1===this.usePhysics?(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),("walk"===this.moveMode?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||"fly"===this.moveMode)&&(this.dispatchStopEvent("jump"),this.movementState.run?(this.dispatchStopEvent("move"),this.dispatchStartEvent("run")):(this.dispatchStopEvent("run"),this.dispatchStartEvent("move"))));let o=Iq.copy(this.velocity);if("none"!==this.orientMode&&!1===this.isFirstPerson){let e=IY.copy(o);e.y=0,o.set(0,o.y,e.length()*("+z"===this.forwardDir?1:-1))}if(this.directionXZ.manhattanLength()>0&&"none"!==this.orientMode&&!1===this.isFirstPerson)if("camera"===this.orientWith&&this.path.length<=1){this.camera.getWorldDirection(IX);let e=IQ.copy(I3).multiplyScalar(IX.dot(I3));IX.sub(e);let t=IY.copy(this.directionXZ);t.x*=-1,this.rot.y=IX.angleTo(t)*(IX.cross(t).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*("+z"===this.forwardDir?1:-1);if(I1.setFromVector3(this.rot),"walk"===this.moveMode&&(I1.x=0),o.applyEuler(I1),a&&(I0.setFromUnitVectors(I3,this.groundNormal),o.applyQuaternion(I0)),i){let e=I1.set(0,this.vrEulerYOffset*Re,0);i.applyEuler(e),o.x+=i.x,o.z+=i.z,this.nonColliderPosOffset.elements[13]+=i.y*r}if(!0===this.usePhysics){for(let e of(this.pushedVelocity.set(0,0,0),this.sharedGameControlGlobals.entitiesWithTransformAnim)){let t=IQ.setFromMatrixPosition(e.matrixWorld).sub(e.prevT).divideScalar(r).divideScalar(this.pixelsPerMeter),i=e.rigidBody.collider(0).castCollider(t,this.object.rigidBody.collider(0),IX.copy(o).divideScalar(this.pixelsPerMeter),r,!1);t.multiplyScalar(this.pixelsPerMeter);let s=SL.is(e)?e:e.object;if(null!==i&&this.lastHitObj!==s){let t;e instanceof wr&&(t=e);let i=this.sharedGameControlGlobals.entityToCollisionEvents[s.uuid];if(i)for(let e of i)"character"===e.data.target&&(e.dispatch(t),s.dispatchEvent(Br));this.lastHitObj=s}if(null!==i){this.pushedVelocity.copy(t),IY.copy(i.normal1).applyQuaternion(e.quaternion);break}}if(0!==this.pushedVelocity.manhattanLength()){let e=IY.dot(o);e<0&&o.addScaledVector(IY,-e),o.add(this.pushedVelocity)}else o.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(),"normal"===this.rotationMode&&(this.movementState.rotPosX||this.movementState.rotNegX)||"steer"===this.rotationMode&&(this.movementState.rotPosX||this.movementState.rotNegX)&&(this.movementState.movePosZ||this.movementState.moveNegZ||"walk"===this.moveMode)?this.rotVelocityStick.x=-this.rotDirection.x*this.speedOrbit*this.rotForce:this.rotVelocityStick.x=0,"normal"===this.rotationMode&&(this.movementState.rotPosY||this.movementState.rotNegY)||"steer"===this.rotationMode&&(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),0===this.rotVelocityTarget.manhattanLength()?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,0===this.rotVelocityTarget.y&&0===this.directionXZ.manhattanLength()?this.rotationAccumWhenOrientWithCamera=0:(!1===this.cameraFollow||"Locked"===this.cameraYAxis)&&(this.rotationAccumWhenOrientWithCamera+=this.rotVelocity.y*r),!1===this.isFirstPerson&&"none"!==this.orientMode&&this.directionXZ.manhattanLength()>0){if("radial"===this.orientMode){this.objectToCamXZ.copy(this.objectToCamXZ0).applyAxisAngle(I3,this.euler.y-this.euler0.y);let e=IY.copy(this.objectToCamXZ).normalize(),t=IQ.copy(o).multiplyScalar(r);t.y=0;let i=t.sub(IX.copy(e).multiplyScalar(t.dot(e))).cross(e).y;this.euler.y-=Math.atan2(i,this.objectToCamXZ.length())}}else this.rot.y+=this.rotVelocity.y*r+this.groundYRotation,0!==this.rotVelocityTarget.y&&(!1===this.cameraFollow||"Locked"===this.cameraYAxis)&&(this.euler.y=this.rot.y);if(!0===this.cameraFollow&&("walk"===this.moveMode?"Limit"===this.cameraXAxis?this.euler.x=tQ.clamp(this.euler.x,-this.maxPolarAngle+this.cameraPolarOffset+1e-6,-this.minPolarAngle+this.cameraPolarOffset-1e-6):this.euler.x=tQ.clamp(this.euler.x,-this.PI_2+this.cameraPolarOffset,this.PI_2+this.cameraPolarOffset):"Limit"===this.cameraXAxis&&(this.euler.x=tQ.clamp(this.euler.x,-this.PI_2,this.PI_2))),"fly"===this.moveMode?this.rot.x=this.euler.x:this.isFirstPerson&&(t?I1.copy(t):I1.copy(this.euler),I1.y=0,this.nonColliderRotOffset.makeRotationFromEuler(I1)),t&&("walk"===this.moveMode?(this.rot.y=t.y,this.rot.x=0,this.rot.z=0):this.rot.setFromEuler(t),this.rot.y+=this.vrEulerYOffset*Re),I$.setFromAxisAngle(I2,this.rot.x),I0.setFromAxisAngle(I3,this.rot.y),I0.multiply(I$),I$.setFromAxisAngle(I4,this.rot.z),I0.multiply(I$),this.quaternion.copy(I0),this.objectRealQuat.multiplyQuaternions(this.quaternion,this.objXZQuat),this.colliderWorldQuat.copy(this.objectRealQuat).multiply(this.collider.rotation),this.collisionEnabled)if(this.usePhysics){let e=IY.copy(o).multiplyScalar(r/this.pixelsPerMeter),t=null;this.didHit=!1;let i=new iy;for(let r=0;r<5;r++){let s=e.length(),a=IQ.copy(e).normalize();if(null!==(t=this.sharedGameControlGlobals.rapierWorld.castShape(this.colliderWorldPosition.divideScalar(this.pixelsPerMeter).add(i),this.colliderWorldQuat,a,this.object.rigidBody?.collider(0).shape,s,!1,24,void 0,void 0,this.object.rigidBody))){this.didHit=!0;let o=this.sharedGameControlGlobals.colliderToEntity.get(t.collider.handle);if(o!==this.lastHitObj&&0===r){this.lastHitObj=o;let e=this.sharedGameControlGlobals.entityToCollisionEvents[o?.uuid];if(e){for(let i of e)if("character"===i.data.target){let e=(this.sharedGameControlGlobals.rapierWorld?.getCollider(t.collider.handle))._parent,r;if(o.cloner){for(let t of o.cloner.children)if(t.rigidBody===e){r=t;break}}i.dispatch(r),o.dispatchEvent(Br)}}}let h=IH.set(t.normal2.x,t.normal2.y,t.normal2.z).applyQuaternion(this.colliderWorldQuat),c=IG.copy(a).multiplyScalar(t.toi).dot(h),d=t.toi;if(0===d&&(this.position.y+=this.offset*this.pixelsPerMeter),c>this.offset&&(d=t.toi*(c-this.offset)/c,i.addScaledVector(a,d)),e.copy(a).multiplyScalar(s-d),Math.acos(-h.y)>this.slopeThresh){let r=this.colliderWorldPosition.divideScalar(this.pixelsPerMeter).add(i),s=IQ.copy(t.witness2).applyQuaternion(this.colliderWorldQuat);s.y=0;let a=r.add(s);a.y+=this.stepThresh;let o=this.sharedGameControlGlobals.rapierWorld.castShape(a,this.colliderWorldQuat,e,this.object.rigidBody?.collider(0).shape,1,!1,24,void 0,void 0,this.object.rigidBody);null!==o&&0===o.toi&&(h.y=0,h.normalize())}e.addScaledVector(h,-e.dot(h))}else{0===r&&0!==this.directionXZ.manhattanLength()&&(this.lastHitObj=null),i.add(e);break}}this.position.addScaledVector(i,this.pixelsPerMeter),this.object.rigidBody?.setTranslation(IX.copy(this.position).divideScalar(this.pixelsPerMeter),!0),this.object.rigidBody?.setRotation(I$.copy(this.quaternion).premultiply(this.groundTilt).multiply(this.objXZQuat),!0)}else{let e=this.onObject?1:5,t=o.multiplyScalar(r/e);for(let i=0;i<e;i++)this.position.add(t),this.collisionAdjustment(r/e)}else this.position.addScaledVector(o,r);if("walk"===this.moveMode&&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),!0===this.cameraFollow){this.updateFollowArms();let e=this.objectToTarget.add(this.position),t=this.targetToCamera.add(e);IZ.lookAt(t,e,I3).setPosition(t),IZ.decompose(this.targetPos,this.targetQuat,IX),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(),"Limit"===this.cameraYAxis&&"cartesian"===this.orientMode&&(this.euler.y=tQ.clamp(this.euler.y,this.minAzimuthAngleRel,this.maxAzimuthAngleRel)),this.euler.x=tQ.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(I7),!(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&&(void 0===this.camera||this.isFirstPerson||this.lastCameraPosition.distanceToSquared(this.camera.position)<this.threshEndTranslate&&8*(1-this.lastCameraQuaternion.dot(this.camera.quaternion))<this.threshEndRotate)&&("fly"===this.moveMode||!0===this.onObject||!1===this.collisionEnabled)&&(null===this.navMeshPathDest||this.navMeshPathDest.material.opacity<-.04*this.navMeshPathDest?.material?.userData.opacity0))&&(this.camera&&(this.lastCameraPosition.copy(this.camera.position),this.lastCameraQuaternion.copy(this.camera.quaternion)),this.lastPosition.copy(this.position),this.object.dispatchEvent(I9),!0)}updateFollowArms(){let e;this.objectToTarget.copy(this.objectToTarget0),this.targetToCamera.copy(this.targetToCamera0);let t=I$.setFromAxisAngle(I3,"Limit"===this.cameraYAxis&&"radial"!==this.orientMode?tQ.clamp(this.euler.y-this.euler0.y,this.minAzimuthAngleRel,this.maxAzimuthAngleRel):this.euler.y-this.euler0.y);("Locked"!==this.cameraYAxis||"radial"===this.orientMode)&&this.objectToTarget.applyQuaternion(t),e="Limit"===this.cameraXAxis?tQ.clamp(this.euler.x,-this.maxPolarAngle+this.cameraPolarOffset+1e-6,-this.minPolarAngle+this.cameraPolarOffset-1e-6):tQ.clamp(this.euler.x,-this.PI_2+this.cameraPolarOffset+1e-6,this.PI_2+this.cameraPolarOffset-1e-6);let i=IX.copy(this.cameraPolarAxis0);("Locked"!==this.cameraYAxis||"radial"===this.orientMode)&&i.applyQuaternion(t);let r=I0.setFromAxisAngle(i,e);"Locked"!==this.cameraYAxis&&this.targetToCamera.applyQuaternion(t),"Locked"!==this.cameraXAxis&&this.targetToCamera.applyQuaternion(r)}groundTiltAdjustment(e){180*I3.angleTo(e)/Math.PI<15||180*I3.angleTo(e)/Math.PI>85?I$.identity():I$.setFromUnitVectors(I3,e),this.groundTilt.slerp(I$,.06),this.groundTiltInv.copy(this.groundTilt).invert()}collisionAdjustment(e){let t=IG.set(0,0,0);this.object.matrix.compose(this.position,this.quaternion,this.scale);
8106let i=IZ.multiplyMatrices(this.object.matrix,this.objXZRotMat).multiply(this.collider.matrix).decompose(IX,I$,IY).compose(IX,I$,I5);this.sharedGameControlGlobals.entitiesWithTransformAnim.forEach(e=>{if(e===this.object||e.isDescendantOf(this.object))return;I8.makeEmpty(),e.updateMatrixWorldSVD();let r=e.matrixWorldRigid,s=IK.copy(r).invert(),a=IJ.copy(IK).multiply(i);I6.copy(this.collider.segment),I6.start.applyMatrix4(a),I6.end.applyMatrix4(a);let o=IH.copy(this.position).applyMatrix4(s);I8.expandByPoint(I6.start),I8.expandByPoint(I6.end),I8.min.addScalar(-this.collider.radius),I8.max.addScalar(this.collider.radius),e.bvhGeometry.boundsTree.shapecast({traverseBoundsOrder:e=>e.distanceToPoint(I6.end),intersectsBounds:e=>e.intersectsBox(I8),intersectsTriangle:e=>{let i=e.closestPointToSegment(I6,IX,IY);if(i<this.collider.radius){let e=this.collider.radius-i,s=IY.sub(IX).normalize(),a=IQ.copy(o);a.addScaledVector(s,e);let h=a.applyMatrix4(r).sub(this.position);t.add(h),I6.start.addScaledVector(s,e),I6.end.addScaledVector(s,e)}}})}),I8.makeEmpty(),I6.copy(this.collider.segment),I6.start.applyMatrix4(i),I6.end.applyMatrix4(i),I8.expandByPoint(I6.start),I8.expandByPoint(I6.end),I8.min.addScalar(-this.collider.radius),I8.max.addScalar(this.collider.radius),this.sharedGameControlGlobals.staticMeshBVH?.shapecast({traverseBoundsOrder:e=>e.distanceToPoint(I6.end),intersectsBounds:e=>e.intersectsBox(I8),intersectsTriangle:e=>{let i=e.closestPointToSegment(I6,IX,IY);if(i<this.collider.radius){let e=this.collider.radius-i,r=IY.sub(IX).normalize();this.alignToGround&&this.groundTiltAdjustment(r),t.addScaledVector(r,e),I6.start.addScaledVector(r,e),I6.end.addScaledVector(r,e)}}}),this.onObject=Math.abs(t.y)>Math.abs(e*this.velocity.y*.25),this.onObject&&this.dispatchStopEvent("jump");let r=Math.max(0,t.length()-1e-5);t.normalize().multiplyScalar(r),this.position.add(t)}pause(){this.firstPointerId=-1,this.movementState={moveNegZ:0,movePosZ:0,moveNegX:0,movePosX:0,moveNegY:0,movePosY:0,rotPosX:0,rotNegX:0,rotPosY:0,rotNegY:0,jump:0,run:0},this.deactivate()}resume(){this.activate()}};Rt.isLocked=!1;var Ri=tS(tE());function Rr(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,o=t[1]**2+t[5]**2+t[9]**2,h=t[2]**2+t[6]**2+t[10]**2;return i<1e-8||r<1e-8||s<1e-8||a<1e-8||o<1e-8||h<1e-8}function Rs(e,t){let i=new rz;if(t&&Rr(t)||!e.getAttribute("position"))return i.setAttribute("position",new rP([],3)),i.setIndex([]),i;let{positions:r,triIndices:s}=S$(e.getAttribute("position"),e.getIndex());return i.setAttribute("position",new rP(r,3)),i.setIndex(s),t&&i.applyMatrix4(t),i}var Ra=new iY,Rn=new iY,Ro=[[0,0,0],[0,0,0],[0,0,0]];function Rl(e){let t=e.elements;Ro[0][0]=t[0],Ro[0][1]=t[4],Ro[0][2]=t[8],Ro[1][0]=t[1],Ro[1][1]=t[5],Ro[1][2]=t[9],Ro[2][0]=t[2],Ro[2][1]=t[6],Ro[2][2]=t[10];let{u:i,v:r}=(0,Ri.SVD)(Ro),s=Ra.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=Rn.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 Rh=class extends lO{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(e=>{e.visible&&this.intersectObject(e,t,i)}),i}createRaycastLineHelper(){let e=new nB({color:65280,linewidth:10}),t=new iy(this.ray.origin.x,this.ray.origin.y,this.ray.origin.z),i=new iy(this.ray.direction.x,this.ray.direction.y,this.ray.direction.z),r=this.camera.far-this.camera.near,s=new iy().addVectors(t,i.multiplyScalar(r)),a=new rz;return a.setFromPoints([t,s]),new nV(a,e)}},Rc=e=>e instanceof Ty||e instanceof Oy;function Rd(e,t){return e.distance-t.distance}function Ru(e,t,i,r=!1){if(!r&&!i.some(t=>void 0!==Rm(e,t)))return[];let s=[];
8106return t.children.forEach(t=>(function e(t,i,r){if(!(!wv(i)||!i.visible))for(let s of(Tc(i)&&i.raycast(t,r),i.children))e(t,s,r)})(e,t,s)),s.sort(Rd),s}function Rp(e){let t=[];if(e.length){let i=e[0].object;wv(i)&&t.push(i);let r=i.parent;for(;r;)Rc(r)&&t.push(r),r=r.parent}return t}function Rf(e,t,i,r){let s=e.frame;if(s){let e=t[0]*s.width,a=(1-t[1])*s.height;for(let t of i){let i=t===s.uuid?s:s.find(t);if(i?.intersects(e,a))return r(i),!0}}return!1}function Rm(e,t){if(Tc(t)){if(t.visible){let i=[];return t.raycast(e,i),i.length?i[0]:void 0}}else if(Rc(t))return function e(t,i){if(!(!wv(i)||!i.visible)){if(Tc(i)){let e=[];if(i.raycast(t,e),e.length)return e[0]}for(let r of i.children){let i=e(t,r);if(i)return i}}}(e,t)}var Rg=class{constructor(e,t,i,r,s,a,o,h){this.renderer=e,this.publish=t,this.scene=i,this.getCamera=r,this.sharedAssets=s,this.requestRender=a,this.isExport=o,this.frame=h,this.raycaster=new Rh,this._useWindowEvents=!1,this.pointerWorld={x:0,y:0},this.pointerScreen={x:0,y:0},this._useWindowEvents="window"===t.mouseEventTarget,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 t,i;let{pageX:r,pageY:s}=e.touches?.length>0?e.touches[0]:e;this.pointerWorld={x:(r-((t=this._domRect).left+window.scrollX))/t.width*2-1,y:-(2*((s-(t.top+window.scrollY))/t.height))+1},this.pointerScreen={x:(r-((i=this._domRect).left+window.scrollX))/i.width,y:1-(s-(i.top+window.scrollY))/i.height},this.raycaster.setFromCamera(this.pointerWorld,this.getCamera())}},Rv=class{constructor(e){this.eventContext=e,this.domEventsNeeded=new Set,this.hasVideoAction=!1}connect(){}disconnect(){}},Ry=[["start","Start"],["keyDown","KeyDown"],["keyUp","KeyUp"],["mouseDown","MouseDown"],["mouseUp","MouseUp"],["mouseHover","MouseHover"],["collision","Collision"],["lookAt","LookAt"],["follow","Follow"],["scroll","Scroll"]],Rx=e=>Ry.find(([t,i])=>i===e)?.[0],Rb=e=>Ry.find(([t])=>t===e)?.[1],Rw=(e,t)=>{let i=Rx(e);if(i){let e=new CustomEvent(i,{bubbles:!0});return Object.defineProperty(e,"target",{writable:!1,value:t}),e}},R_=class extends Rv{constructor(){super(...arguments),this.objectsPerEvents=new Map,this.splineEvents={},this.onBeginEvent=e=>{if(!e.eventName||!e.target||"Scroll"===e.eventName)return;let t=this.splineEvents[Rx(e.eventName)]?.[e.target.uuid];if(!t)return;"Scroll"===e.eventName&&void 0!==e.deltaY&&Object.assign(t,{deltaY:e.deltaY});let{domElement:i}=this.eventContext;i.dispatchEvent(t)}}connect(){let{page:e}=this.eventContext;e.traverseEntity(e=>{if(e.data?.events.length){for(let[t,i]of Ry)if(e.data.events.some(e=>e.data.type===i&&!e.data.disabled)){this.objectsPerEvents.has(t)?this.objectsPerEvents.get(t)?.push(e):this.objectsPerEvents.set(t,[e]);let r=Rw(i,{id:e.uuid,name:e.name}),s=this.splineEvents[t];s?s[e.uuid]=r:this.splineEvents[t]={[e.uuid]:r}}}}),this.objectsPerEvents.forEach(e=>{e.forEach(e=>{e.addEventListener("beginEvent",this.onBeginEvent)})})}disconnect(){this.objectsPerEvents.forEach(e=>{e.forEach(e=>{e.removeEventListener("beginEvent",this.onBeginEvent)})})}},RS=class{constructor(e,t,i,r,s,a){if(this.id=e,this.data=t,this.object=i,this.entered=!1,("KeyDown"===t.type||"KeyUp"===t.type||"KeyPress"===t.type)&&!t.key)throw Error("Missing property");this.actions=IO(t,t.actions,r,s,a,i)}disconnect(){IL(this.actions)}dispatchHeld(e){this.actions.Create.forEach(t=>{e&&t.dispatchThrottled.cancel(),t.dispatchThrottled()})}dispatch(e=!1){this.actions.Transition.forEach(e=>{e.object.currentTransitionEvent!==this&&(e.object.currentTransitionEvent=this,e.init())}),"MousePress"===this.data.type||"KeyPress"===this.data.type?this.entered||(this.entered=!0,this.actions.Transition.forEach(e=>
vendor: 11,939 bytes, line 8106
8106e.playFromCurrent()),this.actions.Animation.forEach(e=>e.playFromCurrent()),this.actions.TimelineAnimation.forEach(e=>e.toggle(!0)),this.actions.SwitchCamera.forEach(e=>e.playFromCurrent()),this.actions.Create.forEach(e=>e.dispatchStart())):(this.actions.Transition.some(e=>e.playing&&"Toggle"!==e.data.runMode)||this.actions.Transition.forEach(e=>{"Toggle"===e.data.runMode?e.toggle():e.play()}),this.actions.SwitchCamera.some(e=>e.playing&&"Toggle"!==e.data.runMode)||this.actions.SwitchCamera.forEach(e=>{"Toggle"===e.data.runMode?e.toggle():e.play()}),this.actions.Animation.forEach(e=>{"Toggle"===e.data.runMode?e.toggle():e.play()}),this.actions.TimelineAnimation.forEach(e=>{e.play()})),this.actions.Link.forEach(e=>{e.dispatch()}),this.actions.SceneTransition.forEach(e=>{e.dispatch()}),!1===e&&this.actions.Create.forEach(e=>{e.dispatch()}),this.actions.Destroy.forEach(e=>{e.dispatch()}),this.actions.Reset.forEach(e=>{e.dispatch()}),this.actions.Audio.forEach(e=>{e.dispatchBasic()}),this.actions.Video.forEach(e=>{e.dispatchBasic()}),this.actions.Particles.forEach(e=>{e.dispatchBasic()}),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())}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(e=>{e.object.currentTransitionEvent!==this&&(e.object.currentTransitionEvent=this,e.init())}),e?(this.actions.Transition.forEach(e=>e.reverseFromCurrent()),this.actions.Animation.forEach(e=>e.reverseFromCurrent()),this.actions.TimelineAnimation.forEach(e=>e.reverseFromCurrent()),this.actions.SwitchCamera.forEach(e=>e.reverseFromCurrent())):(this.actions.Transition.forEach(e=>e.playFromCurrent()),this.actions.Animation.forEach(e=>e.playFromCurrent()),this.actions.TimelineAnimation.forEach(e=>e.playFromCurrent()),this.actions.SwitchCamera.forEach(e=>e.playFromCurrent())),this.actions.Link.forEach(e=>{e.dispatch()}),this.actions.SceneTransition.forEach(e=>{e.dispatch()}),this.actions.Create.forEach(e=>{e.dispatch()}),this.actions.Destroy.forEach(e=>{e.dispatch()}),this.actions.Reset.forEach(e=>{e.dispatch()}),this.actions.Audio.forEach(e=>{e.dispatchBasic()}),this.actions.Video.forEach(e=>{e.dispatchBasic()}),this.actions.Particles.forEach(e=>{e.dispatchBasic()}),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())}},RC=class extends Rv{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=e=>{if(!0===this.useForRaycastProperty&&null===this.sceneInterects){this.eventContext.updateRaycaster(e);let{raycaster:t,page:i}=this.eventContext,r=Ru(t,i,[],!0);this.sceneInterects=r,r.length&&(this.eventContext.sharedAssets.raycastProperty={x:r[0].point.x,y:r[0].point.y,z:r[0].point.z,objX:r[0].object.matrixWorld.elements[12],objY:r[0].object.matrixWorld.elements[13],objZ:r[0].object.matrixWorld.elements[14]})}},this.onCanvasMouseDown=e=>{(e.target===this.eventContext.domElement||"SPLINE-VIEWER"===e.target.tagName)&&this.canvasMouseEvents.forEach(t=>{("MouseDown"===t.data.type||"MousePress"===t.data.type)&&(this.onCanvasRaycast(e),t.dispatch())})},this.onCanvasMouseUp=e=>{(e.target===this.eventContext.domElement||"SPLINE-VIEWER"===e.target.tagName)&&this.canvasMouseEvents.forEach(t=>{"MouseUp"===t.data.type?(this.onCanvasRaycast(e),t.dispatch()):"MousePress"===t.data.type&&t.dispatchRelease()})},this.onMouseDown=e=>{pt.length>1||(this.eventContext.updateRaycaster(e),this.handleMouseEvent("MouseDown"))},this.onMouseUp=e=>{pt.length>1||(this.eventContext.updateRaycaster(e),this.handleMouseEvent("MouseUp"))},this.onMousePressDown=e=>{pt.length>1||(this.eventContext.updateRaycaster(e),this.handleMousePressEvent())},this.onMousePressRelease=e=>{pt.length>1||(this.eventContext.updateRaycaster(e),this.handleMousePressEvent(!0))},this.onKeyDown=e=>{this.heldKeys[e.key]||(this.handleKeyEvent(e,"KeyDown"),this.handleKeyEventHeld(e,"KeyDown",!0)),this.heldKeys[e.key]=!0},this.onKeyUp=e=>{this.handleKeyEvent(e,"KeyUp"),this.handleKeyEventHeld(e,"KeyUp",!0)},this.onKeyPressDown=e=>{this.heldKeysPress[e.key]?this.handleKeyEventHeld(e,"KeyPress"):(this.handleKeyEvent(e,"KeyPress"),this.handleKeyEventHeld(e,"KeyPress",!0)),this.heldKeysPress[e.key]=!0},this.onKeyPressUp=e=>{this.handleKeyEvent(e,"KeyPress",!0)},this.releaseHeldKey=e=>{delete this.heldKeys[e.key]},this.releaseHeldKeyPress=e=>{delete this.heldKeysPress[e.key]},this._onUserEvent=({eventName:e,target:t,reverse:i})=>{if(!e||!t)return;let r=Rb(e);r&&("MouseDown"===r||"MouseUp"===r||"MousePress"===r?(t.dispatchEvent({type:"beginEvent",eventName:r}),this.eventsPerObjects[r]?.[t.uuid]?.forEach(e=>{e.dispatchUserEvent(i)})):("KeyDown"===r||"KeyUp"===r||"KeyPress"===r)&&(t.dispatchEvent({type:"beginEvent",eventName:r}),this.eventsPerObjects[r]?.[t.uuid]?.forEach(e=>{e.dispatchUserEvent()})))}}connect(){let{page:e,sharedAssets:t,domElement:i}=this.eventContext,r=(i,r)=>{if(i.data?.events.length)for(let s of["MouseDown","MouseUp","MousePress","KeyDown","KeyUp","KeyPress"]){let a=this.eventsPerObjects[s];if(i.data.events.filter(({data:e})=>e.type===s&&!0!==e.disabled).forEach(({id:r,data:s})=>{try{let o=new RS(r,s,i,e,t,this.eventManager);o.actions.Video.length&&(this.hasVideoAction=!0),("MouseDown"===s.type||"MouseUp"===s.type||"MousePress"===s.type)&&("Canvas"===s.mode||"Window"===s.mode)?this.canvasMouseEvents.push(o):(a[i.uuid]?a[i.uuid].some(e=>e.id===o.id)||a[i.uuid].push(o):a[i.uuid]=[o],i instanceof OJ&&i.traverseChildren(e=>{if(!e.visible)return!0;e instanceof Al&&"shapeBlendNode"in e.data.geometry&&e.data.geometry.shapeBlendNode?.operation!==2&&(a[e.uuid]?a[e.uuid].push(o):a[e.uuid]=[o])}))}catch(e){}}),a[i.uuid]?.length&&(this.objectsPerTypes[s].push(i instanceof DD&&("MouseDown"===s||"MouseUp"===s||"MousePress"===s)?r:i),i instanceof OJ)){let e=this.objectsPerTypes[s];i.traverseChildren(t=>{if(!t.visible)return!0;t instanceof Al&&-1===e.indexOf(t)&&e.push(t)})}}};e.traverseEntity(e=>{(e instanceof O_||e instanceof Op)&&e.frame?.traverse(t=>{r(t,e)}),r(e)}),this.heldKeys={},this.heldKeysPress={},this.domEventsNeeded.clear(),i.addEventListener("pointerdown",this.onCanvasMouseDown),i.addEventListener("pointerup",this.onCanvasMouseUp),(this.objectsPerTypes.MouseDown?.length||this.useForRaycastProperty)&&(this.domEventsNeeded.add("pointerdown"),i.addEventListener("pointerdown",this.onMouseDown)),this.objectsPerTypes.MouseUp?.length&&(this.domEventsNeeded.add("pointerup"),i.addEventListener("pointerup",this.onMouseUp)),this.objectsPerTypes.MousePress?.length&&(this.domEventsNeeded.add("pointerdown"),i.addEventListener("pointerdown",this.onMousePressDown),this.domEventsNeeded.add("pointerup"),i.addEventListener("pointerup",this.onMousePressRelease)),this.objectsPerTypes.KeyDown?.length&&(this.domEventsNeeded.add("keydown"),document.addEventListener("keydown",this.onKeyDown),document.addEventListener("keyup",this.releaseHeldKey)),this.objectsPerTypes.KeyUp?.length&&(this.domEventsNeeded.add("keyup"),document.addEventListener("keyup",this.onKeyUp)),this.objectsPerTypes.KeyPress?.length&&(this.domEventsNeeded.add("keydown"),document.addEventListener("keydown",this.onKeyPressDown),document.addEventListener("keyup",this.releaseHeldKeyPress),this.domEventsNeeded.add("keyup"),document.addEventListener("keyup",this.onKeyPressUp)),Object.entries(this.objectsPerTypes).forEach(([e,t])=>{t.forEach(e=>{e.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(e=>{Object.values(e).forEach(e=>{e.forEach(e=>{e.disconnect()})})}),this.canvasMouseEvents.forEach(e=>{e.disconnect()}),Object.entries(this.objectsPerTypes).forEach(([e,t])=>{t.forEach(e=>{e.removeEventListener("userEvent",this._onUserEvent)})})}handleMouseEvent(e){let{stopRaycast:t,raycaster:i,page:r,pointerScreen:s}=this.eventContext,a=this.objectsPerTypes[e],o=a.filter(e=>!(e instanceof DD));if(!(!a.length&&!this.useForRaycastProperty)&&!(r.uiCanvas&&Rf(r,[s.x,s.y],Object.keys(this.eventsPerObjects[e]),t=>{this.handleObjectMouseEventDispatch(t,e)}))){if(t||this.useForRaycastProperty){let s;if(null===this.sceneInterects?s=Ru(i,r,o,this.useForRaycastProperty):(s=this.sceneInterects,this.sceneInterects=null),this.useForRaycastProperty&&s.length&&(this.eventContext.sharedAssets.raycastProperty={x:s[0].point.x,y:s[0].point.y,z:s[0].point.z,objX:s[0].object.matrixWorld.elements[12],objY:s[0].object.matrixWorld.elements[13],objZ:s[0].object.matrixWorld.elements[14]}),t){let t=[s[0]?.uv?.x??0,s[0]?.uv?.y??0];Rp(s).forEach(i=>{i instanceof O_&&Rf(i,t,Object.keys(this.eventsPerObjects[e]),t=>{this.handleObjectMouseEventDispatch(t,e)}),this.eventsPerObjects[e][i.uuid]&&this.handleObjectMouseEventDispatch(i,e)})}}t||o.forEach(t=>{let r=Rm(i,t);r&&(this.handleObjectMouseEventDispatch(t,e),t instanceof O_&&Rf(t,[r?.uv?.x??0,r?.uv?.y??0],Object.keys(this.eventsPerObjects[e]),t=>{this.handleObjectMouseEventDispatch(t,e)}))})}}handleMousePressEvent(e=!1){let t="MousePress",i=this.objectsPerTypes[t],r=i.filter(e=>!(e instanceof DD)),s=[];if(i.length){if(!e){let{stopRaycast:e,raycaster:i,page:a,pointerScreen:o}=this.eventContext,h=!1;if(a.uiCanvas&&(h=Rf(a,[o.x,o.y],Object.keys(this.eventsPerObjects[t]),e=>{s.push(e)})),e&&!h){let e=Ru(i,a,r);s=Rp(e),e.forEach(e=>{e.object instanceof O_&&Rf(e.object,[e?.uv?.x??0,e?.uv?.y??0],Object.keys(this.eventsPerObjects[t]),e=>{s.push(e)})})}else r.forEach(e=>{let r=Rm(i,e);r&&(s.push(e),e instanceof O_&&Rf(e,[r?.uv?.x??0,r?.uv?.y??0],Object.keys(this.eventsPerObjects[t]),e=>{s.push(e)}))})}this._prevObjects.length&&this._prevObjects.forEach(e=>{s.includes(e)||this.handleObjectMouseEventDispatchRelease(e,t)}),s.length&&s.forEach(e=>{this.handleObjectMouseEventDispatch(e,t)}),this._prevObjects=s}}handleObjectMouseEventDispatch(e,t){e.dispatchEvent({type:"beginEvent",eventName:t}),this.eventsPerObjects[t]?.[e.uuid]?.forEach(e=>{e.dispatch()})}handleObjectMouseEventDispatchRelease(e,t){e.dispatchEvent({type:"beginEvent",eventName:t}),this.eventsPerObjects[t]?.[e.uuid]?.forEach(e=>{e.dispatchRelease()})}handleKeyEvent(e,t,i=!1){this.objectsPerTypes[t].forEach(r=>{let s=this.eventsPerObjects[t][r.uuid];s.some(({data:t})=>"key"in t&&t.key===e.key)&&r.dispatchEvent({type:"beginEvent",eventName:t}
8106),s.forEach(t=>{"key"in t.data&&t.data.key===e.key&&(i?t.dispatchRelease():t.dispatch(!0))})})}handleKeyEventHeld(e,t,i=!1){this.objectsPerTypes[t].forEach(r=>{this.eventsPerObjects[t][r.uuid].forEach(t=>{"key"in t.data&&t.data.key===e.key&&t.dispatchHeld(i)})})}},RM=new iy,RE=new iy,RA=class{constructor(e,t,i,r,s){this.actionsIn=IO(e,e.inActions,i,r,s,t),this.actionsOut=IO(e,e.outActions,i,r,s,t)}disconnect(){IL(this.actionsIn),IL(this.actionsOut)}},RT=class extends RA{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 e of this.objects)if(!e.visible)return;let e=RM.setFromMatrixPosition(this.objects[0].matrixWorld),t=RE.setFromMatrixPosition(this.objects[1].matrixWorld),i=e.distanceTo(t)<=this.distance?"in":"out";if(this.stage!==i){this.stage=i;let e="in"===i?this.actionsIn:this.actionsOut;e.Audio.forEach(e=>e.dispatchConditional()),e.Particles.forEach(e=>e.dispatchConditional()),e.Video.forEach(e=>e.dispatchConditional()),e.Link.forEach(e=>e.dispatch()),e.Create.forEach(e=>e.dispatch()),e.Destroy.forEach(e=>e.dispatch()),e.Reset.forEach(e=>e.dispatch()),e.Transition.forEach(e=>{e.object.currentTransitionEvent!==this&&(e.object.currentTransitionEvent=this),e.init()}),e.Transition.forEach(e=>e.play()),e.Animation.forEach(e=>e.play()),e.TimelineAnimation.forEach(e=>e.play()),e.SwitchCamera.forEach(e=>e.play()),e.SceneTransition.forEach(e=>e.dispatch()),e.SetVariable.forEach(e=>e.checkConditions()),e.SetVariable.forEach(e=>e.dispatch()),e.DynamicVariablePlay.forEach(e=>e.dispatch()),e.ClearLocalStorage.forEach(e=>e.dispatch()),e.UserAPI.forEach(e=>e.dispatch())}};let{distance:o,fromObject:h,toObject:c}=t.condition;for(let e of(this.distance=o,[h,c])){if(!e)throw Error("Missing property");let t=r.find(e);if(!t)throw Error("Missing property");this.objects.push(t)}}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)})}},RP=class extends RA{constructor(e,t,i,r,s,a){super(t,i,r,s,a),this.id=e,this.data=t,this.object=i,this.onBegin=({target:e,state:t})=>
8106{this.toState!==t&&(this.actionsOut.Audio.forEach(e=>e.dispatchConditional()),this.actionsOut.Particles.forEach(e=>e.dispatchConditional()),this.actionsOut.Video.forEach(e=>e.dispatchConditional()),this.actionsOut.Link.forEach(e=>e.dispatch()),this.actionsOut.Create.forEach(e=>e.dispatch()),this.actionsOut.Destroy.forEach(e=>e.dispatch()),this.actionsOut.Reset.forEach(e=>e.dispatch()),this.actionsIn.Transition.forEach(e=>e.pause()),this.object.currentTransitionEvent=this,this.actionsOut.Transition.forEach(e=>e.play()),this.actionsOut.Animation.forEach(e=>e.play()),this.actionsOut.TimelineAnimation.forEach(e=>e.play()),this.actionsIn.SwitchCamera.forEach(e=>e.pause()),this.actionsOut.SwitchCamera.forEach(e=>e.play()),this.actionsOut.SceneTransition.forEach(e=>e.dispatch()),this.actionsOut.SetVariable.forEach(e=>e.checkConditions()),this.actionsOut.SetVariable.forEach(e=>e.dispatch()),this.actionsOut.DynamicVariablePlay.forEach(e=>e.dispatch()),this.actionsOut.ClearLocalStorage.forEach(e=>e.dispatch()),this.actionsOut.UserAPI.forEach(e=>e.dispatch()))},this.onComplete=({target:e,state:t})=>
8106{this.toState===t&&(this.actionsIn.Audio.forEach(e=>e.dispatchConditional()),this.actionsIn.Particles.forEach(e=>e.dispatchConditional()),this.actionsIn.Video.forEach(e=>e.dispatchConditional()),this.actionsIn.Link.forEach(e=>e.dispatch()),this.actionsIn.Create.forEach(e=>e.dispatch()),this.actionsIn.Destroy.forEach(e=>e.dispatch()),this.actionsIn.Reset.forEach(e=>e.dispatch()),this.actionsOut.Transition.forEach(e=>e.pause()),this.actionsOut.Transition.forEach(e=>e.pause()),this.object.currentTransitionEvent=this,this.actionsIn.Transition.forEach(e=>e.play()),this.actionsIn.Animation.forEach(e=>e.play()),this.actionsIn.TimelineAnimation.forEach(e=>e.play()),this.actionsOut.SwitchCamera.forEach(e=>e.pause()),this.actionsIn.SwitchCamera.forEach(e=>e.play()),this.actionsIn.SceneTransition.forEach(e=>e.dispatch()),this.actionsIn.SetVariable.forEach(e=>e.checkConditions()),this.actionsIn.SetVariable.forEach(e=>e.dispatch()),this.actionsIn.DynamicVariablePlay.forEach(e=>e.dispatch()),this.actionsOut.ClearLocalStorage.forEach(e=>e.dispatch()),this.actionsOut.UserAPI.forEach(e=>e.dispatch()))};let{condition:o}=t;if(!o.object)throw Error("Missing property");let h=r.find(o.object)??r.scene.find2D(o.object);if(!h||(this.toObject=h,o.state&&!this.toObject.states?.[o.state]))throw Error("Missing property");this.toState=o.state}connect(){cZ(this.actionsOut).forEach(e=>{this.actionsOut[e]?.length&&this.toObject.addEventListener("beginState",this.onBegin)}),cZ(this.actionsIn).forEach(e=>{this.actionsIn[e]?.length&&this.toObject.addEventListener("completeState",this.onComplete)})}disconnect(){super.disconnect(),cZ(this.actionsOut).forEach(e=>{this.actionsIn[e]?.length&&this.toObject.removeEventListener("beginState",this.onBegin)}),cZ(this.actionsIn).forEach(e=>{this.actionsIn[e]?.length&&this.toObject.removeEventListener("completeState",this.onComplete)})}},RD=class extends Rv{constructor(e,t){super(e),this.eventManager=t,this.eventsPerConditions={Comparison:[],Distance:[],State:[]},this.hasVideoAction=!1}connect(){super.connect();let{page:e,sharedAssets:t}=this.eventContext;e.traverseEntity(i=>{if(i.data?.events.length){for(let{id:r,data:s}of i.data.events)if(!s.disabled&&"Conditional"===s.type)try{let a;"Comparison"===s.condition.type||("Distance"===s.condition.type?a=new RT(r,s,i,e,t,this.eventManager):"State"===s.condition.type&&(a=new RP(r,s,i,e,t,this.eventManager))),a&&(this.eventsPerConditions[s.condition.type].push(a),(a.actionsIn.Video.length||a.actionsOut.Video.length)&&(this.hasVideoAction=!0))}catch(e){}}}),Object.values(this.eventsPerConditions).forEach(e=>e.forEach(e=>e.connect()))}disconnect(){super.disconnect(),Object.values(this.eventsPerConditions).forEach(e=>e.forEach(e=>e.disconnect()))}},RO=new iy,RL=new iy,RI=new iy,RR=new ss,Rk=new iy,RB=new iy,Rz=new iy,RN=new iv,RF=new i4,Rj=new iY,RU=new tK,RV=new iy,RW=new iy;function RH(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 RG=(ts=new iY,(e,t,i)=>{let r=e.obj;ts.copy(r.hiddenMatrix),null!==r.parent&&ts.premultiply(r.parent.matrixWorld),ts.invert(),r.position.copy(t),"global"===e.reference&&RH(r.position,e.limits),r.position.applyMatrix4(ts),"parent"===e.reference?RH(r.position,e.limits):"local"===e.reference&&(RN.copy(e.quat0).invert(),r.position.sub(e.position0),r.position.applyQuaternion(RN),RH(r.position,e.limits),RN.invert(),r.position.applyQuaternion(RN),r.position.add(e.position0)),ts.multiply(i??r.matrixWorld).decompose(Rk,r.quaternion,RB),r.updateMatrix(),r.hasNonUniformScale&&(r.updateMatrixWorld(),r.updateMatrixWorldSVD()),r instanceof Cf&&Td(r.parent)&&r.invalidateDownstreamBooleanData(!0)}),Rq=class{constructor(e,t,i,r,s,a,o){this.object=e,this.id=t,this.data=i,this.dropDestIds=[],this.activeIdx=null,this.wasDragEventTriggered=!1,this.resetDampingFactor=0===this.data.resetSpeed?1:8/this.data.resetSpeed+1,this.snapDampingFactor=0===this.data.snapSpeed?1:8/this.data.snapSpeed+1,this.actionsDrag=IO(i,i.dragDropActions.drag,r,s,a,this.object),this.actionsDrop=IO(i,i.dragDropActions.drop,r,s,a,this.object);let h=[];
8106this.data.objects.forEach(e=>{let t=r.find(e);!t||!1!==t.data.visible&&(h.push(t),o[t.uuid]&&o[t.uuid].forEach(e=>{let t=r.find(e);t&&!1!==t.data.visible&&h.push(t)}))}),this.data.dropDestinations.forEach(e=>{let t=r.find(e);!t||!1!==t.data.visible&&(this.dropDestIds.push(t.uuid),o[t.uuid]&&o[t.uuid].forEach(e=>{let t=r.find(e);t&&!1!==t.data.visible&&this.dropDestIds.push(t.uuid)}))}),this.dragItems=h.map(e=>("locked"===this.data.planeMode&&(e.userData.lockedPlane=!0),e.userData.worldPosition0=new iy().setFromMatrixPosition(e.matrixWorld),{obj:e,fromPosition:new iy().setFromMatrixPosition(e.matrixWorld),pointStart:new iy,pointEnd:new iy,paused:!0,currentDampingFactor:this.data.dampingFactor,reset:!1,position0:new iy().copy(e.position),quat0:new iv().copy(e.quaternion),snapped:!1,orientationMatrix:new iY,limits:this.data.limits,reference:this.data.referenceFrame}))}get activeDragItem(){return null!==this.activeIdx?this.dragItems[this.activeIdx]:null}dispose(){IL(this.actionsDrag),IL(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()})}},RX=class extends Rv{constructor(e,t){super(e),this.eventManager=t,this.events=[],this.lastDropDestination=null,this.dragTimeout=null,this.onPointerDown=e=>{if(pt.length>1)return;this.eventContext.updateRaycaster(e);let{raycaster:t,page:i}=this.eventContext,r=i.raycastWithClones(t);if(this.lastDropDestination=null,0===r.length){this.activeEvent=null;return}for(let e of this.events){let t=0;for(let{obj:i,pointEnd:s,pointStart:a}of e.dragItems){if(i===r[0].object||i===r[0].object.object||SL.is(i)&&i.isAncestorOf(r[0].object.uuid)){if(e.activeIdx=t,e.activeDragItem.reset=!1,e.activeDragItem.currentDampingFactor=e.data.dampingFactor,e.activeDragItem.snapped=!1,"hand"===e.data.cursor&&this.setCursor("grabbing"),this.eventManager.controlsManager.usePhysics){e.activeDragItem.obj.rigidBody&&e.activeDragItem.obj.rigidBody.setBodyType(2,!0);let t=e.activeDragItem.obj;i.hasNonUniformScale&&i.updateMatrixWorldSVD(),(t.hasNonUniformScale?t.matrixWorldRigid:t.matrixWorld).decompose(Rk,RN,RB),RF.setFromQuaternion(RN),void 0===t.prevR?(t.prevR=RF.clone(),t.prevT=Rk.clone()):(t.prevR.copy(RF),t.prevT.copy(Rk)),this.eventManager.controlsManager.sharedGameControlGlobals.entitiesWithTransformAnim.push(e.activeDragItem.obj)}this.calcPlaneIntersectPos(i,a,e.data.plane,e.data.referenceFrame),s.copy(a),(this.eventManager.controlsManager.usePhysics&&i.data.physics?.rigidBody==="dynamic"||!1===e.data.drop||!1===e.data.resetOnSnapFail)&&e.activeDragItem.fromPosition.setFromMatrixPosition(e.activeDragItem.obj.matrixWorld),this.activeEvent=e,this.eventManager.controlsManager.orbitControls&&(this.eventManager.controlsManager.orbitControls.enabled=!1);return}t++}}this.activeEvent=null},this.onPointerMove=e=>{if(pt.length>1)return;this.eventContext.updateRaycaster(e);let{raycaster:t,page:i}=this.eventContext,r=i.raycastWithClones(t);if(0===pt.length){let e=!1;for(let t of this.events){for(let{obj:i}of t.dragItems)if(i===r[0]?.object||i===r[0]?.object?.object||SL.is(i)&&i.isAncestorOf(r[0]?.object.uuid)){switch(e=!0,t.data.cursor){case"hand":this.setCursor("grab");break;case"move":this.setCursor("move")}break}if(e)break}e||this.setCursor("default");return}if(this.activeEvent&&this.activeEvent.activeDragItem){let e,t=this.activeEvent.activeDragItem;if(t.snapped=!1,this.activeEvent.data.drop&&(e=r.filter(e=>t.obj!==e.object&&!t.obj.isAncestorOf(e.object.uuid)&&!(e.object instanceof Ty)&&("all"===this.activeEvent.data.dropOn||this.activeEvent.dropDestIds.some(t=>t===e.object.uuid||i.scene.find(t).isAncestorOf(e.object.uuid))))[0]),e){let i=Rz.copy(e.face.normal).applyMatrix3(RU.getNormalMatrix(e.object.matrixWorld));if("center"===this.activeEvent.data.snapTo)t.fromPosition.setFromMatrixPosition(e.object.matrixWorld);else if("surface"===this.activeEvent.data.snapTo){if(t.fromPosition.copy(e.point),"bbox"===this.activeEvent.data.snapSurfaceMode){Rk.copy(i).applyMatrix3(RU.setFromMatrix4(t.obj.matrixWorld).transpose());let e=t.obj;Rk.x>.2?RB.x=-e.recursiveBBox.min.x:Rk.x<-.2&&(RB.x=-e.recursiveBBox.max.x),Rk.y>.2?RB.y=-e.recursiveBBox.min.y:Rk.y<-.2&&(RB.y=-e.recursiveBBox.max.y),Rk.z>.2?RB.z=-e.recursiveBBox.min.z:Rk.z<-.2&&(RB.z=-e.recursiveBBox.max.z),RB.applyMatrix3(RU.invert())}else RB.copy(i).multiplyScalar(this.activeEvent.data.snapSurfaceOffset);t.fromPosition.add(RB)}
vendor: 1,255 bytes, line 8106
8106this.activeEvent.data.autoOrient&&(Rk.set(0,1,0).cross(i),1e-4>Rk.length()&&Rk.set(-1,0,0).cross(i),RB.crossVectors(Rz,Rk),t.orientationMatrix.makeBasis(Rk,RB,i)),t.pointStart.copy(t.fromPosition),t.pointEnd.copy(t.pointStart),t.currentDampingFactor=this.activeEvent.snapDampingFactor,t.snapped=!0,this.lastDropDestination!==e.object&&(this.lastDropDestination=e.object,this.activeEvent.actionsDrop.Transition.forEach(e=>{e.play()}),this.activeEvent.actionsDrop.Animation.forEach(e=>{e.play()}),this.activeEvent.actionsDrop.Audio.forEach(e=>{e.dispatchGameControl("start")}),this.activeEvent.actionsDrop.Particles.forEach(e=>{e.dispatchGameControl("start")}),this.activeEvent.actionsDrop.Create.forEach(e=>{e.dispatchThrottled()}))}else t.orientationMatrix.makeRotationFromQuaternion(t.quat0),this.lastDropDestination=null,t.currentDampingFactor=this.activeEvent.data.dampingFactor,this.calcPlaneIntersectPos(t.obj,t.pointEnd,this.activeEvent.data.plane,this.activeEvent.data.referenceFrame),this.activeEvent.actionsDrop.Transition.forEach(e=>{e.stop(),null!==e.object.currentState&&e.object.changeSelectedState(null,{scene:this.eventContext.page.scene,shared:this.eventContext.sharedAssets})}),this.activeEvent.actionsDrop.Animation.forEach(e=>{e.stop()}
8106),this.activeEvent.actionsDrop.Audio.forEach(e=>{e.dispatchGameControl("stop")}),this.activeEvent.actionsDrop.Particles.forEach(e=>{e.dispatchGameControl("stop")});this.activeEvent.actionsDrag.Create.forEach(e=>{e.dispatchThrottled()}),this.activeEvent.actionsDrag.SetVariable.forEach(e=>e.checkConditions()),this.activeEvent.actionsDrag.SetVariable.forEach(e=>e.dispatch()),this.activeEvent.actionsDrag.DynamicVariablePlay.forEach(e=>e.dispatch()),this.activeEvent.actionsDrag.ClearLocalStorage.forEach(e=>e.dispatch()),this.activeEvent.actionsDrag.UserAPI.forEach(e=>e.dispatch()),!1===this.activeEvent.wasDragEventTriggered&&(this.activeEvent.wasDragEventTriggered=!0,this.activeEvent.actionsDrag.Transition.forEach(e=>{e.play()}),this.activeEvent.actionsDrag.Animation.forEach(e=>{e.play()}),this.activeEvent.actionsDrag.Audio.forEach(e=>{e.dispatchGameControl("start")}),this.activeEvent.actionsDrag.Particles.forEach(e=>{e.dispatchGameControl("start")})),this.dragTimeout&&window.clearTimeout(this.dragTimeout),this.dragTimeout=window.setTimeout(()=>{this.activeEvent&&(this.activeEvent.wasDragEventTriggered=!1,this.activeEvent.actionsDrag.Audio.forEac
vendor: 5,919 bytes, line 8106
8106h(e=>{e.dispatchGameControl("stop")}),this.activeEvent.actionsDrag.Particles.forEach(e=>{e.dispatchGameControl("stop")}),this.activeEvent.actionsDrag.Transition.forEach(e=>{e.stop(),null!==e.object.currentState&&e.object.changeSelectedState(null,{scene:this.eventContext.page.scene,shared:this.eventContext.sharedAssets})}),this.activeEvent.actionsDrag.Animation.forEach(e=>{e.stop()}))},500),this.updateDragItem(t),t.obj.dispatchEvent({type:"requestRender"})}},this.onPointerUp=e=>{if(this.activeEvent&&this.activeEvent.activeDragItem){"hand"===this.activeEvent.data.cursor&&this.setCursor("grab");let e=this.activeEvent.activeDragItem.obj.data.physics?.rigidBody==="dynamic";!1===this.activeEvent.activeDragItem.snapped&&this.activeEvent.data.drop&&this.activeEvent.data.resetOnSnapFail&&(!1===this.eventManager.controlsManager.usePhysics||!e)&&(this.activeEvent.activeDragItem.reset=this.activeEvent.data.resetOnSnapFail,this.activeEvent.activeDragItem.paused=!1,this.activeEvent.activeDragItem.currentDampingFactor=this.activeEvent.resetDampingFactor),this.eventManager.controlsManager.usePhysics&&e&&(this.eventManager.controlsManager.sharedGameControlGlobals.entitiesWithTransformAnim.pop(),this.activeEvent.activeDragItem.obj.rigidBody.setBodyType(0,!0),this.activeEvent.activeDragItem.paused=!0),!0===this.activeEvent.wasDragEventTriggered&&(this.activeEvent.wasDragEventTriggered=!1,this.activeEvent.actionsDrag.Transition.forEach(e=>{e.stop(),null!==e.object.currentState&&e.object.changeSelectedState(null,{scene:this.eventContext.page.scene,shared:this.eventContext.sharedAssets})}),this.activeEvent.actionsDrag.Animation.forEach(e=>{e.stop()}),this.activeEvent.actionsDrag.Audio.forEach(e=>{e.dispatchGameControl("stop")}),this.activeEvent.actionsDrag.Particles.forEach(e=>{e.dispatchGameControl("stop")}),this.activeEvent.actionsDrop.SetVariable.forEach(e=>e.checkConditions()),this.activeEvent.actionsDrop.SetVariable.forEach(e=>e.dispatch()),this.activeEvent.actionsDrop.DynamicVariablePlay.forEach(e=>e.dispatch()),this.activeEvent.actionsDrop.ClearLocalStorage.forEach(e=>e.dispatch()),this.activeEvent.actionsDrop.UserAPI.forEach(e=>e.dispatch())),this.eventManager.controlsManager.orbitControls&&(this.eventManager.controlsManager.orbitControls.enabled=!0)}}}connect(){let e={};if(this.eventContext.page.traverseEntity(t=>{t.component&&(e[t.component.uuid]?e[t.component.uuid].push(t.uuid):e[t.component.uuid]=[t.uuid])}),this.eventContext.page.traverseEntity(t=>{t.data?.events.filter(e=>"DragDrop"===e.data.type&&!e.data.disabled).forEach(i=>{this.events.push(new Rq(t,i.id,i.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(e=>e.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(RL),RL.negate();let o=RN.identity();switch("parent"===r?Rj.multiplyMatrices(e.parent.matrixWorld,e.hiddenMatrix).decompose(Rk,o,RB):"local"===r&&e.matrixWorld.decompose(Rk,o,RB),i){case"x":Rk.set(1,0,0).applyQuaternion(o),RV.copy(RL).cross(Rk),RW.copy(Rk).cross(RV);break;case"y":Rk.set(0,1,0).applyQuaternion(o),RV.copy(RL).cross(Rk),RW.copy(Rk).cross(RV);break;case"z":Rk.set(0,0,1).applyQuaternion(o),RV.copy(RL).cross(Rk),RW.copy(Rk).cross(RV);break;case"xy":RW.set(0,0,1).applyQuaternion(o);break;case"yz":RW.set(1,0,0).applyQuaternion(o);break;case"xz":RW.set(0,1,0).applyQuaternion(o);break;case"adaptive":RL.angleTo(RB.set(0,1,0))>Math.PI/6?(Rk.crossVectors(RB.set(0,1,0),RL),RW.crossVectors(Rk,RB)):RW.set(0,1,0);break;default:RW.copy(RL)}RI.setFromMatrixPosition(e.matrixWorld);let h=e.userData.lockedPlane?e.userData.worldPosition0:RI;if(RR.setFromNormalAndCoplanarPoint(RW,h),a.ray.intersectPlane(RR,t)&&("x"===i||"y"===i||"z"===i)){let e=RB.subVectors(t,h).dot(Rk);t.copy(h).addScaledVector(Rk,e)}}updateDragItem(e,t=!1){RI.setFromMatrixPosition(e.obj.matrixWorld),"current"===e.reset?RO.subVectors(e.fromPosition,RI).divideScalar(e.currentDampingFactor):"original"===e.reset?(RO.subVectors(e.obj.userData.worldPosition0,RI).divideScalar(e.currentDampingFactor),e.fromPosition.copy(e.obj.userData.worldPosition0),e.pointStart.copy(e.fromPosition),e.pointEnd.copy(e.pointStart)):RO.subVectors(e.pointEnd,e.pointStart).add(e.fromPosition).sub(RI).divideScalar(e.currentDampingFactor),e.paused=!(e.currentDampingFactor>1)||.01>RO.length(),(this.activeEvent&&1===this.activeEvent.data.dampingFactor||t)&&RG(e,RO.add(RI),this.activeEvent?.data.drop&&this.activeEvent?.data.autoOrient?e.orientationMatrix:null),e.obj.dispatchEvent({type:"beginEvent",eventName:"DragDrop"}),this.eventManager.requestRender()}},RY=new iy,RQ=new iy,RZ=new iy,RK=new iy,RJ=new ss,R$={type:"requestRender"},R0=(ta=new iy,tn=new iy,(e,t,i)=>i>0?(ta.subVectors(e,t),ta.length()<=i?e:tn.copy(t).add(ta.normalize().multiplyScalar(i))):t),R1=(to=new iY,(e,t)=>{e.position.copy(t),null!==e.parent&&(to.copy(e.parent.matrixWorld).invert(),e.position.applyMatrix4(to)),to.copy(e.hiddenMatrix).invert(),e.position.applyMatrix4(to),e.updateMatrix(),e.hasNonUniformScale&&(e.updateMatrixWorld(),e.updateMatrixWorldSVD()),e instanceof Cf&&Td(e.parent)&&e.invali
8106dateDownstreamBooleanData(!0)}),R2=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 iy,this.timeoutId=null,this.delayFinished=!0,this.wasOutside=!1,this.data={...m$.defaultData,...e,...void 0===e.resetOnPointerLeave&&{resetOnPointerLeave:!1}},void 0===e.target||"cursor"===e.target||(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=IO(e,e.actions,r,s,a,i)}},R3=class extends Rv{constructor(e,t){super(e),this.eventManager=t,this.events=[],this.pairOfEventListeners=[],this.onMouseMove=e=>{if(!(pt.length>1))for(let t of(this.eventContext.updateRaycaster(e),this.events))void 0===t.target&&this.updateSingleEvent(t)},this.onMouseEnter=e=>{for(let e of this.events)void 0===e.target&&(e.isReset=!1,e.currentDampingFactor=e.data.dampingFactor)},this.onMouseLeave=e=>{for(let e of this.events)void 0===e.target&&(e.data.resetOnPointerLeave&&(e.isReset=!0,e.currentDampingFactor=e.resetDampingFactor),this.updateSingleEvent(e))},this.onTargetChange=e=>()=>{this.updateSingleEvent(e)}}connect(){let{page:e}=this.eventContext;if(e.traverseEntity(t=>{let i=t.data?.events.find(e=>"Follow"===e.data.type&&!e.data.disabled);i&&(!e.data.globalPhysics.usePhysics||t.dataPatched.physics?.rigidBody!=="dynamic")&&this.events.push(new R2(i.data,i.id,t,e,this.eventContext.sharedAssets,this.eventManager))}),!this.events.length)return;let{domElement:t,eventElement:i}=this.eventContext;for(let e of(this.domEventsNeeded.clear(),u5&&(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)),this.events))if(void 0!==e.target){let t=e.target,i=this.onTargetChange(e);this.pairOfEventListeners.push([t,i]),t.addEventListener("requestRender",i)}}disconnect(){if(!this.events.length)return;let{domElement:e,eventElement:t}=this.eventContext;for(let[i,r]of(this.domEventsNeeded.clear(),u5&&e.removeEventListener("pointerdown",this.onMouseMove),t.removeEventListener("pointermove",this.onMouseMove),e.removeEventListener("pointerenter",this.onMouseEnter),e.removeEventListener("pointerleave",this.onMouseLeave),this.pairOfEventListeners))i.removeEventListener("requestRender",r);for(let e of this.events)e.paused=!0,e.isReset=!1,IL(e.actions)}onAnimationFrameDamping(){for(let e of this.events)e.paused||this.updateSingleEvent(e,!0)}updateSingleEvent(e,t=!1){this.events.forEach(e=>{e.actions.Create.forEach(e=>{e.dispatchThrottled()})});let{plane:i,limitDistance:r,limitDistanceEnabled:s}=e.data;if(e.object.getWorldPosition(RZ),e.isReset)RK.copy(e.worldPosition0);else if(e.target)e.target.getWorldPosition(RK);else{let{getCamera:e,raycaster:t}=this.eventContext;if("custom"===i?(e().getWorldDirection(RQ),RQ.negate(),RY.copy(RQ)):"xy"===i?RY.set(0,0,1):"xz"===i?RY.set(0,1,0):"yz"===i&&RY.set(1,0,0),RJ.setFromNormalAndCoplanarPoint(RY,RZ),!t.ray.intersectPlane(RJ,RK))return}if(!e.isReset){if(RK.distanceTo(e.worldPosition0)>r&&s&&e.target)if(e.snapComplete=!1,e.data.snapDelay&&(e.delayFinished=!1,"u">typeof window&&null!==e.timeoutId&&(window.clearTimeout(e.timeoutId),e.timeoutId=null)),e.wasOutside=!0,!e.data.resetAfterDistanceLimit)return;else RK.copy(e.worldPosition0),e.currentDampingFactor=e.resetDampingFactor;else if(e.wasOutside&&(e.data.snapDelay&&"u">typeof window&&(e.timeoutId=window.setTimeout(()=>{e.delayFinished=!0,e.paused=!1,this.updateSingleEvent(e)},1e3*e.data.snapDelay)),e.currentDampingFactor=e.data.dampingFactor,e.wasOutside=!1),!1===e.delayFinished)return}!1===e.data.enabledTranslation[0]&&(RK.x=RZ.x),!1===e.data.enabledTranslation[1]&&(RK.y=RZ.y),!1===e.data.enabledTranslation[2]&&(RK.z=RZ.z);
vendor: 6,637 bytes, line 8106
8106let a=R0(RZ,RK,e.wasOutside?0:e.data.maxDelta);if(e.currentDampingFactor>1){let i=RY.subVectors(a,RZ).divideScalar(e.currentDampingFactor);RZ.add(i),t&&R1(e.object,RZ),e.paused=.01>i.length()}else R1(e.object,a),e.paused=!0;e.object?.dispatchEvent({type:"beginEvent",eventName:"Follow"}),e.object.dispatchEvent(R$)}},R4=new iy,R5=new iy,R6=new iY,R8=new iv,R9=new iv,R7=new iy,ke=new iy,kt=new iy,ki=new iy,kr=new ss,ks={type:"requestRender"},ka={type:"changeRotation"},kn=(tl=new iY,function(e,t){null!==e.parent?tl.multiplyMatrices(e.parent.matrixWorld,e.hiddenMatrix):tl.copy(e.hiddenMatrix),t.premultiply(Rl(tl).invert()),e.rotation.setFromRotationMatrix(t),e.updateMatrix(),e instanceof Cf&&Td(e.parent)&&e.invalidateDownstreamBooleanData(!0)}),ko=class{constructor(e,t,i,r){this.id=t,this.object=i,this.paused=!1,this.currentDampingFactor=1,this.isReset=!1,this.worldQuaternion0=new iv,this.timeoutId=null,this.delayFinished=!0,this.wasOutside=!1,this.data={...m0.defaultData,...e,...void 0===e.resetOnPointerLeave&&{resetOnPointerLeave:!1}},void 0===e.target||"cursor"===e.target||(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}},kl=class extends Rv{constructor(){super(...arguments),this.events=[],this.pairOfEventListeners=[],this.pairOfUserEventListeners=[],this.onMouseMove=e=>{if(!(pt.length>1))for(let t of(this._lastMouseEvent=e,this.eventContext.updateRaycaster(e),this.events))void 0===t.target&&this.updateSingleEvent(t)},this.onMouseEnter=e=>{for(let e of this.events)void 0===e.target&&(e.isReset=!1,e.currentDampingFactor=e.data.dampingFactor)},this.onMouseLeave=e=>{for(let e of this.events)void 0===e.target&&(e.data.resetOnPointerLeave&&(e.isReset=!0,e.currentDampingFactor=e.resetDampingFactor),this.updateSingleEvent(e))},this.onScroll=e=>{if(this._lastMouseEvent){let e=new PointerEvent("pointermove",{clientX:this._lastMouseEvent.clientX,clientY:this._lastMouseEvent.clientY,bubbles:!0,cancelable:!0,view:window});this.eventContext.eventElement.dispatchEvent(e)}},this.onTargetChange=e=>()=>{this.updateSingleEvent(e)},this.createUserEventListener=e=>({eventName:t,target:i})=>{if(!t||!i)return;let r=Rb(t);r&&"LookAt"===r&&this.updateSingleEvent(e)}}connect(){let{page:e}=this.eventContext;if(e.traverseEntity(t=>{let i=t.data?.events.find(e=>"LookAt"===e.data.type&&!e.data.disabled);i&&(!e.data.globalPhysics.usePhysics||t.dataPatched.physics?.rigidBody!=="dynamic")&&this.events.push(new ko(i.data,i.id,t,e))}),!this.events.length)return;let{domElement:t,eventElement:i}=this.eventContext;for(let e of(this.domEventsNeeded.clear(),u5&&(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)),this.events)){if(void 0!==e.target){let t=this.onTargetChange(e),i=e.target;this.pairOfEventListeners.push([i,t]),i.addEventListener("requestRender",t)}let t=this.createUserEventListener(e),i=e.object;this.pairOfUserEventListeners.push([i,t]),i.addEventListener("userEvent",t)}}disconnect(){if(!this.events.length)return;let{domElement:e,eventElement:t}=this.eventContext;for(let[i,r]of(this.domEventsNeeded.clear(),u5&&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),this.pairOfEventListeners))i.removeEventListener("requestRender",r);for(let[e,t]of this.pairOfUserEventListeners)e.removeEventListener("userEvent",t);for(let e of this.events)e.paused=!0,e.isReset=!1}onAnimationFrameDamping(){for(let e of this.events)e.paused||this.updateSingleEvent(e)}updateSingleEvent(e){let{tilt:t,axis:i,distance:r,plane:s,limitDistance:a,enabledRotation:o,limitDistanceEnabled:h}=e.data,{getCamera:c,raycaster:d}=this.eventContext,{object:u,target:p}=e;if(u.getWorldPosition(R7),!e.isReset)if(e.target)e.target.getWorldPosition(ke);else{if("custom"===s?(c().getWorldDirection(R5),R5.negate(),kr.setFromNormalAndCoplanarPoint(R5,R7)):("xy"===s?R4.set(0,0,1):"xz"===s?R4.set(0,1,0):"yz"===s&&R4.set(1,0,0),kr.setFromNormalAndCoplanarPoint(R4,R7)),!d.ray.intersectPlane(kr,ke))return;r>0&&("custom"===s||void 0===s)&&ke.addScaledVector(R5,r)}if(e.isReset||(p?"target"===t?kt.copy(p.up).applyMatrix4(R6.extractRotation(p.matrixWorld)).normalize():o.some(e=>!1===e)?("x"===i?(ki.set(0,0,1),!1===o[2]&&ki.set(0,1,0)):"y"===i?(ki.set(1,0,0),!1===o[0]&&ki.set(0,0,1)):(ki.set(0,1,0),!1===o[1]&&ki.set(1,0,0)),kt.copy(ki).applyQuaternion(e.worldQuaternion0).normalize()):kt.set(0,1,0):"custom"===s?kt.set(0,1,0):kt.copy(R4)),e.isReset)R9.copy(e.worldQuaternion0);else if(R7.distanceTo(ke)>a&&h&&p)if(e.data.snapDelay&&(e.delayFinished=!1,"u">typeof window&&null!==e.timeoutId&&(window.clearTimeout(e.timeoutId),e.timeoutId=null)),e.wasOutside=!0,!e.data.resetAfterDistanceLimit)return;else R9.copy(e.worldQuaternion0),e.currentDampingFactor=e.resetDampingFactor;else{var f,m,g,v,y,x;let r;if(e.wasOutside&&(e.data.snapDelay&&"u">typeof window&&(e.timeoutId=window.setTimeout(()=>{e.delayFinished=!0,e.paused=!1,this.updateSingleEvent(e)},1e3*e.data.snapDelay)),e.currentDampingFactor=e.data.dampingFactor,e.wasOutside=!1),!1===e.delayFinished)return;f=R6,m=ke,g=R7,v=kt,y=i,x=ki,r=f.elements,kd.subVectors(m,g),0===kd.lengthSq()&&(kd.z=1),kd.normalize(),kc.crossVectors(v,kd),0===kc.lengthSq()&&(1===Math.abs(v.z)?kd.x+=1e-4:kd.z+=1e-4,kd.normalize(),kc.crossVectors(v,kd)),kc.normalize(),kh.crossVectors(kd,kc),"x"===y?1===x.z?[kc,kh,kd]=[kd,kc,kh]:(kc.negate(),[kc,kd]=[kd,kc]):"y"===y?1===x.x?[kc,kh,kd]=[kh,kd,kc]:(kc.negate(),[kh,kd]=[kd,kh]):1===x.x&&(kc.negate(),[kc,kh]=[kh,kc]),r[0]=kc.x,r[4]=kh.x,r[8]=kd.x,r[1]=kc.y,r[5]=kh.y,r[9]=kd.y,r[2]=kc.z,r[6]=kh.z,r[10]=kd.z,R9.setFromRotationMatrix(R6),R8.setFromUnitVectors(ki.applyQuaternion(R9),kt),o.some(e=>!1===e)&&"target"!==t&&R9.premultiply(R8).normalize()}e.currentDampingFactor>1?(u.updateWorldMatrix(!0,!1),R8.setFromRotationMatrix(Rl(u.matrixWorld)),R8.slerp(R9,1/e.currentDampingFactor),kn(u,R6.makeRotationFromQuaternion(R8)),e.paused=8*(1-R8.dot(R9))<1e-6):(kn(u,R6.makeRotationFromQuaternion(R9)),e.paused=!0),e.object?.dispatchEvent({type:"beginEvent",eventName:"Lo
8106okAt"}),u.dispatchEvent(ks),u.dispatchEvent(ka)}},kh=new iy,kc=new iy,kd=new iy,ku=class{constructor(e,t,i,r,s,a){this.id=e,this.data=t,this.object=i,this.entered=!1,this.actions=IO(t,t.actions,r,s,a,i)}disconnect(){IL(this.actions)}dispatchEnter(){this.actions.Transition.forEach(e=>{e.object.currentTransitionEvent!==this&&(e.object.currentTransitionEvent=this,e.init())}),this.entered||(this.entered=!0,this.actions.TimelineAnimation.forEach(e=>e.toggle(!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.TimelineAnimation.forEach(e=>e.toggle(!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(e=>{e.object.currentTransitionEvent!==this&&(e.object.currentTransitionEvent=this,e.init())}),e?(this.actions.Transition.forEach(e=>e.reverseFromCurrent()),this.actions.Particles.forEach(e=>e.reverseFromCurrent()),this.actions.Animation.forEach(e=>e.reverseFromCurrent()),this.actions.TimelineAnimation.forEach(e=>e.reverseFromCurrent()),this.actions.SwitchCamera.forEach(e=>e.reverseFromCurrent())):(this.actions.Transition.forEach(e=>e.playFromCurrent()),this.actions.Animation.forEach(e=>e.playFromCurrent()),this.actions.TimelineAnimation.forEach(e=>e.playFromCurrent()),this.actions.Create.forEach(e=>e.dispatch()),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())}},kp=class extends Rv{constructor(e,t){super(e),this.eventManager=t,this.eventsPerObjects={},this.objects=[],this.objects2D=[],this._prevObjects=[],this.onMouseDown=e=>{pt.length>1||(this.eventContext.updateRaycaster(e),this.handleMouseHoverEvent())},this.onMouseUp=e=>{pt.length>1||this.handleMouseHoverEvent(!0)},this.onMouseMove=e=>{pt.length>1||(this.eventContext.updateRaycaster(e),this.handleMouseHoverEvent())},this.onUserEvent=({eventName:e,target:t,reverse:i})=>{if(!e||!t)return;let r=Rb(e);r&&"MouseHover"===r&&(t.dispatchEvent({type:"beginEvent",eventName:"MouseHover"}),this.eventsPerObjects[t.uuid]?.forEach(e=>e.dispatchUserEvent(i)))}}connect(){let{page:e,sharedAssets:t}=this.eventContext,i=(i,r)=>{if(!(!i.visible||!i.data?.events.length)){for(let{id:r,data:s}of i.data.events)if(!s.disabled&&"MouseHover"===s.type)try{let a=new ku(r,s,i,e,t,this.eventManager);this.eventsPerObjects[i.uuid]?this.eventsPerObjects[i.uuid].push(a):this.eventsPerObjects[i.uuid]=[a]}catch(e){}this.eventsPerObjects[i.uuid]?.length&&this.objects.push(i instanceof DD?r:i)}};if(e.traverseEntity(e=>{(e instanceof O_||e instanceof Op)&&e.frame?.traverse(t=>{i(t,e)}),i(e)}),!this.objects.length)return;let{domElement:r}=this.eventContext;this.domEventsNeeded.clear(),u5&&(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: 8,236 bytes, line 8106
8106h(e=>{e.addEventListener("userEvent",this.onUserEvent)})}disconnect(){if(!this.objects.length)return;let{domElement:e}=this.eventContext;this.domEventsNeeded.clear(),u5&&(e.removeEventListener("pointerdown",this.onMouseDown),e.removeEventListener("pointerup",this.onMouseUp)),e.removeEventListener("pointermove",this.onMouseMove),Object.values(this.eventsPerObjects).forEach(e=>{e.forEach(e=>{e.disconnect()})}),this.objects.forEach(e=>{e.removeEventListener("userEvent",this.onUserEvent)})}handleMouseHoverEvent(e=!1){let t=[];if(!e){let{stopRaycast:e,raycaster:i,page:r,pointerScreen:s}=this.eventContext,a=!1;if(r.uiCanvas&&(a=Rf(r,[s.x,s.y],Object.keys(this.eventsPerObjects),e=>{t.push(e)})),e&&!a){let e=Ru(i,r,this.objects);t=Rp(e),e.forEach(e=>{e.object instanceof O_&&Rf(e.object,[e?.uv?.x??0,e?.uv?.y??0],Object.keys(this.eventsPerObjects),e=>{t.push(e)})})}else this.objects.forEach(e=>{let r=Rm(i,e);r&&(t.push(e),e instanceof O_&&Rf(e,[r?.uv?.x??0,r?.uv?.y??0],Object.keys(this.eventsPerObjects),e=>{t.push(e)}))})}this._prevObjects.length&&this._prevObjects.forEach(e=>{t.includes(e)||(e.dispatchEvent({type:"beginEvent",eventName:"MouseHover"}),this.eventsPerObjects[e.uuid]?.forEach(e=>e.dispatchLeave()))}),t.length&&t.forEach(e=>{e.dispatchEvent({type:"beginEvent",eventName:"MouseHover"}),this.eventsPerObjects[e.uuid]?.forEach(e=>e.dispatchEnter())}),this._prevObjects=t}},kf=class{constructor(e,t,i,r,s,a){this.id=e,this.data=t,this.object=i,this.scrollCounter=0,this.actions=IO(t,t.actions,r,s,a,i)}connect(){this.scrollCounter=0}disconnect(){IL(this.actions)}dispatch(e){this.actions.Transition.forEach(e=>{e.object.currentTransitionEvent!==this&&(e.object.currentTransitionEvent=this,e.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(e=>e.seek(i)),this.actions.Animation.forEach(e=>e.seek(t)),this.actions.TimelineAnimation.forEach(e=>e.seek(i)),this.actions.Create.forEach(e=>e.dispatchThrottled()),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())}dispatchUserEvent(e){this.actions.Transition.forEach(e=>{e.object.currentTransitionEvent!==this&&(e.object.currentTransitionEvent=this,e.init())}),e?(this.actions.Transition.forEach(e=>e.reverseFromCurrent()),this.actions.Animation.forEach(e=>e.reverseFromCurrent()),this.actions.TimelineAnimation.forEach(e=>e.reverseFromCurrent())):(this.actions.Transition.forEach(e=>{e.playFromCurrent()}),this.actions.Animation.forEach(e=>{e.playFromCurrent()}),this.actions.TimelineAnimation.forEach(e=>{e.playFromCurrent()})),this.actions.Create.forEach(e=>e.dispatchThrottled()),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())}},km=class{constructor(e,t,i,r,s,a,o){this.id=e,this.data=t,this.object=i,this.domElement=a,this.eventManager=o,this.scrollStart=0,this.scrollEnd=0,this.actions=IO(t,t.actions,r,s,o,i)}getStickyParentElement(){let e=this.domElement;for(;e;){if("sticky"===window.getComputedStyle(e).position)return e;e=e.parentElement}return null}computeScrollBounds(){let e=this.getStickyParentElement(),t=e?.parentElement,i=this.domElement.getBoundingClientRect(),r={top:i.top,bottom:i.bottom,left:i.left,right:i.right,width:i.width,height:i.height};if(t){let s=t.getBoundingClientRect(),a=window.getComputedStyle(e),o=parseFloat(a.marginTop)+parseFloat(a.marginBottom),h=parseFloat(a.top),c=parseFloat(a.bottom),d=s.height-o;if(isNaN(h)){if(!isNaN(c)){let e=document.body.clientHeight??window.innerHeight,t=window.innerWidth-(document.documentElement.clientWidth??window.innerWidth);i.bottom===e-c?(r.top+=s.top-i.height+c+t,r.bottom+=s.top-i.height+c+t):i.bottom<e-c&&(r.top-=d-i.height,r.bottom-=d-i.height)}}else i.top===h?(r.top+=s.top-h,r.bottom+=s.top-h):i.top<0&&(r.top-=d-i.height,r.bottom-=d-i.height)}let s=document.body,a=document.documentElement,o=window.pageYOffset||a.scrollTop||s.scrollTop,h=a.clientTop||s.clientTop||0,c=Math.round(r.top+o-h);if("enter"===this.data.startFrom){let e=window.innerHeight,t=r.height,i=this.data.enterAnchor;this.scrollStart=c-("top"===i?e:"bottom"===i?e-t:e-.5*t)}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(){IL(this.actions)}handleResize(){this.computeScrollBounds()}get isInvalidBox(){return void 0===this.box||0===this.box.width&&0===this.box.height&&0===this.box.top&&0===this.box.bottom}computeScroll({x:e,y:t}){this.actions.Transition.forEach(e=>{e.object.currentTransitionEvent!==this&&(e.object.currentTransitionEvent=this,e.init())});let i=this.scrollEnd-this.scrollStart,r=Math.min(1,Math.max(0,(t-this.scrollStart)/i));this.actions.Transition.forEach(e=>e.seek(r)),this.actions.Animation.forEach(e=>e.seek(r)),this.actions.Create.forEach(e=>e.dispatchThrottled()),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())}dispatch(e){this.isInvalidBox&&this.computeScrollBounds(),this.computeScroll(e)}dispatchUserEvent(e){this.actions.Transition.forEach(e=>{e.object.currentTransitionEvent!==this&&(e.object.currentTransitionEvent=this,e.init())}),e?(this.actions.Transition.forEach(e=>e.reverseFromCurrent()),this.actions.Animation.forEach(e=>e.reverseFromCurrent())):(this.actions.Transition.forEach(e=>{e.playFromCurrent()}),this.actions.Animation.forEach(e=>{e.playFromCurrent()})),this.actions.Create.forEach(e=>e.dispatchThrottled()),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())}},kg=class extends Rv{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(([e,t])=>{t.forEach(e=>e.handleResize())})},this.onScroll=e=>{if(!this.isInview)return;let t={y:window.scrollY,x:window.scrollX};[...this.scrollEventsPerObject.entries()].forEach(([e,i])=>{e.dispatchEvent({type:"beginEvent",eventName:"Scroll",scroll:t}),i.forEach(e=>e.dispatch(t))})},this.onWheel=e=>{!this.isInview||e.ctrlKey||[...this.wheelEventsPerObject.entries()].forEach(([t,i])=>{t.dispatchEvent({type:"beginEvent",eventName:"Scroll",deltaY:e.deltaY}),i.forEach(t=>t.dispatch(e.deltaY))})},this.onUserEvent=({eventName:e,target:t,reverse:i})=>{if(!e||!t)return;let r=Rb(e);r&&"Scroll"===r&&(t.dispatchEvent({type:"beginEvent",eventName:"Scroll"}),this.wheelEventsPerObject.get(t)?.forEach(e=>{e.dispatchUserEvent(i)}))}}connect(){let{page:e,sharedAssets:t,domElement:i,isExport:r}=this.eventContext,s=s=>{if(s.data?.events.length){for(let{id:a,data:o}of s.data.events)if(!o.disabled&&"Scroll"===o.type)if("load"!==o.trigger&&r){let r=new km(a,o,s,e,t,i,this.managers);this.scrollEventsPerObject.has(s)?this.scrollEventsPerObject.get(s)?.push(r):this.scrollEventsPerObject.set(s,[r])}else{let i=new kf(a,o,s,e,t,this.managers);this.wheelEventsPerObject.has(s)?this.wheelEventsPerObject.get(s)?.push(i):this.wheelEventsPerObject.set(s,[i])}}};e.traverseEntity(e=>{(e instanceof O_||e instanceof Op)&&e.frame?.traverse(e=>{s(e)}),s(e)}),this.intersectionObserver=new IntersectionObserver(e=>{let t=e[0];t&&(this.isInview=t.isIntersecting)},{root:null}),this.intersectionObserver.observe(this.eventContext.domElement),[...this.wheelEventsPerObject.entries()].forEach(([e,t])=>
vendor: 1,927 bytes, line 8106
8106{t.forEach(e=>e.connect()),e.addEventListener("userEvent",this.onUserEvent)}),[...this.scrollEventsPerObject.entries()].forEach(([e,t])=>{t.forEach(e=>e.connect()),e.addEventListener("userEvent",this.onUserEvent)}),[...this.wheelEventsPerObject.values()].some(e=>e.length)&&(this.domEventsNeeded.add("wheel"),window.addEventListener("wheel",this.onWheel)),[...this.scrollEventsPerObject.values()].some(e=>e.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(e=>e.disconnect()),e.removeEventListener("userEvent",this.onUserEvent)}),[...this.scrollEventsPerObject.entries()].forEach(([e,t])=>{t.forEach(e=>e.disconnect()),e.removeEventListener("userEvent",this.onUserEvent)})}},kv=class{constructor(e,t,i,r,s,a){this.id=e,this.data=t,this.object=i,this.actions=IO(t,t.actions,r,s,a,i)}disconnect(){IL(this.actions)}dispatch(){this.actions.Transition.forEach(e=>{e.play()}),this.actions.Animation.forEach(e=>{e.play()}),this.actions.TimelineAnimation.forEach(e=>{e.play()}),this.actions.SwitchCamera.forEach(e=>{e.play()}),this.actions.SceneTransition.forEach(e=>{e.dispatch()}),this.actions.Reset.forEach(e=>e.dispatch()),this.actions.SetVariable.forEach(e=>e.checkConditions()),this.actions.SetVariable.forEach(e=>e.dispatch()),this.actions.DynamicVariablePlay.forEach(e=>e.dispatch()),this.actions.ClearLocalStorage.forEach(e=>e.dispatch()),this.actions.UserAPI.forEach(e=>e.dispatch()),this.actions.Create.forEach(e=>{e.dispatchFromStart()}),this.actions.Destroy.forEach(e=>{e.dispatchFromStart()})}
8106dispatchAfter(e){this.actions.Audio.forEach(t=>{(t.interaction.data.triggerAfter??"any")===e&&(t.interaction instanceof LZ?t.interaction.audioPlayer.play():t.interaction instanceof LK&&t.interaction.dispatch())}),this.actions.Video.forEach(t=>{let i=t.interaction.data.triggerAfter??"autoplay";i===e&&(t.interaction instanceof Ik?t.interaction.play("autoplay"===i):t.interaction instanceof IB&&t.interaction.dispatch())}),this.actions.Particles.forEach(t=>{(t.data.triggerAfter??"any")===e&&t.dispatchBasic()})}async seekVideos(e){let t=[];this.actions.Video.forEach(i=>{(i.interaction.data.triggerAfter??"autoplay")==="autoplay"&&i.interaction instanceof Ik&&t.push(i.interaction.seek(e))}),await Promise.all(t)}pauseVideos(){this.actions.Video.forEach(e=>{e.interaction instanceof Ik&&e.interaction.pause()})}dispatchUserEvent(e){this.actions.Transition.forEach(e=>{e.object.currentTransitionEvent!==this&&(e.object.currentTransitionEvent=this,e.init())}),e?(this.actions.Transition.forEach(e=>e.reverseFromCurrent()),this.actions.Animation.forEach(e=>e.reverseFromCurrent()),this.actions.TimelineAnimation.forEach(e=>e.reverseFromCurrent()),this.actions.SwitchCamera.forEach(e=>e.reverseFromCurrent())):(this.actions.Transition.forEach(e=>e.playFromCurrent()),this.actions.Animation.forEach(e=>e.playFromCurrent()),this.actions.TimelineAnimation.forEach(e=>e.playFromCurrent()),this.actions.SwitchCamera.forEach(e=>e.playFromCurrent())),this.actions.SceneTransition.forEach(e=>e.dispatch()),this.actions.Reset.forEach(e=>e.dispatch()),this.actions.SetVariable.forEach(e=>e.checkConditions()),this.actions.SetVariable.forEach(e=>e.dispatch()),this.actions.DynamicVariablePlay.forEach(e=>e.dispatch()),this.actions.ClearLocalStorage.forEach(e=>e.dispatch()),this.actions.UserAPI.forEach(e=>e.dispatch()),this.actions.Create.forEach(e=>{e.dispatch()}),this.actions.Destroy.forEach(e=>{e.dispatch()}
8106),this.actions.Audio.forEach(e=>{e.interaction instanceof LZ?e.interaction.audioPlayer.play():e.interaction instanceof LK&&e.interaction.dispatch()}),this.actions.Video.forEach(e=>{e.interaction instanceof Ik?e.interaction.play():e.interaction instanceof IB&&e.interaction.dispatch()}),this.actions.Particles.forEach(e=>{e.dispatchBasic()})}},ky=class extends Rv{constructor(e,t){super(e),this.eventManager=t,this.eventsPerObject=new Map,this.eventsAfterPerObject=new Map,this.onMouseDown=()=>{[...this.eventsAfterPerObject.entries()].forEach(([e,t])=>{e.dispatchEvent({type:"beginEvent",eventName:"Start"}),t.forEach(e=>{e.dispatchAfter("mouseDown")})})},this.onKeyDown=()=>{[...this.eventsAfterPerObject.entries()].forEach(([e,t])=>{e.dispatchEvent({type:"beginEvent",eventName:"Start"}),t.forEach(e=>{e.dispatchAfter("keyDown")})})},this.onAny=()=>{let{domElement:e,isExport:t}=this.eventContext,i=t?document:e;i.removeEventListener("pointerdown",this.onAny),i.removeEventListener("mousedown",this.onAny),document.removeEventListener("keydown",this.onAny),[...this.eventsAfterPerObject.entries()].forEach(([e,t])=>{e.dispatchEvent({type:"beginEvent",eventName:"Start"}),t.forEach(e=>{e.dispatchAfter("any")})})},this.onSceneTransitionAudioVideoPlay=()=>{[...this.eventsAfterPerObject.entries()].forEach(([e,t])=>{e.dispatchEvent({type:"beginEvent",eventName:"Start"}),t.forEach(e=>
vendor: 9,906 bytes, line 8106
8106{e.actions.Audio.forEach(e=>{e.interaction instanceof LZ&&e.interaction.audioPlayer.play()}),e.actions.Video.forEach(e=>{let t=e.interaction.data.triggerAfter??"autoplay";e.interaction instanceof Ik&&e.interaction.play("autoplay"===t)}),e.actions.Particles.forEach(e=>{e.dispatchBasic()})})})},this.onPlay=()=>{[...this.eventsAfterPerObject.entries()].forEach(([e,t])=>{e.dispatchEvent({type:"beginEvent",eventName:"Start"}),t.forEach(e=>{e.dispatchAfter("autoplay")})})},this.seekVideos=async e=>{let t=[];[...this.eventsAfterPerObject.entries()].forEach(([i,r])=>{r.forEach(i=>{t.push(i.seekVideos(e))})}),await Promise.all(t)},this.pauseVideos=()=>{[...this.eventsAfterPerObject.entries()].forEach(([e,t])=>{t.forEach(e=>{e.pauseVideos()})})},this.onUserEvent=({eventName:e,target:t,reverse:i})=>{if(!e||!t)return;let r=Rb(e);r&&"Start"===r&&(t instanceof DD||t.dispatchEvent({type:"beginEvent",eventName:"Start"}),this.eventsPerObject.get(t)?.forEach(e=>{e.dispatchUserEvent(i)}),this.eventsAfterPerObject.get(t)?.forEach(e=>{e.dispatchUserEvent(i)}))}}connect(){let{sharedAssets:e,page:t}=this.eventContext,i=i=>{if(i.data?.events.length)for(let{id:r,data:s}of i.data.events){if(s.disabled||"Start"!==s.type)continue;let a=new kv(r,s,i,t,e,this.eventManager);(a.actions.Transition.length||a.actions.TimelineAnimation.length||a.actions.Animation.length||a.actions.SwitchCamera.length||a.actions.Create.length||a.actions.Destroy.length||a.actions.SceneTransition.length||a.actions.Reset.length||a.actions.SetVariable.length||a.actions.DynamicVariablePlay.length||a.actions.ClearLocalStorage.length||a.actions.UserAPI.length)&&(this.eventsPerObject.has(i)?this.eventsPerObject.get(i)?.push(a):this.eventsPerObject.set(i,[a])),a.actions.Audio.length&&(this.eventsAfterPerObject.has(i)?this.eventsAfterPerObject.get(i)?.push(a):this.eventsAfterPerObject.set(i,[a])),a.actions.Video.length&&(this.hasVideoAction=!0,this.eventsAfterPerObject.has(i)?this.eventsAfterPerObject.get(i)?.push(a):this.eventsAfterPerObject.set(i,[a])),a.actions.Particles.length&&(this.eventsAfterPerObject.has(i)?this.eventsAfterPerObject.get(i)?.push(a):this.eventsAfterPerObject.set(i,[a]))}};if(t.traverseEntity(e=>{(e instanceof O_||e instanceof Op)&&e.frame?.traverse(e=>{i(e)}),i(e)}),[...this.eventsAfterPerObject.values()].some(e=>e.length)){if(0===this.eventManager.activateCount){let{domElement:e,isExport:t}=this.eventContext,i=t?document:e;i.addEventListener("pointerdown",this.onMouseDown,{once:!0}),i.addEventListener("mousedown",this.onMouseDown,{once:!0}),document.addEventListener("keydown",this.onKeyDown,{once:!0}),i.addEventListener("pointerdown",this.onAny),i.addEventListener("mousedown",this.onAny),document.addEventListener("keydown",this.onAny),[...this.eventsAfterPerObject.entries()].forEach(([e,t])=>{e.addEventListener("userEvent",this.onUserEvent)})}else this.onSceneTransitionAudioVideoPlay();this.onPlay()}[...this.eventsPerObject.entries()].forEach(([e,t])=>{e.dispatchEvent({type:"beginEvent",eventName:"Start"}),t.forEach(e=>e.dispatch()),e.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(([e,t])=>{e.removeEventListener("userEvent",this.onUserEvent),t.forEach(e=>e.disconnect())})}[...this.eventsPerObject.entries()].forEach(([e,t])=>{e.removeEventListener("userEvent",this.onUserEvent),t.forEach(e=>e.disconnect())}),this.eventsPerObject.clear(),this.eventsAfterPerObject.clear()}},kx=class{constructor(e,t,i,r,s,a){this.id=e,this.data=t,this.object=i,this.initialDisabled=!1,this.actions=IO(t,t.actions,r,s,a,i),this.target=t.target}disconnect(){IL(this.actions)}dispatch(e){this.initialDisabled||(this.actions.Transition.forEach(e=>{e.object.currentTransitionEvent!==this&&(e.object.currentTransitionEvent=this,e.init())}),this.object.dispatchEvent({type:"beginEvent",eventName:"Collision"}),this.actions.Transition.forEach(e=>{"Toggle"===e.data.runMode?e.toggle():e.play()}),this.actions.Animation.forEach(e=>{"Toggle"===e.data.runMode?e.toggle():e.play()}),this.actions.TimelineAnimation.forEach(e=>{"Toggle"===e.data.runMode?e.toggle():e.play()}),this.actions.Reset.forEach(e=>{e.dispatch()}),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(t=>{t.dispatch(e??!1)}),this.actions.SetVariable.forEach(e=>e.checkConditions()),this.actions.SetVariable.forEach(e=>e.dispatch()),this.actions.DynamicVariablePlay.forEach(e=>e.dispatch()),this.actions.Audio.forEach(e=>{e.dispatchBasic()}),this.actions.Particles.forEach(e=>{e.dispatchBasic()}),this.actions.Video.forEach(e=>{e.dispatchBasic()}),this.actions.ClearLocalStorage.forEach(e=>e.dispatch()),this.actions.UserAPI.forEach(e=>e.dispatch()))}},kb=class extends Rv{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=e=>{let t=this.eventContext.sharedAssets;if(this.rafId=window.requestAnimationFrame(this.onFrame),this.isOutOfFocus)return;let i=new Date,r=[],s=[];for(let e=0;e<this.propertiesToWatch.length;e++){let{objectId:t,property:i,prevValue:r}=this.propertiesToWatch[e],a=this.eventContext.scene.find(t),o=m8.propertyPaths[i];if("width"===o[0]||"height"===o[0]||"depth"===o[0])a=a.geometry.userData.parameters[o[0]];else for(let e=0;e<o.length;e++)a=a[o[e]];null===r?this.propertiesToWatch[e].prevValue=a instanceof iy?a.clone():a:(a instanceof iy?a.equals(r):r===a)||(s.push({objId:t,property:i}),a instanceof iy?this.propertiesToWatch[e].prevValue.copy(a):this.propertiesToWatch[e].prevValue=a)}for(let e=0;e<this.variablesToWatch.length;e++){let{id:i,prevValue:s}=this.variablesToWatch[e],a=t.getVariable(i);a!==s&&(r.push(i),this.variablesToWatch[e].prevValue=a)}for(let s=0;s<this.dynamicVars.length;s++){let{id:a,expectedTime:o,last:h,data:c,timerSeconds:d,startValue:u}=this.dynamicVars[s],p=1e3;if(("timer"===c.dynamicVariableType||"stopwatch"===c.dynamicVariableType)&&"number3decimal"===c.format?p=1:"counter"===c.dynamicVariableType?p=c.updateInterval:"random"===c.dynamicVariableType&&(p=c.isStatic?1/0:c.updateInterval),-1===o){this.dynamicVars[s].last=e,this.dynamicVars[s].expectedTime=e+p;continue}if(!(("Stopped"===t.getDynamicVariablePlayState(a)||"Restarted"===t.getDynamicVariablePlayState(a))&&(this.dynamicVars[s].last=e,this.dynamicVars[s].expectedTime=e+p,"counter"===c.dynamicVariableType&&t.getVariable(a)!==u&&(t.updateVariable(a,u),this.eventManager.requestRender()),("timer"===c.dynamicVariableType||"stopwatch"===c.dynamicVariableType)&&this.dynamicVars[s].timerSeconds!==u&&(this.dynamicVars[s].timerSeconds=u,t.updateVariable(a,y8.getFormattedTimerTime(u,c)),this.eventManager.requestRender()),"Restarted"===t.getDynamicVariablePlayState(a)&&t.setDynamicVariablePlayState(a,"Playing"),"Stopped"===t.getDynamicVariablePlayState(a)))){if("Paused"===t.getDynamicVariablePlayState(a)){void 0===this.dynamicVars[s].deltaToExpectedTime&&(this.dynamicVars[s].deltaToExpectedTime=Math.max(this.dynamicVars[s].expectedTime-e,0)),this.dynamicVars[s].last=e-(p-this.dynamicVars[s].deltaToExpectedTime),this.dynamicVars[s].expectedTime=e+this.dynamicVars[s].deltaToExpectedTime;continue}if(this.dynamicVars[s].deltaToExpectedTime=void 0,e>=o)if(this.dynamicVars[s].last=e,this.dynamicVars[s].expectedTime+=p,"random"===c.dynamicVariableType){let e=c.min+Math.random()*(c.max-c.min),i=c.decimals;e=Math.round(e*Math.pow(10,i))/Math.pow(10,i),t.updateVariable(a,e),r.push(a),this.eventManager.requestRender()}else if("counter"===c.dynamicVariableType){let e=t.getVariable(a),i=t.getDynamicVariableToggleIsForward(a)??!0,s=t.getVariable(a)+c.increment*(i?1:-1);c.hasEnd&&((s=c.increment>0?tQ.clamp(s,u,c.endValue):tQ.clamp(s,c.endValue,u))===u&&t.setDynamicVariableToggleIsForward(a,void 0),c.repeat?s===c.endValue&&(s=u):(s===u||s===c.endValue)&&t.setDynamicVariablePlayState(a,"Paused")),s!==e&&(r.push(a),t.updateVariable(a,s),this.eventManager.requestRender())}else if("time"===c.dynamicVariableType){let e=t.getVariable(a),s=Ep(i,c);if("object"==typeof e&&"textValue"in e&&"object"==typeof s&&"textValue"in s){if(Array.isArray(e.textValue)&&Array.isArray(s.textValue)){if(e.textValue.every((e,t)=>e===s.textValue[t]))continue}else if(e.textValue===s.textValue)continue}else if(e===s)continue;t.updateVariable(a,s),r.push(a),this.eventManager.requestRender()}else{let i=y2.isTextValue(c.endValue)?k_(c.endValue.textValue):c.endValue,o=t.getDynamicVariableToggleIsForward(a)??!0,p=d+(e-h)/1e3*("timer"===c.dynamicVariableType?-1:1)*(o?1:-1);p=Math.max(p,0),c.hasEnd&&((p="stopwatch"===c.dynamicVariableType?tQ.clamp(p,u,i):tQ.clamp(p,i,u))===u&&t.setDynamicVariableToggleIsForward(a,void 0),c.repeat?Math.abs(p-i)<("number3decimal"===c.format?1e-4:.1)&&(p=u):(Math.abs(p-u)<("number3decimal"===c.format?1e-4:.1)||Math.abs(p-i)<("number3decimal"===c.format?1e-4:.1))&&t.setDynamicVariablePlayState(a,"Paused")),p!==d&&(r.push(a),this.dynamicVars[s].timerSeconds=p,t.updateVariable(a,y8.getFormattedTimerTime(p,c)),this.eventManager.requestRender())}}}let a=!1;t.mouseProperty!==this.prevMouseProperty&&(this.prevMouseProperty=t.mouseProperty,a=!0);let o=!1;t.raycastProperty!==this.prevRaycastProperty&&(this.prevRaycastProperty=t.raycastProperty,o=!0),this.events.forEac
vendor: 1,054 bytes, line 8106
8106h(e=>{(r.includes(e.data.variableId)||s.find(t=>t.objId===e.data.objectId&&t.property===e.data.property)||"mouseProperty"===e.data.variableId&&a||"raycastProperty"===e.data.variableId&&o)&&(e.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(e=>{e.data?.events.filter(e=>"VariableChange"===e.data.type&&!e.data.disabled).forEach(t=>{this.events.push(new kw(t.id,t.data,e,this.eventContext.page,this.eventContext.sharedAssets,this.eventManager))})}),this.propertiesToWatch=this.events.filter(e=>"objectProperty"===e.data.variableId&&null!==e.data.objectId).map(e=>({objectId:e.data.objectId,property:e.data.property,prevValue:null}));let e=this.eventContext.sharedAssets;
vendor: 5,455 bytes, lines 8106-8167
8106this.sharedVariables.forEach(({id:t,data:i})=>{let r;if(!("dynamicVariableType"in i)){this.events.find(e=>e.data.variableId===t)&&this.variablesToWatch.push({id:t,prevValue:e.getVariable(t)});return}if("timer"===i.dynamicVariableType||"stopwatch"===i.dynamicVariableType){let e;if(y2.isTextValue(i.value)&&Array.isArray(i.value.textValue)){let t=i.value.textValue;e=3===t.length?t[2]+60*t[1]+3600*t[0]:t[1]+60*t[0]}else e=i.value;r=e,this.dynamicVars.push({id:t,last:-1,expectedTime:-1,data:i,timerSeconds:e,startValue:r})}else"time"===i.dynamicVariableType&&e.updateVariable(t,Ep(new Date,i)),"counter"===i.dynamicVariableType&&(r=y2.isTextValue(i.value)?k_(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())}},kw=class{constructor(e,t,i,r,s,a){this.id=e,this.data=t,this.object=i,this.actions=IO(t,t.actions,r,s,a,i)}dispatch(){let e=this.actions;e.Audio.forEach(e=>e.dispatchConditional()),e.Particles.forEach(e=>e.dispatchConditional()),e.Video.forEach(e=>e.dispatchConditional()),e.Create.forEach(e=>e.dispatch()),e.Destroy.forEach(e=>e.dispatch()),e.Reset.forEach(e=>e.dispatch()),e.Transition.forEach(e=>{e.object.currentTransitionEvent!==this&&(e.object.currentTransitionEvent=this),e.init()}),e.Transition.forEach(e=>e.play()),e.Animation.forEach(e=>e.play()),e.SwitchCamera.forEach(e=>e.play()),e.SceneTransition.forEach(e=>e.dispatch()),e.SetVariable.forEach(e=>e.checkConditions()),e.SetVariable.forEach(e=>e.dispatch()),e.DynamicVariablePlay.forEach(e=>e.dispatch()),e.ClearLocalStorage.forEach(e=>e.dispatch()),e.UserAPI.forEach(e=>e.dispatch())}dispose(){IL(this.actions)}};function k_(e){return 3===e.length?e[2]+60*e[1]+3600*e[0]:e[1]+60*e[0]}var kS,kC,kM,kE=`
8107(async function() {
8108	const [wasmImport, wasmBinary] = await Promise.all([
8109		import('https://unpkg.com/@splinetool/[email protected]/build/' + 'navmesh.js'),
8110		fetch('https://unpkg.com/@splinetool/[email protected]/build/' + 'navmesh.wasm').then((res) => res.arrayBuffer()),
8111	]);
8112	const wasmModule = wasmImport.default;
8113	self.module = await wasmModule({ wasmBinary });
8114	postMessage('ready');
8115})();
8116`,kA=`
8117(async function() {
8118	const [wasmImport, wasmBinary] = await Promise.all([
8119		import(self.location.origin + '/_libraries/navmesh.js'),
8120		fetch(self.location.origin + '/_libraries/navmesh.wasm').then((res) => res.arrayBuffer()),
8121	]);
8122	const wasmModule = wasmImport.default;
8123	self.module = await wasmModule({ wasmBinary });
8124	postMessage('ready');
8125})();
8126`,kT=`
8127
8128onmessage = function(messageEvent) {
8129	const meshData = messageEvent.data;
8130	const positions = meshData[0];
8131	const offset = meshData[1];
8132	const indices = meshData[2];
8133	const indicesLength = meshData[3];
8134	const parameters = meshData[4];
8135
8136	const module = self.module;
8137	const rc = new module.rcConfig();
8138	rc.cs = parameters.cs;
8139	rc.ch = parameters.ch;
8140	rc.borderSize = parameters.borderSize ? parameters.borderSize : 0;
8141	rc.tileSize = parameters.tileSize ? parameters.tileSize : 0;
8142	rc.walkableSlopeAngle = parameters.walkableSlopeAngle;
8143	rc.walkableHeight = parameters.walkableHeight;
8144	rc.walkableClimb = parameters.walkableClimb;
8145	rc.walkableRadius = parameters.walkableRadius;
8146	rc.maxEdgeLen = parameters.maxEdgeLen;
8147	rc.maxSimplificationError = parameters.maxSimplificationError;
8148	rc.minRegionArea = parameters.minRegionArea;
8149	rc.mergeRegionArea = parameters.mergeRegionArea;
8150	rc.maxVertsPerPoly = parameters.maxVertsPerPoly;
8151	rc.detailSampleDist = parameters.detailSampleDist;
8152	rc.detailSampleMaxError = parameters.detailSampleMaxError;
8153
8154	if (!self.navMesh) {
8155		self.navMesh = new module.NavMesh();
8156	}
8157	self.navMesh.build(positions, offset, indices, indicesLength, rc);
8158
8159	const navmeshData = navMesh.getNavmeshData();
8160	const arrView = new Uint8Array(module.HEAPU8.buffer, navmeshData.dataPointer, navmeshData.size);
8161	const ret = new Uint8Array(navmeshData.size);
8162	ret.set(arrView);
8163	navMesh.freeNavmeshData(navmeshData);
8164
8165	postMessage(ret);
8166}
8167`,kP={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};pb.then(e=>{kS=e,kC=new e.Vec3,kM=new e.Vec3});var kD=new iy,kO=class{constructor(e=!1,t=!1){this.usePhysics=e,this.isExport=t,this.onPointerDown=e=>{if(1!==pt.length)return;let{raycaster:t,page:i}=this.eventContext;this.eventContext.updateRaycaster(e);let r=i.raycastWithClones(t);if(0!==r.length){if(this.gameControl){let e=kD.copy(this.gameControl.colliderWorldPosition);e.y-=this.gameControl.colliderHeight/2,this.gameControl.path=this.computePath(e,r[0].point)}this.eventContext.requestRender()}},this.traverseWithPhysics=(e,t)=>i=>{let r;if(i instanceof AZ)if(!i.objectForSample)return!0===i.object.dataPatched.physics.fusedBody&&"dynamic"===i.object.dataPatched.physics.rigidBody||void 0;else{if(i.objectForSample.dataPatched.physics.fusedBody)return;r=i.object}else if(i instanceof wr)r=i.object;else if(r=i,r.dataPatched.cloner?.disabled===!1&&r.dataPatched.cloner?.hideBase&&r.dataPatched.physics?.fusedBody!==!0)return!0;
vendor: 5,151 bytes, line 8167
8167if(t&&!r.userData.navmesh)return;let s=r.dataPatched;if(!s.visible&&s.physics?.enabled!==!0)return!0;i.updateMatrixWorldSVD();let a=Ba(s),o=r.userData.hasDestroy,h=r.userData.hasDrag,c=!1,d=!1;for(let e of s.events)!0!==e.data.disabled&&("GameControl"===e.data.type?c=!0:"Follow"===e.data.type&&(d=!0));if(c||a||d||o||h)return!0;if(this.usePhysics&&s.physics?.rigidBody==="dynamic"){if(this.usePhysics&&s.physics?.fusedBody)return!0}else if("geometry"in i&&i.geometry&&e.push(Rs(i.geometry,i.matrixWorld)),this.usePhysics&&s.physics?.fusedBody)return i.traverseObject((t,i)=>{let r;if(0===i)return;if(t instanceof AZ)if(!t.objectForSample)return!0===t.object.dataPatched.physics.fusedBody&&"dynamic"===t.object.dataPatched.physics.rigidBody||void 0;else{if(t.objectForSample.dataPatched.physics.fusedBody)return;r=t.object}else if(t instanceof wr)r=t.object;else if(r=t,t.dataPatched.cloner?.hideBase)return!0;let s=r.dataPatched;if(!s.visible&&s.physics?.enabled!==!0)return!0;"geometry"in t&&t.geometry&&e.push(Rs(t.geometry,t.matrixWorld))}),!0},this.traverseNoPhysics=(e,t)=>i=>{let r;if(i instanceof AZ)return;let s=(r=i instanceof wr?i.object:i).dataPatched;if("visibility"===s.physics.enabled?!s.visible:!s.physics.enabled)return!0;if(t&&!r.userData.navmesh)return;let a=i.geometry,o=!0===r.userData.hasDestroy,h=!0===r.userData.hasDrag;if(Ba(s)||o||h||r.dataPatched.events.some(e=>!0!==e.data.disabled&&"GameControl"===e.data.type))return!0;a&&e.push(Rs(a,i.matrixWorld))},this.navmeshWasm=kS,this.navMesh=new this.navmeshWasm.NavMesh,this._workerURL=URL.createObjectURL(new Blob([(t?kE:kA)+kT])),this._worker=new Worker(this._workerURL)}init(e,t,i){this.gameControl=t,this.eventContext=i,this.setDefaultQueryExtent(new iy().setScalar(e.ch*e.walkableRadius*1.2)),this._worker.onmessage=()=>{this.createNavMesh(i.page,e,e=>{this.buildFromNavmeshData(e.data)})},this.eventContext.renderer.domElement.addEventListener("pointerdown",this.onPointerDown)}createNavMesh(e,t,i){t.objects.forEach(t=>{let i=e.scene.find(t);i.traverseEntity(e=>{e.userData.navmesh=!0}),i.cloner?.traverseObject(e=>{e.userData.navmesh=!0})});let r=[],s=(this.usePhysics?this.traverseWithPhysics:this.traverseNoPhysics)(r,"custom"===t.zones);if(e.traverseChildren(s),t.objects.forEach(t=>{let i=e.scene.find(t);i.traverseEntity(e=>{e.userData.navmesh=void 0}),i.cloner?.traverseObject(e=>{e.userData.navmesh=void 0})}),0===r.length)return!1;let a=vV(r),{positions:o,triIndices:h}=S$(a.getAttribute("position"),a.getIndex());return this._worker.postMessage([o,o.length/3,h,h.length,{...kP,...t}]),this._worker.onmessage=i,!0}createDebugNavGeometry(){let e,t,i=this.navMesh.getDebugNavMesh(),r=i.getTriangleCount(),s=new Uint32Array(3*r),a=new Float32Array(3*r*3);for(e=0;e<3*r;e++)s[e]=e;for(e=0;e<r;e++)for(t=0;t<3;t++){let r=i.getTriangle(e).getPoint(t);a[9*e+3*t+0]=r.x,a[9*e+3*t+1]=r.y,a[9*e+3*t+2]=r.z}let o=new rz;return o.setIndex(new rE(s,1)),o.setAttribute("position",new rE(a,3)),o}getClosestPoint(e){return kC.x=e.x,kC.y=e.y,kC.z=e.z,this.navMesh.getClosestPoint(kC)}getClosestPointToRef(e,t){kC.x=e.x,kC.y=e.y,kC.z=e.z;let i=this.navMesh.getClosestPoint(kC);t.set(i.x,i.y,i.z)}getRandomPointAround(e,t){return kC.x=e.x,kC.y=e.y,kC.z=e.z,this.navMesh.getRandomPointAround(kC,t)}getRandomPointAroundToRef(e,t,i){kC.x=e.x,kC.y=e.y,kC.z=e.z;let r=this.navMesh.getRandomPointAround(kC,t);i.set(r.x,r.y,r.z)}moveAlong(e,t){return kC.x=e.x,kC.y=e.y,kC.z=e.z,kM.x=t.x,kM.y=t.y,kM.z=t.z,this.navMesh.moveAlong(kC,kM)}moveAlongToRef(e,t,i){return kC.x=e.x,kC.y=e.y,kC.z=e.z,kM.x=t.x,kM.y=t.y,kM.z=t.z,this.navMesh.moveAlong(kC,kM)}computePath(e,t){let i=this.getClosestPoint(t);if(kM.x=i.x,kM.y=i.y,kM.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(kC,kM),s=r.getPointCount(),a=[];for(let e=0;e<s;e++){let t=r.getPoint(e);a.push(new iy(t.x,t.y,t.z))}return a}createCrowd(e,t){return new kL(this,e,t)}setDefaultQueryExtent(e){kC.x=e.x,kC.y=e.y,kC.z=e.z,this.navMesh.setDefaultQueryExtent(kC)}getDefaultQueryExtent(){return this.navMesh.getDefaultQueryExtent()}buildFromNavmeshData(e){let t=e.length*e.BYTES_PER_ELEMENT,i=this.navmeshWasm._malloc(t),r=new Uint8Array(this.navmeshWasm.HEAPU8.buffer,i,t);r.set(e);let s=new this.navmeshWasm.NavmeshData;s.dataPointer=r.byteOffset,s.size=e.length,this.navMesh.buildFromNavmeshData(s),this.navmeshWasm._free(r.byteOffset)}getNavmeshData(){let e=this.navMesh.getNavmeshData(),t=new Uint8Array(this.navmeshWasm.HEAPU8.buffer,e.dataPointer,e.size),i=new Uint8Array(e.size);return i.set(t),this.navMesh.freeNavmeshData(e),i}getDefaultQueryExtentToRef(e){let t=this.navMesh.getDefaultQueryExtent();e.set(t.x,t.y,t.z)}dispose(){this.navMesh.destroy(),this._worker.terminate(),URL.revokeObjectURL(this._workerURL),this.eventContext?.renderer.domElement.removeEventListener("pointerdown",this.onPointerDown)}addCylinderObstacle(e,t,i){return kC.x=e.x,kC.y=e.y,kC.z=e.z,this.navMesh.addCylinderObstacle(kC,t,i)}addBoxObstacle(e,t,i){return kC.x=e.x,kC.y=e.y,kC.z=e.z,kM.x=t.x,kM.y=t.y,kM.z=t.z,this.navMesh.addB
vendor: 4,739 bytes, line 8167
8167oxObstacle(kC,kM,i)}removeObstacle(e){this.navMesh.removeObstacle(e)}isSupported(){return void 0!==this.navmeshWasm}},kL=class{constructor(e,t,i){this.navmeshWasmWrapper=e,this.transforms=[],this.agents=[],this.reachRadii=[],this._agentDestinationArmed=[],this._agentDestination=[],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 iy(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);void 0!==t.radius&&(i.radius=t.radius),void 0!==t.height&&(i.height=t.height),void 0!==t.maxAcceleration&&(i.maxAcceleration=t.maxAcceleration),void 0!==t.maxSpeed&&(i.maxSpeed=t.maxSpeed),void 0!==t.collisionQueryRange&&(i.collisionQueryRange=t.collisionQueryRange),void 0!==t.pathOptimizationRange&&(i.pathOptimizationRange=t.pathOptimizationRange),void 0!==t.separationWeight&&(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<=.001)){if(1/60<=.001)this.crowd.update(e);else{let t=Math.floor(e/(1/60));t>10&&(t=10),t<1&&(t=1);let i=e/t;for(let e=0;e<t;e++)this.crowd.update(i)}for(let e=0;e<this.agents.length;e++){let t=this.agents[e],i=this.getAgentPosition(t);if(this.transforms[e].copy(i),this._agentDestinationArmed[e]){let r=i.x-this._agentDestination[e].x,s=i.z-this._agentDestination[e].z,a=this.reachRadii[e],o=this._agentDestination[e].y-this.reachRadii[e],h=this._agentDestination[e].y+this.reachRadii[e],c=r*r+s*s;i.y>o&&i.y<h&&c<a*a&&(this.onReachTarget(t,this._agentDestination[e]),this._agentDestinationArmed[e]=!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 e=i.getPoint(t);s.push(new iy(e.x,e.y,e.z))}return s}dispose(){this.crowd.destroy()}},kI={type:"change"},kR={type:"changeZoom"},kk={type:"changePan"},kB={type:"start"},kz={type:"end",changed:!0,nonOrbit:!0},kN={type:"end",changed:!0,nonOrbit:!1},kF={type:"end",changed:!1},kj=new iv,kU=new tZ,kV=2*Math.PI,kW=new iy,kH=new tZ,kG=new iy,kq=new iv,kX=new iY,kY={type:"requestRender"},kQ=class extends tk{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,3,1],this.offset=new iy,this.eye=new iy,this.lastPosition=new iy,this.lastQuaternion=new iv,this.current=ne
vendor: 4,357 bytes, line 8167
8167w tZ,this.overShoot=new tZ,this.overRatio=new tZ,this.spherical=new lR,this.sphericalDelta=new lR,this.panOffset=new iy,this.panLeftV=new iy,this.panUpV=new iy,this.panV=new iy,this.rotateStart=new tZ,this.rotateEnd=new tZ,this.rotateDelta=new tZ,this.panStart=new tZ,this.panEnd=new tZ,this.panDelta=new tZ,this.dollyStart=new tZ,this.dollyEnd=new tZ,this.dollyDelta=new tZ,this.rotationRangeFactor=new tZ,this.panRangeFactor=new tZ,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.isCurrentlyDamping=!1,this.thetaIsFree=!1,this.phiIsFree=!1,this.needsUpdate=!0,this.onCameraChange=e=>{this.object.removeEventListener("beginState",this.onBeginState),this.object.removeEventListener("completeState",this.onCompleteState),this.object.removeEventListener("cameraChange",this.onCameraChange),this.object=e.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(kG,kq,kW),this.offset.copy(kG).sub(this.target),this.spherical.setFromVector3(this.offset),this.object.isUpVectorFlipped&&(this.spherical.phi*=-1,this.spherical.theta-=Math.PI),this.autoRotate&&-1===this.state&&this.rotateLeft((!0===this.autoRotateClockwise?1:-1)*this.getAutoRotationAngle()),0!==this.rotationLimitsMode&&this.applyLimits(this.sphericalDelta,this.rotationLimitsMode,this.rotationSoftLimit,this.maxTheta,this.minTheta,this.maxPhi,this.minPhi,this.rotationRangeFactor),2!==this.rotationLimitsMode&&(this.spherical.phi+=this.sphericalDelta.phi),(1!==this.rotationLimitsMode||!0===this.autoRotate)&&(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))),0!==this.panLimitsMode&&(this.target.applyQuaternion(kj.copy(kq).invert()),this.panOffset.applyQuaternion(kj),this.applyLimits(this.panOffset,this.panLimitsMode,this.panSoftLimit,this.maxH,this.minH,this.maxV,this.minV,this.panRangeFactor),this.target.applyQuaternion(kq),this.panOffset.applyQuaternion(kq)),2===this.panLimitsMode&&(this.panOffset.y=0),1===this.panLimitsMode&&(this.panOffset.x=0),-1!==this.state||this.gesture?(this.target.add(this.panOffset),this.panOffset.set(0,0,0)):(this.panOffset.multiplyScalar(1-this.dampingFactor),this.target.add(this.panOffset)),this.offset.setFromSpherical(this.spherical),kG.copy(this.target).add(this.offset),this.object.position.copy(this.target).add(this.offset),this.object.parent&&(kX.copy(this.object.parent.matrixWorld).invert(),this.object.position.applyMatrix4(kX));let e=this.spherical.phi%kV;if(this.eye.copy(this.offset).normalize(),this.object.up.copy(rh.DEFAULT_UP).applyAxisAngle(this.eye,this.object.angleOffsetFromUp),e>0&&e>Math.PI||e<0&&e>-Math.PI?(this.object.up.negate(),this.object.lookAt(this.target),this.object.isUpVectorFlipped=!0):(this.object.lookAt(this.target),this.object.isUpVectorFlipped=!1),-1===this.state||!0===this.enableDamping){let e=1===this.hoverRotatePanMode?this.hoverRotateDamping:this.dampingFactor;this.sphericalDelta.theta*=1-e,this.sphericalDelta.phi*=1-e}else this.sphericalDelta.set(0,0,0);if(this.scale=1,this.zoomChanged||this.lastPosition.distanceToSquared(this.object.position)>.01||8*(1-this.lastQuaternion.dot(this.object.quaternion))>1e-8){this.dispatchEvent(kI),this.object.dispatchEvent(kY),this.lastPosition.copy(this.object.position),this.lastQuaternion.copy(this.object.quaternion),this.zoomChanged=!1,this.isCurrentlyDamping=!0;return}
vendor: 20,003 bytes, line 8167
8167this.isPanOverShoot=!1,this.isRotateOverShoot=!1,this.object.wasMovedBySwitchCameraAction=!1,this.sphericalDelta.set(0,0,0),this.panOffset.set(0,0,0),this.isCurrentlyDamping=!1},this.onPointerDown=e=>{!1!==this.enabled&&("touch"===e.pointerType||"pen"===e.pointerType&&u5?this.onPointerDownTouch(e):this.onPointerDownMouse(e),-1!==this.state&&(this.isPointerDown=!0,this.dispatchEvent(kB),this.domElement.addEventListener("pointermove",this.onPointerMove),this.domElement.addEventListener("pointerup",this.onPointerUp),e.stopPropagation(),"touch"===e.pointerType||"pen"===e.pointerType&&u5||this.domElement.setPointerCapture(e.pointerId)))},this.onPointerLeave=e=>{this.resetHoverEffectOnPointerLeave&&!this.useWindowEvents?(1===this.hoverRotatePanMode?(this.sphericalDelta.theta=-this.spherical.theta,this.sphericalDelta.phi=-this.spherical.phi,kW.subVectors(this.position0,this.target0),this.spherical.setFromVector3(kW),this.sphericalDelta.theta+=this.spherical.theta,this.sphericalDelta.phi+=this.spherical.phi,this.sphericalDelta.theta/=8,this.sphericalDelta.phi/=8):2===this.hoverRotatePanMode&&this.panOffset.subVectors(this.target0,this.target).divideScalar(8),this.update()):this.pointerLeaveEvent=e},this.onPointerEnter=e=>{this.resetHoverEffectOnPointerLeave||void 0===this.pointerLeaveEvent?kH.set(e.clientX-this.domElement.clientWidth/2,e.clientY-this.domElement.clientHeight/2):kH.set(e.clientX-this.pointerLeaveEvent.clientX,e.clientY-this.pointerLeaveEvent.clientY),1===this.hoverRotatePanMode?(this.rotateDelta.copy(kH).multiplyScalar(this.rotateSpeed*this.hoverRotatePanStrength).rotateAround(kU,-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(e.clientX,e.clientY)):2===this.hoverRotatePanMode&&(this.panDelta.copy(kH).multiplyScalar(this.panSpeed*this.hoverRotatePanStrength),this.pan(this.panDelta.x,this.panDelta.y),this.panStart.set(e.clientX,e.clientY)),this.update()},this.onPointerMove=e=>{!1!==this.enabled&&(this.checkRaycastLock()||("touch"===e.pointerType||"pen"===e.pointerType&&u5?this.onPointerMoveTouch(e):this.onPointerMoveMouse(e),e.stopPropagation()))},this.onPointerUp=e=>{this.isPointerDown=!1,0===pt.length&&(this.domElement.removeEventListener("pointermove",this.onPointerMove),this.domElement.removeEventListener("pointerup",this.onPointerUp)),pt.length>1&&e.preventDefault(),this.hasChange?this.dispatchEvent(0===this.state?kN:kz):this.dispatchEvent(kF),this.state=-1,e&&(e.stopPropagation(),"touch"===e.pointerType||"pen"===e.pointerType&&u5||this.domElement.releasePointerCapture(e.pointerId))},this.onPointerDownMouse=e=>{switch(this.useKeyEvents?this.mouseButtons[e.button]:this.mouseButtonsPlay[e.button]){case 0:if(!0!==e.altKey||e.shiftKey||pe(e)){if(" "===this.key){if(!1===this.enablePan)return;this.handleMouseDownPan(e),this.state=2}}else{if(!1===this.enableRotate)return;this.handleMouseDownRotate(e),this.state=0}break;case 4:if(!1===this.enablePan)return;this.handleMouseDownPan(e),this.state=2;break;case 3:if(pe(e)||e.shiftKey){if(!1===this.enablePan)return;this.handleMouseDownPan(e),this.state=2}else{if(!1===this.enableRotate)return;this.handleMouseDownRotate(e),this.state=0}break;case 5:if(pe(e)||e.shiftKey){if(!1===this.enableRotate)return;this.handleMouseDownRotate(e),this.state=0}else{if(!1===this.enablePan)return;this.handleMouseDownPan(e),this.state=2}break;default:this.state=-1}},this.onPointerMoveMouse=e=>{switch(this.state){case 0:if(!1===this.enableRotate)return;this.handleMouseMoveRotate(e);break;case 1:if(!1===this.enableZoom)return;this.handleMouseMoveDolly(e);break;case 2:if(!1===this.enablePan)return;this.handleMouseMovePan(e)}this.object.wasMovedByUser=!0},this.onPointerDownTouch=e=>{switch(pt.length>1&&e.preventDefault(),this.touches[pt.length-1]){case 0:if(!1===this.enableRotate){this.state=-1;return}this.handleTouchStartRotate(),this.state=3;break;case 1:if(!1===this.enablePan){this.state=-1;return}this.handleTouchStartPan(),this.state=4;break;case 2:if(!1===this.enableZoom&&!1===this.enablePan)return;this.handleTouchStartDollyPan(),this.state=5;break;case 3:if(!1===this.enableZoom&&!1===this.enableRotate)return;this.handleTouchStartDollyRotate(),this.state=6;break;default:this.state=-1}},this.onPointerMoveTouch=e=>{switch(pt.length>1&&e.preventDefault(),this.state){case 3:if(!1===this.enableRotate)return;this.handleTouchMoveRotate(e),this.update();break;case 4:if(!1===this.enablePan)return;this.handleTouchMovePan(e),this.update();break;case 5:if(!1===this.enableZoom&&!1===this.enablePan)return;this.handleTouchMoveDollyPan(e),this.update();break;case 6:if(!1===this.enableZoom&&!1===this.enableRotate)return;this.handleTouchMoveDollyRotate(e),this.update();break;default:this.state=-1}this.object.wasMovedByUser=!0},this.dispatchEndDebounced=uF(()=>this.dispatchEvent(kz),33),this.onMouseWheel=e=>{!1===this.enabled||!1===this.enableZoom&&!1===this.enablePan||this.checkRaycastLock()||(this.options.isExport||this.domElement.clientHeight!==document.body.clientHeight||this.domElement.clientWidth!==document.body.clientWidth||e.preventDefault(),this.dispatchEvent(kB),this.handleMouseWheel(e),this.dispatchEndDebounced(),this.object.wasMovedByUser=!0)},this.onGesture=e=>{if(e.preventDefault(),!1!==this.enabled&&!this.checkRaycastLock()&&!u3)if("gesturechange"===e.type){if(!1===this.enableZoom||!1===this.isTouchZoom)return;this.dispatchEvent(kB),e.scale>this.prevScale?this.dollyIn(this.getZoomScale()):e.scale<this.prevScale&&this.dollyOut(this.getZoomScale()),this.prevScale=e.scale,this.update(),this.object.wasMovedByUser=!0}else this.dispatchEvent({type:"end",nonOrbit:!0})},this.onContextMenu=e=>{e.preventDefault()},this.onTouchEnd=e=>{e.preventDefault()},this.onKeyDown=e=>{!1!==this.enabled&&(this.key=e.key," "===e.key&&this.dispatchEvent(kB))},this.onKeyUp=e=>{!1!==this.enabled&&(this.key=void 0,-1!==this.state&&"Alt"===e.key&&this.onPointerUp(pt[0])," "===e.key&&this.dispatchEvent({type:"end",nonOrbit:!0}))},this.onPointerHover=e=>{"mouse"!==e.pointerType||!1===this.enabled||-1!==this.state||2===this.hoverRotatePanMode&&this.isPanOverShoot||1===this.hoverRotatePanMode&&this.isRotateOverShoot||(this.isPointerDown=!0,2===this.hoverRotatePanMode?this.handleMouseMovePan(e,this.hoverRotatePanStrength):1===this.hoverRotatePanMode&&this.handleMouseMoveRotate(e,this.hoverRotatePanStrength))},this.onBeginState=()=>{this.enabled=!1,this.needsUpdate=!1},this.onCompleteState=e=>{e.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){"start"===e.type?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,0!==this.hoverRotatePanMode&&(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),0!==this.hoverRotatePanMode&&!this.useWindowEvents){let e=this.useWindowEvents?window:this.domElement;e.addEventListener("pointerleave",this.onPointerLeave),e.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="window"===t,0!==this.hoverRotatePanMode&&(this.useWindowEvents?window.addEventListener("pointermove",this.onPointerHover):this.domElement.addEventListener("pointermove",this.onPointerHover));let i=e.hoverRotatePanStrength/100;this.hoverRotatePanStrength=i**2,this.zoomLimitsEnabled=e.zoomLimitsEnabled,this.minZoom=e.zoomLimits.min,this.maxZoom=Math.max(e.zoomLimits.min,e.zoomLimits.max),this.minDistance=1e3/this.maxZoom,this.maxDistance=Math.max(this.minDistance,1e3/e.zoomLimits.min),this.autoRotate=e.autoRotate,this.autoRotateSpeed=e.autoRotateSpeed,this.autoRotateClockwise=e.autoRotateClockwise;let r=this.object.getTarget().applyQuaternion(kj.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=kZ(this.spherical.phi-e.rotationVerticalOffset.min),this.maxPhi=kZ(this.spherical.phi+e.rotationVerticalOffset.max),this.minTheta=kZ(kZ(this.spherical.theta)-e.rotationHorizontalOffset.min),this.maxTheta=kZ(kZ(this.spherical.theta)+e.rotationHorizontalOffset.max),this.isThetaFlipped=this.minTheta>this.maxTheta,1===e.orbitTouches&&(this.touches[0]=0),1===e.panTouches&&(this.touches[0]=1),2===e.orbitTouches&&(this.touches[1]=3),2===e.panTouches&&(this.touches[1]=2),3===e.orbitTouches&&(this.touches[2]=0),3===e.panTouches&&(this.touches[2]=1),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),0!==this.hoverRotatePanMode&&!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,o,h){let c,d,u;this.overShoot.set(0,0),e instanceof iy?(c=e.x,d=e.y,this.current.set(this.target.x,this.target.y),u=!0):(c=e.theta,d=e.phi,this.current.set(kZ(this.spherical.theta),kZ(this.spherical.phi)),u=!1),0===i&&(this.current.x+=c,this.current.y+=d),(3===t||2===t)&&(!u&&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)),(3===t||1===t)&&(this.current.y>a?this.overShoot.y=a-this.current.y:this.current.y<o&&(this.overShoot.y=o-this.current.y)),u||(this.overShoot.x=kZ(this.overShoot.x),this.overShoot.y=kZ(this.overShoot.y)),0!==i?(this.overRatio.copy(this.overShoot).divide(h),this.overRatio.x=Math.min(Math.abs(this.overRatio.x),1),this.overRatio.y=Math.min(Math.abs(this.overRatio.y),1),1===i&&(this.overRatio.x=kK(Math.abs(this.overRatio.x)),this.overRatio.y=kK(Math.abs(this.overRatio.y))),this.isPointerDown||1===i?2===i&&(this.overRatio.x>.9&&!this.thetaIsFree||this.overRatio.y>.9&&!this.phiIsFree)?this.isPointerDown=!1:(c*this.overShoot.x<0&&!this.thetaIsFree&&(c*=1-this.overRatio.x),d*this.overShoot.y<0&&!this.phiIsFree&&(d*=1-this.overRatio.y)):2===i&&(!u&&(this.overRatio.x>.002&&!this.thetaIsFree||this.overRatio.y>.002&&!this.phiIsFree)||u&&(Math.abs(this.overShoot.x)>2||Math.abs(this.overShoot.y)>2)?(this.thetaIsFree||(c=.05*this.overShoot.x),this.phiIsFree||(d=.05*this.overShoot.y),u?this.isPanOverShoot=!0:this.isRotateOverShoot=!0):u?this.isPanOverShoot=!1:this.isRotateOverShoot=!1)):(c+=this.overShoot.x,d+=this.overShoot.y),e instanceof iy?(e.x=c,e.y=d):(this.thetaIsFree||(e.theta=c),this.phiIsFree||(e.phi=d))}setEnableDampingSpeed(e){this.enableDamping=e,this.rotateSpeed=!0===e?.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(kk)}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(kR)}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(kR)}zoomOut(e=this.getZoomScale()){this.dispatchEvent(kB),this.dollyOut(e),this.dispatchEvent(kz)}zoomIn(e=this.getZoomScale()){this.dispatchEvent(kB),this.dollyIn(e),this.dispatchEvent(kz)}setZoom(e){if(this.dispatchEvent(kB),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(kz)}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){void 0!==e.movementX?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(kU,-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){void 0!==e.movementX?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(!1===u4&&!1===pe(e)&&!0==(0===e.wheelDeltaY||0===e.deltaY?!(u2&&e.shiftKey&&Math.abs(e.wheelDeltaX)>=120)&&(e.wheelDeltaX?e.wheelDeltaX===-3*e.deltaX||e.wheelDeltaX===-3*window.devicePixelRatio*e.deltaX:0===e.deltaMode):e.wheelDeltaY?e.wheelDeltaY===-3*e.deltaY||e.wheelDeltaY===-3*window.devicePixelRatio*e.deltaY:0===e.deltaMode))!1!==this.enablePan&&(this.gesture?(this.panDelta.set(-e.deltaX,-e.deltaY).multiplyScalar(this.panSpeed),this.panDelta.x=Math.min(Math.abs(this.panDelta.x),100)*(this.panDelta.x<0?-1:1),this.panDelta.y=Math.min(Math.abs(this.panDelta.y),100)*(this.panDelta.y<0?-1:1),e.altKey?this.pan(0,this.panDelta.y):e.shiftKey?this.pan(this.panDelta.x,0):this.pan(this.panDelta.x,this.panDelta.y),this.update()):(this.gesture=!0,this.isPointerDown=!0),window.clearTimeout(this.timer),this.timer=window.setTimeout(()=>{this.gesture=!1,this.isPointerDown=!1,this.dispatchEvent(kz)},30));else{if(!1===this.enableZoom||this.gesture)return;0===e.deltaY?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(2===pt.length){let e=.5*(pt[0].pageX+pt[1].pageX),t=.5*(pt[0].pageY+pt[1].pageY);this.rotateStart.set(e,t)}else this.rotateStart.set(pt[0].pageX,pt[0].pageY)}handleTouchStartPan(){if(2===pt.length){let e=.5*(pt[0].pageX+pt[1].pageX),t=.5*(pt[0].pageY+pt[1].pageY);this.panStart.set(e,t)}else this.panStart.set(pt[0].pageX,pt[0].pageY)}handleTouchStartDolly(){let e=pt[0].pageX-pt[1].pageX,t=pt[0].pageY-pt[1].pageY,
vendor: 3,025 bytes, line 8167
8167i=Math.sqrt(e*e+t*t);this.dollyStart.set(0,i)}handleTouchStartDollyPan(){this.enableZoom&&!0===this.isTouchZoom&&this.handleTouchStartDolly(),this.enablePan&&this.handleTouchStartPan()}handleTouchStartDollyRotate(){this.enableZoom&&!0===this.isTouchZoom&&this.handleTouchStartDolly(),this.enableRotate&&this.handleTouchStartRotate()}handleTouchMoveRotate(e){if(2===pt.length){let t=pl(e),i=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this.rotateEnd.set(i,r)}else{if(e.pointerId!==pt[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(2===pt.length){let t=pl(e),i=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this.panEnd.set(i,r)}else{if(e.pointerId!==pt[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=pl(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&&!0===this.isTouchZoom&&this.handleTouchMoveDolly(e),this.enablePan&&this.handleTouchMovePan(e)}handleTouchMoveDollyRotate(e){this.enableZoom&&!0===this.isTouchZoom&&this.handleTouchMoveDolly(e),this.enableRotate&&this.handleTouchMoveRotate(e)}checkRaycastLock(){if(!this.object.data.raycastLock||this.options.isPlayMode)return!1;{let e=this.options?.showCameraLock;return e&&e(),!0}}};function kZ(e){let t=2*Math.PI;for(;e<=-Math.PI;)e+=t;for(;e>Math.PI;)e-=t;return e}function kK(e){return 1-Math.pow(1-e,4)}var kJ=class{constructor(e,t,i,r,s,a){for(let o of(this.id=e,this.data=t,this.object=i,this.page=r,this.currentIntersectedObjects=[],this.actions=IO(t,t.actions,r,s,a,i),this.target=t.target,this.triggeringObjects=[],t.triggeringObjects)){let e=r.scene.find(o);e&&this.triggeringObjects.push(e)}}isValidTriggeringObject(e){return"all"===this.target||this.triggeringObjects.some(t=>t===e||t.isAncestorOf(e.uuid)||e.isAncestorOf(t.uuid))}disconnect(){IL(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=>{"Toggle"===e.data.runMode?e.toggle():e.play()}),this.actions.SwitchCamera.forEach(e=>{"Toggle"===e.data.runMode?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)}
8167),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()))}};pw.then(e=>th=e);var k$=new iy,k0=new iv,k1=new iy,k2=new i4(0,0,0,"YXZ"),k3=new i4(0,0,0,"XYZ"),k4=new iy,k5=new iy,k6=new iy(1,1,1),k8=new iv,k9=new iY,k7=new iY,Be={type:"updateMatrix"},Bt=new iv,Bi=new iF,Br={type:"beginEvent",eventName:"Collision"},Bs={type:"beginEvent",eventName:"Trigger"},Ba=e=>e.states.some(e=>void 0!==e.data.position||void 0!==e.data.rotation||void 0!==e.data.hiddenMatrix||void 0!==e.data.cloner||void 0!==e.data.pathSnapping),Bn=class{constructor(e){this.eventContext=e,this.isEnabled=!1,this.gameControl=null,this.joysticks=[],this.joystickToGameControls=[],this.sharedGameControlGlobals={entitiesWithTransformAnim:[],entityToCollisionEvents:{},colliderToEntity:new Map,triggers:[],gamePads:[],createdObjects:[],nCreatedPerAction:{}},this.sensorToTriggerEvent={},this.eventManager=void 0,this.needsCollisionDetection=!1,this.initializationCounter=-1,this.rigidBodyToMesh=new Map,this.nActiveRigidBodies=0,this.collisionEvents=[],this.isExport=!1,this.skipRender=!0,this.processRigidBody=e=>{if(e.bodyType()!==th.RigidBodyType.Dynamic)return;e.isSleeping()||this.nActiveRigidBodies++;let[t,i,r]=this.rigidBodyToMesh.get(e.handle);if(k$.copy(e.translation()).multiplyScalar(this.pixelsPerMeter),k0.copy(e.rotation()),t.matrixWorld.compose(k$,k0,i),t.hasNonUniformScale&&t.matrixWorld.multiply(t.shearScale),t.dispatchEvent(Be),r){let e=t.cloner;if(e&&void 0===e.objectForSample)for(let i of(e.matrixWorld.copy(t.matrixWorld),e.children))i.updateMatrixWorld(!0);for(let e of t.children)e.updateMatrixWorld(!0)}},this.accumulator=0,this.handleCollisionEvents=(e,t,i)=>{let r,s;if(!1!==i){if(this.sensorToTriggerEvent[e]?(r=this.sensorToTriggerEvent[e],s=this.sharedGameControlGlobals.colliderToEntity.get(t)):this.sensorToTriggerEvent[t]&&(r=this.sensorToTriggerEvent[t],s=this.sharedGameControlGlobals.colliderToEntity.get(e)),r&&s&&r.isValidTriggeringObject(s))return void r.dispatch();for(let i=this.sharedGameControlGlobals.createdObjects.length-1;i>=0;i--){let r=this.sharedGameControlGlobals.createdObjects[i];if(r.userData.hasCollisionDestroy&&(r.rigidBody?.collider(0).handle===e||r.rigidBody?.collider(0).handle===t)){this.sharedGameControlGlobals.createdObjects.splice(i,1),r.removeFromParent(),requestAnimationFrame(()=>this.sharedGameControlGlobals.rapierWorld?.removeRigidBody(r.rigidBody));break}}if(this.gameControl?.object!==void 0&&this.gameControl.object===this.sharedGameControlGlobals.colliderToEntity.get(e)){let e=this.sharedGameControlGlobals.colliderToEntity.get(t),i=this.sharedGameControlGlobals.entityToCollisionEvents[e.uuid];if(void 0===i)return;for(let r of i)"character"===r.data.target&&this.dispatchCollisionEvent(r,e,t)}else if(this.gameControl?.object!==void 0&&this.gameControl.object===this.sharedGameControlGlobals.colliderToEntity.get(t)){let t=this.sharedGameControlGlobals.colliderToEntity.get(e),i=this.sharedGameControlGlobals.entityToCollisionEvents[t.uuid];if(void 0===i)return;for(let r of i)"character"===r.data.target&&this.dispatchCollisionEvent(r,t,e)}else{let i=this.sharedGameControlGlobals.colliderToEntity.get(e),r=this.sharedGameControlGlobals.entityToCollisionEvents[i.uuid];if(void 0!==r)for(let t of r)"scene"===t.data.target&&this.dispatchCollisionEvent(t,i,e);let s=this.sharedGameControlGlobals.colliderToEntity.get(t),a=this.sharedGameControlGlobals.entityToCollisionEvents[s?.uuid];if(void 0!==a)for(let e of a)"scene"===e.data.target&&this.dispatchCollisionEvent(e,s,t)}}},this.isExport=e.isExport,this.sharedAssets=e.sharedAssets,this.renderer=e.renderer,this.requestRender=e.requestRender,this.domElement=this.renderer.domElement,this.pixelsPerMeter=200,this.gravity=this.page.data.globalPhysics.gravity}get page(){return this.eventContext.page}
8167attachVRControllers(e){e.forEach(e=>{e.addEventListener("connected",e=>{"gamepad"in e.data&&"axes"in e.data.gamepad&&this.sharedGameControlGlobals.gamePads.push(e.data.gamepad)})})}markIsDestroyTarget(){this.page.traverseVisibleEntity(e=>{for(let t of e.dataPatched.events){if(!0===t.data.disabled)continue;let e=t.data.actions?.find(e=>"Destroy"===e.data.type)?.data;if(e)for(let t of e.objects){let e=this.page.scene.find(t);e&&(e.userData.hasDestroy=!0)}}})}markIsDragObject(){this.page.traverseVisibleEntity(e=>{for(let t of e.dataPatched.events)if(!0!==t.data.disabled&&"DragDrop"===t.data.type)for(let e of t.data.objects){let t=this.page.scene.find(e);t&&(t.userData.hasDrag=!0)}})}initBVH(){let e=[];if(this.page.traverseChildren(t=>{let i,r=t instanceof Tx,s=t instanceof OW;if(t instanceof AZ||r||s)return;let a=(i=t instanceof wr?t.object:t).dataPatched;if(a.physics?.enabled==="visibility"?!a.visible:!a.physics?.enabled)return!0;let o=t.geometry,h=!0===i.userData.hasDestroy,c=!0===i.userData.hasDrag;if(Ba(a)||h||c||i.dataPatched.events.some(e=>!0!==e.data.disabled&&("GameControl"===e.data.type||"Follow"===e.data.type)))return t.updateMatrixWorldSVD(),this.addBoundsTree(t),!0;o&&o.getAttribute("position").count>0&&e.push(Rs(o,t.matrixWorld))}),e.length>0){let t=vV(e,!1);this.sharedGameControlGlobals.staticMeshBVH=new bY(t)}}addRigidBody(e,t,i){if(Rr(e.matrixWorld))return;let r=[],s="geometry"in e?e.geometry:void 0,a=t.dataPatched;if(s?.getAttribute("position")!==void 0&&r.push(Rs(s,e.shearScale)),a.physics.fusedBody){let t=this.gatherChildrenGeom(e,r);e.traverseObject(t),e.children.forEach(e=>e.updateMatrixWorld(!0));let i=e.cloner;i&&void 0===i.objectForSample&&"dynamic"===a.physics.rigidBody&&(i.traverseObject(t),i.children.forEach(e=>e.updateMatrixWorld(!0)))}if(r.length>0){let o,h=!i.fromCreate&&"dynamic"===a.physics.rigidBody||i.fromCreate&&i.dynamic;h?(o=th.RigidBodyDesc.dynamic()).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?(o=th.RigidBodyDesc.kinematicPositionBased(),this.sharedGameControlGlobals.entitiesWithTransformAnim.push(e)):o=th.RigidBodyDesc.fixed();let c=vV(r);(e.hasNonUniformScale?e.matrixWorldRigid:e.matrixWorld).decompose(k$,k0,k1),e.position0=k$.clone().divideScalar(this.pixelsPerMeter),e.rotation0=k0.clone(),k$.divideScalar(this.pixelsPerMeter),o.setTranslation(k$.x,k$.y,k$.z).setRotation(k0),s?c?.scale(1/this.pixelsPerMeter,1/this.pixelsPerMeter,1/this.pixelsPerMeter):c?.scale(k1.x/this.pixelsPerMeter,k1.y/this.pixelsPerMeter,k1.z/this.pixelsPerMeter);let d=this.sharedGameControlGlobals.rapierWorld.createRigidBody(o);h&&this.rigidBodyToMesh.set(d.handle,[e,k1.clone(),a.physics.fusedBody]);let u=void 0!==a.geometry&&"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"!==a.geometry.type;try{this.addCollider(d,a.physics,c,t,u)}catch{try{this.addCollider(d,a.physics,c,t,!1)}catch(e){console.error(e)}}e.rigidBody=d}}addBoundsTree(e){let t=[];if(e.geometry?.getAttribute("position")!==void 0&&e.geometry?.getAttribute("position").count>0&&t.push(Rs(e.geometry,e.shearScale)),e.traverseObject(this.gatherChildrenGeom(e,t)),e.children.forEach(e=>e.updateMatrixWorld(!0)),t.length>0){let i=vV(t,!1);e.bvhGeometry=i,i.getAttribute("position").count>0&&(e.bvhGeometry.boundsTree=new bY(i),this.sharedGameControlGlobals.entitiesWithTransformAnim.push(e))}}addCollider(e,t,i,r,s=!0){let a;if(i?.getAttribute("position").count===0||i?.getIndex()?.count===0)return;i&&(a="trimesh"===t.colliderType?th.ColliderDesc.trimesh(i.getAttribute("position").array,i.getIndex().array):th.ColliderDesc.convexMesh(i.getAttribute("position").array,s?i.getIndex().array:void 0)),a.setFrictionCombineRule(th.CoefficientCombineRule.Average).setRestitutionCombineRule(th.CoefficientCombineRule.Average).setDensity(t.density).setFriction(t.friction).setRestitution(t.restitution);let o=this.sharedGameControlGlobals.rapierWorld.createCollider(a,e);this.sharedGameControlGlobals.colliderToEntity.set(o.handle,r),this.sharedGameControlGlobals.entityToCollisionEvents[r.uuid]?.some(e=>"scene"===e.target)&&o.setActiveEvents(th.ActiveEvents.COLLISION_EVENTS)}gatherChildrenGeom(e,t){return(i,r)=>{let s;if(0===r)return;if(i instanceof AZ)if(!i.objectForSample)return!0===i.object.dataPatched.physics.fusedBody&&"dynamic"===i.object.dataPatched.physics.rigidBody||void 0;else{if(i.objectForSample.dataPatched.physics.fusedBody)return;s=i.object}else if(i instanceof wr)s=i.object;else if(s=i,s.dataPatched.cloner?.hideBase)return!0;let a=s.dataPatched;
8167if("visibility"===a.physics.enabled?!a.visible:!a.physics.enabled)return!0;1===r?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 o=i.geometry;o?.getAttribute("position")!==void 0&&t.push(Rs(o,i.matrixWorld))}}activate(e){if(this.isEnabled)return;this.isEnabled=!0,this.eventManager=e,this.usePhysics=this.page.data.globalPhysics.usePhysics;let t=this.page.playCamera,i=!1,r=5,s=8,a=9,o="drag",h=this.page.data.publish.gameControlObject,c=null!==h?this.page.find(h):null,d=null;if(c)for(let e of c.data.events){if(e.data.disabled||"GameControl"!==e.data.type)continue;let t=c;for(;this.usePhysics&&(t=t.parent)?.parent!==null;)t.data.physics?.fusedBody;e.data.collisionEnabled&&(this.needsCollisionDetection=!0),null===d&&(d=e.data)}if(this.page.traverseEntity(e=>{for(let t of e.dataPatched.events)if(!1===t.data.disabled&&"Trigger"===t.data.type)return this.needsCollisionDetection=!0,!0}),c&&d&&(!0===c.data.visible||!0===c.data.physics.enabled)){i=i||d.camera===t.uuid||c.uuid===t.uuid;let e=new Rt(c,this.renderer.domElement,d,this.eventContext.page.data.globalPhysics,this,c.uuid!==t.uuid&&d.camera===t.uuid,t,this.page,this.sharedAssets);this.gameControl=e,r=d.joystickPosLoc,s=d.joystickRotLoc,a=d.jumpTouchButtonLoc,o=d.rotByTouch,u5&&d.touchControl&&(this.joystickToGameControls[r]="pos","walk"===d.moveMode&&(this.joystickToGameControls[a]="jmp"),"joystick"===o&&(this.joystickToGameControls[s]="rot"))}if(this.gameControl&&this.gameControl.data.navmesh.enabled){let e=this.gameControl.data;if(!this.navigationMeshWrapper){let t;this.navigationMeshWrapper=new kO(this.usePhysics,this.isExport),t=Math.floor((t="sphere"===e.collider.type?2*e.collider.radius:e.collider.height)/e.navmesh.ch-1),this.navigationMeshWrapper.init({...e.navmesh,walkableHeight:t},this.gameControl,this.eventContext)}}if(!1===i){let{enableRotate:e,enablePan:i,enableZoom:r,autoRotate:s,hoverRotatePanMode:a}=this.eventManager.publish.orbitControls;(e||i||r||s||0!==a)&&(this.orbitControls=new kQ(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 u=this.renderer.domElement.width/this.renderer.getPixelRatio(),p=this.renderer.domElement.height/this.renderer.getPixelRatio();this.joystickToGameControls.forEach((e,t)=>{var i;let r=document.body.appendChild(document.createElement("div")),[s,a,o]=this.eventManager.eventContext.publish.joystickSizeAndXYOffset[t],h=(u-5*s)/4+s,c={},d="jmp"===e,f=d?0:s;for(let e in t<10?(t<5?c.top=f/2:c.bottom=f/2,c.left=f/2+t%5*h):(10===t?c.left=f/2:c.right=f/2,c.top=p/2),c.top?c.top-=a[1]:c.bottom+=a[1],c.left?c.left+=a[0]:c.right-=a[0],c)c[e]+="px";if(d){let e=r.appendChild(document.createElement("div"));Object.assign(e.style,c,{position:"absolute",width:s+"px",height:s+"px",backgroundColor:`rgba(255,255,255,${.4*("show"===o)})`,zIndex:"9999",borderRadius:s+"px",border:"show"===o?"solid 2px rgba(0, 0, 0, .1)":"none",display:"flex",alignItems:"center",justifyContent:"center",touchAction:"none"});let i=s/16*6.4;"show"===o&&(e.innerHTML=`
8168						<svg width="${i}" height="${.4*s}" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
8169							<path d="M2 10L8 4L14 10" stroke="black" stroke-opacity="40%" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
8170						</svg>
8171					`),e.addEventListener("pointerdown",()=>{this.gameControl.movementState.jump=1,this.requestRender()}),e.addEventListener("touchend",e=>e.preventDefault()),this.joysticks[t]=[void 0,r];return}let m={zone:r,mode:"static",position:c,size:s};"hide"===o&&(m.restOpacity=0);let g=(i=m,LX.create(i));g.on("move",(t,i)=>{let r=this.gameControl;"pos"===e?i.force<.2?r.moveForce=0:(r.movementState.movePosZ=Math.sin(-i.angle.radian),r.movementState.movePosX=Math.cos(-i.angle.radian),i.force>1.2?r.movementState.run=1:r.movementState.run=0,i.force<.3?r.moveForce=(i.force-.2)/.1:r.moveForce=1):"rot"===e&&(i.force<.2?r.rotForce=0:(r.movementState.rotPosX=i.vector.y,r.movementState.rotPosY=-i.vector.x,i.force<.3?r.rotForce=(i.force-.2)/.1:r.rotForce=1)),this.requestRender()}),g.on("end",(t,i)=>{let r=this.gameControl;"pos"===e?(r.movementState.movePosZ=0,r.movementState.movePosX=0,r.moveForce=1):"rot"===e&&(r.movementState.rotPosX=0,r.movementState.rotPosY=0,r.rotForce=1)}),this.joysticks[t]=[g,r]}),this.markIsDestroyTarget(),this.markIsDragObject(),this.rebuildBVH(),this.initializationCounter++,window.setTimeout(()=>
8171{this.collisionEvents.forEach(e=>e.initialDisabled=!1)},80)}initPhysics(){this.sharedGameControlGlobals.rapierWorld?.free(),this.sharedGameControlGlobals.rapierWorld=new th.World(new th.Vector3(0,this.gravity,0)),this.events=new th.EventQueue(!0);let e=[],t=[];if(this.page.traverseChildren(i=>{let r;if(i instanceof AZ)if(!i.objectForSample)return!0===i.object.dataPatched.physics.fusedBody&&"dynamic"===i.object.dataPatched.physics.rigidBody||void 0;else{if(i.objectForSample.dataPatched.physics.fusedBody)return;r=i.object}else if(i instanceof wr)r=i.object;else{if(i instanceof OW||i instanceof Tx)return;if(r=i,r.dataPatched.cloner?.disabled===!1&&r.dataPatched.cloner?.hideBase&&r.dataPatched.physics?.fusedBody!==!0)return!0}let s=r.dataPatched,a;for(let e of s.events)!0!==e.data.disabled&&"GameControl"===e.data.type&&(a=e.data);if(!s.physics||("visibility"===s.physics.enabled?!s.visible:!s.physics.enabled))return!0;i.updateMatrixWorldSVD();let o=Ba(s),h=!1,c=r.userData.hasDestroy,d=r.userData.hasDrag,u=!1;for(let e of s.events)if(!0!==e.data.disabled){if("Collision"===e.data.type){h=!0;let t=new kx(e.id,e.data,r,this.page,this.sharedAssets,this.eventManager);t.initialDisabled=!0,this.collisionEvents.push(t),this.sharedGameControlGlobals.entityToCollisionEvents[r.uuid]&&this.sharedGameControlGlobals.entityToCollisionEvents[r.uuid].every(t=>t.id!==e.id)?this.sharedGameControlGlobals.entityToCollisionEvents[r.uuid].push(t):this.sharedGameControlGlobals.entityToCollisionEvents[r.uuid]=[t]}else if("Follow"===e.data.type){u=!0;let t=e.data.target;i.traverseVisible(e=>{e.userData.isFollowingObj=t})}}"dynamic"===s.physics.rigidBody&&!1===s.physics.fusedBody&&(i.matrixWorldFusedFalse=i.matrixWorld.clone());let p=i.geometry;if(void 0!==a){let e,t=th.RigidBodyDesc.kinematicPositionBased();(i.hasNonUniformScale?i.matrixWorldRigid:i.matrixWorld).decompose(k$,k0,k1),i.position0=k$.clone().divideScalar(this.pixelsPerMeter),i.rotation0=k0.clone(),k$.divideScalar(this.pixelsPerMeter),t.setTranslation(k$.x,k$.y,k$.z).setRotation(k0);let o=this.sharedGameControlGlobals.rapierWorld.createRigidBody(t);i.rigidBody=o,(e="sphere"===a.collider.type?th.ColliderDesc.ball(a.collider.radius/this.pixelsPerMeter):"capsule"===a.collider.type?th.ColliderDesc.capsule((a.collider.height/2-a.collider.radius)/this.pixelsPerMeter,a.collider.radius/this.pixelsPerMeter):th.ColliderDesc.cuboid(a.collider.width/this.pixelsPerMeter/2,a.collider.height/this.pixelsPerMeter/2,a.collider.depth/this.pixelsPerMeter/2)).setFrictionCombineRule(th.CoefficientCombineRule.Average).setRestitutionCombineRule(th.CoefficientCombineRule.Average).setDensity(s.physics.density).setFriction(s.physics.friction).setRestitution(s.physics.restitution);let h=this.sharedGameControlGlobals.rapierWorld.createCollider(e,o);this.sharedGameControlGlobals.colliderToEntity.set(h.handle,r),k$.fromArray(a.collider.position).multiply(k1.setFromMatrixScale(r.matrixWorld)).divideScalar(this.pixelsPerMeter),h.setTranslationWrtParent(k$);let c=new iv().setFromEuler(new i4().setFromVector3(new iy().fromArray(a.collider.rotation)));h.setRotationWrtParent(c),h.setActiveEvents(th.ActiveEvents.COLLISION_EVENTS),this.generateSensorColliderDescs(r,!0)}else"dynamic"===s.physics.rigidBody||o||u||c||d||h?(this.addRigidBody(i,r,{hasFollow:u,hasTransformAnim:o,hasDrag:d}),this.generateSensorColliderDescs(r,s.physics.fusedBody)):(p&&e.push(Rs(p,i.matrixWorld)),s.physics.fusedBody&&i.traverseObject((t,i)=>{let r;if(0===i)return;if(t instanceof AZ)if(!t.objectForSample)return!0===t.object.dataPatched.physics.fusedBody&&"dynamic"===t.object.dataPatched.physics.rigidBody||void 0;else{if(t.objectForSample.dataPatched.physics.fusedBody)return;r=t.object}else{if(t instanceof OW||t instanceof Tx)return;if(t instanceof wr)r=t.object;else if(r=t,r.dataPatched.cloner?.hideBase)return!0}let s=r.dataPatched;if("visibility"===s.physics.enabled?!s.visible:!s.physics.enabled)return!0;let a=t.geometry;a?.getAttribute("position")!==void 0&&e.push(Rs(a,t.matrixWorld))}),this.generateSensorColliderDescs(r,s.physics.fusedBody,t));if(s.physics?.fusedBody===!0||a)return!0}),0===e.length)return;let i=vV(e);i.scale(1/this.pixelsPerMeter,1/this.pixelsPerMeter,1/this.pixelsPerMeter);let r=th.RigidBodyDesc.fixed(),s=this.sharedGameControlGlobals.rapierWorld.createRigidBody(r),a=th.ColliderDesc.trimesh(i.getAttribute("position").array,i.getIndex().array).setFrictionCombineRule(th.CoefficientCombineRule.Multiply).setRestitutionCombineRule(th.CoefficientCombineRule.Multiply).setFriction(1).setRestitution(1);for(let[e,i]of(this.sharedGameControlGlobals.rapierWorld.createCollider(a,s),t)){let t=this.sharedGameControlGlobals.rapierWorld.createCollider(e,s);this.sensorToTriggerEvent[t.handle]=i}}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("Trigger"===t.data.type&&!0!==t.data.disabled){let i=new kJ(t.id,t.data,e,this.page,this.sharedAssets,this.eventManager),r=new iY().compose(k4.fromArray(t.data.position),k8.setFromEuler(k3.fromArray(t.data.rotation)),k6);if("box"===t.data.triggerZone){let s=new iw;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())}
8171disconnectEvents(){this.collisionEvents.forEach(e=>e.disconnect()),this.sharedGameControlGlobals.triggers.forEach(e=>e[3].disconnect()),this.sharedGameControlGlobals.triggers.length=0}deactivate(){if(this.isEnabled){for(let e of(this.isEnabled=!1,this.page.traverse(e=>{e.matrixWorldFusedFalse&&(e.matrixWorldFusedFalse=void 0),e.rigidBody&&(e.rigidBody=void 0),e.position0&&(e.position0=void 0),e.rotation0&&(e.rotation0=void 0)}),this.sharedGameControlGlobals.rapierWorld?.free(),this.sharedGameControlGlobals.rapierWorld=void 0,this.sharedGameControlGlobals.staticMeshBVH=void 0,this.accumulator=0,this.sharedGameControlGlobals.entitiesWithTransformAnim=[],this.disconnectEvents(),this.gameControl?.reset(),this.gameControl?.dispose(),this.gameControl=null,this.initializationCounter=-1,this.joysticks.forEach(([e,t])=>{e?.destroy(),t.remove()}),this.joystickToGameControls=[],this.joysticks=[],this.orbitControls&&(this.orbitControls.dispose(),this.orbitControls=void 0),this.navigationMeshWrapper?.dispose(),this.navigationMeshWrapper=void 0,Object.values(this.sharedGameControlGlobals.entityToCollisionEvents)))e.forEach(e=>e.disconnect());this.sharedGameControlGlobals.entityToCollisionEvents={},this.page.updateMatrixWorld(!0)}}update(e,t,i){if(!this.isEnabled)return!0;let r=!0;if(void 0!==this.orbitControls&&this.orbitControls.needsUpdate&&(this.orbitControls.update(),r=!this.orbitControls.isCurrentlyDamping),this.initializationCounter>=0&&this.initializationCounter<2?(this.initializationCounter++,r=!1):2===this.initializationCounter&&this.gameControl&&(r=!this.gameControl.update(e,t,i)&&r),!1===this.usePhysics&&this.checkTrigger(),this.usePhysics)if(0===e)r=this.stepPhysics()&&r;else{let t=e/1e3;t<.016666666666666666&&t>.009166666666666667&&(t=.016666666666666666),this.accumulator+=t;let i=performance.now(),s=0;for(;this.accumulator>=.016666666666666666&&s<6&&(r=this.stepPhysics()&&r,this.accumulator-=.016666666666666666,s++,!(performance.now()-i>16.666666666666668)););this.accumulator=this.accumulator%.016666666666666666}this.skipRender=r}stepPhysics(){for(let e of this.sharedGameControlGlobals.entitiesWithTransformAnim)(e.hasNonUniformScale?e.matrixWorldRigid:e.matrixWorld).decompose(k$,k0,k1),k2.setFromQuaternion(k0),void 0===e.prevR?(e.prevR=k2.clone(),e.prevT=k$.clone()):(e.prevR.copy(k2),e.prevT.copy(k$)),e.rigidBody&&(e.rigidBody.setNextKinematicTranslation(k$.divideScalar(this.pixelsPerMeter)),e.rigidBody.setNextKinematicRotation(k0));return this.sharedGameControlGlobals.rapierWorld.step(this.events),this.events?.drainCollisionEvents(this.handleCollisionEvents),!this.updatePositions()}dispatchCollisionEvent(e,t,i){let r=(this.sharedGameControlGlobals.rapierWorld?.getCollider(i))._parent,s;if(t.cloner){for(let e of t.cloner.children)if(e.rigidBody===r){s=e;break}}e.dispatch(s),t.dispatchEvent(Br)}updateUseWindowEvents(e){this.orbitControls?.updateUseWindowEvents(e)}generateSensorColliderDescs(e,t,i){let r=k7.copy(e.matrixWorld).invert();e.traverseEntity((s,a)=>
vendor: 4,297 bytes, line 8171
8171{if(!1===t&&1===a)return!0;for(let t of s.dataPatched.events)if("Trigger"===t.data.type&&!0!==t.data.disabled){let a=new kJ(t.id,t.data,s,this.page,this.sharedAssets,this.eventManager),o;if((o="box"===t.data.triggerZone?th.ColliderDesc.cuboid(...t.data.size.map(e=>e/(2*this.pixelsPerMeter))):th.ColliderDesc.ball(t.data.radius/this.pixelsPerMeter)).setDensity(0).setSensor(!0).setActiveEvents(th.ActiveEvents.COLLISION_EVENTS),k4.fromArray(t.data.position),k8.setFromEuler(k3.fromArray(t.data.rotation)),k9.compose(k4,k8,k6).premultiply(s.matrixWorld),i?(k9.decompose(k4,k8,k5),o.setActiveCollisionTypes(th.ActiveCollisionTypes.KINEMATIC_FIXED|th.ActiveCollisionTypes.DYNAMIC_FIXED)):(k9.premultiply(r).decompose(k4,k8,k5),e.rigidBody.bodyType()===th.RigidBodyType.Dynamic||(e.rigidBody.bodyType()===th.RigidBodyType.Fixed?o.setActiveCollisionTypes(th.ActiveCollisionTypes.KINEMATIC_FIXED|th.ActiveCollisionTypes.DYNAMIC_FIXED):o.setActiveCollisionTypes(th.ActiveCollisionTypes.KINEMATIC_KINEMATIC|th.ActiveCollisionTypes.DYNAMIC_KINEMATIC))),k4.divideScalar(this.pixelsPerMeter),o.setTranslation(k4.x,k4.y,k4.z),o.setRotation(k8),i)i.push([o,a]);else{let t=this.sharedGameControlGlobals.rapierWorld.createCollider(o,e.rigidBody);this.sensorToTriggerEvent[t.handle]=a}}})}checkTrigger(){let e;for(let t=0;t<this.sharedGameControlGlobals.triggers.length;t++){let[i,r,s,a]=this.sharedGameControlGlobals.triggers[t];for(let t=0;t<this.sharedGameControlGlobals.entitiesWithTransformAnim.length;t++){let o=this.sharedGameControlGlobals.entitiesWithTransformAnim[t];if(s===o||!1===a.isValidTriggeringObject(SL.is(o)?o:o.object))continue;let h=k7.copy(s.matrixWorld).decompose(k4,Bt,k5).compose(k4,Bt,k6).multiply(r),c=k9.copy(o.matrixWorld).invert().multiply(h);i instanceof iw?e=o.bvhGeometry.boundsTree.intersectsBox(i,c):(Bi.radius=i,Bi.center.setFromMatrixPosition(c),e=o.bvhGeometry.boundsTree.intersectsSphere(Bi)),e?-1===a.currentIntersectedObjects.indexOf(o)&&(a.currentIntersectedObjects.push(o),a.dispatch(),s.dispatchEvent(Bs)):a.currentIntersectedObjects=a.currentIntersectedObjects.filter(e=>e!==o)}}}};function Bo(e){let t=this._clip.duration,i=this._clip.start??0,r=this.loop,s=this.time+e,a=this._loopCount,o=2202===r;if(0===e)return -1===a?s:o&&(1&a)==1?t-(s-i):s;if(2200===r){-1===a&&(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(-1===a&&(e>=0?(a=0,this._setEndings(!0,0===this.repetitions,o)):this._setEndings(0===this.repetitions,!0,o)),s>=t||s<i){let r=Math.floor((s-i)/(t-i));s-=(t-i)*r,a+=Math.abs(r);let h=this.repetitions-a;if(h<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,o||(s=e>0?t:i,1===this.repetitions&&(s=t)),this.time=s,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(1===h){let t=e<0;this._setEndings(t,!t,o)}else this._setEndings(!1,!1,o);this._loopCount=a,this.time=s,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:r})}}else this.time=s;if(o&&(1&a)==1)return t-(s-i)}return s}var Bl=!1,Bh=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=e=>{"Empty"===e.data.type&&e.data.animations&&e.data.animations.forEach((t,i)=>{let r=t[0]+"/";if(Array.isArray(e.identity)?r+=e.identity[0]:r+=e.uuid,this.clipIdToAction[r])return;let s=o$.parse(JSON.parse(t[2]));e.animations[i]=s;let a=this.mixer.clipAction(s,e);!1===Bl&&(Object.getPrototypeOf(a)._updateTime=Bo,Bl=!0),a.clampWhenFinished=!0,this.clipIdToAction[r]=a})},this.mixer=new lP(e),this.scene.traverseEntity(this.addClip)}deleteClip(e,t){let i=this.scene.find(t);if(!i)return;let r=i.animations.find(t=>t.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(t=>t.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())}
8171onExitPlayMode(){Object.values(this.clipIdToAction).forEach(e=>{e.repetitions=1/0,e.loop=2201}),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),"pingpong"===e.direction&&0!==e.repeat&&(i.loop=2202)),i.play(),i.paused=!1,this.requestRender(),i}resumeFromInspector(e){let t=this.clipIdToAction[e];t&&(t.play(),t.paused=!1,this.requestRender())}pauseFromInspector(e){let t=this.clipIdToAction[e];t&&(t.paused=!0)}stop(){this.mixer.stopAllAction(),this.requestRender()}update(e){if(this.needsUpdate)this.needsUpdate=!1;else if(!1===this.isPlaying||this.animationInspectorState?.isScrubbing)return;this.mixer.update(e/1e3),this.activeClip&&this.updateDisplayProgress(Math.round(this.mixer.time/this.activeClip.duration*(this.maxFrames-1)%(this.maxFrames-1))),this.requestRender()}get maxFrames(){return IS(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)}},Bc=new WeakMap,Bd=class extends o3{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 o6(this.manager);s.setPath(this.path),s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,e=>{this.decodeDracoFile(e,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(Bc.has(e)){let t=Bc.get(e);if(t.key===i)return t.promise;if(0===e.byteLength)throw 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,o=this._getWorker(s,a).then(i=>(r=i,new Promise((i,a)=>{r._callbacks[s]={resolve:i,reject:a},r.postMessage({type:"decode",id:s,taskConfig:t,buffer:e},[e])}))).then(e=>this._createGeometry(e.geometry));return o.catch(()=>!0).then(()=>{r&&s&&this._releaseTask(r,s)}),Bc.set(e,{key:i,promise:o}),o}_createGeometry(e){let t=new rz;e.index&&t.setIndex(new rE(e.index.array,1));for(let i=0;i<e.attributes.length;i++){let r=e.attributes[i],s=r.name,a=r.array,o=r.itemSize;t.setAttribute(s,new rE(a,o))}return t}_loadLibrary(e,t){let i=new o6(this.manager);return i.setPath(this.decoderPath),i.setResponseType(t),i.setWithCredentials(this.withCredentials),new Promise((t,r)=>{i.load(e,t,void 0,r)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;let e="object"!=typeof WebAssembly||"js"===this.decoderConfig.type,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(t=>{let i=t[0];e||(this.decoderConfig.wasmBinary=t[1]);let r=Bu.toString(),s=["/* draco decoder */",i,"","/* worker */",r.substring(r.indexOf("{")+1,r.lastIndexOf("}"))].join(`
8172`);this.workerSourceURL=URL.createObjectURL(new Blob([s]))}),this.decoderPending}_getWorker(e,t){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){let e=new Worker(this.workerSourceURL);e._callbacks={},e._taskCosts={},e._taskLoad=0,e.postMessage({type:"init",decoderConfig:this.decoderConfig}),e.onmessage=function(t){let i=t.data;switch(i.type){case"decode":e._callbacks[i.id].resolve(i);break;case"error":e._callbacks[i.id].reject(i);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+i.type+'"')}},this.workerPool.push(e)}else this.workerPool.sort(function(e,t){return e._taskLoad>t._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 Bu(){let e,t;onmessage=function(i){let r=i.data;switch(r.type){case"init":e=r.decoderConfig,t=new Promise(function(t){e.onModuleLoaded=function(e){t({draco:e})},DracoDecoderModule(e)});break;case"decode":let s=r.buffer,a=r.taskConfig;t.then(e=>{let t=e.draco,i=new t.Decoder,o=new t.DecoderBuffer;o.Init(new Int8Array(s),s.byteLength);try{let e=function(e,t,i,r){var s,a,o;let h,c,d,u,p=r.attributeIDs,f=r.attributeTypes,m,g,v=t.GetEncodedGeometryType(i);if(v===e.TRIANGULAR_MESH)m=new e.Mesh,g=t.DecodeBufferToMesh(i,m);else if(v===e.POINT_CLOUD)m=new e.PointCloud,g=t.DecodeBufferToPointCloud(i,m);else throw Error("THREE.DRACOLoader: Unexpected geometry type.");if(!g.ok()||0===m.ptr)throw Error("THREE.DRACOLoader: Decoding failed: "+g.error_msg());let y={index:null,attributes:[]};for(let i in p){let s=self[f[i]],a,o;if(r.useUniqueIDs)o=p[i],a=t.GetAttributeByUniqueId(m,o);else{if(-1===(o=t.GetAttributeId(m,e[p[i]])))continue;a=t.GetAttribute(m,o)}y.attributes.push(function(e,t,i,r,s,a){let o=a.num_components(),h=i.num_points()*o,c=h*s.BYTES_PER_ELEMENT,d=function(e,t){switch(t){case Float32Array:return e.DT_FLOAT32;case Int8Array:return e.DT_INT8;case Int16Array:return e.DT_INT16;case Int32Array:return e.DT_INT32;case Uint8Array:return e.DT_UINT8;case Uint16Array:return e.DT_UINT16;case Uint32Array:return e.DT_UINT32}}(e,s),u=e._malloc(c);t.GetAttributeDataArrayForAllPoints(i,a,d,c,u);let p=new s(e.HEAPF32.buffer,u,h).slice();return e._free(u),{name:r,array:p,itemSize:o}}(e,t,m,i,s,a))}return v===e.TRIANGULAR_MESH&&(s=e,a=t,o=m,h=3*o.num_faces(),c=4*h,d=s._malloc(c),a.GetTrianglesUInt32Array(o,c,d),u=new Uint32Array(s.HEAPF32.buffer,d,h).slice(),s._free(d),y.index={array:u,itemSize:1}),e.destroy(m),y}(t,i,o,a),s=e.attributes.map(e=>e.array.buffer);e.index&&s.push(e.index.array.buffer),self.postMessage({type:"decode",id:r.id,geometry:e},s)}catch(e){console.error(e),self.postMessage({type:"error",id:r.id,error:e.message})}finally{t.destroy(o),t.destroy(i)}})}}}function Bp(e){return tc||(tc=new Bd).setDecoderPath(e?`${e}
8172/`:"https://www.gstatic.com/draco/versioned/decoders/1.5.2/").preload(),tc.decoderPending}async function Bf(e){if(tc){let t={attributeIDs:tc.defaultAttributeIDs,attributeTypes:tc.defaultAttributeTypes,useUniqueIDs:!1},i;try{i=await tc.decodeGeometry(new Int8Array(e).buffer,t)}catch(e){console.error(e)}if(i)return{index:i.index?{array:i.index.array}:void 0,attributes:Object.entries(i.attributes).map(([e,t])=>({name:e,itemSize:t.itemSize,array:t.array}))}}return null}async function Bm(e,t){let[i,r]=p2(m_.deserialize(new Uint8Array(e)));return vU(i),t&&t(i),r.result().data}async function Bg(e){for(let t of e){let e=await Bf(t.geometry.data.draco);if(e){let i=t.geometry.data;e.index&&(i.index={array:e.index.array,itemSize:1,normalized:!1,type:"Uint32Array"});let r={};e.attributes.forEach(({name:e,array:t,itemSize:i})=>{r[e]={array:t,itemSize:i,type:"Float32Array",normalized:!1}}),i.attributes=r,i.draco=void 0}}}var Bv=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 e=t[0]-this._lastPosition[0],i=t[1]-this._lastPosition[1];Math.sqrt(e*e+i*i)>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]}},By=class{constructor(e,t,i,r,s,a,o,h){this.eventId=e,this.id=t,this.data=i,this.dataEvent=r,this.object=s,this.stage=!1,this.actions=IO(r,i.actions,a,o,h,s)}disconnect(){IL(this.actions)}
vendor: 3,208 bytes, line 8172
8172dispatchIn(){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()})}},Bx=class extends Rv{constructor(e,t){super(e),this.eventManager=t,this.breakpoints=[],this.resize=(e,t)=>{this.breakpoints.forEach(i=>{let r=m6.deviceToSize(i.data.size),s="horizontal"===i.dataEvent.orientation?e:t,a;switch(i.data.operator){case"<":a=s<r[0];break;case">":a=s>r[0];break;case"<>":a=s>r[0]&&s<r[1]}i.stage!==a&&(i.stage=a,i.stage?i.dispatchIn():i.dispatchOut())})},this.onResizeObserver=new ResizeObserver(e=>{for(let t of e){let{width:e,height:i}=t.contentRect;this.resize(e,i)}})}connect(){let{page:e,sharedAssets:t,domElement:i}=this.eventContext;this.onResizeObserver.observe(i);let r=i=>{if(!(!i.visible||!i.data?.events.length))for(let{data:r,id:s}of i.data.events)r.disabled||"Resize"===r.type&&r.breakpoints.forEach(({data:a,id:o})=>{try{let h=new By(s,o,a,r,i,e,t,this.eventManager);this.breakpoints.push(h)}catch(e){}})};e.traverseEntity(e=>{(e instanceof O_||e instanceof Op)&&e.frame?.traverse(e=>{r(e)}),r(e)})}disconnect(){this.onResizeObserver.disconnect(),this.breakpoints.forEach(e=>{e.disconnect()}),this.breakpoints=[]}},Bb=class extends Rv{constructor(e,t){super(e),this.eventManager=t,this.userAPIs={},this.events=[],this.onSuccess=({userAPIId:e})=>{this.events.forEach(t=>{t.data.userAPIId===e&&t.dispatchSuccess()})},this.onError=({userAPIId:e})=>{this.events.forEach(t=>{t.data.userAPIId===e&&t.dispatchError()})},this.userAPIs=e.sharedAssets.getUserAPIs()}connect(){this.eventContext.page.traverseEntity(e=>{e.data?.events.filter(e=>"API"===e.data.type&&!e.data.disabled).forEach(t=>{this.events.push(new Bw(t.id,t.data,e,this.eventContext.page,this.eventContext.sharedAssets,this.eventManager))})}),Object.entries(this.userAPIs).forEach(([e,t])=>{t.on("success",this.onSuccess),t.on("error",this.onError),t.autostart&&t.callUserAPI(this.eventContext.sharedAssets)})}disconnect(){Object.entries(this.userAPIs).forEach(([e,t])=>{t.off("success",this.onSuccess),t.off("error",this.onError)})}},Bw=class{constructor(e,t,i,r,s,a){this.id=e,this.data=t,this.object=i,this.successActions=IO(t,t.successActions,r,s,a,i),this.errorActions=IO(t,t.errorActions,r,s,a,i)}dispatchSuccess(){this.dispatchActions(this.successActions)}dispatchError(){this.dispatchActions(this.errorActions)}
vendor: 1,586 bytes, line 8172
8172dispatchActions(e){e.Audio.forEach(e=>e.dispatchConditional()),e.Particles.forEach(e=>e.dispatchConditional()),e.Video.forEach(e=>e.dispatchConditional()),e.Create.forEach(e=>e.dispatch()),e.Destroy.forEach(e=>e.dispatch()),e.Reset.forEach(e=>e.dispatch()),e.Transition.forEach(e=>{e.object.currentTransitionEvent!==this&&(e.object.currentTransitionEvent=this),e.init()}),e.Transition.forEach(e=>e.play()),e.Animation.forEach(e=>e.play()),e.SwitchCamera.forEach(e=>e.play()),e.SceneTransition.forEach(e=>e.dispatch()),e.SetVariable.forEach(e=>e.checkConditions()),e.SetVariable.forEach(e=>e.dispatch()),e.DynamicVariablePlay.forEach(e=>e.dispatch()),e.ClearLocalStorage.forEach(e=>e.dispatch()),e.UserAPI.forEach(e=>e.dispatch())}},B_=class extends Rv{constructor(e,t){super(e),this.eventManager=t,this.userWebhooks={},this.events=[],this.onMessage=({userWebhookId:e})=>{this.events.forEach(t=>{t.data.userWebhookId===e&&t.dispatch()})},this.userWebhooks=e.sharedAssets.getUserWebhooks()}connect(){this.eventContext.page.traverseEntity(e=>{e.data?.events.filter(e=>"WEBHOOK"===e.data.type&&!e.data.disabled).forEach(t=>{this.events.push(new BS(t.id,t.data,e,this.eventContext.page,this.eventContext.sharedAssets,this.eventManager))})}),Object.entries(this.userWebhooks).forEach(([e,t])=>{t.connect(),t.on("message",this.onMessage)})}disconnect(){Object.entries(this.userWebhooks).forEach(([e,t])=>{t.off("message",this.onMessage),t.disconnect()})}},BS=class{constructor(e,t,i,r,s,a){this.id=e,this.data=t,this.object=i,this.actions=IO(t,t.actions,r,s,a,i)}dispatch(){let e=this.actions;
8172e.Audio.forEach(e=>e.dispatchConditional()),e.Particles.forEach(e=>e.dispatchConditional()),e.Video.forEach(e=>e.dispatchConditional()),e.Create.forEach(e=>e.dispatch()),e.Destroy.forEach(e=>e.dispatch()),e.Reset.forEach(e=>e.dispatch()),e.Transition.forEach(e=>{e.object.currentTransitionEvent!==this&&(e.object.currentTransitionEvent=this),e.init()}),e.Transition.forEach(e=>e.play()),e.Animation.forEach(e=>e.play()),e.SwitchCamera.forEach(e=>e.play()),e.SceneTransition.forEach(e=>e.dispatch()),e.SetVariable.forEach(e=>e.checkConditions()),e.SetVariable.forEach(e=>e.dispatch()),e.DynamicVariablePlay.forEach(e=>e.dispatch()),e.ClearLocalStorage.forEach(e=>e.dispatch()),e.UserAPI.forEach(e=>e.dispatch())}},BC=new iy(0,0,1),BM=new iy,BE=new iy,BA=new tK,BT=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 Dp,this.doubleClickHandler=new Bv,this.isDragging=!1,this.plane=new ss,this.caretInterval=0,this.planeIntersection=new iy,this.projected=new tZ,this._lastIndex=0,this._isFirstDragMove=!1,this.selectionOnDragStart=0,this.onTextMaterialChanged=()=>{let e=this.virtualInput?.data;if(void 0!==this.virtualInput&&e){let t=e.material,i=function(e,t){let i=go.fromHex(3223857),r=.8;for(let o of e.layers){if("light"===o.data.type||"displace"===o.data.type||"fresnel"===o.data.type||"matcap"===o.data.type||"texture"===o.data.type||"toon"===o.data.type||"outline"===o.data.type||"transmission"===o.data.type||"noise"===o.data.type)continue;let e="string"==typeof o.data.alpha?Number(t.getVariable(o.data.alpha)):o.data.alpha;if("color"===o.data.type&&e>.3){var s,a;s=o.data.color,a=t,i="string"==typeof s?a.data.colors[s]:s,r=e;break}if(("depth"===o.data.type||"gradient"===o.data.type)&&e>.3){let e=o.data.colors[0];i={r:e[0],g:e[1],b:e[2]},r="string"==typeof o.data.alpha?1:o.data.alpha;break}}return{...i,a:r}}("string"==typeof t?this.sharedAssets.data.materials[t]:t,this.sharedAssets);this.helper.setCaretColor(i)}},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=e=>{if(!this.htmlInput||!this.virtualInput)return;let t=this.helper,i=e?.key==="ArrowLeft"||e?.key==="ArrowRight",r=e?.key==="ArrowUp"||e?.key==="ArrowDown";this.htmlInput.selectionStart===this.htmlInput.selectionEnd?(t.setCaretPosition(this.htmlInput.selectionStart,{horizontalKeyMove:i,verticalKeyMove:r}),this.startAnimateTextCursor()):t.setSelection(this.htmlInput.selectionStart,this.htmlInput.selectionEnd),this.requestRender()},this.containerScene.add(this.helper)}createInput(){let e;return this.htmlInput=((e=document.createElement("textarea")).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),this.htmlInput}connect(){}disconnect(){this.stopAnimateTextCursor(),this.helper.hide(),this.htmlInput?.remove(),this.doubleClickHandler.stop()}handleMouseDown(){if(!this.htmlInput||!this.virtualInput)return!0;this.getPointOnPlane();let e=this.doubleClickHandler.clickCount,{index:t,lineIndex:i,characterIndex:r}=this.helper.getSelectionFromPosition(this.projected.x,this.projected.y,e>1?"inside":"previous")??{index:0,lineIndex:0,characterIndex:0};this.virtualInput?.wrappedText?.length&&this.virtualInput.wrappedText[i][Math.max(0,r-1)]===`
8173`&&(t--,r--),this._lastIndex=t,this._isFirstDragMove=!0;let s=this.checkClickedObject();if(1===e){if(null===s)return this.onExit(this.virtualInput),!0;this.selectionOnDragStart=t,this.isDragging=!0,this.setInputSelection(t)}else s===this.virtualInput&&(2===e?this.selectClosestWord(i,r):e>2&&(this.setInputSelection(0,this.htmlInput.value.length),this.doubleClickHandler.reset()))}handleMouseUp(){this.applyRangeToTextInput(),this.isDragging=!1,this._isFirstDragMove=!1}handleMouseMove(){this.virtualInput&&(this._isFirstDragMove&&this.doubleClickHandler.clickCount>1&&(this.selectionOnDragStart=this._lastIndex,this.isDragging=!0,this.setInputSelection(this._lastIndex)),this._isFirstDragMove=!1,this.getPointOnPlane(),this.applyRangeToTextInput())}focus(e){if(this.virtualInput=e,this.updateTextInputStyles(),this.htmlInput)if(e){let e=this.data?.geometry.text;this.htmlInput.value="string"==typeof e?"":e?.textValue.toString()??""}else this.htmlInput.value=""}blur(){}get data(){let{virtualInput:e}=this;if(e)return e.dataPatched}
vendor: 5,153 bytes, lines 8173-8174
8173applyRangeToTextInput(){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};void 0!==i&&void 0!==r&&this.virtualInput?.wrappedText[i][r-1]===`
8174`&&t--,this.htmlInput.setSelectionRange(Math.min(e,t),Math.max(e,t))}checkClickedObject(){if(this.virtualInput){let e=this.raycaster.intersectObject(this.virtualInput,!1);if(e.length>0){let t=e[0];if(t.object instanceof Ov)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"," "))>0&&a++,s>=r.length-1&&e===i.length-1&&s++);let o=this.helper,h=o.getGlobalIndexFromLineAndCharIndexes(i,e,a),c=o.getGlobalIndexFromLineAndCharIndexes(i,e,s);this.setInputSelection(h,c)}findNextCharOccurence(e,t,i,r=" "){let s=Math.max(0,e.length-1),a="forward"===i?s:0,o="forward"===i?1:-1,h=Math.max(Math.min(t,s),0);for(;h!==a;)if(h+=o,e.charAt(h)===r)return h;return a}getPointOnPlane(){let e=this.virtualInput?.data;if(!(!this.virtualInput||!e)&&this.raycaster.ray.intersectsPlane(this.plane)){null===this.planeIntersection&&(this.planeIntersection=new iy);let t=this.raycaster.ray.intersectPlane(this.plane,this.planeIntersection);if(t){this.planeIntersection.copy(this.virtualInput.worldToLocal(t));let i="number"==typeof e.geometry.width?e.geometry.width:1,r="number"==typeof e.geometry.height?e.geometry.height:1;this.projected.set(t.x+.5*i,t.y-.5*r)}}}updatePlane(){let e=this.virtualInput?.data;this.virtualInput&&e&&(BA.getNormalMatrix(this.virtualInput.matrixWorld),BM.copy(BC).applyMatrix3(BA).normalize(),this.virtualInput.localToWorld(BE.set(0,0,e.geometry.depth)),this.plane.setFromNormalAndCoplanarPoint(BM,BE))}setInputSelection(e,t=e){this.htmlInput?.setSelectionRange(e,t),u3&&this.htmlInput?.focus(),setTimeout(()=>{this.htmlInput?.focus()})}updateTextInputStyles(){var e;let t=this.virtualInput?.data;this.virtualInput&&t&&this.htmlInput&&(this.htmlInput.style.fontSize=t.geometry.fontSize+"px",this.htmlInput.style.letterSpacing=t.geometry.letterSpacing*t.geometry.fontSize+"px",this.htmlInput.style.lineHeight=t.geometry.fontSize*t.geometry.lineHeight+"px",this.htmlInput.style.width=t.geometry.width+"px",this.htmlInput.style.height=t.geometry.height+"px",this.htmlInput.style.textAlign=4===(e=t.geometry.horizontalAlign)?"justify":2===e?"right":3===e?"center":"left")}},BP=(e,t)=>{if("string"==typeof e){let i=t.data(e);if(i)return BP(i.value,t)}return y2.getDisplayedValue(e)};function BD(e,t){let i=e.text,r="";if("string"==typeof i){let e=t.variables.data(r);e&&(r=BP(e.value,t.variables))}else r=i.textValue.toString();return r}var BO=class extends Rv{constructor(e,t){super(e),this.eventManager=t,this._textInputs=[],this.sceneHelpers=new nb,this.helper=new Dp,this._onMouseDownFocusIn=e=>{if(pt.length>1)return;this.eventContext.updateRaycaster(e);let t=null;if(this.eventContext.raycaster){for(let e of this._textInputs)if(this.eventContext.raycaster.intersectObject(e,!0).length>0){t=e;break}}this.focusOnTextInput(t),this._onCaretUpdate(),this._onMouseUp(),this.textInputManager.doubleClickHandler.start(this.eventContext.domElement),this.textInputManager.doubleClickHandler._onMouseDown(e),this._onMouseDown(e)},this.onExit=()=>{let{virtualInput:e}=this.textInputManager;if(null===e)return;let t=this.textInputManager.htmlInput;this.helper.hide(),t?.setSelectionRange(t.value.length,t.value.length),this.eventManager.controlsManager.orbitControls&&(this.eventManager.controlsManager.orbitControls.enabled=!0);let{domElement:i}=this.eventContext;i.removeEventListener("pointerdown",this._onMouseDown,!1),i.removeEventListener("pointerup",this._onMouseUp,!1),i.removeEventListener("pointermove",this._onMouseMove,!1),window.removeEventListener("keydown",this._onKeyPress),this.textInputManager.doubleClickHandler.reset(),i.addEventListener("pointerdown",this._onMouseDownFocusIn),this.eventContext.renderer.sceneHelpersOnTop=void 0,this.eventContext.renderer.pipeline.disableHelpers()},this._onMouseDown=e=>{this.eventContext.updateRaycaster(e),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=e=>{this.eventContext.updateRaycaster(e),this.textInputManager.handleMouseMove()},this._onTextEdit=e=>{let{htmlInput:t,virtualInput:i,helper:r}=this.textInputManager;if(!t||!i)return;let s=t.value;i.textGeometry.setText(s,this.eventContext.sharedAssets).then(()=>{this.eventContext.requestRender()});let a=i.data;
vendor: 3,823 bytes, line 8174
8174r.update();let o=a.geometry.text;"string"==typeof o&&this.eventContext.sharedAssets.updateVariable(o,{textValue:s}),this.textInputManager.updateTextInputStyles(),this._onCaretUpdate()},this._onCaretUpdate=e=>{this.textInputManager.handleCaretUpdate(e)},this._onKeyPress=e=>{"Escape"===e.key&&this.onExit()},this.textInputManager=new BT(this.sceneHelpers,e.raycaster,e.sharedAssets,e.requestRender,this.onExit)}connect(){let e=[];if(this.eventContext.scene.traverseEntity(t=>{t instanceof Ov&&e.push(t)}),this._textInputs=e,0===e.length)return;let{domElement:t}=this.eventContext;t.addEventListener("pointerdown",this._onMouseDownFocusIn),this.textInputManager.connect();let i=this.textInputManager.createInput();document.body.appendChild(i),i.style.display="none",i.addEventListener("keyup",this._onCaretUpdate),i.addEventListener("keydown",this._onCaretUpdate),i.addEventListener("beforeinput",this._onCaretUpdate),i.addEventListener("paste",this._onCaretUpdate),i.addEventListener("cut",this._onCaretUpdate),i.addEventListener("select",this._onCaretUpdate),i.addEventListener("selectstart",this._onCaretUpdate)}disconnect(){let e=this.textInputManager.htmlInput,{domElement:t,sharedAssets:i}=this.eventContext;t.removeEventListener("pointerdown",this._onMouseDownFocusIn),e?.removeEventListener("keyup",this._onCaretUpdate),e?.removeEventListener("keydown",this._onCaretUpdate),e?.removeEventListener("beforeinput",this._onCaretUpdate),e?.removeEventListener("paste",this._onCaretUpdate),e?.removeEventListener("cut",this._onCaretUpdate),e?.removeEventListener("select",this._onCaretUpdate),e?.removeEventListener("selectstart",this._onCaretUpdate),this._textInputs.forEach(e=>{let t=BD(e.data.geometry,this.eventContext.sharedAssets.data);e.textGeometry.setText(t,i)}),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||null===e)return;this.textInputManager.updateTextInputStyles(),this.eventContext.renderer.sceneHelpersOnTop=this.sceneHelpers,this.eventContext.renderer.pipeline.enableHelpers(),this.textInputManager.isDragging=!1,t.value=BD(e.textGeometry.userData.parameters,this.eventContext.sharedAssets.data),t.setSelectionRange(0,0),this.textInputManager.helper.show(e),t.style.display="block",t.addEventListener("input",this._onTextEdit),this.textInputManager.updatePlane();let{domElement:i}=this.eventContext;i.removeEventListener("pointerdown",this._onMouseDownFocusIn),i.addEventListener("pointerdown",this._onMouseDown,!1),i.addEventListener("pointerup",this._onMouseUp,!1),i.addEventListener("pointermove",this._onMouseMove,!1),window.addEventListener("keydown",this._onKeyPress)}},BL=class extends Rv{constructor(e,t){super(e),this.eventManager=t,this.events=[],this.onVoice=({value:e,frequencies:t})=>{this.events.forEach(e=>{e.dispatch()})}}connect(){this.openAIRealtime=this.eventContext.sharedAssets.openAIRealtime,this.openAIRealtime&&(this.eventContext.page.traverseEntity(e=>{e.data?.events.filter(e=>"AIAssistantListener"===e.data.type&&!e.data.disabled).forEach(t=>{this.events.push(new BI(t.id,t.data,e,this.eventContext.page,this.eventContext.sharedAssets,this.eventManager))})}),this.openAIRealtime.on("voice",this.onVoice))}disconnect(){this.openAIRealtime?.off("voice",this.onVoice)}},BI=class{constructor(e,t,i,r,s,a){this.id=e,this.data=t,this.object=i,this.actions=IO(t,t.actions,r,s,a,i)}dispatch(){this.dispatchActions(this.actions)}
vendor: 1,591 bytes, line 8174
8174dispatchActions(e){e.Audio.forEach(e=>e.dispatchConditional()),e.Particles.forEach(e=>e.dispatchConditional()),e.Video.forEach(e=>e.dispatchConditional()),e.Create.forEach(e=>e.dispatch()),e.Destroy.forEach(e=>e.dispatch()),e.Reset.forEach(e=>e.dispatch()),e.Transition.forEach(e=>{e.object.currentTransitionEvent!==this&&(e.object.currentTransitionEvent=this),e.init()}),e.Transition.forEach(e=>e.play()),e.Animation.forEach(e=>e.play()),e.SwitchCamera.forEach(e=>e.play()),e.SceneTransition.forEach(e=>e.dispatch()),e.SetVariable.forEach(e=>e.checkConditions()),e.SetVariable.forEach(e=>e.dispatch()),e.DynamicVariablePlay.forEach(e=>e.dispatch()),e.ClearLocalStorage.forEach(e=>e.dispatch()),e.UserAPI.forEach(e=>e.dispatch())}},BR=class extends Rv{constructor(e,t){super(e),this.eventManager=t,this.events=[],this.onTriggerEvent=({description:e,direction:t})=>{let i=this.events.find(t=>t.data.description===e);i&&("backward"===t?i.dispatchReverse():i.dispatch())}}connect(){this.openAIRealtime=this.eventContext.sharedAssets.openAIRealtime,this.openAIRealtime&&(this.eventContext.page.traverseEntity(e=>{e.data?.events.filter(e=>"AIAssistantTrigger"===e.data.type&&!e.data.disabled).forEach(t=>{this.events.push(new Bk(t.id,t.data,e,this.eventContext.page,this.eventContext.sharedAssets,this.eventManager))})}),this.openAIRealtime.on("trigger_event",this.onTriggerEvent))}disconnect(){this.openAIRealtime?.off("trigger_event",this.onTriggerEvent)}},Bk=class{constructor(e,t,i,r,s,a){this.id=e,this.data=t,this.object=i,this.actions=IO(t,t.actions,r,s,a,i)}dispatch(){let e=this.actions;
8174e.Audio.forEach(e=>e.dispatchConditional()),e.Particles.forEach(e=>e.dispatchConditional()),e.Video.forEach(e=>e.dispatchConditional()),e.Create.forEach(e=>e.dispatch()),e.Destroy.forEach(e=>e.dispatch()),e.Reset.forEach(e=>e.dispatch()),e.Transition.forEach(e=>{e.object.currentTransitionEvent!==this&&(e.object.currentTransitionEvent=this),e.init()}),e.Transition.forEach(e=>e.play()),e.Animation.forEach(e=>e.play()),e.SwitchCamera.forEach(e=>e.play()),e.SceneTransition.forEach(e=>e.dispatch()),e.SetVariable.forEach(e=>e.checkConditions()),e.SetVariable.forEach(e=>e.dispatch()),e.DynamicVariablePlay.forEach(e=>e.dispatch()),e.ClearLocalStorage.forEach(e=>e.dispatch()),e.UserAPI.forEach(e=>e.dispatch())}dispatchReverse(){let e=this.actions;e.Transition.forEach(e=>e.reverseFromCurrent()),e.Particles.forEach(e=>e.reverseFromCurrent()),e.Animation.forEach(e=>e.reverseFromCurrent()),e.SwitchCamera.forEach(e=>e.reverseFromCurrent()),e.Create.forEach(e=>e.dispatchStop())}},BB=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=e=>{let t=window.parent!==window,i=document.documentElement.scrollHeight>document.documentElement.clientHeight||document.documentElement.scrollWidth>document.documentElement.clientWidth;(e.touches.length>1||this.preventTouchScroll||!1===t&&!1===i)&&e.preventDefault()},this.onMouseWheelPreventScroll=e=>{this.preventScroll&&e.preventDefault()},this.onMouseMove=e=>{this.eventContext.sharedAssets.mouseProperty={...this.getMousePosition(e),pressed:e.buttons>0}},this.onMouseDown=e=>{this.eventContext.sharedAssets.mouseProperty={...this.getMousePosition(e),pressed:!0}},this.onMouseUp=e=>{this.eventContext.sharedAssets.mouseProperty={...this.getMousePosition(e),pressed:!1}},this.getMousePosition=e=>{let{domRect:t}=this.eventContext,{pageX:i,pageY:r}=e.touches?.length>0?e.touches[0]:e;return{x:i-(t.left+window.scrollX),y:r-(t.top+window.scrollY)}},this.stopRaycast=e.stopRaycast,this.preventScroll=e.preventScroll,this.preventTouchScroll=e.preventTouchScroll,this.hideCursor=e.hideCursor,this.requestRender=r.requestRender}activate(e=!1){if(this.isEnabled)return;this.isEnabled=!0,this.initializeActionsDependentStates(),this.needsMouse&&(this.eventContext.domElement.addEventListener("pointermove",this.onMouseMove),this.eventContext.domElement.addEventListener("pointerdown",this.onMouseDown)),this.handlers={Spline:new R_(this.eventContext),VariableChange:new kb(this.eventContext,this.sharedVariables,this,this.needsMouse,this.needsRaycast),API:new Bb(this.eventContext,this),WEBHOOK:new B_(this.eventContext,this),AIAssistantListener:new BL(this.eventContext,this),AIAssistantTrigger:new BR(this.eventContext,this),Conditional:new RD(this.eventContext,this),Start:new ky(this.eventContext,this),Basic:new RC(this.eventContext,this,this.needsRaycast),MouseHover:new kp(this.eventContext,this),Scroll:ne
8174w kg(this.eventContext,this),Follow:new R3(this.eventContext,this),DragDrop:new RX(this.eventContext,this),LookAt:new kl(this.eventContext),Resize:new Bx(this.eventContext,this),Textfields:new BO(this.eventContext,this)};let{page:t,domElement:i}=this.eventContext;this.hideCursor&&(i.style.cursor="none"),t.traverseEntity(e=>{e.addEventListener("requestRender",this.requestRender)}),Object.values(this.handlers).forEach(e=>e.connect()),i.addEventListener("wheel",this.onMouseWheelPreventScroll),i.addEventListener("touchmove",this.onTouchMovePreventScroll),this.activateCount++,e||this.eventContext.sharedAssets.openAIRealtime?.connect()}deactivate(e=!1){if(!this.isEnabled)return;this.isEnabled=!1,this.eventContext.domElement.removeEventListener("pointermove",this.onMouseMove),this.eventContext.domElement.removeEventListener("pointerdown",this.onMouseDown),this.eventContext.domElement.removeEventListener("pointerup",this.onMouseUp),this.eventContext.sharedAssets.mouseProperty=null,this.eventContext.sharedAssets.raycastProperty=null;let{page:t,domElement:i}=this.eventContext;i.style.cursor="",Object.values(this.handlers).forEach(e=>e.disconnect()),this.controlsManager.gameControl?.disposeActions(),this.controlsManager.disconnectEvents(),t.traverseEntity(e=>{e.removeEventListener("requestRender",this.requestRender),e.destroyedInAction=!1}),i.removeEventListener("touchmove",this.onTouchMovePreventScroll),i.removeEventListener("wheel",this.onMouseWheelPreventScroll),this.animationControls.onExitPlayMode(),e||this.eventContext.sharedAssets.openAIRealtime?.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("Conditional"===i.data.type&&(i.data.ifActions.forEach(t),i.data.elseActions.forEach(t)),"Conditional"===i.data.type||"SetVariable"===i.data.type)for(let e of"Conditional"===i.data.type?i.data.condition:i.data.expression)"id"in e&&Array.isArray(e.id)&&("mouse"===e.id[0]&&(this.needsMouse=!0),"raycast"===e.id[0]&&(this.needsRaycast=!0));"DynamicVariablePlay"===i.data.type&&""!==i.data.variableId&&("Play"===i.data.mode||"PlayPause"===i.data.mode||"Toggle"===i.data.mode)&&e.setDynamicVariablePlayState(i.data.variableId,"Stopped")};this.eventContext.page.traverseEntity(e=>{if(e.data?.events.length)for(let i of e.data.events)if("VariableChange"===i.data.type&&("mouseProperty"===i.data.variableId&&(this.needsMouse=!0),"raycastProperty"===i.data.variableId&&(this.needsRaycast=!0)),"Conditional"===i.data.type)for(let e of["inActions","outActions"])i.data[e].forEach(t);else if("DragDrop"===i.data.type)for(let e of["drag","drop"])i.data.dragDropActions[e].forEach(t);else if("GameControl"===i.data.type)for(let e of["idle","move","jump","run"])i.data.gameActions[e].forEach(t);else if("Resize"===i.data.type)for(let e of i.data.breakpoints)e.data.actions.forEach(t);else"LookAt"===i.data.type||"API"===i.data.type||i.data.actions.forEach(t)})}},Bz=class{constructor(e,t,i,r,s){this._aspect=1,this.enableResponsive=!1,this._renderer=e,this._camera=t,this._frameSize=new tZ().copy(i),this._editorSize=new tZ().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||"PerspectiveCamera"!==this._camera.cameraType)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("PerspectiveCamera"===this._camera.cameraType){let t=this._frameSize.y,i=this._editorSize.y,r=this._fov;if(e&&t>i){let e=((t-1080)/1080*14+1)/100;r*=t/i*(1-e)}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())}},BN=class{get sharedAssets(){return this.shared}constructor(e,t={},i=!0){this.shared=new At(e.shared,t,!0,i),this.scene=new Lw(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 Op&&!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 Al&&e.markGeometryAsReachable(this.shared)}),this.shared.geometryCache.endGc(),this.shared.geometryCache2.endGc()}}
8174,BF=class{constructor({x:e=10,y:t=10}){this._startTime=0;let i=document.getElementById("spe-perfs");i?this.element=i:(this.element=document.createElement("div"),document.body.appendChild(this.element),this.element.style.position="absolute",this.element.style.zIndex="10000",this.element.style.fontFamily="monospace",this.element.style.background="black",this.element.style.color="white",this.element.style.padding="10px",this.element.style.opacity="0.5",this.element.style.fontSize="11px",this.element.setAttribute("id","spe-perfs")),this.element.style.left=`${e}px`,this.element.style.top=`${t}px`}dispose(){this.element.parentElement?.removeChild(this.element)}start(){this._startTime=performance.now()}end(){let e=performance.now()-this._startTime;this.element.innerHTML=e.toFixed(3)+" ms"}};function Bj(e){return e instanceof Ap?"SubdivObject":"NonParametricGeometry"===e.geometry.type?"NonParametric":"Mesh"}var BU=tS(tO(),1),BV=new tZ;function BW(e){let t=new xA(0,0,0,1);try{t.setStyle(e)}catch(e){console.error(e)}finally{return t}}var BH=class{constructor(e,{renderOnDemand:t,renderMode:i="auto",wasmPath:r}={}){this._viewportMode=1,this._viewportWidth=window.innerWidth,this._viewportHeight=window.innerHeight,this._proxyObjectCache=new Map,this._variablesCache=new Map,this._isPaused=!1,this._renderRequested=!1,this._skipRender=!1,this.time=performance.now(),this.dt=0,this.currentTAAFrame=0,this.disposed=!1,this._requestRenderAutoMode=()=>{this._skipRender=!1},this.requestRender=()=>{this._renderRequested=!0},this.render=e=>{if(this.time=e,this._lastTime&&(this.dt=this.time-this._lastTime),this._lastTime=this.time,this._perfs?.start(),!this._renderer||!this._isPaused&&("manual"===this.renderMode&&!this._renderRequested||"auto"===this.renderMode&&this._skipRender))return void this._perfs?.end();if(this._renderRequested=!1,this._skipRender=!0,this._controls&&(this._skipRender=this._controls.update(this.dt)??!1),this._eventManager&&(this._eventManager.handlers?.Start.hasVideoAction||this._eventManager.handlers?.Basic.hasVideoAction||this._eventManager.handlers?.Conditional.hasVideoAction)&&(this._skipRender=!1),this._animationControls?.update(this.dt),this._skipRender?(this.currentTAAFrame++,this.currentTAAFrame<32?this._skipRender=!1:this.currentTAAFrame=0):this.currentTAAFrame=0,this._scene?.traverseVisibleEntity(e=>{"ParticleSystem"===e.type&&(e.update(this.dt),this._skipRender=!1)}),this._scene&&this._scene.activeCamera!==this._camera&&(this._camera=this._scene.activeCamera),this._eventManager?.isEnabled&&((this._eventManager.handlers?.Follow).onAnimationFrameDamping(),(this._eventManager.handlers?.LookAt).onAnimationFrameDamping(),(this._eventManager.handlers?.DragDrop).onAnimationFrameDamping()),this._scene&&this._camera){if(this._scene.pathConstraints.applyConstraints(this._scene),this._renderer.sceneTransitionTimeRemaining>0){this._renderer.sceneTransitionTimeRemaining-=this.dt;let e=1-this._renderer.sceneTransitionTimeRemaining/this._renderer.sceneTransitionDuration;this._renderer.pipeline.sceneTransitionPass.uniforms.mixRatio.value=e,this._skipRender=!1}else this._renderer.pipeline.sceneTransitionFromTexture=null;this._renderer.renderSplineScene(this._scene,this._camera)}this.canvas.dispatchEvent(this._renderedEvent),this._perfs?.end()},this._resize=e=>{if(this._renderer){if(1===this._viewportMode&&this._frameView&&(this._frameView.frameSize=BV.set(this._viewportWidth,this._viewportHeight)),e){let e=this._viewportWidth,t=this._viewportHeight;this._renderer.setSize(e-1,t-1,!1),this._renderer.setSize(e,t,!1)}else this._renderer.setSize(this._viewportWidth,this._viewportHeight,!1);if(this._camera=this._scene?.activeCamera,this._scene?.updateViewPlaneSize(this._frameView?.frameSize?.x??this._viewportWidth,this._frameView?.frameSize?.y??this._viewportHeight,this._frameView?.enableResponsive??!1),this._camera){let e=Object.values(this._data?.frames??{})[0].preset??"fullscreen";this._frameView?.setCamera(this._camera),this._frameView?.updateCamera("fullscreen"!==e),"PerspectiveCamera"===this._camera.cameraType&&(this._camera.aspect=this._viewportWidth/this._viewportHe
8174ight),this._camera.updateProjectionMatrix()}this.eventManager&&(this.eventManager.eventContext.domRect=this.canvas.getBoundingClientRect()),this._requestRenderAutoMode()}},this._debouncedResize=uF(this._resize,10),this._onScroll=e=>{this.eventManager&&(this.eventManager.eventContext.domRect=this.canvas.getBoundingClientRect())},this.canvas=e,this.renderMode=t?"auto":i,r&&(this._wasmPath=uJ(r,"/")),this._renderedEvent=new CustomEvent("rendered",{bubbles:!0}),Object.defineProperty(this._renderedEvent,"target",{writable:!1,value:this}),window.location.search.includes("perfs")&&(this._perfs=new BF({x:10,y:10})),function(e){e.addEventListener("pointerdown",pa,!0),e.addEventListener("pointerdown",po,!0),e.addEventListener("pointermove",po,!0),e.addEventListener("pointerup",pn,!0),e.addEventListener("pointercancel",pn,!0),e.addEventListener("pointerleave",pn,!0),window.addEventListener("keydown",ph,!0),window.addEventListener("keyup",pc,!0)}(e)}async load(e,t,i){e.endsWith(".spline")?console.warn("The Spline Runtime only accepts .splinecode files that are generated from Spline export panel. The .spline files are only meant to be used by the Editor."):e.endsWith(".splinecode")||console.warn("The Spline Runtime only accepts .splinecode files that are generated from Spline export panel."),this.disposed=!1;let r=await (await fetch(e,i)).arrayBuffer();await this.start(r,{variables:t})}async start(t,{interactive:i=!0,variables:r}={}){var s,a;let o,h,c,d,u;if(this.disposed)return;let p=await Bm(t);this._data=p;let f=(o=[],p.scene.objects.traverse((e,t)=>{"Mesh"===t.type&&"NonParametricGeometry"===t.geometry.type&&void 0!==t.geometry.data.draco&&o.push(t)}),o);p.version&&(0,BU.default)(p.version,"1.10.77")>0&&console.warn("Your .splinecode file is more recent than the library. Please upgrade @splinetool/runtime to the latest version."),this._wasmPath&&this.setUIWasmUrl(`${this._wasmPath}/ui.wasm`),await Promise.all([f.length&&Bp(this._wasmPath),To(p)&&(s=this._wasmPath,MM||(MM=async function(){let t=e.A(490875),[i,r]=await Promise.all([t,fetch(`${s??"https://unpkg.com/@splinetool/[email protected]/build"}/boolean.wasm`).then(e=>e.arrayBuffer())]),a=i.default,o=await a({wasmBinary:r});MC(o)}())),(h=!1,p.scene.objects.traverse((e,t)=>{"Mesh"===t.type&&"SubdivGeometry"===t.geometry.type&&(h=!0)}),h&&function(t){if(!SF)return SH||(SH=i());async function i(){let i=e.A(469111),[r,s]=await Promise.all([i,fetch(`${t??"https://unpkg.com/@splinetool/[email protected]/build"}/process.wasm`).then(e=>e.arrayBuffer())]),a=r.default,o=await a({wasmBinary:s});Sk(o),SF=!0}}(this._wasmPath)),yK.physicsEnabled(p.scene.objects)&&(pO||(pO=async function(){let t=await e.A(397172);await t.init(),px(t)}())),AL(p)&&function(){if(EU=!0,!EW)return AI||(AI=t());async function t(){let t=await e.A(861735);EN(t),EW=!0}}(),Lh(p)&&function(){if(!Lv)return Lk||(Lk=t());async function t(){let t=await e.A(935748);Lf(t),Lv=!0}}(),(c=!1,d=[],p.scene.objects.traverse((e,t)=>{if("Page"===t.type&&void 0!==t.uiScene&&t.uiScene.objects.traverse((e,t)=>{if(void 0===t.events||!1===Array.isArray(t.events))return!0;Ek(t.events,d),c=c||d.some(e=>"Audio"===e.data.type)}),void 0===t.events||!1===Array.isArray(t.events))return!0;Ek(t.events,d),c=c||d.some(e=>"Audio"===e.data.type)}),c&&function(){if(!ER)return EB||(EB=t());async function t(){await e.A(440603),ED(void 0!==window?window:e.g),ER=!0}}()),DN(p)&&function(){if(!Dz)return DH||(DH=t());async function t(){let t=await e.A(898225);DT(t.default??t),Dz=!0}}(),(u=!1,p.scene.objects.forEach(e=>{"Page"===e.data.type&&!u&&e.data.publish.gameControlObject&&yK.traverseModuleInstances(p,e.id,(e,t,i)=>{for(let e of i)"GameControl"===e.data.type&&e.data.navmesh.enabled&&(u=!0)})}),u&&(a=this._wasmPath,py||(py=async function(){let t=e.A(533927),[i,r]=await Promise.all([t,fetch(`${a??"https://unpkg.com/@splinetool/[email protected]/build"}/navmesh.wasm`).then(e=>e.arrayBuffer())]),s=i.default,o=await s({wasmBinary:r});pv(o)}())))].filter(Boolean)),f.length&&await Bg(f),this._eventManager?.deactivate(),this._controls?.deactivate(),this._scene?.dispose();let m=new BN(p);if(m.resetPersonalCameraFromDocumentData(),this._scene=m.scene,this._sharedAssetsManager=m.sharedAssets,this._camera=this._scene.activeCamera,window.location.search.includes("merge-geometries")){let e=performance.now();!function(e,t){let i,r,s=(i={},t.traverseEntity(t=>{if(!t.visible||!(t instanceof Cf)||"Mesh"!==t.type||Array.isArray(t.material)||t.states&&Object.keys(t.states).length)return;let r=t.parent;for(;r;){if(r instanceof Cf&&t.states&&Object.keys(t.states).length)return;r=r.parent}let s=t.material.uuid,a=e.shared.materials[s];if(a){if(!g3.isMergable(a))return}else{let i=e.scene.objects.get(t.uuid)?.data;if(i&&"material"in i&&"string"!=typeof i.material){if(!g3.isMergable(i.material))return;s=g3.getHash(i.material)}}i[s]||(i[s]={});let o=i[s][Bj(t)];if(o){if(o.push(t),t.cloner)for(let e of t.cloner.children)o.push(e)}else if(i[s][Bj(t)]=[t],t.cloner)for(let e of t.cloner.children)i[s][Bj(t)].push(e)}
8174),i),a=(r=0,Object.values(s).forEach(e=>{Object.values(e).forEach(e=>{let t=e.length;t>r&&(r=t)})}),r),o=Array(a),h=0,c=Array(a),d=0,u=Array(a),p=0,f=Array(a),m=0;for(let[e,i]of Object.entries(s))for(let r of Object.values(i)){if(d=0,p=0,r.forEach(e=>{e instanceof Cf&&(c[d++]=e.geometry.clone(),u[p++]=e)}),p<2)continue;for(let e=0;e<p;e++)u[e].updateWorldMatrix(!0,!1),c[e].applyMatrix4(u[e].matrixWorld),0>u[e].matrixWorld.determinant()&&function(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}(c[e]);let i=vV(c.slice(0,d),!1);if(i){let r;"SubdivObject"===e&&console.warn("Turning subdiv object into mesh"),(r=new rK(i,u[0].material)).castShadow=u[0].castShadow,r.receiveShadow=u[0].receiveShadow,t.add(r);let a=e=>{for(let t of(m=0,e))t.children&&a(t.children),t instanceof Cf&&(Array.isArray(t.material)||s[t.material.uuid]&&s[t.material.uuid][Bj(t)]&&s[t.material.uuid][Bj(t)].length>1||(f[m++]=t));for(let e=0;e<m;e++)t.attach(f[e])};for(let e=0;e<p;e++){let t=u[e];a(t.children),o[h++]=t}}}for(let e=0;e<h;e++)o[e].removeFromParent()}(p,m.scene),console.log("Merged geometries in ",performance.now()-e," ms")}To(p)&&this._scene.traverse(e=>{Td(e)&&e.recomputeBoolean()}),this._sharedAssetsManager.setRequestRender(()=>{this._requestRenderAutoMode(),this._scene?.traverse(e=>{e instanceof AZ&&e.pendingMediaLoad&&e.update()})}),this._scene?.traverse(e=>{"ParticleSystem"===e.type&&(e.wakeUp(),e.data.autoPlay?e.start():e.stop())});let g=Object.keys(p.shared.fonts).map(e=>this._sharedAssetsManager.getFont(e).loadingPromise);if(Promise.all(g).then(()=>{m.scene.markNeedsUpdateRendererDirty(),this._requestRenderAutoMode()}),AL(p)&&function(e){if(yK.physicsEnabled(e.scene.objects))return!0;let t=!1;return e.scene.objects.traverse((e,i)=>{if(i.events){if(Array.isArray(i.events)){for(let e of i.events)if(!0!==e.data.disabled&&"GameControl"===e.data.type&&e.data.collisionEnabled){t=!0;break}}else for(let e of Object.values(i.events))if(!0!==e.disabled&&"GameControl"===e.type&&e.collisionEnabled){t=!0;break}}}),t}(p)&&await Promise.all(g),DN(p)){let e=[];this._scene.traverseEntity(t=>{(t instanceof O_||t instanceof Op)&&t.uiCanvas&&e.push(t.uiCanvas)}),await Promise.all(e.map(e=>e.promise))}if(this._scene.rewriteEventsBeforeGoToPlayMode(),Il(this._scene.activePage,this._sharedAssetsManager),!this._renderer){this._renderer=new Dl({canvas:this.canvas,antialias:!1,alpha:!0,stencil:!1,depth:!1,powerPreference:"high-performance"}),this._renderer.hdTransmission=!0===p.scene.publish.hdTransmission;let e=this._getPixelRatio(/Mobi|Android|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)?p.scene.publish.settings.web.pixelRatioMobile:p.scene.publish.settings.web.pixelRatioDesktop);if(this._renderer.setPixelRatio(e),this._renderer.pipeline.enableUIOverlay(),this._renderer.pipeline.addEventListener("smaaloaded",this._requestRenderAutoMode),p.shared.images.SplineWatermark){let e=this._sharedAssetsManager.getImage("SplineWatermark");await e.loadPromise;let t=e.getTexture(1001);this._renderer.pipeline.setWatermark(t)}}Lh(p)&&this._scene.initializeSplatViewer(),void 0!==p.scene.blueNoiseTextureData&&this._renderer.pipeline.updateBlueNoiseTexture(p.scene.blueNoiseTextureData);let v=Object.values(p.frames)[0];if(this._frameView?this._frameView.setCamera(this._camera):("fullscreen"===v.preset?(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._viewportHeight=this.canvas.parentElement.clientHeight||150,this.canvas.style.height="100%")):(this._viewportMode=2,this._viewportWidth=v.size[0],this._viewportHeight=v.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 Bz(this._renderer,this._camera,new tZ(this._viewportWidth,this._viewportHeight),new tZ(window.innerWidth,window.innerHeight)),this._frameView.enableResponsive=(v.allowResponsive??!1)&&"fullscreen"===v.preset),i){let e=new Rg(this._renderer,this.data.scene.publish,this._scene,()=>this._scene.activeCamera,this._sharedAssetsManager,this._requestRenderAutoMode,!0,v);this._scene.updateMatrixWorld(!0),this._controls=new Bn(e),this._animationControls=new Bh(this._scene,this._requestRenderAutoMode),this._eventManager=new BB(p.scene.publish,this._controls,this._animationControls,e,p.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)}),void 0!==r&&this.setVariables(r),0===this.dt&&(this.render(performance.now()),setTimeout(()=>{this._renderer?.setAnimationLoop(this.render)},0)),this._resizeObserverTimeout=setTimeout(()=>{!this._resizeObserver&&this.canvas.parentElement&&(this._resizeObserver=new ResizeObserver(()=>
8174{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(void 0!==this._data)for(let[t,i]of Object.entries(e))this.setVariable(t,i)}setVariable(e,t){let i=this._getVariableByName(e);if(!i||"dynamicVariableType"in i.data)void 0===i?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.`);else{let e=t;"number"==typeof i.data.value?e="number"==typeof t?t:"boolean"==typeof t?+(!0===t):parseFloat(t):"boolean"==typeof i.data.value?e="number"==typeof t?!!t:"boolean"==typeof t?t:"false"!==t.toLocaleLowerCase()&&!!t:"string"!=typeof i.data.value&&void 0!==i.data.value.textValue&&(e=t.toString());let r="string"==typeof e?{textValue:e}:e;this._sharedAssetsManager?.updateVariable(i.id,r),this.requestRender(),this._requestRenderAutoMode()}}getVariables(){let e={};
8174return this._data&&this._data.shared.variables.forEach(t=>{void 0===e[t.data.name]&&(e[t.data.name]=this._getVariableValue(this._sharedAssetsManager.getVariable(t.id)))}),e}getVariable(e){let t=this._getVariableByName(e);if(t){let e=this._sharedAssetsManager.getVariable(t.id);return this._getVariableValue(e)}}_getVariableValue(e){return"string"!=typeof e&&y2.isTextValue(e)?y2.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(t=>t.data.name===e);return t&&this._variablesCache.set(e,t),t}}_getPixelRatio(e){switch(e){case 0:return window.devicePixelRatio;case 1:return 1;case 2:return 2}}findObjectById(e){let t=this._scene?.getObjectByProperty("uuid",e);return this._createProxyObject(t)}findObjectByName(e){let t=this._scene?.getObjectByName(e);return this._createProxyObject(t)}getAllObjects(){let e=[];return this._scene?.traverseEntity(t=>{if(t.uuid!==mE&&!this._scene.isInvisibleObjects(t)&&!(t instanceof Op)){let i=this._createProxyObject(t);i&&e.push(i)}}),e}getSplineEvents(){return(this._eventManager?.handlers?.Spline).splineEvents}emitEvent(e,t){(this.findObjectById(t)||this.findObjectByName(t))?.emitEvent(e)}emitEventReverse(e,t){(this.findObjectById(t)||this.findObjectByName(t))?.emitEventReverse(e)}addEventListener(e,t){this.canvas.addEventListener(e,t)}removeEventListener(e,t){this.canvas.removeEventListener(e,t)}setZoom(e){this._controls?.orbitControls instanceof kQ&&this._controls?.orbitControls.setZoom(e)}get eventManager(){return this._eventManager}get controls(){return this._controls}setSize(e,t){this._viewportWidth=e,this._viewportHeight=t,this._viewportMode=2,this._resize()}setBackgroundColor(e){let t=BW(e);this._scene?.activePage.setBackgroundColor(t),this._requestRenderAutoMode()}dispose(){var e;this.disposed=!0,this._eventManager?.deactivate(),this._scene?.dispose(),this._sharedAssetsManager?.dispose(),this._proxyObjectCache.forEach(e=>{hC.unsubscribe(e)}),this._variablesCache.clear(),this._renderer?.setAnimationLoop(null),this._renderer?.dispose(),this._renderer=void 0,this._sharedAssetsManager?.dispose(),this._resizeObserver&&(this._resizeObserver.disconnect(),this._resizeObserver=void 0),void 0!==this._resizeObserverTimeout&&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),this._controls?.deactivate(),this.dt=0,(e=this.canvas).removeEventListener("pointerdown",pa,!0),e.removeEventListener("pointerdown",po,!0),e.removeEventListener("pointermove",po,!0),e.removeEventListener("pointerup",pn,!0),e.removeEventListener("pointercancel",pn,!0),e.removeEventListener("pointerleave",pn,!0),window.removeEventListener("keydown",ph,!0),window.removeEventListener("keyup",pc,!0),document.removeEventListener("scroll",this._onScroll)}get isStopped(){return this._isPaused}stop(){this._isPaused||(this._renderer?.setAnimationLoop(null),this._isPaused=!0,this._eventManager?.pause(),this._controls?.orbitControls&&(this._controls.orbitControls.enabled=!1))}play(){this._isPaused&&(this._isPaused=!1,this._eventManager?.resume(),this._controls?.orbitControls&&(this._controls.orbitControls.enabled=!0),this._renderer?.setAnimationLoop(this.render))}setGlobalEvents(e){this._eventManager?.updateUseWindowEvents(e)}get data(){return this._data}_createProxyObject(e){let t;if(!this._scene||null==e)return;if(this._proxyObjectCache.has(e.uuid))return this._proxyObjectCache.get(e.uuid);e.traverseAncestors(e=>{e instanceof Op&&(t=e.name)});let i=this._sharedAssetsManager,r={shared:i,scene:this._scene},s=t=>{if(null===t||"Base State"===t)return null;if(t&&e.data.states){let i=e.data.states.find(e=>e.data.name===t);return i?i.id:void 0}},a={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 Op||e instanceof Lw?void 0:e.parent?.uuid,emitEvent(t){e.dispatchEvent({type:"userEvent",eventName:t})},emitEventReverse(t){e.dispatchEvent({type:"userEvent",eventName:t,reverse:!0})},hide(){e.visible&&(e.visible=!1,r.shared.requestRender())},show(){e.visible||(e.visible=!0,r.shared.requestRender())},get state(){let t=e.stateSelection;if(null!==t)return e.data.states.find(({id:e})=>e===t)?.data.name},set state(l){let t;if(void 0!==l){let i="string"==typeof l?e.data.states.find(({id:e})=>e===l):e.data.states[l];if(i)t=i.id;else{let e="string"==typeof l?s(l):void 0;e&&(t=e)}}e.changeSelectedState(t??null,r),e.currentState=t??null,e.dispatchEvent({type:"completeState",state:t??null}),r.shared.requestRender()},transition(t){let r=this,a,o=xM.timeline({autoplay:t.autoPlay??!0}),h={transition({from:t,to:h,duration:c,delay:d,...u}){let p=s(t);void 0===p&&(p=a);let f=s(h);a=f;let m=new Im(e,p,f,{state:f,repeat:0,delay:d??0,delayDirection:"start-once",direction:"normal",duration:c??1e3,...u,...6===u.easing?gc.defaultData:5===u.easing?gE.defaultData:{}},i,!1);return o.add({...m.params,begin:()=>{(t&&p||"Base State"===t&&!p)&&(r.state=p??void 0)},complete:()=>{r.state=f??void 0}},o.duration),this},play(){return o.play(),this},pause(){return o.pause(),this},reset(){return o.reset(),this},seek(e){return o.seek(e),this}};return h.transition(t),h},set color(l){let t=BW(l);
8174if(DE.is(e)){e.color=t;return}if("Mesh"!==e.type||!("material"in e)||!(e instanceof Ai))return;let i={r:t.r,g:t.g,b:t.b,a:t.a},s=Array.isArray(e.material)?e.material[0]:e.material,a=s.data.layers.find(e=>"color"===e.data.type)?.id;a&&s.updateByOp({type:0,path:["layers",a],props:{color:{...i}}},s.data,r)}},o=hC(a,(t,i)=>{"object"!=typeof e[t]&&Object.getOwnPropertyDescriptor(e,t)?.writable&&(e[t]=i),this._requestRenderAutoMode(),e.updateMatrix()});return this._proxyObjectCache.set(e.uuid,o),o}setUIWasmUrl(e){MP.skiaWasmUrl=e}pauseGameControls(){this._eventManager?.controlsManager.gameControl?.pause()}resumeGameControls(){this._eventManager?.controlsManager.gameControl?.resume()}async swapGeometry(e,t){let i;if("string"==typeof t)if(t.endsWith(".splinegeometry"))i=new Uint8Array(await (await fetch(t)).arrayBuffer());else throw Error("Only .splinegeometry format is supported");else i=t;let r=m_.deserialize(i),s="data"in r&&void 0!==r.data.draco;s&&await Bp(this._wasmPath);let a=this._scene?.getObjectByProperty("uuid",e)??this._scene?.getObjectByName(e);if(!a)return void console.warn(`Object ${e} not found`);if("Mesh"!==a.data.type||!(a instanceof Ai))return void console.warn(`Object ${e} is not a mesh`);let o={...a.data,geometry:r};for(let e of(s&&await Bg([o]),a.updateByOp({type:0,path:[],props:{geometry:o.geometry}},o,{shared:this._sharedAssetsManager,scene:this._scene},!1),a.data.states)){let t={...e.data};a.states||(a.states={}),a.states[e.id]=yG.patch(o,t)}return i}},BG=e.i(351853);let Bq=[],BX={width:"100%",height:"100%"},BY=(0,tp.forwardRef)(function({className:e,children:t,debounceTime:i=300,ignoreDimensions:r=Bq,parentSizeStyles:s,enableDebounceLeadingCall:a=!0,resizeObserverPolyfill:o,...h},c){var d;let u=(0,tp.useRef)(null),p=(0,tp.useRef)(0),[f,m]=(0,tp.useState)({width:0,height:0,top:0,left:0}),g=(0,tp.useMemo)(()=>{let e=Array.isArray(r)?r:[r];return(0,BG.default)(t=>{m(i=>Object.keys(i).filter(e=>i[e]!==t[e]).every(t=>e.includes(t))?i:t)},i,{leading:a})},[i,a,r]);return(0,tp.useEffect)(()=>{let e=new(o||window.ResizeObserver)(e=>{e.forEach(e=>{let{left:t,top:i,width:r,height:s}=(null==e?void 0:e.contentRect)??{};p.current=window.requestAnimationFrame(()=>{g({width:r,height:s,top:i,left:t})})})});return u.current&&e.observe(u.current),()=>{window.cancelAnimationFrame(p.current),e.disconnect(),g.cancel()}},[g,o]),(0,td.jsx)("div",{style:{...BX,...s},ref:(d=[c,u],e=>{d.forEach(t=>{"function"==typeof t?t(e):null!=t&&(t.current=e)})}),className:e,...h,children:t({...f,ref:u.current,resize:g})})}),BQ=(0,tp.forwardRef)(({scene:e,style:t,onSplineMouseDown:i,onSplineMouseUp:r,onSplineMouseHover:s,onSplineKeyDown:a,onSplineKeyUp:o,onSplineStart:h,onSplineLookAt:c,onSplineFollow:d,onSplineScroll:u,onLoad:p,renderOnDemand:f=!0,wasmPath:m,children:g,...v},y)=>{let x=(0,tp.useRef)(null),[b,w]=(0,tp.useState)(!0),[_,S]=(0,tp.useState)();if(_)throw _;return(0,tp.useEffect)(()=>{let t;w(!0);let g=[{name:"mouseDown",cb:i},{name:"mouseUp",cb:r},{name:"mouseHover",cb:s}
8174,{name:"keyDown",cb:a},{name:"keyUp",cb:o},{name:"start",cb:h},{name:"lookAt",cb:c},{name:"follow",cb:d},{name:"scroll",cb:u}];return x.current&&(t=new BH(x.current,{renderOnDemand:f,wasmPath:m}),(async function(){for(let i of(await t.load(e),g))i.cb&&t.addEventListener(i.name,i.cb);w(!1),null==p||p(t)})().catch(e=>{S(e)})),()=>{for(let e of g)e.cb&&t.removeEventListener(e.name,e.cb);t.dispose()}},[e]),(0,td.jsx)(BY,{ref:y,parentSizeStyles:{overflow:"hidden",...t},debounceTime:50,...v,children:()=>(0,td.jsxs)(td.Fragment,{children:[b&&g,(0,td.jsx)("canvas",{ref:x,style:{display:b?"none":"block"}})]})})});var BZ=e.i(47997);e.s(["default",0,function({url:e,className:t}){return e?(0,td.jsx)("div",{className:(0,tu.default)(BZ.default.Animation,t),children:(0,td.jsx)(BQ,{scene:e,wasmPath:"./",renderOnDemand:!0})}):null}],588610)},968937,e=>{e.v({CopyBlock:"HeroAnimatedCopy-module-scss-module__6VK4WW__CopyBlock",Outer:"HeroAnimatedCopy-module-scss-module__6VK4WW__Outer"})},264452,e=>{e.v({AnimatedWord:"HeroAnimatedH1-module-scss-module__EM_16q__AnimatedWord",WordContainer:"HeroAnimatedH1-module-scss-module__EM_16q__WordContainer"})},545178,e=>{e.v({Animation:"Hero-module-scss-module__hGO3iW__Animation",BackgroundImage:"Hero-module-scss-module__hGO3iW__BackgroundImage",BackgroundVideo:"Hero-module-scss-module__hGO3iW__BackgroundVideo",Buttons:"Hero-module-scss-module__hGO3iW__Buttons",Copy:"Hero-module-scss-module__hGO3iW__Copy",Cutout:"Hero-module-scss-module__hGO3iW__Cutout",HasAnimation:"Hero-module-scss-module__hGO3iW__HasAnimation",HasMounted:"Hero-module-scss-module__hGO3iW__HasMounted",Hero:"Hero-module-scss-module__hGO3iW__Hero",Logo:"Hero-module-scss-module__hGO3iW__Logo",Main:"Hero-module-scss-module__hGO3iW__Main",MistGreen:"Hero-module-scss-module__hGO3iW__MistGreen",NoAnimation:"Hero-module-scss-module__hGO3iW__NoAnimation",NoBG:"Hero-module-scss-module__hGO3iW__NoBG",NoBg:"Hero-module-scss-module__hGO3iW__NoBg",NoButtons:"Hero-module-scss-module__hGO3iW__NoButtons",Outer:"Hero-module-scss-module__hGO3iW__Outer",TitleCont:"Hero-module-scss-module__hGO3iW__TitleCont",White:"Hero-module-scss-module__hGO3iW__White"})},588278,e=>{"use strict";var t=e.i(395633),i=e.i(131173),r=e.i(7284),s=e.i(378081),a=e.i(559229),o=e.i(588610),h=e.i(170586),c=e.i(389264),d=e.i(792668),u=e.i(440855),p=e.i(270744),f=e.i(968937);function m({copy:e,activeIndex:i}){return(0,t.jsx)("div",{className:f.default.Outer,children:e.map((e,r)=>{let s=i===r,a=function(e){let t,i=[],r=/(<[^>]+>)|([^<]+)/g;for(;null!==(t=r.exec(e));)t[1]?i.push({type:"tag",content:t[1]}):t[2]&&i.push({type:"text",content:t[2]});return i}(e),o=0;return(0,t.jsx)("p",{className:f.default.CopyBlock,children:a.map((e,i)=>{if("tag"===e.type)return(0,t.jsx)("span",{dangerouslySetInnerHTML:{__html:e.content}},i);{let r=e.content.split(""),a=o;return o+=r.length,r.map((e,r)=>(0,t.jsx)(p.motion.span,{initial:!1,animate:{opacity:+!!s},transition:{duration:.1,delay:s?.005*(a+r):0,ease:"linear"},children:e},`${i}-${r}`))}})},r)})})}var g=e.i(264452);function v({words:e,activeIndex:r}){let s=(0,i.useRef)([]),[a,o]=(0,i.useState)(180);return(0,i.useEffect)(()=>{let e=s.current[r];o(e?.offsetWidth||0)},[r]),(0,t.jsx)("div",{className:g.default.AnimatedWord,style:{width:a},children:e.map((e,i)=>{let a=r===i;return(0,t.jsx)(p.motion.div,{className:g.default.WordContainer,ref:e=>{s.current[i]=e},children:e.split("").map((e,i)=>(0,t.jsx)(p.motion.span,{initial:!1,animate:{opacity:+!!a,x:a?0:-10},transition:{duration:.3,delay:.03*i,ease:"easeOut"},children:e},i))},i)})})}function y({title:e,activeIndex:s,className:a}){let o=e.split(" ").map((e,r)=>{let a=e+r;if(!(e.includes("[[")&&e.includes("]]")))return(0,t.jsxs)(i.Fragment,{children:[e," "]},a);{let[r,o]=e.split("]]"),h=(r||"").replace("[[","").replace("]]","").split("|");return(0,t.jsxs)(i.Fragment,{children:[(0,t.jsx)(v,{words:h,activeIndex:s}),o||" "]},a)}});return(0,t.jsx)("h1",{className:(0,r.default)(a,g.default.Outer),children:o})}var x=e.i(545178);e.s(["default",0,function({title:e,logo:p,copy:f,toggleableCopy:g,buttons:v,animationFile:b,background:w,backgroundImage:_,backgroundVideo:S}){let C,[M,E]=(0,i.useState)(!1);(0,i.useEffect)(()=>{setTimeout(()=>{E(!0)},200)},[]);let A=(0,a.useIsMobile)(),T=b?.asset?.url,P="image"===w&&_,D="video"===w&&S?.file,O=e&&e.includes("[["),L=g&&g.length>0&&O,[I,R]=(0,i.useState)(0);return(0,t.jsx)("section",{className:(0,r.default)(x.default.Hero,M&&x.default.HasMounted),children:(0,t.jsxs)("div",{className:(0,r.default)(x.default.Cont,"container"),children:[(0,t.jsxs)("div",{className:(0,r.default)(x.default.Outer,{[x.default.HasAnimation]:T,[x.default.NoBg]:P||D,[x.default.MistGreen]:"mist-green"===w}),children:[(0,t.jsxs)("div",{className:(0,r.default)(x.default.Main,"mist-green"===w&&x.default.MistGreen,!v?.length&&x.default.NoButtons,!T&&x.default.NoAnimation),children:[(0,t.jsxs)("div",{className:x.default.TitleCont,children:[p&&(0,t.jsx)("div",{className:x.default.Logo,children:(0,t.jsx)(d.default,{image:p,contain:!0})}),e&&(C=(0,r.default)((D||P)&&x.default.White),O?(0,t.jsx)(y,{title:e,activeIndex:I,className:C}):(0,t.jsx)("h1",{className:C,dangerouslySetInnerHTML:{__html:e}}))]}),(f||L)&&(0,t.jsx)("div",{className:(0,r.default)(x.default.Copy,"smallCaps",(D||P)&&x.default.White),children:L?(0,t.jsx)(m,{copy:g,activeIndex:I}):(0,t.jsx)(c.default,{copy:f,size:"small"})}
8174),P&&(0,t.jsx)("div",{className:x.default.BackgroundImage,children:(0,t.jsx)(d.default,{image:_,priority:!0})}),D&&(0,t.jsx)("div",{className:x.default.BackgroundVideo,children:(0,t.jsx)(u.default,{video:S.file,darken:!0})})]}),T&&!A&&(0,t.jsx)("div",{className:x.default.Animation,children:(0,t.jsx)(o.default,{url:b?.asset?.url})}),v&&v?.length>0?(0,t.jsx)("div",{className:x.default.Buttons,children:v?.map((e,t)=>{let r=(e?.linkType==="internal"||e?.linkType==="external")&&(0,s.getSanityLink)(e)||null;return(0,i.createElement)(h.default,{...r,transparent:!0,key:t,handleMouseEnter:()=>R(t),forceHoverState:!!(O&&I===t)})})}):null,(0,t.jsx)("div",{className:x.default.Cutout})]}),T&&A&&(0,t.jsx)("div",{className:x.default.Animation,children:(0,t.jsx)(o.default,{url:b?.asset?.url})})]})})}],588278)},829454,e=>{e.v({Intro:"Intro-module-scss-module__KNXHba__Intro",Logo:"Intro-module-scss-module__KNXHba__Logo",Pretitle:"Intro-module-scss-module__KNXHba__Pretitle"})},616827,e=>{"use strict";var t=e.i(395633),i=e.i(7284),r=e.i(389264),s=e.i(470989),a=e.i(792668),o=e.i(829454);e.s(["default",0,function({preTitle:e,title:h,copy:c,plainCopy:d,logo:u,logoLink:p}){return(0,t.jsxs)("div",{className:o.default.Intro,children:[e&&(0,t.jsx)("p",{className:(0,i.default)(o.default.Pretitle,"preTitle"),children:e}),u&&(0,t.jsx)("div",{className:o.default.Logo,children:p?(0,t.jsx)(s.default,{href:p,children:(0,t.jsx)(a.default,{image:u})}):(0,t.jsx)(a.default,{image:u})}),h&&(0,t.jsx)("h4",{className:o.default.Title,dangerouslySetInnerHTML:{__html:h}}),c&&(0,t.jsx)("div",{className:o.default.Copy,children:(0,t.jsx)(r.default,{copy:c,size:"small"})}),d&&(0,t.jsx)("div",{className:o.default.Copy,dangerouslySetInnerHTML:{__html:d}})]})}])},520687,e=>{e.v({Cont:"CtaGrid-module-scss-module__i2rOPW__Cont",CtaGrid:"CtaGrid-module-scss-module__i2rOPW__CtaGrid",Image:"CtaGrid-module-scss-module__i2rOPW__Image",Info:"CtaGrid-module-scss-module__i2rOPW__Info",Intro:"CtaGrid-module-scss-module__i2rOPW__Intro",Item:"CtaGrid-module-scss-module__i2rOPW__Item",ItemCopy:"CtaGrid-module-scss-module__i2rOPW__ItemCopy",ItemTitle:"CtaGrid-module-scss-module__i2rOPW__ItemTitle",Items:"CtaGrid-module-scss-module__i2rOPW__Items"})},183102,e=>{"use strict";var t=e.i(131173),i=e.i(225578);let r={some:0,all:1};var s=e.i(559229);e.s(["AnimatedElement",0,({children:e,className:a="",delay:o=0,element:h="div",dangerouslySetInnerHTML:c=null,style:d={},duration:u})=>{let p=(0,t.useRef)(null),f=(0,s.useIsMobile)(),[m,g]=(0,t.useState)(!1),v=function(e,{root:s,margin:a,amount:o,once:h=!1,initial:c=!1}={}){let[d,u]=(0,t.useState)(c);return(0,t.useEffect)(()=>{if(!e.current||h&&d)return;let t={root:s&&s.current||void 0,margin:a,amount:o};return function(e,t,{root:s,margin:a,amount:o="some"}={}){let h=(0,i.resolveElements)(e),c=new WeakMap,d=new IntersectionObserver(e=>{e.forEach(e=>{let i=c.get(e.target);if(!!i!==e.isIntersecting)if(e.isIntersecting){let i=t(e.target,e);
8174"function"==typeof i?c.set(e.target,i):d.unobserve(e.target)}else"function"==typeof i&&(i(e),c.delete(e.target))})},{root:s,rootMargin:a,threshold:"number"==typeof o?o:r[o]});return h.forEach(e=>d.observe(e)),()=>d.disconnect()}(e.current,()=>(u(!0),h?void 0:()=>u(!1)),t)},[s,e,a,h,o]),d}(p,{once:!0});return(0,t.useEffect)(()=>{setTimeout(()=>{v&&g(!0)},100)},[v]),t.default.createElement(h,{className:`${a} AnimateDiv ${m?"Visible":""}`,ref:p,style:{...d,transitionDuration:u?`${u}s`:"0.6s",transitionDelay:!f&&o?`${o+.3}s`:"0s"},...c?{dangerouslySetInnerHTML:c}:{children:e}})}],183102)},389836,e=>{"use strict";var t=e.i(395633),i=e.i(7284),r=e.i(378081),s=e.i(389264),a=e.i(470989),o=e.i(170586),h=e.i(792668),c=e.i(616827),d=e.i(520687),u=e.i(559229),p=e.i(183102);e.s(["default",0,function({title:e,copy:f,logo:m,items:g}){let v=(0,u.useIsMobile)();return(0,t.jsx)("section",{className:d.default.CtaGrid,children:(0,t.jsxs)("div",{className:(0,i.default)(d.default.Cont,"container"),children:[(0,t.jsx)("div",{className:d.default.Intro,children:(0,t.jsx)(c.default,{logo:m,title:e,copy:f})}),(0,t.jsx)("div",{className:d.default.Items,children:g?.map((e,c)=>{let{title:u,copy:f,link:m,image:g}=e||{},y=(m?.linkType==="internal"||m?.linkType==="external")&&(0,r.getSanityLink)(m)||null;return(0,t.jsx)(p.AnimatedElement,{element:"div",className:d.default.Item,delay:.05*c,children:(0,t.jsxs)(a.default,{href:y?.url||"#",children:[u&&(0,t.jsx)("div",{className:(0,i.default)(d.default.ItemTitle,"smallCaps"),dangerouslySetInnerHTML:{__html:u}}),g&&(0,t.jsx)("div",{className:d.default.Image,children:(0,t.jsx)(h.default,{image:g})}),(0,t.jsxs)("div",{className:d.default.Info,children:[f&&(0,t.jsx)("div",{className:d.default.ItemCopy,children:(0,t.jsx)(s.default,{copy:f,size:v?"xsmall":"xxsmall"})}),y?(0,t.jsx)(o.default,{title:y?.title,transparent:!0,noArrow:!0,black:0!==c,white:0===c}):null]})]})},c)})})]})})}])},949518,(e,t,i)=>{e.e,function(e){"use strict";var t=function(){return(t=Object.assign||function(e){for(var t,i=1,r=arguments.length;i<r;i++)for(var s in t=arguments[i])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e}).apply(this,arguments)};e.CountUp=function(){function e(e,i,r){var s=this;this.endVal=i,this.options=r,this.version="2.9.0",this.defaults={startVal:0,decimalPlaces:0,duration:2,useEasing:!0,useGrouping:!0,useIndianSeparators:!1,smartEasingThreshold:999,smartEasingAmount:333,separator:",",decimal:".",prefix:"",suffix:"",enableScrollSpy:!1,scrollSpyDelay:200,scrollSpyOnce:!1},this.finalEndVal=null,this.useEasing=!0,this.countDown=!1,this.error="",this.startVal=0,this.paused=!0,this.once=!1,this.count=function(e){s.startTime||(s.startTime=e);var t=e-s.startTime;s.remaining=s.duration-t,s.useEasing?s.countDown?s.frameVal=s.startVal-s.easingFn(t,0,s.startVal-s.endVal,s.duration):s.frameVal=s.easingFn(t,s.startVal,s.endVal-s.startVal,s.duration):s.frameVal=s.startVal+(s.endVal-s.startVal)*(t/s.duration);var i=s.countDown?s.frameVal<s.endVal:s.frameVal>s.endVal;s.frameVal=i?s.endVal:s.frameVal,s.frameVal=Number(s.frameVal.toFixed(s.options.decimalPlaces)),s.printValue(s.frameVal),t<s.duration?s.rAF=requestAnimationFrame(s.count):null!==s.finalEndVal?s.update(s.finalEndVal):s.options.onCompleteCallback&&s.options.onCompleteCallback()},this.formatNumber=function(e){var t,i,r,a=(Math.abs(e).toFixed(s.options.decimalPlaces)+"").split(".");if(t=a[0],i=a.length>1?s.options.decimal+a[1]:"",s.options.useGrouping){r="";for(var o=3,h=0,c=0,d=t.length;c<d;++c)s.options.useIndianSeparators&&4===c&&(o=2,h=1),0!==c&&h%o==0&&(r=s.options.separator+r),h++,r=t[d-c-1]+r;t=r}return s.options.numerals&&s.options.numerals.length&&(t=t.replace(/[0-9]/g,function(e){return s.options.numerals[+e]}),i=i.replace(/[0-9]/g,function(e){return s.options.numerals[+e]})),(e<0?"-":"")+s.options.prefix+t+i+s.options.suffix},this.easeOutExpo=function(e,t,i,r){return i*(1-Math.pow(2,-10*e/r))*1024/1023+t},this.options=t(t({},this.defaults),r),this.formattingFn=this.options.formattingFn?this.options.formattingFn:this.formatNumber,this.easingFn=this.options.easingFn?this.options.easingFn:this.easeOutExpo,this.el="string"==typeof e?document.getElementById(e):e,i=null==i?this.parse(this.el.
8174innerHTML):i,this.startVal=this.validateValue(this.options.startVal),this.frameVal=this.startVal,this.endVal=this.validateValue(i),this.options.decimalPlaces=Math.max(this.options.decimalPlaces),this.resetDuration(),this.options.separator=String(this.options.separator),this.useEasing=this.options.useEasing,""===this.options.separator&&(this.options.useGrouping=!1),this.el?this.printValue(this.startVal):this.error="[CountUp] target is null or undefined","u">typeof window&&this.options.enableScrollSpy&&(this.error?console.error(this.error,e):(window.onScrollFns=window.onScrollFns||[],window.onScrollFns.push(function(){return s.handleScroll(s)}),window.onscroll=function(){window.onScrollFns.forEach(function(e){return e()})},this.handleScroll(this)))}return e.prototype.handleScroll=function(e){if(e&&window&&!e.once){var t=window.innerHeight+window.scrollY,i=e.el.getBoundingClientRect(),r=i.top+window.pageYOffset,s=i.top+i.height+window.pageYOffset;s<t&&s>window.scrollY&&e.paused?(e.paused=!1,setTimeout(function(){return e.start()},e.options.scrollSpyDelay),e.options.scrollSpyOnce&&(e.once=!0)):(window.scrollY>s||r>t)&&!e.paused&&e.reset()}},e.prototype.determineDirectionAndSmartEasing=function(){var e=this.finalEndVal?this.finalEndVal:this.endVal;if(this.countDown=this.startVal>e,Math.abs(e-this.startVal)>this.options.smartEasingThreshold&&this.options.useEasing){this.finalEndVal=e;var t=this.countDown?1:-1;this.endVal=e+t*this.options.smartEasingAmount,this.duration=this.duration/2}else this.endVal=e,this.finalEndVal=null;null!==this.finalEndVal?this.useEasing=!1:this.useEasing=this.options.useEasing},e.prototype.start=function(e){this.error||(this.options.onStartCallback&&this.options.onStartCallback(),e&&(this.options.onCompleteCallback=e),this.duration>0?(this.determineDirectionAndSmartEasing(),this.paused=!1,this.rAF=requestAnimationFrame(this.count)):this.printValue(this.endVal))},e.prototype.pauseResume=function(){this.paused?(this.startTime=null,this.duration=this.remaining,this.startVal=this.frameVal,this.determineDirectionAndSmartEasing(),this.rAF=requestAnimationFrame(this.count)):cancelAnimationFrame(this.rAF),this.paused=!this.paused},e.prototype.reset=function(){cancelAnimationFrame(this.rAF),this.paused=!0,this.resetDuration(),this.startVal=this.validateValue(this.options.startVal),this.frameVal=this.startVal,this.printValue(this.startVal)},e.prototype.update=function(e){cancelAnimationFrame(this.rAF),this.startTime=null,this.endVal=this.validateValue(e),this.endVal!==this.frameVal&&(this.startVal=this.frameVal,null==this.finalEndVal&&this.resetDuration(),this.finalEndVal=null,this.determineDirectionAndSmartEasing(),this.rAF=requestAnimationFrame(this.count))},e.prototype.printValue=function(e){var t;if(this.el){var i=this.formattingFn(e);(null==(t=this.options.plugin)?void 0:t.render)?this.options.plugin.render(this.el,i):"INPUT"===this.el.tagName?this.el.value=i:"text"===this.el.tagName||"tspan"===this.el.tagName?this.el.textContent=i:this.el.innerHTML=i}},e.prototype.ensureNumber=function(e){return"number"==typeof e&&!isNaN(e)},e.prototype.validateValue=function(e){var t=Number(e);return this.ensureNumber(t)?t:(this.error="[CountUp] invalid start or end value: ".concat(e),null)},e.prototype.resetDuration=function(){this.startTime=null,this.duration=1e3*Number(this.options.duration),this.remaining=this.duration},e.prototype.parse=function(e){var t=function(e){return e.replace(/([.,'  ])/g,"\\$1")},i=t(this.options.separator),r=t(this.options.decimal);return parseFloat(e.replace(RegExp(i,"g"),"").replace(RegExp(r,"g"),"."))},e}()}(i)},488265,(e,t,i)=>{"use strict";Object.defineProperty(i,"__esModule",{value:!0});var r=e.r(131173),s=e.r(949518);function a(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,r)}return i}function o(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?a(Object(i),!0).forEach(function(t){!function(e,t,i){var r;(t="symbol"==typeof(r=function(e,t){if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var r=i.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(t,"string"))?r:String(r))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i}(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):a(Object(i)).forEac
8174h(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}function h(){return(h=Object.assign.bind()).apply(this,arguments)}function c(e,t){if(null==e)return{};var i,r,s=function(e,t){if(null==e)return{};var i,r,s={},a=Object.keys(e);for(r=0;r<a.length;r++)i=a[r],t.indexOf(i)>=0||(s[i]=e[i]);return s}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)i=a[r],!(t.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(s[i]=e[i])}return s}function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,r=Array(t);i<t;i++)r[i]=e[i];return r}var u="u">typeof window&&void 0!==window.document&&void 0!==window.document.createElement?r.useLayoutEffect:r.useEffect;function p(e){var t=r.useRef(e);return u(function(){t.current=e}),r.useCallback(function(){for(var e=arguments.length,i=Array(e),r=0;r<e;r++)i[r]=arguments[r];return t.current.apply(void 0,i)},[])}var f=function(e,t){var i=t.decimal,r=t.decimals,a=t.duration,o=t.easingFn,h=t.end,c=t.formattingFn,d=t.numerals,u=t.prefix,p=t.separator,f=t.start,m=t.suffix,g=t.useEasing,v=t.useGrouping,y=t.useIndianSeparators,x=t.enableScrollSpy,b=t.scrollSpyDelay,w=t.scrollSpyOnce,_=t.plugin;return new s.CountUp(e,h,{startVal:f,duration:a,decimal:i,decimalPlaces:r,easingFn:o,formattingFn:c,numerals:d,separator:p,prefix:u,suffix:m,plugin:_,useEasing:g,useIndianSeparators:y,useGrouping:v,enableScrollSpy:x,scrollSpyDelay:b,scrollSpyOnce:w})},m=["ref","startOnMount","enableReinitialize","delay","onEnd","onStart","onPauseResume","onReset","onUpdate"],g={decimal:".",separator:",",delay:null,prefix:"",suffix:"",duration:2,start:0,decimals:0,startOnMount:!0,enableReinitialize:!0,useEasing:!0,useGrouping:!0,useIndianSeparators:!1},v=function(e){var t=Object.fromEntries(Object.entries(e).filter(function(e){return void 0!==(function(e){if(Array.isArray(e))return e}(e)||function(e){var t=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var i,r,s,a,o=[],h=!0,c=!1;try{s=(t=t.call(e)).next,!1;for(;!(h=(i=s.call(t)).done)&&(o.push(i.value),2!==o.length);h=!0);}catch(e){c=!0,r=e}finally{try{if(!h&&null!=t.return&&(a=t.return(),Object(a)!==a))return}finally{if(c)throw r}}return o}}(e)||function(e){if(e){if("string"==typeof e)return d(e,2);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(e);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return d(e,2)}}(e)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())[1]})),i=r.useMemo(function(){return o(o({},g),t)},[e]),s=i.ref,a=i.startOnMount,h=i.enableReinitialize,u=i.delay,v=i.onEnd,y=i.onStart,x=i.onPauseResume,b=i.onReset,w=i.onUpdate,_=c(i,m),S=r.useRef(),C=r.useRef(),M=r.useRef(!1),E=p(function(){return f("string"==typeof s?s:s.current,_)}),A=p(function(e){var t=S.current;if(t&&!e)return t;var i=E();return S.current=i,i}),T=p(function(){var e=function(){return A(!0).start(function(){null==v||v({pauseResume:P,reset:D,start:L,update:O})})};u&&u>0?C.current=setTimeout(e,1e3*u):e(),null==y||y({pauseResume:P,reset:D,update:O})}),P=p(function(){A().pauseResume(),null==x||x({reset:D,start:L,update:O})}),D=p(function(){A().el&&(C.current&&clearTimeout(C.current),A().reset(),null==b||b({pauseResume:P,start:L,update:O}))}),O=p(function(e){A().update(e),null==w||w({pauseResume:P,reset:D,start:L})}),L=p(function(){D(),T()}),I=p(function(e){a&&(e&&D(),T())});return r.useEffect(function(){M.current?h&&I(!0):(M.current=!0,I())},[h,M,I,u,e.start,e.suffix,e.prefix,e.duration,e.separator,e.decimals,e.decimal,e.formattingFn]),r.useEffect(function(){return function(){D()}},[D]),{start:L,pauseResume:P,reset:D,update:O,getCountUp:A}},y=["className","redraw","containerProps","children","style"];i.default=function(e){var t=e.className,i=e.redraw,s=e.containerProps,a=e.children,d=e.style,u=c(e,y),f=r.useRef(null),m=r.useRef(!1),g=v(o(o({},u),{},{ref:f,startOnMount:"function"!=typeof a||0===e.delay,enableReinitialize:!1})),x=g.start,b=g.reset,w=g.update,_=g.pauseResume,S=g.getCountUp,C=p(function(){x()}),M=p(function(t){e.preserveValue||b(),w(t)}),E=p(function(){"function"!=typeof e.children||f.current instanceof Element?S():console.error('Couldn\'t find attached element to hook the CountUp instance into! Try to attach "containerRef" from the render prop to a an Element, eg. <span ref={containerRef} />.')});r.useEffect(function(){E()},[E]),r.useEffect(function(){m.current&&M(e.end)},[e.end,M]);var A=i&&e;return(r.useEffect(function(){i&&m.current&&C()},[C,i,A]),r.useEffect(function(){!i&&m.current&&C()},[C,i,e.start,e.suffix,e.prefix,e.duration,e.separator,e.decimals,e.decimal,e.className,e.formattingFn]),r.useEffect(function(){m.current=!0},[]),"function"==typeof a)?a({countUpRef:f,start:x,reset:b,update:w,pauseResume:_,getCountUp:S}):r.createElement("span",h({className:t,ref:f,style:d},s),void 0!==e.start?S().formattingFn(e.start):"")},i.useCountUp=v},703001,e=>{e.v({BgImage:"Stats-module-scss-module__AegcEa__BgImage",Buttons:"Stats-module-scss-module__AegcEa__Buttons",Caption:"Stats-module-scss-module__AegcEa__Caption",Cont:"Stats-module-scss-module__AegcEa__Cont",Copy:"Stats-module-scss-module__AegcEa__Copy",Cutout:"Stats-module-scss-module__AegcEa__Cutout",FixedStat:"Stats-module-scss-module__AegcEa__FixedStat",Grid:"Stats-module-scss-module__AegcEa__Grid",Intro:"Stats-module-scss-module__AegcEa__Intro",Main:"Stats-module-scss-module__AegcEa__Main",Number:"Stats-module-scss-module__AegcEa__Number",Stat:"Stats-module-scss-module__AegcEa__Stat",StatCopy:"Stats-module-scss-module__AegcEa__StatCopy",Stats:"Stats-module-scss-module__AegcEa__Stats",TwoCol:"Stats-module-scss-module__AegcEa__TwoCol"})},632374,e=>{"use strict";var t=e.i(395633),i=e.i(7284),r=e.i(488265),s=e.i(703001);e.s(["default",0,function({stat:e}){let{stat:a,prefix:o,suffix:h}=e||{};return a?(0,t.jsx)("div",{className:(0,i.default)(s.default.Number,"smallCaps"),children:(0,t.jsx)(r.default,{end:a,duration:5,prefix:o||"",suffix:h||"",enableScrollSpy:!0})}):null}])},329316,404204,e=>{"use strict";let t,i;var r=e.i(813219),s=e.i(348367),a=e.i(131173),o=e.i(175602),h=e.i(176014);function c(e,t){let i,r=()=>{let{currentTime:r}=t,s=(null===r?0:r.value)/100;i!==s&&e(s),i=s};return h.frame.preUpdate(r,!0),()=>(0,h.cancelFrame)(r)}var d=e.i(645816),u=e.i(5421),p=e.i(225578);let f=new WeakMap,m=(e,t,i)=>(r,s)=>s&&s[0]?s[0][e+"Size"]:(0,u.isSVGElement)(r)&&"getBBox"in r?r.getBBox()[t]:r[i],g=m("inline","width","offsetWidth"),v=m("block","height","offsetHeight");function y({target:e,borderBoxSize:t}){f.get(e)?.forEach(i=>
8174{i(e,{get width(){return g(e,t)},get height(){return v(e,t)}})})}function x(e){e.forEach(y)}let b=new Set;var w=e.i(747113),_=e.i(795153);let S=()=>({current:0,offset:[],progress:0,scrollLength:0,targetOffset:0,targetLength:0,containerLength:0,velocity:0}),C={x:{length:"Width",position:"Left"},y:{length:"Height",position:"Top"}};function M(e,t,i,r){let s=i[t],{length:a,position:o}=C[t],h=s.current,c=i.time;s.current=e[`scroll${o}`],s.scrollLength=e[`scroll${a}`]-e[`client${a}`],s.offset.length=0,s.offset[0]=0,s.offset[1]=s.scrollLength,s.progress=(0,w.progress)(0,s.scrollLength,s.current);let d=r-c;s.velocity=d>50?0:(0,_.velocityPerSecond)(s.current-h,d)}e.i(103308);var E=e.i(682505),A=e.i(805331),T=e.i(483032),P=e.i(443390);let D={start:0,center:.5,end:1};function O(e,t,i=0){let r=0;if(e in D&&(e=D[e]),"string"==typeof e){let t=parseFloat(e);e.endsWith("px")?r=t:e.endsWith("%")?e=t/100:e.endsWith("vw")?r=t/100*document.documentElement.clientWidth:e.endsWith("vh")?r=t/100*document.documentElement.clientHeight:e=t}return"number"==typeof e&&(r=t*e),i+r}let L=[0,0],I=[[0,0],[1,1]],R={x:0,y:0},k=new WeakMap,B=new WeakMap,z=new WeakMap,N=e=>e===document.scrollingElement?window:e;function F(e,{container:r=document.scrollingElement,...s}={}){if(!r)return o.noop;let a=z.get(r);a||(a=new Set,z.set(r,a));let c=function(e,t,i,r={}){return{measure:t=>{!function(e,t=e,i){if(i.x.targetOffset=0,i.y.targetOffset=0,t!==e){let r=t;for(;r&&r!==e;)i.x.targetOffset+=r.offsetLeft,i.y.targetOffset+=r.offsetTop,r=r.offsetParent}i.x.targetLength=t===e?t.scrollWidth:t.clientWidth,i.y.targetLength=t===e?t.scrollHeight:t.clientHeight,i.x.containerLength=e.clientWidth,i.y.containerLength=e.clientHeight}
8174(e,r.target,i),M(e,"x",i,t),M(e,"y",i,t),i.time=t,(r.offset||r.target)&&function(e,t,i){let{offset:r=I}=i,{target:s=e,axis:a="y"}=i,o="y"===a?"height":"width",h=s!==e?function(e,t){let i={x:0,y:0},r=e;for(;r&&r!==t;)if((0,P.isHTMLElement)(r))i.x+=r.offsetLeft,i.y+=r.offsetTop,r=r.offsetParent;else if("svg"===r.tagName){let e=r.getBoundingClientRect(),t=(r=r.parentElement).getBoundingClientRect();i.x+=e.left-t.left,i.y+=e.top-t.top}else if(r instanceof SVGGraphicsElement){let{x:e,y:t}=r.getBBox();i.x+=e,i.y+=t;let s=null,a=r.parentNode;for(;!s;)"svg"===a.tagName&&(s=a),a=r.parentNode;r=s}else break;return i}(s,e):R,c=s===e?{width:e.scrollWidth,height:e.scrollHeight}:"getBBox"in s&&"svg"!==s.tagName?s.getBBox():{width:s.clientWidth,height:s.clientHeight},d={width:e.clientWidth,height:e.clientHeight};t[a].offset.length=0;let u=!t[a].interpolate,p=r.length;for(let e=0;e<p;e++){let i=function(e,t,i,r){let s=Array.isArray(e)?e:L,a=0;return"number"==typeof e?s=[e,e]:"string"==typeof e&&(s=(e=e.trim()).includes(" ")?e.split(" "):[e,D[e]?e:"0"]),(a=O(s[0],i,r))-O(s[1],t)}(r[e],d[o],c[o],h[a]);u||i===t[a].interpolatorOffsets[e]||(u=!0),t[a].offset[e]=i}u&&(t[a].interpolate=(0,E.interpolate)(t[a].offset,(0,A.defaultOffset)(r),{clamp:!1}),t[a].interpolatorOffsets=[...t[a].offset]),t[a].progress=(0,T.clamp)(0,1,t[a].interpolate(t[a].current))}(e,i,r)},notify:()=>t(i)}}(r,e,{time:0,x:S(),y:S()},s);if(a.add(c),!k.has(r)){let e,s=()=>{for(let e of a)e.measure(h.frameData.timestamp);h.frame.preUpdate(o)},o=()=>{for(let e of a)e.notify()},c=()=>h.frame.read(s);k.set(r,c);let d=N(r);window.addEventListener("resize",c,{passive:!0}),r!==document.documentElement&&B.set(r,"function"==typeof r?(b.add(r),i||(i=()=>{let e={get width(){return window.innerWidth},get height(){return window.innerHeight}};b.forEach(t=>t(e))},window.addEventListener("resize",i)),()=>{b.delete(r),b.size||"function"!=typeof i||(window.removeEventListener("resize",i),i=void 0)}):(!t&&"u">typeof ResizeObserver&&(t=new ResizeObserver(x)),(e=(0,p.resolveElements)(r)).forEach(e=>{let i=f.get(e);i||(i=new Set,f.set(e,i)),i.add(c),t?.observe(e)}),()=>{e.forEach(e=>{let i=f.get(e);i?.delete(c),i?.size||t?.unobserve(e)})})),d.addEventListener("scroll",c,{passive:!0}),c()}let d=k.get(r);return h.frame.read(d,!1,!0),()=>{(0,h.cancelFrame)(d);let e=z.get(r);if(!e||(e.delete(c),e.size))return;let t=k.get(r);k.delete(r),t&&(N(r).removeEventListener("scroll",t),B.get(r)?.(),window.removeEventListener("resize",t))}}let j=new Map;function U({source:e,container:t,...i}){var r;let s,a,{axis:o}=i;e&&(t=e);let h=j.get(t)??new Map;j.set(t,h);let c=i.target??"self",u=h.get(c)??{},p=o+(i.offset??[]).join(",");return u[p]||(u[p]=!i.target&&(0,d.supportsScrollTimeline)()?new ScrollTimeline({source:t,axis:o}):(r={container:t,...i},s={value:0},a=F(e=>{s.value=100*e[r.axis].progress},r),{currentTime:s,cancel:a})),u[p]}var V=e.i(954832),W=e.i(196015);let H=()=>({scrollX:(0,r.motionValue)(0),scrollY:(0,r.motionValue)(0),scrollXProgress:(0,r.motionValue)(0),scrollYProgress:(0,r.motionValue)(0)}),G=e=>!!e&&!e.current;e.s(["useScroll",0,function({container:e,target:t,...i}={}){let r=(0,V.useConstant)(H),h=(0,a.useRef)(null),d=(0,a.useRef)(!1),u=(0,a.useCallback)(()=>(h.current=function(e,{axis:t="y",container:i=document.scrollingElement,...r}={}){var s,a;let h;
8174if(!i)return o.noop;let d={axis:t,container:i,...r};return"function"==typeof e?(s=e,a=d,2===s.length?F(e=>{s(e[a.axis].progress,e)},a):c(s,U(a))):(h=U(d),e.attachTimeline({timeline:d.target?void 0:h,observe:e=>(e.pause(),c(t=>{e.time=e.duration*t},h))}))}((e,{x:t,y:i})=>{r.scrollX.set(t.current),r.scrollXProgress.set(t.progress),r.scrollY.set(i.current),r.scrollYProgress.set(i.progress)},{...i,container:e?.current||void 0,target:t?.current||void 0}),()=>{h.current?.()}),[e,t,JSON.stringify(i.offset)]);return(0,W.useIsomorphicLayoutEffect)(()=>{if(d.current=!1,!(G(e)||G(t)))return u();d.current=!0},[u]),(0,a.useEffect)(()=>d.current?((0,s.invariant)(!G(e),"Container ref is defined but not hydrated","use-scroll-ref"),(0,s.invariant)(!G(t),"Target ref is defined but not hydrated","use-scroll-ref"),u()):void 0,[u]),r}],329316);var q=e.i(730955);function X(e,t){let i=function(e){let t=(0,V.useConstant)(()=>(0,r.motionValue)(e)),{isStatic:i}=(0,a.useContext)(q.MotionConfigContext);if(i){let[,i]=(0,a.useState)(e);(0,a.useEffect)(()=>t.on("change",i),[])}return t}(t()),s=()=>i.set(t());return s(),(0,W.useIsomorphicLayoutEffect)(()=>{let t=()=>h.frame.preRender(s,!1,!0),i=e.map(e=>e.on("change",t));return()=>{i.forEach(e=>e()),(0,h.cancelFrame)(s)}}),i}function Y(e,t){let i=(0,V.useConstant)(()=>[]);return X(e,()=>{i.length=0;let r=e.length;for(let t=0;t<r;t++)i[t]=e[t].get();return t(i)})}e.s(["useTransform",0,function(e,t,i,s){if("function"==typeof e){let t;return r.collectMotionValues.current=[],e(),t=X(r.collectMotionValues.current,e),r.collectMotionValues.current=void 0,t}let a="function"==typeof t?t:function(...e){let t=!Array.isArray(e[0]),i=t?0:-1,r=e[0+i],s=e[1+i],a=e[2+i],o=e[3+i],h=(0,E.interpolate)(s,a,o);return t?h(r):h}(t,i,s);return Array.isArray(e)?Y(e,a):Y([e],([e])=>a(e))}],404204)},312820,e=>{e.v({Buttons:"VideoAnimation-module-scss-module__VAiQvW__Buttons",Cont:"VideoAnimation-module-scss-module__VAiQvW__Cont",Copy:"VideoAnimation-module-scss-module__VAiQvW__Copy",Image:"VideoAnimation-module-scss-module__VAiQvW__Image",ImageCont:"VideoAnimation-module-scss-module__VAiQvW__ImageCont",ImageInner:"VideoAnimation-module-scss-module__VAiQvW__ImageInner",Intro:"VideoAnimation-module-scss-module__VAiQvW__Intro",Large:"VideoAnimation-module-scss-module__VAiQvW__Large",Logo:"VideoAnimation-module-scss-module__VAiQvW__Logo",Title:"VideoAnimation-module-scss-module__VAiQvW__Title",Video:"VideoAnimation-module-scss-module__VAiQvW__Video",VideoAnimation:"VideoAnimation-module-scss-module__VAiQvW__VideoAnimation"})},482624,e=>{"use strict";var t=e.i(395633),i=e.i(131173),r=e.i(7284),s=e.i(270744),a=e.i(329316),o=e.i(404204),h=e.i(378081),c=e.i(170586),d=e.i(389264),u=e.i(616827),p=e.i(440855),f=e.i(312820);e.s(["default",0,function({preTitle:e,logo:m,title:g,copy:v,buttons:y,videoFile:x}){let b=(0,i.useRef)(null),{scrollYProgress:w}=(0,a.useScroll)({target:b,offset:["start end","center center"]}),_=(0,o.useTransform)(w,[.5,1],[.2,.33]),S=(0,o.useTransform)(w,[.5,1],[0,1]),C=(0,o.useTransform)(_,e=>`${100*e}%`);return(0,t.jsxs)("section",{className:f.default.VideoAnimation,ref:b,children:[(0,t.jsxs)("div",{className:(0,r.default)(f.default.Cont,"container"),children:[(0,t.jsx)("div",{className:f.default.Intro,children:(0,t.jsx)(u.default,{preTitle:e,plainCopy:g,logo:m})}),(0,t.jsxs)("div",{className:f.default.Copy,children:[v&&(0,t.jsx)(d.default,{copy:v,size:"small"}),y?.length&&(0,t.jsx)("div",{className:f.default.Buttons,children:y?.map(e=>{let i=(e?.linkType==="internal"||e?.linkType==="external")&&(0,h.getSanityLink)(e)||null;return(0,t.jsx)(c.default,{...i,transparent:!0,white:!0},e.title)})})]})]}),x?.asset?.fileURL&&(0,t.jsx)("div",{className:f.default.ImageCont,children:(0,t.jsx)(s.motion.div,{className:f.default.Image,style:{maskSize:C,WebkitMaskSize:C,opacity:S},children:(0,t.jsx)(s.motion.div,{className:f.default.ImageInner,children:(0,t.jsx)(p.default,{video:x,darken:!1})})})}),(0,t.jsx)("div",{className:f.default.Video,children:(0,t.jsx)(p.default,{video:x})})]})}])},227759,e=>{e.v({Accordion:"Accordion-module-scss-module__pVKnzq__Accordion",Active:"Accordion-module-scss-module__pVKnzq__Active",Answer:"Accordion-module-scss-module__pVKnzq__Answer",Button:"Accordion-module-scss-module__pVKnzq__Button",Grey:"Accordion-module-scss-module__pVKnzq__Grey",Item:"Accordion-module-scss-module__pVKnzq__Item",Question:"Accordion-module-scss-module__pVKnzq__Question",White:"Accordion-module-scss-module__pVKnzq__White"})},5593,e=>{"use strict";var t=e.i(395633),i=e.i(170586),r=e.i(389264);let s=(0,t.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 15 16",children:[(0,t.jsx)("path",{d:"M8.35,16h-1.73V0h1.73v16Z",fill:"#0c0c0c"}),(0,t.jsx)("path",{d:"M0,8.86v-1.73h15v1.73H0Z",fill:"#0c0c0c"})]});var a=e.i(378081),o=e.i(7284),h=e.i(131173),c=e.i(227759);e.s(["default",0,function({items:e,white:d=!1,grey:u=!1}){let[p,f]=(0,h.useState)(0);return(0,t.jsx)("div",{className:(0,o.default)(c.default.Accordion,d&&c.default.White,u&&c.default.Grey),children:e?.map((e,h)=>{let{question:d,answer:u,link:m}=e,g=(m?.linkType==="internal"||m?.linkType==="external")&&(0,a.getSanityLink)(m)||null;return(0,t.jsxs)("div",{className:(0,o.default)(c.default.Item,p===h?c.default.Active:null),children:[(0,t.jsxs)("div",{className:c.default.Question,onClick:()=>f(p===h?null:h),children:[(0,t.jsx)("span",{dangerouslySetInnerHTML:{__html:d||""}}),s]}),(0,t.jsx)("div",{className:c.default.Answer,children:(0,t.jsxs)("div",{children:[(0,t.jsx)(r.default,{copy:u,size:"small"}),g&&(0,t.jsx)(i.default,{...g,className:c.default.Button,noArrow:!0})]})})]},h)})})}],5593)},486487,e=>{"use strict";e.s(["c",0,function(e){return void 0===e&&(e=""),`.${e.trim().replace(/([\.:!+\/()[\]])/g,"\\$1").replace(/ /g,".")}`}])},308562,e=>{"use strict";var t=e.i(482231),i=e.i(486487),r=e.i(640437);e.s(["A11y",0,function(e){let s,a,{swiper:o,extendParams:h,on:c}=e;h({a11y:{enabled:!0,notificationClass:"swiper-notification",prevSlideMessage:"Previous slide",nextSlideMessage:"Next slide",firstSlideMessage:"This is the first slide",lastSlideMessage:"This is the last slide",paginationBulletMessage:"Go to slide {{index}}",slideLabelMessage:"{{index}} / {{slidesLength}}",containerMessage:null,containerRoleDescriptionMessage:null,containerRole:null,itemRoleDescriptionMessage:null,slideRole:"group",id:null,
8174scrollOnFocus:!0}}),o.a11y={clicked:!1};let d=null,u=new Date().getTime();function p(e){let t=d;0!==t.length&&(0,r.s)(t,e)}function f(e){(e=(0,r.m)(e)).forEach(e=>{e.setAttribute("tabIndex","0")})}function m(e){(e=(0,r.m)(e)).forEach(e=>{e.setAttribute("tabIndex","-1")})}function g(e,t){(e=(0,r.m)(e)).forEach(e=>{e.setAttribute("role",t)})}function v(e,t){(e=(0,r.m)(e)).forEach(e=>{e.setAttribute("aria-roledescription",t)})}function y(e,t){(e=(0,r.m)(e)).forEach(e=>{e.setAttribute("aria-label",t)})}function x(e){(e=(0,r.m)(e)).forEach(e=>{e.setAttribute("aria-disabled",!0)})}function b(e){(e=(0,r.m)(e)).forEach(e=>{e.setAttribute("aria-disabled",!1)})}function w(e){if(13!==e.keyCode&&32!==e.keyCode)return;let t=o.params.a11y,s=e.target;if(!(o.pagination&&o.pagination.el&&(s===o.pagination.el||o.pagination.el.contains(e.target)))||e.target.matches((0,i.c)(o.params.pagination.bulletClass))){if(o.navigation&&o.navigation.prevEl&&o.navigation.nextEl){let e=(0,r.m)(o.navigation.prevEl);(0,r.m)(o.navigation.nextEl).includes(s)&&(o.isEnd&&!o.params.loop||o.slideNext(),o.isEnd?p(t.lastSlideMessage):p(t.nextSlideMessage)),e.includes(s)&&(o.isBeginning&&!o.params.loop||o.slidePrev(),o.isBeginning?p(t.firstSlideMessage):p(t.prevSlideMessage))}o.pagination&&s.matches((0,i.c)(o.params.pagination.bulletClass))&&s.click()}}function _(){return o.pagination&&o.pagination.bullets&&o.pagination.bullets.length}function S(){return _()&&o.params.pagination.clickable}let C=(e,t,i)=>{var s;f(e),"BUTTON"!==e.tagName&&(g(e,"button"),e.addEventListener("keydown",w)),y(e,i),s=e,(s=(0,r.m)(s)).forEach(e=>{e.setAttribute("aria-controls",t)})},M=e=>{a&&a!==e.target&&!a.contains(e.target)&&(s=!0),o.a11y.clicked=!0},E=()=>{s=!1,requestAnimationFrame(()=>{requestAnimationFrame(()=>{o.destroyed||(o.a11y.clicked=!1)})})},A=e=>{u=new Date().getTime()},T=e=>{if(o.a11y.clicked||!o.params.a11y.scrollOnFocus||new Date().getTime()-u<100)return;let t=e.target.closest(`.${o.params.slideClass}, swiper-slide`);if(!t||!o.slides.includes(t))return;a=t;let i=o.slides.indexOf(t)===o.activeIndex,r=o.params.watchSlidesProgress&&o.visibleSlides&&o.visibleSlides.includes(t);i||r||e.sourceCapabilities&&e.sourceCapabilities.firesTouchEvents||(o.isHorizontal()?o.el.scrollLeft=0:o.el.scrollTop=0,requestAnimationFrame(()=>{s||(o.params.loop?o.slideToLoop(o.getSlideIndexWhenGrid(parseInt(t.getAttribute("data-swiper-slide-index"))),0):o.slideTo(o.getSlideIndexWhenGrid(o.slides.indexOf(t)),0),s=!1)}))},P=()=>{let e=o.params.a11y;e.itemRoleDescriptionMessage&&v(o.slides,e.itemRoleDescriptionMessage),e.slideRole&&g(o.slides,e.slideRole);let t=o.slides.length;e.slideLabelMessage&&o.slides.forEach((i,r)=>{let s=o.params.loop?parseInt(i.getAttribute("data-swiper-slide-index"),10):r;y(i,e.slideLabelMessage.replace(/\{\{index\}\}/,s+1).replace(/\{\{slidesLength\}\}/,t))})};c("beforeInit",()=>{(d=(0,r.c)("span",o.params.a11y.notificationClass)).setAttribute("aria-live","assertive"),d.setAttribute("aria-atomic","true")}),c("afterInit",()=>{o.params.a11y.enabled&&(()=>{var e,i;let s=o.params.a11y;o.el.append(d);let a=o.el;s.containerRoleDescriptionMessage&&v(a,s.containerRoleDescriptionMessage),s.containerMessage&&y(a,s.containerMessage),s.containerRole&&g(a,s.containerRole);let h=o.wrapperEl,c=s.id||h.getAttribute("id")||`swiper-wrapper-${"x".repeat(16).replace(/x/g,()=>Math.round(16*Math.random()).toString(16))}`,u=o.params.autoplay&&o.params.autoplay.enabled?"off":"polite";e=h,(e=(0,r.m)(e)).forEach(e=>{e.setAttribute("id",c)}),i=h,(i=(0,r.m)(i)).forEach(e=>{e.setAttribute("aria-live",u)}),P();let{nextEl:p,prevEl:f}=o.navigation?o.navigation:{};p=(0,r.m)(p),f=(0,r.m)(f),p&&p.forEach(e=>C(e,c,s.nextSlideMessage)),f&&f.forEach(e=>C(e,c,s.prevSlideMessage)),S()&&(0,r.m)(o.pagination.el).forEach(e=>{e.addEventListener("keydown",w)}),(0,t.g)().addEventListener("visibilitychange",A),o.el.addEventListener("focus",T,!0),o.el.addEventListener("focus",T,!0),o.el.addEventListener("pointerdown",M,!0),o.el.addEventListener("pointerup",E,!0)})()}),c("slidesLengthChange snapGridLengthChange slidesGridLengthChange",()=>{o.params.a11y.enabled&&P()}),c("fromEdge toEdge afterInit lock unlock",()=>{o.params.a11y.enabled&&function(){if(o.params.loop||o.params.rewind||!o.navigation)return;let{nextEl:e,prevEl:t}=o.navigation;
8174t&&(o.isBeginning?(x(t),m(t)):(b(t),f(t))),e&&(o.isEnd?(x(e),m(e)):(b(e),f(e)))}()}),c("paginationUpdate",()=>{if(o.params.a11y.enabled){let e;e=o.params.a11y,_()&&o.pagination.bullets.forEach(t=>{o.params.pagination.clickable&&(f(t),o.params.pagination.renderBullet||(g(t,"button"),y(t,e.paginationBulletMessage.replace(/\{\{index\}\}/,(0,r.i)(t)+1)))),t.matches((0,i.c)(o.params.pagination.bulletActiveClass))?t.setAttribute("aria-current","true"):t.removeAttribute("aria-current")})}}),c("destroy",()=>{o.params.a11y.enabled&&function(){d&&d.remove();let{nextEl:e,prevEl:i}=o.navigation?o.navigation:{};e=(0,r.m)(e),i=(0,r.m)(i),e&&e.forEach(e=>e.removeEventListener("keydown",w)),i&&i.forEach(e=>e.removeEventListener("keydown",w)),S()&&(0,r.m)(o.pagination.el).forEach(e=>{e.removeEventListener("keydown",w)}),(0,t.g)().removeEventListener("visibilitychange",A),o.el&&"string"!=typeof o.el&&(o.el.removeEventListener("focus",T,!0),o.el.removeEventListener("pointerdown",M,!0),o.el.removeEventListener("pointerup",E,!0))}()})}],308562)},572197,e=>{e.v({Copy:"UpdatesList-module-scss-module__5kO03a__Copy",Image:"UpdatesList-module-scss-module__5kO03a__Image",List:"UpdatesList-module-scss-module__5kO03a__List",Main:"UpdatesList-module-scss-module__5kO03a__Main",PreTitle:"UpdatesList-module-scss-module__5kO03a__PreTitle",Update:"UpdatesList-module-scss-module__5kO03a__Update",UpdatesList:"UpdatesList-module-scss-module__5kO03a__UpdatesList"})},276170,e=>{"use strict";var t=e.i(395633),i=e.i(7284),r=e.i(440085),s=e.i(308562),a=e.i(378081),o=e.i(470989),h=e.i(792668),c=e.i(572197);e.s(["default",0,function({updatesTitle:e,updates:d}){let u=d?.concat(d)?.concat(d)?.concat(d);return(0,t.jsxs)("div",{className:c.default.UpdatesList,children:[(0,t.jsx)("p",{className:(0,i.default)(c.default.PreTitle,"smallCaps"),children:e||"Updates"}),(0,t.jsx)("div",{className:c.default.List,children:(0,t.jsx)(r.Swiper,{modules:[s.A11y],spaceBetween:10,slidesPerView:"auto",loop:!0,allowTouchMove:!0,children:u?.map((e,s)=>{let{link:d,copy:u,image:p}=e,f=(d?.linkType==="internal"||d?.linkType==="external")&&(0,a.getSanityLink)(d)||null,m=(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:c.default.Image,children:p&&(0,t.jsx)(h.default,{image:p})}),(0,t.jsxs)("div",{className:c.default.Main,children:[(0,t.jsx)("span",{children:f?.title}),u&&(0,t.jsx)("p",{className:(0,i.default)(c.default.Copy,"smallCaps"),dangerouslySetInnerHTML:{__html:u}})]})]});return(0,t.jsx)(r.SwiperSlide,{children:(0,t.jsx)("div",{className:c.default.Update,children:f?(0,t.jsx)(o.default,{href:f?.url||"#",className:c.default.Link,children:m}):(0,t.jsx)("div",{children:m})})},s)})})})]})}])},566073,e=>{e.v({Active:"BlogSliderInner-module-scss-module__cz8s1G__Active",CategoryFilter:"BlogSliderInner-module-scss-module__cz8s1G__CategoryFilter",CategoryFilterWrapper:"BlogSliderInner-module-scss-module__cz8s1G__CategoryFilterWrapper"})},865668,e=>{"use strict";var t=e.i(640437);e.s(["c",0,function(e,i,r,s){return e.params.createElements&&Object.keys(s).forEach(a=>{if(!r[a]&&!0===r.auto){let o=(0,t.e)(e.el,`.${s[a]}`)[0];o||((o=(0,t.c)("div",s[a])).className=s[a],e.el.append(o)),r[a]=o,i[a]=o}}),r}])},682623,e=>{"use strict";var t=e.i(865668),i=e.i(640437);e.s(["Navigation",0,function(e){let{swiper:r,extendParams:s,on:a,emit:o}=e;function h(e){let t;return e&&"string"==typeof e&&r.isElement&&(t=r.el.querySelector(e)||r.hostEl.querySelector(e))?t:(e&&("string"==typeof e&&(t=[...document.querySelectorAll(e)]),r.params.uniqueNavElements&&"string"==typeof e&&t&&t.length>1&&1===r.el.querySelectorAll(e).length?t=r.el.querySelector(e):t&&1===t.length&&(t=t[0])),e&&!t)?e:t}function c(e,t){let s=r.params.navigation;(e=(0,i.m)(e)).forEach(e=>{e&&(e.classList[t?"add":"remove"](...s.disabledClass.split(" ")),"BUTTON"===e.tagName&&(e.disabled=t),r.params.watchOverflow&&r.enabled&&e.classList[r.isLocked?"add":"remove"](s.lockClass))})}function d(){let{nextEl:e,prevEl:t}=r.navigation;if(r.params.loop){c(t,!1),c(e,!1);return}c(t,r.isBeginning&&!r.params.rewind),c(e,r.isEnd&&!r.params.rewind)}function u(e){e.preventDefault(),(!r.isBeginning||r.params.loop||r.params.rewind)&&(r.slidePrev(),o("navigationPrev"))}function p(e){e.preventDefault(),(!r.isEnd||r.params.loop||r.params.rewind)&&(r.slideNext(),o("navigationNext"))}function f(){let e=r.params.navigation;if(r.params.navigation=(0,t.c)(r,r.originalParams.navigation,r.params.navigation,{nextEl:"swiper-button-next",prevEl:"swiper-button-prev"}),!(e.nextEl||e.prevEl))return;let s=h(e.nextEl),a=h(e.prevEl);Object.assign(r.navigation,{nextEl:s,prevEl:a}),s=(0,i.m)(s),a=(0,i.m)(a);let o=(t,i)=>{t&&t.addEventListener("click","next"===i?p:u),!r.enabled&&t&&t.classList.add(...e.lockClass.split(" "))};
8174s.forEach(e=>o(e,"next")),a.forEach(e=>o(e,"prev"))}function m(){let{nextEl:e,prevEl:t}=r.navigation;e=(0,i.m)(e),t=(0,i.m)(t);let s=(e,t)=>{e.removeEventListener("click","next"===t?p:u),e.classList.remove(...r.params.navigation.disabledClass.split(" "))};e.forEach(e=>s(e,"next")),t.forEach(e=>s(e,"prev"))}s({navigation:{nextEl:null,prevEl:null,hideOnClick:!1,disabledClass:"swiper-button-disabled",hiddenClass:"swiper-button-hidden",lockClass:"swiper-button-lock",navigationDisabledClass:"swiper-navigation-disabled"}}),r.navigation={nextEl:null,prevEl:null},a("init",()=>{!1===r.params.navigation.enabled?g():(f(),d())}),a("toEdge fromEdge lock unlock",()=>{d()}),a("destroy",()=>{m()}),a("enable disable",()=>{let{nextEl:e,prevEl:t}=r.navigation;(e=(0,i.m)(e),t=(0,i.m)(t),r.enabled)?d():[...e,...t].filter(e=>!!e).forEach(e=>e.classList.add(r.params.navigation.lockClass))}),a("click",(e,t)=>{let{nextEl:s,prevEl:a}=r.navigation;s=(0,i.m)(s),a=(0,i.m)(a);let h=t.target,c=a.includes(h)||s.includes(h);if(r.isElement&&!c){let e=t.path||t.composedPath&&t.composedPath();e&&(c=e.find(e=>s.includes(e)||a.includes(e)))}if(r.params.navigation.hideOnClick&&!c){let e;if(r.pagination&&r.params.pagination&&r.params.pagination.clickable&&(r.pagination.el===h||r.pagination.el.contains(h)))return;s.length?e=s[0].classList.contains(r.params.navigation.hiddenClass):a.length&&(e=a[0].classList.contains(r.params.navigation.hiddenClass)),!0===e?o("navigationShow"):o("navigationHide"),[...s,...a].filter(e=>!!e).forEach(e=>e.classList.toggle(r.params.navigation.hiddenClass))}});let g=()=>{r.el.classList.add(...r.params.navigation.navigationDisabledClass.split(" ")),m()};Object.assign(r.navigation,{enable:()=>{r.el.classList.remove(...r.params.navigation.navigationDisabledClass.split(" ")),f(),d()},disable:g,update:d,init:f,destroy:m})}],682623)},167781,e=>{e.v({Cont:"BlogSliderSlides-module-scss-module__Jnjlwq__Cont",Content:"BlogSliderSlides-module-scss-module__Jnjlwq__Content",EmptyState:"BlogSliderSlides-module-scss-module__Jnjlwq__EmptyState",FeatureImage:"BlogSliderSlides-module-scss-module__Jnjlwq__FeatureImage",Info:"BlogSliderSlides-module-scss-module__Jnjlwq__Info",Loading:"BlogSliderSlides-module-scss-module__Jnjlwq__Loading",Navigation:"BlogSliderSlides-module-scss-module__Jnjlwq__Navigation",Skeleton:"BlogSliderSlides-module-scss-module__Jnjlwq__Skeleton",Slide:"BlogSliderSlides-module-scss-module__Jnjlwq__Slide",Swiper:"BlogSliderSlides-module-scss-module__Jnjlwq__Swiper",pulse:"BlogSliderSlides-module-scss-module__Jnjlwq__pulse"})},948671,e=>{"use strict";var t=e.i(395633),i=e.i(7284),r=e.i(566073),s=e.i(131173),a=e.i(308562),o=e.i(682623),h=e.i(440085),c=e.i(170586),d=e.i(470989),u=e.i(792668),p=e.i(378081),f=e.i(167781);function m({posts:e,isLoading:i}){let r=(0,s.useRef)(null);return(0,t.jsx)(t.Fragment,{children:i?(0,t.jsxs)("div",{className:f.default.Loading,children:[(0,t.jsxs)("div",{className:f.default.Skeleton,children:[(0,t.jsx)("div",{}),(0,t.jsx)("div",{}),(0,t.jsx)("div",{})]}),(0,t.jsxs)("div",{className:f.default.Skeleton,children:[(0,t.jsx)("div",{}),(0,t.jsx)("div",{}),(0,t.jsx)("div",{})]}),(0,t.jsxs)("div",{className:f.default.Skeleton,children:[(0,t.jsx)("div",{}),(0,t.jsx)("div",{}),(0,t.jsx)("div",{})]})]}):e.length>0?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(h.Swiper,{ref:r,className:f.default.Swiper,modules:[a.A11y,o.Navigation],spaceBetween:20,slidesPerView:1.4,breakpoints:{768:{slidesPerView:2},1024:{slidesPerView:3}},loop:!0,allowTouchMove:!0,children:e.map(e=>(0,t.jsx)(h.SwiperSlide,{className:f.default.Slide,children:(0,t.jsx)(d.default,{href:`/newsroom/${e.slug}`,className:f.default.NavLink,"aria-label":e.title,children:(0,t.jsxs)("div",{className:f.default.Cont,children:[(0,t.jsx)("div",{className:f.default.FeatureImage,children:e.featuredImage&&(0,t.jsx)(u.default,{image:e.featuredImage,alt:e?.title})}),(0,t.jsxs)("div",{className:f.default.Content,children:[(0,t.jsxs)("div",{className:f.default.Info,children:[(0,t.jsx)("span",{children:(0,p.returnDate)(e.publishDate)})," |"," ",e.categories?.map(e=>
8174e.name).join(", ")]}),e.title]})]})})},e._id))}),(0,t.jsxs)("div",{className:f.default.Navigation,children:[(0,t.jsx)("button",{onClick:()=>r.current?.swiper.slidePrev(),children:"←"}),(0,t.jsx)("button",{onClick:()=>r.current?.swiper.slideNext(),children:"→"}),(0,t.jsx)(c.default,{url:"/newsroom",transparent:!0,noArrow:!0,title:"View all"})]})]}):(0,t.jsx)("p",{className:f.default.EmptyState,children:"There are no posts to show here."})})}var g=e.i(884825),v=e.i(832410);e.s(["default",0,function({categories:e,initialPosts:a}){let[o,h]=(0,s.useState)("all"),[c,d]=(0,s.useState)(a),[u,p]=(0,s.useState)(!1),f=e=>{e&&(p(!0),h(e))};return(0,s.useEffect)(()=>{if("all"===o){d(a),p(!1);return}(async()=>{let e=g.groq`
8175                *[_type == "post" && excludeFromNewsroom != true && $category in categories[]->slug.current] | order(publishDate desc) [0...5] {
8176                    ...,
8177                    _id,
8178                    title,
8179                    "slug": slug.current,
8180                    categories[]-> {
8181                        name,
8182                        "slug": slug.current
8183                    },
8184                    featuredImage {
8185                        ...,
8186                        asset-> {
8187                            url,
8188                            altText,
8189                            metadata {
8190                                lqip,
8191                            }
8192                        }
8193                    },
8194                }
8195            `;d(await (0,v.sanityFetch)({query:e,params:{category:o},tags:["post"]})),p(!1)})()},[o,a]),(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:r.default.CategoryFilterWrapper,children:(0,t.jsxs)("ul",{className:r.default.CategoryFilter,children:[(0,t.jsx)("li",{className:(0,i.default)("smallCaps","all"===o&&r.default.Active),children:(0,t.jsx)("button",{onClick:()=>f("all"),children:"All"})}),e?.length&&e.map(e=>(0,t.jsx)("li",{className:(0,i.default)("smallCaps",o===e.slug&&r.default.Active),children:(0,t.jsx)("button",{onClick:()=>f(e.slug),children:e.name})},e.slug))]})}),(0,t.jsx)(m,{posts:c,isLoading:u})]})}],948671)},666527,e=>{e.v({Copy:"Stat-module-scss-module__6fTvHq__Copy",Number:"Stat-module-scss-module__6fTvHq__Number",Stat:"Stat-module-scss-module__6fTvHq__Stat"})},893184,e=>{"use strict";var t=e.i(395633),i=e.i(488265),r=e.i(666527);e.s(["default",0,function({number:e,prefix:s,suffix:a,countUp:o,copy:h}){return(0,t.jsxs)("div",{className:r.default.Stat,children:[(0,t.jsx)("div",{className:r.default.Number,children:o?(0,t.jsx)(i.default,{end:e||0,prefix:s?`${s} `:"",suffix:a||"",enableScrollSpy:!0,scrollSpyOnce:!0}):(0,t.jsxs)(t.Fragment,{children:[s?`${s} `:"",e,a]})}),h&&(0,t.jsx)("div",{className:r.default.Copy,children:h})]})}])},211833,e=>{e.v({Copy:"TilesCarousel-module-scss-module__NHNNqq__Copy",Image:"TilesCarousel-module-scss-module__NHNNqq__Image",List:"TilesCarousel-module-scss-module__NHNNqq__List",Main:"TilesCarousel-module-scss-module__NHNNqq__Main",PreTitle:"TilesCarousel-module-scss-module__NHNNqq__PreTitle",Tile:"TilesCarousel-module-scss-module__NHNNqq__Tile",TilesCarousel:"TilesCarousel-module-scss-module__NHNNqq__TilesCarousel"})},809626,e=>{"use strict";var t=e.i(395633),i=e.i(7284),r=e.i(440085),s=e.i(308562),a=e.i(470989),o=e.i(378081),h=e.i(211833);e.s(["default",0,function({preTitle:e,tiles:c}){let d=c?.concat(c)?.concat(c)?.concat(c);return(0,t.jsx)("section",{className:h.default.TilesCarousel,children:(0,t.jsxs)("div",{className:"container",children:[(0,t.jsx)("p",{className:(0,i.default)(h.default.PreTitle,"preTitle"),children:e}),(0,t.jsx)("div",{className:h.default.List,children:(0,t.jsx)(r.Swiper,{modules:[s.A11y],spaceBetween:20,slidesPerView:"auto",loop:!0,allowTouchMove:!0,children:d?.map((e,s)=>{let{link:c,copy:d}=e,u=(c?.linkType==="internal"||c?.linkType==="external")&&(0,o.getSanityLink)(c)||null,p=(0,t.jsx)(t.Fragment,{children:(0,t.jsxs)("div",{className:h.default.Main,children:[(0,t.jsx)("span",{children:u?.title}),d&&(0,t.jsx)("p",{className:(0,i.default)(h.default.Copy,"smallCaps"),dangerouslySetInnerHTML:{__html:d}})]})});return(0,t.jsx)(r.SwiperSlide,{children:(0,t.jsx)("div",{className:h.default.Tile,children:u?(0,t.jsx)(a.default,{href:u?.url||"#",className:h.default.Link,children:p}):(0,t.jsx)("div",{children:p})})},s)})})})]})})}])},583143,(e,t,i)=>{"use strict";var r=Array.isArray,s=Object.keys,a=Object.prototype.hasOwnProperty,o="u">typeof Element;t.exports=function(e,t){try{return function e(t,i){if(t===i)return!0;
8195if(t&&i&&"object"==typeof t&&"object"==typeof i){var h,c,d,u=r(t),p=r(i);if(u&&p){if((c=t.length)!=i.length)return!1;for(h=c;0!=h--;)if(!e(t[h],i[h]))return!1;return!0}if(u!=p)return!1;var f=t instanceof Date,m=i instanceof Date;if(f!=m)return!1;if(f&&m)return t.getTime()==i.getTime();var g=t instanceof RegExp,v=i instanceof RegExp;if(g!=v)return!1;if(g&&v)return t.toString()==i.toString();var y=s(t);if((c=y.length)!==s(i).length)return!1;for(h=c;0!=h--;)if(!a.call(i,y[h]))return!1;if(o&&t instanceof Element&&i instanceof Element)return t===i;for(h=c;0!=h--;)if(("_owner"!==(d=y[h])||!t.$$typeof)&&!e(t[d],i[d]))return!1;return!0}return t!=t&&i!=i}(e,t)}catch(e){if(e.message&&e.message.match(/stack|recursion/i)||-0x7ff5ffe4===e.number)return console.warn("Warning: react-fast-compare does not handle circular references.",e.name,e.message),!1;throw e}}},979546,(e,t,i)=>{"use strict";function r(e){this._maxSize=e,this.clear()}r.prototype.clear=function(){this._size=0,this._values=Object.create(null)},r.prototype.get=function(e){return this._values[e]},r.prototype.set=function(e,t){return this._size>=this._maxSize&&this.clear(),!(e in this._values)&&this._size++,this._values[e]=t};var s=/[^.^\]^[]+|(?=\[\]|\.\.)/g,a=/^\d+$/,o=/^\d/,h=/[~`!#$%\^&*+=\-\[\]\\';,/{}|\\":<>\?]/g,c=/^\s*(['"]?)(.*?)(\1)\s*$/,d=new r(512),u=new r(512),p=new r(512);function f(e){return d.get(e)||d.set(e,m(e).map(function(e){return e.replace(c,"$2")}))}function m(e){return e.match(s)||[""]}function g(e){return"string"==typeof e&&e&&-1!==["'",'"'].indexOf(e.charAt(0))}t.exports={Cache:r,split:m,normalizePath:f,setter:function(e){var t=f(e);return u.get(e)||u.set(e,function(e,i){for(var r=0,s=t.length,a=e;r<s-1;){var o=t[r];if("__proto__"===o||"constructor"===o||"prototype"===o)return e;a=a[t[r++]]}a[t[r]]=i})},getter:function(e,t){var i=f(e);return p.get(e)||p.set(e,function(e){for(var r=0,s=i.length;r<s;)if(null==e&&t)return;else e=e[i[r++]];return e})},join:function(e){return e.reduce(function(e,t){return e+(g(t)||a.test(t)?"["+t+"]":(e?".":"")+t)},"")},forEach:function(e,t,i){!function(e,t,i){var r,s,c,d,u=e.length;for(s=0;s<u;s++)(r=e[s])&&(function(e){return!g(e)&&(e.match(o)&&!e.match(a)||h.test(e))}(r)&&(r='"'+r+'"'),c=!(d=g(r))&&/^\d+$/.test(r),t.call(i,r,d,c,s,e))}(Array.isArray(e)?e:m(e),t,i)}}},950434,(e,t,i)=>{let r=/[A-Z\xc0-\xd6\xd8-\xde]?[a-z\xdf-\xf6\xf8-\xff]+(?:['’](?:d|ll|m|re|s|t|ve))?(?=[\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000]|[A-Z\xc0-\xd6\xd8-\xde]|$)|(?:[A-Z\xc0-\xd6\xd8-\xde]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])+(?:['’](?:D|LL|M|RE|S|T|VE))?(?=[\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000]|[A-Z\xc0-\xd6\xd8-\xde](?:[a-z\xdf-\xf6\xf8-\xff]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])|$)|[A-Z\xc0-\xd6\xd8-\xde]?(?:[a-z\xdf-\xf6\xf8-\xff]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])+(?:['’](?:d|ll|m|re|s|t|ve))?|[A-Z\xc0-\xd6\xd8-\xde]+(?:['’](?:D|LL|M|RE|S|T|VE))?|\d*(?:1ST|2ND|3RD|(?![123])\dTH)(?=\b|[a-z_])|\d*(?:1st|2nd|3rd|(?![123])\dth)(?=\b|[A-Z_])|\d+|(?:[\u2700-\u27bf]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff]|\ud83c[\udffb-\udfff])?(?:\u200d(?:[^\ud800-\udfff]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff]|\ud83c[\udffb-\udfff])?)*/g,s=e=>e.match(r)||[],a=e=>e[0].toUpperCase()+e.slice(1),o=(e,t)=>s(e).join(t).toLowerCase(),h=e=>s(e).reduce((e,t)=>
8195`${e}${!e?t.toLowerCase():t[0].toUpperCase()+t.slice(1).toLowerCase()}`,"");t.exports={words:s,upperFirst:a,camelCase:h,pascalCase:e=>a(h(e)),snakeCase:e=>o(e,"_"),kebabCase:e=>o(e,"-"),sentenceCase:e=>a(o(e," ")),titleCase:e=>s(e).map(a).join(" ")}},427001,(e,t,i)=>{function r(e,t){var i=e.length,r=Array(i),s={},a=i,o=function(e){for(var t=new Map,i=0,r=e.length;i<r;i++){var s=e[i];t.has(s[0])||t.set(s[0],new Set),t.has(s[1])||t.set(s[1],new Set),t.get(s[0]).add(s[1])}return t}(t),h=function(e){for(var t=new Map,i=0,r=e.length;i<r;i++)t.set(e[i],i);return t}(e);for(t.forEach(function(e){if(!h.has(e[0])||!h.has(e[1]))throw Error("Unknown node. There is an unknown node in the supplied edges.")});a--;)s[a]||function e(t,a,c){if(c.has(t)){var d;try{d=", node was:"+JSON.stringify(t)}catch(e){d=""}throw Error("Cyclic dependency"+d)}if(!h.has(t))throw Error("Found unknown node. Make sure to provided all involved nodes. Unknown node: "+JSON.stringify(t));if(!s[a]){s[a]=!0;var u=o.get(t)||new Set;if(a=(u=Array.from(u)).length){c.add(t);do{var p=u[--a];e(p,h.get(p),c)}while(a)c.delete(t)}r[--i]=t}}(e[a],a,new Set);return r}t.exports=function(e){return r(function(e){for(var t=new Set,i=0,r=e.length;i<r;i++){var s=e[i];t.add(s[0]),t.add(s[1])}return Array.from(t)}(e),e)},t.exports.array=r},860476,e=>{"use strict";var t=e.i(486487),i=e.i(865668),r=e.i(640437);e.s(["Pagination",0,function(e){let s,{swiper:a,extendParams:o,on:h,emit:c}=e,d="swiper-pagination";o({pagination:{el:null,bulletElement:"span",clickable:!1,hideOnClick:!1,renderBullet:null,renderProgressbar:null,renderFraction:null,renderCustom:null,progressbarOpposite:!1,type:"bullets",dynamicBullets:!1,dynamicMainBullets:1,formatFractionCurrent:e=>e,formatFractionTotal:e=>e,bulletClass:`${d}-bullet`,bulletActiveClass:`${d}-bullet-active`,modifierClass:`${d}-`,currentClass:`${d}-current`,totalClass:`${d}-total`,hiddenClass:`${d}-hidden`,progressbarFillClass:`${d}-progressbar-fill`,progressbarOppositeClass:`${d}-progressbar-opposite`,clickableClass:`${d}-clickable`,lockClass:`${d}-lock`,horizontalClass:`${d}-horizontal`,verticalClass:`${d}-vertical`,paginationDisabledClass:`${d}-disabled`}}),a.pagination={el:null,bullets:[]};let u=0;function p(){return!a.params.pagination.el||!a.pagination.el||Array.isArray(a.pagination.el)&&0===a.pagination.el.length}function f(e,t){let{bulletActiveClass:i}=a.params.pagination;e&&(e=e[`${"prev"===t?"previous":"next"}ElementSibling`])&&(e.classList.add(`${i}-${t}`),(e=e[`${"prev"===t?"previous":"next"}ElementSibling`])&&e.classList.add(`${i}-${t}-${t}`))}function m(e){let i=e.target.closest((0,t.c)(a.params.pagination.bulletClass));if(!i)return;e.preventDefault();let s=(0,r.i)(i)*a.params.slidesPerGroup;if(a.params.loop){var o,h,c;if(a.realIndex===s)return;let e=(o=a.realIndex,h=s,(o%=c=a.slides.length,(h%=c)===o+1)?"next":h===o-1?"previous":void 0);"next"===e?a.slideNext():"previous"===e?a.slidePrev():a.slideToLoop(s)}else a.slideTo(s)}function g(){let e,i,o=a.rtl,h=a.params.pagination;if(p())return;let d=a.pagination.el;d=(0,r.m)(d);let m=a.virtual&&a.params.virtual.enabled?a.virtual.slides.length:a.slides.length,g=a.params.loop?Math.ceil(m/a.params.slidesPerGroup):a.snapGrid.length;if(a.params.loop?(i=a.previousRealIndex||0,e=a.params.slidesPerGroup>1?Math.floor(a.realIndex/a.params.slidesPerGroup):a.realIndex):void 0!==a.snapIndex?(e=a.snapIndex,i=a.previousSnapIndex):(i=a.previousIndex||0,e=a.activeIndex||0),"bullets"===h.type&&a.pagination.bullets&&a.pagination.bullets.length>0){let t,c,p,m=a.pagination.bullets;if(h.dynamicBullets&&(s=(0,r.h)(m[0],a.isHorizontal()?"width":"height",!0),d.forEach(e=>{e.style[a.isHorizontal()?"width":"height"]=`${s*(h.dynamicMainBullets+4)}px`}),h.dynamicMainBullets>1&&void 0!==i&&((u+=e-(i||0))>h.dynamicMainBullets-1?u=h.dynamicMainBullets-1:u<0&&(u=0)),p=((c=(t=Math.max(e-u,0))+(Math.min(m.length,h.dynamicMainBullets)-1))+t)/2),m.forEach(e=>{let t=[...["","-next","-next-next","-prev","-prev-prev","-main"].map(e=>`${h.bulletActiveClass}${e}`)].map(e=>"string"==typeof e&&e.includes(" ")?e.split(" "):e).flat();e.classList.remove(...t)}),d.length>1)m.forEach(i=>
8195{let s=(0,r.i)(i);s===e?i.classList.add(...h.bulletActiveClass.split(" ")):a.isElement&&i.setAttribute("part","bullet"),h.dynamicBullets&&(s>=t&&s<=c&&i.classList.add(...`${h.bulletActiveClass}-main`.split(" ")),s===t&&f(i,"prev"),s===c&&f(i,"next"))});else{let i=m[e];if(i&&i.classList.add(...h.bulletActiveClass.split(" ")),a.isElement&&m.forEach((t,i)=>{t.setAttribute("part",i===e?"bullet-active":"bullet")}),h.dynamicBullets){let e=m[t],i=m[c];for(let e=t;e<=c;e+=1)m[e]&&m[e].classList.add(...`${h.bulletActiveClass}-main`.split(" "));f(e,"prev"),f(i,"next")}}if(h.dynamicBullets){let e=Math.min(m.length,h.dynamicMainBullets+4),t=(s*e-s)/2-p*s,i=o?"right":"left";m.forEach(e=>{e.style[a.isHorizontal()?i:"top"]=`${t}px`})}}d.forEach((i,s)=>{if("fraction"===h.type&&(i.querySelectorAll((0,t.c)(h.currentClass)).forEach(t=>{t.textContent=h.formatFractionCurrent(e+1)}),i.querySelectorAll((0,t.c)(h.totalClass)).forEach(e=>{e.textContent=h.formatFractionTotal(g)})),"progressbar"===h.type){let r;r=h.progressbarOpposite?a.isHorizontal()?"vertical":"horizontal":a.isHorizontal()?"horizontal":"vertical";let s=(e+1)/g,o=1,c=1;"horizontal"===r?o=s:c=s,i.querySelectorAll((0,t.c)(h.progressbarFillClass)).forEach(e=>{e.style.transform=`translate3d(0,0,0) scaleX(${o}) scaleY(${c})`,e.style.transitionDuration=`${a.params.speed}ms`})}"custom"===h.type&&h.renderCustom?((0,r.s)(i,h.renderCustom(a,e+1,g)),0===s&&c("paginationRender",i)):(0===s&&c("paginationRender",i),c("paginationUpdate",i)),a.params.watchOverflow&&a.enabled&&i.classList[a.isLocked?"add":"remove"](h.lockClass)})}function v(){let e=a.params.pagination;if(p())return;let i=a.virtual&&a.params.virtual.enabled?a.virtual.slides.length:a.grid&&a.params.grid.rows>1?a.slides.length/Math.ceil(a.params.grid.rows):a.slides.length,s=a.pagination.el;s=(0,r.m)(s);let o="";if("bullets"===e.type){let t=a.params.loop?Math.ceil(i/a.params.slidesPerGroup):a.snapGrid.length;a.params.freeMode&&a.params.freeMode.enabled&&t>i&&(t=i);for(let i=0;i<t;i+=1)e.renderBullet?o+=e.renderBullet.call(a,i,e.bulletClass):o+=`<${e.bulletElement} ${a.isElement?'part="bullet"':""} class="${e.bulletClass}"></${e.bulletElement}>`}"fraction"===e.type&&(o=e.renderFraction?e.renderFraction.call(a,e.currentClass,e.totalClass):`<span class="${e.currentClass}"></span> / <span class="${e.totalClass}"></span>`),"progressbar"===e.type&&(o=e.renderProgressbar?e.renderProgressbar.call(a,e.progressbarFillClass):`<span class="${e.progressbarFillClass}"></span>`),a.pagination.bullets=[],s.forEach(i=>{"custom"!==e.type&&(0,r.s)(i,o||""),"bullets"===e.type&&a.pagination.bullets.push(...i.querySelectorAll((0,t.c)(e.bulletClass)))}),"custom"!==e.type&&c("paginationRender",s[0])}function y(){let e;a.params.pagination=(0,i.c)(a,a.originalParams.pagination,a.params.pagination,{el:"swiper-pagination"});let t=a.params.pagination;!t.el||("string"==typeof t.el&&a.isElement&&(e=a.el.querySelector(t.el)),e||"string"!=typeof t.el||(e=[...document.querySelectorAll(t.el)]),e||(e=t.el),e&&0!==e.length&&(a.params.uniqueNavElements&&"string"==typeof t.el&&Array.isArray(e)&&e.length>1&&(e=[...a.el.querySelectorAll(t.el)]).length>1&&(e=e.find(e=>(0,r.b)(e,".swiper")[0]===a.el)),Array.isArray(e)&&1===e.length&&(e=e[0]),Object.assign(a.pagination,{el:e}),(e=(0,r.m)(e)).forEach(e=>{"bullets"===t.type&&t.clickable&&e.classList.add(...(t.clickableClass||"").split(" ")),e.classList.add(t.modifierClass+t.type),e.classList.add(a.isHorizontal()?t.horizontalClass:t.verticalClass),"bullets"===t.type&&t.dynamicBullets&&(e.classList.add(`${t.modifierClass}${t.type}-dynamic`),u=0,t.dynamicMainBullets<1&&(t.dynamicMainBullets=1)),"progressbar"===t.type&&t.progressbarOpposite&&e.classList.add(t.progressbarOppositeClass),t.clickable&&e.addEventListener("click",m),a.enabled||e.classList.add(t.lockClass)})))}function x(){let e=a.params.pagination;if(p())return;let t=a.pagination.el;t&&(t=(0,r.m)(t)).forEach(t=>{t.classList.remove(e.hiddenClass),t.classList.remove(e.modifierClass+e.type),t.classList.remove(a.isHorizontal()?e.horizontalClass:e.verticalClass),e.clickable&&(t.classList.remove(...(e.clickableClass||"").split(" ")),t.removeEventListener("click",m))}
8195),a.pagination.bullets&&a.pagination.bullets.forEach(t=>t.classList.remove(...e.bulletActiveClass.split(" ")))}h("changeDirection",()=>{if(!a.pagination||!a.pagination.el)return;let e=a.params.pagination,{el:t}=a.pagination;(t=(0,r.m)(t)).forEach(t=>{t.classList.remove(e.horizontalClass,e.verticalClass),t.classList.add(a.isHorizontal()?e.horizontalClass:e.verticalClass)})}),h("init",()=>{!1===a.params.pagination.enabled?b():(y(),v(),g())}),h("activeIndexChange",()=>{void 0===a.snapIndex&&g()}),h("snapIndexChange",()=>{g()}),h("snapGridLengthChange",()=>{v(),g()}),h("destroy",()=>{x()}),h("enable disable",()=>{let{el:e}=a.pagination;e&&(e=(0,r.m)(e)).forEach(e=>e.classList[a.enabled?"remove":"add"](a.params.pagination.lockClass))}),h("lock unlock",()=>{g()}),h("click",(e,t)=>{let i=t.target,s=(0,r.m)(a.pagination.el);if(a.params.pagination.el&&a.params.pagination.hideOnClick&&s&&s.length>0&&!i.classList.contains(a.params.pagination.bulletClass)){if(a.navigation&&(a.navigation.nextEl&&i===a.navigation.nextEl||a.navigation.prevEl&&i===a.navigation.prevEl))return;!0===s[0].classList.contains(a.params.pagination.hiddenClass)?c("paginationShow"):c("paginationHide"),s.forEach(e=>e.classList.toggle(a.params.pagination.hiddenClass))}});let b=()=>{a.el.classList.add(a.params.pagination.paginationDisabledClass);let{el:e}=a.pagination;e&&(e=(0,r.m)(e)).forEach(e=>e.classList.add(a.params.pagination.paginationDisabledClass)),x()};Object.assign(a.pagination,{enable:()=>{a.el.classList.remove(a.params.pagination.paginationDisabledClass);let{el:e}=a.pagination;e&&(e=(0,r.m)(e)).forEach(e=>e.classList.remove(a.params.pagination.paginationDisabledClass)),y(),v(),g()},disable:b,render:v,update:g,init:y,destroy:x})}],860476)},541371,e=>{e.v({Active:"Form-module-scss-module__TeAh4W__Active",AddressFields:"Form-module-scss-module__TeAh4W__AddressFields",AddressRow:"Form-module-scss-module__TeAh4W__AddressRow",Error:"Form-module-scss-module__TeAh4W__Error",FieldGroup:"Form-module-scss-module__TeAh4W__FieldGroup",Fields:"Form-module-scss-module__TeAh4W__Fields",FormError:"Form-module-scss-module__TeAh4W__FormError",Indicator:"Form-module-scss-module__TeAh4W__Indicator",Inner:"Form-module-scss-module__TeAh4W__Inner",Loading:"Form-module-scss-module__TeAh4W__Loading",LoadingMessage:"Form-module-scss-module__TeAh4W__LoadingMessage",LoadingOverlay:"Form-module-scss-module__TeAh4W__LoadingOverlay",Navigation:"Form-module-scss-module__TeAh4W__Navigation",Outer:"Form-module-scss-module__TeAh4W__Outer",SliderOuter:"Form-module-scss-module__TeAh4W__SliderOuter",StageIndicator:"Form-module-scss-module__TeAh4W__StageIndicator",checkbox:"Form-module-scss-module__TeAh4W__checkbox",checkboxLabel:"Form-module-scss-module__TeAh4W__checkboxLabel",checkboxWrapper:"Form-module-scss-module__TeAh4W__checkboxWrapper",input:"Form-module-scss-module__TeAh4W__input",select:"Form-module-scss-module__TeAh4W__select",textarea:"Form-module-scss-module__TeAh4W__textarea"})},384184,e=>{e.v({Active:"PasswordField-module-scss-module__JZbhZW__Active",Bars:"PasswordField-module-scss-module__JZbhZW__Bars",Outer:"PasswordField-module-scss-module__JZbhZW__Outer",Strength:"PasswordField-module-scss-module__JZbhZW__Strength","Strength-good":"PasswordField-module-scss-module__JZbhZW__Strength-good","Strength-medium":"PasswordField-module-scss-module__JZbhZW__Strength-medium","Strength-strong":"PasswordField-module-scss-module__JZbhZW__Strength-strong","Strength-weak":"PasswordField-module-scss-module__JZbhZW__Strength-weak",StrengthIndicator:"PasswordField-module-scss-module__JZbhZW__StrengthIndicator",Toggle:"PasswordField-module-scss-module__JZbhZW__Toggle"})},412178,e=>{e.v({AutocompleteWrapper:"AddressAutocomplete-module-scss-module__8OEncW__AutocompleteWrapper",ManualEntryButton:"AddressAutocomplete-module-scss-module__8OEncW__ManualEntryButton",SuggestionItem:"AddressAutocomplete-module-scss-module__8OEncW__SuggestionItem",SuggestionsList:"AddressAutocomplete-module-scss-module__8OEncW__SuggestionsList",input:"AddressAutocomplete-module-scss-module__8OEncW__input"})},657338,(e,t,i)=>{t.exports=function({id:e,sv:t,debug:i=!1,nonce:r=null}){var s,a,o,h;s=window,a=document,s.hj=s.hj||function(){(s.hj.q=s.hj.q||[]).push(arguments)},s._hjSettings={hjid:e,hjsv:t,hjDebug:i},s._scriptPath="https://static.hotjar.com/c/hotjar-"+s._hjSettings.hjid+".js?sv="+s._hjSettings.hjsv,document.querySelector('script[src*="'+s._scriptPath+'"]')||(o=a.getElementsByTagName("head")[0],h=a.createElement("script"),r&&h.setAttribute("nonce",r),h.async=1,h.src=s._scriptPath,o.appendChild(h))}},452878,(e,t,i)=>{let r=e.r(657338),s=(...e)=>{if(!window.hj)throw Error("Hotjar is not initialized");window.hj(...e)}
8195;t.exports={hotjar:{initialize:function({id:e,sv:t,debug:i,nonce:s}){r({id:e,sv:t,debug:i,nonce:s})},initialized:function(){return"u">typeof window&&"function"==typeof window?.hj},identify:function(e,t){s("identify",e,t)},event:function(e){s("event",e)},stateChange:function(e){s("stateChange",e)}}}},435764,e=>{e.v({Cont:"SignUp-module-scss-module__D1K9da__Cont",CreateAccount:"SignUp-module-scss-module__D1K9da__CreateAccount",Intro:"SignUp-module-scss-module__D1K9da__Intro",Success:"SignUp-module-scss-module__D1K9da__Success"})},813407,e=>{"use strict";let t,i,r,s,a,o,h,c;var d,u,p,f,m,g,v,y,x,b,w,_,S,C,M,E,A,T,P,D,O,L=e.i(103308),I=e.i(395633),R=e.i(389264),k=e.i(131173),B=function(e){var t,i,r;return!!(t=e)&&"object"==typeof t&&(i=e,"[object RegExp]"!==(r=Object.prototype.toString.call(i))&&"[object Date]"!==r&&i.$$typeof!==z)},z="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function N(e,t){return!1!==t.clone&&t.isMergeableObject(e)?j(Array.isArray(e)?[]:{},e,t):e}function F(e,t,i){return e.concat(t).map(function(e){return N(e,i)})}function j(e,t,i){(i=i||{}).arrayMerge=i.arrayMerge||F,i.isMergeableObject=i.isMergeableObject||B;var r,s,a=Array.isArray(t);return a!==Array.isArray(e)?N(t,i):a?i.arrayMerge(e,t,i):(s={},(r=i).isMergeableObject(e)&&Object.keys(e).forEach(function(t){s[t]=N(e[t],r)}),Object.keys(t).forEach(function(i){r.isMergeableObject(t[i])&&e[i]?s[i]=j(e[i],t[i],r):s[i]=N(t[i],r)}),s)}j.all=function(e,t){if(!Array.isArray(e))throw Error("first argument should be an array");return e.reduce(function(e,i){return j(e,i,t)},{})};let U=j;var V=e.g&&e.g.Object===Object&&e.g,W="object"==typeof self&&self&&self.Object===Object&&self,H=V||W||Function("return this")(),G=H.Symbol,q=Object.prototype,X=q.hasOwnProperty,Y=q.toString,Q=G?G.toStringTag:void 0;let Z=function(e){var t=X.call(e,Q),i=e[Q];try{e[Q]=void 0;var r=!0}catch(e){}var s=Y.call(e);return r&&(t?e[Q]=i:delete e[Q]),s};var K=Object.prototype.toString,J=G?G.toStringTag:void 0;let $=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":J&&J in Object(e)?Z(e):K.call(e)},ee=function(e,t){return function(i){return e(t(i))}};var et=ee(Object.getPrototypeOf,Object);let ei=function(e){return null!=e&&"object"==typeof e};var er=Object.prototype,es=Function.prototype.toString,ea=er.hasOwnProperty,en=es.call(Object);let eo=function(e){if(!ei(e)||"[object Object]"!=$(e))return!1;var t=et(e);if(null===t)return!0;var i=ea.call(t,"constructor")&&t.constructor;return"function"==typeof i&&i instanceof i&&es.call(i)==en},el=function(e,t){return e===t||e!=e&&t!=t},eh=function(e,t){for(var i=e.length;i--;)if(el(e[i][0],t))return i;return -1};var ec=Array.prototype.splice;function ed(e){var t=-1,i=null==e?0:e.length;for(this.clear();++t<i;){var r=e[t];this.set(r[0],r[1])}}ed.prototype.clear=function(){this.__data__=[],this.size=0},ed.prototype.delete=function(e){var t=this.__data__,i=eh(t,e);return!(i<0)&&(i==t.length-1?t.pop():ec.call(t,i,1),--this.size,!0)},ed.prototype.get=function(e){var t=this.__data__,i=eh(t,e);return i<0?void 0:t[i][1]},ed.prototype.has=function(e){return eh(this.__data__,e)>-1},ed.prototype.set=function(e,t){var i=this.__data__,r=eh(i,e);return r<0?(++this.size,i.push([e,t])):i[r][1]=t,this};let eu=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},ep=function(e){if(!eu(e))return!1;var t=$(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t};var ef=H["__core-js_shared__"],em=(m=/[^.]+$/.exec(ef&&ef.keys&&ef.keys.IE_PROTO||""))?"Symbol(src)_1."+m:"",eg=Function.prototype.toString;let ev=function(e){if(null!=e){try{return eg.call(e)}catch(e){}try{return e+""}catch(e){}}return""};var ey=/^\[object .+?Constructor\]$/,ex=Object.prototype,eb=Function.prototype.toString,ew=ex.hasOwnProperty,e_=RegExp("^"+eb.call(ew).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");let eS=function(e){return!!eu(e)&&(!em||!(em in e))&&(ep(e)?e_:ey).test(ev(e))},eC=function(e,t){var i=null==e?void 0:e[t];return eS(i)?i:void 0};
8195var eM=eC(H,"Map"),eE=eC(Object,"create"),eA=Object.prototype.hasOwnProperty,eT=Object.prototype.hasOwnProperty;function eP(e){var t=-1,i=null==e?0:e.length;for(this.clear();++t<i;){var r=e[t];this.set(r[0],r[1])}}eP.prototype.clear=function(){this.__data__=eE?eE(null):{},this.size=0},eP.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=!!t,t},eP.prototype.get=function(e){var t=this.__data__;if(eE){var i=t[e];return"__lodash_hash_undefined__"===i?void 0:i}return eA.call(t,e)?t[e]:void 0},eP.prototype.has=function(e){var t=this.__data__;return eE?void 0!==t[e]:eT.call(t,e)},eP.prototype.set=function(e,t){var i=this.__data__;return this.size+=+!this.has(e),i[e]=eE&&void 0===t?"__lodash_hash_undefined__":t,this};let eD=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e},eO=function(e,t){var i=e.__data__;return eD(t)?i["string"==typeof t?"string":"hash"]:i.map};function eL(e){var t=-1,i=null==e?0:e.length;for(this.clear();++t<i;){var r=e[t];this.set(r[0],r[1])}}function eI(e){var t=this.__data__=new ed(e);this.size=t.size}eL.prototype.clear=function(){this.size=0,this.__data__={hash:new eP,map:new(eM||ed),string:new eP}},eL.prototype.delete=function(e){var t=eO(this,e).delete(e);return this.size-=!!t,t},eL.prototype.get=function(e){return eO(this,e).get(e)},eL.prototype.has=function(e){return eO(this,e).has(e)},eL.prototype.set=function(e,t){var i=eO(this,e),r=i.size;return i.set(e,t),this.size+=+(i.size!=r),this},eI.prototype.clear=function(){this.__data__=new ed,this.size=0},eI.prototype.delete=function(e){var t=this.__data__,i=t.delete(e);return this.size=t.size,i},eI.prototype.get=function(e){return this.__data__.get(e)},eI.prototype.has=function(e){return this.__data__.has(e)},eI.prototype.set=function(e,t){var i=this.__data__;if(i instanceof ed){var r=i.__data__;if(!eM||r.length<199)return r.push([e,t]),this.size=++i.size,this;i=this.__data__=new eL(r)}return i.set(e,t),this.size=i.size,this};let eR=function(e,t){for(var i=-1,r=null==e?0:e.length;++i<r&&!1!==t(e[i],i,e););return e};var ek=function(){try{var e=eC(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();let eB=function(e,t,i){"__proto__"==t&&ek?ek(e,t,{configurable:!0,enumerable:!0,value:i,writable:!0}):e[t]=i};var ez=Object.prototype.hasOwnProperty;let eN=function(e,t,i){var r=e[t];ez.call(e,t)&&el(r,i)&&(void 0!==i||t in e)||eB(e,t,i)},eF=function(e,t,i,r){var s=!i;i||(i={});for(var a=-1,o=t.length;++a<o;){var h=t[a],c=r?r(i[h],e[h],h,i,e):void 0;void 0===c&&(c=e[h]),s?eB(i,h,c):eN(i,h,c)}return i},ej=function(e,t){for(var i=-1,r=Array(e);++i<e;)r[i]=t(i);return r},eU=function(e){return ei(e)&&"[object Arguments]"==$(e)};var eV=Object.prototype,eW=eV.hasOwnProperty,eH=eV.propertyIsEnumerable,eG=eU(function(){return arguments}())?eU:function(e){return ei(e)&&eW.call(e,"callee")&&!eH.call(e,"callee")},eq=Array.isArray;let eX=function(){return!1};var eY=/^(?:0|[1-9]\d*)$/;let eQ=function(e,t){var i=typeof e;return!!(t=null==t?0x1fffffffffffff:t)&&("number"==i||"symbol"!=i&&eY.test(e))&&e>-1&&e%1==0&&e<t},eZ=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=0x1fffffffffffff};var eK={};eK["[object Float32Array]"]=eK["[object Float64Array]"]=eK["[object Int8Array]"]=eK["[object Int16Array]"]=eK["[object Int32Array]"]=eK["[object Uint8Array]"]=eK["[object Uint8ClampedArray]"]=eK["[object Uint16Array]"]=eK["[object Uint32Array]"]=!0,eK["[object Arguments]"]=eK["[object Array]"]=eK["[object ArrayBuffer]"]=eK["[object Boolean]"]=eK["[object DataView]"]=eK["[object Date]"]=eK["[object Error]"]=eK["[object Function]"]=eK["[object Map]"]=eK["[object Number]"]=eK["[object Object]"]=eK["[object RegExp]"]=eK["[object Set]"]=eK["[object String]"]=eK["[object WeakMap]"]=!1;let eJ=function(e){return function(t){return e(t)}};var e$=function(){try{return!1}catch(e){}}(),e0=e$&&e$.isTypedArray,e1=e0?eJ(e0):function(e){return ei(e)&&eZ(e.length)&&!!eK[$(e)]},e2=Object.prototype.hasOwnProperty;let e3=function(e,t){var i=eq(e),r=!i&&eG(e),s=!i&&!r&&eX(e),a=!i&&!r&&!s&&e1(e),o=i||r||s||a,h=o?ej(e.length,String):[],c=h.length;for(var d in e)(t||e2.call(e,d))&&!(o&&("length"==d||s&&("offset"==d||"parent"==d)||a&&("buffer"==d||"byteLength"==d||"byteOffset"==d)||eQ(d,c)))&&h.push(d);return h};var e4=Object.prototype;let e5=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||e4)};var e6=ee(Object.keys,Object),e8=Object.prototype.hasOwnProperty;let e9=function(e){if(!e5(e))return e6(e);var t=[];for(var i in Object(e))e8.call(e,i)&&"constructor"!=i&&t.push(i);return t},e7=function(e){return null!=e&&eZ(e.length)&&!ep(e)},te=function(e){return e7(e)?e3(e):e9(e)},tt=function(e){var t=[];if(null!=e)for(var i in Object(e))t.push(i);return t};var ti=Object.prototype.hasOwnProperty;let tr=function(e){if(!eu(e))return tt(e);var t=e5(e),i=[];for(var r in e)"constructor"==r&&(t||!ti.call(e,r))||i.push(r);return i},ts=function(e){return e7(e)?e3(e,!0):tr(e)},ta=function(e,t){if(t)return e.slice();var i=e.length,r=new e.constructor(i);return e.copy(r),r},tn=function(e,t){var i=-1,r=e.length;for(t||(t=Array(r));++i<r;)t[i]=e[i];return t},to=function(e,t){for(var i=-1,r=null==e?0:e.length,s=0,a=[];++i<r;){var o=e[i];t(o,i,e)&&(a[s++]=o)}return a},tl=function(){return[]};var th=Object.prototype.propertyIsEnumerable,tc=Object.getOwnPropertySymbols,td=tc?function(e){return null==e?[]:to(tc(e=Object(e)),function(t){return th.call(e,t)})}:tl;let tu=function(e,t){for(var i=-1,r=t.length,s=e.length;++i<r;)e[s+i]=t[i];return e};var tp=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)tu(t,td(e)),e=et(e);return t}:tl;let tf=function(e,t,i){var r=t(e);return eq(e)?r:tu(r,i(e))},tm=function(e){return tf(e,te,td)},tg=function(e){return tf(e,ts,tp)};var tv=eC(H,"DataView"),ty=eC(H,"Promise"),tx=eC(H,"Set"),tb=eC(H,"WeakMap"),tw="[object Map]",t_="[object Promise]",tS="[object Set]",tC="[object WeakMap]",tM="[object DataView]",tE=ev(tv),tA=ev(eM),tT=ev(ty),tP=ev(tx),tD=ev(tb),tO=$;
8195(tv&&tO(new tv(new ArrayBuffer(1)))!=tM||eM&&tO(new eM)!=tw||ty&&tO(ty.resolve())!=t_||tx&&tO(new tx)!=tS||tb&&tO(new tb)!=tC)&&(tO=function(e){var t=$(e),i="[object Object]"==t?e.constructor:void 0,r=i?ev(i):"";if(r)switch(r){case tE:return tM;case tA:return tw;case tT:return t_;case tP:return tS;case tD:return tC}return t});let tL=tO;var tI=Object.prototype.hasOwnProperty;let tR=function(e){var t=e.length,i=new e.constructor(t);return t&&"string"==typeof e[0]&&tI.call(e,"index")&&(i.index=e.index,i.input=e.input),i};var tk=H.Uint8Array;let tB=function(e){var t=new e.constructor(e.byteLength);return new tk(t).set(new tk(e)),t},tz=function(e,t){var i=t?tB(e.buffer):e.buffer;return new e.constructor(i,e.byteOffset,e.byteLength)};var tN=/\w*$/;let tF=function(e){var t=new e.constructor(e.source,tN.exec(e));return t.lastIndex=e.lastIndex,t};var tj=G?G.prototype:void 0,tU=tj?tj.valueOf:void 0;let tV=function(e,t){var i=t?tB(e.buffer):e.buffer;return new e.constructor(i,e.byteOffset,e.length)},tW=function(e,t,i){var r=e.constructor;switch(t){case"[object ArrayBuffer]":return tB(e);case"[object Boolean]":case"[object Date]":return new r(+e);case"[object DataView]":return tz(e,i);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return tV(e,i);case"[object Map]":case"[object Set]":return new r;case"[object Number]":case"[object String]":return new r(e);case"[object RegExp]":return tF(e);case"[object Symbol]":return tU?Object(tU.call(e)):{}}};var tH=Object.create,tG=function(){function e(){}return function(t){if(!eu(t))return{};if(tH)return tH(t);e.prototype=t;var i=new e;return e.prototype=void 0,i}}(),tq=e$&&e$.isMap,tX=tq?eJ(tq):function(e){return ei(e)&&"[object Map]"==tL(e)},tY=e$&&e$.isSet,tQ=tY?eJ(tY):function(e){return ei(e)&&"[object Set]"==tL(e)},tZ="[object Arguments]",tK="[object Function]",tJ="[object Object]",t$={};t$[tZ]=t$["[object Array]"]=t$["[object ArrayBuffer]"]=t$["[object DataView]"]=t$["[object Boolean]"]=t$["[object Date]"]=t$["[object Float32Array]"]=t$["[object Float64Array]"]=t$["[object Int8Array]"]=t$["[object Int16Array]"]=t$["[object Int32Array]"]=t$["[object Map]"]=t$["[object Number]"]=t$[tJ]=t$["[object RegExp]"]=t$["[object Set]"]=t$["[object String]"]=t$["[object Symbol]"]=t$["[object Uint8Array]"]=t$["[object Uint8ClampedArray]"]=t$["[object Uint16Array]"]=t$["[object Uint32Array]"]=!0,t$["[object Error]"]=t$[tK]=t$["[object WeakMap]"]=!1;let t0=function e(t,i,r,s,a,o){var h,c=1&i,d=2&i,u=4&i;if(r&&(h=a?r(t,s,a,o):r(t)),void 0!==h)return h;if(!eu(t))return t;var p=eq(t);if(p){if(h=tR(t),!c)return tn(t,h)}else{var f,m,g,v,y,x=tL(t),b=x==tK||"[object GeneratorFunction]"==x;if(eX(t))return ta(t,c);if(x==tJ||x==tZ||b&&!a){if(h=d||b||"function"!=typeof(f=t).constructor||e5(f)?{}:tG(et(f)),!c)return d?(g=(m=h)&&eF(t,ts(t),m),eF(t,tp(t),g)):(y=(v=h)&&eF(t,te(t),v),eF(t,td(t),y))}else{if(!t$[x])return a?t:{};h=tW(t,x,c)}}o||(o=new eI);var w=o.get(t);if(w)return w;o.set(t,h),tQ(t)?t.forEach(function(s){h.add(e(s,i,r,s,t,o))}):tX(t)&&t.forEach(function(s,a){h.set(a,e(s,i,r,a,t,o))});var _=u?d?tg:tm:d?ts:te,S=p?void 0:_(t);return eR(S||t,function(s,a){S&&(s=t[a=s]),eN(h,a,e(s,i,r,a,t,o))}),h},t1=function(e){return t0(e,5)};var t2=e.i(583143);let t3=function(e,t){},t4=function(e){return t0(e,4)},t5=function(e,t){for(var i=-1,r=null==e?0:e.length,s=Array(r);++i<r;)s[i]=t(e[i],i,e);return s},t6=function(e){return"symbol"==typeof e||ei(e)&&"[object Symbol]"==$(e)};function t8(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw TypeError("Expected a function");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 o=e.apply(this,r);return i.cache=a.set(s,o)||a,o};return i.cache=new(t8.Cache||eL),i}t8.Cache=eL;var t9=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,t7=/\\(\\)?/g,ie=(v=(g=t8(function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(t9,function(e,i,r,s){t.push(r?s.replace(t7,"$1"):i||e)}),t},function(e){return 500===v.size&&v.clear(),e})).cache,g),it=1/0;let ii=function(e){if("string"==typeof e||t6(e))return e;var t=e+"";return"0"==t&&1/e==-it?"-0":t};var ir=1/0,is=G?G.prototype:void 0,ia=is?is.toString:void 0;let io=function e(t){if("string"==typeof t)return t;if(eq(t))return t5(t,e)+"";if(t6(t))return ia?ia.call(t):"";var i=t+"";return"0"==i&&1/t==-ir?"-0":i},il=function(e){return eq(e)?t5(e,ii):t6(e)?[e]:tn(ie(null==e?"":io(e)))};var ih=e.i(705927);function ic(){return(ic=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e}).apply(this,arguments)}function id(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function iu(e,t){if(null==e)return{};var i,r,s={},a=Object.keys(e);for(r=0;r<a.length;r++)i=a[r],t.indexOf(i)>=0||(s[i]=e[i]);return s}function ip(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var im=(0,k.createContext)(void 0);im.displayName="FormikContext";var ig=im.Provider,iv=im.Consumer;function iy(){var e=(0,k.useContext)(im);return e||t3(!1),e}var ix=function(e){return Array.isArray(e)&&0===e.length},ib=function(e){return"function"==typeof e},iw=function(e){return null!==e&&"object"==typeof e},i_=function(e){return"[object String]"===Object.prototype.toString.call(e)},iS=function(e){return 0===k.Children.count(e)},iC=function(e){return iw(e)&&ib(e.then)};function iM(e,t,i,r){void 0===r&&(r=0);for(var s=il(t);e&&r<s.length;)e=e[s[r++]];return r===s.length||e?void 0===e?i:e:i}function iE(e,t,i){for(var r=t4(e),s=r,a=0,o=il(t);a<o.length-1;a++){var h=o[a],c=iM(e,o.slice(0,a+1));if(c&&(iw(c)||Array.isArray(c)))s=s[h]=t4(c);else{var d=o[a+1];s=s[h]=String(Math.floor(Number(d)))===d&&Number(d)>=0?[]:{}}}return(0===a?e:s)[o[a]]===i?e:(void 0===i?delete s[o[a]]:s[o[a]]=i,0===a&&void 0===i&&delete r[o[a]],r)}var iA={},iT={};function iP(e){var t,i,r,s,a,o,h,c,d,u,p,f,m,g,v,y,x,b,w,_,S,C,M,E,A,T,P,D,O,L,I,R,B,z,N,F,j,V,W,H,G,q,X,Y,Q,Z,K,J,$,ee,et,ei,er,es,ea,en=(i=void 0===(t=e.validateOnChange)||t,s=void 0===(r=e.validateOnBlur)||r,o=void 0!==(a=e.validateOnMount)&&a,h=e.isInitialValid,d=void 0!==(c=e.enableReinitialize)&&c,u=e.onSubmit,p=iu(e,["validateOnChange","validateOnBlur","validateOnMount","isInitialValid","enableReinitialize","onSubmit"]),f=ic({validateOnChange:i,validateOnBlur:s,validateOnMount:o,onSubmit:u},p),m=(0,k.useRef)(f.initialValues),g=(0,k.useRef)(f.initialErrors||iA),v=(0,k.useRef)(f.initialTouched||iT),y=(0,k.useRef)(f.initialStatus),x=(0,k.useRef)(!1),b=(0,k.useRef)({}),(0,k.useEffect)(function(){return x.current=!0,function(){x.current=!1}},[]),w=(0,k.useState)(0)[1],S=(_=(0,k.useRef)({values:t1(f.initialValues),errors:t1(f.initialErrors)||iA,touched:t1(f.initialTouched)||iT,status:t1(f.initialStatus),isSubmitting:!1,isValidating:!1,submitCount:0})).current,C=(0,k.useCallback)(function(e){var t=_.current;_.current=function(e,t){switch(t.type){case"SET_VALUES":return ic({},e,{values:t.payload});case"SET_TOUCHED":return ic({},e,{touched:t.payload});case"SET_ERRORS":if((0,t2.default)(e.errors,t.payload))return e;return ic({},e,{errors:t.payload});case"SET_STATUS":return ic({},e,{status:t.payload});case"SET_ISSUBMITTING":return ic({},e,{isSubmitting:t.payload});case"SET_ISVALIDATING":return ic({},e,{isValidating:t.payload});case"SET_FIELD_VALUE":return ic({},e,{values:iE(e.values,t.payload.field,t.payload.value)});case"SET_FIELD_TOUCHED":return ic({},e,{touched:iE(e.touched,t.payload.field,t.payload.value)});case"SET_FIELD_ERROR":return ic({},e,{errors:iE(e.errors,t.payload.field,t.payload.value)});case"RESET_FORM":return ic({},e,t.payload);case"SET_FORMIK_STATE":return t.payload(e);case"SUBMIT_ATTEMPT":return ic({},e,{touched:function e(t,i,r,s){void 0===r&&(r=new WeakMap),void 0===s&&(s={});for(var a=0,o=Object.keys(t);a<o.length;a++){var h=o[a],c=t[h];iw(c)?r.get(c)||(r.set(c,!0),s[h]=Array.isArray(c)?[]:{},e(c,i,r,s[h])):s[h]=i}return s}(e.values,!0),isSubmitting:!0,submitCount:e.submitCount+1});case"SUBMIT_FAILURE":case"SUBMIT_SUCCESS":return ic({},e,{isSubmitting:!1});default:return e}}(t,e),t!==_.current&&w(function(e){return e+1})},[]),M=(0,k.useCallback)(function(e,t){return new Promise(function(i,r){var s=f.validate(e,t);null==s?i(iA):iC(s)?s.then(function(e){i(e||iA)},function(e){r(e)}):i(s)})},[f.validate]),E=(0,k.useCallback)(function(e,t){var i,r,s,a,o=f.validationSchema,h=ib(o)?o(t):o,c=t&&h.validateAt?h.validateAt(t,e):(i=e,r=h,void 0===s&&(s=!1),a=function e(t){var i=Array.isArray(t)?[]:{};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){var s=String(r);!0===Array.isArray(t[s])?i[s]=t[s].map(function(t){return!0===Array.isArray(t)||eo(t)?e(t):""!==t?t:void 0}):eo(t[s])?i[s]=e(t[s]):i[s]=""!==t[s]?t[s]:void 0}return i}(i),r[s?"validateSync":"validate"](a,{abortEarly:!1,context:a}));return new Promise(function(e,t){c.then(function(){e(iA)},function(i){"ValidationError"===i.name?e(function(e){var t={};if(e.inner){if(0===e.inner.length)return iE(t,e.path,e.message);for(var i=e.inner,r=Array.isArray(i),s=0,i=r?i:i[Symbol.iterator]();;){if(r){if(s>=i.length)break;a=i[s++]}else{if((s=i.next()).done)break;a=s.value}var a,o=a;iM(t,o.path)||(t=iE(t,o.path,o.message))}}return t}(i)):t(i)})})},[f.validationSchema]),A=(0,k.useCallback)(function(e,t){return new Promise(function(i){return i(b.current[e].validate(t))})},[]),T=(0,k.useCallback)(function(e){var t=Object.keys(b.current).filter(function(e){return ib(b.current[e].validate)});return Promise.all(t.length>0?t.map(function(t){return A(t,iM(e,t))}):[Promise.resolve("DO_NOT_DELETE_YOU_WILL_BE_FIRED")]).then(function(e){return e.reduce(function(e,i,r){return"DO_NOT_DELETE_YOU_WILL_BE_FIRED"===i||i&&(e=iE(e,t[r],i)),e},{})})},[A]),P=(0,k.useCallback)(function(e){return Promise.all([T(e),f.validationSchema?E(e):{},f.validate?M(e):{}]).then(function(e){var t=e[0],i=e[1],r=e[2];return U.all([t,i,r],{arrayMerge:iD})})},[f.validate,f.validationSchema,T,M,E]),D=iL(function(e){return void 0===e&&(e=S.values),C({type:"SET_ISVALIDATING",payload:!0}),P(e).then(function(e){return x.current&&(C({type:"SET_ISVALIDATING",payload:!1}),C({type:"SET_ERRORS",payload:e})),e})}),(0,k.useEffect)(function(){o&&!0===x.current&&(0,t2.default)(m.current,f.initialValues)&&D(m.current)},[o,D]),O=(0,k.useCallback)(function(e){var t=e&&e.values?e.values:m.current,i=e&&e.errors?e.errors:g.current?g.current:f.initialErrors||{},r=e&&e.touched?e.touched:v.current?v.current:f.initialTouched||{},s=e&&e.status?e.status:y.current?y.current:f.initialStatus;m.current=t,g.current=i,v.current=r,y.current=s;var a=function(){C({type:"RESET_FORM",payload:{isSubmitting:!!e&&!!e.isSubmitting,errors:i,touched:r,status:s,values:t,isValidating:!!e&&!!e.isValidating,submitCount:e&&e.submitCount&&"number"==typeof e.submitCount?e.submitCount:0}})};if(f.onReset){var o=f.onReset(S.values,J);iC(o)?o.then(a):a()}else a()},[f.initialErrors,f.initialStatus,f.initialTouched,f.onReset]),(0,k.useEffect)(function(){!0===x.current&&!(0,t2.default)(m.current,f.initialValues)&&d&&(m.current=f.initialValues,O(),o&&D(m.current))},[d,f.initialValues,O,o,D]),(0,k.useEffect)(function(){d&&!0===x.current&&!(0,t2.default)(g.current,f.initialErrors)&&(g.current=f.initialErrors||iA,C({type:"SET_ERRORS",payload:f.initialErrors||iA}))},[d,f.initialErrors]),(0,k.useEffect)(function(){d&&!0===x.current&&!(0,t2.default)(v.current,f.initialTouched)&&(v.current=f.initialTouched||iT,C({type:"SET_TOUCHED",payload:f.initialTouched||iT}))},[d,f.initialTouched]),(0,k.useEffect)(function(){d&&!0===x.current&&!(0,t2.default)(y.current,f.initialStatus)&&(y.current=f.initialStatus,C({type:"SET_STATUS",payload:f.initialStatus}))},[d,f.initialStatus,f.initialTouched]),L=iL(function(e){if(b.current[e]&&ib(b.current[e].validate)){var t=iM(S.values,e),i=b.current[e].validate(t);return iC(i)?(C({type:"SET_ISVALIDATING",payload:!0}),i.then(function(e){return e}).then(function(t){C({type:"SET_FIELD_ERROR",payload:{field:e,value:t}}),C({type:"SET_ISVALIDATING",payload:!1})})):(C({type:"SET_FIELD_ERROR",payload:{field:e,value:i}}),Promise.resolve(i))}return f.validationSchema?(C({type:"SET_ISVALIDATING",payload:!0}),E(S.values,e).then(function(e){return e}).then(function(t){C({type:"SET_FIELD_ERROR",payload:{field:e,value:iM(t,e)}}),C({type:"SET_ISVALIDATING",payload:!1})})):Promise.resolve()}),I=(0,k.useCallback)(function(e,t){var i=t.validate;b.current[e]={validate:i}},[]),R=(0,k.useCallback)(function(e){delete b.current[e]},[]),B=iL(function(e,t){return C({type:"SET_TOUCHED",payload:e}),(void 0===t?s:t)?D(S.values):Promise.resolve()}),z=(0,k.useCallback)(function(e){C({type:"SET_ERRORS",payload:e})},[]),N=iL(function(e,t){var r=ib(e)?e(S.values):e;return C({type:"SET_VALUES",payload:r}
8195),(void 0===t?i:t)?D(r):Promise.resolve()}),F=(0,k.useCallback)(function(e,t){C({type:"SET_FIELD_ERROR",payload:{field:e,value:t}})},[]),j=iL(function(e,t,r){return C({type:"SET_FIELD_VALUE",payload:{field:e,value:t}}),(void 0===r?i:r)?D(iE(S.values,e,t)):Promise.resolve()}),V=(0,k.useCallback)(function(e,t){var i,r=t,s=e;if(!i_(e)){e.persist&&e.persist();var a=e.target?e.target:e.currentTarget,o=a.type,h=a.name,c=a.id,d=a.value,u=a.checked,p=(a.outerHTML,a.options),f=a.multiple;r=t||h||c,s=/number|range/.test(o)?isNaN(i=parseFloat(d))?"":i:/checkbox/.test(o)?function(e,t,i){if("boolean"==typeof e)return!!t;var r=[],s=!1,a=-1;if(Array.isArray(e))r=e,s=(a=e.indexOf(i))>=0;else if(!i||"true"==i||"false"==i)return!!t;return t&&i&&!s?r.concat(i):s?r.slice(0,a).concat(r.slice(a+1)):r}(iM(S.values,r),u,d):p&&f?Array.from(p).filter(function(e){return e.selected}).map(function(e){return e.value}):d}r&&j(r,s)},[j,S.values]),W=iL(function(e){if(i_(e))return function(t){return V(t,e)};V(e)}),H=iL(function(e,t,i){return void 0===t&&(t=!0),C({type:"SET_FIELD_TOUCHED",payload:{field:e,value:t}}),(void 0===i?s:i)?D(S.values):Promise.resolve()}),G=(0,k.useCallback)(function(e,t){e.persist&&e.persist();var i=e.target,r=i.name,s=i.id;i.outerHTML,H(t||r||s,!0)},[H]),q=iL(function(e){if(i_(e))return function(t){return G(t,e)};G(e)}),X=(0,k.useCallback)(function(e){ib(e)?C({type:"SET_FORMIK_STATE",payload:e}):C({type:"SET_FORMIK_STATE",payload:function(){return e}})},[]),Y=(0,k.useCallback)(function(e){C({type:"SET_STATUS",payload:e})},[]),Q=(0,k.useCallback)(function(e){C({type:"SET_ISSUBMITTING",payload:e})},[]),Z=iL(function(){return C({type:"SUBMIT_ATTEMPT"}),D().then(function(e){var t,i=e instanceof Error;if(!i&&0===Object.keys(e).length){try{if(t=$(),void 0===t)return}catch(e){throw e}return Promise.resolve(t).then(function(e){return x.current&&C({type:"SUBMIT_SUCCESS"}),e}).catch(function(e){if(x.current)throw C({type:"SUBMIT_FAILURE"}),e})}if(x.current&&(C({type:"SUBMIT_FAILURE"}),i))throw e})}),K=iL(function(e){e&&e.preventDefault&&ib(e.preventDefault)&&e.preventDefault(),e&&e.stopPropagation&&ib(e.stopPropagation)&&e.stopPropagation(),Z().catch(function(e){console.warn("Warning: An unhandled error was caught from submitForm()",e)})}),J={resetForm:O,validateForm:D,validateField:L,setErrors:z,setFieldError:F,setFieldTouched:H,setFieldValue:j,setStatus:Y,setSubmitting:Q,setTouched:B,setValues:N,setFormikState:X,submitForm:Z},$=iL(function(){return u(S.values,J)}),ee=iL(function(e){e&&e.preventDefault&&ib(e.preventDefault)&&e.preventDefault(),e&&e.stopPropagation&&ib(e.stopPropagation)&&e.stopPropagation(),O()}),et=(0,k.useCallback)(function(e){return{value:iM(S.values,e),error:iM(S.errors,e),touched:!!iM(S.touched,e),initialValue:iM(m.current,e),initialTouched:!!iM(v.current,e),initialError:iM(g.current,e)}},[S.errors,S.touched,S.values]),ei=(0,k.useCallback)(function(e){return{setValue:function(t,i){return j(e,t,i)},setTouched:function(t,i){return H(e,t,i)},setError:function(t){return F(e,t)}}},[j,H,F]),er=(0,k.useCallback)(function(e){var t=iw(e),i=t?e.name:e,r=iM(S.values,i),s={name:i,value:r,onChange:W,onBlur:q};if(t){var a=e.type,o=e.value,h=e.as,c=e.multiple;"checkbox"===a?void 0===o?s.checked=!!r:(s.checked=!!(Array.isArray(r)&&~r.indexOf(o)),s.value=o):"radio"===a?(s.checked=r===o,s.value=o):"select"===h&&c&&(s.value=s.value||[],s.multiple=!0)}return s},[q,W,S.values]),es=(0,k.useMemo)(function(){return!(0,t2.default)(m.current,S.values)},[m.current,S.values]),ea=(0,k.useMemo)(function(){return void 0!==h?es?S.errors&&0===Object.keys(S.errors).length:!1!==h&&ib(h)?h(f):h:S.errors&&0===Object.keys(S.errors).length},[h,es,S.errors,f]),ic({},S,{initialValues:m.current,initialErrors:g.current,initialTouched:v.current,initialStatus:y.current,handleBlur:q,handleChange:W,handleReset:ee,handleSubmit:K,resetForm:O,setErrors:z,setFormikState:X,setFieldTouched:H,setFieldValue:j,setFieldError:F,setStatus:Y,setSubmitting:Q,setTouched:B,setValues:N,submitForm:Z,validateForm:D,validateField:L,isValid:ea,dirty:es,unregisterField:R,registerField:I,getFieldProps:er,getFieldMeta:et,getFieldHelpers:ei,val
8195idateOnBlur:s,validateOnChange:i,validateOnMount:o})),el=e.component,eh=e.children,ec=e.render,ed=e.innerRef;return(0,k.useImperativeHandle)(ed,function(){return en}),(0,k.createElement)(ig,{value:en},el?(0,k.createElement)(el,en):ec?ec(en):eh?ib(eh)?eh(en):iS(eh)?null:k.Children.only(eh):null)}function iD(e,t,i){var r=e.slice();return t.forEach(function(t,s){if(void 0===r[s]){var a=!1!==i.clone&&i.isMergeableObject(t);r[s]=a?U(Array.isArray(t)?[]:{},t,i):t}else i.isMergeableObject(t)?r[s]=U(e[s],t,i):-1===e.indexOf(t)&&r.push(t)}),r}var iO="u">typeof window&&void 0!==window.document&&void 0!==window.document.createElement?k.useLayoutEffect:k.useEffect;function iL(e){var t=(0,k.useRef)(e);return iO(function(){t.current=e}),(0,k.useCallback)(function(){for(var e=arguments.length,i=Array(e),r=0;r<e;r++)i[r]=arguments[r];return t.current.apply(void 0,i)},[])}function iI(e){var t=e.validate,i=e.name,r=e.render,s=e.children,a=e.as,o=e.component,h=e.className,c=iu(e,["validate","name","render","children","as","component","className"]),d=iu(iy(),["validate","validationSchema"]),u=d.registerField,p=d.unregisterField;(0,k.useEffect)(function(){return u(i,{validate:t}),function(){p(i)}},[u,p,i,t]);var f=d.getFieldProps(ic({name:i},c)),m=d.getFieldMeta(i),g={field:f,form:d};if(r)return r(ic({},g,{meta:m}));if(ib(s))return s(ic({},g,{meta:m}));if(o){if("string"==typeof o){var v=c.innerRef,y=iu(c,["innerRef"]);return(0,k.createElement)(o,ic({ref:v},f,y,{className:h}),s)}return(0,k.createElement)(o,ic({field:f,form:d},c,{className:h}),s)}var x=a||"input";if("string"==typeof x){var b=c.innerRef,w=iu(c,["innerRef"]);return(0,k.createElement)(x,ic({ref:b},f,w,{className:h}),s)}return(0,k.createElement)(x,ic({},f,c,{className:h}),s)}var iR=(0,k.forwardRef)(function(e,t){var i=e.action,r=iu(e,["action"]),s=iy(),a=s.handleReset,o=s.handleSubmit;return(0,k.createElement)("form",ic({onSubmit:o,ref:t,onReset:a,action:null!=i?i:"#"},r))});iR.displayName="Form";var ik=function(e,t,i){var r=iF(e),s=r[t];return r.splice(t,1),r.splice(i,0,s),r},iB=function(e,t,i){var r=iF(e),s=r[t];return r[t]=r[i],r[i]=s,r},iz=function(e,t,i){var r=iF(e);return r.splice(t,0,i),r},iN=function(e,t,i){var r=iF(e);return r[t]=i,r},iF=function(e){if(!e)return[];if(Array.isArray(e))return[].concat(e);var t=Object.keys(e).map(function(e){return parseInt(e)}).reduce(function(e,t){return t>e?t:e},0);return Array.from(ic({},e,{length:t+1}))},ij=function(e,t){var i="function"==typeof e?e:t;return function(e){return Array.isArray(e)||iw(e)?i(iF(e)):e}};(function(e){function t(t){var i;return(i=e.call(this,t)||this).updateArrayField=function(e,t,r){var s=i.props,a=s.name;(0,s.formik.setFormikState)(function(i){var s=ij(r,e),o=ij(t,e),h=iE(i.values,a,e(iM(i.values,a))),c=r?s(iM(i.errors,a)):void 0,d=t?o(iM(i.touched,a)):void 0;return ix(c)&&(c=void 0),ix(d)&&(d=void 0),ic({},i,{values:h,errors:r?iE(i.errors,a,c):i.errors,touched:t?iE(i.touched,a,d):i.touched})})},i.push=function(e){return i.updateArrayField(function(t){return[].concat(iF(t),[t1(e)])},!1,!1)},i.handlePush=function(e){return function(){return i.push(e)}},i.swap=function(e,t){return i.updateArrayField(function(i){return iB(i,e,t)},!0,!0)},i.handleSwap=function(e,t){return function(){return i.swap(e,t)}},i.move=function(e,t){return i.updateArrayField(function(i){return ik(i,e,t)},!0,!0)},i.handleMove=function(e,t){return function(){return i.move(e,t)}},i.insert=function(e,t){return i.updateArrayField(function(i){return iz(i,e,t)},function(t){return iz(t,e,null)},function(t){return iz(t,e,null)})},i.handleInsert=function(e,t){return function(){return i.insert(e,t)}},i.replace=function(e,t){return i.updateArrayField(function(i){return iN(i,e,t)},!1,!1)},i.handleReplace=function(e,t){return function(){return i.replace(e,t)}},i.unshift=function(e){var t=-1;return i.updateArrayField(function(i){var r=i?[e].concat(i):[e];return t=r.length,r},function(e){return e?[null].concat(e):[null]},function(e){return e?[null].concat(e):[null]}),t},i.handleUnshift=function(e){return function(){return i.unshift(e)}},i.handleRemove=function(e){return function(){return i.remove(e)}},i.handlePop=function(){return function(){return i.pop()}},i.remove=i.remove.bind(ip(i)),i.pop=i.pop.bind(ip(i)),i}id(t,e);var i=t.prototype;return i.componentDidUpdate=function(e){this.props.validateOnChange&&this.props.formik.validateOnChange&&!(0,t2.default)(iM(e.formik.values,e.name),iM(this.props.formik.values,this.props.name))&&this.props.formik.validateForm(this.props.formik.values)},i.remove=function(e){var t;return this.updateArrayField(function(i){var r=i?iF(i):[];return t||(t=r[e]),ib(r.splice)&&r.splice(e,1),ib(r.every)&&r.every(function(e){return void 0===e})?[]:r},!0,!0),t},i.pop=function(){var e;return this.updateArrayField(function(t){var i=t.slice();return e||(e=i&&i.pop&&i.pop()),i},!0,!0),e},i.render=function(){var e={push:this.push,pop:this.pop,swap:this.swap,move:this.move,insert:this.insert,replace:this.replace,unshift:this.unshift,remove:this.remove,handlePush:this.handlePush,handlePop:this.handlePop,handleSwap:this.handleSwap,handleMove:this.handleMove,handleInsert:this.handleInsert,handleReplace:this.handleReplace,handleUnshift:this.handleUnshift,handleRemove:this.handleRemove},t=this.props,i=t.component,r=t.render,s=t.children,a=t.name,o=iu(t.formik,["validate","validationSchema"]),h=ic({},e,{form:o,name:a});return i?(0,k.createElement)(i,h):r?r(h):s?"function"==typeof s?s(h):iS(s)?null:k.Children.only(s):null},t})(k.Component).defaultProps={validateOnChange:!0};var iU=(y=function(e){function t(){return e.apply(this,arguments)||this}id(t,e);var i=t.prototype;return i.shouldComponentUpdate=function(e){return iM(this.props.formik.errors,this.props.name)!==iM(e.formik.errors,this.props.name)||iM(this.props.formik.touched,this.props.name)!==iM(e.formik.touched,this.props.name)||Object.keys(this.props).length!==Object.keys(e).length},i.render=function(){var e=this.props,t=e.component,i=e.formik,r=e.render,s=e.children,a=e.name,o=iu(e,["component","formik","render","children","name"]),h=iM(i.touched,a),c=iM(i.errors,a);return h&&c?r?ib(r)?r(c):null:s?ib(s)?s(c):null:t?(0,k.createElement)(t,o,c):c:null},t}(k.Component),x=function(e){return(0,k.createElement)(iv,null,function(t){return t||t3(!1),(0,k.createElement)(y,ic({},e,{formik:t}))})}
8195,b=y.displayName||y.name||y.constructor&&y.constructor.name||"Component",x.WrappedComponent=y,x.displayName="FormikConnect("+b+")",(0,ih.default)(x,y));k.Component;var iV=e.i(979546),iW=e.i(950434),iH=e.i(427001);let iG=Object.prototype.toString,iq=Error.prototype.toString,iX=RegExp.prototype.toString,iY="u">typeof Symbol?Symbol.prototype.toString:()=>"",iQ=/^Symbol\((.*)\)(.*)$/;function iZ(e,t=!1){if(null==e||!0===e||!1===e)return""+e;let i=typeof e;if("number"===i)return e!=+e?"NaN":0===e&&1/e<0?"-0":""+e;if("string"===i)return t?`"${e}"`:e;if("function"===i)return"[Function "+(e.name||"anonymous")+"]";if("symbol"===i)return iY.call(e).replace(iQ,"Symbol($1)");let r=iG.call(e).slice(8,-1);return"Date"===r?isNaN(e.getTime())?""+e:e.toISOString(e):"Error"===r||e instanceof Error?"["+iq.call(e)+"]":"RegExp"===r?iX.call(e):null}function iK(e,t){let i=iZ(e,t);return null!==i?i:JSON.stringify(e,function(e,i){let r=iZ(this[e],t);return null!==r?r:i},2)}function iJ(e){return null==e?[]:[].concat(e)}let i$=/\$\{\s*(\w+)\s*\}/g;t=Symbol.toStringTag;class i0{constructor(e,i,r,s){this.name=void 0,this.message=void 0,this.value=void 0,this.path=void 0,this.type=void 0,this.params=void 0,this.errors=void 0,this.inner=void 0,this[t]="Error",this.name="ValidationError",this.value=i,this.path=r,this.type=s,this.errors=[],this.inner=[],iJ(e).forEach(e=>{if(i1.isError(e)){this.errors.push(...e.errors);let t=e.inner.length?e.inner:[e];this.inner.push(...t)}else this.errors.push(e)}),this.message=this.errors.length>1?`${this.errors.length} errors occurred`:this.errors[0]}}i=Symbol.hasInstance,r=Symbol.toStringTag;class i1 extends Error{static formatError(e,t){let i=t.label||t.path||"this";return(t=Object.assign({},t,{path:i,originalPath:t.path}),"string"==typeof e)?e.replace(i$,(e,i)=>iK(t[i])):"function"==typeof e?e(t):e}static isError(e){return e&&"ValidationError"===e.name}constructor(e,t,i,s,a){const o=new i0(e,t,i,s);if(a)return o;super(),this.value=void 0,this.path=void 0,this.type=void 0,this.params=void 0,this.errors=[],this.inner=[],this[r]="Error",this.name=o.name,this.message=o.message,this.type=o.type,this.value=o.value,this.path=o.path,this.errors=o.errors,this.inner=o.inner,Error.captureStackTrace&&Error.captureStackTrace(this,i1)}static[i](e){return i0[Symbol.hasInstance](e)||super[Symbol.hasInstance](e)}}let i2={default:"${path} is invalid",required:"${path} is a required field",defined:"${path} must be defined",notNull:"${path} cannot be null",oneOf:"${path} must be one of the following values: ${values}",notOneOf:"${path} must not be one of the following values: ${values}",notType:({path:e,type:t,value:i,originalValue:r})=>{let s=null!=r&&r!==i?` (cast from the value \`${iK(r,!0)}\`).`:".";return"mixed"!==t?`${e} must be a \`${t}\` type, but the final value was: \`${iK(i,!0)}\``+s:`${e} must match the configured type. The validated value was: \`${iK(i,!0)}\``+s}},i3={length:"${path} must be exactly ${length} characters",min:"${path} must be at least ${min} characters",max:"${path} must be at most ${max} characters",matches:'${path} must match the following: "${regex}"',email:"${path} must be a valid email",url:"${path} must be a valid URL",uuid:"${path} must be a valid UUID",datetime:"${path} must be a valid ISO date-time",datetime_precision:"${path} must be a valid ISO date-time with a sub-second precision of exactly ${precision} digits",datetime_offset:'${path} must be a valid ISO date-time with UTC "Z" timezone',trim:"${path} must be a trimmed string",lowercase:"${path} must be a lowercase string",uppercase:"${path} must be a upper case string"},i4={min:"${path} must be greater than or equal to ${min}",max:"${path} must be less than or equal to ${max}",lessThan:"${path} must be less than ${less}",moreThan:"${path} must be greater than ${more}",positive:"${path} must be a positive number",negative:"${path} must be a negative number",integer:"${path} must be an integer"},i5={min:"${path} field must be later than ${min}",max:"${path} field must be at earlier than ${max}"},i6={isValue:"${path} field must be ${value}"},i8={noUnknown:"${path} field has unspecified keys: ${unknown}",exact:"${path}
8195 object contains unknown properties: ${properties}"},i9={min:"${path} field must have at least ${min} items",max:"${path} field must have less than or equal to ${max} items",length:"${path} must have ${length} items"},i7={notType:e=>{let{path:t,value:i,spec:r}=e,s=r.types.length;if(Array.isArray(i)){if(i.length<s)return`${t} tuple value has too few items, expected a length of ${s} but got ${i.length} for value: \`${iK(i,!0)}\``;if(i.length>s)return`${t} tuple value has too many items, expected a length of ${s} but got ${i.length} for value: \`${iK(i,!0)}\``}return i1.formatError(i2.notType,e)}};Object.assign(Object.create(null),{mixed:i2,string:i3,number:i4,date:i5,object:i8,array:i9,boolean:i6,tuple:i7});let re=e=>e&&e.__isYupSchema__;class rt{static fromOptions(e,t){if(!t.then&&!t.otherwise)throw TypeError("either `then:` or `otherwise:` is required for `when()` conditions");let{is:i,then:r,otherwise:s}=t,a="function"==typeof i?i:(...e)=>e.every(e=>e===i);return new rt(e,(e,t)=>{var i;let o=a(...e)?r:s;return null!=(i=null==o?void 0:o(t))?i:t})}constructor(e,t){this.fn=void 0,this.refs=e,this.refs=e,this.fn=t}resolve(e,t){let i=this.refs.map(e=>e.getValue(null==t?void 0:t.value,null==t?void 0:t.parent,null==t?void 0:t.context)),r=this.fn(i,e,t);if(void 0===r||r===e)return e;if(!re(r))throw TypeError("conditions must return a schema object");return r.resolve(t)}}class ri{constructor(e,t={}){if(this.key=void 0,this.isContext=void 0,this.isValue=void 0,this.isSibling=void 0,this.path=void 0,this.getter=void 0,this.map=void 0,"string"!=typeof e)throw TypeError("ref must be a string, got: "+e);if(this.key=e.trim(),""===e)throw TypeError("ref must be a non-empty string");this.isContext="$"===this.key[0],this.isValue="."===this.key[0],this.isSibling=!this.isContext&&!this.isValue;let i=this.isContext?"$":this.isValue?".":"";this.path=this.key.slice(i.length),this.getter=this.path&&(0,iV.getter)(this.path,!0),this.map=t.map}getValue(e,t,i){let r=this.isContext?i:this.isValue?e:t;return this.getter&&(r=this.getter(r||{})),this.map&&(r=this.map(r)),r}cast(e,t){return this.getValue(e,null==t?void 0:t.parent,null==t?void 0:t.context)}resolve(){return this}describe(){return{type:"ref",key:this.key}}toString(){return`Ref(${this.key})`}static isRef(e){return e&&e.__isYupRef}}function rr(e){function t({value:i,path:r="",options:s,originalValue:a,schema:o},h,c){let d,{name:u,test:p,params:f,message:m,skipAbsent:g}=e,{parent:v,context:y,abortEarly:x=o.spec.abortEarly,disableStackTrace:b=o.spec.disableStackTrace}=s,w={value:i,parent:v,context:y};function _(e={}){let t=rs(Object.assign({value:i,originalValue:a,label:o.spec.label,path:e.path||r,spec:o.spec,disableStackTrace:e.disableStackTrace||b},f,e.params),w),s=new i1(i1.formatError(e.message||m,t),i,t.path,e.type||u,t.disableStackTrace);return s.params=t,s}let S=x?h:c,C={path:r,parent:v,type:u,from:s.from,createError:_,resolve:e=>ra(e,w),options:s,originalValue:a,schema:o},M=e=>{i1.isError(e)?S(e):e?c(null):S(_())},E=e=>{i1.isError(e)?S(e):h(e)};if(g&&null==i)return M(!0);try{var A;if(d=p.call(C,i,C),"function"==typeof(null==(A=d)?void 0:A.then)){if(s.sync)throw Error(`Validation test of type: "${C.type}" returned a Promise during a synchronous validate. This test will finish after the validate call has returned`);return Promise.resolve(d).then(M,E)}}catch(e){E(e);return}M(d)}return t.OPTIONS=e,t}function rs(e,t){if(!e)return e;for(let i of Object.keys(e))e[i]=ra(e[i],t);return e}function ra(e,t){return ri.isRef(e)?e.getValue(t.value,t.parent,t.context):e}ri.prototype.__isYupRef=!0;class rn extends Set{describe(){let e=[];for(let t of this.values())e.push(ri.isRef(t)?t.describe():t);return e}resolveAll(e){let t=[];for(let i of this.values())t.push(e(i));return t}clone(){return new rn(this.values())}merge(e,t){let i=this.clone();return e.forEach(e=>i.add(e)),t.forEach(e=>i.delete(e)),i}}function ro(e,t=new Map){let i;if(re(e)||!e||"object"!=typeof e)return e;if(t.has(e))return t.get(e);if(e instanceof Date)i=new Date(e.getTime()),t.set(e,i);else if(e instanceof RegExp)i=new RegExp(e),t.set(e,i);else if(Array.isArray(e)){i=Array(e.length),t.set(e,i);for(let r=0;r<e.length;r++)i[r]=ro(e[r],t)}else if(e instanceof Map)for(let[r,s]of(i=new Map,t.set(e,i),e.entries()))i.set(r,ro(s,t));else if(e instanceof Set)for(let r of(i=new Set,t.set(e,i),e))i.add(ro(r,t));else if(e instanceof Object)for(let[r,s]of(i={},t.set(e,i),Object.entries(e)))i[r]=ro(s,t);else throw Error(`Unable to clone ${e}`);return i}function rl(e,t){var i;if(!(null!=(i=e.inner)&&i.length)&&e.errors.length){let i;return i=t?`${t}.${e.path}`:e.path,e.errors.map(e=>({message:e,path:function(e){if(!(null!=e&&e.length))return;let t=[],i="",r=!1,s=!1;for(let a=0;a<e.length;a++){let o=e[a];
8195if("["===o&&!s){i&&(t.push(...i.split(".").filter(Boolean)),i=""),r=!0;continue}if("]"===o&&!s){i&&(/^\d+$/.test(i)?t.push(i):t.push(i.replace(/^"|"$/g,"")),i=""),r=!1;continue}if('"'===o){s=!s;continue}if("."===o&&!r&&!s){i&&(t.push(i),i="");continue}i+=o}return i&&t.push(...i.split(".").filter(Boolean)),t}(i)}))}let r=t?`${t}.${e.path}`:e.path;return e.inner.flatMap(e=>rl(e,r))}class rh{constructor(e){this.type=void 0,this.deps=[],this.tests=void 0,this.transforms=void 0,this.conditions=[],this._mutate=void 0,this.internalTests={},this._whitelist=new rn,this._blacklist=new rn,this.exclusiveTests=Object.create(null),this._typeCheck=void 0,this.spec=void 0,this.tests=[],this.transforms=[],this.withMutation(()=>{this.typeError(i2.notType)}),this.type=e.type,this._typeCheck=e.check,this.spec=Object.assign({strip:!1,strict:!1,abortEarly:!0,recursive:!0,disableStackTrace:!1,nullable:!1,optional:!0,coerce:!0},null==e?void 0:e.spec),this.withMutation(e=>{e.nonNullable()})}get _type(){return this.type}clone(e){if(this._mutate)return e&&Object.assign(this.spec,e),this;let t=Object.create(Object.getPrototypeOf(this));return t.type=this.type,t._typeCheck=this._typeCheck,t._whitelist=this._whitelist.clone(),t._blacklist=this._blacklist.clone(),t.internalTests=Object.assign({},this.internalTests),t.exclusiveTests=Object.assign({},this.exclusiveTests),t.deps=[...this.deps],t.conditions=[...this.conditions],t.tests=[...this.tests],t.transforms=[...this.transforms],t.spec=ro(Object.assign({},this.spec,e)),t}label(e){let t=this.clone();return t.spec.label=e,t}meta(...e){if(0===e.length)return this.spec.meta;let t=this.clone();return t.spec.meta=Object.assign(t.spec.meta||{},e[0]),t}withMutation(e){let t=this._mutate;this._mutate=!0;let i=e(this);return this._mutate=t,i}concat(e){if(!e||e===this)return this;if(e.type!==this.type&&"mixed"!==this.type)throw TypeError(`You cannot \`concat()\` schema's of different types: ${this.type} and ${e.type}`);let t=e.clone(),i=Object.assign({},this.spec,t.spec);return t.spec=i,t.internalTests=Object.assign({},this.internalTests,t.internalTests),t._whitelist=this._whitelist.merge(e._whitelist,e._blacklist),t._blacklist=this._blacklist.merge(e._blacklist,e._whitelist),t.tests=this.tests,t.exclusiveTests=this.exclusiveTests,t.withMutation(t=>{e.tests.forEach(e=>{t.test(e.OPTIONS)})}),t.transforms=[...this.transforms,...t.transforms],t}isType(e){return null==e?!!this.spec.nullable&&null===e||!!this.spec.optional&&void 0===e:this._typeCheck(e)}resolve(e){let t=this;if(t.conditions.length){let i=t.conditions;(t=t.clone()).conditions=[],t=(t=i.reduce((t,i)=>i.resolve(t,e),t)).resolve(e)}return t}resolveOptions(e){var t,i,r,s;return Object.assign({},e,{from:e.from||[],strict:null!=(t=e.strict)?t:this.spec.strict,abortEarly:null!=(i=e.abortEarly)?i:this.spec.abortEarly,recursive:null!=(r=e.recursive)?r:this.spec.recursive,disableStackTrace:null!=(s=e.disableStackTrace)?s:this.spec.disableStackTrace})}cast(e,t={}){let i=this.resolve(Object.assign({value:e},t)),r="ignore-optionality"===t.assert,s=i._cast(e,t);if(!1!==t.assert&&!i.isType(s)){if(r&&null==s)return s;let a=iK(e),o=iK(s);throw TypeError(`The value of ${t.path||"field"} could not be cast to a value that satisfies the schema type: "${i.type}". 
8196
8197attempted value: ${a} 
8198`+(o!==a?`result of cast: ${o}`:""))}return s}_cast(e,t){let i=void 0===e?e:this.transforms.reduce((t,i)=>i.call(this,t,e,this),e);return void 0===i&&(i=this.getDefault(t)),i}_validate(e,t={},i,r){let{path:s,originalValue:a=e,strict:o=this.spec.strict}=t,h=e;o||(h=this._cast(h,Object.assign({assert:!1},t)));let c=[];for(let e of Object.values(this.internalTests))e&&c.push(e);this.runTests({path:s,value:h,originalValue:a,options:t,tests:c},i,e=>{if(e.length)return r(e,h);this.runTests({path:s,value:h,originalValue:a,options:t,tests:this.tests},i,r)})}runTests(e,t,i){let r=!1,{tests:s,value:a,originalValue:o,path:h,options:c}=e,d=e=>{r||(r=!0,t(e,a))},u=e=>{r||(r=!0,i(e,a))},p=s.length,f=[];if(!p)return u([]);let m={value:a,originalValue:o,path:h,options:c,schema:this};for(let e=0;e<s.length;e++)(0,s[e])(m,d,function(e){e&&(Array.isArray(e)?f.push(...e):f.push(e)),--p<=0&&u(f)})}asNestedTest({key:e,index:t,parent:i,parentPath:r,originalParent:s,options:a}){let o=null!=e?e:t;
vendor: 4,160 bytes, line 8198
8198if(null==o)throw TypeError("Must include `key` or `index` for nested validations");let h="number"==typeof o,c=i[o],d=Object.assign({},a,{strict:!0,parent:i,value:c,originalValue:s[o],key:void 0,[h?"index":"key"]:o,path:h||o.includes(".")?`${r||""}[${h?o:`"${o}"`}]`:(r?`${r}.`:"")+e});return(e,t,i)=>this.resolve(d)._validate(c,d,t,i)}validate(e,t){var i;let r=this.resolve(Object.assign({},t,{value:e})),s=null!=(i=null==t?void 0:t.disableStackTrace)?i:r.spec.disableStackTrace;return new Promise((i,a)=>r._validate(e,t,(e,t)=>{i1.isError(e)&&(e.value=t),a(e)},(e,t)=>{e.length?a(new i1(e,t,void 0,void 0,s)):i(t)}))}validateSync(e,t){var i;let r,s=this.resolve(Object.assign({},t,{value:e})),a=null!=(i=null==t?void 0:t.disableStackTrace)?i:s.spec.disableStackTrace;return s._validate(e,Object.assign({},t,{sync:!0}),(e,t)=>{throw i1.isError(e)&&(e.value=t),e},(t,i)=>{if(t.length)throw new i1(t,e,void 0,void 0,a);r=i}),r}isValid(e,t){return this.validate(e,t).then(()=>!0,e=>{if(i1.isError(e))return!1;throw e})}isValidSync(e,t){try{return this.validateSync(e,t),!0}catch(e){if(i1.isError(e))return!1;throw e}}_getDefault(e){let t=this.spec.default;return null==t?t:"function"==typeof t?t.call(this,e):ro(t)}getDefault(e){return this.resolve(e||{})._getDefault(e)}default(e){return 0==arguments.length?this._getDefault():this.clone({default:e})}strict(e=!0){return this.clone({strict:e})}nullability(e,t){let i=this.clone({nullable:e});return i.internalTests.nullable=rr({message:t,name:"nullable",test(e){return null!==e||this.schema.spec.nullable}}),i}optionality(e,t){let i=this.clone({optional:e});return i.internalTests.optionality=rr({message:t,name:"optionality",test(e){return void 0!==e||this.schema.spec.optional}}),i}optional(){return this.optionality(!0)}defined(e=i2.defined){return this.optionality(!1,e)}nullable(){return this.nullability(!0)}nonNullable(e=i2.notNull){return this.nullability(!1,e)}required(e=i2.required){return this.clone().withMutation(t=>t.nonNullable(e).defined(e))}notRequired(){return this.clone().withMutation(e=>e.nullable().optional())}transform(e){let t=this.clone();return t.transforms.push(e),t}test(...e){let t;if(void 0===(t=1===e.length?"function"==typeof e[0]?{test:e[0]}:e[0]:2===e.length?{name:e[0],test:e[1]}:{name:e[0],message:e[1],test:e[2]}).message&&(t.message=i2.default),"function"!=typeof t.test)throw TypeError("`test` is a required parameters");let i=this.clone(),r=rr(t),s=t.exclusive||t.name&&!0===i.exclusiveTests[t.name];if(t.exclusive&&!t.name)throw TypeError("Exclusive tests must provide a unique `name` identifying the test");return t.name&&(i.exclusiveTests[t.name]=!!t.exclusive),i.tests=i.tests.filter(e=>(e.OPTIONS.name!==t.name||!s&&e.OPTIONS.test!==r.OPTIONS.test)&&!0),i.tests.push(r),i}when(e,t){Array.isArray(e)||"string"==typeof e||(t=e,e=".");let i=this.clone(),r=iJ(e).map(e=>new ri(e));return r.forEach(e=>{e.isSibling&&i.deps.push(e.key)}),i.conditions.push("function"==typeof t?new rt(r,t):rt.fromOptions(r,t)),i}typeError(e){let t=this.clone();return t.internalTests.typeError=rr({message:e,name:"typeError",skipAbsent:!0,test(e){return!!this.schema._typeCheck(e)||this.createError({params:{type:this.schema.type}})}}),t}oneOf(e,t=i2.oneOf){let i=this.clone();return e.forEach(e=>{i._whitelist.add(e),i._blacklist.delete(e)}),i.internalTests.whiteList=rr({message:t,name:"oneOf",skipAbsent:!0,test(e){let t=this.schema._whitelist,i=t.resolveAll(this.resolve);return!!i.includes(e)||this.createError({params:{values:Array.from(t).join(", "),resolved:i}})}}),i}notOneOf(e,t=i2.notOneOf){let i=this.clone();return e.forEach(e=>{i._blacklist.add(e),i._whitelist.delete(e)}),i.internalTests.blacklist=rr({message:t,name:"notOneOf",test(e){let t=this.schema._blacklist,i=t.resolveAll(this.resolve);return!i.includes(e)||this.createError({params:{values:Array.from(t).join(", "),resolved:i}})}}),i}strip(e=!0){let t=this.clone();return t.spec.strip=e,t}describe(e){let t=(e?this.resolve(e):this).clone(),{label:i,meta:r,optional:s,nullable:a}=t.spec;return{meta:r,label:i,optional:s,nullable:a,default:t.getDefault(e),type:t.type,oneOf:t._whitelist.describe(),notOneOf:t._blackl
8198ist.describe(),tests:t.tests.filter((e,t,i)=>i.findIndex(t=>t.OPTIONS.name===e.OPTIONS.name)===t).map(t=>{let i=t.OPTIONS.params&&e?rs(Object.assign({},t.OPTIONS.params),e):t.OPTIONS.params;return{name:t.OPTIONS.name,params:i}})}}get"~standard"(){let e=this;return{version:1,vendor:"yup",async validate(t){try{return{value:await e.validate(t,{abortEarly:!1})}}catch(e){if(e instanceof i1)return{issues:rl(e)};throw e}}}}}for(let e of(rh.prototype.__isYupSchema__=!0,["validate","validateSync"]))rh.prototype[`${e}At`]=function(t,i,r={}){let{parent:s,parentPath:a,schema:o}=function(e,t,i,r=i){let s,a,o;return t?((0,iV.forEach)(t,(h,c,d)=>{let u=c?h.slice(1,h.length-1):h,p="tuple"===(e=e.resolve({context:r,parent:s,value:i})).type,f=d?parseInt(u,10):0;if(e.innerType||p){if(p&&!d)throw Error(`Yup.reach cannot implicitly index into a tuple type. the path part "${o}" must contain an index to the tuple element, e.g. "${o}[0]"`);if(i&&f>=i.length)throw Error(`Yup.reach cannot resolve an array item at index: ${h}, in the path: ${t}. because there is no value at that index. `);s=i,i=i&&i[f],e=p?e.spec.types[f]:e.innerType}if(!d){if(!e.fields||!e.fields[u])throw Error(`The schema does not contain the path: ${t}. (failed at: ${o} which is a type: "${e.type}")`);s=i,i=i&&i[u],e=e.fields[u]}a=u,o=c?"["+h+"]":"."+h}),{schema:e,parent:s,parentPath:a}):{parent:s,parentPath:t,schema:e}}(this,t,i,r.context);return o[e](s&&s[a],Object.assign({},r,{parent:s,path:t}))};for(let e of["equals","is"])rh.prototype[e]=rh.prototype.oneOf;for(let e of["not","nope"])rh.prototype[e]=rh.prototype.notOneOf;function rc(){return new rd}class rd extends rh{constructor(){super({type:"boolean",check:e=>(e instanceof Boolean&&(e=e.valueOf()),"boolean"==typeof e)}),this.withMutation(()=>{this.transform((e,t,i)=>{if(i.spec.coerce&&!i.isType(e)){if(/^(true|1)$/i.test(String(e)))return!0;if(/^(false|0)$/i.test(String(e)))return!1}return e})})}isTrue(e=i6.isValue){return this.test({message:e,name:"is-value",exclusive:!0,params:{value:"true"},test:e=>null==e||!0===e})}isFalse(e=i6.isValue){return this.test({message:e,name:"is-value",exclusive:!0,params:{value:"false"},test:e=>null==e||!1===e})}default(e){return super.default(e)}defined(e){return super.defined(e)}optional(){return super.optional()}required(e){return super.required(e)}notRequired(){return super.notRequired()}nullable(){return super.nullable()}nonNullable(e){return super.nonNullable(e)}strip(e){return super.strip(e)}}rc.prototype=rd.prototype;let ru=/^(\d{4}|[+-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,.](\d{1,}))?)?(?:(Z)|([+-])(\d{2})(?::?(\d{2}))?)?)?$/;function rp(e){var t,i;let r=ru.exec(e);return r?{year:rf(r[1]),month:rf(r[2],1)-1,day:rf(r[3],1),hour:rf(r[4]),minute:rf(r[5]),second:rf(r[6]),millisecond:r[7]?rf(r[7].substring(0,3)):0,precision:null!=(t=null==(i=r[7])?void 0:i.length)?t:void 0,z:r[8]||void 0,plusMinus:r[9]||void 0,hourOffset:rf(r[10]),minuteOffset:rf(r[11])}:null}function rf(e,t=0){return Number(e)||t}let rm=/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,rg=/^((https?|ftp):)?\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i,rv=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,ry=RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"),rx=e=>null==e||e===e.trim(),rb=({}).toString();function rw(){return new r_}class r_ extends rh{constructor(){super({type:"string",check:e=>(e instanceof String&&(e=e.valueOf()),"string"==typeof e)}),this.withMutation(()=>{this.transform((e,t,i)=>{if(!i.spec.coerce||i.isType(e)||Array.isArray(e))return e;let r=null!=e&&e.toString?e.toString():e;return r===rb?e:r})})}required(e){return super.required(e).withMutation(t=>t.test({message:e||i2.required,name:"required",skipAbsent:!0,test:e=>!!e.length}))}notRequired(){return super.notRequired().withMutation(e=>(e.tests=e.tests.filter(e=>"required"!==e.OPTIONS.name),e))}length(e,t=i3.length){return this.test({message:t,name:"length",exclusive:!0,params:{length:e},skipAbsent:!0,test(t){return t.length===this.resolve(e)}})}min(e,t=i3.min){return this.test({message:t,name:"min",exclusive:!0,params:{min:e},skipAbsent:!0,test(t){return t.length>=this.resolve(e)}})}max(e,t=i3.max){return this.test({name:"max",exclusive:!0,message:t,params:{max:e},skipAbsent:!0,test(t){return t.length<=this.resolve(e)}})}matches(e,t){let i,r,s=!1;return t&&("object"==typeof t?{excludeEmptyString:s=!1,message:i,name:r}=t:i=t),this.test({name:r||"matches",message:i||i3.matches,params:{regex:e},skipAbsent:!0,test:t=>""===t&&s||-1!==t.search(e)})}email(e=i3.email){return this.matches(rm,{name:"email",message:e,excludeEmptyString:!0})}url(e=i3.url){return this.matches(rg,{name:"url",message:e,excludeEmptyString:!0})}uuid(e=i3.uuid){return this.matches(rv,{name:"uuid",message:e,excludeEmptyString:!1})}datetime(e){let t,i,r="";return e&&("object"==typeof e?{message:r="",allowOffset:t=!1,precision:i}=e:r=e),this.matches(ry,{name:"datetime",message:r||i3.datetime,excludeEmptyString:!0}).test({name:"datetime_offset",message:r||i3.datetime_offset,params:{allowOffset:t},skipAbsent:!0,test:e=>{if(!e||t)return!0;let i=rp(e);return!!i&&!!i.z}}).test({name:"datetime_precision",message:r||i3.datetime_precision,params:{precision:i},skipAbsent:!0,test:e=>{if(!e||void 0==i)return!0;let t=rp(e);return!!t&&t.precision===i}})}ensure(){return this.default("").transform(e=>null===e?"":e)}trim(e=i3.trim){return this.transform(e=>null!=e?e.trim():e).test({message:e,name:"trim",test:rx})}lowercase(e=i3.lowercase){return this.transform(e=>null==e?e:e.toLowerCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:e=>null==e||e===e.toLowerCase()})}uppercase(e=i3.uppercase){return this.transform(e=>null==e?e:e.toUpperCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:e=>null==e||e===e.toUpperCase()})}}rw.prototype=r_.prototype;let rS=new Date("");function rC(){return new rM}class rM extends rh{constructor(){super({type:"date",check:e=>"[object Date]"===Object.prototype.toString.call(e)&&!isNaN(e.getTime())}),this.withMutation(()=>{this.transform((e,t,i)=>!i.spec.coerce||i.isType(e)||null===e?e:isNaN(e=function(e){let t=rp(e);if(!t)return Date.parse?Date.parse(e):NaN;if(void 0===t.z&&void 0===t.plusMinus)return new Date(t.year,t.month,t.day,t.hour,t.minute,t.second,t.millisecond).valueOf();let i=0;return"Z"!==t.z&&void 0!==t.plusMinus&&(i=60*t.hourOffset+t.minuteOffset,"+"===t.plusMinus&&(i=0-i)),Date.UTC(t.year,t.month,t.day,t.hour,t.minute+i,t.second,t.millisecond)}(e))?rM.INVALID_DATE:new Date(e))})}prepareParam(e,t){let i;if(ri.isRef(e))i=e;else{let r=this.cast(e);if(!this._typeCheck(r))throw TypeError(`\`${t}\` must be a Date or a value that can be \`cast()\` to a Date`);i=r}return i}min(e,t=i5.min){let i=this.prepareParam(e,"min");return this.test({message:t,name:"min",exclusive:!0,params:{min:e},skipAbsent:!0,test(e){return e>=this.resolve(i)}})}max(e,t=i5.max){let i=this.prepareParam(e,"max");return this.test({message:t,name:"max",exclusive:!0,params:{max:e},skipAbsent:!0,test(e){return e<=this.resolve(i)}})}}function rE(e,t){let i=1/0;return e.some((e,r)=>{var s;if(null!=(s=t.path)&&s.includes(e))return i=r,!0}),i}function rA(e){return(t,i)=>rE(e,t)-rE(e,i)}rM.INVALID_DATE=rS,rC.prototype=rM.prototype,rC.INVALID_DATE=rS;let rT=(e,t,i)=>{if("string"!=typeof e)return e;let r=e;try{r=JSON.parse(e)}catch(e){}return i.isType(r)?r:e},rP=e=>"[object Object]"===Object.prototype.toString.call(e);function rD(e,t){let i=Object.keys(e.fields);return Object.keys(t).filter(e=>-1===i.indexOf(e))}let rO=rA([]);function rL(e){return new rI(e)}class rI extends rh{constructor(e){super({type:"object",check:e=>rP(e)||"function"==typeof e}),this.fields=Object.create(null),this._sortErrors=rO,this._nodes=[],this._excludedEdges=[],this.withMutation(()=>{e&&this.shape(e)})}_cast(e,t={}){var i;let r=super._cast(e,t);if(void 0===r)return this.getDefault(t);if(!this._typeCheck(r))return r;let s=this.fields,a=null!=(i=t.stripUnknown)?i:this.spec.noUnknown,o=[].concat(this._nodes,Object.keys(r).filter(e=>!this._nodes.includes(e))),h={},c=Object.assign({},t,{parent:h,__validating:t.__validating||!1}),d=!1;for(let e of o){let i=s[e],o=e in r;if(i){let s,a=r[e];c.path=(t.path?`${t.path}.`:"")+e;let o=(i=i.resolve({value:a,context:t.context,parent:h}))instanceof rh?i.spec:void 0,u=null==o?void 0:o.strict;if(null!=o&&o.strip){d=d||e in r;continue}void 0!==(s=t.__validating&&u?r[e]:i.cast(r[e],c))&&(h[e]=s)}else o&&!a&&(h[e]=r[e]);(o!==e in h||h[e]!==r[e])&&(d=!0)}return d?h:r}_validate(e,t={},i,r){let{from:s=[],originalValue:a=e,recursive:o=this.spec.recursive}=t;t.from=[{schema:this,value:a},...s],t.__validating=!0,t.originalValue=a,super._validate(e,t,i,(e,s)=>{if(!o||!rP(s))return void r(e,s);a=a||s;let h=[];for(let e of this._nodes){let i=this.fields[e];!i||ri.isRef(i)||h.push(i.asNestedTest({options:t,key:e,parent:s,parentPath:t.path,originalParent:a}))}this.runTests({tests:h,value:s,originalValue:a,options:t},i,t=>{r(t.sort(this._sortErrors).concat(e),s)})})}clone(e){let t=super.clone(e);return t.fields=Object.assign({},this.fields),t._nodes=this._nodes,t._excludedEdges=this._excludedEdges,t._sortErrors=this._sortErrors,t}concat(e){let t=super.concat(e),i=t.fields;for(let[e,t]of Object.entries(this.fields)){let r=i[e];i[e]=void 0===r?t:r}return t.withMutation(t=>t.setFields(i,[...this._excludedEdges,...e._excludedEdges]))}_getDefault(e){if("default"in this.spec)return super._getDefault(e);if(!this._nodes.length)return;let t={};
8198return this._nodes.forEach(i=>{var r;let s=this.fields[i],a=e;null!=(r=a)&&r.value&&(a=Object.assign({},a,{parent:a.value,value:a.value[i]})),t[i]=s&&"getDefault"in s?s.getDefault(a):void 0}),t}setFields(e,t){let i=this.clone();return i.fields=e,i._nodes=function(e,t=[]){let i=[],r=new Set,s=new Set(t.map(([e,t])=>`${e}-${t}`));function a(e,t){let a=(0,iV.split)(e)[0];r.add(a),s.has(`${t}-${a}`)||i.push([t,a])}for(let t of Object.keys(e)){let i=e[t];r.add(t),ri.isRef(i)&&i.isSibling?a(i.path,t):re(i)&&"deps"in i&&i.deps.forEach(e=>a(e,t))}return iH.default.array(Array.from(r),i).reverse()}(e,t),i._sortErrors=rA(Object.keys(e)),t&&(i._excludedEdges=t),i}shape(e,t=[]){return this.clone().withMutation(i=>{let r=i._excludedEdges;return t.length&&(Array.isArray(t[0])||(t=[t]),r=[...i._excludedEdges,...t]),i.setFields(Object.assign(i.fields,e),r)})}partial(){let e={};for(let[t,i]of Object.entries(this.fields))e[t]="optional"in i&&i.optional instanceof Function?i.optional():i;return this.setFields(e)}deepPartial(){return function e(t){if("fields"in t){let i={};for(let[r,s]of Object.entries(t.fields))i[r]=e(s);return t.setFields(i)}if("array"===t.type){let i=t.optional();return i.innerType&&(i.innerType=e(i.innerType)),i}return"tuple"===t.type?t.optional().clone({types:t.spec.types.map(e)}):"optional"in t?t.optional():t}(this)}pick(e){let t={};for(let i of e)this.fields[i]&&(t[i]=this.fields[i]);return this.setFields(t,this._excludedEdges.filter(([t,i])=>e.includes(t)&&e.includes(i)))}omit(e){let t=[];for(let i of Object.keys(this.fields))e.includes(i)||t.push(i);return this.pick(t)}from(e,t,i){let r=(0,iV.getter)(e,!0);return this.transform(s=>{if(!s)return s;let a=s;return((e,t)=>{let i=[...(0,iV.normalizePath)(t)];if(1===i.length)return i[0]in e;let r=i.pop(),s=(0,iV.getter)((0,iV.join)(i),!0)(e);return!!(s&&r in s)})(s,e)&&(a=Object.assign({},s),i||delete a[e],a[t]=r(s)),a})}json(){return this.transform(rT)}exact(e){return this.test({name:"exact",exclusive:!0,message:e||i8.exact,test(e){if(null==e)return!0;let t=rD(this.schema,e);return 0===t.length||this.createError({params:{properties:t.join(", ")}})}})}stripUnknown(){return this.clone({noUnknown:!0})}noUnknown(e=!0,t=i8.noUnknown){"boolean"!=typeof e&&(t=e,e=!0);let i=this.test({name:"noUnknown",exclusive:!0,message:t,test(t){if(null==t)return!0;let i=rD(this.schema,t);return!e||0===i.length||this.createError({params:{unknown:i.join(", ")}})}});return i.spec.noUnknown=e,i}unknown(e=!0,t=i8.noUnknown){return this.noUnknown(!e,t)}transformKeys(e){return this.transform(t=>{if(!t)return t;let i={};for(let r of Object.keys(t))i[e(r)]=t[r];return i})}camelCase(){return this.transformKeys(iW.camelCase)}snakeCase(){return this.transformKeys(iW.snakeCase)}constantCase(){return this.transformKeys(e=>(0,iW.snakeCase)(e).toUpperCase())}describe(e){let t=(e?this.resolve(e):this).clone(),i=super.describe(e);for(let[s,a]of(i.fields={},Object.entries(t.fields))){var r;let t=e;null!=(r=t)&&r.value&&(t=Object.assign({},t,{parent:t.value,value:t.value[s]})),i.fields[s]=a.describe(t)}return i}}rL.prototype=rI.prototype;var rR=e.i(440085),rk=e.i(682623),rB=e.i(860476),rz=e.i(170586),rN=e.i(541371),rF=e.i(618915),rj=e.i(7284),rU=e.i(999296),rV=e.i(28779),rW=function(){return(rW=Object.assign||function(e){for(var t,i=1,r=arguments.length;i<r;i++)for(var s in t=arguments[i])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e}).apply(this,arguments)},rH=function(e,t){var i={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(i[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var s=0,r=Object.getOwnPropertySymbols(e);s<r.length;s++)0>t.indexOf(r[s])&&Object.prototype.propertyIsEnumerable.call(e,r[s])&&(i[r[s]]=e[r[s]]);return i},rG=(0,rV.createAnimation)("MoonLoader","100% {transform: rotate(360deg)}","moon");let rq=function(e){var t=e.loading,i=e.color,r=void 0===i?"#000000":i,s=e.speedMultiplier,a=void 0===s?1:s,o=e.cssOverride,h=e.size,c=rH(e,["loading","color","speedMultiplier","cssOverride","size"]),d=(0,rU.parseLengthAndUnit)(void 0===h?60:h),u=d.value,p=d.unit,f=Math.round(u/7),m=rW({display:"inherit",position:"relative",width:"".concat("".concat(u+2*f).concat(p)),height:"".concat("".concat(u+2*f).concat(p)),animation:"".concat(rG," ").concat(.6/a,"s 0s infinite linear"),animationFillMode:"forwards"},void 0===o?{}:o),g=function(e){return{width:(0,rU.cssValue)(e),height:(0,rU.cssValue)(e),borderRadius:"100%"}},v=rW(rW({},g(f)),{backgroundColor:"".concat(r),opacity:"0.8",position:"absolute",top:"".concat("".concat(u/2-f/2).concat(p)),animation:"".concat(rG," ").concat(.6/a,"s 0s infinite linear"),animationFillMode:"forwards"}),y=rW(rW({},g(u)),{border:"".concat(f,"px solid ").concat(r),opacity:"0.1",boxSizing:"content-box",position:"absolute"});return void 0===t||t?k.createElement("span",rW({style:m},c),k.createElement("span",{style:v}),k.createElement("span",{style:y})):null};var rX=e.i(384184);let rY=(0,I.jsx)("svg",{width:"15",height:"13",viewBox:"0 0 15 13",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,I.jsx)("path",{d:"M3.81802 9.78662C5.12977 10.8126 6.23227 11.1411 7.50052 11.1411C8.60377 11.1411 10.0438 10.6814 11.429 9.70187C12.428 8.99537 13.2538 7.96562 13.904 6.60437C13.199 5.38087 12.3833 4.37762 11.4568 3.59462C10.1743 2.50862 8.77027 2.01062 7.47277 2.01062C6.13027 2.01062 4.58527 2.60912 3.26677 3.86612C2.31777 4.77112 1.59777 5.68062 1.10677 6.59462C1.90577 7.93562 2.81002 8.99962 3.81802 9.78662ZM7.50052 12.2009C6.02002 12.2009 4.69927 11.8071 3.19477 10.6304C2.01227 9.70537 0.971269 8.45537 0.0717685 6.88037C0.0275666 6.80343 0.00300595 6.71678 0.000258879 6.62809C-0.00248819 6.5394 0.0166629 6.45139 0.0560185 6.37187C0.607019 5.25287 1.44352 4.15862 2.56552 3.08912C4.07902 1.64687 5.87527 0.950867 7.47277 0.950867C9.00502 0.950867 10.64 1.53212 12.1108 2.77637C13.1973 3.69637 14.138 4.87687 14.933 6.31787C15.0155 6.46637 15.023 6.64712 14.9533 6.80162C14.2123 8.45162 13.232 9.71312 12.0125 10.5756C10.4555 11.6759 8.81302 12.2009 7.50052 12.2009ZM7.67527 9.50087C7.31085 9.50087 6.95 9.42909 6.61332 9.28963C6.27664 9.15018 5.97073 8.94577 5.71305 8.68809C5.45537 8.4304 5.25096 8.12449 5.1115 7.78781C4.97205 7.45113 4.90027 7.09028 4.90027 6.72587C4.90027 6.36145 4.97205 6.0006 5.1115 5.66392C5.25096 5.32724 5.45537 5.02133 5.71305 4.76365C5.97073 4.50596 6.27664 4.30156 6.61332 4.1621C6.95 4.02264 7.31085 3.95087 7.67527 3.95087C8.41125 3.95087 9.11708 4.24323 9.63749 4.76365C10.1579 5.28406 10.4503 5.98989 10.4503 6.72587C10.4503 7.46184 10.1579 8.1676
81987 9.63749 8.68809C9.11708 9.2085 8.41125 9.50087 7.67527 9.50087ZM7.67527 8.45087C7.9018 8.45087 8.12611 8.40625 8.3354 8.31956C8.54469 8.23287 8.73485 8.10581 8.89503 7.94563C9.05521 7.78544 9.18227 7.59528 9.26896 7.386C9.35565 7.17671 9.40027 6.9524 9.40027 6.72587C9.40027 6.49934 9.35565 6.27502 9.26896 6.06574C9.18227 5.85645 9.05521 5.66629 8.89503 5.50611C8.73485 5.34593 8.54469 5.21886 8.3354 5.13217C8.12611 5.04549 7.9018 5.00087 7.67527 5.00087C7.21777 5.00087 6.77901 5.18261 6.45551 5.50611C6.13201 5.82961 5.95027 6.26837 5.95027 6.72587C5.95027 7.18336 6.13201 7.62213 6.45551 7.94563C6.77901 8.26913 7.21777 8.45087 7.67527 8.45087Z",fill:"black"})}),rQ=(0,I.jsx)("svg",{width:"17",height:"13",viewBox:"0 0 17 13",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,I.jsx)("path",{d:"M0.853521 0.879641C0.970266 0.718721 1.14613 0.610738 1.34245 0.579423C1.53878 0.548108 1.73951 0.596025 1.90052 0.712641L16.4005 11.2126C16.4833 11.2692 16.554 11.3417 16.6083 11.4261C16.6626 11.5104 16.6994 11.6047 16.7166 11.7035C16.7338 11.8023 16.731 11.9035 16.7084 12.0012C16.6858 12.0989 16.6438 12.1911 16.585 12.2723C16.5261 12.3535 16.4516 12.422 16.3658 12.4739C16.2799 12.5258 16.1846 12.5599 16.0854 12.5743C15.9861 12.5887 15.885 12.5831 15.788 12.5577C15.691 12.5323 15.6 12.4878 15.5205 12.4266L13.2725 10.7986C12.0565 11.7596 10.5025 12.5696 8.71052 12.5696C6.72952 12.5696 5.04052 11.5776 3.77752 10.4916C2.50752 9.40164 1.59052 8.14664 1.14052 7.46964C0.96316 7.20355 0.868518 6.89092 0.868518 6.57114C0.868518 6.25136 0.96316 5.93873 1.14052 5.67264C1.49352 5.13964 2.13552 4.25264 3.00852 3.36764L1.02052 1.92664C0.859601 1.8099 0.751618 1.63403 0.720303 1.43771C0.688988 1.24138 0.736904 1.04065 0.853521 0.879641ZM2.38952 6.50164C2.37545 6.52155 2.36778 6.54527 2.36752 6.56964C2.36685 6.59164 2.37419 6.61431 2.38952 6.63764C2.80152 7.25864 3.63152 8.38764 4.75552 9.35464C5.88552 10.3276 7.23752 11.0696 8.71052 11.0696C9.90552 11.0696 11.0205 10.5816 12.0005 9.87864L9.77352 8.26464C9.43588 8.47672 9.04256 8.58304 8.64406 8.56995C8.24556 8.55686 7.86006 8.42495 7.53707 8.19117C7.21408 7.95739 6.96833 7.63241 6.83139 7.25795C6.69445 6.88349 6.67255 6.47664 6.76852 6.08964L4.23952 4.25764C3.54768 4.94035 2.92776 5.6923 2.38952 6.50164ZM8.71052 2.06964C8.19452 2.06964 7.69352 2.15964 7.21152 2.32064C7.11739 2.3545 7.01744 2.36919 6.91755 2.36385C6.81766 2.3585 6.71985 2.33322 6.62988 2.28951C6.5399 2.24579 6.45958 2.18452 6.39364 2.10929C6.3277 2.03407 6.27748 1.94642 6.24593 1.85149C6.21437 1.75656 6.20213 1.65628 6.20991 1.55655C6.2177 1.45682 6.24535 1.35966 6.29125 1.27078C6.33716 1.1819 6.40037 1.1031 6.47718 1.03902C6.554 0.974935 6.64285 0.926867 6.73852 0.897641C7.37378 0.682357 8.03977 0.571584 8.71052 0.569641C10.6915 0.569641 12.3805 1.56164 13.6435 2.64764C14.9135 3.73864 15.8305 4.99264 16.2805 5.67064C16.4581 5.93683 16.5529 6.24965 16.5529 6.56964C16.5529 6.88963 16.4581 7.20245 16.2805 7.46864C16.1705 7.63464 16.0325 7.83364 15.8705 8.05564C15.8123 8.13509 15.739 8.20229 15.6547 8.25341C15.5705 8.30452 15.4771 8.33855 15.3797 8.35354C15.2824 8.36854 15.183 8.36421 15.0873 8.34081C14.9916 8.3174 14.9015 8.27538 14.822 8.21714C14.7426 8.1589 14.6754 8.08558 14.6243 8.00137C14.5731 7.91716 14.5391 7.8237 14.5241 7.72634C14.5091 7.62898 14.5134 7.52961 14.5369 7.43392C14.5603 7.33823 14.6023 7.24809 14.6605 7.16864C14.8085 6.96764 14.9325 6.78664 15.0315 6.63864C15.0455 6.61853 15.053 6.59463 15.053 6.57014C15.053 6.54565 15.0455 6.52175 15.0315 6.50164C14.6195 5.88064 13.7895 4.75164 12.6655 3.78464C11.5355 2.81164 10.1835 2.06964 8.71052 2.06964Z",fill:"black"})});function rZ({name:e,placeholder:t,className:i}){let[r,s]=(0,k.useState)(""),{setFieldValue:a}=iy(),[o,h]=(0,k.useState)(!1);return(0,I.jsxs)("div",{className:rX.default.Outer,children:[(0,I.jsx)("button",{onClick:()=>h(!o),type:"button",className:(0,rj.default)(rX.default.Toggle,{[rX.default.Active]:o}),tabIndex:-1,children:o?rY:rQ}),(0,I.jsx)(iI,{type:o?"text":"password",name:e,placeholder:t,className:i,onChange:t=>{let i=t.target.value;s(function(e){let t=0;if(!e)return"";switch(e.length>8&&(t+=1),/[a-z]/.test(e)&&(t+=1),/[A-Z]/.test(e)&&(t+=1),/\d/.test(e)&&(t+=1),/[^A-Za-z0-9]/.test(e)&&(t+=1),t){case 0:case 1:case 2:return"weak";case 3:return"medium";case 4:return"good";case 5:return"strong";default:return""}}(i)),a(e,i)}}),(0,I.jsxs)("div",{className:(0,rj.default)(rX.default.Strength,rX.default[`Strength-${r}`]),children:[(0,I.jsx)("ul",{className:rX.default.Bars,children:[1,2,3,4].map(e=>(0,I.jsx)("li",{},e))}),r&&(0,I.jsx)("div",{className:rX.default.StrengthIndicator,children:r})]})]})}var rK=e.i(304153),rJ=["sitekey","onChange","theme","type","tabindex","onExpired","onErrored","size","stoken","grecaptcha","badge","hl","isolated"];function r$(){return(r$=Object.assign.bind()).apply(this,arguments)}function r0(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}
8198function r1(e,t){return(r1=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}var r2=function(e){function t(){var t;return(t=e.call(this)||this).handleExpired=t.handleExpired.bind(r0(t)),t.handleErrored=t.handleErrored.bind(r0(t)),t.handleChange=t.handleChange.bind(r0(t)),t.handleRecaptchaRef=t.handleRecaptchaRef.bind(r0(t)),t}t.prototype=Object.create(e.prototype),t.prototype.constructor=t,r1(t,e);var i=t.prototype;return i.getCaptchaFunction=function(e){return this.props.grecaptcha?this.props.grecaptcha.enterprise?this.props.grecaptcha.enterprise[e]:this.props.grecaptcha[e]:null},i.getValue=function(){var e=this.getCaptchaFunction("getResponse");return e&&void 0!==this._widgetId?e(this._widgetId):null},i.getWidgetId=function(){return this.props.grecaptcha&&void 0!==this._widgetId?this._widgetId:null},i.execute=function(){var e=this.getCaptchaFunction("execute");if(e&&void 0!==this._widgetId)return e(this._widgetId);this._executeRequested=!0},i.executeAsync=function(){var e=this;return new Promise(function(t,i){e.executionResolve=t,e.executionReject=i,e.execute()})},i.reset=function(){var e=this.getCaptchaFunction("reset");e&&void 0!==this._widgetId&&e(this._widgetId)},i.forceReset=function(){var e=this.getCaptchaFunction("reset");e&&e()},i.handleExpired=function(){this.props.onExpired?this.props.onExpired():this.handleChange(null)},i.handleErrored=function(){this.props.onErrored&&this.props.onErrored(),this.executionReject&&(this.executionReject(),delete this.executionResolve,delete this.executionReject)},i.handleChange=function(e){this.props.onChange&&this.props.onChange(e),this.executionResolve&&(this.executionResolve(e),delete this.executionReject,delete this.executionResolve)},i.explicitRender=function(){var e=this.getCaptchaFunction("render");if(e&&void 0===this._widgetId){var t=document.createElement("div");this._widgetId=e(t,{sitekey:this.props.sitekey,callback:this.handleChange,theme:this.props.theme,type:this.props.type,tabindex:this.props.tabindex,"expired-callback":this.handleExpired,"error-callback":this.handleErrored,size:this.props.size,stoken:this.props.stoken,hl:this.props.hl,badge:this.props.badge,isolated:this.props.isolated}),this.captcha.appendChild(t)}this._executeRequested&&this.props.grecaptcha&&void 0!==this._widgetId&&(this._executeRequested=!1,this.execute())},i.componentDidMount=function(){this.explicitRender()},i.componentDidUpdate=function(){this.explicitRender()},i.handleRecaptchaRef=function(e){this.captcha=e},i.render=function(){var e=this.props,t=(e.sitekey,e.onChange,e.theme,e.type,e.tabindex,e.onExpired,e.onErrored,e.size,e.stoken,e.grecaptcha,e.badge,e.hl,e.isolated,function(e,t){if(null==e)return{};var i,r,s={},a=Object.keys(e);for(r=0;r<a.length;r++)i=a[r],t.indexOf(i)>=0||(s[i]=e[i]);return s}(e,rJ));return k.createElement("div",r$({},t,{ref:this.handleRecaptchaRef}))},t}(k.Component);function r3(){return(r3=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e}).apply(this,arguments)}r2.displayName="ReCAPTCHA",r2.propTypes={sitekey:rK.default.string.isRequired,onChange:rK.default.func,grecaptcha:rK.default.object,theme:rK.default.oneOf(["dark","light"]),type:rK.default.oneOf(["image","audio"]),tabindex:rK.default.number,onExpired:rK.default.func,onErrored:rK.default.func,size:rK.default.oneOf(["compact","normal","invisible"]),stoken:rK.default.string,hl:rK.default.string,badge:rK.default.oneOf(["bottomright","bottomleft","inline"]),isolated:rK.default.bool},r2.defaultProps={onChange:function(){},theme:"light",type:"image",tabindex:0,size:"normal",badge:"bottomright"};var r4={},r5=0,r6="onloadcallback";function r8(){return"u">typeof window&&window.recaptchaOptions||{}}let r9=(w=function(){var e=r8(),t=e.useRecaptchaNet?"recaptcha.net":"www.google.com";return e.enterprise?"https://"+t+"/recaptcha/enterprise.js?onload="+r6+"&render=explicit":"https://"+t+"/recaptcha/api.js?onload="+r6+"&render=explicit"},_=_={callbackName:r6,globalName:"grecaptcha",attributes:r8().nonce?{nonce:r8().nonce}:{}}
8198,function(e){var t=e.displayName||e.name||"Component",i=function(t){function i(e,i){var r;return(r=t.call(this,e,i)||this).state={},r.__scriptURL="",r}i.prototype=Object.create(t.prototype),i.prototype.constructor=i,i.__proto__=t;var r=i.prototype;return r.asyncScriptLoaderGetScriptLoaderID=function(){return this.__scriptLoaderID||(this.__scriptLoaderID="async-script-loader-"+r5++),this.__scriptLoaderID},r.setupScriptURL=function(){return this.__scriptURL="function"==typeof w?w():w,this.__scriptURL},r.asyncScriptLoaderHandleLoad=function(e){var t=this;this.setState(e,function(){return t.props.asyncScriptOnLoad&&t.props.asyncScriptOnLoad(t.state)})},r.asyncScriptLoaderTriggerOnScriptLoaded=function(){var e=r4[this.__scriptURL];if(!e||!e.loaded)throw Error("Script is not loaded.");for(var t in e.observers)e.observers[t](e);delete window[_.callbackName]},r.componentDidMount=function(){var e=this,t=this.setupScriptURL(),i=this.asyncScriptLoaderGetScriptLoaderID(),r=_,s=r.globalName,a=r.callbackName,o=r.scriptId;if(s&&void 0!==window[s]&&(r4[t]={loaded:!0,observers:{}}),r4[t]){var h=r4[t];return h&&(h.loaded||h.errored)?void this.asyncScriptLoaderHandleLoad(h):void(h.observers[i]=function(t){return e.asyncScriptLoaderHandleLoad(t)})}var c={};c[i]=function(t){return e.asyncScriptLoaderHandleLoad(t)},r4[t]={loaded:!1,observers:c};var d=document.createElement("script");for(var u in d.src=t,d.async=!0,_.attributes)d.setAttribute(u,_.attributes[u]);o&&(d.id=o);var p=function(e){if(r4[t]){var i=r4[t].observers;for(var r in i)e(i[r])&&delete i[r]}};a&&"u">typeof window&&(window[a]=function(){return e.asyncScriptLoaderTriggerOnScriptLoaded()}),d.onload=function(){var e=r4[t];e&&(e.loaded=!0,p(function(t){return!a&&(t(e),!0)}))},d.onerror=function(){var e=r4[t];e&&(e.errored=!0,p(function(t){return t(e),!0}))},document.body.appendChild(d)},r.componentWillUnmount=function(){var e=this.__scriptURL;if(!0===_.removeOnUnmount)for(var t=document.getElementsByTagName("script"),i=0;i<t.length;i+=1)t[i].src.indexOf(e)>-1&&t[i].parentNode&&t[i].parentNode.removeChild(t[i]);var r=r4[e];r&&(delete r.observers[this.asyncScriptLoaderGetScriptLoaderID()],!0===_.removeOnUnmount&&delete r4[e])},r.render=function(){var t=_.globalName,i=this.props,r=(i.asyncScriptOnLoad,i.forwardedRef),s=function(e,t){if(null==e)return{};var i,r,s={},a=Object.keys(e);for(r=0;r<a.length;r++)t.indexOf(i=a[r])>=0||(s[i]=e[i]);return s}(i,["asyncScriptOnLoad","forwardedRef"]);return t&&"u">typeof window&&(s[t]=void 0!==window[t]?window[t]:void 0),s.ref=r,(0,k.createElement)(e,s)},i}(k.Component),r=(0,k.forwardRef)(function(e,t){return(0,k.createElement)(i,r3({},e,{forwardedRef:t}))});return r.displayName="AsyncScriptLoader("+t+")",r.propTypes={asyncScriptOnLoad:rK.default.func},(0,ih.default)(r,e)})(r2);var r7=k,se=e.i(222502);function st(e){return(st="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function si(e,t,i){var r;return(r=function(e,t){if("object"!=st(e)||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var r=i.call(e,t||"default");if("object"!=st(r))return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(t,"string"),(t="symbol"==st(r)?r:r+"")in e)?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function sr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ss=sr(E?M:(E=1,M=function(e,t,i,r,s,a,o,h){if(!e){var c;if(void 0===t)c=Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var d=[i,r,s,a,o,h],u=0;(c=Error(t.replace(/%s/g,function(){return d[u++]}))).name="Invariant Violation"}throw c.framesToPop=1,c}})),sa=(0,r7.createContext)(null);function sn(e){google.maps.event.removeListener(e)}function so(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];e.forEach(sn)}function sl(e){var t,i,r,s,{updaterMap:a,eventMap:o,prevProps:h,nextProps:c,instance:d}=e,u=(t=function(e,t,i){return"function"==typeof c[i]&&e.push(google.maps.event.addListener(d,t,c[i])),e},i=[],Object.keys(o).reduce(function(e,i){return t(e,o[i],i)},i));return r={},s=(e,t)=>{var i=c[t];i!==h[t]&&(r[t]=i,e(d,i))}
8198,Object.keys(a).forEach(e=>s(a[e],e)),u}function sh(e,t,i,r,s,a,o){try{var h=e[a](o),c=h.value}catch(e){return void i(e)}h.done?t(c):Promise.resolve(c).then(r,s)}function sc(e){return function(){var t=this,i=arguments;return new Promise(function(r,s){var a=e.apply(t,i);function o(e){sh(a,r,s,o,h,"next",e)}function h(e){sh(a,r,s,o,h,"throw",e)}o(void 0)})}}function sd(e){var{googleMapsApiKey:t,googleMapsClientId:i,version:r="weekly",language:s,region:a,libraries:o,channel:h,mapIds:c,authReferrerPolicy:d,apiUrl:u="https://maps.googleapis.com"}=e,p=[];return ss(t&&i||!(t&&i),"You need to specify either googleMapsApiKey or googleMapsClientId for @react-google-maps/api load script to work. You cannot use both at the same time."),t?p.push("key=".concat(t)):i&&p.push("client=".concat(i)),r&&p.push("v=".concat(r)),s&&p.push("language=".concat(s)),a&&p.push("region=".concat(a)),o&&o.length&&p.push("libraries=".concat(o.sort().join(","))),h&&p.push("channel=".concat(h)),c&&c.length&&p.push("map_ids=".concat(c.join(","))),d&&p.push("auth_referrer_policy=".concat(d)),p.push("loading=async"),p.push("callback=initMap"),"".concat(u,"/maps/api/js?").concat(p.join("&"))}(0,r7.memo)(function(e){var{children:t,options:i,id:r,mapContainerStyle:s,mapContainerClassName:a,center:o,onClick:h,onDblClick:c,onDrag:d,onDragEnd:u,onDragStart:p,onMouseMove:f,onMouseOut:m,onMouseOver:g,onMouseDown:v,onMouseUp:y,onRightClick:x,onCenterChanged:b,onLoad:w,onUnmount:_}=e,[S,C]=(0,r7.useState)(null),M=(0,r7.useRef)(null),[E,A]=(0,r7.useState)(null),[T,P]=(0,r7.useState)(null),[D,O]=(0,r7.useState)(null),[L,R]=(0,r7.useState)(null),[k,B]=(0,r7.useState)(null),[z,N]=(0,r7.useState)(null),[F,j]=(0,r7.useState)(null),[U,V]=(0,r7.useState)(null),[W,H]=(0,r7.useState)(null),[G,q]=(0,r7.useState)(null),[X,Y]=(0,r7.useState)(null),[Q,Z]=(0,r7.useState)(null);return(0,r7.useEffect)(()=>{i&&null!==S&&S.setOptions(i)},[S,i]),(0,r7.useEffect)(()=>{null!==S&&void 0!==o&&S.setCenter(o)},[S,o]),(0,r7.useEffect)(()=>{S&&c&&(null!==T&&google.maps.event.removeListener(T),P(google.maps.event.addListener(S,"dblclick",c)))},[c]),(0,r7.useEffect)(()=>{S&&u&&(null!==D&&google.maps.event.removeListener(D),O(google.maps.event.addListener(S,"dragend",u)))},[u]),(0,r7.useEffect)(()=>{S&&p&&(null!==L&&google.maps.event.removeListener(L),R(google.maps.event.addListener(S,"dragstart",p)))},[p]),(0,r7.useEffect)(()=>{S&&v&&(null!==k&&google.maps.event.removeListener(k),B(google.maps.event.addListener(S,"mousedown",v)))},[v]),(0,r7.useEffect)(()=>{S&&f&&(null!==z&&google.maps.event.removeListener(z),N(google.maps.event.addListener(S,"mousemove",f)))},[f]),(0,r7.useEffect)(()=>{S&&m&&(null!==F&&google.maps.event.removeListener(F),j(google.maps.event.addListener(S,"mouseout",m)))},[m]),(0,r7.useEffect)(()=>{S&&g&&(null!==U&&google.maps.event.removeListener(U),V(google.maps.event.addListener(S,"mouseover",g)))},[g]),(0,r7.useEffect)(()=>{S&&y&&(null!==W&&google.maps.event.removeListener(W),H(google.maps.event.addListener(S,"mouseup",y)))},[y]),(0,r7.useEffect)(()=>{S&&x&&(null!==G&&google.maps.event.removeListener(G),q(google.maps.event.addListener(S,"rightclick",x)))},[x]),(0,r7.useEffect)(()=>{S&&h&&(null!==X&&google.maps.event.removeListener(X),Y(google.maps.event.addListener(S,"click",h)))},[h]),(0,r7.useEffect)(()=>{S&&d&&(null!==Q&&google.maps.event.removeListener(Q),Z(google.maps.event.addListener(S,"drag",d)))},[d]),(0,r7.useEffect)(()=>{S&&b&&(null!==E&&google.maps.event.removeListener(E),A(google.maps.event.addListener(S,"center_changed",b)))},[h]),(0,r7.useEffect)(()=>{var e=null===M.current?null:new google.maps.Map(M.current,i);return C(e),null!==e&&w&&w(e),()=>{null!==e&&_&&_(e)}},[]),(0,I.jsx)("div",{id:r,ref:M,style:s,className:a,children:(0,I.jsx)(sa.Provider,{value:S,children:null!==S?t:null})})}),r7.PureComponent;var su="u">typeof document;function sp(e){var{url:t,id:i,nonce:r}=e;return su?new Promise(function(e,s){var a=document.getElementById(i),o=window;if(a){var h=a.getAttribute("data-state");if(a.src===t&&"error"!==h)if("ready"===h)return e(i);else{var c=o.initMap,d=a.onerror;o.initMap=function(){c&&c(),e(i)},a.onerror=function(e){d&&d(e),s(e)};return}a.remove()}var u=document.createElement("script");u.type="text/javascript",u.src=t,u.id=i,u.async=!0,u.nonce=r||"",u.onerror=function(e){u.setAttribute("data-state","error"),s(e)},o.initMap=function(){u.setAttribute("data-state","ready"),e(i)},document.head.appendChild(u)}).catch(e=>{throw console.error("injectScript error: ",e),e}):Promise.reject(Error("document is undefined"))}function sf(e){var t=e.href;return!!t&&(0===t.indexOf("https://fonts.googleapis.com/css?family=Roboto")||0===t.indexOf("https://fonts.googleapis.com/css?family=Google+Sans+Text"))||("style"===e.tagName.toLowerCase()&&e.styleSheet&&e.styleSheet.cssText&&0===e.styleSheet.cssText.replace("\r\n","").indexOf(".gm-style")?(e.styleSheet.cssText="",!0):"style"===e.tagName.toLowerCase()&&e.innerHTML&&0===e.innerHTML.replace("\r\n","").indexOf(".gm-style")?(e.innerHTML="",!0):"style"===e.tagName.toLowerCase()&&!e.styleSheet&&!e.innerHTML)}function sm(){var e=document.getElementsByTagName("head")[0];if(e){var t=e.insertBefore.bind(e);e.insertBefore=function(i,r){return sf(i)||Reflect.apply(t,e,[i,r]),i};var i=e.appendChild.bind(e);e.appendChild=function(t){return sf(t)||Reflect.apply(i,e,[t]),t}}}var sg=!1;function sv(){return(0,I.jsx)("div",{children:"Loading..."})}var sy={id:"script-loader",version:"weekly"};class sx extends r7.PureComponent{constructor(){super(...arguments),si(this,"check",null),si(this,"state",{loaded:!1}),si(this,"cleanupCallback",()=>{delete window.google.maps,this.injectScript()}),si(this,"isCleaningUp",sc(function*(){return new Promise(function(e){if(sg){if(su)var t=window.setInterval(function(){sg||(window.clearInterval(t),e())},1)}else e()})})),si(this,"cleanup",()=>{sg=!0;var e=document.getElementById(this.props.id);e&&e.parentNode&&e.parentNode.removeChild(e),Array.prototype.slice.call(document.getElementsByTagName("script")).filter(function(e){return"string"==typeof e.src&&e.src.includes("maps.googleapis")}
8198).forEach(function(e){e.parentNode&&e.parentNode.removeChild(e)}),Array.prototype.slice.call(document.getElementsByTagName("link")).filter(function(e){return"https://fonts.googleapis.com/css?family=Roboto:300,400,500,700|Google+Sans"===e.href}).forEach(function(e){e.parentNode&&e.parentNode.removeChild(e)}),Array.prototype.slice.call(document.getElementsByTagName("style")).filter(function(e){return void 0!==e.innerText&&e.innerText.length>0&&e.innerText.includes(".gm-")}).forEach(function(e){e.parentNode&&e.parentNode.removeChild(e)})}),si(this,"injectScript",()=>{this.props.preventGoogleFontsLoading&&sm(),ss(!!this.props.id,'LoadScript requires "id" prop to be a string: %s',this.props.id),sp({id:this.props.id,nonce:this.props.nonce,url:sd(this.props)}).then(()=>{this.props.onLoad&&this.props.onLoad(),this.setState(function(){return{loaded:!0}})}).catch(e=>{this.props.onError&&this.props.onError(e),console.error("\n          There has been an Error with loading Google Maps API script, please check that you provided correct google API key (".concat(this.props.googleMapsApiKey||"-",") or Client ID (").concat(this.props.googleMapsClientId||"-",") to <LoadScript />\n          Otherwise it is a Network issue.\n        "))})}),si(this,"getRef",e=>{this.check=e})}componentDidMount(){if(su){if(window.google&&window.google.maps&&!sg)return void console.error("google api is already presented");this.isCleaningUp().then(this.injectScript).catch(function(e){console.error("Error at injecting script after cleaning up: ",e)})}}componentDidUpdate(e){this.props.libraries!==e.libraries&&console.warn("Performance warning! LoadScript has been reloaded unintentionally! You should not pass `libraries` prop as new array. Please keep an array of libraries as static class property for Components and PureComponents, or just a const variable outside of component, or somewhere in config files or ENV variables"),su&&e.language!==this.props.language&&(this.cleanup(),this.setState(function(){return{loaded:!1}},this.cleanupCallback))}componentWillUnmount(){if(su){this.cleanup();var e=()=>{this.check||(delete window.google,sg=!1)};window.setTimeout(e,1),this.props.onUnmount&&this.props.onUnmount()}}render(){return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)("div",{ref:this.getRef}),this.state.loaded?this.props.children:this.props.loadingElement||(0,I.jsx)(sv,{})]})}}function sb(e,t){if(null==e)return{};var i,r,s=function(e,t){if(null==e)return{};var i={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(t.includes(r))continue;i[r]=e[r]}return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)i=a[r],t.includes(i)||({}).propertyIsEnumerable.call(e,i)&&(s[i]=e[i])}return s}function sw(e){var{id:t=sy.id,version:i=sy.version,nonce:r,googleMapsApiKey:s,googleMapsClientId:a,language:o,region:h,libraries:c,preventGoogleFontsLoading:d,channel:u,mapIds:p,authReferrerPolicy:f,apiUrl:m="https://maps.googleapis.com"}=e,g=(0,r7.useRef)(!1),[v,y]=(0,r7.useState)(!1),[x,b]=(0,r7.useState)(void 0);(0,r7.useEffect)(function(){return g.current=!0,()=>{g.current=!1}},[]),(0,r7.useEffect)(function(){su&&d&&sm()},[d]),(0,r7.useEffect)(function(){v&&ss(!!window.google,"useLoadScript was marked as loaded, but window.google is not present. Something went wrong.")},[v]);var w=sd({version:i,googleMapsApiKey:s,googleMapsClientId:a,language:o,region:h,libraries:c,channel:u,mapIds:p,authReferrerPolicy:f,apiUrl:m});(0,r7.useEffect)(function(){if(su){if(window.google&&window.google.maps&&A===w)return void e();sp({id:t,url:w,nonce:r}).then(e).catch(function(e){g.current&&b(e),console.warn("\n        There has been an Error with loading Google Maps API script, please check that you provided correct google API key (".concat(s||"-",") or Client ID (").concat(a||"-",")\n        Otherwise it is a Network issue.\n      ")),console.error(e)})}function e(){g.current&&(y(!0),A=w)}},[t,w,r]);var _=(0,r7.useRef)(void 0);return(0,r7.useEffect)(function(){_.current&&c!==_.current&&console.warn("Performance warning! LoadScript has been reloaded unintentionally! You should not pass `libraries` prop as new array. Please keep an array of libraries as 
8198static class property for Components and PureComponents, or just a const variable outside of component, or somewhere in config files or ENV variables"),_.current=c},[c]),{isLoaded:v,loadError:x,url:w}}si(sx,"defaultProps",sy);var s_=["loadingElement","onLoad","onError","onUnmount","children"],sS=(0,I.jsx)(sv,{});function sC(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,r)}return i}function sM(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?sC(Object(i),!0).forEach(function(t){si(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):sC(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}(0,r7.memo)(function(e){var{loadingElement:t,onLoad:i,onError:r,onUnmount:s,children:a}=e,{isLoaded:o,loadError:h}=sw(sb(e,s_));return(0,r7.useEffect)(function(){o&&"function"==typeof i&&i()},[o,i]),(0,r7.useEffect)(function(){h&&"function"==typeof r&&r(h)},[h,r]),(0,r7.useEffect)(function(){return()=>{s&&s()}},[s]),o?a:t||sS}),"function"==typeof SuppressedError&&SuppressedError,(S=T||(T={}))[S.INITIALIZED=0]="INITIALIZED",S[S.LOADING=1]="LOADING",S[S.SUCCESS=2]="SUCCESS",S[S.FAILURE=3]="FAILURE";var sE={},sA={options(e,t){e.setOptions(t)}};(0,r7.memo)(function(e){var{options:t,onLoad:i,onUnmount:r}=e,s=(0,r7.useContext)(sa),[a,o]=(0,r7.useState)(null);return(0,r7.useEffect)(()=>{null!==a&&a.setMap(s)},[s]),(0,r7.useEffect)(()=>{t&&null!==a&&a.setOptions(t)},[a,t]),(0,r7.useEffect)(()=>{var e=new google.maps.TrafficLayer(sM(sM({},t),{},{map:s}));return o(e),i&&i(e),()=>{null!==a&&(r&&r(a),a.setMap(null))}},[]),null});class sT extends r7.PureComponent{constructor(){super(...arguments),si(this,"state",{trafficLayer:null}),si(this,"setTrafficLayerCallback",()=>{null!==this.state.trafficLayer&&this.props.onLoad&&this.props.onLoad(this.state.trafficLayer)}),si(this,"registeredEvents",[])}componentDidMount(){var e=new google.maps.TrafficLayer(sM(sM({},this.props.options),{},{map:this.context}));this.registeredEvents=sl({updaterMap:sA,eventMap:sE,prevProps:{},nextProps:this.props,instance:e}),this.setState(function(){return{trafficLayer:e}},this.setTrafficLayerCallback)}componentDidUpdate(e){null!==this.state.trafficLayer&&(so(this.registeredEvents),this.registeredEvents=sl({updaterMap:sA,eventMap:sE,prevProps:e,nextProps:this.props,instance:this.state.trafficLayer}))}componentWillUnmount(){null!==this.state.trafficLayer&&(this.props.onUnmount&&this.props.onUnmount(this.state.trafficLayer),so(this.registeredEvents),this.state.trafficLayer.setMap(null))}render(){return null}}si(sT,"contextType",sa),(0,r7.memo)(function(e){var{onLoad:t,onUnmount:i}=e,r=(0,r7.useContext)(sa),[s,a]=(0,r7.useState)(null);return(0,r7.useEffect)(()=>{null!==s&&s.setMap(r)},[r]),(0,r7.useEffect)(()=>{var e=new google.maps.BicyclingLayer;return a(e),e.setMap(r),t&&t(e),()=>{null!==e&&(i&&i(e),e.setMap(null))}},[]),null});class sP extends r7.PureComponent{constructor(){super(...arguments),si(this,"state",{bicyclingLayer:null}),si(this,"setBicyclingLayerCallback",()=>{null!==this.state.bicyclingLayer&&(this.state.bicyclingLayer.setMap(this.context),this.props.onLoad&&this.props.onLoad(this.state.bicyclingLayer))})}componentDidMount(){var e=new google.maps.BicyclingLayer;this.setState(()=>({bicyclingLayer:e}),this.setBicyclingLayerCallback)}componentWillUnmount(){null!==this.state.bicyclingLayer&&(this.props.onUnmount&&this.props.onUnmount(this.state.bicyclingLayer),this.state.bicyclingLayer.setMap(null))}render(){return null}}si(sP,"contextType",sa),(0,r7.memo)(function(e){var{onLoad:t,onUnmount:i}=e,r=(0,r7.useContext)(sa),[s,a]=(0,r7.useState)(null);return(0,r7.useEffect)(()=>{null!==s&&s.setMap(r)},[r]),(0,r7.useEffect)(()=>{var e=new google.maps.TransitLayer;return a(e),e.setMap(r),t&&t(e),()=>{null!==s&&(i&&i(s),s.setMap(null))}},[]),null});class sD extends r7.PureComponent{constructor(){super(...arguments),si(this,"state",{transitLayer:null}),si(this,"setTransitLayerCallback",()=>{null!==this.state.transitLayer&&(this.state.transitLayer.setMap(this.context),this.props.onLoad&&this.props.onLoad(this.state.transitLayer))})}componentDidMount(){var e=new google.maps.TransitLayer;this.setState(function(){return{transitLayer:e}},this.setTransitLayerCallback)}componentWillUnmount(){null!==this.state.transitLayer&&(this.props.onUnmount&&this.props.onUnmount(this.state.transitLayer),this.state.transitLayer.setMap(null))}render(){return null}}function sO(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,r)}return i}function sL(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};
8198t%2?sO(Object(i),!0).forEach(function(t){si(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):sO(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}si(sD,"contextType",sa);var sI={onCircleComplete:"circlecomplete",onMarkerComplete:"markercomplete",onOverlayComplete:"overlaycomplete",onPolygonComplete:"polygoncomplete",onPolylineComplete:"polylinecomplete",onRectangleComplete:"rectanglecomplete"},sR={drawingMode(e,t){e.setDrawingMode(t)},options(e,t){e.setOptions(t)}};(0,r7.memo)(function(e){var{options:t,drawingMode:i,onCircleComplete:r,onMarkerComplete:s,onOverlayComplete:a,onPolygonComplete:o,onPolylineComplete:h,onRectangleComplete:c,onLoad:d,onUnmount:u}=e,p=(0,r7.useContext)(sa),[f,m]=(0,r7.useState)(null),[g,v]=(0,r7.useState)(null),[y,x]=(0,r7.useState)(null),[b,w]=(0,r7.useState)(null),[_,S]=(0,r7.useState)(null),[C,M]=(0,r7.useState)(null),[E,A]=(0,r7.useState)(null);return(0,r7.useEffect)(()=>{null!==f&&f.setMap(p)}
8198,[p]),(0,r7.useEffect)(()=>{t&&null!==f&&f.setOptions(t)},[f,t]),(0,r7.useEffect)(()=>{null!==f&&f.setDrawingMode(null!=i?i:null)},[f,i]),(0,r7.useEffect)(()=>{f&&r&&(null!==g&&google.maps.event.removeListener(g),v(google.maps.event.addListener(f,"circlecomplete",r)))},[f,r]),(0,r7.useEffect)(()=>{f&&s&&(null!==y&&google.maps.event.removeListener(y),x(google.maps.event.addListener(f,"markercomplete",s)))},[f,s]),(0,r7.useEffect)(()=>{f&&a&&(null!==b&&google.maps.event.removeListener(b),w(google.maps.event.addListener(f,"overlaycomplete",a)))},[f,a]),(0,r7.useEffect)(()=>{f&&o&&(null!==_&&google.maps.event.removeListener(_),S(google.maps.event.addListener(f,"polygoncomplete",o)))},[f,o]),(0,r7.useEffect)(()=>{f&&h&&(null!==C&&google.maps.event.removeListener(C),M(google.maps.event.addListener(f,"polylinecomplete",h)))},[f,h]),(0,r7.useEffect)(()=>{f&&c&&(null!==E&&google.maps.event.removeListener(E),A(google.maps.event.addListener(f,"rectanglecomplete",c)))},[f,c]),(0,r7.useEffect)(()=>{ss(!!google.maps.drawing,"Did you include prop libraries={['drawing']} in the URL? %s",google.maps.drawing);var e=new google.maps.drawing.DrawingManager(sL(sL({},t),{},{map:p}));return i&&e.setDrawingMode(i),r&&v(google.maps.event.addListener(e,"circlecomplete",r)),s&&x(google.maps.event.addListener(e,"markercomplete",s)),a&&w(google.maps.event.addListener(e,"overlaycomplete",a)),o&&S(google.maps.event.addListener(e,"polygoncomplete",o)),h&&M(google.maps.event.addListener(e,"polylinecomplete",h)),c&&A(google.maps.event.addListener(e,"rectanglecomplete",c)),m(e),d&&d(e),()=>{null!==f&&(g&&google.maps.event.removeListener(g),y&&google.maps.event.removeListener(y),b&&google.maps.event.removeListener(b),_&&google.maps.event.removeListener(_),C&&google.maps.event.removeListener(C),E&&google.maps.event.removeListener(E),u&&u(f),f.setMap(null))}},[]),null});class sk extends r7.PureComponent{constructor(e){super(e),si(this,"registeredEvents",[]),si(this,"state",{drawingManager:null}),si(this,"setDrawingManagerCallback",()=>{null!==this.state.drawingManager&&this.props.onLoad&&this.props.onLoad(this.state.drawingManager)}),ss(!!google.maps.drawing,"Did you include prop libraries={['drawing']} in the URL? %s",google.maps.drawing)}componentDidMount(){var e=new google.maps.drawing.DrawingManager(sL(sL({},this.props.options),{},{map:this.context}));this.registeredEvents=sl({updaterMap:sR,eventMap:sI,prevProps:{},nextProps:this.props,instance:e}),this.setState(function(){return{drawingManager:e}},this.setDrawingManagerCallback)}componentDidUpdate(e){null!==this.state.drawingManager&&(so(this.registeredEvents),this.registeredEvents=sl({updaterMap:sR,eventMap:sI,prevProps:e,nextProps:this.props,instance:this.state.drawingManager}))}componentWillUnmount(){null!==this.state.drawingManager&&(this.props.onUnmount&&this.props.onUnmount(this.state.drawingManager),so(this.registeredEvents),this.state.drawingManager.setMap(null))}render(){return null}}function sB(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,r)}return i}function sz(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?sB(Object(i),!0).forEach(function(t){si(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):sB(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}si(sk,"contextType",sa);var sN={onAnimationChanged:"animation_changed",onClick:"click",onClickableChanged:"clickable_changed",onCursorChanged:"cursor_changed",onDblClick:"dblclick",onDrag:"drag",onDragEnd:"dragend",onDraggableChanged:"draggable_changed",onDragStart:"dragstart",onFlatChanged:"flat_changed",onIconChanged:"icon_changed",onMouseDown:"mousedown",onMouseOut:"mouseout",onMouseOver:"mouseover",onMouseUp:"mouseup",onPositionChanged:"position_changed",onRightClick:"rightclick",onShapeChanged:"shape_changed",onTitleChanged:"title_changed",onVisibleChanged:"visible_changed",onZindexChanged:"zindex_changed"},sF={animation(e,t){e.setAnimation(t)},clickable(e,t){e.setClickable(t)},cursor(e,t){e.setCursor(t)},draggable(e,t){e.setDraggable(t)},icon(e,t){e.setIcon(t)},label(e,t){e.setLabel(t)},map(e,t){e.setMap(t)},opacity(e,t){e.setOpacity(t)},options(e,t){e.setOptions(t)},position(e,t){e.setPosition(t)},shape(e,t){e.setShape(t)},title(e,t){e.setTitle(t)}
8198,visible(e,t){e.setVisible(t)},zIndex(e,t){e.setZIndex(t)}},sj={};(0,r7.memo)(function(e){var{position:t,options:i,clusterer:r,noClustererRedraw:s,children:a,draggable:o,visible:h,animation:c,clickable:d,cursor:u,icon:p,label:f,opacity:m,shape:g,title:v,zIndex:y,onClick:x,onDblClick:b,onDrag:w,onDragEnd:_,onDragStart:S,onMouseOut:C,onMouseOver:M,onMouseUp:E,onMouseDown:A,onRightClick:T,onClickableChanged:P,onCursorChanged:D,onAnimationChanged:O,onDraggableChanged:L,onFlatChanged:R,onIconChanged:k,onPositionChanged:B,onShapeChanged:z,onTitleChanged:N,onVisibleChanged:F,onZindexChanged:j,onLoad:U,onUnmount:V}=e,W=(0,r7.useContext)(sa),[H,G]=(0,r7.useState)(null),[q,X]=(0,r7.useState)(null),[Y,Q]=(0,r7.useState)(null),[Z,K]=(0,r7.useState)(null),[J,$]=(0,r7.useState)(null),[ee,et]=(0,r7.useState)(null),[ei,er]=(0,r7.useState)(null),[es,ea]=(0,r7.useState)(null),[en,eo]=(0,r7.useState)(null),[el,eh]=(0,r7.useState)(null),[ec,ed]=(0,r7.useState)(null),[eu,ep]=(0,r7.useState)(null),[ef,em]=(0,r7.useState)(null),[eg,ev]=(0,r7.useState)(null),[ey,ex]=(0,r7.useState)(null),[eb,ew]=(0,r7.useState)(null),[e_,eS]=(0,r7.useState)(null),[eC,eM]=(0,r7.useState)(null),[eE,eA]=(0,r7.useState)(null),[eT,eP]=(0,r7.useState)(null),[eD,eO]=(0,r7.useState)(null),[eL,eI]=(0,r7.useState)(null);(0,r7.useEffect)(()=>{null!==H&&H.setMap(W)},[W]),(0,r7.useEffect)(()=>{void 0!==i&&null!==H&&H.setOptions(i)},[H,i]),(0,r7.useEffect)(()=>{void 0!==o&&null!==H&&H.setDraggable(o)},[H,o]),(0,r7.useEffect)(()=>{t&&null!==H&&H.setPosition(t)},[H,t]),(0,r7.useEffect)(()=>{void 0!==h&&null!==H&&H.setVisible(h)},[H,h]),(0,r7.useEffect)(()=>{null==H||H.setAnimation(c)},[H,c]),(0,r7.useEffect)(()=>{H&&void 0!==d&&H.setClickable(d)},[H,d]),(0,r7.useEffect)(()=>{H&&void 0!==u&&H.setCursor(u)},[H,u]),(0,r7.useEffect)(()=>{H&&void 0!==p&&H.setIcon(p)},[H,p]),(0,r7.useEffect)(()=>{H&&void 0!==f&&H.setLabel(f)},[H,f]),(0,r7.useEffect)(()=>{H&&void 0!==m&&H.setOpacity(m)},[H,m]),(0,r7.useEffect)(()=>{H&&void 0!==g&&H.setShape(g)},[H,g]),(0,r7.useEffect)(()=>{H&&void 0!==v&&H.setTitle(v)},[H,v]),(0,r7.useEffect)(()=>{H&&void 0!==y&&H.setZIndex(y)},[H,y]),(0,r7.useEffect)(()=>{H&&b&&(null!==q&&google.maps.event.removeListener(q),X(google.maps.event.addListener(H,"dblclick",b)))},[b]),(0,r7.useEffect)(()=>{H&&_&&(null!==Y&&google.maps.event.removeListener(Y),Q(google.maps.event.addListener(H,"dragend",_)))},[_]),(0,r7.useEffect)(()=>{H&&S&&(null!==Z&&google.maps.event.removeListener(Z),K(google.maps.event.addListener(H,"dragstart",S)))},[S]),(0,r7.useEffect)(()=>{H&&A&&(null!==J&&google.maps.event.removeListener(J),$(google.maps.event.addListener(H,"mousedown",A)))},[A]),(0,r7.useEffect)(()=>{H&&C&&(null!==ee&&google.maps.event.removeListener(ee),et(google.maps.event.addListener(H,"mouseout",C)))},[C]),(0,r7.useEffect)(()=>{H&&M&&(null!==ei&&google.maps.event.removeListener(ei),er(google.maps.event.addListener(H,"mouseover",M)))},[M]),(0,r7.useEffect)(()=>{H&&E&&(null!==es&&google.maps.event.removeListener(es),ea(google.maps.event.addListener(H,"mouseup",E)))},[E]),(0,r7.useEffect)(()=>{H&&T&&(null!==en&&google.maps.event.removeListener(en),eo(google.maps.event.addListener(H,"rightclick",T)))},[T]),(0,r7.useEffect)(()=>{H&&x&&(null!==el&&google.maps.event.removeListener(el),eh(google.maps.event.addListener(H,"click",x)))},[x]),(0,r7.useEffect)(()=>{H&&w&&(null!==ec&&google.maps.event.removeListener(ec),ed(google.maps.event.addListener(H,"drag",w)))},[w]),(0,r7.useEffect)(()=>{H&&P&&(null!==eu&&google.maps.event.removeListener(eu),ep(google.maps.event.addListener(H,"clickable_changed",P)))},[P]),(0,r7.useEffect)(()=>{H&&D&&(null!==ef&&google.maps.event.removeListener(ef),em(google.maps.event.addListener(H,"cursor_changed",D)))},[D]),(0,r7.useEffect)(()=>{H&&O&&(null!==eg&&google.maps.event.removeListener(eg),ev(google.maps.event.addListener(H,"animation_changed",O)))},[O]),(0,r7.useEffect)(()=>{H&&L&&(null!==ey&&google.maps.event.removeListener(ey),ex(google.maps.event.addListener(H,"draggable_changed",L)))},[L]),(0,r7.useEffect)(()=>{H&&R&&(null!==eb&&google.maps.event.removeListener(eb),ew(google.maps.event.addListener(H,"flat_changed",R)))},[R]),(0,r7.useEffect)(()=>{H&&k&&(null!==e_&&google.maps.event.removeListener(e_),eS(google.maps.event.addListener(H,"icon_changed",k)))},[k]),(0,r7.useEffect)(()=>{H&&B&&(null!==eC&&google.maps.event.removeListener(eC),eM(google.maps.event.addListener(H,"position_changed",B)))},[B]),(0,r7.useEffect)(()=>{H&&z&&(null!==eE&&google.maps.event.removeListener(eE),eA(google.maps.event.addListener(H,"shape_changed",z)))},[z]),(0,r7.useEffect)(()=>{H&&N&&(null!==eT&&google.maps.event.removeListener(eT),eP(google.maps.event.addListener(H,"title_changed",N)))}
8198,[N]),(0,r7.useEffect)(()=>{H&&F&&(null!==eD&&google.maps.event.removeListener(eD),eO(google.maps.event.addListener(H,"visible_changed",F)))},[F]),(0,r7.useEffect)(()=>{H&&j&&(null!==eL&&google.maps.event.removeListener(eL),eI(google.maps.event.addListener(H,"zindex_changed",j)))},[j]),(0,r7.useEffect)(()=>{var e=sz(sz(sz({},i||sj),r?sj:{map:W}),{},{position:t}),a=new google.maps.Marker(e);return r?r.addMarker(a,!!s):a.setMap(W),t&&a.setPosition(t),void 0!==h&&a.setVisible(h),void 0!==o&&a.setDraggable(o),void 0!==d&&a.setClickable(d),"string"==typeof u&&a.setCursor(u),p&&a.setIcon(p),void 0!==f&&a.setLabel(f),void 0!==m&&a.setOpacity(m),g&&a.setShape(g),"string"==typeof v&&a.setTitle(v),"number"==typeof y&&a.setZIndex(y),b&&X(google.maps.event.addListener(a,"dblclick",b)),_&&Q(google.maps.event.addListener(a,"dragend",_)),S&&K(google.maps.event.addListener(a,"dragstart",S)),A&&$(google.maps.event.addListener(a,"mousedown",A)),C&&et(google.maps.event.addListener(a,"mouseout",C)),M&&er(google.maps.event.addListener(a,"mouseover",M)),E&&ea(google.maps.event.addListener(a,"mouseup",E)),T&&eo(google.maps.event.addListener(a,"rightclick",T)),x&&eh(google.maps.event.addListener(a,"click",x)),w&&ed(google.maps.event.addListener(a,"drag",w)),P&&ep(google.maps.event.addListener(a,"clickable_changed",P)),D&&em(google.maps.event.addListener(a,"cursor_changed",D)),O&&ev(google.maps.event.addListener(a,"animation_changed",O)),L&&ex(google.maps.event.addListener(a,"draggable_changed",L)),R&&ew(google.maps.event.addListener(a,"flat_changed",R)),k&&eS(google.maps.event.addListener(a,"icon_changed",k)),B&&eM(google.maps.event.addListener(a,"position_changed",B)),z&&eA(google.maps.event.addListener(a,"shape_changed",z)),N&&eP(google.maps.event.addListener(a,"title_changed",N)),F&&eO(google.maps.event.addListener(a,"visible_changed",F)),j&&eI(google.maps.event.addListener(a,"zindex_changed",j)),G(a),U&&U(a),()=>{null!==q&&google.maps.event.removeListener(q),null!==Y&&google.maps.event.removeListener(Y),null!==Z&&google.maps.event.removeListener(Z),null!==J&&google.maps.event.removeListener(J),null!==ee&&google.maps.event.removeListener(ee),null!==ei&&google.maps.event.removeListener(ei),null!==es&&google.maps.event.removeListener(es),null!==en&&google.maps.event.removeListener(en),null!==el&&google.maps.event.removeListener(el),null!==eu&&google.maps.event.removeListener(eu),null!==ef&&google.maps.event.removeListener(ef),null!==eg&&google.maps.event.removeListener(eg),null!==ey&&google.maps.event.removeListener(ey),null!==eb&&google.maps.event.removeListener(eb),null!==e_&&google.maps.event.removeListener(e_),null!==eC&&google.maps.event.removeListener(eC),null!==eT&&google.maps.event.removeListener(eT),null!==eD&&google.maps.event.removeListener(eD),null!==eL&&google.maps.event.removeListener(eL),V&&V(a),r?r.removeMarker(a,!!s):a&&a.setMap(null)}},[]);var eR=(0,r7.useMemo)(()=>a?r7.Children.map(a,e=>(0,r7.isValidElement)(e)?(0,r7.cloneElement)(e,{anchor:H}):e):null,[a,H]);return(0,I.jsx)(I.Fragment,{children:eR})||null});class sU extends r7.PureComponent{constructor(){super(...arguments),si(this,"registeredEvents",[])}componentDidMount(){var e=this;return sc(function*(){var t=sz(sz(sz({},e.props.options||sj),e.props.clusterer?sj:{map:e.context}),{},{position:e.props.position});e.marker=new google.maps.Marker(t),e.props.clusterer?e.props.clusterer.addMarker(e.marker,!!e.props.noClustererRedraw):e.marker.setMap(e.context),e.registeredEvents=sl({updaterMap:sF,eventMap:sN,prevProps:{},nextProps:e.props,instance:e.marker}),e.props.onLoad&&e.props.onLoad(e.marker)})()}componentDidUpdate(e){this.marker&&(so(this.registeredEvents),this.registeredEvents=sl({updaterMap:sF,eventMap:sN,prevProps:e,nextProps:this.props,instance:this.marker}))}componentWillUnmount(){this.marker&&(this.props.onUnmount&&this.props.onUnmount(this.marker),so(this.registeredEvents),this.props.clusterer?this.props.clusterer.removeMarker(this.marker,!!this.props.noClustererRedraw):this.marker&&this.marker.setMap(null))}render(){return(this.props.children?r7.Children.map(this.props.children,e=>(0,r7.isValidElement)(e)?(0,r7.cloneElement)(e,{anchor:this.marker}):e):null)||null}}si(sU,"contextType",sa);var sV=function(){function e(t,i){t.getClusterer().extend(e,google.maps.OverlayView),this.cluster=t,this.clusterClassName=this.cluster.getClusterer().getClusterClass(),this.className=this.clusterClassName,this.styles=i,this.center=void 0,this.div=null,this.sums=null,this.visible=!1,this.boundsChangedListener=null,this.url="",this.height=0,this.width=0,this.anchorText=[0,0],this.anchorIcon=[0,0],this.textColor="black",this.textSize=11,this.textDecoration="none",this.fontWeight="bold",this.fontStyle="normal",this.fontFamily="Arial,sans-serif",this.backgroundPosition="0 0",this.cMouseDownInCluster=null,this.cDraggingMapByCluster=null,this.timeOut=null,this.setMap(t.getMap()),this.onBoundsChanged=this.onBoundsChanged.bind(this),this.onMouseDown=this.onMouseDown.bind(this),this.onClick=this.onClick.bind(this),this.onMouseOver=this.onMouseOver.bind(this),this.onMouseOut=this.onMouseOut.bind(this),this.onAdd=this.onAdd.bind(this),this.onRemove=this.onRemove.bind(this),this.draw=this.draw.bind(this),this.hide=this.hide.bind(this),this.show=this.show.bind(this),this.useStyle=this.useStyle.bind(this),this.setCenter=this.setCenter.bind(this),this.getPosFromLatLng=this.getPosFromLatLng.bind(this)}return e.prototype.onBoundsChanged=function(){this.cDraggingMapByCluster=this.cMouseDownInCluster},e.prototype.onMouseDown=function(){this.cMouseDownInCluster=!0,this.cDraggingMapByCluster=!1},e.prototype.onClick=function(e){if(this.cMouseDownInCluster=!1,!this.cDraggingMapByCluster){var t=this.cluster.getClusterer();if(google.maps.event.trigger(t,"click",this.cluster),google.maps.event.trigger(t,"clusterclick",this.cluster),t.getZoomOnClick()){var i=t.getMaxZoom(),r=this.cluster.getBounds(),s=t.getMap();null!==s&&"fitBounds"in s&&s.fitBounds(r),this.timeOut=window.setTimeout(function(){var e=t.getMap();if(null!==e){"fitBounds"in e&&e.fitBounds(r);var s=e.getZoom()||0;null!==i&&s>i&&e.setZoom(i+1)}},100)}e.cancelBubble=!0,e.stopPropagation&&e.stopPropagation()}},e.prototype.onMouseOver=function(){google.maps.event.trigger(this.cluster.getClusterer(),"mouseover",this.cluster)},e.prototype.onMouseOut=function(){google.maps.event.trigger(this.cluster.getClusterer(),"mouseout",this.cluster)},e.prototype.onAdd=function(){this.div=document.createElement("div"),this.div.className=this.className,this.visible&&this.show(),null==(e=this.getPanes())||e.overlayMouseTarget.appendChild(this.div);var e,t=this.getMap();null!==t&&(this.boundsChangedListener=google.maps.event.addListener(t,"boun
8198ds_changed",this.onBoundsChanged),this.div.addEventListener("mousedown",this.onMouseDown),this.div.addEventListener("click",this.onClick),this.div.addEventListener("mouseover",this.onMouseOver),this.div.addEventListener("mouseout",this.onMouseOut))},e.prototype.onRemove=function(){this.div&&this.div.parentNode&&(this.hide(),null!==this.boundsChangedListener&&google.maps.event.removeListener(this.boundsChangedListener),this.div.removeEventListener("mousedown",this.onMouseDown),this.div.removeEventListener("click",this.onClick),this.div.removeEventListener("mouseover",this.onMouseOver),this.div.removeEventListener("mouseout",this.onMouseOut),this.div.parentNode.removeChild(this.div),null!==this.timeOut&&(window.clearTimeout(this.timeOut),this.timeOut=null),this.div=null)},e.prototype.draw=function(){if(this.visible&&null!==this.div&&this.center){var e=this.getPosFromLatLng(this.center);this.div.style.top=null!==e?"".concat(e.y,"px"):"0",this.div.style.left=null!==e?"".concat(e.x,"px"):"0"}},e.prototype.hide=function(){this.div&&(this.div.style.display="none"),this.visible=!1},e.prototype.show=function(){var e,t,i,r,s,a;if(this.div&&this.center){var o=null===this.sums||void 0===this.sums.title||""===this.sums.title?this.cluster.getClusterer().getTitle():this.sums.title,h=this.backgroundPosition.split(" "),c=parseInt((null==(e=h[0])?void 0:e.replace(/^\s+|\s+$/g,""))||"0",10),d=parseInt((null==(t=h[1])?void 0:t.replace(/^\s+|\s+$/g,""))||"0",10),u=this.getPosFromLatLng(this.center);this.div.className=this.className,this.div.setAttribute("style","cursor: pointer; position: absolute; top: ".concat(null!==u?"".concat(u.y,"px"):"0","; left: ").concat(null!==u?"".concat(u.x,"px"):"0","; width: ").concat(this.width,"px; height: ").concat(this.height,"px; "));var p=document.createElement("img");p.alt=o,p.src=this.url,p.width=this.width,p.height=this.height,p.setAttribute("style","position: absolute; top: ".concat(d,"px; left: ").concat(c,"px")),this.cluster.getClusterer().enableRetinaIcons||(p.style.clip="rect(-".concat(d,"px, -").concat(c+this.width,"px, -").concat(d+this.height,", -").concat(c,")"));var f=document.createElement("div");f.setAttribute("style","position: absolute; top: ".concat(this.anchorText[0],"px; left: ").concat(this.anchorText[1],"px; color: ").concat(this.textColor,"; font-size: ").concat(this.textSize,"px; font-family: ").concat(this.fontFamily,"; font-weight: ").concat(this.fontWeight,"; fontStyle: ").concat(this.fontStyle,"; text-decoration: ").concat(this.textDecoration,"; text-align: center; width: ").concat(this.width,"px; line-height: ").concat(this.height,"px")),(null==(i=this.sums)?void 0:i.text)&&(f.innerText="".concat(null==(r=this.sums)?void 0:r.text)),(null==(s=this.sums)?void 0:s.html)&&(f.innerHTML="".concat(null==(a=this.sums)?void 0:a.html)),this.div.innerHTML="",this.div.appendChild(p),this.div.appendChild(f),this.div.title=o,this.div.style.display=""}this.visible=!0},e.prototype.useStyle=function(e){this.sums=e;var t=this.cluster.getClusterer().getStyles(),i=t[Math.min(t.length-1,Math.max(0,e.index-1))];i&&(this.url=i.url,this.height=i.height,this.width=i.width,i.className&&(this.className="".concat(this.clusterClassName," ").concat(i.className)),this.anchorText=i.anchorText||[0,0],this.anchorIcon=i.anchorIcon||[this.height/2,this.width/2],this.textColor=i.textColor||"black",this.textSize=i.textSize||11,this.textDecoration=i.textDecoration||"none",this.fontWeight=i.fontWeight||"bold",this.fontStyle=i.fontStyle||"normal",this.fontFamily=i.fontFamily||"Arial,sans-serif",this.backgroundPosition=i.backgroundPosition||"0 0")},e.prototype.setCenter=function(e){this.center=e},e.prototype.getPosFromLatLng=function(e){var t=this.getProjection().fromLatLngToDivPixel(e);return null!==t&&(t.x-=this.anchorIcon[1],t.y-=this.anchorIcon[0]),t},e}(),sW=function(){function e(e){this.markerClusterer=e,this.map=this.markerClusterer.getMap(),this.gridSize=this.markerClusterer.getGridSize(),this.minClusterSize=this.markerClusterer.getMinimumClusterSize(),this.averageCenter=this.markerClusterer.getAverageCenter(),this.markers=[],this.center=void 0,this.bounds=null,this.clusterIcon=new sV(this,this.markerClusterer.getStyles()),this.get
vendor: 4,162 bytes, line 8198
8198Size=this.getSize.bind(this),this.getMarkers=this.getMarkers.bind(this),this.getCenter=this.getCenter.bind(this),this.getMap=this.getMap.bind(this),this.getClusterer=this.getClusterer.bind(this),this.getBounds=this.getBounds.bind(this),this.remove=this.remove.bind(this),this.addMarker=this.addMarker.bind(this),this.isMarkerInClusterBounds=this.isMarkerInClusterBounds.bind(this),this.calculateBounds=this.calculateBounds.bind(this),this.updateIcon=this.updateIcon.bind(this),this.isMarkerAlreadyAdded=this.isMarkerAlreadyAdded.bind(this)}return e.prototype.getSize=function(){return this.markers.length},e.prototype.getMarkers=function(){return this.markers},e.prototype.getCenter=function(){return this.center},e.prototype.getMap=function(){return this.map},e.prototype.getClusterer=function(){return this.markerClusterer},e.prototype.getBounds=function(){for(var e=new google.maps.LatLngBounds(this.center,this.center),t=this.getMarkers(),i=0;i<t.length;i++){var r=t[i].getPosition();r&&e.extend(r)}return e},e.prototype.remove=function(){this.clusterIcon.setMap(null),this.markers=[],delete this.markers},e.prototype.addMarker=function(e){if(this.isMarkerAlreadyAdded(e))return!1;if(this.center){if(this.averageCenter){var t=e.getPosition();if(t){var i=this.markers.length+1;this.center=new google.maps.LatLng((this.center.lat()*(i-1)+t.lat())/i,(this.center.lng()*(i-1)+t.lng())/i),this.calculateBounds()}}}else{var r,t=e.getPosition();t&&(this.center=t,this.calculateBounds())}e.isAdded=!0,this.markers.push(e);var s=this.markers.length,a=this.markerClusterer.getMaxZoom(),o=null==(r=this.map)?void 0:r.getZoom();if(null!==a&&void 0!==o&&o>a)e.getMap()!==this.map&&e.setMap(this.map);else if(s<this.minClusterSize)e.getMap()!==this.map&&e.setMap(this.map);else if(s===this.minClusterSize)for(var h=0,c=this.markers;h<c.length;h++)c[h].setMap(null);else e.setMap(null);return!0},e.prototype.isMarkerInClusterBounds=function(e){if(null!==this.bounds){var t=e.getPosition();if(t)return this.bounds.contains(t)}return!1},e.prototype.calculateBounds=function(){this.bounds=this.markerClusterer.getExtendedBounds(new google.maps.LatLngBounds(this.center,this.center))},e.prototype.updateIcon=function(){var e,t=this.markers.length,i=this.markerClusterer.getMaxZoom(),r=null==(e=this.map)?void 0:e.getZoom();null!==i&&void 0!==r&&r>i||t<this.minClusterSize?this.clusterIcon.hide():(this.center&&this.clusterIcon.setCenter(this.center),this.clusterIcon.useStyle(this.markerClusterer.getCalculator()(this.markers,this.markerClusterer.getStyles().length)),this.clusterIcon.show())},e.prototype.isMarkerAlreadyAdded=function(e){if(this.markers.includes)return this.markers.includes(e);for(var t=0;t<this.markers.length;t++)if(e===this.markers[t])return!0;return!1},e}();function sH(e,t){var i=e.length,r=Math.min(i.toString().length,t);return{text:i.toString(),index:r,title:""}}var sG=[53,56,66,78,90],sq=function(){function e(t,i,r){void 0===i&&(i=[]),void 0===r&&(r={}),this.getMinimumClusterSize=this.getMinimumClusterSize.bind(this),this.setMinimumClusterSize=this.setMinimumClusterSize.bind(this),this.getEnableRetinaIcons=this.getEnableRetinaIcons.bind(this),this.setEnableRetinaIcons=this.setEnableRetinaIcons.bind(this),this.addToClosestCluster=this.addToClosestCluster.bind(this),this.getImageExtension=this.getImageExtension.bind(this),this.setImageExtension=this.setImageExtension.bind(this),this.getExtendedBounds=this.getExtendedBounds.bind(this),this.getAverageCenter=this.getAverageCenter.bind(this),this.setAverageCenter=this.setAverageCenter.bind(this),this.getTotalClusters=this.getTotalClusters.bind(this),this.fitMapToMarkers=this.fitMapToMarkers.bind(this),this.getIgnoreHidden=this.getIgnoreHidden.bind(this),this.setIgnoreHidden=this.setIgnoreHidden.bind(this),this.getClusterClass=this.getClusterClass.bind(this),this.setClusterClass=this.setClusterClass.bind(this),this.getTotalMarkers=this.getTotalMarkers.bind(this),this.getZoomOnClick=this.getZoomOnClick.bind(this),this.setZoomOnClick=this.setZoomOnClick.bind(this),this.getBatchSizeIE=this.getBatchSizeIE.bind(this),this.setBatchSizeIE=this.setBatchSizeIE.bind(this),this.createCluster
8198s=this.createClusters.bind(this),this.onZoomChanged=this.onZoomChanged.bind(this),this.getImageSizes=this.getImageSizes.bind(this),this.setImageSizes=this.setImageSizes.bind(this),this.getCalculator=this.getCalculator.bind(this),this.setCalculator=this.setCalculator.bind(this),this.removeMarkers=this.removeMarkers.bind(this),this.resetViewport=this.resetViewport.bind(this),this.getImagePath=this.getImagePath.bind(this),this.setImagePath=this.setImagePath.bind(this),this.pushMarkerTo=this.pushMarkerTo.bind(this),this.removeMarker=this.removeMarker.bind(this),this.clearMarkers=this.clearMarkers.bind(this),this.setupStyles=this.setupStyles.bind(this),this.getGridSize=this.getGridSize.bind(this),this.setGridSize=this.setGridSize.bind(this),this.getClusters=this.getClusters.bind(this),this.getMaxZoom=this.getMaxZoom.bind(this),this.setMaxZoom=this.setMaxZoom.bind(this),this.getMarkers=this.getMarkers.bind(this),this.addMarkers=this.addMarkers.bind(this),this.getStyles=this.getStyles.bind(this),this.setStyles=this.setStyles.bind(this),this.addMarker=this.addMarker.bind(this),this.onRemove=this.onRemove.bind(this),this.getTitle=this.getTitle.bind(this),this.setTitle=this.setTitle.bind(this),this.repaint=this.repaint.bind(this),this.onIdle=this.onIdle.bind(this),this.redraw=this.redraw.bind(this),this.onAdd=this.onAdd.bind(this),this.draw=this.draw.bind(this),this.extend=this.extend.bind(this),this.extend(e,google.maps.OverlayView),this.markers=[],this.clusters=[],this.listeners=[],this.activeMap=null,this.ready=!1,this.gridSize=r.gridSize||60,this.minClusterSize=r.minimumClusterSize||2,this.maxZoom=r.maxZoom||null,this.styles=r.styles||[],this.title=r.title||"",this.zoomOnClick=!0,void 0!==r.zoomOnClick&&(this.zoomOnClick=r.zoomOnClick),this.averageCenter=!1,void 0!==r.averageCenter&&(this.averageCenter=r.averageCenter),this.ignoreHidden=!1,void 0!==r.ignoreHidden&&(this.ignoreHidden=r.ignoreHidden),this.enableRetinaIcons=!1,void 0!==r.enableRetinaIcons&&(this.enableRetinaIcons=r.enableRetinaIcons),this.imagePath=r.imagePath||"https://developers.google.com/maps/documentation/javascript/examples/markerclusterer/m",this.imageExtension=r.imageExtension||"png",this.imageSizes=r.imageSizes||sG,this.calculator=r.calculator||sH,this.batchSize=r.batchSize||2e3,this.batchSizeIE=r.batchSizeIE||500,this.clusterClass=r.clusterClass||"cluster",-1!==navigator.userAgent.toLowerCase().indexOf("msie")&&(this.batchSize=this.batchSizeIE),this.timerRefStatic=null,this.setupStyles(),this.addMarkers(i,!0),this.setMap(t)}return e.prototype.onZoomChanged=function(){var e,t;this.resetViewport(!1),((null==(e=this.getMap())?void 0:e.getZoom())===(this.get("minZoom")||0)||(null==(t=this.getMap())?void 0:t.getZoom())===this.get("maxZoom"))&&google.maps.event.trigger(this,"idle")},e.prototype.onIdle=function(){this.redraw()},e.prototype.onAdd=function(){var e=this.getMap();this.activeMap=e,this.ready=!0,this.repaint(),null!==e&&(this.listeners=[google.maps.event.addListener(e,"zoom_changed",this.onZoomChanged),google.maps.event.addListener(e,"idle",this.onIdle)])},e.prototype.onRemove=function(){for(var e=0,t=this.markers;e<t.length;e++){var i=t[e];i.getMap()!==this.activeMap&&i.setMap(this.activeMap)}
vendor: 5,880 bytes, line 8198
8198for(var r=0,s=this.clusters;r<s.length;r++)s[r].remove();this.clusters=[];for(var a=0,o=this.listeners;a<o.length;a++){var h=o[a];google.maps.event.removeListener(h)}this.listeners=[],this.activeMap=null,this.ready=!1},e.prototype.draw=function(){},e.prototype.getMap=function(){return null},e.prototype.getPanes=function(){return null},e.prototype.getProjection=function(){return{fromContainerPixelToLatLng:function(){return null},fromDivPixelToLatLng:function(){return null},fromLatLngToContainerPixel:function(){return null},fromLatLngToDivPixel:function(){return null},getVisibleRegion:function(){return null},getWorldWidth:function(){return 0}}},e.prototype.setMap=function(){},e.prototype.addListener=function(){return{remove:function(){}}},e.prototype.bindTo=function(){},e.prototype.get=function(){},e.prototype.notify=function(){},e.prototype.set=function(){},e.prototype.setValues=function(){},e.prototype.unbind=function(){},e.prototype.unbindAll=function(){},e.prototype.setupStyles=function(){if(!(this.styles.length>0))for(var e=0;e<this.imageSizes.length;e++)this.styles.push({url:"".concat(this.imagePath+(e+1),".").concat(this.imageExtension),height:this.imageSizes[e]||0,width:this.imageSizes[e]||0})},e.prototype.fitMapToMarkers=function(){for(var e=this.getMarkers(),t=new google.maps.LatLngBounds,i=0;i<e.length;i++){var r=e[i].getPosition();r&&t.extend(r)}var s=this.getMap();null!==s&&"fitBounds"in s&&s.fitBounds(t)},e.prototype.getGridSize=function(){return this.gridSize},e.prototype.setGridSize=function(e){this.gridSize=e},e.prototype.getMinimumClusterSize=function(){return this.minClusterSize},e.prototype.setMinimumClusterSize=function(e){this.minClusterSize=e},e.prototype.getMaxZoom=function(){return this.maxZoom},e.prototype.setMaxZoom=function(e){this.maxZoom=e},e.prototype.getStyles=function(){return this.styles},e.prototype.setStyles=function(e){this.styles=e},e.prototype.getTitle=function(){return this.title},e.prototype.setTitle=function(e){this.title=e},e.prototype.getZoomOnClick=function(){return this.zoomOnClick},e.prototype.setZoomOnClick=function(e){this.zoomOnClick=e},e.prototype.getAverageCenter=function(){return this.averageCenter},e.prototype.setAverageCenter=function(e){this.averageCenter=e},e.prototype.getIgnoreHidden=function(){return this.ignoreHidden},e.prototype.setIgnoreHidden=function(e){this.ignoreHidden=e},e.prototype.getEnableRetinaIcons=function(){return this.enableRetinaIcons},e.prototype.setEnableRetinaIcons=function(e){this.enableRetinaIcons=e},e.prototype.getImageExtension=function(){return this.imageExtension},e.prototype.setImageExtension=function(e){this.imageExtension=e},e.prototype.getImagePath=function(){return this.imagePath},e.prototype.setImagePath=function(e){this.imagePath=e},e.prototype.getImageSizes=function(){return this.imageSizes},e.prototype.setImageSizes=function(e){this.imageSizes=e},e.prototype.getCalculator=function(){return this.calculator},e.prototype.setCalculator=function(e){this.calculator=e},e.prototype.getBatchSizeIE=function(){return this.batchSizeIE},e.prototype.setBatchSizeIE=function(e){this.batchSizeIE=e},e.prototype.getClusterClass=function(){return this.clusterClass},e.prototype.setClusterClass=function(e){this.clusterClass=e},e.prototype.getMarkers=function(){return this.markers},e.prototype.getTotalMarkers=function(){return this.markers.length},e.prototype.getClusters=function(){return this.clusters},e.prototype.getTotalClusters=function(){return this.clusters.length},e.prototype.addMarker=function(e,t){this.pushMarkerTo(e),t||this.redraw()},e.prototype.addMarkers=function(e,t){for(var i in e)if(Object.prototype.hasOwnProperty.call(e,i)){var r=e[i];r&&this.pushMarkerTo(r)}t||this.redraw()},e.prototype.pushMarkerTo=function(e){var t=this;e.getDraggable()&&google.maps.event.addListener(e,"dragend",function(){t.ready&&(e.isAdded=!1,t.repaint())}),e.isAdded=!1,this.markers.push(e)},e.prototype.removeMarker_=function(e){var t=-1;if(this.markers.indexOf)t=this.markers.indexOf(e);else for(var i=0;i<this.markers.length;i++)if(e===this.markers[i]){t=i;break}return -1!==t&&(e.setMap(null),this.markers.splice(t,1),!0)},e.prototype.removeMarker=function(e,t){var i=this.removeMarker_(e);return!t&&i&&this.repaint(),i},e.prototype.removeMarkers=function(e,t){for(var i=!1,r=0;r<e.length;r++){var s=e[r];i=i||this.removeMarker_(s)}return!t&&i&&this.repaint(),i},e.prototype.clearMarkers=function(){this.resetViewport(!0),this.markers=[]},e.prototype.repaint=function(){var e=this.clusters.slice();this.clusters=[],this.resetViewport(!1),this.redraw(),setTimeout(function(){for(var t=0;t<e.length;t++)e[t].remove()},0)},e.prototype.getExtendedBounds=function(e){var t=this.getProjection(),i=t.fromLatLngToDivPixel(new google.maps.LatLng(e.getNorthEast().lat(),e.getNorthEast().lng()));null!==i&&(i.x+=this.gridSize,i.y-=this.gridSize);var r=t.fromLatLngToDivPixel(new google.maps.LatLng(e.getSouthWest().lat(),e.getSouthWest().lng()));if(null!==r&&(r.x-=this.gridSize,r.y+=this.gridSize),null!==i){var s=t.fromDivPixelToLatLng(i);null!==s&&e.extend(s)}if(null!==r){var a=t.fromDivPixelToLatLng(r);null!==a&&e.extend(a)}return e},e.prototype.redraw=function(){this.createClusters(0)},e.prototype.resetViewport=function(e){for(var t=0,i=this.clusters;t<i.length;t++)i[t].remove();this.clusters=[];for(var r=0,s=this.markers;r<s.length;r++){var a=s[r];a.isAdded=!1,e&&a.setMap(null)}},e.prototype.distanceBetweenPoints=function(e,t){var i=(t.lat()-e.lat())*Math.PI/180,r=(t.lng()-e.lng())*Math.PI/180,s=Math.sin(i/2)*Math.sin(i/2)+Math.cos(e.lat()*Math.PI/180)*Math.cos(t.lat()*Math.PI/180)*Math.sin(r/2)*Math.sin(r/2);return 2*Math.atan2(Math.sqrt(s),Math.sqrt(1-s))*6371},e.prototype.isMarkerInBounds=function(e,t){var i=e.getPosition();return!!i&&t.contains(i)},e.prototype.addToClosestCluster=function(e){for(var t,i=4e4,r=null,s=0,a=this.cluster
8198s;s<a.length;s++){var o=(t=a[s]).getCenter(),h=e.getPosition();if(o&&h){var c=this.distanceBetweenPoints(o,h);c<i&&(i=c,r=t)}}r&&r.isMarkerInClusterBounds(e)?r.addMarker(e):((t=new sW(this)).addMarker(e),this.clusters.push(t))},e.prototype.createClusters=function(e){var t=this;if(this.ready){0===e&&(google.maps.event.trigger(this,"clusteringbegin",this),null!==this.timerRefStatic&&(window.clearTimeout(this.timerRefStatic),delete this.timerRefStatic));for(var i=this.getMap(),r=null!==i&&("getBounds"in i)?i.getBounds():null,s=((null==i?void 0:i.getZoom())||0)>3?new google.maps.LatLngBounds(null==r?void 0:r.getSouthWest(),null==r?void 0:r.getNorthEast()):new google.maps.LatLngBounds(new google.maps.LatLng(85.02070771743472,-178.48388434375),new google.maps.LatLng(-85.08136444384544,178.00048865625)),a=this.getExtendedBounds(s),o=Math.min(e+this.batchSize,this.markers.length),h=e;h<o;h++){var c=this.markers[h];c&&!c.isAdded&&this.isMarkerInBounds(c,a)&&(!this.ignoreHidden||this.ignoreHidden&&c.getVisible())&&this.addToClosestCluster(c)}if(o<this.markers.length)this.timerRefStatic=window.setTimeout(function(){t.createClusters(o)},0);else{this.timerRefStatic=null,google.maps.event.trigger(this,"clusteringend",this);
8198for(var d=0,u=this.clusters;d<u.length;d++)u[d].updateIcon()}}},e.prototype.extend=function(e,t){return(function(e){for(var t in e.prototype)this.prototype[t]=e.prototype[t];return this}).apply(e,[t])},e}();function sX(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,r)}return i}var sY={onClick:"click",onClusteringBegin:"clusteringbegin",onClusteringEnd:"clusteringend",onMouseOut:"mouseout",onMouseOver:"mouseover"},sQ={averageCenter(e,t){e.setAverageCenter(t)},batchSizeIE(e,t){e.setBatchSizeIE(t)},calculator(e,t){e.setCalculator(t)},clusterClass(e,t){e.setClusterClass(t)},enableRetinaIcons(e,t){e.setEnableRetinaIcons(t)},gridSize(e,t){e.setGridSize(t)},ignoreHidden(e,t){e.setIgnoreHidden(t)},imageExtension(e,t){e.setImageExtension(t)},imagePath(e,t){e.setImagePath(t)},imageSizes(e,t){e.setImageSizes(t)},maxZoom(e,t){e.setMaxZoom(t)},minimumClusterSize(e,t){e.setMinimumClusterSize(t)},styles(e,t){e.setStyles(t)},title(e,t){e.setTitle(t)},zoomOnClick(e,t){e.setZoomOnClick(t)}},sZ={};(0,r7.memo)(function(e){var{children:t,options:i,averageCenter:r,batchSizeIE:s,calculator:a,clusterClass:o,enableRetinaIcons:h,gridSize:c,ignoreHidden:d,imageExtension:u,imagePath:p,imageSizes:f,maxZoom:m,minimumClusterSize:g,styles:v,title:y,zoomOnClick:x,onClick:b,onClusteringBegin:w,onClusteringEnd:_,onMouseOver:S,onMouseOut:C,onLoad:M,onUnmount:E}=e,[A,T]=(0,r7.useState)(null),P=(0,r7.useContext)(sa),[D,O]=(0,r7.useState)(null),[L,I]=(0,r7.useState)(null),[R,k]=(0,r7.useState)(null),[B,z]=(0,r7.useState)(null),[N,F]=(0,r7.useState)(null);return(0,r7.useEffect)(()=>{A&&C&&(null!==B&&google.maps.event.removeListener(B),z(google.maps.event.addListener(A,sY.onMouseOut,C)))},[C]),(0,r7.useEffect)(()=>{A&&S&&(null!==N&&google.maps.event.removeListener(N),F(google.maps.event.addListener(A,sY.onMouseOver,S)))},[S]),(0,r7.useEffect)(()=>{A&&b&&(null!==D&&google.maps.event.removeListener(D),O(google.maps.event.addListener(A,sY.onClick,b)))},[b]),(0,r7.useEffect)(()=>{A&&w&&(null!==L&&google.maps.event.removeListener(L),I(google.maps.event.addListener(A,sY.onClusteringBegin,w)))},[w]),(0,r7.useEffect)(()=>{A&&_&&(null!==R&&google.maps.event.removeListener(R),I(google.maps.event.addListener(A,sY.onClusteringEnd,_)))},[_]),(0,r7.useEffect)(()=>{void 0!==r&&null!==A&&sQ.averageCenter(A,r)},[A,r]),(0,r7.useEffect)(()=>{void 0!==s&&null!==A&&sQ.batchSizeIE(A,s)},[A,s]),(0,r7.useEffect)(()=>{void 0!==a&&null!==A&&sQ.calculator(A,a)},[A,a]),(0,r7.useEffect)(()=>{void 0!==o&&null!==A&&sQ.clusterClass(A,o)},[A,o]),(0,r7.useEffect)(()=>{void 0!==h&&null!==A&&sQ.enableRetinaIcons(A,h)},[A,h]),(0,r7.useEffect)(()=>{void 0!==c&&null!==A&&sQ.gridSize(A,c)},[A,c]),(0,r7.useEffect)(()=>{void 0!==d&&null!==A&&sQ.ignoreHidden(A,d)},[A,d]),(0,r7.useEffect)(()=>{void 0!==u&&null!==A&&sQ.imageExtension(A,u)},[A,u]),(0,r7.useEffect)(()=>{void 0!==p&&null!==A&&sQ.imagePath(A,p)},[A,p]),(0,r7.useEffect)(()=>{void 0!==f&&null!==A&&sQ.imageSizes(A,f)},[A,f]),(0,r7.useEffect)(()=>{void 0!==m&&null!==A&&sQ.maxZoom(A,m)},[A,m]),(0,r7.useEffect)(()=>{void 0!==g&&null!==A&&sQ.minimumClusterSize(A,g)},[A,g]),(0,r7.useEffect)(()=>{void 0!==v&&null!==A&&sQ.styles(A,v)},[A,v]),(0,r7.useEffect)(()=>{void 0!==y&&null!==A&&sQ.title(A,y)},[A,y]),(0,r7.useEffect)(()=>{void 0!==x&&null!==A&&sQ.zoomOnClick(A,x)},[A,x]),(0,r7.useEffect)(()=>{if(P){var e=new sq(P,[],function(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?sX(Object(i),!0).forEach(function(t){si(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):sX(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}({},i||sZ));return r&&sQ.averageCenter(e,r),s&&sQ.batchSizeIE(e,s),a&&sQ.calculator(e,a),o&&sQ.clusterClass(e,o),h&&sQ.enableRetinaIcons(e,h),c&&sQ.gridSize(e,c),d&&sQ.ignoreHidden(e,d),u&&sQ.imageExtension(e,u),p&&sQ.imagePath(e,p),f&&sQ.imageSizes(e,f),m&&sQ.maxZoom(e,m),g&&sQ.minimumClusterSize(e,g),v&&sQ.styles(e,v),y&&sQ.title(e,y),x&&sQ.zoomOnClick(e,x),C&&z(google.maps.event.addListener(e,sY.onMouseOut,C)),S&&F(google.maps.event.addListener(e,sY.onMouseOver,S)),b&&O(google.maps.event.addListener(e,sY.onClick,b)),w&&I(google.maps.event.addListener(e,sY.onClusteringBegin,w)),_&&k(google.maps.event.addListener(e,sY.onClusteringEnd,_)),T(e),M&&M(e),()=>{null!==B&&google.maps.event.removeListener(B),null!==N&&google.maps.event.removeListener(N),null!==D&&google.maps.event.removeListener(
vendor: 11,697 bytes, line 8198
8198D),null!==L&&google.maps.event.removeListener(L),null!==R&&google.maps.event.removeListener(R),E&&E(e)}}},[]),null!==A&&t(A)||null});class sK extends r7.PureComponent{constructor(){super(...arguments),si(this,"registeredEvents",[]),si(this,"state",{markerClusterer:null}),si(this,"setClustererCallback",()=>{null!==this.state.markerClusterer&&this.props.onLoad&&this.props.onLoad(this.state.markerClusterer)})}componentDidMount(){if(this.context){var e=new sq(this.context,[],this.props.options);this.registeredEvents=sl({updaterMap:sQ,eventMap:sY,prevProps:{},nextProps:this.props,instance:e}),this.setState(()=>({markerClusterer:e}),this.setClustererCallback)}}componentDidUpdate(e){this.state.markerClusterer&&(so(this.registeredEvents),this.registeredEvents=sl({updaterMap:sQ,eventMap:sY,prevProps:e,nextProps:this.props,instance:this.state.markerClusterer}))}componentWillUnmount(){null!==this.state.markerClusterer&&(this.props.onUnmount&&this.props.onUnmount(this.state.markerClusterer),so(this.registeredEvents),this.state.markerClusterer.setMap(null))}render(){return null!==this.state.markerClusterer?this.props.children(this.state.markerClusterer):null}}function sJ(e){e.cancelBubble=!0,e.stopPropagation&&e.stopPropagation()}si(sK,"contextType",sa);var s$=function(){function e(t){void 0===t&&(t={}),this.getCloseClickHandler=this.getCloseClickHandler.bind(this),this.closeClickHandler=this.closeClickHandler.bind(this),this.createInfoBoxDiv=this.createInfoBoxDiv.bind(this),this.addClickHandler=this.addClickHandler.bind(this),this.getCloseBoxImg=this.getCloseBoxImg.bind(this),this.getBoxWidths=this.getBoxWidths.bind(this),this.setBoxStyle=this.setBoxStyle.bind(this),this.setPosition=this.setPosition.bind(this),this.getPosition=this.getPosition.bind(this),this.setOptions=this.setOptions.bind(this),this.setContent=this.setContent.bind(this),this.setVisible=this.setVisible.bind(this),this.getContent=this.getContent.bind(this),this.getVisible=this.getVisible.bind(this),this.setZIndex=this.setZIndex.bind(this),this.getZIndex=this.getZIndex.bind(this),this.onRemove=this.onRemove.bind(this),this.panBox=this.panBox.bind(this),this.extend=this.extend.bind(this),this.close=this.close.bind(this),this.draw=this.draw.bind(this),this.show=this.show.bind(this),this.hide=this.hide.bind(this),this.open=this.open.bind(this),this.extend(e,google.maps.OverlayView),this.content=t.content||"",this.disableAutoPan=t.disableAutoPan||!1,this.maxWidth=t.maxWidth||0,this.pixelOffset=t.pixelOffset||new google.maps.Size(0,0),this.position=t.position||new google.maps.LatLng(0,0),this.zIndex=t.zIndex||null,this.boxClass=t.boxClass||"infoBox",this.boxStyle=t.boxStyle||{},this.closeBoxMargin=t.closeBoxMargin||"2px",this.closeBoxURL=t.closeBoxURL||"http://www.google.com/intl/en_us/mapfiles/close.gif",""===t.closeBoxURL&&(this.closeBoxURL=""),this.infoBoxClearance=t.infoBoxClearance||new google.maps.Size(1,1),void 0===t.visible&&(void 0===t.isHidden?t.visible=!0:t.visible=!t.isHidden),this.isHidden=!t.visible,this.alignBottom=t.alignBottom||!1,this.pane=t.pane||"floatPane",this.enableEventPropagation=t.enableEventPropagation||!1,this.div=null,this.closeListener=null,this.moveListener=null,this.mapListener=null,this.contextListener=null,this.eventListeners=null,this.fixedWidthSet=null}return e.prototype.createInfoBoxDiv=function(){var e=this;if(!this.div){this.div=document.createElement("div"),this.setBoxStyle(),"string"==typeof this.content?this.div.innerHTML=this.getCloseBoxImg()+this.content:(this.div.innerHTML=this.getCloseBoxImg(),this.div.appendChild(this.content));var t=this.getPanes();if(null!==t&&t[this.pane].appendChild(this.div),this.addClickHandler(),this.div.style.width)this.fixedWidthSet=!0;else if(0!==this.maxWidth&&this.div.offsetWidth>this.maxWidth)this.div.style.width=this.maxWidth+"px",this.fixedWidthSet=!0;else{var i=this.getBoxWidths();this.div.style.width=this.div.offsetWidth-i.left-i.right+"px",this.fixedWidthSet=!1}if(this.panBox(this.disableAutoPan),!this.enableEventPropagation){this.eventListeners=[];for(var r=0,s=["mousedown","mouseover","mouseout","mouseup","click","dblclick","touchstart","touchend","touchmove"];r<s.length;r++){var a=s[r];this.eventListeners.push(google.maps.event.addListener(this.div,a,sJ))}this.eventListeners.push(google.maps.event.addListener(this.div,"mouseover",function(){e.div&&(e.div.style.cursor="default")}))}this.contextListener=google.maps.event.addListener(this.div,"contextmenu",function(t){t.returnValue=!1,t.preventDefault&&t.preventDefault(),e.enableEventPropagation||sJ(t)}),google.maps.event.trigger(this,"domready")}},e.prototype.getCloseBoxImg=function(){var e="";return""!==this.closeBoxURL&&(e='<img alt="" aria-hidden="true" src=\''+this.closeBoxURL+"' align=right style=' position: relative; cursor: pointer;"+(" margin: "+this.closeBoxMargin)+";'>"),e},e.prototype.addClickHandler=function(){this.closeListener=this.div&&this.div.firstChild&&""!==this.closeBoxURL?google.maps.event.addListener(this.div.firstChild,"click",this.getCloseClickHandler()):null},e.prototype.closeClickHandler=function(e){e.cancelBubble=!0,e.stopPropagation&&e.stopPropagation(),google.maps.event.trigger(this,"closeclick"),this.close()},e.prototype.getCloseClickHandler=function(){return this.closeClickHandler},e.prototype.panBox=function(e){if(this.div&&!e){var t=this.getMap();if(t instanceof google.maps.Map){var i=0,r=0,s=t.getBounds();s&&!s.contains(this.position)&&t.setCenter(this.position);var a=t.getDiv(),o=a.offsetWidth,h=a.offsetHeight,c=this.pixelOffset.width,d=this.pixelOffset.height,u=this.div.offsetWidth,p=this.div.offsetHeight,f=this.infoBoxClearance.width,m=this.infoBoxClearance.height,g=this.getProjection().fromLatLngToContainerPixel(this.position);null!==g&&(g.x<-c+f?i=g.x+c-f:g.x+u+c+f>o&&(i=g.x+u+c+f-o),this.alignBottom?g.y<-d+m+p?r=g.y+d-m-p:g.y+d+m>h&&(r=g.y+d+m-h):g.y<-d+m?r=g.y+d-m:g.y+p+d+m>h&&(r=g.y+p+d+m-h)),(0!==i||0!==r)&&t.panBy(i,r)}}},e.prototype.setBoxStyle=function(){if(this.div){this.div.className=this.boxClass,this.div.style.cssText="";var e=this.boxStyle;for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(this.div.style[t]=e[t]);if(this.div.style.webkitTransform="translateZ(0)",void 0!==this.div.style.opacity&&""!==this.div.style.opacity){var i=parseFloat(this.div.style.opacity||"");this.div.style.msFilter='"progid:DXImageTransform.Microsoft.Alpha(Opacity='+100*i+')"',this.div.style.filter="alpha(opacity="+100*i+")"}this.div.style.position="absolute",this.div.style.visibility="hidden",null!==this.zIndex&&(this.div.style.zIndex=this.zIndex+""),this.div.style.overflow||(this.div.style.overflow="auto")}},e.prototype.getBoxWidths=function(){var e={top:0,bottom:0,left:0,right:0};if(!this.div)return e;if(document.defaultView){var t=this.div.ownerDocument,i=t&&t.defaultView?t.defaultView.getComputedStyle(this.div,""):null;i&&(e.top=parseInt(i.borderTopWidth||"",10)||0,e.bottom=parseInt(i.borderBottomWidth||"",10)||0,e.left=parseInt(i.borderLeftWidth||"",10)||0,e.right=parseInt(i.borderRightWidth||"",10)||0)}else if(document.documentElement.currentStyle){var r=this.div.currentStyle;r&&(e.top=parseInt(r.borderTopWidth||"",10)||0,e.bottom=parseInt(r.borderBottomWidth||"",10)||0,e.left=parseInt(r.borderLeftWidth||"",10)||0,e.right=parseInt(r.borderRightWidth||"",10)||0)}return e},e.prototype.onRemove=function(){this.div&&this.div.parentNode&&(this.div.parentNode.removeChild(this.div),this.div=null)},e.prototype.draw=function(){if(this.createInfoBoxDiv(),this.div){var e=this.getProjection().fromLatLngToDivPixel(this.position);null!==e&&(this.div.style.left=e.x+this.pixelOffset.width+"px",this.alignBottom?this.div.style.bottom=-(e.y+this.pixelOffset.height)+"px":this.div.style.top=e.y+this.pixelOffset.height+"px"),this.isHidden?this.div.style.visibility="hidden":this.div.style.visibility="visible"}},e.prototype.setOptions=function(e){void 0===e&&(e={}),void 0!==e.boxClass&&(this.boxClass=e.boxClass,this.setBoxStyle()),void 0!==e.boxStyle&&(this.boxStyle=e.boxStyle,this.setBoxStyle()),void 0!==e.content&&this.setContent(e.content),void 0!==e.disableAutoPan&&(this.disableAutoPan=e.disableAutoPan),void 0!==e.maxWidth&&(this.maxWidth=e.maxWidth),void 0!==e.pixelOffset&&(this.pixelOffset=e.pixelOffset),void 0!==e.alignBottom&&(this.alignBottom=e.alignBottom),void 0!==e.position&&this.setPosition(e.position),void 0!==e.zIndex&&this.setZIndex(e.zIndex),void 0!==e.closeBoxMargin&&(this.closeBoxMargin=e.closeBoxMargin),void 0!==e.closeBoxURL&&(this.closeBoxURL=e.closeBoxURL),void 0!==e.infoBoxClearance&&(this.infoBoxClearance=e.infoBoxClearance),void 0!==e.isHidden&&(this.isHidden=e.isHidden),void 0!==e.visible&&(this.isHidden=!e.visible),void 0!==e.enableEventPropagation&&(this.enableEventPropagation=e.enableEventPropagation),this.div&&this.draw()},e.prototype.setContent=function(e){this.content=e,this.div&&(this.closeListener&&(google.maps.event.removeListener(this.closeListener),this.closeListener=null),this.fixedWidthSet||(this.div.style.width=""),"string"==typeof e?this.div.innerHTML=this.getCloseBoxImg()+e:(this.div.innerHTML=this.getCloseBoxImg(),this.div.appendChild(e)),this.fixedWidthSet||(this.div.style.width=this.div.offsetWidth+"px","string"==typeof e?this.div.innerHTML=this.getCloseBoxImg()+e:(this.div.innerHTML=this.getCloseBoxImg(),this.div.appendChild(e))),this.addClickHandler()),google.maps.event.trigger(this,"content_changed")},e.prototype.setPosition=function(e){this.position=e,this.div&&this.draw(),google.maps.event.trigger(this,"position_changed")},e.prototype.setVisible=function(e){this.isHidden=!e,this.div&&(this.div.style.visibility=this.isHidden?"hidden":"visible")},e.prototype.setZIndex=function(e){this.zIndex=e,this.div&&(this.div.style.zIndex=e+""),google.maps.event.trigger(this,"zindex_changed")},e.prototype.getContent=function(){return this.content},e.prototype.getPosition=function(){return this.position},e.prototype.getZIndex=function(){return this.zIndex},e.prototype.getVisible=function(){return null!=this.getMap()&&!this.isHidden},e.prototype.show=function(){this.isHidden=!1,this.div&&(this.div.style.visibility="visible")},e.prototype.hide=function(){this.isHidden=!0,this.div&&(this.div.style.visibility="hidden")},e.prototype.open=function(e,t){var i=this;t&&(this.position=t.getPosition(),this.moveListener=google.maps.event.addListener(t,"position_changed",function(){var e=t.getPosition();i.setPosition(e)}),this.mapListener=google.maps.event.addListener(t,"map_changed",function(){i.setMap(t.map)})),this.setMap(e),this.div&&this.panBox()},e.prototype.close=function(){if(this.closeListener&&(google.maps.event.removeListener(this.closeListener),this.closeListener=null),this.eventListeners){for(var e=0,t=this.eventListeners;e<t.length;e++){var i=t[e];google.maps.event.removeListener(i)}this.eventListeners=null}this.moveListener&&(google.maps.event.removeListener(this.moveListener),this.moveListener=null),this.mapListener&&(google.maps.event.removeListener(this.mapListener),this.mapListener=null),this.contextListener&&(google.maps.event.removeListener(this.contextListener),this.contextListener=null),this.setMap(null)},e.prototype.extend=function(e,t){return(function(e){for(var t in e.prototype)Object.prototype.hasOwnProperty.call(this,t)||(this.prototype[t]=e.prototype[t]);return this}).apply(e,[t])},e}(),s0=["position"],s1=["position"];function s2(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,r)}return i}function s3(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};
8198t%2?s2(Object(i),!0).forEach(function(t){si(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):s2(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}var s4={onCloseClick:"closeclick",onContentChanged:"content_changed",onDomReady:"domready",onPositionChanged:"position_changed",onZindexChanged:"zindex_changed"},s5={options(e,t){e.setOptions(t)},position(e,t){t instanceof google.maps.LatLng?e.setPosition(t):e.setPosition(new google.maps.LatLng(t.lat,t.lng))},visible(e,t){e.setVisible(t)},zIndex(e,t){e.setZIndex(t)}},s6={};(0,r7.memo)(function(e){var{children:t,anchor:i,options:r,position:s,zIndex:a,onCloseClick:o,onDomReady:h,onContentChanged:c,onPositionChanged:d,onZindexChanged:u,onLoad:p,onUnmount:f}=e,m=(0,r7.useContext)(sa),[g,v]=(0,r7.useState)(null),[y,x]=(0,r7.useState)(null),[b,w]=(0,r7.useState)(null),[_,S]=(0,r7.useState)(null),[C,M]=(0,r7.useState)(null),[E,A]=(0,r7.useState)(null),T=(0,r7.useRef)(null);return(0,r7.useEffect)(()=>{m&&null!==g&&(g.close(),i?g.open(m,i):g.getPosition()&&g.open(m))},[m,g,i]),(0,r7.useEffect)(()=>{r&&null!==g&&g.setOptions(r)},[g,r]),(0,r7.useEffect)(()=>{if(s&&null!==g){var e=s instanceof google.maps.LatLng?s:new google.maps.LatLng(s.lat,s.lng);g.setPosition(e)}},[s]),(0,r7.useEffect)(()=>{"number"==typeof a&&null!==g&&g.setZIndex(a)},[a]),(0,r7.useEffect)(()=>{g&&o&&(null!==y&&google.maps.event.removeListener(y),x(google.maps.event.addListener(g,"closeclick",o)))},[o]),(0,r7.useEffect)(()=>{g&&h&&(null!==b&&google.maps.event.removeListener(b),w(google.maps.event.addListener(g,"domready",h)))},[h]),(0,r7.useEffect)(()=>{g&&c&&(null!==_&&google.maps.event.removeListener(_),S(google.maps.event.addListener(g,"content_changed",c)))},[c]),(0,r7.useEffect)(()=>{g&&d&&(null!==C&&google.maps.event.removeListener(C),M(google.maps.event.addListener(g,"position_changed",d)))},[d]),(0,r7.useEffect)(()=>{g&&u&&(null!==E&&google.maps.event.removeListener(E),A(google.maps.event.addListener(g,"zindex_changed",u)))},[u]),(0,r7.useEffect)(()=>{if(m){var e,t=r||s6,{position:s}=t,a=sb(t,s0);!s||s instanceof google.maps.LatLng||(e=new google.maps.LatLng(s.lat,s.lng));var P=new s$(s3(s3({},a),e?{position:e}:{}));T.current=document.createElement("div"),v(P),o&&x(google.maps.event.addListener(P,"closeclick",o)),h&&w(google.maps.event.addListener(P,"domready",h)),c&&S(google.maps.event.addListener(P,"content_changed",c)),d&&M(google.maps.event.addListener(P,"position_changed",d)),u&&A(google.maps.event.addListener(P,"zindex_changed",u)),P.setContent(T.current),i?P.open(m,i):P.getPosition()?P.open(m):ss(!1,"You must provide either an anchor or a position prop for <InfoBox>."),p&&p(P)}return()=>{null!==g&&(y&&google.maps.event.removeListener(y),_&&google.maps.event.removeListener(_),b&&google.maps.event.removeListener(b),C&&google.maps.event.removeListener(C),E&&google.maps.event.removeListener(E),f&&f(g),g.close())}},[]),T.current?(0,se.createPortal)(r7.Children.only(t),T.current):null});class s8 extends r7.PureComponent{constructor(){super(...arguments),si(this,"registeredEvents",[]),si(this,"containerElement",null),si(this,"state",{infoBox:null}),si(this,"open",(e,t)=>{t?null!==this.context&&e.open(this.context,t):e.getPosition()?null!==this.context&&e.open(this.context):ss(!1,"You must provide either an anchor or a position prop for <InfoBox>.")}),si(this,"setInfoBoxCallback",()=>{null!==this.state.infoBox&&null!==this.containerElement&&(this.state.infoBox.setContent(this.containerElement),this.open(this.state.infoBox,this.props.anchor),this.props.onLoad&&this.props.onLoad(this.state.infoBox))})}componentDidMount(){var e,t=this.props.options||{},{position:i}=t,r=sb(t,s1);!i||i instanceof google.maps.LatLng||(e=new google.maps.LatLng(i.lat,i.lng));var s=new s$(s3(s3({},r),e?{position:e}:{}));this.containerElement=document.createElement("div"),this.registeredEvents=sl({updaterMap:s5,eventMap:s4,prevProps:{},nextProps:this.props,instance:s}),this.setState({infoBox:s},this.setInfoBoxCallback)}componentDidUpdate(e){var{infoBox:t}=this.state;null!==t&&(so(this.registeredEvents),this.registeredEvents=sl({updaterMap:s5,eventMap:s4,prevProps:e,nextProps:this.props,instance:t}))}componentWillUnmount(){var{onUnmount:e}=this.props,{infoBox:t}=this.state;null!==t&&(e&&e(t),so(this.registeredEvents),t.close())}render(){return this.containerElement?(0,se.createPortal)(r7.Children.only(this.props.children),this.containerElement):null}}si(s8,"contextType",sa);var s9=sr(D?P:(D=1,P=function e(t,i){if(t===i)return!0;
8198if(t&&i&&"object"==typeof t&&"object"==typeof i){if(t.constructor!==i.constructor)return!1;if(Array.isArray(t)){if((r=t.length)!=i.length)return!1;for(s=r;0!=s--;)if(!e(t[s],i[s]))return!1;return!0}if(t.constructor===RegExp)return t.source===i.source&&t.flags===i.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===i.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===i.toString();if((r=(a=Object.keys(t)).length)!==Object.keys(i).length)return!1;for(s=r;0!=s--;)if(!Object.prototype.hasOwnProperty.call(i,a[s]))return!1;for(s=r;0!=s--;){var r,s,a,o=a[s];if(!e(t[o],i[o]))return!1}return!0}return t!=t&&i!=i})),s7=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class ae{static from(e){if(!(e instanceof ArrayBuffer))throw Error("Data must be an instance of ArrayBuffer.");var[t,i]=new Uint8Array(e,0,2);if(219!==t)throw Error("Data does not appear to be in a KDBush format.");var r=i>>4;if(1!==r)throw Error("Got v".concat(r," data when expected v").concat(1,"."));var s=s7[15&i];if(!s)throw Error("Unrecognized array type.");var[a]=new Uint16Array(e,2,1),[o]=new Uint32Array(e,4,1);return new ae(o,a,s,e)}constructor(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:64,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Float64Array,r=arguments.length>3?arguments[3]:void 0;if(isNaN(e)||e<0)throw Error("Unpexpected numItems value: ".concat(e,"."));this.numItems=+e,this.nodeSize=Math.min(Math.max(+t,2),65535),this.ArrayType=i,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;var s=s7.indexOf(this.ArrayType),a=2*e*this.ArrayType.BYTES_PER_ELEMENT,o=e*this.IndexArrayType.BYTES_PER_ELEMENT,h=(8-o%8)%8;if(s<0)throw Error("Unexpected typed array class: ".concat(i,"."));r&&r instanceof ArrayBuffer?(this.data=r,this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+o+h,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+a+o+h),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+o+h,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+s]),new Uint16Array(this.data,2,1)[0]=t,new Uint32Array(this.data,4,1)[0]=e)}add(e,t){var i=this._pos>>1;return this.ids[i]=i,this.coords[this._pos++]=e,this.coords[this._pos++]=t,i}finish(){var e=this._pos>>1;if(e!==this.numItems)throw Error("Added ".concat(e," items when expected ").concat(this.numItems,"."));return function e(t,i,r,s,a,o){if(!(a-s<=r)){var h=s+a>>1;(function e(t,i,r,s,a,o){for(;a>s;){if(a-s>600){var h=a-s+1,c=r-s+1,d=Math.log(h),u=.5*Math.exp(2*d/3),p=.5*Math.sqrt(d*u*(h-u)/h)*(c-h/2<0?-1:1),f=Math.max(s,Math.floor(r-c*u/h+p)),m=Math.min(a,Math.floor(r+(h-c)*u/h+p));e(t,i,r,f,m,o)}var g=i[2*r+o],v=s,y=a;for(at(t,i,s,r),i[2*a+o]>g&&at(t,i,s,a);v<y;){for(at(t,i,v,y),v++,y--;i[2*v+o]<g;)v++;for(;i[2*y+o]>g;)y--}i[2*s+o]===g?at(t,i,s,y):at(t,i,++y,a),y<=r&&(s=y+1),r<=y&&(a=y-1)}})(t,i,h,s,a,o),e(t,i,r,s,h-1,1-o),e(t,i,r,h+1,a,1-o)}}(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,t,i,r){if(!this._finished)throw Error("Data not yet indexed - call index.finish().");for(var{ids:s,coords:a,nodeSize:o}=this,h=[0,s.length-1,0],c=[];h.length;){var d=h.pop()||0,u=h.pop()||0,p=h.pop()||0;if(u-p<=o){for(var f=p;f<=u;f++){var m=a[2*f],g=a[2*f+1];m>=e&&m<=i&&g>=t&&g<=r&&c.push(s[f])}continue}var v=p+u>>1,y=a[2*v],x=a[2*v+1];y>=e&&y<=i&&x>=t&&x<=r&&c.push(s[v]),(0===d?e<=y:t<=x)&&(h.push(p),h.push(v-1),h.push(1-d)),(0===d?i>=y:r>=x)&&(h.push(v+1),h.push(u),h.push(1-d))}return c}within(e,t,i){if(!this._finished)throw Error("Data not yet indexed - call index.finish().");for(var{ids:r,coords:s,nodeSize:a}=this,o=[0,r.length-1,0],h=[],c=i*i;o.length;){var d=o.pop()||0,u=o.pop()||0,p=o.pop()||0;if(u-p<=a){for(var f=p;f<=u;f++)ar(s[2*f],s[2*f+1],e,t)<=c&&h.push(r[f]);continue}var m=p+u>>1,g=s[2*m],v=s[2*m+1];ar(g,v,e,t)<=c&&h.push(r[m]),(0===d?e-i<=g:t-i<=v)&&(o.push(p),o.push(m-1),o.push(1-d)),(0===d?e+i>=g:t+i>=v)&&(o.push(m+1),o.push(u),o.push(1-d))}return h}}function at(e,t,i,r){ai(e,i,r),ai(t,2*i,2*r),ai(t,2*i+1,2*r+1)}function ai(e,t,i){var r=e[t];e[t]=e[i],e[i]=r}function ar(e,t,i,r){var s=e-i,a=t-r;return s*s+a*a}var as={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:e=>e},aa=Math.fround||(s=new Float32Array(1),e=>(s[0]=+e,s[0]));class an{constructor(e){this.options=Object.assign(Object.create(as),e),this.trees=Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(e){var{log:t,minZoom:i,maxZoom:r}=this.options;t&&console.time("total time");var s="prepare ".concat(e.length," points");t&&console.time(s),this.points=e;for(var a=[],o=0;o<e.length;o++){var h=e[o];if(h.geometry){var[c,d]=h.geometry.coordinates,u=aa(ah(c)),p=aa(ac(d));a.push(u,p,1/0,o,-1,1),this.options.reduce&&a.push(0)}}var f=this.trees[r+1]=this._createTree(a);t&&console.timeEnd(s);for(var m=r;m>=i;m--){var g=+Date.now();f=this.trees[m]=this._createTree(this._cluster(f,m)),t&&console.log("z%d: %d clusters in %dms",m,f.numItems,Date.now()-g)}return t&&console.timeEnd("total time"),this}getClusters(e,t){var i=((e[0]+180)%360+360)%360-180,r=Math.max(-90,Math.min(90,e[1])),s=180===e[2]?180:((e[2]+180)%360+360)%360-180,a=Math.max(-90,Math.min(90,e[3]));if(e[2]-e[0]>=360)i=-180,s=180;else if(i>s){var o=this.getClusters([i,r,180,a],t),h=this.getClusters([-180,r,s,a],t);return o.concat(h)}var c=this.trees[this._limitZoom(t)],d=c.range(ah(i),ac(a),ah(s),ac(r)),u=c.data,p=[];for(var f of d){var m=this.stride*f;p.push(u[m+5]>1?ao(u,m,this.clusterProps):this.points[u[m+3]])}return p}getChildren(e){var t=this._getOriginId(e),i=this._getOriginZoom(e),r="No cluster with the specified id.",s=this.trees[i];if(!s)throw Error(r);var a=s.data;if(t*this.stride>=a.length)throw Error(r);var o=this.options.radius/(this.options.extent*Math.pow(2,i-1)),h=a[t*this.stride],c=a[t*this.stride+1],d=s.within(h,c,o),u=[];for(var p of d){var f=p*this.stride;a[f+4]===e&&u.push(a[f+5]>1?ao(a,f,this.clusterProps):this.points[a[f+3]])}if(0===u.length)throw Error(r);return u}getLeaves(e,t,i){t=t||10,i=i||0;var r=[];return this._appendLeaves(r,e,t,i,0),r}getTile(e,t,i){var r=this.trees[this._limitZoom(e)],s=Math.pow(2,e),{extent:a,radius:o}=this.options,h=o/a,c=(i-h)/s,d=(i+1+h)/s,u={features:[]};
8198return this._addTileFeatures(r.range((t-h)/s,c,(t+1+h)/s,d),r.data,t,i,s,u),0===t&&this._addTileFeatures(r.range(1-h/s,c,1,d),r.data,s,i,s,u),t===s-1&&this._addTileFeatures(r.range(0,c,h/s,d),r.data,-1,i,s,u),u.features.length?u:null}getClusterExpansionZoom(e){for(var t=this._getOriginZoom(e)-1;t<=this.options.maxZoom;){var i=this.getChildren(e);if(t++,1!==i.length)break;e=i[0].properties.cluster_id}return t}_appendLeaves(e,t,i,r,s){for(var a of this.getChildren(t)){var o=a.properties;if(o&&o.cluster?s+o.point_count<=r?s+=o.point_count:s=this._appendLeaves(e,o.cluster_id,i,r,s):s<r?s++:e.push(a),e.length===i)break}return s}_createTree(e){for(var t=new ae(e.length/this.stride|0,this.options.nodeSize,Float32Array),i=0;i<e.length;i+=this.stride)t.add(e[i],e[i+1]);return t.finish(),t.data=e,t}_addTileFeatures(e,t,i,r,s,a){for(var o of e){var h=o*this.stride,c=t[h+5]>1,d=void 0,u=void 0,p=void 0;if(c)d=al(t,h,this.clusterProps),u=t[h],p=t[h+1];else{var f=this.points[t[h+3]];d=f.properties;var[m,g]=f.geometry.coordinates;u=ah(m),p=ac(g)}var v={type:1,geometry:[[Math.round(this.options.extent*(u*s-i)),Math.round(this.options.extent*(p*s-r))]],tags:d},y=void 0;void 0!==(y=c||this.options.generateId?t[h+3]:this.points[t[h+3]].id)&&(v.id=y),a.features.push(v)}}_limitZoom(e){return Math.max(this.options.minZoom,Math.min(Math.floor(+e),this.options.maxZoom+1))}_cluster(e,t){for(var{radius:i,extent:r,reduce:s,minPoints:a}=this.options,o=i/(r*Math.pow(2,t)),h=e.data,c=[],d=this.stride,u=0;u<h.length;u+=d)if(!(h[u+2]<=t)){h[u+2]=t;
8198var p=h[u],f=h[u+1],m=e.within(h[u],h[u+1],o),g=h[u+5],v=g;for(var y of m){var x=y*d;h[x+2]>t&&(v+=h[x+5])}if(v>g&&v>=a){var b=p*g,w=f*g,_=void 0,S=-1,C=(u/d<<5)+(t+1)+this.points.length;for(var M of m){var E=M*d;if(!(h[E+2]<=t)){h[E+2]=t;var A=h[E+5];b+=h[E]*A,w+=h[E+1]*A,h[E+4]=C,s&&(_||(_=this._map(h,u,!0),S=this.clusterProps.length,this.clusterProps.push(_)),s(_,this._map(h,E)))}}h[u+4]=C,c.push(b/v,w/v,1/0,C,-1,v),s&&c.push(S)}else{for(var T=0;T<d;T++)c.push(h[u+T]);if(v>1)for(var P of m){var D=P*d;if(!(h[D+2]<=t)){h[D+2]=t;for(var O=0;O<d;O++)c.push(h[D+O])}}}}return c}_getOriginId(e){return e-this.points.length>>5}_getOriginZoom(e){return(e-this.points.length)%32}_map(e,t,i){if(e[t+5]>1){var r=this.clusterProps[e[t+6]];return i?Object.assign({},r):r}var s=this.points[e[t+3]].properties,a=this.options.map(s);return i&&a===s?Object.assign({},a):a}}function ao(e,t,i){return{type:"Feature",id:e[t+3],properties:al(e,t,i),geometry:{type:"Point",coordinates:[(e[t]-.5)*360,360*Math.atan(Math.exp((180-360*e[t+1])*Math.PI/180))/Math.PI-90]}}}function al(e,t,i){var r=e[t+5],s=r>=1e4?"".concat(Math.round(r/1e3),"k"):r>=1e3?"".concat(Math.round(r/100)/10,"k"):r,a=e[t+6];return Object.assign(-1===a?{}:Object.assign({},i[a]),{cluster:!0,cluster_id:e[t+3],point_count:r,point_count_abbreviated:s})}function ah(e){return e/360+.5}function ac(e){var t=Math.sin(e*Math.PI/180),i=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return i<0?0:i>1?1:i}function ad(e,t){var i={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(i[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var s=0,r=Object.getOwnPropertySymbols(e);s<r.length;s++)0>t.indexOf(r[s])&&Object.prototype.propertyIsEnumerable.call(e,r[s])&&(i[r[s]]=e[r[s]]);return i}class au{static isAdvancedMarkerAvailable(e){return google.maps.marker&&!0===e.getMapCapabilities().isAdvancedMarkersAvailable}static isAdvancedMarker(e){return google.maps.marker&&e instanceof google.maps.marker.AdvancedMarkerElement}static setMap(e,t){this.isAdvancedMarker(e)?e.map=t:e.setMap(t)}static getPosition(e){if(this.isAdvancedMarker(e)){if(e.position){if(e.position instanceof google.maps.LatLng)return e.position;if(e.position.lat&&e.position.lng)return new google.maps.LatLng(e.position.lat,e.position.lng)}return new google.maps.LatLng(null)}return e.getPosition()}static getVisible(e){return!!this.isAdvancedMarker(e)||e.getVisible()}}class ap{constructor(e){var{markers:t,position:i}=e;this.markers=t,i&&(i instanceof google.maps.LatLng?this._position=i:this._position=new google.maps.LatLng(i))}get bounds(){if(0!==this.markers.length||this._position){var e=new google.maps.LatLngBounds(this._position,this._position);for(var t of this.markers)e.extend(au.getPosition(t));return e}}get position(){return this._position||this.bounds.getCenter()}get count(){return this.markers.filter(e=>au.getVisible(e)).length}push(e){this.markers.push(e)}delete(){this.marker&&(au.setMap(this.marker,null),this.marker=void 0),this.markers.length=0}}class af{constructor(e){var{maxZoom:t=16}=e;this.maxZoom=t}noop(e){var{markers:t}=e;return am(t)}}var am=e=>e.map(e=>new ap({position:au.getPosition(e),markers:[e]}));class ag extends af{constructor(e){var{maxZoom:t,radius:i=60}=e,r=ad(e,["maxZoom","radius"]);super({maxZoom:t}),this.state={zoom:-1},this.superCluster=new an(Object.assign({maxZoom:this.maxZoom,radius:i},r))}calculate(e){var t=!1,i={zoom:e.map.getZoom()};if(!s9(e.markers,this.markers)){t=!0,this.markers=[...e.markers];var r=this.markers.map(e=>{var t=au.getPosition(e);return{type:"Feature",geometry:{type:"Point",coordinates:[t.lng(),t.lat()]},properties:{marker:e}}});this.superCluster.load(r)}return!t&&(this.state.zoom<=this.maxZoom||i.zoom<=this.maxZoom)&&(t=!s9(this.state,i)),this.state=i,t&&(this.cluster
8198s=this.cluster(e)),{clusters:this.clusters,changed:t}}cluster(e){var{map:t}=e;return this.superCluster.getClusters([-180,-90,180,90],Math.round(t.getZoom())).map(e=>this.transformCluster(e))}transformCluster(e){var{geometry:{coordinates:[t,i]},properties:r}=e;if(r.cluster)return new ap({markers:this.superCluster.getLeaves(r.cluster_id,1/0).map(e=>e.properties.marker),position:{lat:i,lng:t}});var s=r.marker;return new ap({markers:[s],position:au.getPosition(s)})}}class av{constructor(e,t){this.markers={sum:e.length};var i=t.map(e=>e.count),r=i.reduce((e,t)=>e+t,0);this.clusters={count:t.length,markers:{mean:r/t.length,sum:r,min:Math.min(...i),max:Math.max(...i)}}}}class ay{render(e,t,i){var{count:r,position:s}=e,a=r>Math.max(10,t.clusters.markers.mean)?"#ff0000":"#0000ff",o='<svg fill="'.concat(a,'" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 240 240" width="50" height="50">\n<circle cx="120" cy="120" opacity=".6" r="70" />\n<circle cx="120" cy="120" opacity=".3" r="90" />\n<circle cx="120" cy="120" opacity=".2" r="110" />\n<text x="50%" y="50%" style="fill:#fff" text-anchor="middle" font-size="50" dominant-baseline="middle" font-family="roboto,arial,sans-serif">').concat(r,"</text>\n</svg>"),h="Cluster of ".concat(r," markers"),c=Number(google.maps.Marker.MAX_ZINDEX)+r;if(au.isAdvancedMarkerAvailable(i)){var d=new DOMParser().parseFromString(o,"image/svg+xml").documentElement;return d.setAttribute("transform","translate(0 25)"),new google.maps.marker.AdvancedMarkerElement({map:i,position:s,zIndex:c,title:h,content:d})}var u={position:s,zIndex:c,title:h,icon:{url:"data:image/svg+xml;base64,".concat(btoa(o)),anchor:new google.maps.Point(25,25)}};return new google.maps.Marker(u)}}class ax{constructor(){!function(e,t){for(var i in t.prototype)e.prototype[i]=t.prototype[i]}(ax,google.maps.OverlayView)}}(C=O||(O={})).CLUSTERING_BEGIN="clusteringbegin",C.CLUSTERING_END="clusteringend",C.CLUSTER_CLICK="click";var ab=(e,t,i)=>{i.fitBounds(t.bounds)};class aw extends ax{constructor(e){var{map:t,markers:i=[],algorithmOptions:r={},algorithm:s=new ag(r),renderer:a=new ay,onClusterClick:o=ab}=e;super(),this.markers=[...i],this.clusters=[],this.algorithm=s,this.renderer=a,this.onClusterClick=o,t&&this.setMap(t)}addMarker(e,t){!this.markers.includes(e)&&(this.markers.push(e),t||this.render())}addMarkers(e,t){e.forEach(e=>{this.addMarker(e,!0)}),t||this.render()}removeMarker(e,t){var i=this.markers.indexOf(e);return -1!==i&&(au.setMap(e,null),this.markers.splice(i,1),t||this.render(),!0)}removeMarkers(e,t){var i=!1;return e.forEach(e=>{i=this.removeMarker(e,!0)||i}),i&&!t&&this.render(),i}clearMarkers(e){this.markers.length=0,e||this.render()}render(){var e=this.getMap();if(e instanceof google.maps.Map&&e.getProjection()){google.maps.event.trigger(this,O.CLUSTERING_BEGIN,this);var{clusters:t,changed:i}=this.algorithm.calculate({markers:this.markers,map:e,mapCanvasProjection:this.getProjection()});if(i||void 0==i){var r=new Set;for(var s of t)1==s.markers.length&&r.add(s.markers[0]);var a=[];for(var o of this.clusters)null!=o.marker&&(1==o.markers.length?r.has(o.marker)||au.setMap(o.marker,null):a.push(o.marker));this.clusters=t,this.renderClusters(),requestAnimationFrame(()=>a.forEach(e=>au.setMap(e,null)))}google.maps.event.trigger(this,O.CLUSTERING_END,this)}}onAdd(){this.idleListener=this.getMap().addListener("idle",this.render.bind(this)),this.render()}onRemove(){google.maps.event.removeListener(this.idleListener),this.reset()}reset(){this.markers.forEach(e=>au.setMap(e,null)),this.clusters.forEach(e=>e.delete()),this.clusters=[]}renderClusters(){var e=new av(this.markers,this.clusters),t=this.getMap();this.clusters.forEach(i=>{1===i.markers.length?i.marker=i.markers[0]:(i.marker=this.renderer.render(i,e,t),i.markers.forEach(e=>au.setMap(e,null)),this.onClusterClick&&i.marker.addListener("click",e=>{google.maps.event.trigger(this,O.CLUSTER_CLICK,i),this.onClusterClick(e,i,t)})),au.setMap(i.marker,t)})}}function a_(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,r)}return i}function aS(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};
8198t%2?a_(Object(i),!0).forEach(function(t){si(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):a_(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}(0,r7.memo)(function(e){var{children:t,options:i}=e,r=function(e){var t,i=(ss(!!r7.useContext,"useGoogleMap is React hook and requires React version 16.8+"),ss(!!(t=(0,r7.useContext)(sa)),"useGoogleMap needs a GoogleMap available up in the tree"),t),[r,s]=(0,r7.useState)(null);return(0,r7.useEffect)(()=>{i&&null===r&&s(new aw(aS(aS({},e),{},{map:i})))},[i]),r}(i);return null!==r?t(r):null});var aC={onCloseClick:"closeclick",onContentChanged:"content_changed",onDomReady:"domready",onPositionChanged:"position_changed",onZindexChanged:"zindex_changed"},aM={options(e,t){e.setOptions(t)},position(e,t){e.setPosition(t)},zIndex(e,t){e.setZIndex(t)}};(0,r7.memo)(function(e){var{children:t,anchor:i,options:r,position:s,zIndex:a,onCloseClick:o,onDomReady:h,onContentChanged:c,onPositionChanged:d,onZindexChanged:u,onLoad:p,onUnmount:f}=e,m=(0,r7.useContext)(sa),[g,v]=(0,r7.useState)(null),[y,x]=(0,r7.useState)(null),[b,w]=(0,r7.useState)(null),[_,S]=(0,r7.useState)(null),[C,M]=(0,r7.useState)(null),[E,A]=(0,r7.useState)(null),T=(0,r7.useRef)(null);return(0,r7.useEffect)(()=>{null!==g&&(g.close(),i?g.open(m,i):g.getPosition()&&g.open(m))},[m,g,i]),(0,r7.useEffect)(()=>{r&&null!==g&&g.setOptions(r)},[g,r]),(0,r7.useEffect)(()=>{s&&null!==g&&g.setPosition(s)},[s]),(0,r7.useEffect)(()=>{"number"==typeof a&&null!==g&&g.setZIndex(a)},[a]),(0,r7.useEffect)(()=>{g&&o&&(null!==y&&google.maps.event.removeListener(y),x(google.maps.event.addListener(g,"closeclick",o)))},[o]),(0,r7.useEffect)(()=>{g&&h&&(null!==b&&google.maps.event.removeListener(b),w(google.maps.event.addListener(g,"domready",h)))},[h]),(0,r7.useEffect)(()=>{g&&c&&(null!==_&&google.maps.event.removeListener(_),S(google.maps.event.addListener(g,"content_changed",c)))},[c]),(0,r7.useEffect)(()=>{g&&d&&(null!==C&&google.maps.event.removeListener(C),M(google.maps.event.addListener(g,"position_changed",d)))},[d]),(0,r7.useEffect)(()=>{g&&u&&(null!==E&&google.maps.event.removeListener(E),A(google.maps.event.addListener(g,"zindex_changed",u)))},[u]),(0,r7.useEffect)(()=>{var e=new google.maps.InfoWindow(r);return v(e),T.current=document.createElement("div"),o&&x(google.maps.event.addListener(e,"closeclick",o)),h&&w(google.maps.event.addListener(e,"domready",h)),c&&S(google.maps.event.addListener(e,"content_changed",c)),d&&M(google.maps.event.addListener(e,"position_changed",d)),u&&A(google.maps.event.addListener(e,"zindex_changed",u)),e.setContent(T.current),s&&e.setPosition(s),a&&e.setZIndex(a),i?e.open(m,i):e.getPosition()?e.open(m):ss(!1,"You must provide either an anchor (typically render it inside a <Marker>) or a position props for <InfoWindow>."),p&&p(e),()=>{y&&google.maps.event.removeListener(y),_&&google.maps.event.removeListener(_),b&&google.maps.event.removeListener(b),C&&google.maps.event.removeListener(C),E&&google.maps.event.removeListener(E),f&&f(e),e.close()}},[]),T.current?(0,se.createPortal)(r7.Children.only(t),T.current):null});class aE extends r7.PureComponent{constructor(){super(...arguments),si(this,"registeredEvents",[]),si(this,"containerElement",null),si(this,"state",{infoWindow:null}),si(this,"open",(e,t)=>{t?e.open(this.context,t):e.getPosition()?e.open(this.context):ss(!1,"You must provide either an anchor (typically render it inside a <Marker>) or a position props for <InfoWindow>.")}),si(this,"setInfoWindowCallback",()=>{null!==this.state.infoWindow&&null!==this.containerElement&&(this.state.infoWindow.setContent(this.containerElement),this.open(this.state.infoWindow,this.props.anchor),this.props.onLoad&&this.props.onLoad(this.state.infoWindow))})}componentDidMount(){var e=new google.maps.InfoWindow(this.props.options);this.containerElement=document.createElement("div"),this.registeredEvents=sl({updaterMap:aM,eventMap:aC,prevProps:{},nextProps:this.props,instance:e}),this.setState(()=>({infoWindow:e}),this.setInfoWindowCallback)}componentDidUpdate(e){null!==this.state.infoWindow&&(so(this.registeredEvents),this.registeredEvents=sl({updaterMap:aM,eventMap:aC,prevProps:e,nextProps:this.props,instance:this.state.infoWindow}))}componentWillUnmount(){null!==this.state.infoWindow&&(so(this.registeredEvents),this.props.onUnmount&&this.props.onUnmount(this.state.infoWindow),this.state.infoWindow.close())}render(){return this.containerElement?(0,se.createPortal)(r7.Children.only(this.props.children),this.containerElement):null}}function aA(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,r)}return i}function aT(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};
8198t%2?aA(Object(i),!0).forEach(function(t){si(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):aA(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}si(aE,"contextType",sa);var aP={onClick:"click",onDblClick:"dblclick",onDrag:"drag",onDragEnd:"dragend",onDragStart:"dragstart",onMouseDown:"mousedown",onMouseMove:"mousemove",onMouseOut:"mouseout",onMouseOver:"mouseover",onMouseUp:"mouseup",onRightClick:"rightclick"},aD={draggable(e,t){e.setDraggable(t)},editable(e,t){e.setEditable(t)},map(e,t){e.setMap(t)},options(e,t){e.setOptions(t)},path(e,t){e.setPath(t)},visible(e,t){e.setVisible(t)}},aO={};(0,r7.memo)(function(e){var{options:t,draggable:i,editable:r,visible:s,path:a,onDblClick:o,onDragEnd:h,onDragStart:c,onMouseDown:d,onMouseMove:u,onMouseOut:p,onMouseOver:f,onMouseUp:m,onRightClick:g,onClick:v,onDrag:y,onLoad:x,onUnmount:b}=e,w=(0,r7.useContext)(sa),[_,S]=(0,r7.useState)(null),[C,M]=(0,r7.useState)(null),[E,A]=(0,r7.useState)(null),[T,P]=(0,r7.useState)(null),[D,O]=(0,r7.useState)(null),[L,I]=(0,r7.useState)(null),[R,k]=(0,r7.useState)(null),[B,z]=(0,r7.useState)(null),[N,F]=(0,r7.useState)(null),[j,U]=(0,r7.useState)(null),[V,W]=(0,r7.useState)(null),[H,G]=(0,r7.useState)(null);return(0,r7.useEffect)(()=>{null!==_&&_.setMap(w)},[w]),(0,r7.useEffect)(()=>{void 0!==t&&null!==_&&_.setOptions(t)},[_,t]),(0,r7.useEffect)(()=>{void 0!==i&&null!==_&&_.setDraggable(i)},[_,i]),(0,r7.useEffect)(()=>{void 0!==r&&null!==_&&_.setEditable(r)},[_,r]),(0,r7.useEffect)(()=>{void 0!==s&&null!==_&&_.setVisible(s)},[_,s]),(0,r7.useEffect)(()=>{void 0!==a&&null!==_&&_.setPath(a)},[_,a]),(0,r7.useEffect)(()=>{_&&o&&(null!==C&&google.maps.event.removeListener(C),M(google.maps.event.addListener(_,"dblclick",o)))},[o]),(0,r7.useEffect)(()=>{_&&h&&(null!==E&&google.maps.event.removeListener(E),A(google.maps.event.addListener(_,"dragend",h)))},[h]),(0,r7.useEffect)(()=>{_&&c&&(null!==T&&google.maps.event.removeListener(T),P(google.maps.event.addListener(_,"dragstart",c)))},[c]),(0,r7.useEffect)(()=>{_&&d&&(null!==D&&google.maps.event.removeListener(D),O(google.maps.event.addListener(_,"mousedown",d)))},[d]),(0,r7.useEffect)(()=>{_&&u&&(null!==L&&google.maps.event.removeListener(L),I(google.maps.event.addListener(_,"mousemove",u)))},[u]),(0,r7.useEffect)(()=>{_&&p&&(null!==R&&google.maps.event.removeListener(R),k(google.maps.event.addListener(_,"mouseout",p)))},[p]),(0,r7.useEffect)(()=>{_&&f&&(null!==B&&google.maps.event.removeListener(B),z(google.maps.event.addListener(_,"mouseover",f)))},[f]),(0,r7.useEffect)(()=>{_&&m&&(null!==N&&google.maps.event.removeListener(N),F(google.maps.event.addListener(_,"mouseup",m)))},[m]),(0,r7.useEffect)(()=>{_&&g&&(null!==j&&google.maps.event.removeListener(j),U(google.maps.event.addListener(_,"rightclick",g)))},[g]),(0,r7.useEffect)(()=>{_&&v&&(null!==V&&google.maps.event.removeListener(V),W(google.maps.event.addListener(_,"click",v)))},[v]),(0,r7.useEffect)(()=>{_&&y&&(null!==H&&google.maps.event.removeListener(H),G(google.maps.event.addListener(_,"drag",y)))},[y]),(0,r7.useEffect)(()=>{var e=new google.maps.Polyline(aT(aT({},t||aO),{},{map:w}));return a&&e.setPath(a),void 0!==s&&e.setVisible(s),void 0!==r&&e.setEditable(r),void 0!==i&&e.setDraggable(i),o&&M(google.maps.event.addListener(e,"dblclick",o)),h&&A(google.maps.event.addListener(e,"dragend",h)),c&&P(google.maps.event.addListener(e,"dragstart",c)),d&&O(google.maps.event.addListener(e,"mousedown",d)),u&&I(google.maps.event.addListener(e,"mousemove",u)),p&&k(google.maps.event.addListener(e,"mouseout",p)),f&&z(google.maps.event.addListener(e,"mouseover",f)),m&&F(google.maps.event.addListener(e,"mouseup",m)),g&&U(google.maps.event.addListener(e,"rightclick",g)),v&&W(google.maps.event.addListener(e,"click",v)),y&&G(google.maps.event.addListener(e,"drag",y)),S(e),x&&x(e),()=>{null!==C&&google.maps.event.removeListener(C),null!==E&&google.maps.event.removeListener(E),null!==T&&google.maps.event.removeListener(T),null!==D&&google.maps.event.removeListener(
8198D),null!==L&&google.maps.event.removeListener(L),null!==R&&google.maps.event.removeListener(R),null!==B&&google.maps.event.removeListener(B),null!==N&&google.maps.event.removeListener(N),null!==j&&google.maps.event.removeListener(j),null!==V&&google.maps.event.removeListener(V),b&&b(e),e.setMap(null)}},[]),null});class aL extends r7.PureComponent{constructor(){super(...arguments),si(this,"registeredEvents",[]),si(this,"state",{polyline:null}),si(this,"setPolylineCallback",()=>{null!==this.state.polyline&&this.props.onLoad&&this.props.onLoad(this.state.polyline)})}componentDidMount(){var e=new google.maps.Polyline(aT(aT({},this.props.options),{},{map:this.context}));this.registeredEvents=sl({updaterMap:aD,eventMap:aP,prevProps:{},nextProps:this.props,instance:e}),this.setState(function(){return{polyline:e}},this.setPolylineCallback)}componentDidUpdate(e){null!==this.state.polyline&&(so(this.registeredEvents),this.registeredEvents=sl({updaterMap:aD,eventMap:aP,prevProps:e,nextProps:this.props,instance:this.state.polyline}))}componentWillUnmount(){null!==this.state.polyline&&(this.props.onUnmount&&this.props.onUnmount(this.state.polyline),so(this.registeredEvents),this.state.polyline.setMap(null))}render(){return null}}function aI(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,r)}return i}function aR(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?aI(Object(i),!0).forEach(function(t){si(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):aI(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}si(aL,"contextType",sa);var ak={onClick:"click",onDblClick:"dblclick",onDrag:"drag",onDragEnd:"dragend",onDragStart:"dragstart",onMouseDown:"mousedown",onMouseMove:"mousemove",onMouseOut:"mouseout",onMouseOver:"mouseover",onMouseUp:"mouseup",onRightClick:"rightclick"},aB={draggable(e,t){e.setDraggable(t)},editable(e,t){e.setEditable(t)},map(e,t){e.setMap(t)},options(e,t){e.setOptions(t)},path(e,t){e.setPath(t)},paths(e,t){e.setPaths(t)},visible(e,t){e.setVisible(t)}};(0,r7.memo)(function(e){var{options:t,draggable:i,editable:r,visible:s,path:a,paths:o,onDblClick:h,onDragEnd:c,onDragStart:d,onMouseDown:u,onMouseMove:p,onMouseOut:f,onMouseOver:m,onMouseUp:g,onRightClick:v,onClick:y,onDrag:x,onLoad:b,onUnmount:w,onEdit:_}=e,S=(0,r7.useContext)(sa),[C,M]=(0,r7.useState)(null),[E,A]=(0,r7.useState)(null),[T,P]=(0,r7.useState)(null),[D,O]=(0,r7.useState)(null),[L,I]=(0,r7.useState)(null),[R,k]=(0,r7.useState)(null),[B,z]=(0,r7.useState)(null),[N,F]=(0,r7.useState)(null),[j,U]=(0,r7.useState)(null),[V,W]=(0,r7.useState)(null),[H,G]=(0,r7.useState)(null),[q,X]=(0,r7.useState)(null);return(0,r7.useEffect)(()=>{null!==C&&C.setMap(S)},[S]),(0,r7.useEffect)(()=>{void 0!==t&&null!==C&&C.setOptions(t)},[C,t]),(0,r7.useEffect)(()=>{void 0!==i&&null!==C&&C.setDraggable(i)},[C,i]),(0,r7.useEffect)(()=>{void 0!==r&&null!==C&&C.setEditable(r)},[C,r]),(0,r7.useEffect)(()=>{void 0!==s&&null!==C&&C.setVisible(s)},[C,s]),(0,r7.useEffect)(()=>{void 0!==a&&null!==C&&C.setPath(a)},[C,a]),(0,r7.useEffect)(()=>{void 0!==o&&null!==C&&C.setPaths(o)},[C,o]),(0,r7.useEffect)(()=>{C&&"function"==typeof h&&(null!==E&&google.maps.event.removeListener(E),A(google.maps.event.addListener(C,"dblclick",h)))},[h]),(0,r7.useEffect)(()=>{C&&(google.maps.event.addListener(C.getPath(),"insert_at",()=>{null==_||_(C)}),google.maps.event.addListener(C.getPath(),"set_at",()=>{null==_||_(C)}),google.maps.event.addListener(C.getPath(),"remove_at",()=>{null==_||_(C)}))},[C,_]),(0,r7.useEffect)(()=>{C&&"function"==typeof c&&(null!==T&&google.maps.event.removeListener(T),P(google.maps.event.addListener(C,"dragend",c)))},[c]),(0,r7.useEffect)(()=>{C&&"function"==typeof d&&(null!==D&&google.maps.event.removeListener(D),O(google.maps.event.addListener(C,"dragstart",d)))},[d]),(0,r7.useEffect)(()=>{C&&"function"==typeof u&&(null!==L&&google.maps.event.removeListener(L),I(google.maps.event.addListener(C,"mousedown",u)))},[u]),(0,r7.useEffect)(()=>{C&&"function"==typeof p&&(null!==R&&google.maps.event.removeListener(R),k(google.maps.event.addListener(C,"mousemove",p)))}
8198,[p]),(0,r7.useEffect)(()=>{C&&"function"==typeof f&&(null!==B&&google.maps.event.removeListener(B),z(google.maps.event.addListener(C,"mouseout",f)))},[f]),(0,r7.useEffect)(()=>{C&&"function"==typeof m&&(null!==N&&google.maps.event.removeListener(N),F(google.maps.event.addListener(C,"mouseover",m)))},[m]),(0,r7.useEffect)(()=>{C&&"function"==typeof g&&(null!==j&&google.maps.event.removeListener(j),U(google.maps.event.addListener(C,"mouseup",g)))},[g]),(0,r7.useEffect)(()=>{C&&"function"==typeof v&&(null!==V&&google.maps.event.removeListener(V),W(google.maps.event.addListener(C,"rightclick",v)))},[v]),(0,r7.useEffect)(()=>{C&&"function"==typeof y&&(null!==H&&google.maps.event.removeListener(H),G(google.maps.event.addListener(C,"click",y)))},[y]),(0,r7.useEffect)(()=>{C&&"function"==typeof x&&(null!==q&&google.maps.event.removeListener(q),X(google.maps.event.addListener(C,"drag",x)))},[x]),(0,r7.useEffect)(()=>{var e=new google.maps.Polygon(aR(aR({},t),{},{map:S}));return a&&e.setPath(a),o&&e.setPaths(o),void 0!==s&&e.setVisible(s),void 0!==r&&e.setEditable(r),void 0!==i&&e.setDraggable(i),h&&A(google.maps.event.addListener(e,"dblclick",h)),c&&P(google.maps.event.addListener(e,"dragend",c)),d&&O(google.maps.event.addListener(e,"dragstart",d)),u&&I(google.maps.event.addListener(e,"mousedown",u)),p&&k(google.maps.event.addListener(e,"mousemove",p)),f&&z(google.maps.event.addListener(e,"mouseout",f)),m&&F(google.maps.event.addListener(e,"mouseover",m)),g&&U(google.maps.event.addListener(e,"mouseup",g)),v&&W(google.maps.event.addListener(e,"rightclick",v)),y&&G(google.maps.event.addListener(e,"click",y)),x&&X(google.maps.event.addListener(e,"drag",x)),M(e),b&&b(e),()=>{null!==E&&google.maps.event.removeListener(E),null!==T&&google.maps.event.removeListener(T),null!==D&&google.maps.event.removeListener(D),null!==L&&google.maps.event.removeListener(L),null!==R&&google.maps.event.removeListener(R),null!==B&&google.maps.event.removeListener(B),null!==N&&google.maps.event.removeListener(N),null!==j&&google.maps.event.removeListener(j),null!==V&&google.maps.event.removeListener(V),null!==H&&google.maps.event.removeListener(H),w&&w(e),e.setMap(null)}},[]),null});class az extends r7.PureComponent{constructor(){super(...arguments),si(this,"registeredEvents",[])}componentDidMount(){var e=this.props.options||{};this.polygon=new google.maps.Polygon(e),this.polygon.setMap(this.context),this.registeredEvents=sl({updaterMap:aB,eventMap:ak,prevProps:{},nextProps:this.props,instance:this.polygon}),this.props.onLoad&&this.props.onLoad(this.polygon)}componentDidUpdate(e){this.polygon&&(so(this.registeredEvents),this.registeredEvents=sl({updaterMap:aB,eventMap:ak,prevProps:e,nextProps:this.props,instance:this.polygon}))}componentWillUnmount(){this.polygon&&(this.props.onUnmount&&this.props.onUnmount(this.polygon),so(this.registeredEvents),this.polygon&&this.polygon.setMap(null))}render(){return null}}function aN(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,r)}return i}function aF(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?aN(Object(i),!0).forEach(function(t){si(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):aN(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}si(az,"contextType",sa);var aj={onBoundsChanged:"bounds_changed",onClick:"click",onDblClick:"dblclick",onDrag:"drag",onDragEnd:"dragend",onDragStart:"dragstart",onMouseDown:"mousedown",onMouseMove:"mousemove",onMouseOut:"mouseout",onMouseOver:"mouseover",onMouseUp:"mouseup",onRightClick:"rightclick"},aU={bounds(e,t){e.setBounds(t)},draggable(e,t){e.setDraggable(t)},editable(e,t){e.setEditable(t)},map(e,t){e.setMap(t)},options(e,t){e.setOptions(t)},visible(e,t){e.setVisible(t)}};(0,r7.memo)(function(e){var{options:t,bounds:i,draggable:r,editable:s,visible:a,onDblClick:o,onDragEnd:h,onDragStart:c,onMouseDown:d,onMouseMove:u,onMouseOut:p,onMouseOver:f,onMouseUp:m,onRightClick:g,onClick:v,onDrag:y,onBoundsChanged:x,onLoad:b,onUnmount:w}=e,_=(0,r7.useContext)(sa),[S,C]=(0,r7.useState)(null),[M,E]=(0,r7.useState)(null),[A,T]=(0,r7.useState)(null),[P,D]=(0,r7.useState)(null),[O,L]=(0,r7.useState)(null),[I,R]=(0,r7.useState)(null),[k,B]=(0,r7.useState)(null),[z,N]=(0,r7.useState)(null),[F,j]=(0,r7.useState)(null),[U,V]=(0,r7.useState)(null),[W,H]=(0,r7.useState)(null),[G,q]=(0,r7.useState)(null),[X,Y]=(0,r7.useState)(null);return(0,r7.useEffect)(()=>{null!==S&&S.setMap(_)},[_]),(0,r7.useEffect)(()=>{void 0!==t&&null!==S&&S.setOptions(t)},[S,t]),(0,r7.useEffect)(()=>{void 0!==r&&null!==S&&S.setDraggable(r)},[S,r]),(0,r7.useEffect)(()=>{void 0!==s&&null!==S&&S.setEditable(s)},[S,s]),(0,r7.useEffect)(()=>{void 0!==a&&null!==S&&S.setVisible(a)},[S,a]),(0,r7.useEffect)(()=>{void 0!==i&&null!==S&&S.setBounds(i)},[S,i]),(0,r7.useEffect)(()=>{S&&o&&(null!==M&&google.maps.event.removeListener(M),E(google.maps.event.addListener(S,"dblclick",o)))},[o]),(0,r7.useEffect)(()=>{S&&h&&(null!==A&&google.maps.event.removeListener(A),T(google.maps.event.addListener(S,"dragend",h)))},[h]),(0,r7.useEffect)(()=>{S&&c&&(null!==P&&google.maps.event.removeListener(P),D(google.maps.event.addListener(S,"dragstart",c)))},[c]),(0,r7.useEffect)(()=>{S&&d&&(null!==O&&google.maps.event.removeListener(O),L(google.maps.event.addListener(S,"mousedown",d)))},[d]),(0,r7.useEffect)(()=>{S&&u&&(null!==I&&google.maps.event.removeListener(I),R(google.maps.event.addListener(S,"mousemove",u)))},[u]),(0,r7.useEffect)(()=>{S&&p&&(null!==k&&google.maps.event.removeListener(k),B(google.maps.event.addListener(S,"mouseout",p)))}
8198,[p]),(0,r7.useEffect)(()=>{S&&f&&(null!==z&&google.maps.event.removeListener(z),N(google.maps.event.addListener(S,"mouseover",f)))},[f]),(0,r7.useEffect)(()=>{S&&m&&(null!==F&&google.maps.event.removeListener(F),j(google.maps.event.addListener(S,"mouseup",m)))},[m]),(0,r7.useEffect)(()=>{S&&g&&(null!==U&&google.maps.event.removeListener(U),V(google.maps.event.addListener(S,"rightclick",g)))},[g]),(0,r7.useEffect)(()=>{S&&v&&(null!==W&&google.maps.event.removeListener(W),H(google.maps.event.addListener(S,"click",v)))},[v]),(0,r7.useEffect)(()=>{S&&y&&(null!==G&&google.maps.event.removeListener(G),q(google.maps.event.addListener(S,"drag",y)))},[y]),(0,r7.useEffect)(()=>{S&&x&&(null!==X&&google.maps.event.removeListener(X),Y(google.maps.event.addListener(S,"bounds_changed",x)))},[x]),(0,r7.useEffect)(()=>{var e=new google.maps.Rectangle(aF(aF({},t),{},{map:_}));return void 0!==a&&e.setVisible(a),void 0!==s&&e.setEditable(s),void 0!==r&&e.setDraggable(r),void 0!==i&&e.setBounds(i),o&&E(google.maps.event.addListener(e,"dblclick",o)),h&&T(google.maps.event.addListener(e,"dragend",h)),c&&D(google.maps.event.addListener(e,"dragstart",c)),d&&L(google.maps.event.addListener(e,"mousedown",d)),u&&R(google.maps.event.addListener(e,"mousemove",u)),p&&B(google.maps.event.addListener(e,"mouseout",p)),f&&N(google.maps.event.addListener(e,"mouseover",f)),m&&j(google.maps.event.addListener(e,"mouseup",m)),g&&V(google.maps.event.addListener(e,"rightclick",g)),v&&H(google.maps.event.addListener(e,"click",v)),y&&q(google.maps.event.addListener(e,"drag",y)),x&&Y(google.maps.event.addListener(e,"bounds_changed",x)),C(e),b&&b(e),()=>{null!==M&&google.maps.event.removeListener(M),null!==A&&google.maps.event.removeListener(A),null!==P&&google.maps.event.removeListener(P),null!==O&&google.maps.event.removeListener(O),null!==I&&google.maps.event.removeListener(I),null!==k&&google.maps.event.removeListener(k),null!==z&&google.maps.event.removeListener(z),null!==F&&google.maps.event.removeListener(F),null!==U&&google.maps.event.removeListener(U),null!==W&&google.maps.event.removeListener(W),null!==G&&google.maps.event.removeListener(G),null!==X&&google.maps.event.removeListener(X),w&&w(e),e.setMap(null)}},[]),null});class aV extends r7.PureComponent{constructor(){super(...arguments),si(this,"registeredEvents",[]),si(this,"state",{rectangle:null}),si(this,"setRectangleCallback",()=>{null!==this.state.rectangle&&this.props.onLoad&&this.props.onLoad(this.state.rectangle)})}componentDidMount(){var e=new google.maps.Rectangle(aF(aF({},this.props.options),{},{map:this.context}));this.registeredEvents=sl({updaterMap:aU,eventMap:aj,prevProps:{},nextProps:this.props,instance:e}),this.setState(function(){return{rectangle:e}},this.setRectangleCallback)}componentDidUpdate(e){null!==this.state.rectangle&&(so(this.registeredEvents),this.registeredEvents=sl({updaterMap:aU,eventMap:aj,prevProps:e,nextProps:this.props,instance:this.state.rectangle}))}componentWillUnmount(){null!==this.state.rectangle&&(this.props.onUnmount&&this.props.onUnmount(this.state.rectangle),so(this.registeredEvents),this.state.rectangle.setMap(null))}render(){return null}}function aW(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,r)}return i}function aH(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?aW(Object(i),!0).forEach(function(t){si(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):aW(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}si(aV,"contextType",sa);var aG={onCenterChanged:"center_changed",onRadiusChanged:"radius_changed",onClick:"click",onDblClick:"dblclick",onDrag:"drag",onDragEnd:"dragend",onDragStart:"dragstart",onMouseDown:"mousedown",onMouseMove:"mousemove",onMouseOut:"mouseout",onMouseOver:"mouseover",onMouseUp:"mouseup",onRightClick:"rightclick"},aq={center(e,t){e.setCenter(t)},draggable(e,t){e.setDraggable(t)},editable(e,t){e.setEditable(t)},map(e,t){e.setMap(t)},options(e,t){e.setOptions(t)},radius(e,t){e.setRadius(t)},visible(e,t){e.setVisible(t)}},aX={};(0,r7.memo)(function(e){var{options:t,center:i,radius:r,draggable:s,editable:a,visible:o,onDblClick:h,onDragEnd:c,onDragStart:d,onMouseDown:u,onMouseMove:p,onMouseOut:f,onMouseOver:m,onMouseUp:g,onRightClick:v,onClick:y,onDrag:x,onCenterChanged:b,onRadiusChanged:w,onLoad:_,onUnmount:S}=e,C=(0,r7.useContext)(sa),[M,E]=(0,r7.useState)(null),[A,T]=(0,r7.useState)(null),[P,D]=(0,r7.useState)(null),[O,L]=(0,r7.useState)(null),[I,R]=(0,r7.useState)(null),[k,B]=(0,r7.useState)(null),[z,N]=(0,r7.useState)(null),[F,j]=(0,r7.useState)(null),[U,V]=(0,r7.useState)(null),[W,H]=(0,r7.useState)(null),[G,q]=(0,r7.useState)(null),[X,Y]=(0,r7.useState)(null),[Q,Z]=(0,r7.useState)(null),[K,J]=(0,r7.useState)(null);return(0,r7.useEffect)(()=>{null!==M&&M.setMap(C)},[C]),(0,r7.useEffect)(()=>{void 0!==t&&null!==M&&M.setOptions(t)},[M,t]),(0,r7.useEffect)(()=>{void 0!==s&&null!==M&&M.setDraggable(s)},[M,s]),(0,r7.useEffect)(()=>{void 0!==a&&null!==M&&M.setEditable(a)},[M,a]),(0,r7.useEffect)(()=>{void 0!==o&&null!==M&&M.setVisible(o)},[M,o]),(0,r7.useEffect)(()=>{"number"==typeof r&&null!==M&&M.setRadius(r)},[M,r]),(0,r7.useEffect)(()=>{void 0!==i&&null!==M&&M.setCenter(i)},[M,i]),(0,r7.useEffect)(()=>{M&&h&&(null!==A&&google.maps.event.removeListener(A),T(google.maps.event.addListener(M,"dblclick",h)))},[h]),(0,r7.useEffect)(()=>{M&&c&&(null!==P&&google.maps.event.removeListener(P),D(google.maps.event.addListener(M,"dragend",c)))},[c]),(0,r7.useEffect)(()=>{M&&d&&(null!==O&&google.maps.event.removeListener(O),L(google.maps.event.addListener(M,"dragstart",d)))},[d]),(0,r7.useEffect)(()=>{M&&u&&(null!==I&&google.maps.event.removeListener(I),R(google.maps.event.addListener(M,"mousedown",u)))},[u]),(0,r7.useEffect)(()=>{M&&p&&(null!==k&&google.maps.event.removeListener(k),B(google.maps.event.addListener(M,"mousemove",p)))}
8198,[p]),(0,r7.useEffect)(()=>{M&&f&&(null!==z&&google.maps.event.removeListener(z),N(google.maps.event.addListener(M,"mouseout",f)))},[f]),(0,r7.useEffect)(()=>{M&&m&&(null!==F&&google.maps.event.removeListener(F),j(google.maps.event.addListener(M,"mouseover",m)))},[m]),(0,r7.useEffect)(()=>{M&&g&&(null!==U&&google.maps.event.removeListener(U),V(google.maps.event.addListener(M,"mouseup",g)))},[g]),(0,r7.useEffect)(()=>{M&&v&&(null!==W&&google.maps.event.removeListener(W),H(google.maps.event.addListener(M,"rightclick",v)))},[v]),(0,r7.useEffect)(()=>{M&&y&&(null!==G&&google.maps.event.removeListener(G),q(google.maps.event.addListener(M,"click",y)))},[y]),(0,r7.useEffect)(()=>{M&&x&&(null!==X&&google.maps.event.removeListener(X),Y(google.maps.event.addListener(M,"drag",x)))},[x]),(0,r7.useEffect)(()=>{M&&b&&(null!==Q&&google.maps.event.removeListener(Q),Z(google.maps.event.addListener(M,"center_changed",b)))},[y]),(0,r7.useEffect)(()=>{M&&w&&(null!==K&&google.maps.event.removeListener(K),J(google.maps.event.addListener(M,"radius_changed",w)))},[w]),(0,r7.useEffect)(()=>{var e=new google.maps.Circle(aH(aH({},t||aX),{},{map:C}));return"number"==typeof r&&e.setRadius(r),void 0!==i&&e.setCenter(i),"number"==typeof r&&e.setRadius(r),void 0!==o&&e.setVisible(o),void 0!==a&&e.setEditable(a),void 0!==s&&e.setDraggable(s),h&&T(google.maps.event.addListener(e,"dblclick",h)),c&&D(google.maps.event.addListener(e,"dragend",c)),d&&L(google.maps.event.addListener(e,"dragstart",d)),u&&R(google.maps.event.addListener(e,"mousedown",u)),p&&B(google.maps.event.addListener(e,"mousemove",p)),f&&N(google.maps.event.addListener(e,"mouseout",f)),m&&j(google.maps.event.addListener(e,"mouseover",m)),g&&V(google.maps.event.addListener(e,"mouseup",g)),v&&H(google.maps.event.addListener(e,"rightclick",v)),y&&q(google.maps.event.addListener(e,"click",y)),x&&Y(google.maps.event.addListener(e,"drag",x)),b&&Z(google.maps.event.addListener(e,"center_changed",b)),w&&J(google.maps.event.addListener(e,"radius_changed",w)),E(e),_&&_(e),()=>{null!==A&&google.maps.event.removeListener(A),null!==P&&google.maps.event.removeListener(P),null!==O&&google.maps.event.removeListener(O),null!==I&&google.maps.event.removeListener(I),null!==k&&google.maps.event.removeListener(k),null!==z&&google.maps.event.removeListener(z),null!==F&&google.maps.event.removeListener(F),null!==U&&google.maps.event.removeListener(U),null!==W&&google.maps.event.removeListener(W),null!==G&&google.maps.event.removeListener(G),null!==Q&&google.maps.event.removeListener(Q),null!==K&&google.maps.event.removeListener(K),S&&S(e),e.setMap(null)}},[]),null});class aY extends r7.PureComponent{constructor(){super(...arguments),si(this,"registeredEvents",[]),si(this,"state",{circle:null}),si(this,"setCircleCallback",()=>{null!==this.state.circle&&this.props.onLoad&&this.props.onLoad(this.state.circle)})}componentDidMount(){var e=new google.maps.Circle(aH(aH({},this.props.options),{},{map:this.context}));this.registeredEvents=sl({updaterMap:aq,eventMap:aG,prevProps:{},nextProps:this.props,instance:e}),this.setState(function(){return{circle:e}},this.setCircleCallback)}componentDidUpdate(e){null!==this.state.circle&&(so(this.registeredEvents),this.registeredEvents=sl({updaterMap:aq,eventMap:aG,prevProps:e,nextProps:this.props,instance:this.state.circle}))}componentWillUnmount(){if(null!==this.state.circle){var e;this.props.onUnmount&&this.props.onUnmount(this.state.circle),so(this.registeredEvents),null==(e=this.state.circle)||e.setMap(null)}}render(){return null}}function aQ(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,r)}return i}function aZ(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?aQ(Object(i),!0).forEach(function(t){si(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):aQ(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}si(aY,"contextType",sa);var aK={onClick:"click",onDblClick:"dblclick",onMouseDown:"mousedown",onMouseOut:"mouseout",onMouseOver:"mouseover",onMouseUp:"mouseup",onRightClick:"rightclick",onAddFeature:"addfeature",onRemoveFeature:"removefeature",onRemoveProperty:"removeproperty",onSetGeometry:"setgeometry",onSetProperty:"setproperty"},aJ={add(e,t){e.add(t)},addgeojson(e,t,i){e.addGeoJson(t,i)},contains(e,t){e.contains(t)},foreach(e,t){e.forEach(t)},loadgeojson(e,t,i,r){e.loadGeoJson(t,i,r)},overridestyle(e,t,i){e.overrideStyle(t,i)},remove(e,t){e.remove(t)},revertstyle(e,t){e.revertStyle(t)},controlposition(e,t){e.setControlPosition(t)},controls(e,t){e.setControls(t)},drawingmode(e,t){e.setDrawingMode(t)},map(e,t){e.setMap(t)},style(e,t){e.setStyle(t)},togeojson(e,t){e.toGeoJson(t)}};(0,r7.memo)(function(e){var{options:t,onClick:i,onDblClick:r,onMouseDown:s,onMouseMove:a,onMouseOut:o,onMouseOver:h,onMouseUp:c,onRightClick:d,onAddFeature:u,onRemoveFeature:p,onRemoveProperty:f,onSetGeometry:m,onSetProperty:g,onLoad:v,onUnmount:y}=e,x=(0,r7.useContext)(sa),[b,w]=(0,r7.useState)(null),[_,S]=(0,r7.useState)(null),[C,M]=(0,r7.useState)(null),[E,A]=(0,r7.useState)(null),[T,P]=(0,r7.useState)(null),[D,O]=(0,r7.useState)(null),[L,I]=(0,r7.useState)(null),[R,k]=(0,r7.useState)(null),[B,z]=(0,r7.useState)(null),[N,F]=(0,r7.useState)(null),[j,U]=(0,r7.useState)(null),[V,W]=(0,r7.useState)(null),[H,G]=(0,r7.useState)(null),[q,X]=(0,r7.useState)(null);return(0,r7.useEffect)(()=>{null!==b&&b.setMap(x)},[x]),(0,r7.useEffect)(()=>{b&&r&&(null!==_&&google.maps.event.removeListener(_),S(google.maps.event.addListener(b,"dblclick",r)))},[r]),(0,r7.useEffect)(()=>{b&&s&&(null!==C&&google.maps.event.removeListener(C),M(google.maps.event.addListener(b,"mousedown",s)))},[s]),(0,r7.useEffect)(()=>{b&&a&&(null!==E&&google.maps.event.removeListener(E),A(google.maps.event.addListener(b,"mousemove",a)))},[a]),(0,r7.useEffect)(()=>{b&&o&&(null!==T&&google.maps.event.removeListener(T),P(google.maps.event.addListener(b,"mouseout",o)))},[o]),(0,r7.useEffect)(()=>
8198{b&&h&&(null!==D&&google.maps.event.removeListener(D),O(google.maps.event.addListener(b,"mouseover",h)))},[h]),(0,r7.useEffect)(()=>{b&&c&&(null!==L&&google.maps.event.removeListener(L),I(google.maps.event.addListener(b,"mouseup",c)))},[c]),(0,r7.useEffect)(()=>{b&&d&&(null!==R&&google.maps.event.removeListener(R),k(google.maps.event.addListener(b,"rightclick",d)))},[d]),(0,r7.useEffect)(()=>{b&&i&&(null!==B&&google.maps.event.removeListener(B),z(google.maps.event.addListener(b,"click",i)))},[i]),(0,r7.useEffect)(()=>{b&&u&&(null!==N&&google.maps.event.removeListener(N),F(google.maps.event.addListener(b,"addfeature",u)))},[u]),(0,r7.useEffect)(()=>{b&&p&&(null!==j&&google.maps.event.removeListener(j),U(google.maps.event.addListener(b,"removefeature",p)))},[p]),(0,r7.useEffect)(()=>{b&&f&&(null!==V&&google.maps.event.removeListener(V),W(google.maps.event.addListener(b,"removeproperty",f)))},[f]),(0,r7.useEffect)(()=>{b&&m&&(null!==H&&google.maps.event.removeListener(H),G(google.maps.event.addListener(b,"setgeometry",m)))},[m]),(0,r7.useEffect)(()=>{b&&g&&(null!==q&&google.maps.event.removeListener(q),X(google.maps.event.addListener(b,"setproperty",g)))},[g]),(0,r7.useEffect)(()=>{if(null!==x){var e=new google.maps.Data(aZ(aZ({},t),{},{map:x}));r&&S(google.maps.event.addListener(e,"dblclick",r)),s&&M(google.maps.event.addListener(e,"mousedown",s)),a&&A(google.maps.event.addListener(e,"mousemove",a)),o&&P(google.maps.event.addListener(e,"mouseout",o)),h&&O(google.maps.event.addListener(e,"mouseover",h)),c&&I(google.maps.event.addListener(e,"mouseup",c)),d&&k(google.maps.event.addListener(e,"rightclick",d)),i&&z(google.maps.event.addListener(e,"click",i)),u&&F(google.maps.event.addListener(e,"addfeature",u)),p&&U(google.maps.event.addListener(e,"removefeature",p)),f&&W(google.maps.event.addListener(e,"removeproperty",f)),m&&G(google.maps.event.addListener(e,"setgeometry",m)),g&&X(google.maps.event.addListener(e,"setproperty",g)),w(e),v&&v(e)}return()=>{b&&(null!==_&&google.maps.event.removeListener(_),null!==C&&google.maps.event.removeListener(C),null!==E&&google.maps.event.removeListener(E),null!==T&&google.maps.event.removeListener(T),null!==D&&google.maps.event.removeListener(D),null!==L&&google.maps.event.removeListener(L),null!==R&&google.maps.event.removeListener(R),null!==B&&google.maps.event.removeListener(B),null!==N&&google.maps.event.removeListener(N),null!==j&&google.maps.event.removeListener(j),null!==V&&google.maps.event.removeListener(V),null!==H&&google.maps.event.removeListener(H),null!==q&&google.maps.event.removeListener(q),y&&y(b),b.setMap(null))}},[]),null});class a$ extends r7.PureComponent{constructor(){super(...arguments),si(this,"registeredEvents",[]),si(this,"state",{data:null}),si(this,"setDataCallback",()=>{null!==this.state.data&&this.props.onLoad&&this.props.onLoad(this.state.data)})}componentDidMount(){if(null!==this.context){var e=new google.maps.Data(aZ(aZ({},this.props.options),{},{map:this.context}));this.registeredEvents=sl({updaterMap:aJ,eventMap:aK,prevProps:{},nextProps:this.props,instance:e}),this.setState(()=>({data:e}),this.setDataCallback)}}componentDidUpdate(e){null!==this.state.data&&(so(this.registeredEvents),this.registeredEvents=sl({updaterMap:aJ,eventMap:aK,prevProps:e,nextProps:this.props,instance:this.state.data}))}componentWillUnmount(){null!==this.state.data&&(this.props.onUnmount&&this.props.onUnmount(this.state.data),so(this.registeredEvents),this.state.data&&this.state.data.setMap(null))}render(){return null}}function a0(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,r)}return i}function a1(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?a0(Object(i),!0).forEach(function(t){si(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):a0(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}si(a$,"contextType",sa);var a2={onClick:"click",onDefaultViewportChanged:"defaultviewport_changed",onStatusChanged:"status_changed"},a3={options(e,t){e.setOptions(t)},url(e,t){e.setUrl(t)},zIndex(e,t){e.setZIndex(t)}};class a4 extends r7.PureComponent{constructor(){super(...arguments),si(this,"registeredEvents",[]),si(this,"state",{kmlLayer:null}),si(this,"setKmlLayerCallback",()=>{null!==this.state.kmlLayer&&this.props.onLoad&&this.props.onLoad(this.state.kmlLayer)})}componentDidMount(){var e=new google.maps.KmlLayer(a1(a1({},this.props.options),{},{map:this.context}));this.registeredEvents=sl({updaterMap:a3,eventMap:a2,prevProps:{},nextProps:this.props,instance:e}),this.setState(function(){return{kmlLayer:e}},this.setKmlLayerCallback)}componentDidUpdate(e){null!==this.state.kmlLayer&&(so(this.registeredEvents),this.registeredEvents=sl({updaterMap:a3,eventMap:a2,prevProps:e,nextProps:this.props,instance:this.state.kmlLayer}))}componentWillUnmount(){null!==this.state.kmlLayer&&(this.props.onUnmount&&this.props.onUnmount(this.state.kmlLayer),so(this.registeredEvents),this.state.kmlLayer.setMap(null))}render(){return null}}function a5(e,t){return"function"==typeof t?t(e.offsetWidth,e.offsetHeight):{x:0,y:0}}function a6(e,t){return new t(e.lat,e.lng)}function a8(e,t){return new t(new google.maps.LatLng(e.ne.lat,e.
8198ne.lng),new google.maps.LatLng(e.sw.lat,e.sw.lng))}function a9(e,t,i,r){var s,a,o,h,c;return void 0!==i?(s=google.maps.LatLngBounds,a=i instanceof s?i:a8(i,s),o=e&&e.fromLatLngToDivPixel(a.getNorthEast()),h=e&&e.fromLatLngToDivPixel(a.getSouthWest()),o&&h?{left:"".concat(h.x+t.x,"px"),top:"".concat(o.y+t.y,"px"),width:"".concat(o.x-h.x-t.x,"px"),height:"".concat(h.y-o.y-t.y,"px")}:{left:"-9999px",top:"-9999px"}):function(e,t,i){var r=e&&e.fromLatLngToDivPixel(i);if(r){var{x:s,y:a}=r;return{left:"".concat(s+t.x,"px"),top:"".concat(a+t.y,"px")}}return{left:"-9999px",top:"-9999px"}}(e,t,(c=google.maps.LatLng,r instanceof c?r:a6(r,c)))}function a7(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,r)}return i}function ne(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,r)}return i}function nt(e){return e?(e instanceof google.maps.LatLng?e:new google.maps.LatLng(e.lat,e.lng))+"":""}function ni(e){return e?(e instanceof google.maps.LatLngBounds?e:new google.maps.LatLngBounds(new google.maps.LatLng(e.south,e.east),new google.maps.LatLng(e.north,e.west)))+"":""}si(a4,"contextType",sa),(0,r7.memo)(function(e){var{position:t,bounds:i,mapPaneName:r,zIndex:s,onLoad:a,onUnmount:o,getPixelPositionOffset:h,children:c}=e,d=(0,r7.useContext)(sa),u=(0,r7.useMemo)(()=>{var e=document.createElement("div");return e.style.position="absolute",e},[]),p=(0,r7.useMemo)(()=>(function(e,t,i,r,s){class a extends google.maps.OverlayView{constructor(e,t,i,r){super(),this.container=e,this.pane=t,this.position=i,this.bounds=r}onAdd(){var e,t=null==(e=this.getPanes())?void 0:e[this.pane];null==t||t.appendChild(this.container)}draw(){for(var[e,t]of Object.entries(a9(this.getProjection(),function(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?a7(Object(i),!0).forEach(function(t){si(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):a7(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}({},this.container?a5(this.container,s):{x:0,y:0}),this.bounds,this.position)))this.container.style[e]=t}onRemove(){null!==this.container.parentNode&&this.container.parentNode.removeChild(this.container)}}return new a(e,t,i,r)})(u,r,t,i,h),[u,r,t,i]);return(0,r7.useEffect)(()=>(null==a||a(p),null==p||p.setMap(d),()=>{null==o||o(p),null==p||p.setMap(null)}),[d,p]),(0,r7.useEffect)(()=>{u.style.zIndex="".concat(s)},[s,u]),se.createPortal(c,u)});class nr extends r7.PureComponent{constructor(e){super(e),si(this,"state",{paneEl:null,containerStyle:{position:"absolute"}}),si(this,"updatePane",()=>{var e=this.props.mapPaneName,t=this.overlayView.getPanes();ss(!!e,"OverlayView requires props.mapPaneName but got %s",e),t?this.setState({paneEl:t[e]}):this.setState({paneEl:null})}),si(this,"onAdd",()=>{var e,t;this.updatePane(),null==(e=(t=this.props).onLoad)||e.call(t,this.overlayView)}),si(this,"onPositionElement",()=>{var e,t,i,r,s,a=a9(this.overlayView.getProjection(),function(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?ne(Object(i),!0).forEach(function(t){si(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):ne(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}({x:0,y:0},this.containerRef.current?a5(this.containerRef.current,this.props.getPixelPositionOffset):{}),this.props.bounds,this.props.position);s={left:this.state.containerStyle.left,top:this.state.containerStyle.top,width:this.state.containerStyle.width,height:this.state.containerStyle.height},(a.left!==s.left||a.top!==s.top||a.width!==s.height||a.height!==s.height)&&this.setState({containerStyle:{top:null!=(e=a.top)?e:0,left:null!=(t=a.left)?t:0,width:null!=(i=a.width)?i:0,height:null!=(r=a.height)?r:0,position:"absolute"}})}),si(this,"draw",()=>{this.onPositionElement()}),si(this,"onRemove",()=>{var e,t;this.setState(()=>({paneEl:null})),null==(e=(t=this.props).onUnmount)||e.call(t,this.overlayView)}
8198),this.containerRef=(0,r7.createRef)();var t=new google.maps.OverlayView;t.onAdd=this.onAdd,t.draw=this.draw,t.onRemove=this.onRemove,this.overlayView=t}componentDidMount(){this.overlayView.setMap(this.context)}componentDidUpdate(e){var t=nt(e.position),i=nt(this.props.position),r=ni(e.bounds),s=ni(this.props.bounds);(t!==i||r!==s)&&this.overlayView.draw(),e.mapPaneName!==this.props.mapPaneName&&this.updatePane()}componentWillUnmount(){this.overlayView.setMap(null)}render(){var e=this.state.paneEl;return e?se.createPortal((0,I.jsx)("div",{ref:this.containerRef,style:this.state.containerStyle,children:r7.Children.only(this.props.children)}),e):null}}function ns(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,r)}return i}function na(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?ns(Object(i),!0).forEach(function(t){si(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):ns(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}si(nr,"FLOAT_PANE","floatPane"),si(nr,"MAP_PANE","mapPane"),si(nr,"MARKER_LAYER","markerLayer"),si(nr,"OVERLAY_LAYER","overlayLayer"),si(nr,"OVERLAY_MOUSE_TARGET","overlayMouseTarget"),si(nr,"contextType",sa);var nn={onDblClick:"dblclick",onClick:"click"},no={opacity(e,t){e.setOpacity(t)}};(0,r7.memo)(function(e){var{url:t,bounds:i,options:r,visible:s}=e,a=(0,r7.useContext)(sa),o=new google.maps.LatLngBounds(new google.maps.LatLng(i.south,i.west),new google.maps.LatLng(i.north,i.east)),h=(0,r7.useMemo)(()=>new google.maps.GroundOverlay(t,o,r),[]);return(0,r7.useEffect)(()=>{null!==h&&h.setMap(a)},[a]),(0,r7.useEffect)(()=>{void 0!==t&&null!==h&&(h.set("url",t),h.setMap(a))},[h,t]),(0,r7.useEffect)(()=>{void 0!==s&&null!==h&&h.setOpacity(+!!s)},[h,s]),(0,r7.useEffect)(()=>{var e=new google.maps.LatLngBounds(new google.maps.LatLng(i.south,i.west),new google.maps.LatLng(i.north,i.east));void 0!==i&&null!==h&&(h.set("bounds",e),h.setMap(a))},[h,i]),null});class nl extends r7.PureComponent{constructor(){super(...arguments),si(this,"registeredEvents",[]),si(this,"state",{groundOverlay:null}),si(this,"setGroundOverlayCallback",()=>{null!==this.state.groundOverlay&&this.props.onLoad&&this.props.onLoad(this.state.groundOverlay)})}componentDidMount(){ss(!!this.props.url||!!this.props.bounds,"For GroundOverlay, url and bounds are passed in to constructor and are immutable after instantiated. This is the behavior of Google Maps JavaScript API v3 ( See https://developers.google.com/maps/documentation/javascript/reference#GroundOverlay) Hence, use the corresponding two props provided by `react-google-maps-api`, url and bounds. In some cases, you'll need the GroundOverlay component to reflect the changes of url and bounds. You can leverage the React's key property to remount the component. Typically, just `key={url}` would serve your need. See https://github.com/tomchentw/react-google-maps/issues/655");var e=new google.maps.GroundOverlay(this.props.url,this.props.bounds,na(na({},this.props.options),{},{map:this.context}));this.registeredEvents=sl({updaterMap:no,eventMap:nn,prevProps:{},nextProps:this.props,instance:e}),this.setState(function(){return{groundOverlay:e}},this.setGroundOverlayCallback)}componentDidUpdate(e){null!==this.state.groundOverlay&&(so(this.registeredEvents),this.registeredEvents=sl({updaterMap:no,eventMap:nn,prevProps:e,nextProps:this.props,instance:this.state.groundOverlay}))}componentWillUnmount(){this.state.groundOverlay&&(this.props.onUnmount&&this.props.onUnmount(this.state.groundOverlay),this.state.groundOverlay.setMap(null))}render(){return null}}function nh(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,r)}return i}function nc(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};
8198t%2?nh(Object(i),!0).forEach(function(t){si(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):nh(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}si(nl,"defaultProps",{onLoad:function(){}}),si(nl,"contextType",sa);var nd={},nu={data(e,t){e.setData(t)},map(e,t){e.setMap(t)},options(e,t){e.setOptions(t)}};(0,r7.memo)(function(e){var{data:t,onLoad:i,onUnmount:r,options:s}=e,a=(0,r7.useContext)(sa),[o,h]=(0,r7.useState)(null);return(0,r7.useEffect)(()=>{google.maps.visualization||ss(!!google.maps.visualization,'Did you include prop libraries={["visualization"]} in useJsApiScript? %s',google.maps.visualization)},[]),(0,r7.useEffect)(()=>{ss(!!t,"data property is required in HeatmapLayer %s",t)},[t]),(0,r7.useEffect)(()=>{null!==o&&o.setMap(a)},[a]),(0,r7.useEffect)(()=>{s&&null!==o&&o.setOptions(s)},[o,s]),(0,r7.useEffect)(()=>{var e=new google.maps.visualization.HeatmapLayer(nc(nc({},s),{},{data:t,map:a}));return h(e),i&&i(e),()=>{null!==o&&(r&&r(o),o.setMap(null))}},[]),null});class np extends r7.PureComponent{constructor(){super(...arguments),si(this,"registeredEvents",[]),si(this,"state",{heatmapLayer:null}),si(this,"setHeatmapLayerCallback",()=>{null!==this.state.heatmapLayer&&this.props.onLoad&&this.props.onLoad(this.state.heatmapLayer)})}componentDidMount(){ss(!!google.maps.visualization,'Did you include prop libraries={["visualization"]} to <LoadScript />? %s',google.maps.visualization),ss(!!this.props.data,"data property is required in HeatmapLayer %s",this.props.data);var e=new google.maps.visualization.HeatmapLayer(nc(nc({},this.props.options),{},{data:this.props.data,map:this.context}));this.registeredEvents=sl({updaterMap:nu,eventMap:nd,prevProps:{},nextProps:this.props,instance:e}),this.setState(function(){return{heatmapLayer:e}},this.setHeatmapLayerCallback)}componentDidUpdate(e){so(this.registeredEvents),this.registeredEvents=sl({updaterMap:nu,eventMap:nd,prevProps:e,nextProps:this.props,instance:this.state.heatmapLayer})}componentWillUnmount(){null!==this.state.heatmapLayer&&(this.props.onUnmount&&this.props.onUnmount(this.state.heatmapLayer),so(this.registeredEvents),this.state.heatmapLayer.setMap(null))}render(){return null}}si(np,"contextType",sa);var nf={onCloseClick:"closeclick",onPanoChanged:"pano_changed",onPositionChanged:"position_changed",onPovChanged:"pov_changed",onResize:"resize",onStatusChanged:"status_changed",onVisibleChanged:"visible_changed",onZoomChanged:"zoom_changed"},nm={register(e,t,i){e.registerPanoProvider(t,i)},links(e,t){e.setLinks(t)},motionTracking(e,t){e.setMotionTracking(t)},options(e,t){e.setOptions(t)},pano(e,t){e.setPano(t)},position(e,t){e.setPosition(t)},pov(e,t){e.setPov(t)},visible(e,t){e.setVisible(t)},zoom(e,t){e.setZoom(t)}};class ng extends r7.PureComponent{constructor(){super(...arguments),si(this,"registeredEvents",[]),si(this,"state",{streetViewPanorama:null}),si(this,"setStreetViewPanoramaCallback",()=>{null!==this.state.streetViewPanorama&&this.props.onLoad&&this.props.onLoad(this.state.streetViewPanorama)})}componentDidMount(){var e,t,i=null!=(e=null==(t=this.context)?void 0:t.getStreetView())?e:null;this.registeredEvents=sl({updaterMap:nm,eventMap:nf,prevProps:{},nextProps:this.props,instance:i}),this.setState(()=>({streetViewPanorama:i}),this.setStreetViewPanoramaCallback)}componentDidUpdate(e){null!==this.state.streetViewPanorama&&(so(this.registeredEvents),this.registeredEvents=sl({updaterMap:nm,eventMap:nf,prevProps:e,nextProps:this.props,instance:this.state.streetViewPanorama}))}componentWillUnmount(){null!==this.state.streetViewPanorama&&(this.props.onUnmount&&this.props.onUnmount(this.state.streetViewPanorama),so(this.registeredEvents),this.state.streetViewPanorama.setVisible(!1))}render(){return null}}si(ng,"contextType",sa);class nv extends r7.PureComponent{constructor(){super(...arguments),si(this,"state",{streetViewService:null}),si(this,"setStreetViewServiceCallback",()=>{null!==this.state.streetViewService&&this.props.onLoad&&this.props.onLoad(this.state.streetViewService)})}componentDidMount(){var e=new google.maps.StreetViewService;this.setState(function(){return{streetViewService:e}},this.setStreetViewServiceCallback)}componentWillUnmount(){null!==this.state.streetViewService&&this.props.onUnmount&&this.props.onUnmount(this.state.streetViewService)}render(){return null}}si(nv,"contextType",sa),r7.PureComponent;var ny={onDirectionsChanged:"directions_changed"},nx={directions(e,t){e.setDirections(t)},map(e,t){e.setMap(t)},options(e,t){e.setOptions(t)},panel(e,t){e.setPanel(t)},routeIndex(e,t){e.setRouteIndex(t)}};
8198class nb extends r7.PureComponent{constructor(){super(...arguments),si(this,"registeredEvents",[]),si(this,"state",{directionsRenderer:null}),si(this,"setDirectionsRendererCallback",()=>{null!==this.state.directionsRenderer&&(this.state.directionsRenderer.setMap(this.context),this.props.onLoad&&this.props.onLoad(this.state.directionsRenderer))})}componentDidMount(){var e=new google.maps.DirectionsRenderer(this.props.options);this.registeredEvents=sl({updaterMap:nx,eventMap:ny,prevProps:{},nextProps:this.props,instance:e}),this.setState(function(){return{directionsRenderer:e}},this.setDirectionsRendererCallback)}componentDidUpdate(e){null!==this.state.directionsRenderer&&(so(this.registeredEvents),this.registeredEvents=sl({updaterMap:nx,eventMap:ny,prevProps:e,nextProps:this.props,instance:this.state.directionsRenderer}))}componentWillUnmount(){null!==this.state.directionsRenderer&&(this.props.onUnmount&&this.props.onUnmount(this.state.directionsRenderer),so(this.registeredEvents),this.state.directionsRenderer&&this.state.directionsRenderer.setMap(null))}render(){return null}}si(nb,"contextType",sa),r7.PureComponent;var nw={onPlacesChanged:"places_changed"},n_={bounds(e,t){e.setBounds(t)}};class nS extends r7.PureComponent{constructor(){super(...arguments),si(this,"registeredEvents",[]),si(this,"containerElement",(0,r7.createRef)()),si(this,"state",{searchBox:null}),si(this,"setSearchBoxCallback",()=>{null!==this.state.searchBox&&this.props.onLoad&&this.props.onLoad(this.state.searchBox)})}componentDidMount(){if(ss(!!google.maps.places,'You need to provide libraries={["places"]} prop to <LoadScript /> component %s',google.maps.places),null!==this.containerElement&&null!==this.containerElement.current){var e=this.containerElement.current.querySelector("input");if(null!==e){var t=new google.maps.places.SearchBox(e,this.props.options);this.registeredEvents=sl({updaterMap:n_,eventMap:nw,prevProps:{},nextProps:this.props,instance:t}),this.setState(function(){return{searchBox:t}},this.setSearchBoxCallback)}}}componentDidUpdate(e){null!==this.state.searchBox&&(so(this.registeredEvents),this.registeredEvents=sl({updaterMap:n_,eventMap:nw,prevProps:e,nextProps:this.props,instance:this.state.searchBox}))}componentWillUnmount(){null!==this.state.searchBox&&(this.props.onUnmount&&this.props.onUnmount(this.state.searchBox),so(this.registeredEvents))}render(){return(0,I.jsx)("div",{ref:this.containerElement,children:r7.Children.only(this.props.children)})}}si(nS,"contextType",sa);var nC={onPlaceChanged:"place_changed"},nM={bounds(e,t){e.setBounds(t)},restrictions(e,t){e.setComponentRestrictions(t)},fields(e,t){e.setFields(t)},options(e,t){e.setOptions(t)},types(e,t){e.setTypes(t)}};class nE extends r7.PureComponent{constructor(){super(...arguments),si(this,"registeredEvents",[]),si(this,"containerElement",(0,r7.createRef)()),si(this,"state",{autocomplete:null}),si(this,"setAutocompleteCallback",()=>{null!==this.state.autocomplete&&this.props.onLoad&&this.props.onLoad(this.state.autocomplete)})}componentDidMount(){ss(!!google.maps.places,'You need to provide libraries={["places"]} prop to <LoadScript /> component %s',google.maps.places);var e,t=null==(e=this.containerElement.current)?void 0:e.querySelector("input");if(t){var i=new google.maps.places.Autocomplete(t,this.props.options);this.registeredEvents=sl({updaterMap:nM,eventMap:nC,prevProps:{},nextProps:this.props,instance:i}),this.setState(()=>({autocomplete:i}),this.setAutocompleteCallback)}}componentDidUpdate(e){so(this.registeredEvents),this.registeredEvents=sl({updaterMap:nM,eventMap:nC,prevProps:e,nextProps:this.props,instance:this.state.autocomplete})}componentWillUnmount(){null!==this.state.autocomplete&&so(this.registeredEvents)}render(){return(0,I.jsx)("div",{ref:this.containerElement,className:this.props.className,children:r7.Children.only(this.props.children)})}}function nA(){return(nA=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e}).apply(this,arguments)}si(nE,"defaultProps",{className:""}),si(nE,"contextType",sa);var nT=function(e){var t=(0,k.useRef)(e);return t.current=e,t},nP=function(e,t){var i;return function(){for(var r=this,s=arguments.length,a=Array(s),o=0;o<s;o++)a[o]=arguments[o];null!==i&&(clearTimeout(i),i=null),i=setTimeout(function(){return e.apply(r,a)},t)}},nD=function(e){var t=void 0===e?{}:e,i=t.requestOptions,r=t.debounce,s=t.cache,a=void 0===s?86400:s,o=t.cacheKey,h=void 0===o?"upa":o,c=t.googleMaps,d=t.callbackName,u=t.defaultValue,p=t.initOnMount,f=void 0===p||p,m=(0,k.useState)(!1),g=m[0],v=m[1],y=(0,k.useState)(void 0===u?"":u),x=y[0],b=y[1],w=(0,k.useState)({loading:!1,status:"",data:[]}),_=w[0],S=w[1],C=(0,k.useRef)(),M=nT(i),E=nT(c),A=(0,k.useCallback)(function(){if(!C.current){var e,t=window.google,i=E.current,r=(null==i?void 0:i.places)||(null==t||null==(e=t.maps)?void 0:e.places);if(!r)return void console.error("💡 use-places-autocomplete: Google Maps Places API library must be loaded. See: https://github.com/wellyshen/use-places-autocomplete#load-the-library");
8198C.current=new r.AutocompleteService,v(!0)}},[E]),T=(0,k.useCallback)(function(){S({loading:!1,status:"",data:[]})},[]),P=(0,k.useCallback)(function(e){void 0===e&&(e=h);try{sessionStorage.removeItem(e)}catch(e){}},[h]),D=(0,k.useCallback)(nP(function(e){if(!e)return void T();S(function(e){return nA({},e,{loading:!0})});var t,i={};try{i=JSON.parse(sessionStorage.getItem(h)||"{}")}catch(e){}a&&(i=Object.keys(i).reduce(function(e,t){return i[t].maxAge-Date.now()>=0&&(e[t]=i[t]),e},{}))[e]?S({loading:!1,status:"OK",data:i[e].data}):null==(t=C.current)||t.getPlacePredictions(nA({},M.current,{input:e}),function(t,r){if(S({loading:!1,status:r,data:t||[]}),a&&"OK"===r){i[e]={data:t,maxAge:Date.now()+1e3*a};try{sessionStorage.setItem(h,JSON.stringify(i))}catch(e){}}})},void 0===r?200:r),[a,h,T,M]),O=(0,k.useCallback)(function(e,t){void 0===t&&(t=!0),b(e),C.current&&t&&D(e)},[D]);return(0,k.useEffect)(function(){if(!f)return function(){return null};var e=window.google;return E.current||null!=e&&e.maps||!d?A():window[d]=A,function(){window[d]&&delete window[d]}},[d,E,A,f]),{ready:g,value:x,suggestions:_,setValue:O,clearSuggestions:T,clearCache:P,init:A}},nO=function(e){var t=new window.google.maps.Geocoder;return new Promise(function(i,r){t.geocode(e,function(t,s){"OK"!==s&&r(s),!e.address&&e.componentRestrictions&&(console.error("💡 use-places-autocomplete: Please provide an address when using getGeocode() with the componentRestrictions."),i(t)),i(t)})})},nL=e.i(412178);function nI({onAddressSelect:e,onManualEntry:t}){let i=(0,k.useRef)(null),{ready:r,value:s,suggestions:{status:a,data:o},setValue:h,clearSuggestions:c}=nD({requestOptions:{types:["address"],componentRestrictions:{country:["au","sg"]}},debounce:300});(0,k.useEffect)(()=>{function e(e){i.current&&!i.current.contains(e.target)&&c()}return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[c]);let d=async i=>{h("",!1),c();try{let t=await nO({placeId:i});if(t&&t[0]){let i=t[0],r={addressLine1:"",addressLine2:"",city:"",state:"",country:"",postcode:""},s="",a="";i.address_components?.forEach(e=>{let t=e.types;t.includes("street_number")?s=e.long_name:t.includes("route")?a=e.long_name:t.includes("subpremise")?r.addressLine2=e.long_name:t.includes("locality")?r.city=e.long_name:t.includes("administrative_area_level_1")?r.state=e.long_name:t.includes("country")?r.country=e.long_name:t.includes("postal_code")&&(r.postcode=e.long_name)}),r.addressLine1=[s,a].filter(Boolean).join(" "),e(r)}}catch(e){console.error("Error fetching place details:",e),t()}};return(0,I.jsxs)("div",{className:nL.default.AutocompleteWrapper,ref:i,children:[(0,I.jsx)("input",{value:s,onChange:e=>h(e.target.value),disabled:!r,placeholder:"Start typing your address...",className:nL.default.input,autoComplete:"off"}),"OK"===a&&(0,I.jsx)("ul",{className:nL.default.SuggestionsList,children:o.map(e=>(0,I.jsx)("li",{onClick:()=>d(e.place_id),className:nL.default.SuggestionItem,children:e.description},e.place_id))}),(0,I.jsxs)("button",{type:"button",onClick:()=>{t()},className:nL.default.ManualEntryButton,children:["Can","'","t find your address? Enter manually"]})]})}let nR=["places"];function nk({googleMapsApiKey:e}){let[t,i]=(0,k.useState)(!1),{setFieldValue:r}=iy(),{isLoaded:s,loadError:a}=sw({googleMapsApiKey:e,libraries:nR});if(a||!e||!s){if(!t&&!s&&e)return(0,I.jsx)("div",{className:rN.default.LoadingMessage,children:"Loading address autocomplete..."});t||i(!0)}return(0,I.jsxs)("div",{children:[!t&&s&&e&&(0,I.jsx)(nI,{onAddressSelect:e=>{r("addressLine1",e.addressLine1),r("addressLine2",e.addressLine2),r("city",e.city),r("state",e.state),r("country",e.country),r("postcode",e.postcode),i(!0)},onManualEntry:()=>{i(!0)}}),t&&(0,I.jsxs)("div",{className:rN.default.AddressFields,children:[(0,I.jsxs)("div",{className:rN.default.FieldGroup,children:[(0,I.jsx)("label",{htmlFor:"addressLine1",className:rN.default.label,children:"Address Line 1"}),(0,I.jsx)(iI,{type:"text",name:"addressLine1",placeholder:"Street address",className:rN.default.input}),(0,I.jsx)(iU,{name:"addressLine1",component:"div",className:rN.default.Error})]}),(0,I.jsxs)("div",{className:rN.default.FieldGroup,children:[(0,I.jsx)("label",{htmlFor:"addressLine2",className:rN.default.label,children:"Address Line 2"}),(0,I.jsx)(iI,{type:"text",name:"addressLine2",placeholder:"Apartment, suite, etc. (optional)",className:rN.default.input}),(0,I.jsx)(iU,{name:"addressLine2",component:"div",className:rN.default.Error})]}),(0,I.jsxs)("div",{className:rN.default.FieldGroup,children:[(0,I.jsx)("label",{htmlFor:"city",className:rN.default.label,children:"City"}),(0,I.jsx)(iI,{type:"text",name:"city",placeholder:"City",className:rN.default.input}),(0,I.jsx)(iU,{name:"city",component:"div",className:rN.default.Error})]}),(0,I.jsxs)("div",{className:rN.default.AddressRow,children:[(0,I.jsxs)("div",{className:rN.default.FieldGroup,children:[(0,I.jsx)("label",{htmlFor:"state",className:rN.default.label,children:"State / Province"}),(0,I.jsx)(iI,{type:"text",name:"state",placeholder:"State",className:rN.default.input}),(0,I.jsx)(iU,{name:"state",component:"div",className:rN.default.Error})]}),(0,I.jsxs)("div",{className:rN.default.FieldGroup,children:[(0,I.jsx)("label",{htmlFor:"postcode",className:rN.default.label,children:"Postcode / ZIP"}),(0,I.jsx)(iI,{type:"text",name:"postcode",placeholder:"Postcode",className:rN.default.input}),(0,I.jsx)(iU,{name:"postcode",component:"div",className:rN.default.Error})]})]}),(0,I.jsxs)("div",{className:rN.default.FieldGroup,children:[(0,I.jsx)("label",{htmlFor:"country",className:rN.default.label,children:"Country"}),(0,I.jsxs)(iI,{as:"select",name:"country",className:rN.default.select,children:[(0,I.jsx)("option",{value:"",children:"Select a country"}),(0,I.jsx)("option",{value:"Australia",children:"Australia"}),(0,I.jsx)("option",{value:"Singapore",children:"Singapore"}),(0,I.jsx)("option",{value:"Thailand",children:"Thailand"})]}),(0,I.jsx)(iU,{name:"country",component:"div",className:rN.default.Error})]}),(0,I.jsxs)("div",{className:rN.default.FieldGroup,children:[(0,I.jsx)("label",{htmlFor:"phone",className:rN.default.label,children:"Phone Number"}),(0,I.jsx)(iI,{type:"tel",name:"phone",placeholder:"+1 (555) 123-4567",className:rN.default.input}),(0,I.jsx)(iU,{name:"phone",component:"div",className:rN.default.Error})]})]})]})}function nB({stages:e=[],submitButtonText:t="Submit",successSlide:i,formError:r,isLoading:s}){let[a,o]=(0,k.useState)(0),h=(0,k.useRef)(null),c=(0,k.useRef)(null);if((0,k.useEffect)(()=>{r&&window.scrollTo({top:0,behavior:"smooth"})},[r]),!e.length)return null;let d=e.reduce((e,t)=>
8198(t.fields.forEach(t=>{e[t.name]="checkbox"!==t.type&&(t.initialValue??"")}),e),{}),u=e[a]?.validationSchema,p=()=>{window.scrollTo({top:0,behavior:"smooth"}),a<e.length-1?(o(e=>e+1),h.current?.slideNext()):i&&(o(e.length),h.current?.slideNext())},f=async(t,i)=>{let r=await i(),s=e[a]?.fields.map(e=>e.name)||[];if(!Object.keys(r).filter(e=>s.includes(e)).length){let i=e[a];i?.onSubmit&&await i.onSubmit(t,p)}},m=()=>{window.scrollTo({top:0,behavior:"smooth"}),a>0&&(o(e=>e-1),h.current?.slidePrev())};return(0,I.jsx)("div",{className:rN.default.Outer,ref:c,children:(0,I.jsx)(iP,{initialValues:d,validationSchema:u,onSubmit:()=>{},validateOnChange:!0,validateOnBlur:!0,children:({validateForm:o,isSubmitting:c,values:d,errors:u})=>{let p;return(0,I.jsxs)(iR,{className:(0,rj.default)(rN.default.Inner,{[rN.default.Loading]:s}),children:[(0,I.jsx)("div",{className:rN.default.LoadingOverlay,children:(0,I.jsx)(rq,{color:"#00601b"})}),(0,I.jsxs)(rR.Swiper,{onSwiper:e=>{h.current=e},allowTouchMove:!1,modules:[rk.Navigation,rB.Pagination],className:rN.default.SliderOuter,children:[e.map((t,i)=>(0,I.jsxs)(rR.SwiperSlide,{children:[r&&a<e.length&&(0,I.jsxs)("div",{className:rN.default.FormError,children:[rF.icons.alert,r]}),(0,I.jsx)("div",{className:rN.default.Fields,children:t.fields.map(e=>(0,I.jsxs)("div",{className:rN.default.FieldGroup,children:[e.label&&"checkbox"!==e.type&&(0,I.jsx)("label",{htmlFor:e.name,className:rN.default.label,children:e.label}),(e=>{switch(e.type){case"textarea":return(0,I.jsx)(iI,{as:"textarea",name:e.name,placeholder:e.placeholder,className:rN.default.textarea});case"select":return(0,I.jsxs)(iI,{as:"select",name:e.name,className:rN.default.select,children:[(0,I.jsx)("option",{value:"",children:e.placeholder||"Select an option"}),e.options?.map(e=>(0,I.jsx)("option",{value:e.value,children:e.label},e.value))]});case"password":return(0,I.jsx)(rZ,{name:e.name,placeholder:e.placeholder,className:rN.default.input});case"captcha":return(0,I.jsxs)("div",{children:[(0,I.jsx)(iI,{name:e.name,children:({form:t})=>(0,I.jsx)(r9,{sitekey:"6Lcmn9orAAAAAPdKw_zDoCKU21QxpqS6YLVPl5qD",onChange:i=>{t.setFieldValue(e.name,i)}})}),(0,I.jsx)(iU,{name:e.name,component:"div",className:rN.default.Error})]});case"address":return(0,I.jsx)(nk,{googleMapsApiKey:e.googleMapsApiKey||""});case"checkbox":return(0,I.jsxs)("div",{className:rN.default.checkboxWrapper,children:[(0,I.jsx)(iI,{type:"checkbox",name:e.name,className:rN.default.checkbox}),e.label&&(0,I.jsx)("span",{className:rN.default.checkboxLabel,children:e.label})]});default:return(0,I.jsx)(iI,{type:e.type,name:e.name,placeholder:e.placeholder,className:rN.default.input})}})(e),(0,I.jsx)(iU,{name:e.name,component:"div",className:rN.default.Error})]},e.name))})]},i)),i&&(0,I.jsx)(rR.SwiperSlide,{children:(0,I.jsx)("div",{className:rN.default.successContent,children:i})})]}),a<e.length&&(0,I.jsxs)("div",{className:rN.default.Navigation,children:[(0,I.jsx)("div",{children:a>0&&(0,I.jsx)(rz.default,{type:"button",handleClick:m,title:"Previous"})}),(0,I.jsx)("div",{children:(0,I.jsx)(rz.default,{type:"button",disabled:c||!!(p=e[a]?.validationSchema)&&Object.keys(p.fields||{}).some(e=>{let t=u[e],i=!d[e]||""===d[e],r=p.fields[e],s=r?.spec?.optional||!1;return t||i&&!s}),handleClick:()=>f(d,o),title:c?"Submitting...":a<e.length-1?"Next":t,interfaceGreen:!0,size:"large"})})]})]})}})})}let nz=(0,I.jsxs)("svg",{width:"342",height:"37",viewBox:"0 0 342 37",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,I.jsx)("path",{d:"M23.8711 11.5212H10.7856V9.93466C10.7856 9.65135 10.7856 9.38693 10.8245 9.16028C10.9995 7.89484 11.68 7.34711 13.2549 7.27156C13.391 7.27156 13.5077 7.27156 13.6438 7.27156H22.8406V1.41653H12.3022C12.0883 1.41653 11.8744 1.41653 11.68 1.41653C7.16912 1.64318 4.25259 4.2685 3.82484 8.72588C3.78595 9.10362 3.76651 9.51914 3.76651 9.93466V11.5212H0.5V17.3762H3.76651V35.9045H10.8051V17.3762H20.099V35.9045H27.1376V14.6565L23.8905 11.5212H23.8711Z",fill:"#1A1A1A"}),(0,I.jsx)("path",{d:"M45.4337 10.5579C42.8672 10.5579 41.2728 11.6345 40.2617 12.6544C39.659 13.2399 39.2118 13.9198 38.9007 14.6942H38.6479V11.0301H31.6094V35.9045H38.6479V22.7402C38.6479 19.2838 40.8645 17.1307 44.6754 17.1307H48.4474V10.539H45.4337V10.5579Z",fill:"#1A1A1A"}),(0,I.jsx)("path",{d:"M89.0058 12.0878C89.0058 12.0878 89.0058 12.0878 88.9864 12.0878C88.8697 11.9934 88.733
81986 11.9178 88.617 11.8234C88.2475 11.5778 87.8392 11.3701 87.4115 11.1812C86.1087 10.6146 84.5727 10.3124 82.8422 10.3124C79.6341 10.3124 77.7286 11.4834 76.3676 12.6544C75.6093 13.3344 75.0065 14.1087 74.5593 14.9398H74.3065C73.8593 14.1087 73.2566 13.3344 72.4983 12.6544C71.915 12.1445 71.1761 11.6345 70.2817 11.2379C70.0095 11.1057 69.7373 11.0112 69.4457 10.8979C68.4152 10.5391 67.2097 10.3124 65.7514 10.3124C62.9321 10.3124 61.1239 11.389 59.9184 12.4089C59.2184 12.9944 58.6545 13.6743 58.2073 14.4487H57.9546V11.0301H50.916V35.9045H57.9546V22.4946C57.9546 18.585 60.4628 16.1485 63.4765 16.1485C66.4903 16.1485 64.2348 16.1863 64.5848 16.243C64.682 16.243 64.7598 16.2808 64.857 16.2808C64.9348 16.2808 65.0126 16.3185 65.0709 16.3374C65.1487 16.3374 65.2264 16.3752 65.3042 16.3941C67.1902 16.9796 68.2402 18.6228 68.2402 21.5125V35.9045H75.2787V22.4946C75.2787 18.585 77.7869 16.1485 80.8007 16.1485C83.8144 16.1485 81.734 16.1863 82.1423 16.2808C82.3173 16.3185 82.4534 16.3563 82.6089 16.413C82.6672 16.413 82.745 16.4507 82.8033 16.4696C82.9589 16.5263 83.095 16.583 83.2311 16.6396C84.7283 17.3762 85.5643 18.9627 85.5643 21.5125V35.9045H92.6029V20.7759C92.6029 16.6963 91.3002 13.7688 88.9864 12.0689L89.0058 12.0878Z",fill:"#1A1A1A"}),(0,I.jsx)("path",{d:"M115.216 11.0301V24.1945C115.216 28.1041 112.455 30.7861 109.189 30.7861C105.922 30.7861 108.78 30.7861 108.586 30.7672C108.1 30.7295 107.653 30.6539 107.244 30.5217C106.991 30.4462 106.758 30.3517 106.525 30.2384C104.872 29.4262 103.919 27.7264 103.919 25.1955V11.0301H96.8809V26.1588C96.8809 32.6182 100.206 36.1879 105.805 36.6034C106.175 36.6223 106.544 36.6411 106.933 36.6411C107.322 36.6411 107.633 36.6411 107.964 36.6034C110.277 36.3956 111.93 35.489 113.116 34.6013C113.874 34.0158 114.516 33.3359 114.963 32.5049H115.216V35.9234H122.255V11.0301H115.216Z",fill:"#1A1A1A"}),(0,I.jsx)("path",{d:"M148.97 26.2154C148.834 25.8565 148.678 25.5355 148.503 25.2333C148.387 25.0255 148.251 24.8177 148.114 24.6289C146.617 22.6268 144.031 21.588 141.484 21.0403C138.646 20.4548 135.787 20.0015 134.407 19.1327C134.232 19.0194 134.076 18.9061 133.96 18.7738C133.882 18.6794 133.804 18.6039 133.746 18.5094C133.629 18.3206 133.551 18.1128 133.551 17.8861C133.551 16.904 134.504 15.9408 137.071 15.9408C139.637 15.9408 140.123 16.4318 140.882 16.9418C140.979 17.0173 141.095 17.074 141.173 17.1495C141.231 17.1873 141.27 17.244 141.329 17.3006C141.465 17.4329 141.601 17.584 141.718 17.735C141.756 17.7917 141.795 17.8484 141.815 17.8861C141.912 18.0372 142.009 18.2072 142.068 18.3772H149.106C149.067 18.1883 149.009 17.9995 148.97 17.8295C148.912 17.6028 148.834 17.3951 148.756 17.1873C148.639 16.8662 148.503 16.564 148.367 16.2618C148.289 16.0919 148.192 15.9219 148.114 15.7708C147.842 15.2797 147.531 14.8264 147.181 14.392C145.529 12.39 142.456 10.3502 137.09 10.3502C131.724 10.3502 126.299 14.0143 126.299 17.905C126.299 21.7958 127.563 22.3624 129.352 23.5712C129.449 23.6467 129.565 23.7034 129.663 23.7789C129.76 23.8356 129.876 23.9112 129.974 23.9678C130.013 23.9867 130.071 24.0245 130.11 24.0434C130.285 24.1378 130.44 24.2134 130.615 24.3078C130.751 24.3833 130.888 24.44 131.043 24.4967C131.238 24.5911 131.451 24.6666 131.665 24.7422C132.482 25.0444 133.357 25.2899 134.212 25.4599C135.671 25.7621 137.129 26.0454 138.412 26.3476C140.318 26.8198 141.776 27.3675 142.068 28.3119C142.106 28.4252 142.106 28.5196 142.106 28.633C142.106 30.1439 141.095 31.0694 137.829 31.0694C134.562 31.0694 137.732 31.0694 137.693 31.0694C137.498 31.0694 137.304 31.0694 137.109 31.0505C137.071 31.0505 137.032 31.0505 136.973 31.0505C136.74 31.0316 136.507 30.9939 136.293 30.9561C135.612 30.8239 135.029 30.6161 134.562 30.3706C134.096 30.125 133.707 29.8228 133.415 29.5395C133.221 29.3507 133.221 29.3507 133.415 29.5395C132.968 29.1051 132.56 28.5763 132.307 27.9341H125.016C125.463 29.5395 126.221 31.0127 127.271 32.316C127.718 32.8826 128.243 33.4303 128.885 33.9403C129.313 34.2802 129.313 34.2802 128.885 33.9403C129.04 34.0725 129.215 34.1858 129.371 34.318C129.546 34.4502 129.721 34.5635 129.915 34.6769C130.013 34.7335 130.11 34.7902 130.207 34.8468C130.304 34.9035 130.401 34.9602 130.499 35.0168C130.693 35.1301 130.907 35.2246 131.121 35.3379C131.238 35.3946 131.374 35.4512 131.51 35.5079C131.704 35.5834 131.879 35.659 132.074 35.7345C132.968 36.0745 133.96 36.3389 135.068 36.49C135.282 36.5278 135.515 36.5467 135.729 36.5845C136.371 36.66 137.071 36.6978 137.79 36.6978C139.89 36.6978 141.737 3
81986.3956 143.273 35.8479C143.623 35.7345 143.934 35.6023 144.265 35.4512C144.42 35.3757 144.576 35.3001 144.731 35.2246C145.023 35.0735 145.315 34.9224 145.587 34.7335C146.131 34.3935 146.617 34.0158 147.045 33.6192C147.473 33.2225 147.842 32.7881 148.153 32.3348C148.231 32.2215 148.309 32.1082 148.367 31.976C148.503 31.7493 148.62 31.5038 148.737 31.2583C149.126 30.4272 149.32 29.5207 149.32 28.633C149.32 27.7453 149.184 26.952 148.931 26.2532L148.97 26.2154Z",fill:"#1A1A1A"}),(0,I.jsx)("path",{d:"M195.828 1.43542V35.9234H199.27V1.43542H195.828Z",fill:"#1A1A1A"}),(0,I.jsx)("path",{d:"M193.049 35.9045H189.296L179.749 4.13629H175.141L169.522 22.8157L167.675 24.61H168.977L165.594 35.9045H161.822L172.4 1.43542H182.491L193.049 35.9045Z",fill:"#1A1A1A"}),(0,I.jsx)("path",{d:"M169.523 22.8157L168.978 24.61H167.676L169.523 22.8157Z",fill:"#1A1A1A"}),(0,I.jsx)("path",{d:"M185.058 24.61H167.676L169.523 22.8157L170.728 21.6447H184.164L185.058 24.61Z",fill:"#1A1A1A"}),(0,I.jsx)("path",{d:"M260.79 32.8259V35.9045H254.879L251.826 33.2037V1.09546H255.268V32.8259H260.79Z",fill:"#1A1A1A"}),(0,I.jsx)("path",{d:"M247.996 23.6279L247.957 23.7412C247.18 26.2343 246.032 28.4063 244.399 30.3895C241.949 33.3925 237.516 36.9811 230.186 36.9811C222.856 36.9811 220.367 35.1302 216.964 31.7682C213.542 28.3874 211.656 23.6656 211.656 18.4906C211.656 13.3155 213.542 8.59367 216.964 5.21286C220.367 1.85094 225.053 0 230.186 0C235.319 0 241.794 3.39969 244.244 6.25166C245.799 8.1026 246.927 10.1613 247.685 12.5033L247.724 12.6355H244.185V12.5789C243.485 10.8224 242.513 9.25472 241.269 7.87596C238.391 4.75957 234.658 3.17305 230.166 3.17305C221.32 3.17305 215.156 9.48137 215.156 18.4906C215.156 27.4997 221.32 33.827 230.166 33.827C239.013 33.827 238.566 32.1271 241.463 28.7841C242.727 27.3109 243.699 25.6488 244.419 23.6845V23.6279H247.977H247.996Z",fill:"#1A1A1A"}),(0,I.jsx)("path",{d:"M274.691 10.4446C267.185 10.4446 261.527 16.0541 261.527 23.4768C261.527 30.8994 267.185 36.5089 274.691 36.5089C282.196 36.5089 287.854 30.8994 287.854 23.4768C287.854 16.0541 282.196 10.4446 274.691 10.4446ZM274.691 33.5814C271.968 33.5814 269.48 32.5804 267.652 30.7483C265.805 28.8974 264.794 26.3098 264.794 23.4768C264.794 20.6437 265.805 18.0561 267.652 16.2052C269.46 14.3731 271.968 13.3721 274.691 13.3721C280.329 13.3721 284.587 17.7162 284.587 23.4768C284.587 29.2374 280.329 33.5814 274.691 33.5814Z",fill:"#1A1A1A"}),(0,I.jsx)("path",{d:"M338.213 1.00101V15.7141C337.066 13.6365 333.916 10.4446 328.569 10.4446C323.222 10.4446 316.184 16.1674 316.184 23.4768C316.184 30.7861 321.628 36.5089 328.569 36.5089C335.51 36.5089 337.066 33.317 338.213 31.2394V36.0179H341.48V1.00101H338.213ZM338.213 23.4768C338.213 29.7095 333.352 33.5814 328.841 33.5814C324.33 33.5814 319.47 29.1429 319.47 23.4768C319.47 17.8106 323.592 13.3721 328.841 13.3721C334.091 13.3721 338.213 17.2251 338.213 23.4768Z",fill:"#1A1A1A"}),(0,I.jsx)("path",{d:"M313.132 10.9546V36.0179H309.866V31.976C308.952 33.5059 306.463 36.5278 300.747 36.5278C295.03 36.5278 295.458 35.5457 293.689 33.6759C291.88 31.7494 290.908 29.0107 290.908 25.7433V10.9546H294.175V25.7244C294.175 30.7295 296.761 33.5814 301.252 33.5814C305.744 33.5814 309.866 29.7662 309.866 24.7233V10.9546H313.132Z",fill:"#1A1A1A"})]}),nN={CONFIG035:"An organization by this name already exists.",GEN001:"Something went wrong. Please try again later.",BANNED_DOMAIN:"Registrations from this email domain are not allowed.",USER_EXISTS:"You appear to already have an account. Please log in instead.",IP_NOT_ALLOWED:"Registrations via this form from your IP address are not allowed.",ORG_NAME_EXISTS:"An organization by this name already exists.",CAPTCHA_INVALID:"Captcha verification failed or expired. Please try again."};function nF(e,t){return function(){return e.apply(t,arguments)}}let{toString:nj}=Object.prototype,{getPrototypeOf:nU}=Object,{iterator:nV,toStringTag:nW}=Symbol,nH=(a=Object.create(null),e=>{let t=nj.call(e);return a[t]||(a[t]=t.slice(8,-1).toLowerCase())}),nG=e=>(e=e.toLowerCase(),t=>nH(t)===e),nq=e=>t=>typeof t===e,{isArray:nX}=Array,nY=nq("undefined");function nQ(e){return null!==e&&!nY(e)&&null!==e.constructor&&!nY(e.constructor)&&nJ(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}let nZ=nG("ArrayBuffer"),nK=nq("string"),nJ=nq("function"),n$=nq("number"),n0=e=>null!==e&&"object"==typeof e,n1=e=>{if("object"!==nH(e))return!1;let t=nU(e);return(null===t||t===Object.prototype||null===Object.getPrototypeOf(t))&&!(nW in e)&&!(nV in e)},n2=nG("Date"),n3=nG("File"),n4=nG("Blob"),n5=nG("FileList"),n6=nG("URLSearchParams"),[n8,n9,n7,oe]=["ReadableStream","Request","Response","Headers"].map(nG);function ot(e,t,{allOwnKeys:i=!1}
8198={}){let r,s;if(null!=e)if("object"!=typeof e&&(e=[e]),nX(e))for(r=0,s=e.length;r<s;r++)t.call(null,e[r],r,e);else{let s;if(nQ(e))return;let a=i?Object.getOwnPropertyNames(e):Object.keys(e),o=a.length;for(r=0;r<o;r++)s=a[r],t.call(null,e[s],s,e)}}function oi(e,t){let i;if(nQ(e))return null;t=t.toLowerCase();let r=Object.keys(e),s=r.length;for(;s-- >0;)if(t===(i=r[s]).toLowerCase())return i;return null}let or="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:e.g,os=e=>!nY(e)&&e!==or,oa=(o="u">typeof Uint8Array&&nU(Uint8Array),e=>o&&e instanceof o),on=nG("HTMLFormElement"),oo=(({hasOwnProperty:e})=>(t,i)=>e.call(t,i))(Object.prototype),ol=nG("RegExp"),oh=(e,t)=>{let i=Object.getOwnPropertyDescriptors(e),r={};ot(i,(i,s)=>{let a;!1!==(a=t(i,s,e))&&(r[s]=a||i)}),Object.defineProperties(e,r)},oc=nG("AsyncFunction"),od=(d="function"==typeof setImmediate,u=nJ(or.postMessage),d?setImmediate:u?(p=`axios@${Math.random()}`,f=[],or.addEventListener("message",({source:e,data:t})=>{e===or&&t===p&&f.length&&f.shift()()},!1),e=>{f.push(e),or.postMessage(p,"*")}):e=>
8198setTimeout(e)),ou="u">typeof queueMicrotask?queueMicrotask.bind(or):void 0!==L.default&&L.default.nextTick||od,op={isArray:nX,isArrayBuffer:nZ,isBuffer:nQ,isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||nJ(e.append)&&("formdata"===(t=nH(e))||"object"===t&&nJ(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){return"u">typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&nZ(e.buffer)},isString:nK,isNumber:n$,isBoolean:e=>!0===e||!1===e,isObject:n0,isPlainObject:n1,isEmptyObject:e=>{if(!n0(e)||nQ(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:n8,isRequest:n9,isResponse:n7,isHeaders:oe,isUndefined:nY,isDate:n2,isFile:n3,isBlob:n4,isRegExp:ol,isFunction:nJ,isStream:e=>n0(e)&&nJ(e.pipe),isURLSearchParams:n6,isTypedArray:oa,isFileList:n5,forEach:ot,merge:function e(){let{caseless:t,skipUndefined:i}=os(this)&&this||{},r={},s=(s,a)=>{let o=t&&oi(r,a)||a;n1(r[o])&&n1(s)?r[o]=e(r[o],s):n1(s)?r[o]=e({},s):nX(s)?r[o]=s.slice():i&&nY(s)||(r[o]=s)};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&ot(arguments[e],s);return r},extend:(e,t,i,{allOwnKeys:r}={})=>(ot(t,(t,r)=>{i&&nJ(t)?e[r]=nF(t,i):e[r]=t},{allOwnKeys:r}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,i,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),i&&Object.assign(e.prototype,i)},toFlatObject:(e,t,i,r)=>{let s,a,o,h={};if(t=t||{},null==e)return t;do{for(a=(s=Object.getOwnPropertyNames(e)).length;a-- >0;)o=s[a],(!r||r(o,e,t))&&!h[o]&&(t[o]=e[o],h[o]=!0);e=!1!==i&&nU(e)}while(e&&(!i||i(e,t))&&e!==Object.prototype)return t},kindOf:nH,kindOfTest:nG,endsWith:(e,t,i)=>{e=String(e),(void 0===i||i>e.length)&&(i=e.length),i-=t.length;let r=e.indexOf(t,i);return -1!==r&&r===i},toArray:e=>{if(!e)return null;if(nX(e))return e;let t=e.length;if(!n$(t))return null;let i=Array(t);for(;t-- >0;)i[t]=e[t];return i},forEachEntry:(e,t)=>{let i,r=(e&&e[nV]).call(e);for(;(i=r.next())&&!i.done;){let r=i.value;t.call(e,r[0],r[1])}},matchAll:(e,t)=>{let i,r=[];for(;null!==(i=e.exec(t));)r.push(i);return r},isHTMLForm:on,hasOwnProperty:oo,hasOwnProp:oo,reduceDescriptors:oh,freezeMethods:e=>{oh(e,(t,i)=>{if(nJ(e)&&-1!==["arguments","caller","callee"].indexOf(i))return!1;if(nJ(e[i])){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+i+"'")})}})},toObjectSet:(e,t)=>{let i={};return(nX(e)?e:String(e).split(t)).forEach(e=>{i[e]=!0}),i},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,t,i){return t.toUpperCase()+i}),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e*=1)?e:t,findKey:oi,global:or,isContextDefined:os,isSpecCompliantForm:function(e){return!!(e&&nJ(e.append)&&"FormData"===e[nW]&&e[nV])},toJSONObject:e=>{let t=Array(10),i=(e,r)=>{if(n0(e)){if(t.indexOf(e)>=0)return;if(nQ(e))return e;if(!("toJSON"in e)){t[r]=e;let s=nX(e)?[]:{};return ot(e,(e,t)=>{let a=i(e,r+1);nY(a)||(s[t]=a)}),t[r]=void 0,s}}return e};return i(e,0)},isAsyncFn:oc,isThenable:e=>e&&(n0(e)||nJ(e))&&nJ(e.then)&&nJ(e.catch),setImmediate:od,asap:ou,isIterable:e=>null!=e&&nJ(e[nV])};var of=e.i(512533);function om(e,t,i,r,s){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),i&&(this.config=i),r&&(this.request=r),s&&(this.response=s,this.status=s.status?s.status:null)}op.inherits(om,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:op.toJSONObject(this.config),code:this.code,status:this.status}}});let og=om.prototype,ov={};function oy(e){return op.isPlainObject(e)||op.isArray(e)}function ox(e){return op.endsWith(e,"[]")?e.slice(0,-2):e}function ob(e,t,i){return e?e.concat(t).map(function(e,t){return e=ox(e),!i&&t?"["+e+"]":e}).join(i?".":""):t}["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","E
8198RR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{ov[e]={value:e}}),Object.defineProperties(om,ov),Object.defineProperty(og,"isAxiosError",{value:!0}),om.from=(e,t,i,r,s,a)=>{let o=Object.create(og);op.toFlatObject(e,o,function(e){return e!==Error.prototype},e=>"isAxiosError"!==e);let h=e&&e.message?e.message:"Error",c=null==t&&e?e.code:t;return om.call(o,h,c,i,r,s),e&&null==o.cause&&Object.defineProperty(o,"cause",{value:e,configurable:!0}),o.name=e&&e.name||"Error",a&&Object.assign(o,a),o};let ow=op.toFlatObject(op,{},null,function(e){return/^is[A-Z]/.test(e)}),o_=function(e,t,i){if(!op.isObject(e))throw TypeError("target must be an object");t=t||new FormData;let r=(i=op.toFlatObject(i,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!op.isUndefined(t[e])})).metaTokens,s=i.visitor||d,a=i.dots,o=i.indexes,h=(i.Blob||"u">typeof Blob&&Blob)&&op.isSpecCompliantForm(t);if(!op.isFunction(s))throw TypeError("visitor must be a function");function c(e){if(null===e)return"";if(op.isDate(e))return e.toISOString();if(op.isBoolean(e))return e.toString();if(!h&&op.isBlob(e))throw new om("Blob is not supported. Use a Buffer instead.");return op.isArrayBuffer(e)||op.isTypedArray(e)?h&&"function"==typeof Blob?new Blob([e]):of.Buffer.from(e):e}function d(e,i,s){let h=e;if(e&&!s&&"object"==typeof e)if(op.endsWith(i,"{}"))i=r?i:i.slice(0,-2),e=JSON.stringify(e);else{var d;if(op.isArray(e)&&(d=e,op.isArray(d)&&!d.some(oy))||(op.isFileList(e)||op.endsWith(i,"[]"))&&(h=op.toArray(e)))return i=ox(i),h.forEach(function(e,r){op.isUndefined(e)||null===e||t.append(!0===o?ob([i],r,a):null===o?i:i+"[]",c(e))}),!1}return!!oy(e)||(t.append(ob(s,i,a),c(e)),!1)}let u=[],p=Object.assign(ow,{defaultVisitor:d,convertValue:c,isVisitable:oy});if(!op.isObject(e))throw TypeError("data must be an object");return!function e(i,r){if(!op.isUndefined(i)){if(-1!==u.indexOf(i))throw Error("Circular reference detected in "+r.join("."));u.push(i),op.forEach(i,function(i,a){!0===(!(op.isUndefined(i)||null===i)&&s.call(t,i,op.isString(a)?a.trim():a,r,p))&&e(i,r?r.concat(a):[a])}),u.pop()}}(e),t};function oS(e){let t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}function oC(e,t){this._pairs=[],e&&o_(e,this,t)}let oM=oC.prototype;function oE(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function oA(e,t,i){let r;if(!t)return e;let s=i&&i.encode||oE;op.isFunction(i)&&(i={serialize:i});let a=i&&i.serialize;if(r=a?a(t,i):op.isURLSearchParams(t)?t.toString():new oC(t,i).toString(s)){let t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+r}return e}oM.append=function(e,t){this._pairs.push([e,t])},oM.toString=function(e){let t=e?function(t){return e.call(this,t,oS)}:oS;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};let oT=class{constructor(){this.handlers=[]}use(e,t,i){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!i&&i.synchronous,runWhen:i?i.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){op.forEach(this.handlers,function(t){null!==t&&e(t)})}},oP={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},oD="u">typeof URLSearchParams?URLSearchParams:oC,oO="u">typeof FormData?FormData:null,oL="u">typeof Blob?Blob:null,oI="u">typeof window&&"u">typeof document,oR="object"==typeof navigator&&navigator||void 0,ok=oI&&(!oR||0>["ReactNative","NativeScript","NS"].indexOf(oR.product)),oB="u">typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,oz=oI&&window.location.href||"http://localhost";e.s(["hasBrowserEnv",0,oI,"hasStandardBrowserEnv",0,ok,"hasStandardBrowserWebWorkerEnv",0,oB,"navigator",0,oR,"origin",0,oz],79098);let oN={...e.i(79098),isBrowser:!0,classes:{URLSearchParams:oD,FormData:oO,Blob:oL},protocols:["http","https","file","blob","url","data"]},oF=function(e){if(op.isFormData(e)&&op.isFunction(e.entries)){let t={};
8198return op.forEachEntry(e,(e,i)=>{!function e(t,i,r,s){let a=t[s++];if("__proto__"===a)return!0;let o=Number.isFinite(+a),h=s>=t.length;return(a=!a&&op.isArray(r)?r.length:a,h)?op.hasOwnProp(r,a)?r[a]=[r[a],i]:r[a]=i:(r[a]&&op.isObject(r[a])||(r[a]=[]),e(t,i,r[a],s)&&op.isArray(r[a])&&(r[a]=function(e){let t,i,r={},s=Object.keys(e),a=s.length;for(t=0;t<a;t++)r[i=s[t]]=e[i];return r}(r[a]))),!o}(op.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0]),i,t,0)}),t}return null},oj={transitional:oP,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){let i,r=t.getContentType()||"",s=r.indexOf("application/json")>-1,a=op.isObject(e);if(a&&op.isHTMLForm(e)&&(e=new FormData(e)),op.isFormData(e))return s?JSON.stringify(oF(e)):e;if(op.isArrayBuffer(e)||op.isBuffer(e)||op.isStream(e)||op.isFile(e)||op.isBlob(e)||op.isReadableStream(e))return e;if(op.isArrayBufferView(e))return e.buffer;if(op.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();if(a){if(r.indexOf("application/x-www-form-urlencoded")>-1){var o,h;return(o=e,h=this.formSerializer,o_(o,new oN.classes.URLSearchParams,{visitor:function(e,t,i,r){return oN.isNode&&op.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)},...h})).toString()}if((i=op.isFileList(e))||r.indexOf("multipart/form-data")>-1){let t=this.env&&this.env.FormData;return o_(i?{"files[]":e}:e,t&&new t,this.formSerializer)}}if(a||s){t.setContentType("application/json",!1);var c=e;if(op.isString(c))try{return(0,JSON.parse)(c),op.trim(c)}catch(e){if("SyntaxError"!==e.name)throw e}return(0,JSON.stringify)(c)}return e}],transformResponse:[function(e){let t=this.transitional||oj.transitional,i=t&&t.forcedJSONParsing,r="json"===this.responseType;if(op.isResponse(e)||op.isReadableStream(e))return e;if(e&&op.isString(e)&&(i&&!this.responseType||r)){let i=t&&t.silentJSONParsing;try{return JSON.parse(e,this.parseReviver)}catch(e){if(!i&&r){if("SyntaxError"===e.name)throw om.from(e,om.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:oN.classes.FormData,Blob:oN.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};op.forEach(["delete","get","head","post","put","patch"],e=>{oj.headers[e]={}});let oU=op.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),oV=Symbol("internals");function oW(e){return e&&String(e).trim().toLowerCase()}function oH(e){return!1===e||null==e?e:op.isArray(e)?e.map(oH):String(e)}function oG(e,t,i,r,s){if(op.isFunction(r))return r.call(this,t,i);if(s&&(t=i),op.isString(t)){if(op.isString(r))return -1!==t.indexOf(r);if(op.isRegExp(r))return r.test(t)}}class oq{constructor(e){e&&this.set(e)}set(e,t,i){let r=this;function s(e,t,i){let s=oW(t);if(!s)throw Error("header name must be a non-empty string");let a=op.findKey(r,s);a&&void 0!==r[a]&&!0!==i&&(void 0!==i||!1===r[a])||(r[a||t]=oH(e))}let a=(e,t)=>op.forEach(e,(e,i)=>s(e,i,t));if(op.isPlainObject(e)||e instanceof this.constructor)a(e,t);else{let r;if(op.isString(e)&&(e=e.trim())&&(r=e,!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(r.trim()))){var o;let i,r,s,h;a((h={},(o=e)&&o.split("\n").forEach(function(e){s=e.indexOf(":"),i=e.substring(0,s).trim().toLowerCase(),r=e.substring(s+1).trim(),!i||h[i]&&oU[i]||("set-cookie"===i?h[i]?h[i].push(r):h[i]=[r]:h[i]=h[i]?h[i]+", "+r:r)}),h),t)}else if(op.isObject(e)&&op.isIterable(e)){let i={},r,s;for(let t of e){if(!op.isArray(t))throw TypeError("Object iterator must return a key-value pair");i[s=t[0]]=(r=i[s])?op.isArray(r)?[...r,t[1]]:[r,t[1]]:t[1]}a(i,t)}else null!=e&&s(t,e,i)}return this}get(e,t){if(e=oW(e)){let i=op.findKey(this,e);if(i){let e=this[i];if(!t)return e;if(!0===t){let t,i=Object.create(null),r=/([^\s,;
8198=]+)\s*(?:=\s*([^,;]+))?/g;for(;t=r.exec(e);)i[t[1]]=t[2];return i}if(op.isFunction(t))return t.call(this,e,i);if(op.isRegExp(t))return t.exec(e);throw TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=oW(e)){let i=op.findKey(this,e);return!!(i&&void 0!==this[i]&&(!t||oG(this,this[i],i,t)))}return!1}delete(e,t){let i=this,r=!1;function s(e){if(e=oW(e)){let s=op.findKey(i,e);s&&(!t||oG(i,i[s],s,t))&&(delete i[s],r=!0)}}return op.isArray(e)?e.forEach(s):s(e),r}clear(e){let t=Object.keys(this),i=t.length,r=!1;for(;i--;){let s=t[i];(!e||oG(this,this[s],s,e,!0))&&(delete this[s],r=!0)}return r}normalize(e){let t=this,i={};return op.forEach(this,(r,s)=>{let a=op.findKey(i,s);if(a){t[a]=oH(r),delete t[s];return}let o=e?s.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,i)=>t.toUpperCase()+i):String(s).trim();o!==s&&delete t[s],t[o]=oH(r),i[o]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){let t=Object.create(null);return op.forEach(this,(i,r)=>{null!=i&&!1!==i&&(t[r]=e&&op.isArray(i)?i.join(", "):i)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join("\n")}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){let i=new this(e);return t.forEach(e=>i.set(e)),i}static accessor(e){let t=(this[oV]=this[oV]={accessors:{}}).accessors,i=this.prototype;function r(e){let r=oW(e);if(!t[r]){let s;s=op.toCamelCase(" "+e),["get","set","has"].forEach(t=>{Object.defineProperty(i,t+s,{value:function(i,r,s){return this[t].call(this,e,i,r,s)},configurable:!0})}),t[r]=!0}}return op.isArray(e)?e.forEach(r):r(e),this}}function oX(e,t){let i=this||oj,r=t||i,s=oq.from(r.headers),a=r.data;return op.forEach(e,function(e){a=e.call(i,a,s.normalize(),t?t.status:void 0)}),s.normalize(),a}function oY(e){return!!(e&&e.__CANCEL__)}function oQ(e,t,i){om.call(this,null==e?"canceled":e,om.ERR_CANCELED,t,i),this.name="CanceledError"}function oZ(e,t,i){let r=i.config.validateStatus;!i.status||!r||r(i.status)?e(i):t(new om("Request failed with status code "+i.status,[om.ERR_BAD_REQUEST,om.ERR_BAD_RESPONSE][Math.floor(i.status/100)-4],i.config,i.request,i))}oq.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),op.reduceDescriptors(oq.prototype,({value:e},t)=>{let i=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[i]=e}}}),op.freezeMethods(oq),op.inherits(oQ,om,{__CANCEL__:!0});let oK=function(e,t){let i,r=Array(e=e||10),s=Array(e),a=0,o=0;return t=void 0!==t?t:1e3,function(h){let c=Date.now(),d=s[o];i||(i=c),r[a]=h,s[a]=c;let u=o,p=0;for(;u!==a;)p+=r[u++],u%=e;if((a=(a+1)%e)===o&&(o=(o+1)%e),c-i<t)return;let f=d&&c-d;return f?Math.round(1e3*p/f):void 0}},oJ=function(e,t){let i,r,s=0,a=1e3/t,o=(t,a=Date.now())=>{s=a,i=null,r&&(clearTimeout(r),r=null),e(...t)};return[(...e)=>{let t=Date.now(),h=t-s;h>=a?o(e,t):(i=e,r||(r=setTimeout(()=>{r=null,o(i)},a-h)))},()=>i&&o(i)]},o$=(e,t,i=3)=>{let r=0,s=oK(50,250);return oJ(i=>{let a=i.loaded,o=i.lengthComputable?i.total:void 0,h=a-r,c=s(h);r=a,e({loaded:a,total:o,progress:o?a/o:void 0,bytes:h,rate:c||void 0,estimated:c&&o&&a<=o?(o-a)/c:void 0,event:i,lengthComputable:null!=o,[t?"download":"upload"]:!0})},i)},o0=(e,t)=>{let i=null!=e;return[r=>t[0]({lengthComputable:i,total:e,loaded:r}),t[1]]},o1=e=>(...t)=>op.asap(()=>e(...t)),o2=oN.hasStandardBrowserEnv?(h=new URL(oN.origin),c=oN.navigator&&/(msie|trident)/i.test(oN.navigator.userAgent),e=>(e=new URL(e,oN.origin),h.protocol===e.protocol&&h.host===e.host&&(c||h.port===e.port))):()=>!0,o3=oN.hasStandardBrowserEnv?{write(e,t,i,r,s,a){let o=[e+"="+encodeURIComponent(t)];op.isNumber(i)&&o.push("expires="+new Date(i).toGMTString()),op.isString(r)&&o.push("path="+r),op.isString(s)&&o.push("domain="+s),!0===a&&o.push("secure"),document.cookie=o.join("; ")},read(e){let t=document.cookie.match(RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read:()=>null,remove(){}};function o4(e,t,i){let r=!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t);return e&&(r||!1==i)?t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e:t}let o5=e=>e instanceof oq?{...e}:e;function o6(e,t){t=t||{};let i={};function r(e,t,i,r){return op.isPlainObject(e)&&op.isPlainObject(t)?op.merge.call({caseless:r},e,t):op.isPlainObject(t)?op.merge({},t):op.isArray(t)?t.slice():t}
8198function s(e,t,i,s){return op.isUndefined(t)?op.isUndefined(e)?void 0:r(void 0,e,i,s):r(e,t,i,s)}function a(e,t){if(!op.isUndefined(t))return r(void 0,t)}function o(e,t){return op.isUndefined(t)?op.isUndefined(e)?void 0:r(void 0,e):r(void 0,t)}function h(i,s,a){return a in t?r(i,s):a in e?r(void 0,i):void 0}let c={url:a,method:a,data:a,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:h,headers:(e,t,i)=>s(o5(e),o5(t),i,!0)};return op.forEach(Object.keys({...e,...t}),function(r){let a=c[r]||s,o=a(e[r],t[r],r);op.isUndefined(o)&&a!==h||(i[r]=o)}),i}let o8=e=>{let t=o6({},e),{data:i,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:a,headers:o,auth:h}=t;if(t.headers=o=oq.from(o),t.url=oA(o4(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),h&&o.set("Authorization","Basic "+btoa((h.username||"")+":"+(h.password?unescape(encodeURIComponent(h.password)):""))),op.isFormData(i)){if(oN.hasStandardBrowserEnv||oN.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if(op.isFunction(i.getHeaders)){let e=i.getHeaders(),t=["content-type","content-length"];Object.entries(e).forEach(([e,i])=>{t.includes(e.toLowerCase())&&o.set(e,i)})}}if(oN.hasStandardBrowserEnv&&(r&&op.isFunction(r)&&(r=r(t)),r||!1!==r&&o2(t.url))){let e=s&&a&&o3.read(a);e&&o.set(s,e)}return t},o9="u">typeof XMLHttpRequest&&function(e){return new Promise(function(t,i){var r;let s,a,o,h,c,d,u=o8(e),p=u.data,f=oq.from(u.headers).normalize(),{responseType:m,onUploadProgress:g,onDownloadProgress:v}=u;function y(){h&&h(),c&&c(),u.cancelToken&&u.cancelToken.unsubscribe(s),u.signal&&u.signal.removeEventListener("abort",s)}let x=new XMLHttpRequest;function b(){if(!x)return;let r=oq.from("getAllResponseHeaders"in x&&x.getAllResponseHeaders());oZ(function(e){t(e),y()},function(e){i(e),y()},{data:m&&"text"!==m&&"json"!==m?x.response:x.responseText,status:x.status,statusText:x.statusText,headers:r,config:e,request:x}),x=null}x.open(u.method.toUpperCase(),u.url,!0),x.timeout=u.timeout,"onloadend"in x?x.onloadend=b:x.onreadystatechange=function(){!x||4!==x.readyState||(0!==x.status||x.responseURL&&0===x.responseURL.indexOf("file:"))&&setTimeout(b)},x.onabort=function(){x&&(i(new om("Request aborted",om.ECONNABORTED,e,x)),x=null)},x.onerror=function(t){let r=new om(t&&t.message?t.message:"Network Error",om.ERR_NETWORK,e,x);r.event=t||null,i(r),x=null},x.ontimeout=function(){let t=u.timeout?"timeout of "+u.timeout+"ms exceeded":"timeout exceeded",r=u.transitional||oP;u.timeoutErrorMessage&&(t=u.timeoutErrorMessage),i(new om(t,r.clarifyTimeoutError?om.ETIMEDOUT:om.ECONNABORTED,e,x)),x=null},void 0===p&&f.setContentType(null),"setRequestHeader"in x&&op.forEach(f.toJSON(),function(e,t){x.setRequestHeader(t,e)}),op.isUndefined(u.withCredentials)||(x.withCredentials=!!u.withCredentials),m&&"json"!==m&&(x.responseType=u.responseType),v&&([o,c]=o$(v,!0),x.addEventListener("progress",o)),g&&x.upload&&([a,h]=o$(g),x.upload.addEventListener("progress",a),x.upload.addEventListener("loadend",h)),(u.cancelToken||u.signal)&&(s=t=>{x&&(i(!t||t.type?new oQ(null,e,x):t),x.abort(),x=null)},u.cancelToken&&u.cancelToken.subscribe(s),u.signal&&(u.signal.aborted?s():u.signal.addEventListener("abort",s)));let w=(r=u.url,(d=/^([-+\w]{1,25})(:?\/\/|:)/.exec(r))&&d[1]||"");w&&-1===oN.protocols.indexOf(w)?i(new om("Unsupported protocol "+w+":",om.ERR_BAD_REQUEST,e)):x.send(p||null)})},o7=function*(e,t){let i,r=e.byteLength;if(!t||r<t)return void(yield e);let s=0;for(;s<r;)i=s+t,yield e.slice(s,i),s=i},le=async function*(e,t){for await(let i of lt(e))yield*o7(i,t)},lt=async function*(e){if(e[Symbol.asyncIterator])return void(yield*e);let t=e.getReader();try{for(;;){let{done:e,value:i}=await t.read();if(e)break;yield i}}finally{await t.cancel()}},li=(e,t,i,r)=>{let s,a=le(e,t),o=0,h=e=>{!s&&(s=!0,r&&r(e))};return new ReadableStream({async pull(e){try{let{done:t,value:r}=await a.next();if(t){h(),e.close();return}let s=r.byteLength;if(i){let e=o+=s;i(e)}e.enqueue(new Uint8Array(r))}catch(e){throw h(e),e}},cancel:e=>(h(e),a.return())},{highWaterMark:2})},{isFunction:lr}=op,ls=(({Request:e,Response:t})=>({Request:e,Response:t}))(op.global),{ReadableStream:la,TextEncoder:ln}=op.global,lo=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},ll=e=>{let t,{fetch:i,Request:r,Response:s}=e=op.merge.call({skipUndefined:!0},ls,e),a=i?lr(i):"function"==typeof fetch,o=lr(r),h=lr(s);if(!a)return!1;
8198let c=a&&lr(la),d=a&&("function"==typeof ln?(t=new ln,e=>t.encode(e)):async e=>new Uint8Array(await new r(e).arrayBuffer())),u=o&&c&&lo(()=>{let e=!1,t=new r(oN.origin,{body:new la,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),p=h&&c&&lo(()=>op.isReadableStream(new s("").body)),f={stream:p&&(e=>e.body)};a&&["text","arrayBuffer","blob","formData","stream"].forEach(e=>{f[e]||(f[e]=(t,i)=>{let r=t&&t[e];if(r)return r.call(t);throw new om(`Response type '${e}' is not supported`,om.ERR_NOT_SUPPORT,i)})});let m=async e=>{if(null==e)return 0;if(op.isBlob(e))return e.size;if(op.isSpecCompliantForm(e)){let t=new r(oN.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return op.isArrayBufferView(e)||op.isArrayBuffer(e)?e.byteLength:(op.isURLSearchParams(e)&&(e+=""),op.isString(e))?(await d(e)).byteLength:void 0},g=async(e,t)=>{let i=op.toFiniteNumber(e.getContentLength());return null==i?m(t):i};return async e=>{let t,{url:a,method:h,data:c,signal:d,cancelToken:m,timeout:v,onDownloadProgress:y,onUploadProgress:x,responseType:b,headers:w,withCredentials:_="same-origin",fetchOptions:S}=o8(e),C=i||fetch;b=b?(b+"").toLowerCase():"text";let M=((e,t)=>{let{length:i}=e=e?e.filter(Boolean):[];if(t||i){let i,r=new AbortController,s=function(e){if(!i){i=!0,o();let t=e instanceof Error?e:this.reason;r.abort(t instanceof om?t:new oQ(t instanceof Error?t.message:t))}},a=t&&setTimeout(()=>{a=null,s(new om(`timeout ${t} of ms exceeded`,om.ETIMEDOUT))},t),o=()=>{e&&(a&&clearTimeout(a),a=null,e.forEach(e=>{e.unsubscribe?e.unsubscribe(s):e.removeEventListener("abort",s)}),e=null)};e.forEach(e=>e.addEventListener("abort",s));let{signal:h}=r;return h.unsubscribe=()=>
8198op.asap(o),h}})([d,m&&m.toAbortSignal()],v),E=null,A=M&&M.unsubscribe&&(()=>{M.unsubscribe()});try{if(x&&u&&"get"!==h&&"head"!==h&&0!==(t=await g(w,c))){let e,i=new r(a,{method:"POST",body:c,duplex:"half"});if(op.isFormData(c)&&(e=i.headers.get("content-type"))&&w.setContentType(e),i.body){let[e,r]=o0(t,o$(o1(x)));c=li(i.body,65536,e,r)}}op.isString(_)||(_=_?"include":"omit");let i=o&&"credentials"in r.prototype,d={...S,signal:M,method:h.toUpperCase(),headers:w.normalize().toJSON(),body:c,duplex:"half",credentials:i?_:void 0};E=o&&new r(a,d);let m=await (o?C(E,S):C(a,d)),v=p&&("stream"===b||"response"===b);if(p&&(y||v&&A)){let e={};["status","statusText","headers"].forEach(t=>{e[t]=m[t]});let t=op.toFiniteNumber(m.headers.get("content-length")),[i,r]=y&&o0(t,o$(o1(y),!0))||[];m=new s(li(m.body,65536,i,()=>{r&&r(),A&&A()}),e)}b=b||"text";let T=await f[op.findKey(f,b)||"text"](m,e);return!v&&A&&A(),await new Promise((t,i)=>{oZ(t,i,{data:T,headers:oq.from(m.headers),status:m.status,statusText:m.statusText,config:e,request:E})})}catch(t){if(A&&A(),t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message))throw Object.assign(new om("Network Error",om.ERR_NETWORK,e,E),{cause:t.cause||t});throw om.from(t,t&&t.code,e,E)}}},lh=new Map,lc=e=>{let t=e?e.env:{},{fetch:i,Request:r,Response:s}=t,a=[r,s,i],o=a.length,h,c,d=lh;for(;o--;)h=a[o],void 0===(c=d.get(h))&&d.set(h,c=o?new Map:ll(t)),d=c;return c};lc();let ld={http:null,xhr:o9,fetch:{get:lc}};op.forEach(ld,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}});let lu=e=>`- ${e}`,lp=e=>op.isFunction(e)||null===e||!1===e,lf=(e,t)=>{let i,r,{length:s}=e=op.isArray(e)?e:[e],a={};for(let o=0;o<s;o++){let s;if(r=i=e[o],!lp(i)&&void 0===(r=ld[(s=String(i)).toLowerCase()]))throw new om(`Unknown adapter '${s}'`);if(r&&(op.isFunction(r)||(r=r.get(t))))break;a[s||"#"+o]=r}if(!r){let e=Object.entries(a).map(([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build"));throw new om("There is no suitable adapter to dispatch the request "+(s?e.length>1?"since :\n"+e.map(lu).join("\n"):" "+lu(e[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return r};function lm(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new oQ(null,e)}function lg(e){return lm(e),e.headers=oq.from(e.headers),e.data=oX.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1),lf(e.adapter||oj.adapter,e)(e).then(function(t){return lm(e),t.data=oX.call(e,e.transformResponse,t),t.headers=oq.from(t.headers),t},function(t){return!oY(t)&&(lm(e),t&&t.response&&(t.response.data=oX.call(e,e.transformResponse,t.response),t.response.headers=oq.from(t.response.headers))),Promise.reject(t)})}let lv="1.12.2",ly={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{ly[e]=function(i){return typeof i===e||"a"+(t<1?"n ":" ")+e}});let lx={};ly.transitional=function(e,t,i){function r(e,t){return"[Axios v"+lv+"] Transitional option '"+e+"'"+t+(i?". "+i:"")}return(i,s,a)=>{if(!1===e)throw new om(r(s," has been removed"+(t?" in "+t:"")),om.ERR_DEPRECATED);return t&&!lx[s]&&(lx[s]=!0,console.warn(r(s," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(i,s,a)}},ly.spelling=function(e){return(t,i)=>(console.warn(`${i} is likely a misspelling of ${e}`),!0)};let lb=function(e,t,i){if("object"!=typeof e)throw new om("options must be an object",om.ERR_BAD_OPTION_VALUE);let r=Object.keys(e),s=r.length;for(;s-- >0;){let a=r[s],o=t[a];if(o){let t=e[a],i=void 0===t||o(t,a,e);if(!0!==i)throw new om("option "+a+" must be "+i,om.ERR_BAD_OPTION_VALUE);continue}if(!0!==i)throw new om("Unknown option "+a,om.ERR_BAD_OPTION)}};class lw{constructor(e){this.defaults=e||{},this.interceptors={request:new oT,response:new oT}}async request(e,t){try{return await this._request(e,t)}catch(e){if(e instanceof Error){let t={};Error.captureStackTrace?Error.captureStackTrace(t):t=Error();let i=t.stack?t.stack.replace(/^.+\n/,""):"";try{e.stack?i&&!String(e.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(e.stack+="\n"+i):e.stack=i}catch(e){}}throw e}}_request(e,t){let i,r;"string"==typeof e?(t=t||{}).url=e:t=e||{};let{transitional:s,paramsSerializer:a,headers:o}=t=o6(this.defaults,t);void 0!==s&&lb(s,{silentJSONParsing:ly.transitional(ly.boolean),forcedJSONParsing:ly.transitional(ly.boolean),clarifyTimeoutError:ly.transitional(ly.boolean)}
8198,!1),null!=a&&(op.isFunction(a)?t.paramsSerializer={serialize:a}:lb(a,{encode:ly.function,serialize:ly.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),lb(t,{baseUrl:ly.spelling("baseURL"),withXsrfToken:ly.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let h=o&&op.merge(o.common,o[t.method]);o&&op.forEach(["delete","get","head","post","put","patch","common"],e=>{delete o[e]}),t.headers=oq.concat(h,o);let c=[],d=!0;this.interceptors.request.forEach(function(e){("function"!=typeof e.runWhen||!1!==e.runWhen(t))&&(d=d&&e.synchronous,c.unshift(e.fulfilled,e.rejected))});let u=[];this.interceptors.response.forEach(function(e){u.push(e.fulfilled,e.rejected)});let p=0;if(!d){let e=[lg.bind(this),void 0];for(e.unshift(...c),e.push(...u),r=e.length,i=Promise.resolve(t);p<r;)i=i.then(e[p++],e[p++]);return i}r=c.length;let f=t;for(;p<r;){let e=c[p++],t=c[p++];try{f=e(f)}catch(e){t.call(this,e);break}}try{i=lg.call(this,f)}catch(e){return Promise.reject(e)}for(p=0,r=u.length;p<r;)i=i.then(u[p++],u[p++]);return i}getUri(e){return oA(o4((e=o6(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}}op.forEach(["delete","get","head","options"],function(e){lw.prototype[e]=function(t,i){return this.request(o6(i||{},{method:e,url:t,data:(i||{}).data}))}}),op.forEach(["post","put","patch"],function(e){function t(t){return function(i,r,s){return this.request(o6(s||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:i,data:r}))}}lw.prototype[e]=t(),lw.prototype[e+"Form"]=t(!0)});class l_{constructor(e){let t;if("function"!=typeof e)throw TypeError("executor must be a function.");this.promise=new Promise(function(e){t=e});const i=this;this.promise.then(e=>{if(!i._listeners)return;let t=i._listeners.length;for(;t-- >0;)i._listeners[t](e);i._listeners=null}),this.promise.then=e=>{let t,r=new Promise(e=>{i.subscribe(e),t=e}).then(e);return r.cancel=function(){i.unsubscribe(t)},r},e(function(e,r,s){i.reason||(i.reason=new oQ(e,r,s),t(i.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;let t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}toAbortSignal(){let e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;return{token:new l_(function(t){e=t}),cancel:e}}}let lS={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,Parti
8198alContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(lS).forEach(([e,t])=>{lS[t]=e});let lC=function e(t){let i=new lw(t),r=nF(lw.prototype.request,i);return op.extend(r,lw.prototype,i,{allOwnKeys:!0}),op.extend(r,i,null,{allOwnKeys:!0}),r.create=function(i){return e(o6(t,i))},r}(oj);lC.Axios=lw,lC.CanceledError=oQ,lC.CancelToken=l_,lC.isCancel=oY,lC.VERSION=lv,lC.toFormData=o_,lC.AxiosError=om,lC.Cancel=lC.CanceledError,lC.all=function(e){return Promise.all(e)},lC.spread=function(e){return function(t){return e.apply(null,t)}},lC.isAxiosError=function(e){return op.isObject(e)&&!0===e.isAxiosError},lC.mergeConfig=o6,lC.AxiosHeaders=oq,lC.formToJSON=e=>oF(op.isHTMLForm(e)?new FormData(e):e),lC.getAdapter=lf,lC.HttpStatusCode=lS,lC.default=lC;var lM=e.i(507251),lE=e.i(452878),lA=e.i(435764),lT=e.i(852756);e.s(["default",0,function({mainArea:e,successCopy:t,waitlistCopy:i,internalUseOnly:r}){let[s,a]=(0,k.useState)(""),[o,h]=(0,k.useState)(null),[c,d]=(0,k.useState)(!1),[u,p]=(0,k.useState)(t);(0,k.useEffect)(()=>{lE.hotjar.initialize({id:6523333,sv:6})},[]);let f=e=>{let t=e?.response?.data?.error;console.log(e);let i="An error occurred. Please try again.";t&&nN[t]&&(i=nN[t]),h(i)},m=[{fields:[{name:"organisationName",type:"text",label:"Organization name",placeholder:"Enter your company name"},{name:"firstName",type:"text",label:"First name",placeholder:"Enter your first name"},{name:"lastName",type:"text",label:"Last name",placeholder:"Enter your last name"},{name:"email",type:"email",label:"Email address",placeholder:"Enter your email"},{name:"termsAccepted",type:"checkbox",label:(0,I.jsxs)(I.Fragment,{children:["I accept the Firmus AI Console"," ",(0,I.jsx)(lT.default,{href:"/privacy-policy",children:"Terms & Privacy Policy"})]})}],validationSchema:rL({organisationName:rw().required("Company name is required"),firstName:rw().required("First name is required"),lastName:rw().required("Last name is required"),email:rw().email("Invalid email").required("Email is required"),termsAccepted:rc().oneOf([!0],"You must accept the terms & conditions").required("You must accept the terms & conditions")}),onSubmit:async(e,t)=>{a(e.firstName),t()}},{fields:[{name:"address",type:"address",label:"Organization Address",googleMapsApiKey:"AIzaSyAraCynncK7-MFUpLYqUIQgrvu0Gy_UrUU"},{name:"captcha",type:"captcha"}],validationSchema:rL({addressLine1:rw().required("Address line 1 is required"),addressLine2:rw(),city:rw().required("City is required"),state:rw().required("State is required"),country:rw().oneOf(["Australia","Singapore","Thailand"],"Please select Australia, Singapore, or Thailand").required("Country is required"),captcha:rw().required("Please complete the captcha verification"),postcode:rw().required("Postcode is required"),phone:rw().required("Phone number is required")}),onSubmit:async(e,s)=>{d(!0),h(null);try{let a={...e,password:((e=12)=>{let t="ABCDEFGHIJKLMNOPQRSTUVWXYZ",i="abcdefghijklmnopqrstuvwxyz",r="0123456789",s="!@#$%^&*()_+[]{}|;:,.<>?",a=[t[Math.floor(Math.random()*t.length)],i[Math.floor(Math.random()*i.length)],r[Math.floor(Math.random()*r.length)],s[Math.floor(Math.random()*s.length)]],o=t+i+r+s;for(let t=a.length;t<e;t++)a.push(o[Math.floor(Math.random()*o.length)]);for(let e=a.length-1;e>0;e--){let t=Math.floor(Math.random()*(e+1));[a[e],a[t]]=[a[t],a[e]]}return a.join("")})(),internalUseOnly:r},o=await lC.post("/api/createRafayOrganisation",a);o.data.success?("WAITLIST"===o.data.message?p(i):p(t),d(!1),s()):(d(!1),f(),console.error("Failed to create organisation:",o.data.message))}catch(e){d(!1),f(e)}}}];return(0,I.jsx)("section",{className:lA.default.CreateAccount,children:(0,I.jsxs)("div",{className:(0,rj.default)("container",lA.default.Cont),children:[(0,I.jsxs)("div",{className:lA.default.Intro,children:[nz,(0,I.jsx)(R.default,{copy:e?.copy,size:"small"})]}),(0,I.jsx)(nB,{stages:m,submitButtonText:"Create Account",formError:o,isLoading:c,successSlide:(0,I.jsxs)("div",{className:lA.default.Success,children:[(0,I.jsx)(lM.default,{src:"/favicon-light.svg",width:80,height:81,alt:"Firmus logo"}),(0,I.jsx)("h3",{children:u?.title?.replace("#FNAME#",s)}),(0,I.jsx)(R.default,{className:lA.default.Message,copy:u?.copy})]})})]})})}],813407)},25211,e=>{e.v({Arrow:"BenchmarkModel-module-scss-module__BPezxq__Arrow",BenchmarkModel:"BenchmarkModel-module-scss-module__BPezxq__BenchmarkModel",Chart:"BenchmarkModel-module-scss-module__BPezxq__Chart",Main:"BenchmarkModel-module-scss-module__BPezxq__Main",ResultsSection:"BenchmarkModel-module-scss-module__BPezxq__ResultsSection",ResultsSectionCopy:"BenchmarkModel-module-scss-module__BPezxq__ResultsSectionCopy",ResultsSectionTable:"BenchmarkModel-module-scss-module__BPezxq__ResultsSectionTable",ResultsSectionTableCont:"BenchmarkModel-module-scss-module__BPezxq__ResultsSectionTableCont",ResultsSectionTableTitle:"BenchmarkModel-module-scss-module__BPezxq__ResultsSectionTableTitle",ResultsSectionTables:"BenchmarkModel-module-scss-module__BPezxq__ResultsSectionTables",ResultsSectionTitle:"BenchmarkModel-module-scss-module__BPezxq__ResultsSectionTitle",ResultsSections:"BenchmarkModel-module-scss-module__BPezxq__ResultsSections",Section:"BenchmarkModel-module-scss-module__BPezxq__Section",SectionChartTags:"BenchmarkModel-module-scss-module__BPezxq__SectionChartTags",SectionCopy:"BenchmarkModel-module-scss-module__BPezxq__SectionCopy",SectionFootnote:"BenchmarkModel-module-scss-module__BPezxq__SectionFootnote",SectionImage:"BenchmarkModel-module-scss-module__BPezxq__SectionImage",SectionTitle:"BenchmarkModel-module-scss-module__BPezxq__SectionTitle",Sections:"BenchmarkModel-module-scss-module__BPezxq__Sections",Table:"BenchmarkModel-module-scss-module__BPezxq__Table",Tag:"BenchmarkModel-module-scss-module__BPezxq__Tag"})},633534,e=>{"use strict";let t,i;var r=e.i(395633),s=e.i(7284);function a(e){return e+.5|0}let o=(e,t,i)=>Math.max(Math.min(e,i),t);function h(e){return o(a(2.55*e),0,255)}function c(e){return o(a(255*e),0,255)}function d(e){return o(a(e/2.55)/100,0,1)}function u(e){return o(a(100*e),0,100)}let p={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},f=[..."0123456789ABCDEF"],m=e=>f[15&e],g=e=>f[(240&e)>>4]+f[15&e],v=e=>(240&e)>>4==(15&e),y=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function x(e,t,i){let r=t*Math.min(i,1-i),s=(t,s=(t+e/30)%12)=>i-r*Math.max(Math.min(s-3,9-s,1),-1);return[s(0),s(8),s(4)]}function b(e,t,i){let r=(r,s=(r+e/60)%6)=>i-i*t*Math.max(Math.min(s,4-s,1),0);return[r(5),r(3),r(1)]}function w(e,t,i){let r,s=x(e,1,.5);for(t+i>1&&(r=1/(t+i),t*=r,i*=r),r=0;r<3;r++)s[r]*=1-t-i,s[r]+=t;return s}function _(e){let t,i,r,s=e.r/255,a=e.g/255,o=e.b/255,h=Math.max(s,a,o),c=Math.min(s,a,o),d=(h+c)/2;h!==c&&(r=h-c,i=d>.5?r/(2-h-c):r/(h+c),t=60*(t=s===h?(a-o)/r+6*(a<o):a===h?(o-s)/r+2:(s-a)/r+4)+.5);return[0|t,i||0,d]}function S(e,t,i,r){return(Array.isArray(t)?e(t[0],t[1],t[2]):e(t,i,r)).map(c)}function C(e){return(e%360+360)%360}let M={x:"dark",Z:"light",Y:"re",X:"blu",W:"gr",V:"medium",U:"slate",A:"ee",T:"ol",S:"or",B:"ra",C:"lateg",D:"ights",R:"in",Q:"turquois",E:"hi",P:"ro",O:"al",N:"le",M:"de",L:"yello",F:"en",K:"ch",G:"arks",H:"ea",I:"ightg",J:"wh"},E={OiceXe:"f0f8ff",antiquewEte:"faebd7",aqua:"ffff",aquamarRe:"7fffd4",azuY:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"0",blanKedOmond:"ffebcd",Xe:"ff",XeviTet:"8a2be2",bPwn:"a52a2a",burlywood:"deb887",caMtXe:"5f9ea0",KartYuse:"7fff00",K
8198ocTate:"d2691e",cSO:"ff7f50",cSnflowerXe:"6495ed",cSnsilk:"fff8dc",crimson:"dc143c",cyan:"ffff",xXe:"8b",xcyan:"8b8b",xgTMnPd:"b8860b",xWay:"a9a9a9",xgYF:"6400",xgYy:"a9a9a9",xkhaki:"bdb76b",xmagFta:"8b008b",xTivegYF:"556b2f",xSange:"ff8c00",xScEd:"9932cc",xYd:"8b0000",xsOmon:"e9967a",xsHgYF:"8fbc8f",xUXe:"483d8b",xUWay:"2f4f4f",xUgYy:"2f4f4f",xQe:"ced1",xviTet:"9400d3",dAppRk:"ff1493",dApskyXe:"bfff",dimWay:"696969",dimgYy:"696969",dodgerXe:"1e90ff",fiYbrick:"b22222",flSOwEte:"fffaf0",foYstWAn:"228b22",fuKsia:"ff00ff",gaRsbSo:"dcdcdc",ghostwEte:"f8f8ff",gTd:"ffd700",gTMnPd:"daa520",Way:"808080",gYF:"8000",gYFLw:"adff2f",gYy:"808080",honeyMw:"f0fff0",hotpRk:"ff69b4",RdianYd:"cd5c5c",Rdigo:"4b0082",ivSy:"fffff0",khaki:"f0e68c",lavFMr:"e6e6fa",lavFMrXsh:"fff0f5",lawngYF:"7cfc00",NmoncEffon:"fffacd",ZXe:"add8e6",ZcSO:"f08080",Zcyan:"e0ffff",ZgTMnPdLw:"fafad2",ZWay:"d3d3d3",ZgYF:"90ee90",ZgYy:"d3d3d3",ZpRk:"ffb6c1",ZsOmon:"ffa07a",ZsHgYF:"20b2aa",ZskyXe:"87cefa",ZUWay:"778899",ZUgYy:"778899",ZstAlXe:"b0c4de",ZLw:"ffffe0",lime:"ff00",limegYF:"32cd32",lRF:"faf0e6",magFta:"ff00ff",maPon:"800000",VaquamarRe:"66cdaa",VXe:"cd",VScEd:"ba55d3",VpurpN:"9370db",VsHgYF:"3cb371",VUXe:"7b68ee",VsprRggYF:"fa9a",VQe:"48d1cc",VviTetYd:"c71585",midnightXe:"191970",mRtcYam:"f5fffa",mistyPse:"ffe4e1",moccasR:"ffe4b5",navajowEte:"ffdead",navy:"80",Tdlace:"fdf5e6",Tive:"808000",TivedBb:"6b8e23",Sange:"ffa500",SangeYd:"ff4500",ScEd:"da70d6",pOegTMnPd:"eee8aa",pOegYF:"98fb98",pOeQe:"afeeee",pOeviTetYd:"db7093",papayawEp:"ffefd5",pHKpuff:"ffdab9",peru:"cd853f",pRk:"ffc0cb",plum:"dda0dd",powMrXe:"b0e0e6",purpN:"800080",YbeccapurpN:"663399",Yd:"ff0000",Psybrown:"bc8f8f",PyOXe:"4169e1",saddNbPwn:"8b4513",sOmon:"fa8072",sandybPwn:"f4a460",sHgYF:"2e8b57",sHshell:"fff5ee",siFna:"a0522d",silver:"c0c0c0",skyXe:"87ceeb",UXe:"6a5acd",UWay:"708090",UgYy:"708090",snow:"fffafa",sprRggYF:"ff7f",stAlXe:"4682b4",tan:"d2b48c",teO:"8080",tEstN:"d8bfd8",tomato:"ff6347",Qe:"40e0d0",viTet:"ee82ee",JHt:"f5deb3",wEte:"ffffff",wEtesmoke:"f5f5f5",Lw:"ffff00",LwgYF:"9acd32"},A=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/,T=e=>e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055,P=e=>e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4);function D(e,t,i){if(e){let r=_(e);r[t]=Math.max(0,Math.min(r[t]+r[t]*i,0===t?360:1)),e.r=(r=S(x,r,void 0,void 0))[0],e.g=r[1],e.b=r[2]}}function O(e,t){return e?Object.assign(t||{},e):e}function L(e){var t={r:0,g:0,b:0,a:255};return Array.isArray(e)?e.length>=3&&(t={r:e[0],g:e[1],b:e[2],a:255},e.length>3&&(t.a=c(e[3]))):(t=O(e,{r:0,g:0,b:0,a:1})).a=c(t.a),t}class I{constructor(e){let i;if(e instanceof I)return e;const r=typeof e;"object"===r?i=L(e):"string"===r&&(i=function(e){var t,i=e.length;return"#"===e[0]&&(4===i||5===i?t={r:255&17*p[e[1]],g:255&17*p[e[2]],b:255&17*p[e[3]],a:5===i?17*p[e[4]]:255}:(7===i||9===i)&&(t={r:p[e[1]]<<4|p[e[2]],g:p[e[3]]<<4|p[e[4]],b:p[e[5]]<<4|p[e[6]],a:9===i?p[e[7]]<<4|p[e[8]]:255})),t}(e)||function(e){t||((t=function(){let e,t,i,r,s,a={},o=Object.keys(E),h=Object.keys(M);for(e=0;e<o.length;e++){for(t=0,r=s=o[e];t<h.length;t++)i=h[t],s=s.replace(i,M[i]);i=parseInt(E[r],16),a[s]=[i>>16&255,i>>8&255,255&i]}return a}()).transparent=[0,0,0,0]);let i=t[e.toLowerCase()];return i&&{r:i[0],g:i[1],b:i[2],a:4===i.length?i[3]:255}}(e)||function(e){return"r"===e.charAt(0)?function(e){let t,i,r,s=A.exec(e),a=255;if(s){if(s[7]!==t){let e=+s[7];a=s[8]?h(e):o(255*e,0,255)}return t=+s[1],i=+s[3],r=+s[5],t=255&(s[2]?h(t):o(t,0,255)),{r:t,g:i=255&(s[4]?h(i):o(i,0,255)),b:r=255&(s[6]?h(r):o(r,0,255)),a:a}}}(e):function(e){let t,i=y.exec(e),r=255;if(!i)return;i[5]!==t&&(r=i[6]?h(+i[5]):c(+i[5]));let s=C(+i[2]),a=i[3]/100,o=i[4]/100;return{r:(t="hwb"===i[1]?S(w,s,a,o):"hsv"===i[1]?S(b,s,a,o):S(x,s,a,o))[0],g:t[1],b:t[2],a:r}}(e)}(e)),this._rgb=i,this._valid=!!i}get valid(){return this._valid}get rgb(){var e=O(this._rgb);return e&&(e.a=d(e.a)),e}set rgb(e){this._rgb=L(e)}rgbString(){var e;return this._valid?(e=this._rgb)&&(e.a<255?`rgba(${e.r}, ${e.g}, ${e.b}, ${d(e.a)})`:`rgb(${e.r}, ${e.g}, ${e.b})`):void 0}hexString(){var e,t;let i,r;
8198return this._valid?(t=v((i=e=this._rgb).r)&&v(i.g)&&v(i.b)&&v(i.a)?m:g,e?"#"+t(e.r)+t(e.g)+t(e.b)+(r=e.a,r<255?t(r):""):void 0):void 0}hslString(){return this._valid?function(e){if(!e)return;let t=_(e),i=t[0],r=u(t[1]),s=u(t[2]);return e.a<255?`hsla(${i}, ${r}%, ${s}%, ${d(e.a)})`:`hsl(${i}, ${r}%, ${s}%)`}(this._rgb):void 0}mix(e,t){if(e){let i,r=this.rgb,s=e.rgb,a=t===i?.5:t,o=2*a-1,h=r.a-s.a,c=((o*h==-1?o:(o+h)/(1+o*h))+1)/2;i=1-c,r.r=255&c*r.r+i*s.r+.5,r.g=255&c*r.g+i*s.g+.5,r.b=255&c*r.b+i*s.b+.5,r.a=a*r.a+(1-a)*s.a,this.rgb=r}return this}interpolate(e,t){var i,r;let s,a,o;return e&&(this._rgb=(i=this._rgb,r=e._rgb,s=P(d(i.r)),a=P(d(i.g)),o=P(d(i.b)),{r:c(T(s+t*(P(d(r.r))-s))),g:c(T(a+t*(P(d(r.g))-a))),b:c(T(o+t*(P(d(r.b))-o))),a:i.a+t*(r.a-i.a)})),this}clone(){return new I(this.rgb)}alpha(e){return this._rgb.a=c(e),this}clearer(e){let t=this._rgb;return t.a*=1-e,this}greyscale(){let e=this._rgb,t=a(.3*e.r+.59*e.g+.11*e.b);return e.r=e.g=e.b=t,this}opaquer(e){let t=this._rgb;return t.a*=1+e,this}negate(){let e=this._rgb;return e.r=255-e.r,e.g=255-e.g,e.b=255-e.b,this}lighten(e){return D(this._rgb,2,e),this}darken(e){return D(this._rgb,2,-e),this}saturate(e){return D(this._rgb,1,e),this}desaturate(e){return D(this._rgb,1,-e),this}rotate(e){var t=this._rgb,i=_(t);return i[0]=C(i[0]+e),t.r=(i=S(x,i,void 0,void 0))[0],t.g=i[1],t.b=i[2],this}}function R(){}let k=(i=0,()=>i++);function B(e){return null==e}function z(e){if(Array.isArray&&Array.isArray(e))return!0;let t=Object.prototype.toString.call(e);return"[object"===t.slice(0,7)&&"Array]"===t.slice(-6)}function N(e){return null!==e&&"[object Object]"===Object.prototype.toString.call(e)}function F(e){return("number"==typeof e||e instanceof Number)&&isFinite(+e)}function j(e,t){return F(e)?e:t}function U(e,t){return void 0===e?t:e}let V=(e,t)=>"string"==typeof e&&e.endsWith("%")?parseFloat(e)/100*t:+e;function W(e,t,i){if(e&&"function"==typeof e.call)return e.apply(i,t)}function H(e,t,i,r){let s,a,o;if(z(e))if(a=e.length,r)for(s=a-1;s>=0;s--)t.call(i,e[s],s);else for(s=0;s<a;s++)t.call(i,e[s],s);else if(N(e))for(s=0,a=(o=Object.keys(e)).length;s<a;s++)t.call(i,e[o[s]],o[s])}function G(e,t){let i,r,s,a;if(!e||!t||e.length!==t.length)return!1;for(i=0,r=e.length;i<r;++i)if(s=e[i],a=t[i],s.datasetIndex!==a.datasetIndex||s.index!==a.index)return!1;return!0}function q(e){if(z(e))return e.map(q);if(N(e)){let t=Object.create(null),i=Object.keys(e),r=i.length,s=0;for(;s<r;++s)t[i[s]]=q(e[i[s]]);return t}return e}function X(e){return -1===["__proto__","prototype","constructor"].indexOf(e)}function Y(e,t,i,r){if(!X(e))return;let s=t[e],a=i[e];N(s)&&N(a)?Q(s,a,r):t[e]=q(a)}function Q(e,t,i){let r,s=z(t)?t:[t],a=s.length;if(!N(e))return e;let o=(i=i||{}).merger||Y;for(let t=0;t<a;++t){if(!N(r=s[t]))continue;let a=Object.keys(r);for(let t=0,s=a.length;t<s;++t)o(a[t],e,r,i)}return e}function Z(e,t){return Q(e,t,{merger:K})}function K(e,t,i){if(!X(e))return;let r=t[e],s=i[e];N(r)&&N(s)?Z(r,s):Object.prototype.hasOwnProperty.call(t,e)||(t[e]=q(s))}let J={"":e=>e,x:e=>e.x,y:e=>e.y};function $(e,t){let i;return(J[t]||(J[t]=(i=function(e){let t=e.split("."),i=[],r="";for(let e of t)(r+=e).endsWith("\\")?r=r.slice(0,-1)+".":(i.push(r),r="");return i}(t),e=>{for(let t of i){if(""===t)break;e=e&&e[t]}return e})))(e)}function ee(e){return e.charAt(0).toUpperCase()+e.slice(1)}let et=e=>void 0!==e,ei=e=>"function"==typeof e,er=(e,t)=>{if(e.size!==t.size)return!1;for(let i of e)if(!t.has(i))return!1;return!0},es=Math.PI,ea=2*es,en=ea+es,eo=1/0,el=es/180,eh=es/2,ec=es/4,ed=2*es/3,eu=Math.log10,ep=Math.sign;function ef(e,t,i){return Math.abs(e-t)<i}function em(e){let t=Math.round(e),i=Math.pow(10,Math.floor(eu(e=ef(e,t,e/1e3)?t:e))),r=e/i;return(r<=1?1:r<=2?2:r<=5?5:10)*i}function eg(e){return"symbol"!=typeof e&&("object"!=typeof e||null===e||!!(Symbol.toPrimitive in e||"toString"in e||"valueOf"in e))&&!isNaN(parseFloat(e))&&isFinite(e)}function ev(e,t,i){let r,s,a;for(r=0,s=e.length;r<s;r++)isNaN(a=e[r][i])||(t.min=Math.min(t.min,a),t.max=Math.max(t.max,a))}function ey(e){return es/180*e}function ex(e){return 180/es*e}function eb(e){if(!F(e))return;let t=1,i=0;for(;Math.round(e*t)/t!==e;)t*=10,i++;return i}function ew(e,t){let i=t.x-e.x,r=t.y-e.y,s=Math.sqrt(i*i+r*r),a=Math.atan2(r,i);return a<-.5*es&&(a+=ea),{angle:a,distance:s}}function e_(e,t){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function eS(e,t){return(e-t+en)%ea-es}function eC(e){return(e%ea+ea)%ea}function eM(e,t,i,r){let s=eC(e),a=eC(t),o=eC(i),h=eC(a-s),c=eC(o-s),d=eC(s-a),u=eC(s-o);return s===a||s===o||r&&a===o||h>c&&d<u}function eE(e,t,i){return Math.max(t,Math.min(i,e))}function eA(e,t,i,r=1e-6){return e>=Math.min(t,i)-r&&e<=Math.max(t,i)+r}function eT(e,t,i){let r;i=i||(i=>e[i]<t);let s=e.length-1,a=0;for(;s-a>1;)i(r=a+s>>1)?a=r:s=r;return{lo:a,hi:s}}let eP=(e,t,i,r)=>eT(e,i,r?r=>{let s=e[r][t];return s<i||s===i&&e[r+1][t]===i}:r=>e[r][t]<i),eD=(e,t,i)=>eT(e,i,r=>e[r][t]>=i),eO=["push","pop","shift","splice","unshift"];function eL(e,t){let i=e._chartjs;if(!i)return;let r=i.listeners,s=r.indexOf(t);-1!==s&&r.splice(s,1),r.length>0||(eO.forEach(t=>{delete e[t]}),delete e._chartjs)}function eI(e){let t=new Set(e);return t.size===e.length?e:Array.from(t)}let eR="u"<typeof window?function(e){return e()}:window.requestAnimationFrame;function ek(e,t){let i=[],r=!1;return function(...s){i=s,r||(r=!0,eR.call(window,()=>{r=!1,e.apply(t,i)}))}}let eB=e=>
8198"start"===e?"left":"end"===e?"right":"center",ez=(e,t,i)=>"start"===e?t:"end"===e?i:(t+i)/2;function eN(e,t,i){let r=t.length,s=0,a=r;if(e._sorted){let{iScale:o,vScale:h,_parsed:c}=e,d=e.dataset&&e.dataset.options?e.dataset.options.spanGaps:null,u=o.axis,{min:p,max:f,minDefined:m,maxDefined:g}=o.getUserBounds();if(m){if(s=Math.min(eP(c,u,p).lo,i?r:eP(t,u,o.getPixelForValue(p)).lo),d){let e=c.slice(0,s+1).reverse().findIndex(e=>!B(e[h.axis]));s-=Math.max(0,e)}s=eE(s,0,r-1)}if(g){let e=Math.max(eP(c,o.axis,f,!0).hi+1,i?0:eP(t,u,o.getPixelForValue(f),!0).hi+1);if(d){let t=c.slice(e-1).findIndex(e=>!B(e[h.axis]));e+=Math.max(0,t)}a=eE(e,s,r)-s}else a=r-s}return{start:s,count:a}}function eF(e){let{xScale:t,yScale:i,_scaleRanges:r}=e,s={xmin:t.min,xmax:t.max,ymin:i.min,ymax:i.max};if(!r)return e._scaleRanges=s,!0;let a=r.xmin!==t.min||r.xmax!==t.max||r.ymin!==i.min||r.ymax!==i.max;return Object.assign(r,s),a}let ej=e=>0===e||1===e,eU=(e,t,i)=>-(Math.pow(2,10*(e-=1))*Math.sin((e-t)*ea/i)),eV=(e,t,i)=>Math.pow(2,-10*e)*Math.sin((e-t)*ea/i)+1,eW={linear:e=>e,easeInQuad:e=>e*e,easeOutQuad:e=>-e*(e-2),easeInOutQuad:e=>(e/=.5)<1?.5*e*e:-.5*(--e*(e-2)-1),easeInCubic:e=>e*e*e,easeOutCubic:e=>(e-=1)*e*e+1,easeInOutCubic:e=>(e/=.5)<1?.5*e*e*e:.5*((e-=2)*e*e+2),easeInQuart:e=>e*e*e*e,easeOutQuart:e=>-((e-=1)*e*e*e-1),easeInOutQuart:e=>(e/=.5)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2),easeInQuint:e=>e*e*e*e*e,easeOutQuint:e=>(e-=1)*e*e*e*e+1,easeInOutQuint:e=>(e/=.5)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2),easeInSine:e=>-Math.cos(e*eh)+1,easeOutSine:e=>Math.sin(e*eh),easeInOutSine:e=>-.5*(Math.cos(es*e)-1),easeInExpo:e=>0===e?0:Math.pow(2,10*(e-1)),easeOutExpo:e=>1===e?1:-Math.pow(2,-10*e)+1,easeInOutExpo:e=>ej(e)?e:e<.5?.5*Math.pow(2,10*(2*e-1)):.5*(-Math.pow(2,-10*(2*e-1))+2),easeInCirc:e=>e>=1?e:-(Math.sqrt(1-e*e)-1),easeOutCirc:e=>Math.sqrt(1-(e-=1)*e),easeInOutCirc:e=>(e/=.5)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1),easeInElastic:e=>ej(e)?e:eU(e,.075,.3),easeOutElastic:e=>ej(e)?e:eV(e,.075,.3),easeInOutElastic:e=>ej(e)?e:e<.5?.5*eU(2*e,.1125,.45):.5+.5*eV(2*e-1,.1125,.45),easeInBack:e=>e*e*(2.70158*e-1.70158),easeOutBack:e=>(e-=1)*e*(2.70158*e+1.70158)+1,easeInOutBack(e){let t=1.70158;return(e/=.5)<1?.5*(e*e*(((t*=1.525)+1)*e-t)):.5*((e-=2)*e*(((t*=1.525)+1)*e+t)+2)},easeInBounce:e=>1-eW.easeOutBounce(1-e),easeOutBounce:e=>e<.36363636363636365?7.5625*e*e:e<.7272727272727273?7.5625*(e-=.5454545454545454)*e+.75:e<.9090909090909091?7.5625*(e-=.8181818181818182)*e+.9375:7.5625*(e-=.9545454545454546)*e+.984375,easeInOutBounce:e=>e<.5?.5*eW.easeInBounce(2*e):.5*eW.easeOutBounce(2*e-1)+.5};function eH(e){if(e&&"object"==typeof e){let t=e.toString();return"[object CanvasPattern]"===t||"[object CanvasGradient]"===t}return!1}function eG(e){return eH(e)?e:new I(e)}function eq(e){return eH(e)?e:new I(e).saturate(.5).darken(.1).hexString()}let eX=["x","y","borderWidth","radius","tension"],eY=["color","borderColor","backgroundColor"],eQ=new Map;function eZ(e,t,i){var r;let s,a;return(s=t+JSON.stringify(r=(r=i)||{}),!(a=eQ.get(s))&&(a=new Intl.NumberFormat(t,r),eQ.set(s,a)),a).format(e)}let eK={values:e=>z(e)?e:""+e,numeric(e,t,i){let r;if(0===e)return"0";let s=this.chart.options.locale,a=e;if(i.length>1){var o,h;let t,s=Math.max(Math.abs(i[0].value),Math.abs(i[i.length-1].value));(s<1e-4||s>1e15)&&(r="scientific"),o=e,Math.abs(t=(h=i).length>3?h[2].value-h[1].value:h[1].value-h[0].value)>=1&&o!==Math.floor(o)&&(t=o-Math.floor(o)),a=t}let c=eu(Math.abs(a)),d=isNaN(c)?1:Math.max(Math.min(-1*Math.floor(c),20),0),u={notation:r,minimumFractionDigits:d,maximumFractionDigits:d};return Object.assign(u,this.options.ticks.format),eZ(e,s,u)},logarithmic(e,t,i){return 0===e?"0":[1,2,3,5,10,15].includes(i[t].significand||e/Math.pow(10,Math.floor(eu(e))))||t>.8*i.length?eK.numeric.call(this,e,t,i):""}},eJ=Object.create(null),e$=Object.create(null);function e0(e,t){if(!t)return e;let i=t.split(".");for(let t=0,r=i.length;t<r;++t){let r=i[t];e=e[r]||(e[r]=Object.create(null))}return e}function e1(e,t,i){return"string"==typeof t?Q(e0(e,t),i):Q(e0(e,""),t)}var e2=new class{constructor(e,t){this.animation=void 0,this.backgroundColor="rgba(0,0,0,0.1)",this.borderColor="rgba(0,0,0,0.1)",this.color="#666",this.datasets={},this.devicePixelRatio=e=>e.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={}
vendor: 4,138 bytes, line 8198
8198,this.hoverBackgroundColor=(e,t)=>eq(t.backgroundColor),this.hoverBorderColor=(e,t)=>eq(t.borderColor),this.hoverColor=(e,t)=>eq(t.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(e),this.apply(t)}set(e,t){return e1(this,e,t)}get(e){return e0(this,e)}describe(e,t){return e1(e$,e,t)}override(e,t){return e1(eJ,e,t)}route(e,t,i,r){let s=e0(this,e),a=e0(this,i),o="_"+t;Object.defineProperties(s,{[o]:{value:s[t],writable:!0},[t]:{enumerable:!0,get(){let e=this[o],t=a[r];return N(e)?Object.assign({},t,e):U(e,t)},set(e){this[o]=e}}})}apply(e){e.forEach(e=>e(this))}}({_scriptable:e=>!e.startsWith("on"),_indexable:e=>"events"!==e,hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[function(e){e.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),e.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:e=>"onProgress"!==e&&"onComplete"!==e&&"fn"!==e}),e.set("animations",{colors:{type:"color",properties:eY},numbers:{type:"number",properties:eX}}),e.describe("animations",{_fallback:"animation"}),e.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:e=>0|e}}}})},function(e){e.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})},function(e){e.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",clip:!0,grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(e,t)=>t.lineWidth,tickColor:(e,t)=>t.color,offset:!1},border:{display:!0,dash:[],dashOffset:0,width:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:eK.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),e.route("scale.ticks","color","","color"),e.route("scale.grid","color","","borderColor"),e.route("scale.border","color","","borderColor"),e.route("scale.title","color","","color"),e.describe("scale",{_fallback:!1,_scriptable:e=>!e.startsWith("before")&&!e.startsWith("after")&&"callback"!==e&&"parser"!==e,_indexable:e=>"borderDash"!==e&&"tickBorderDash"!==e&&"dash"!==e}),e.describe("scales",{_fallback:"scale"}),e.describe("scale.ticks",{_scriptable:e=>"backdropPadding"!==e&&"callback"!==e,_indexable:e=>"backdropPadding"!==e})}]);function e3(e,t,i,r,s){let a=t[s];return a||(a=t[s]=e.measureText(s).width,i.push(s)),a>r&&(r=a),r}function e4(e,t,i){let r=e.currentDevicePixelRatio,s=0!==i?Math.max(i/2,.5):0;return Math.round((t-s)*r)/r+s}function e5(e,t){(t||e)&&((t=t||e.getContext("2d")).save(),t.resetTransform(),t.clearRect(0,0,e.width,e.height),t.restore())}function e6(e,t,i,r){e8(e,t,i,r,null)}function e8(e,t,i,r,s){let a,o,h,c,d,u,p,f,m=t.pointStyle,g=t.rotation,v=t.radius,y=(g||0)*el;if(m&&"object"==typeof m&&("[object HTMLImageElement]"===(a=m.toString())||"[object HTMLCanvasElement]"===a)){e.save(),e.translate(i,r),e.rotate(y),e.drawImage(m,-m.width/2,-m.height/2,m.width,m.height),e.restore();return}if(!isNaN(v)&&!(v<=0)){switch(e.beginPath(),m){default:s?e.ellipse(i,r,s/2,v,0,0,ea):e.arc(i,r,v,0,ea),e.closePath();break;case"triangle":u=s?s/2:v,e.moveTo(i+Math.sin(y)*u,r-Math.cos(y)*v),y+=ed,e.lineTo(i+Math.sin(y)*u,r-Math.cos(y)*v),y+=ed,e.lineTo(i+Math.sin(y)*u,r-Math.cos(y)*v),e.closePath();break;case"rectRounded":d=.516*v,o=Math.cos(y+ec)*(c=v-d),p=Math.cos(y+ec)*(s?s/2-d:c),h=Math.sin(y+ec)*c,f=Math.sin(y+ec)*(s?s/2-d:c),e.arc(i-p,r-h,d,y-es,y-eh),e.arc(i+f,r-o,d,y-eh,y),e.arc(i+p,r+h,d,y,y+eh),e.arc(i-f,r+o,d,y+eh,y+es),e.closePath();break;
8198case"rect":if(!g){c=Math.SQRT1_2*v,u=s?s/2:c,e.rect(i-u,r-c,2*u,2*c);break}y+=ec;case"rectRot":p=Math.cos(y)*(s?s/2:v),o=Math.cos(y)*v,h=Math.sin(y)*v,f=Math.sin(y)*(s?s/2:v),e.moveTo(i-p,r-h),e.lineTo(i+f,r-o),e.lineTo(i+p,r+h),e.lineTo(i-f,r+o),e.closePath();break;case"crossRot":y+=ec;case"cross":p=Math.cos(y)*(s?s/2:v),o=Math.cos(y)*v,h=Math.sin(y)*v,f=Math.sin(y)*(s?s/2:v),e.moveTo(i-p,r-h),e.lineTo(i+p,r+h),e.moveTo(i+f,r-o),e.lineTo(i-f,r+o);break;case"star":p=Math.cos(y)*(s?s/2:v),o=Math.cos(y)*v,h=Math.sin(y)*v,f=Math.sin(y)*(s?s/2:v),e.moveTo(i-p,r-h),e.lineTo(i+p,r+h),e.moveTo(i+f,r-o),e.lineTo(i-f,r+o),y+=ec,p=Math.cos(y)*(s?s/2:v),o=Math.cos(y)*v,h=Math.sin(y)*v,f=Math.sin(y)*(s?s/2:v),e.moveTo(i-p,r-h),e.lineTo(i+p,r+h),e.moveTo(i+f,r-o),e.lineTo(i-f,r+o);break;case"line":o=s?s/2:Math.cos(y)*v,h=Math.sin(y)*v,e.moveTo(i-o,r-h),e.lineTo(i+o,r+h);break;case"dash":e.moveTo(i,r),e.lineTo(i+Math.cos(y)*(s?s/2:v),r+Math.sin(y)*v);break;case!1:e.closePath()}e.fill(),t.borderWidth>0&&e.stroke()}}function e9(e,t,i){return i=i||.5,!t||e&&e.x>t.left-i&&e.x<t.right+i&&e.y>t.top-i&&e.y<t.bottom+i}function e7(e,t){e.save(),e.beginPath(),e.rect(t.left,t.top,t.right-t.left,t.bottom-t.top),e.clip()}function te(e){e.restore()}function tt(e,t,i,r,s){if(!t)return e.lineTo(i.x,i.y);if("middle"===s){let r=(t.x+i.x)/2;e.lineTo(r,t.y),e.lineTo(r,i.y)}else"after"===s!=!!r?e.lineTo(t.x,i.y):e.lineTo(i.x,t.y);e.lineTo(i.x,i.y)}function ti(e,t,i,r){if(!t)return e.lineTo(i.x,i.y);e.bezierCurveTo(r?t.cp1x:t.cp2x,r?t.cp1y:t.cp2y,r?i.cp2x:i.cp1x,r?i.cp2y:i.cp1y,i.x,i.y)}function tr(e,t,i,r,s,a={}){let o,h,c=z(t)?t:[t],d=a.strokeWidth>0&&""!==a.strokeColor;for(e.save(),e.font=s.string,a.translation&&e.translate(a.translation[0],a.translation[1]),B(a.rotation)||e.rotate(a.rotation),a.color&&(e.fillStyle=a.color),a.textAlign&&(e.textAlign=a.textAlign),a.textBaseline&&(e.textBaseline=a.textBaseline),o=0;o<c.length;++o)h=c[o],a.backdrop&&function(e,t){let i=e.fillStyle;e.fillStyle=t.color,e.fillRect(t.left,t.top,t.width,t.height),e.fillStyle=i}(e,a.backdrop),d&&(a.strokeColor&&(e.strokeStyle=a.strokeColor),B(a.strokeWidth)||(e.lineWidth=a.strokeWidth),e.strokeText(h,i,r,a.maxWidth)),e.fillText(h,i,r,a.maxWidth),function(e,t,i,r,s){if(s.strikethrough||s.underline){let a=e.measureText(r),o=t-a.actualBoundingBoxLeft,h=t+a.actualBoundingBoxRight,c=i-a.actualBoundingBoxAscent,d=i+a.actualBoundingBoxDescent,u=s.strikethrough?(c+d)/2:d;e.strokeStyle=e.fillStyle,e.beginPath(),e.lineWidth=s.decorationWidth||2,e.moveTo(o,u),e.lineTo(h,u),e.stroke()}}(e,i,r,h,a),r+=Number(s.lineHeight);e.restore()}function ts(e,t){let{x:i,y:r,w:s,h:a,radius:o}=t;e.arc(i+o.topLeft,r+o.topLeft,o.topLeft,1.5*es,es,!0),e.lineTo(i,r+a-o.bottomLeft),e.arc(i+o.bottomLeft,r+a-o.bottomLeft,o.bottomLeft,es,eh,!0),e.lineTo(i+s-o.bottomRight,r+a),e.arc(i+s-o.bottomRight,r+a-o.bottomRight,o.bottomRight,eh,0,!0),e.lineTo(i+s,r+o.topRight),e.arc(i+s-o.topRight,r+o.topRight,o.topRight,0,-eh,!0),e.lineTo(i+o.topLeft,r)}let ta=/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/,tn=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/,to=e=>+e||0;function tl(e,t){let i={},r=N(t),s=r?Object.keys(t):t,a=N(e)?r?i=>U(e[i],e[t[i]]):t=>e[t]:()=>e;for(let e of s)i[e]=to(a(e));return i}function th(e){return tl(e,{top:"y",right:"x",bottom:"y",left:"x"})}function tc(e){return tl(e,["topLeft","topRight","bottomLeft","bottomRight"])}function td(e){let t=th(e);return t.width=t.left+t.right,t.height=t.top+t.bottom,t}function tu(e,t){e=e||{},t=t||e2.font;let i=U(e.size,t.size);"string"==typeof i&&(i=parseInt(i,10));let r=U(e.style,t.style);r&&!(""+r).match(tn)&&(console.warn('Invalid font style specified: "'+r+'"'),r=void 0);let s={family:U(e.family,t.family),lineHeight:function(e,t){let i=(""+e).match(ta);if(!i||"normal"===i[1])return 1.2*t;switch(e=+i[2],i[3]){case"px":return e;case"%":e/=100}return t*e}(U(e.lineHeight,t.lineHeight),i),size:i,style:r,weight:U(e.weight,t.weight),string:""};return s.string=!s||B(s.size)||B(s.family)?null:(s.style?s.style+" ":"")+(s.weight?s.weight+" ":"")+s.size+"px "+s.family,s}function tp(e,t,i,r){let s,a,o,h=!0;for(s=0,a=e.length;s<a;++s)if(void 0!==(o=e[s])&&(void 0!==t&&"function"==typeof o&&(o=o(t),h=!1),void 0!==i&&z(o)&&(o=o[i%o.length],h=!1),void 0!==o))return r&&!h&&(r.cacheable=!1),o}function tf(e,t){return Object.assign(Object.create(e),t)}function tm(e,t=[""],i,r,s=()=>e[0]){let a=i||e;return void 0===r&&(r=tC("_fallback",e)),new Proxy({[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:e,_rootScopes:a,_fallback:r,_getTarget:s,override:i=>tm([i,...e],t,a,r)},{deleteProperty:(t,i)=>(delete t[i],delete t._keys,delete e[0][i],!0),get:(i,r)=>tb(i,r,()=>(function(e,t,i,r){let s;for(let a of t)if(void 0!==(s=tC(ty(a,e),i)))return tx(e,s)?t_(i,r,e,s):s})(r,t,e,i)),getOwnPropertyDescriptor:(e,t)=>
8198Reflect.getOwnPropertyDescriptor(e._scopes[0],t),getPrototypeOf:()=>Reflect.getPrototypeOf(e[0]),has:(e,t)=>tM(e).includes(t),ownKeys:e=>tM(e),set(e,t,i){let r=e._storage||(e._storage=s());return e[t]=r[t]=i,delete e._keys,!0}})}function tg(e,t,i,r){return new Proxy({_cacheable:!1,_proxy:e,_context:t,_subProxy:i,_stack:new Set,_descriptors:tv(e,r),setContext:t=>tg(e,t,i,r),override:s=>tg(e.override(s),t,i,r)},{deleteProperty:(t,i)=>(delete t[i],delete e[i],!0),get:(e,t,i)=>tb(e,t,()=>(function(e,t,i){let{_proxy:r,_context:s,_subProxy:a,_descriptors:o}=e,h=r[t];return ei(h)&&o.isScriptable(t)&&(h=function(e,t,i,r){let{_proxy:s,_context:a,_subProxy:o,_stack:h}=i;if(h.has(e))throw Error("Recursion detected: "+Array.from(h).join("->")+"->"+e);h.add(e);let c=t(a,o||r);return h.delete(e),tx(e,c)&&(c=t_(s._scopes,s,e,c)),c}(t,h,e,i)),z(h)&&h.length&&(h=function(e,t,i,r){let{_proxy:s,_context:a,_subProxy:o,_descriptors:h}=i;if(void 0!==a.index&&r(e))return t[a.index%t.length];if(N(t[0])){let i=t,r=s._scopes.filter(e=>e!==i);for(let c of(t=[],i)){let i=t_(r,s,e,c);t.push(tg(i,a,o&&o[e],h))}}return t}(t,h,e,o.isIndexable)),tx(t,h)&&(h=tg(h,s,a&&a[t],o)),h})(e,t,i)),getOwnPropertyDescriptor:(t,i)=>t._descriptors.allKeys?Reflect.has(e,i)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(e,i),getPrototypeOf:()=>Reflect.getPrototypeOf(e),has:(t,i)=>Reflect.has(e,i),ownKeys:()=>Reflect.ownKeys(e),set:(t,i,r)=>(e[i]=r,delete t[i],!0)})}function tv(e,t={scriptable:!0,indexable:!0}){let{_scriptable:i=t.scriptable,_indexable:r=t.indexable,_allKeys:s=t.allKeys}=e;return{allKeys:s,scriptable:i,indexable:r,isScriptable:ei(i)?i:()=>i,isIndexable:ei(r)?r:()=>r}}let ty=(e,t)=>e?e+ee(t):t,tx=(e,t)=>N(t)&&"adapters"!==e&&(null===Object.getPrototypeOf(t)||t.constructor===Object);function tb(e,t,i){if(Object.prototype.hasOwnProperty.call(e,t)||"constructor"===t)return e[t];let r=i();return e[t]=r,r}let tw=(e,t)=>!0===e?t:"string"==typeof e?$(t,e):void 0;function t_(e,t,i,r){var s;let a=t._rootScopes,o=(s=t._fallback,ei(s)?s(i,r):s),h=[...e,...a],c=new Set;c.add(r);let d=tS(c,h,i,o||i,r);return null!==d&&(void 0===o||o===i||null!==(d=tS(c,h,o,d,r)))&&tm(Array.from(c),[""],a,o,()=>{var e,s,a;let o,h;return e=t,s=i,a=r,s in(o=e._getTarget())||(o[s]={}),z(h=o[s])&&N(a)?a:h||{}})}function tS(e,t,i,r,s){for(;i;)i=function(e,t,i,r,s){for(let o of t){let t=tw(i,o);if(t){var a;e.add(t);let o=(a=t._fallback,ei(a)?a(i,s):a);if(void 0!==o&&o!==i&&o!==r)return o}else if(!1===t&&void 0!==r&&i!==r)return null}return!1}(e,t,i,r,s);return i}function tC(e,t){for(let i of t){if(!i)continue;let t=i[e];if(void 0!==t)return t}}function tM(e){let t=e._keys;return t||(t=e._keys=function(e){let t=new Set;for(let i of e)for(let e of Object.keys(i).filter(e=>!e.startsWith("_")))t.add(e);return Array.from(t)}(e._scopes)),t}function tE(e,t,i,r){let s,a,o,{iScale:h}=e,{key:c="r"}=this._parsing,d=Array(r);for(s=0;s<r;++s)o=t[a=s+i],d[s]={r:h.parse($(o,c),a)};return d}let tA=Number.EPSILON||1e-14,tT=(e,t)=>t<e.length&&!e[t].skip&&e[t],tP=e=>"x"===e?"y":"x";function tD(e,t,i){return Math.max(Math.min(e,i),t)}function tO(){return"u">typeof window&&"u">typeof document}function tL(e){let t=e.parentNode;return t&&"[object ShadowRoot]"===t.toString()&&(t=t.host),t}function tI(e,t,i){let r;return"string"==typeof e?(r=parseInt(e,10),-1!==e.indexOf("%")&&(r=r/100*t.parentNode[i])):r=e,r}let tR=e=>e.ownerDocument.defaultView.getComputedStyle(e,null),tk=["top","right","bottom","left"];function tB(e,t,i){let r={};i=i?"-"+i:"";for(let s=0;s<4;s++){let a=tk[s];r[a]=parseFloat(e[t+"-"+a+i])||0}return r.width=r.left+r.right,r.height=r.top+r.bottom,r}function tz(e,t){if("native"in e)return e;let{canvas:i,currentDevicePixelRatio:r}=t,s=tR(i),a="border-box"===s.boxSizing,o=tB(s,"padding"),h=tB(s,"border","width"),{x:c,y:d,box:u}=function(e,t){let i,r,s,a=e.touches,o=a&&a.length?a[0]:e,{offsetX:h,offsetY:c}=o,d=!1;if(s=e.target,(h>0||c>0)&&(!s||!s.shadowRoot))i=h,r=c;else{let e=t.getBoundingClientRect();i=o.clientX-e.left,r=o.clientY-e.top,d=!0}return{x:i,y:r,box:d}}(e,i),p=o.left+(u&&h.left),f=o.top+(u&&h.top),{width:m,height:g}=t;return a&&(m-=o.width+h.width,g-=o.height+h.height),{x:Math.round((c-p)/m*i.width/r),y:Math.round((d-f)/g*i.height/r)}}let tN=e=>Math.round(10*e)/10;function tF(e,t,i){let r=t||1,s=Math.floor(e.height*r),a=Math.floor(e.width*r);e.height=Math.floor(e.height),e.width=Math.floor(e.width);let o=e.canvas;return o.style&&(i||!o.style.height&&!o.style.width)&&(o.style.height=`${e.height}px`,o.style.width=`${e.width}px`),(e.currentDevicePixelRatio!==r||o.height!==s||o.width!==a)&&(e.currentDevicePixelRatio=r,o.height=s,o.width=a,e.ctx.setTransform(r,0,0,r,0,0),!0)}let tj=function(){let e=!1;
8198try{let t={get passive(){return e=!0,!1}};tO()&&(window.addEventListener("test",null,t),window.removeEventListener("test",null,t))}catch(e){}return e}();function tU(e,t){let i=tR(e).getPropertyValue(t),r=i&&i.match(/^(\d+)(\.\d+)?px$/);return r?+r[1]:void 0}function tV(e,t,i,r){return{x:e.x+i*(t.x-e.x),y:e.y+i*(t.y-e.y)}}function tW(e,t,i,r){return{x:e.x+i*(t.x-e.x),y:"middle"===r?i<.5?e.y:t.y:"after"===r?i<1?e.y:t.y:i>0?t.y:e.y}}function tH(e,t,i,r){let s={x:e.cp2x,y:e.cp2y},a={x:t.cp1x,y:t.cp1y},o=tV(e,s,i),h=tV(s,a,i),c=tV(a,t,i),d=tV(o,h,i),u=tV(h,c,i);return tV(d,u,i)}function tG(e,t,i){var r;return e?(r=i,{x:e=>t+t+r-e,setWidth(e){r=e},textAlign:e=>"center"===e?e:"right"===e?"left":"right",xPlus:(e,t)=>e-t,leftForLtr:(e,t)=>e-t}):{x:e=>e,setWidth(e){},textAlign:e=>e,xPlus:(e,t)=>e+t,leftForLtr:(e,t)=>e}}function tq(e,t){let i,r;("ltr"===t||"rtl"===t)&&(r=[(i=e.canvas.style).getPropertyValue("direction"),i.getPropertyPriority("direction")],i.setProperty("direction",t,"important"),e.prevTextDirection=r)}function tX(e,t){void 0!==t&&(delete e.prevTextDirection,e.canvas.style.setProperty("direction",t[0],t[1]))}function tY(e){return"angle"===e?{between:eM,compare:eS,normalize:eC}:{between:eA,compare:(e,t)=>e-t,normalize:e=>e}}function tQ({start:e,end:t,count:i,loop:r,style:s}){return{start:e%i,end:t%i,loop:r&&(t-e+1)%i==0,style:s}}function tZ(e,t,i){let r,s,a;if(!i)return[e];let{property:o,start:h,end:c}=i,d=t.length,{compare:u,between:p,normalize:f}=tY(o),{start:m,end:g,loop:v,style:y}=function(e,t,i){let r,{property:s,start:a,end:o}=i,{between:h,normalize:c}=tY(s),d=t.length,{start:u,end:p,loop:f}=e;if(f){for(u+=d,p+=d,r=0;r<d&&h(c(t[u%d][s]),a,o);++r)u--,p--;u%=d,p%=d}return p<u&&(p+=d),{start:u,end:p,loop:f,style:e.style}}(e,t,i),x=[],b=!1,w=null,_=()=>b||p(h,a,r)&&0!==u(h,a),S=()=>!b||0===u(c,r)||p(c,a,r);for(let e=m,i=m;e<=g;++e)(s=t[e%d]).skip||(r=f(s[o]))!==a&&(b=p(r,h,c),null===w&&_()&&(w=0===u(r,h)?e:i),null!==w&&S()&&(x.push(tQ({start:w,end:e,loop:v,count:d,style:y})),w=null),i=e,a=r);return null!==w&&x.push(tQ({start:w,end:g,loop:v,count:d,style:y})),x}function tK(e,t){let i=[],r=e.segments;for(let s=0;s<r.length;s++){let a=tZ(r[s],e.points,t);a.length&&i.push(...a)}return i}function tJ(e,t,i,r){return r&&r.setContext&&i?function(e,t,i,r){let s=e._chart.getContext(),a=t$(e.options),{_datasetIndex:o,options:{spanGaps:h}}=e,c=i.length,d=[],u=a,p=t[0].start,f=p;function m(e,t,r,s){let a=h?-1:1;if(e!==t){for(e+=c;i[e%c].skip;)e-=a;for(;i[t%c].skip;)t+=a;e%c!=t%c&&(d.push({start:e%c,end:t%c,loop:r,style:s}),u=s,p=t%c)}}for(let e of t){let t,a=i[(p=h?p:e.start)%c];for(f=p+1;f<=e.end;f++){let h=i[f%c];(function(e,t){if(!t)return!1;let i=[],r=function(e,t){return eH(t)?(i.includes(t)||i.push(t),i.indexOf(t)):t};return JSON.stringify(e,r)!==JSON.stringify(t,r)})(t=t$(r.setContext(tf(s,{type:"segment",p0:a,p1:h,p0DataIndex:(f-1)%c,p1DataIndex:f%c,datasetIndex:o}))),u)&&m(p,f-1,e.loop,u),a=h,u=t}p<f-1&&m(p,f-1,e.loop,u)}return d}(e,t,i,r):t}function t$(e){return{backgroundColor:e.backgroundColor,borderCapStyle:e.borderCapStyle,borderDash:e.borderDash,borderDashOffset:e.borderDashOffset,borderJoinStyle:e.borderJoinStyle,borderWidth:e.borderWidth,borderColor:e.borderColor}}function t0(e,t,i){return e.options.clip?e[i]:t[i]}function t1(e,t){let i=t._clip;if(i.disabled)return!1;let r=function(e,t){let{xScale:i,yScale:r}=e;return i&&r?{left:t0(i,t,"left"),right:t0(i,t,"right"),top:t0(r,t,"top"),bottom:t0(r,t,"bottom")}:t}(t,e.chartArea);return{left:!1===i.left?0:r.left-(!0===i.left?0:i.left),right:!1===i.right?e.width:r.right+(!0===i.right?0:i.right),top:!1===i.top?0:r.top-(!0===i.top?0:i.top),bottom:!1===i.bottom?e.height:r.bottom+(!0===i.bottom?0:i.bottom)}}var t2=new class{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(e,t,i,r){let s=t.listeners[r],a=t.duration;s.forEach(r=>r({chart:e,initial:t.initial,numSteps:a,currentStep:Math.min(i-t.start,a)}))}_refresh(){this._request||(this._running=!0,this._request=eR.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(e=Date.now()){let t=0;
8198this._charts.forEach((i,r)=>{let s;if(!i.running||!i.items.length)return;let a=i.items,o=a.length-1,h=!1;for(;o>=0;--o)(s=a[o])._active?(s._total>i.duration&&(i.duration=s._total),s.tick(e),h=!0):(a[o]=a[a.length-1],a.pop());h&&(r.draw(),this._notify(r,i,e,"progress")),a.length||(i.running=!1,this._notify(r,i,e,"complete"),i.initial=!1),t+=a.length}),this._lastDate=e,0===t&&(this._running=!1)}_getAnims(e){let t=this._charts,i=t.get(e);return i||(i={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},t.set(e,i)),i}listen(e,t,i){this._getAnims(e).listeners[t].push(i)}add(e,t){t&&t.length&&this._getAnims(e).items.push(...t)}has(e){return this._getAnims(e).items.length>0}start(e){let t=this._charts.get(e);t&&(t.running=!0,t.start=Date.now(),t.duration=t.items.reduce((e,t)=>Math.max(e,t._duration),0),this._refresh())}running(e){if(!this._running)return!1;let t=this._charts.get(e);return!!t&&!!t.running&&!!t.items.length}stop(e){let t=this._charts.get(e);if(!t||!t.items.length)return;let i=t.items,r=i.length-1;for(;r>=0;--r)i[r].cancel();t.items=[],this._notify(e,t,Date.now(),"complete")}remove(e){return this._charts.delete(e)}};let t3="transparent",t4={boolean:(e,t,i)=>i>.5?t:e,color(e,t,i){let r=eG(e||t3),s=r.valid&&eG(t||t3);return s&&s.valid?s.mix(r,i).hexString():t},number:(e,t,i)=>e+(t-e)*i};class t5{constructor(e,t,i,r){const s=t[i];r=tp([e.to,r,s,e.from]);const a=tp([e.from,s,r]);this._active=!0,this._fn=e.fn||t4[e.type||typeof a],this._easing=eW[e.easing]||eW.linear,this._start=Math.floor(Date.now()+(e.delay||0)),this._duration=this._total=Math.floor(e.duration),this._loop=!!e.loop,this._target=t,this._prop=i,this._from=a,this._to=r,this._promises=void 0}active(){return this._active}update(e,t,i){if(this._active){this._notify(!1);let r=this._target[this._prop],s=i-this._start,a=this._duration-s;this._start=i,this._duration=Math.floor(Math.max(a,e.duration)),this._total+=s,this._loop=!!e.loop,this._to=tp([e.to,t,r,e.from]),this._from=tp([e.from,r,t])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(e){let t,i=e-this._start,r=this._duration,s=this._prop,a=this._from,o=this._loop,h=this._to;if(this._active=a!==h&&(o||i<r),!this._active){this._target[s]=h,this._notify(!0);return}if(i<0){this._target[s]=a;return}t=i/r%2,t=o&&t>1?2-t:t,t=this._easing(Math.min(1,Math.max(0,t))),this._target[s]=this._fn(a,h,t)}wait(){let e=this._promises||(this._promises=[]);return new Promise((t,i)=>{e.push({res:t,rej:i})})}_notify(e){let t=e?"res":"rej",i=this._promises||[];for(let e=0;e<i.length;e++)i[e][t]()}}class t6{constructor(e,t){this._chart=e,this._properties=new Map,this.configure(t)}configure(e){if(!N(e))return;let t=Object.keys(e2.animation),i=this._properties;Object.getOwnPropertyNames(e).forEach(r=>{let s=e[r];if(!N(s))return;let a={};for(let e of t)a[e]=s[e];(z(s.properties)&&s.properties||[r]).forEach(e=>{e!==r&&i.has(e)||i.set(e,a)})})}_animateOptions(e,t){let i=t.options,r=function(e,t){if(!t)return;let i=e.options;if(!i){e.options=t;return}return i.$shared&&(e.options=i=Object.assign({},i,{$shared:!1,$animations:{}})),i}(e,i);if(!r)return[];let s=this._createAnimations(r,i);return i.$shared&&(function(e,t){let i=[],r=Object.keys(t);for(let t=0;t<r.length;t++){let s=e[r[t]];s&&s.active()&&i.push(s.wait())}return Promise.all(i)})(e.options.$animations,i).then(()=>{e.options=i},()=>{}),s}_createAnimations(e,t){let i,r=this._properties,s=[],a=e.$animations||(e.$animations={}),o=Object.keys(t),h=Date.now();for(i=o.length-1;i>=0;--i){let c=o[i];if("$"===c.charAt(0))continue;if("options"===c){s.push(...this._animateOptions(e,t));continue}let d=t[c],u=a[c],p=r.get(c);if(u)if(p&&u.active()){u.update(p,d,h);continue}else u.cancel();if(!p||!p.duration){e[c]=d;continue}a[c]=u=new t5(p,e,c,d),s.push(u)}return s}update(e,t){if(0===this._properties.size)return void Object.assign(e,t);let i=this._createAnimations(e,t);if(i.length)return t2.add(this._chart,i),!0}}function t8(e,t){let i=e&&e.options||{},r=i.reverse,s=void 0===i.min?t:0,a=void 0===i.max?t:0;return{start:r?a:s,end:r?s:a}}
8198function t9(e,t){let i,r,s=[],a=e._getSortedDatasetMetas(t);for(i=0,r=a.length;i<r;++i)s.push(a[i].index);return s}function t7(e,t,i,r={}){let s,a,o,h,c=e.keys,d="single"===r.mode;if(null===t)return;let u=!1;for(s=0,a=c.length;s<a;++s){if((o=+c[s])===i){if(u=!0,r.all)continue;break}F(h=e.values[o])&&(d||0===t||ep(t)===ep(h))&&(t+=h)}return u||r.all?t:0}function ie(e,t){let i=e&&e.options.stacked;return i||void 0===i&&void 0!==t.stack}function it(e,t,i,r){for(let s of t.getMatchingVisibleMetas(r).reverse()){let t=e[s.index];if(i&&t>0||!i&&t<0)return s.index}return null}function ii(e,t){let i,{chart:r,_cachedMeta:s}=e,a=r._stacks||(r._stacks={}),{iScale:o,vScale:h,index:c}=s,d=o.axis,u=h.axis,p=`${o.id}.${h.id}.${s.stack||s.type}`,f=t.length;for(let e=0;e<f;++e){let r=t[e],{[d]:o,[u]:f}=r;(i=(r._stacks||(r._stacks={}))[u]=function(e,t,i){let r=e[t]||(e[t]={});return r[i]||(r[i]={})}(a,p,o))[c]=f,i._top=it(i,h,!0,s.type),i._bottom=it(i,h,!1,s.type),(i._visualValues||(i._visualValues={}))[c]=f}}function ir(e,t){let i=e.scales;return Object.keys(i).filter(e=>i[e].axis===t).shift()}function is(e,t){let i=e.controller.index,r=e.vScale&&e.vScale.axis;if(r)for(let s of t=t||e._parsed){let e=s._stacks;if(!e||void 0===e[r]||void 0===e[r][i])return;delete e[r][i],void 0!==e[r]._visualValues&&void 0!==e[r]._visualValues[i]&&delete e[r]._visualValues[i]}}let ia=e=>"reset"===e||"none"===e,io=(e,t)=>t?e:Object.assign({},e);class il{static defaults={};static datasetElementType=null;static dataElementType=null;constructor(e,t){this.chart=e,this._ctx=e.ctx,this.index=t,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){let e=this._cachedMeta;this.configure(),this.linkScales(),e._stacked=ie(e.vScale,e),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(e){this.index!==e&&is(this._cachedMeta),this.index=e}linkScales(){let e=this.chart,t=this._cachedMeta,i=this.getDataset(),r=(e,t,i,r)=>"x"===e?t:"r"===e?r:i,s=t.xAxisID=U(i.xAxisID,ir(e,"x")),a=t.yAxisID=U(i.yAxisID,ir(e,"y")),o=t.rAxisID=U(i.rAxisID,ir(e,"r")),h=t.indexAxis,c=t.iAxisID=r(h,s,a,o),d=t.vAxisID=r(h,a,s,o);t.xScale=this.getScaleForId(s),t.yScale=this.getScaleForId(a),t.rScale=this.getScaleForId(o),t.iScale=this.getScaleForId(c),t.vScale=this.getScaleForId(d)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(e){return this.chart.scales[e]}_getOtherScale(e){let t=this._cachedMeta;return e===t.iScale?t.vScale:t.iScale}reset(){this._update("reset")}_destroy(){let e=this._cachedMeta;this._data&&eL(this._data,this),e._stacked&&is(e)}_dataCheck(){let e=this.getDataset(),t=e.data||(e.data=[]),i=this._data;if(N(t)){let e=this._cachedMeta;this._data=function(e,t){let i,r,s,{iScale:a,vScale:o}=t,h="x"===a.axis?"x":"y",c="x"===o.axis?"x":"y",d=Object.keys(e),u=Array(d.length);for(i=0,r=d.length;i<r;++i)s=d[i],u[i]={[h]:s,[c]:e[s]};return u}(t,e)}else if(i!==t){if(i){eL(i,this);let e=this._cachedMeta;is(e),e._parsed=[]}t&&Object.isExtensible(t)&&(t._chartjs?t._chartjs.listeners.push(this):(Object.defineProperty(t,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[this]}}),eO.forEach(e=>{let i="_onData"+ee(e),r=t[e];Object.defineProperty(t,e,{configurable:!0,enumerable:!1,value(...e){let s=r.apply(this,e);return t._chartjs.listeners.forEach(t=>{"function"==typeof t[i]&&t[i](...e)}),s}})}))),this._syncList=[],this._data=t}}addElements(){let e=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(e.dataset=new this.datasetElementType)}buildOrUpdateElements(e){let t=this._cachedMeta,i=this.getDataset(),r=!1;this._dataCheck();let s=t._stacked;t._stacked=ie(t.vScale,t),t.stack!==i.stack&&(r=!0,is(t),t.stack=i.stack),this._resyncElements(e),(r||s!==t._stacked)&&(ii(this,t._parsed),t._stacked=ie(t.vScale,t))}configure(){let e=this.chart.config,t=e.datasetScopeKeys(this._type),i=e.getOptionScopes(this.getDataset(),t,!0);this.options=e.createResolver(i,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(e,t){let i,r,s,{_cachedMeta:a,_data:o}=this,{iScale:h,_stacked:c}=a,d=h.axis,u=0===e&&t===o.length||a._sorted,p=e>0&&a._parsed[e-1];if(!1===this._parsing)a._parsed=o,a._sorted=!0,s=o;else{s=z(o[e])?this.parseArrayData(a,o,e,t):N(o[e])?this.parseObjectData(a,o,e,t):this.parsePrimitiveData(a,o,e,t);let h=()=>null===r[d]||p&&r[d]<p[d];for(i=0;i<t;++i)a._parsed[i+e]=r=s[i],u&&(h()&&(u=!1),p=r);a._sorted=u}c&&ii(this,s)}parsePrimitiveData(e,t,i,r){let s,a,{iScale:o,vScale:h}=e,c=o.axis,d=h.axis,u=o.getLabels(),p=o===h,f=Array(r);for(s=0;s<r;++s)a=s+i,f[s]={[c]:p||o.parse(u[a],a),[d]:h.parse(t[a],a)};return f}parseArrayData(e,t,i,r){let s,a,o,{xScale:h,yScale:c}=e,d=Array(r);for(s=0;s<r;
8198++s)o=t[a=s+i],d[s]={x:h.parse(o[0],a),y:c.parse(o[1],a)};return d}parseObjectData(e,t,i,r){let s,a,o,{xScale:h,yScale:c}=e,{xAxisKey:d="x",yAxisKey:u="y"}=this._parsing,p=Array(r);for(s=0;s<r;++s)o=t[a=s+i],p[s]={x:h.parse($(o,d),a),y:c.parse($(o,u),a)};return p}getParsed(e){return this._cachedMeta._parsed[e]}getDataElement(e){return this._cachedMeta.data[e]}applyStack(e,t,i){let r=this.chart,s=this._cachedMeta,a=t[e.axis];return t7({keys:t9(r,!0),values:t._stacks[e.axis]._visualValues},a,s.index,{mode:i})}updateRangeFromParsed(e,t,i,r){let s=i[t.axis],a=null===s?NaN:s,o=r&&i._stacks[t.axis];r&&o&&(r.values=o,a=t7(r,s,this._cachedMeta.index)),e.min=Math.min(e.min,a),e.max=Math.max(e.max,a)}getMinMax(e,t){let i,r,s,a=this._cachedMeta,o=a._parsed,h=a._sorted&&e===a.iScale,c=o.length,d=this._getOtherScale(e),u=(s=this.chart,t&&!a.hidden&&a._stacked&&{keys:t9(s,!0),values:null}),p={min:1/0,max:-1/0},{min:f,max:m}=function(e){let{min:t,max:i,minDefined:r,maxDefined:s}=e.getUserBounds();return{min:r?t:-1/0,max:s?i:1/0}}(d);function g(){let t=(r=o[i])[d.axis];return!F(r[e.axis])||f>t||m<t}for(i=0;i<c&&(g()||(this.updateRangeFromParsed(p,e,r,u),!h));++i);if(h){for(i=c-1;i>=0;--i)if(!g()){this.updateRangeFromParsed(p,e,r,u);break}}return p}getAllParsedValues(e){let t,i,r,s=this._cachedMeta._parsed,a=[];for(t=0,i=s.length;t<i;++t)F(r=s[t][e.axis])&&a.push(r);return a}getMaxOverflow(){return!1}getLabelAndValue(e){let t=this._cachedMeta,i=t.iScale,r=t.vScale,s=this.getParsed(e);return{label:i?""+i.getLabelForValue(s[i.axis]):"",value:r?""+r.getLabelForValue(s[r.axis]):""}}_update(e){var t;let i,r,s,a,o=this._cachedMeta;this.update(e||"default"),N(t=U(this.options.clip,function(e,t,i){if(!1===i)return!1;let r=t8(e,i),s=t8(t,i);return{top:s.end,right:r.end,bottom:s.start,left:r.start}}(o.xScale,o.yScale,this.getMaxOverflow())))?(i=t.top,r=t.right,s=t.bottom,a=t.left):i=r=s=a=t,o._clip={top:i,right:r,bottom:s,left:a,disabled:!1===t}}update(e){}draw(){let e,t=this._ctx,i=this.chart,r=this._cachedMeta,s=r.data||[],a=i.chartArea,o=[],h=this._drawStart||0,c=this._drawCount||s.length-h,d=this.options.drawActiveElementsOnTop;for(r.dataset&&r.dataset.draw(t,a,h,c),e=h;e<h+c;++e){let i=s[e];i.hidden||(i.active&&d?o.push(i):i.draw(t,a))}for(e=0;e<o.length;++e)o[e].draw(t,a)}getStyle(e,t){let i=t?"active":"default";return void 0===e&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(i):this.resolveDataElementOptions(e||0,i)}getContext(e,t,i){var r,s;let a,o=this.getDataset();if(e>=0&&e<this._cachedMeta.data.length){let t=this._cachedMeta.data[e];(a=t.$context||(r=this.getContext(),t.$context=tf(r,{active:!1,dataIndex:e,parsed:void 0,raw:void 0,element:t,index:e,mode:"default",type:"data"}))).parsed=this.getParsed(e),a.raw=o.data[e],a.index=a.dataIndex=e}else(a=this.$context||(this.$context=tf(this.chart.getContext(),{active:!1,dataset:void 0,datasetIndex:s=this.index,index:s,mode:"default",type:"dataset"}))).dataset=o,a.index=a.datasetIndex=this.index;return a.active=!!t,a.mode=i,a}resolveDatasetElementOptions(e){return this._resolveElementOptions(this.datasetElementType.id,e)}resolveDataElementOptions(e,t){return this._resolveElementOptions(this.dataElementType.id,t,e)}_resolveElementOptions(e,t="default",i){let r="active"===t,s=this._cachedDataOpts,a=e+"-"+t,o=s[a],h=this.enableOptionSharing&&et(i);if(o)return io(o,h);let c=this.chart.config,d=c.datasetElementScopeKeys(this._type,e),u=r?[`${e}Hover`,"hover",e,""]:[e,""],p=c.getOptionScopes(this.getDataset(),d),f=Object.keys(e2.elements[e]),m=()=>this.getContext(i,r,t),g=c.resolveNamedOptions(p,f,m,u);return g.$shared&&(g.$shared=h,s[a]=Object.freeze(io(g,h))),g}_resolveAnimations(e,t,i){let r,s=this.chart,a=this._cachedDataOpts,o=`animation-${t}`,h=a[o];if(h)return h;if(!1!==s.options.animation){let s=this.chart.config,a=s.datasetAnimationScopeKeys(this._type,t),o=s.getOptionScopes(this.getDataset(),a);r=s.createResolver(o,this.getContext(e,i,t))}let c=new t6(s,r&&r.animations);return r&&r._cacheable&&(a[o]=Object.freeze(c)),c}getSharedOptions(e){if(e.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},e))}includeOptions(e,t){return!t||ia(e)||this.chart._animationsDisabled}_getSharedOptions(e,t){let i=this.resolveDataElementOptions(e,t),r=this._sharedOptions,s=this.getSharedOptions(i),a=this.includeOptions(t,s)||s!==r;return this.updateSharedOptions(s,t,i),{sharedOptions:s,includeOptions:a}}updateElement(e,t,i,r){ia(r)?Object.assign(e,i):this._resolveAnimations(t,r).update(e,i)}updateSharedOptions(e,t,i){e&&!ia(t)&&this._resolveAnimations(void 0,t).update(e,i)}_setStyle(e,t,i,r){e.active=r;let s=this.getStyle(t,r);
8198this._resolveAnimations(t,i,r).update(e,{options:!r&&this.getSharedOptions(s)||s})}removeHoverStyle(e,t,i){this._setStyle(e,i,"active",!1)}setHoverStyle(e,t,i){this._setStyle(e,i,"active",!0)}_removeDatasetHoverStyle(){let e=this._cachedMeta.dataset;e&&this._setStyle(e,void 0,"active",!1)}_setDatasetHoverStyle(){let e=this._cachedMeta.dataset;e&&this._setStyle(e,void 0,"active",!0)}_resyncElements(e){let t=this._data,i=this._cachedMeta.data;for(let[e,t,i]of this._syncList)this[e](t,i);this._syncList=[];let r=i.length,s=t.length,a=Math.min(s,r);a&&this.parse(0,a),s>r?this._insertElements(r,s-r,e):s<r&&this._removeElements(s,r-s)}_insertElements(e,t,i=!0){let r,s=this._cachedMeta,a=s.data,o=e+t,h=e=>{for(e.length+=t,r=e.length-1;r>=o;r--)e[r]=e[r-t]};for(h(a),r=e;r<o;++r)a[r]=new this.dataElementType;this._parsing&&h(s._parsed),this.parse(e,t),i&&this.updateElements(a,e,t,"reset")}updateElements(e,t,i,r){}_removeElements(e,t){let i=this._cachedMeta;if(this._parsing){let r=i._parsed.splice(e,t);i._stacked&&is(i,r)}i.data.splice(e,t)}_sync(e){if(this._parsing)this._syncList.push(e);else{let[t,i,r]=e;this[t](i,r)}this.chart._dataChanges.push([this.index,...e])}_onDataPush(){let e=arguments.length;this._sync(["_insertElements",this.getDataset().data.length-e,e])}_onDataPop(){this._sync(["_removeElements",this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync(["_removeElements",0,1])}_onDataSplice(e,t){t&&this._sync(["_removeElements",e,t]);let i=arguments.length-2;i&&this._sync(["_insertElements",e,i])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}}function ih(e,t,i,r){if(z(e)){let s,a,o,h,c,d;s=i.parse(e[0],r),o=Math.min(s,a=i.parse(e[1],r)),h=Math.max(s,a),c=o,d=h,Math.abs(o)>Math.abs(h)&&(c=h,d=o),t[i.axis]=d,t._custom={barStart:c,barEnd:d,start:s,end:a,min:o,max:h}}else t[i.axis]=i.parse(e,r);return t}function ic(e,t,i,r){let s,a,o,h,c=e.iScale,d=e.vScale,u=c.getLabels(),p=c===d,f=[];for(s=i,a=i+r;s<a;++s)h=t[s],(o={})[c.axis]=p||c.parse(u[s],s),f.push(ih(h,o,d,s));return f}function id(e){return e&&void 0!==e.barStart&&void 0!==e.barEnd}function iu(e,t,i,r){var s,a,o;return r?ip((s=e,a=t,o=i,e=s===a?o:s===o?a:s),i,t):ip(e,t,i)}function ip(e,t,i){return"start"===e?t:"end"===e?i:e}class im extends il{static id="doughnut";static defaults={datasetElementType:!1,dataElementType:"arc",animation:{animateRotate:!0,animateScale:!1},animations:{numbers:{type:"number",properties:["circumference","endAngle","innerRadius","outerRadius","startAngle","x","y","offset","borderWidth","spacing"]}},cutout:"50%",rotation:0,circumference:360,radius:"100%",spacing:0,indexAxis:"r"};static descriptors={_scriptable:e=>"spacing"!==e,_indexable:e=>"spacing"!==e&&!e.startsWith("borderDash")&&!e.startsWith("hoverBorderDash")};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(e){let t=e.data;if(t.labels.length&&t.datasets.length){let{labels:{pointStyle:i,color:r}}=e.legend.options;return t.labels.map((t,s)=>{let a=e.getDatasetMeta(0).controller.getStyle(s);return{text:t,fillStyle:a.backgroundColor,strokeStyle:a.borderColor,fontColor:r,lineWidth:a.borderWidth,pointStyle:i,hidden:!e.getDataVisibility(s),index:s}})}return[]}},onClick(e,t,i){i.chart.toggleDataVisibility(t.index),i.chart.update()}}}};constructor(e,t){super(e,t),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(e,t){let i=this.getDataset().data,r=this._cachedMeta;if(!1===this._parsing)r._parsed=i;else{let s,a,o=e=>+i[e];if(N(i[e])){let{key:e="value"}=this._parsing;o=t=>+$(i[t],e)}for(s=e,a=e+t;s<a;++s)r._parsed[s]=o(s)}}_getRotation(){return ey(this.options.rotation-90)}_getCircumference(){return ey(this.options.circumference)}_getRotationExtents(){let e=ea,t=-ea;for(let i=0;i<this.chart.data.datasets.length;++i)if(this.chart.isDatasetVisible(i)&&this.chart.getDatasetMeta(i).type===this._type){let r=this.chart.getDatasetMeta(i).controller,s=r._getRotation(),a=r._getCircumference();e=Math.min(e,s),t=Math.max(t,s+a)}return{rotation:e,circumference:t-e}}update(e){let t,{chartArea:i}=this.chart,r=this._cachedMeta,s=r.data,a=this.getMaxBorderWidth()+this.getMaxOffset(s)+this.options.spacing,o=Math.max((Math.min(i.width,i.height)-a)/2,0),h=Math.min((t=this.options.cutout,"string"==typeof t&&t.endsWith("%")?parseFloat(t)/100:t/o),1),c=this._getRingWeight(this.index),{circumference:d,rotation:u}=this._getRotationExtents(),{ratioX:p,ratioY:f,offsetX:m,offsetY:g}=function(e,t,i){let r=1,s=1,a=0,o=0;if(t<ea){let h=e+t,c=Math.cos(e),d=Math.sin(e),u=Math.cos(h),p=Math.sin(h),f=(t,r,s)=>eM(t,e,h,!0)?1:Math.max(r,r*i,s,s*i),m=(t,r,s)=>eM(t,e,h,!0)?-1:Math.min(r,r*i,s,s*i),g=f(0,c,u),v=f(eh,d,p),y=m(es,c,u),x=m(es+eh,d,p);r=(g-y)/2,s=(v-x)/2,a=-(g+y)/2,o=-(v+x)/2}return{ratioX:r,ratioY:s,offsetX:a,offsetY:o}}(u,d,h),v=Math.max(Math.min((i.width-a)/p,(i.height-a)/f)/2,0),y=V(this.options.radius,v),x=Math.max(y*h,0),b=(y-x)/this._getVisibleDatasetWeightTotal();this.offsetX=m*y,this.offsetY=g*y,r.total=this.calculateTotal(),this.outerRadius=y-b*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-b*c,0),this.updateElements(s,0,s.length,e)}_circumference(e,t){let i=this.options,r=this._cachedMeta,s=this._getCircumference();return t&&i.animation.animateRotate||!this.chart.getDataVisibility(e)||null===r._parsed[e]||r.data[e].hidden?0:this.calculateCircumference(r._parsed[e]*s/ea)}updateElements(e,t,i,r){let s,a="reset"===r,o=this.chart,h=o.chartArea,c=o.options.animation,d=(h.left+h.right)/2,u=(h.top+h.bottom)/2,p=a&&c.animateScale,f=p?0:this.innerRadius,m=p?0:this.outerRadius,{sharedOptions:g,includeOptions:v}=this._getSharedOptions(t,r),y=this._getRotation();for(s=0;s<t;++s)y+=this._circumference(s,a);for(s=t;s<t+i;++s){let t=this._circumference(s,a),i=e[s],o={x:d+this.offsetX,y:u+this.offsetY,startAngle:y,endAngle:y+t,circumference:t,outerRadius:m,innerRadius:f};v&&(o.options=g||this.resolveDataElementOptions(s,i.active?"active":r)),y+=t,this.updateElement(i,s,o,r)}}calculateTotal(){let e,t=this._cachedMeta,i=t.data,r=0;for(e=0;e<i.length;e++){let s=t._parsed[e];null!==s&&!isNaN(s)&&this.chart.getDataVisibility(e)&&!i[e].hidden&&(r+=Math.abs(s))}return r}calculateCircumference(e){let t=this._cachedMeta.total;return t>0&&!isNaN(e)?Math.abs(e)/t*ea:0}
8198getLabelAndValue(e){let t=this._cachedMeta,i=this.chart,r=i.data.labels||[],s=eZ(t._parsed[e],i.options.locale);return{label:r[e]||"",value:s}}getMaxBorderWidth(e){let t,i,r,s,a,o=0,h=this.chart;if(!e){for(t=0,i=h.data.datasets.length;t<i;++t)if(h.isDatasetVisible(t)){e=(r=h.getDatasetMeta(t)).data,s=r.controller;break}}if(!e)return 0;for(t=0,i=e.length;t<i;++t)"inner"!==(a=s.resolveDataElementOptions(t)).borderAlign&&(o=Math.max(o,a.borderWidth||0,a.hoverBorderWidth||0));return o}getMaxOffset(e){let t=0;for(let i=0,r=e.length;i<r;++i){let e=this.resolveDataElementOptions(i);t=Math.max(t,e.offset||0,e.hoverOffset||0)}return t}_getRingWeightOffset(e){let t=0;for(let i=0;i<e;++i)this.chart.isDatasetVisible(i)&&(t+=this._getRingWeight(i));return t}_getRingWeight(e){return Math.max(U(this.chart.data.datasets[e].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}}class ig extends il{static id="polarArea";static defaults={dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(e){let t=e.data;if(t.labels.length&&t.datasets.length){let{labels:{pointStyle:i,color:r}}=e.legend.options;return t.labels.map((t,s)=>{let a=e.getDatasetMeta(0).controller.getStyle(s);return{text:t,fillStyle:a.backgroundColor,strokeStyle:a.borderColor,fontColor:r,lineWidth:a.borderWidth,pointStyle:i,hidden:!e.getDataVisibility(s),index:s}})}return[]}},onClick(e,t,i){i.chart.toggleDataVisibility(t.index),i.chart.update()}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}};constructor(e,t){super(e,t),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(e){let t=this._cachedMeta,i=this.chart,r=i.data.labels||[],s=eZ(t._parsed[e].r,i.options.locale);return{label:r[e]||"",value:s}}parseObjectData(e,t,i,r){return tE.bind(this)(e,t,i,r)}update(e){let t=this._cachedMeta.data;this._updateRadius(),this.updateElements(t,0,t.length,e)}getMinMax(){let e=this._cachedMeta,t={min:1/0,max:-1/0};return e.data.forEach((e,i)=>{let r=this.getParsed(i).r;!isNaN(r)&&this.chart.getDataVisibility(i)&&(r<t.min&&(t.min=r),r>t.max&&(t.max=r))}),t}_updateRadius(){let e=this.chart,t=e.chartArea,i=e.options,r=Math.max(Math.min(t.right-t.left,t.bottom-t.top)/2,0),s=Math.max(i.cutoutPercentage?r/100*i.cutoutPercentage:1,0),a=(r-s)/e.getVisibleDatasetCount();this.outerRadius=r-a*this.index,this.innerRadius=this.outerRadius-a}updateElements(e,t,i,r){let s,a="reset"===r,o=this.chart,h=o.options.animation,c=this._cachedMeta.rScale,d=c.xCenter,u=c.yCenter,p=c.getIndexAngle(0)-.5*es,f=p,m=360/this.countVisibleElements();for(s=0;s<t;++s)f+=this._computeAngle(s,r,m);for(s=t;s<t+i;s++){let t=e[s],i=f,g=f+this._computeAngle(s,r,m),v=o.getDataVisibility(s)?c.getDistanceFromCenterForValue(this.getParsed(s).r):0;f=g,a&&(h.animateScale&&(v=0),h.animateRotate&&(i=g=p));let y={x:d,y:u,innerRadius:0,outerRadius:v,startAngle:i,endAngle:g,options:this.resolveDataElementOptions(s,t.active?"active":r)};this.updateElement(t,s,y,r)}}countVisibleElements(){let e=this._cachedMeta,t=0;return e.data.forEach((e,i)=>{!isNaN(this.getParsed(i).r)&&this.chart.getDataVisibility(i)&&t++}),t}_computeAngle(e,t,i){return this.chart.getDataVisibility(e)?ey(this.resolveDataElementOptions(e,t).angle||i):0}}class iv extends il{static id="scatter";static defaults={datasetElementType:!1,dataElementType:"point",showLine:!1,fill:!1};static overrides={interaction:{mode:"point"},scales:{x:{type:"linear"},y:{type:"linear"}}};getLabelAndValue(e){let t=this._cachedMeta,i=this.chart.data.labels||[],{xScale:r,yScale:s}=t,a=this.getParsed(e),o=r.getLabelForValue(a.x),h=s.getLabelForValue(a.y);return{label:i[e]||"",value:"("+o+", "+h+")"}}update(e){let t=this._cachedMeta,{data:i=[]}=t,r=this.chart._animationsDisabled,{start:s,count:a}=eN(t,i,r);if(this._drawStart=s,this._drawCount=a,eF(t)&&(s=0,a=i.length),this.options.showLine){this.datasetElementType||this.addElements();let{dataset:s,_dataset:a}=t;s._chart=this.chart,s._datasetIndex=this.index,s._decimated=!!a._decimated,s.points=i;let o=this.resolveDatasetElementOptions(e);o.segment=this.options.segment,this.updateElement(s,void 0,{animated:!r,options:o},e)}else this.datasetElementType&&(delete t.dataset,this.datasetElementType=!1);this.updateElements(i,s,a,e)}addElements(){let{showLine:e}=this.options;!this.datasetElementType&&e&&(this.datasetElementType=this.chart.registry.getElement("line")),super.addElements()}updateElements(e,t,i,r){let s="reset"===r,{iScale:a,vScale:o,_stacked:h,_dataset:c}=this._cachedMeta,d=this.resolveDataElementOptions(t,r),u=this.getSharedOptions(d),p=this.includeOptions(r,u),f=a.axis,m=o.axis,{spanGaps:g,segment:v}=this.options,y=eg(g)?g:1/0,x=this.chart._animationsDisabled||s||"none"===r,b=t>0&&this.getParsed(t-1);for(let d=t;d<t+i;++d){let t=e[d],i=this.getParsed(d),g=x?t:{},w=B(i[m]),_=g[f]=a.getPixelForValue(i[f],d),S=g[m]=s||w?o.getBasePixel():o.getPixelForValue(h?this.applyStack(o,i,h):i[m],d);g.skip=isNaN(_)||isNaN(S)||w,g.stop=d>0&&Math.abs(i[f]-b[f])>y,v&&(g.parsed=i,g.raw=c.data[d]),p&&(g.options=u||this.resolveDataElementOptions(d,t.active?"active":r)),x||this.updateElement(t,d,g,r),b=i}this.updateSharedOptions(u,r,d)}getMaxOverflow(){let e=this._cachedMeta,t=e.data||[];if(!this.options.showLine){let e=0;for(let i=t.length-1;i>=0;--i)e=Math.max(e,t[i].size(this.resolveDataElementOptions(i))/2);return e>0&&e}let i=e.dataset,r=i.options&&i.options.borderWidth||0;return t.length?Math.max(r,t[0].size(this.resolveDataElementOptions(0)),t[t.length-1].size(this.resolveDataElementOptions(t.length-1)))/2:r}}var iy=Object.freeze({__proto__:null,BarController:class extends il{static id="bar";static defaults={datasetElementType:!1,dataElementType:"bar",categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:"number",properties:["x","y","base","width","height"]}}};static overrides={scales:{_index_:{type:"category",offset:!0,grid:{offset:!0}},_value_:{type:"linear",beginAtZero:!0}}};parsePrimitiveData(e,t,i,r){return ic(e,t,i,r)}parseArrayData(e,t,i,r){return ic(e,t,i,r)}parseObjectData(e,t,i,r){let s,a,o,h,{iScale:c,vScale:d}=e,{xAxisKey:u="x",yAxisKey:p="y"}=this._parsing,f="x"===c.axis?u:p,m="x"===d.axis?u:p,g=[];for(s=i,a=i+r;s<a;++s)h=t[s],(o={}
8198)[c.axis]=c.parse($(h,f),s),g.push(ih($(h,m),o,d,s));return g}updateRangeFromParsed(e,t,i,r){super.updateRangeFromParsed(e,t,i,r);let s=i._custom;s&&t===this._cachedMeta.vScale&&(e.min=Math.min(e.min,s.min),e.max=Math.max(e.max,s.max))}getMaxOverflow(){return 0}getLabelAndValue(e){let{iScale:t,vScale:i}=this._cachedMeta,r=this.getParsed(e),s=r._custom,a=id(s)?"["+s.start+", "+s.end+"]":""+i.getLabelForValue(r[i.axis]);return{label:""+t.getLabelForValue(r[t.axis]),value:a}}initialize(){this.enableOptionSharing=!0,super.initialize(),this._cachedMeta.stack=this.getDataset().stack}update(e){let t=this._cachedMeta;this.updateElements(t.data,0,t.data.length,e)}updateElements(e,t,i,r){let s="reset"===r,{index:a,_cachedMeta:{vScale:o}}=this,h=o.getBasePixel(),c=o.isHorizontal(),d=this._getRuler(),{sharedOptions:u,includeOptions:p}=this._getSharedOptions(t,r);for(let f=t;f<t+i;f++){let t=this.getParsed(f),i=s||B(t[o.axis])?{base:h,head:h}:this._calculateBarValuePixels(f),m=this._calculateBarIndexPixels(f,d),g=(t._stacks||{})[o.axis],v={horizontal:c,base:i.base,enableBorderRadius:!g||id(t._custom)||a===g._top||a===g._bottom,x:c?i.head:m.center,y:c?m.center:i.head,height:c?m.size:Math.abs(i.size),width:c?Math.abs(i.size):m.size};p&&(v.options=u||this.resolveDataElementOptions(f,e[f].active?"active":r));let y=v.options||e[f].options;!function(e,t,i,r){let s,a,o,h,c,d=t.borderSkipped,u={};if(!d){e.borderSkipped=u;return}if(!0===d){e.borderSkipped={top:!0,right:!0,bottom:!0,left:!0};return}let{start:p,end:f,reverse:m,top:g,bottom:v}=(e.horizontal?(s=e.base>e.x,a="left",o="right"):(s=e.base<e.y,a="bottom",o="top"),s?(h="end",c="start"):(h="start",c="end"),{start:a,end:o,reverse:s,top:h,bottom:c});"middle"===d&&i&&(e.enableBorderRadius=!0,(i._top||0)===r?d=g:(i._bottom||0)===r?d=v:(u[iu(v,p,f,m)]=!0,d=g)),u[iu(d,p,f,m)]=!0,e.borderSkipped=u}(v,y,g,a),function(e,{inflateAmount:t},i){e.inflateAmount="auto"===t?.33*(1===i):t}(v,y,d.ratio),this.updateElement(e[f],f,v,r)}}_getStacks(e,t){let{iScale:i}=this._cachedMeta,r=i.getMatchingVisibleMetas(this._type).filter(e=>e.controller.options.grouped),s=i.options.stacked,a=[],o=this._cachedMeta.controller.getParsed(t),h=o&&o[i.axis],c=e=>{let t=e._parsed.find(e=>e[i.axis]===h),r=t&&t[e.vScale.axis];if(B(r)||isNaN(r))return!0};for(let i of r)if(!(void 0!==t&&c(i))&&((!1===s||-1===a.indexOf(i.stack)||void 0===s&&void 0===i.stack)&&a.push(i.stack),i.index===e))break;return a.length||a.push(void 0),a}_getStackCount(e){return this._getStacks(void 0,e).length}_getAxisCount(){return this._getAxis().length}getFirstScaleIdForIndexAxis(){let e=this.chart.scales,t=this.chart.options.indexAxis;return Object.keys(e).filter(i=>e[i].axis===t).shift()}_getAxis(){let e={},t=this.getFirstScaleIdForIndexAxis();for(let i of this.chart.data.datasets)e[U("x"===this.chart.options.indexAxis?i.xAxisID:i.yAxisID,t)]=!0;return Object.keys(e)}_getStackIndex(e,t,i){let r=this._getStacks(e,i),s=void 0!==t?r.indexOf(t):-1;return -1===s?r.length-1:s}_getRuler(){let e,t,i=this.options,r=this._cachedMeta,s=r.iScale,a=[];for(e=0,t=r.data.length;e<t;++e)a.push(s.getPixelForValue(this.getParsed(e)[s.axis],e));let o=i.barThickness;return{min:o||function(e){let t,i,r,s,a=e.iScale,o=function(e,t){if(!e._cache.$bar){let i=e.getMatchingVisibleMetas(t),r=[];for(let t=0,s=i.length;t<s;t++)r=r.concat(i[t].controller.getAllParsedValues(e));e._cache.$bar=eI(r.sort((e,t)=>e-t))}return e._cache.$bar}(a,e.type),h=a._length,c=()=>{32767!==r&&-32768!==r&&(et(s)&&(h=Math.min(h,Math.abs(r-s)||h)),s=r)};for(t=0,i=o.length;t<i;++t)r=a.getPixelForValue(o[t]),c();for(t=0,s=void 0,i=a.ticks.length;t<i;++t)r=a.getPixelForTick(t),c();return h}(r),pixels:a,start:s._startPixel,end:s._endPixel,stackCount:this._getStackCount(),scale:s,grouped:i.grouped,ratio:o?1:i.categoryPercentage*i.barPercentage}}_calculateBarValuePixels(e){let t,i,{_cachedMeta:{vScale:r,_stacked:s,index:a},options:{base:o,minBarLength:h}}=this,c=o||0,d=this.getParsed(e),u=d._custom,p=id(u),f=d[r.axis],m=0,g=s?this.applyStack(r,d,s):f;g!==f&&(m=g-f,g=f),p&&(f=u.barStart,g=u.barEnd-u.barStart,0!==f&&ep(f)!==ep(u.barEnd)&&(m=0),m+=f);
8198let v=B(o)||p?m:o,y=r.getPixelForValue(v);if(Math.abs(i=(t=this.chart.getDataVisibility(e)?r.getPixelForValue(m+g):y)-y)<h){var x;i=(0!==(x=i)?ep(x):(r.isHorizontal()?1:-1)*(r.min>=c?1:-1))*h,f===c&&(y-=i/2);let e=r.getPixelForDecimal(0),o=r.getPixelForDecimal(1),u=Math.min(e,o);t=(y=Math.max(Math.min(y,Math.max(e,o)),u))+i,s&&!p&&(d._stacks[r.axis]._visualValues[a]=r.getValueForPixel(t)-r.getValueForPixel(y))}if(y===r.getPixelForValue(c)){let e=ep(i)*r.getLineWidthForValue(c)/2;y+=e,i-=e}return{size:i,base:y,head:t,center:t+i/2}}_calculateBarIndexPixels(e,t){let i,r,s=t.scale,a=this.options,o=a.skipNull,h=U(a.maxBarThickness,1/0),c=this._getAxisCount();if(t.grouped){var d,u;let s,p,f,m,g,v,y,x,b,w=o?this._getStackCount(e):t.stackCount,_="flex"===a.barThickness?(d=w*c,p=(s=t.pixels)[e],f=e>0?s[e-1]:null,m=e<s.length-1?s[e+1]:null,g=a.categoryPercentage,null===f&&(f=p-(null===m?t.end-t.start:m-p)),null===m&&(m=p+p-f),v=p-(p-Math.min(f,m))/2*g,{chunk:Math.abs(m-f)/2*g/d,ratio:a.barPercentage,start:v}):(u=w*c,B(b=a.barThickness)?(y=t.min*a.categoryPercentage,x=a.barPercentage):(y=b*u,x=1),{chunk:y/u,ratio:x,start:t.pixels[e]-y/2}),S="x"===this.chart.options.indexAxis?this.getDataset().xAxisID:this.getDataset().yAxisID,C=this._getAxis().indexOf(U(S,this.getFirstScaleIdForIndexAxis())),M=this._getStackIndex(this.index,this._cachedMeta.stack,o?e:void 0)+C;i=_.start+_.chunk*M+_.chunk/2,r=Math.min(h,_.chunk*_.ratio)}else i=s.getPixelForValue(this.getParsed(e)[s.axis],e),r=Math.min(h,t.min*t.ratio);return{base:i-r/2,head:i+r/2,center:i,size:r}}draw(){let e=this._cachedMeta,t=e.vScale,i=e.data,r=i.length,s=0;for(;s<r;++s)null===this.getParsed(s)[t.axis]||i[s].hidden||i[s].draw(this._ctx)}},BubbleController:class extends il{static id="bubble";static defaults={datasetElementType:!1,dataElementType:"point",animations:{numbers:{type:"number",properties:["x","y","borderWidth","radius"]}}};static overrides={scales:{x:{type:"linear"},y:{type:"linear"}}};initialize(){this.enableOptionSharing=!0,super.initialize()}parsePrimitiveData(e,t,i,r){let s=super.parsePrimitiveData(e,t,i,r);for(let e=0;e<s.length;e++)s[e]._custom=this.resolveDataElementOptions(e+i).radius;return s}parseArrayData(e,t,i,r){let s=super.parseArrayData(e,t,i,r);for(let e=0;e<s.length;e++){let r=t[i+e];s[e]._custom=U(r[2],this.resolveDataElementOptions(e+i).radius)}return s}parseObjectData(e,t,i,r){let s=super.parseObjectData(e,t,i,r);for(let e=0;e<s.length;e++){let r=t[i+e];s[e]._custom=U(r&&r.r&&+r.r,this.resolveDataElementOptions(e+i).radius)}return s}getMaxOverflow(){let e=this._cachedMeta.data,t=0;for(let i=e.length-1;i>=0;--i)t=Math.max(t,e[i].size(this.resolveDataElementOptions(i))/2);return t>0&&t}getLabelAndValue(e){let t=this._cachedMeta,i=this.chart.data.labels||[],{xScale:r,yScale:s}=t,a=this.getParsed(e),o=r.getLabelForValue(a.x),h=s.getLabelForValue(a.y),c=a._custom;return{label:i[e]||"",value:"("+o+", "+h+(c?", "+c:"")+")"}}update(e){let t=this._cachedMeta.data;this.updateElements(t,0,t.length,e)}updateElements(e,t,i,r){let s="reset"===r,{iScale:a,vScale:o}=this._cachedMeta,{sharedOptions:h,includeOptions:c}=this._getSharedOptions(t,r),d=a.axis,u=o.axis;for(let p=t;p<t+i;p++){let t=e[p],i=!s&&this.getParsed(p),f={},m=f[d]=s?a.getPixelForDecimal(.5):a.getPixelForValue(i[d]),g=f[u]=s?o.getBasePixel():o.getPixelForValue(i[u]);f.skip=isNaN(m)||isNaN(g),c&&(f.options=h||this.resolveDataElementOptions(p,t.active?"active":r),s&&(f.options.radius=0)),this.updateElement(t,p,f,r)}}resolveDataElementOptions(e,t){let i=this.getParsed(e),r=super.resolveDataElementOptions(e,t);r.$shared&&(r=Object.assign({},r,{$shared:!1}));let s=r.radius;return"active"!==t&&(r.radius=0),r.radius+=U(i&&i._custom,s),r}},DoughnutController:im,LineController:class extends il{static id="line";static defaults={datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1};static overrides={scales:{_index_:{type:"category"},_value_:{type:"linear"}}};initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(e){let t=this._cachedMeta,{dataset:i,data:r=[],_dataset:s}=t,a=this.chart._animationsDisabled,{start:o,count:h}=eN(t,r,a);this._drawStart=o,this._drawCount=h,eF(t)&&(o=0,h=r.length),i._chart=this.chart,i._datasetIndex=this.index,i._decimated=!!s._decimated,i.points=r;let c=this.resolveDatasetElementOptions(e);this.options.showLine||(c.borderWidth=0),c.segment=this.options.segment,this.updateElement(i,void 0,{animated:!a,options:c},e),this.updateElements(r,o,h,e)}updateElements(e,t,i,r){let s="reset"===r,{iScale:a,vScale:o,_stacked:h,_dataset:c}=this._cachedMeta,{sharedOptions:d,includeOptions:u}=this._getSharedOptions(t,r),p=a.axis,f=o.axis,{spanGaps:m,segment:g}=this.options,v=eg(m)?m:1/0,y=this.chart._animationsDisabled||s||"none"===r,x=t+i,b=e.length,w=t>0&&this.getParsed(t-1);for(let i=0;i<b;++i){let m=e[i],b=y?m:{};
8198if(i<t||i>=x){b.skip=!0;continue}let _=this.getParsed(i),S=B(_[f]),C=b[p]=a.getPixelForValue(_[p],i),M=b[f]=s||S?o.getBasePixel():o.getPixelForValue(h?this.applyStack(o,_,h):_[f],i);b.skip=isNaN(C)||isNaN(M)||S,b.stop=i>0&&Math.abs(_[p]-w[p])>v,g&&(b.parsed=_,b.raw=c.data[i]),u&&(b.options=d||this.resolveDataElementOptions(i,m.active?"active":r)),y||this.updateElement(m,i,b,r),w=_}}getMaxOverflow(){let e=this._cachedMeta,t=e.dataset,i=t.options&&t.options.borderWidth||0,r=e.data||[];return r.length?Math.max(i,r[0].size(this.resolveDataElementOptions(0)),r[r.length-1].size(this.resolveDataElementOptions(r.length-1)))/2:i}draw(){let e=this._cachedMeta;e.dataset.updateControlPoints(this.chart.chartArea,e.iScale.axis),super.draw()}},PieController:class extends im{static id="pie";static defaults={cutout:0,rotation:0,circumference:360,radius:"100%"}},PolarAreaController:ig,RadarController:class extends il{static id="radar";static defaults={datasetElementType:"line",dataElementType:"point",indexAxis:"r",showLine:!0,elements:{line:{fill:"start"}}};static overrides={aspectRatio:1,scales:{r:{type:"radialLinear"}}};getLabelAndValue(e){let t=this._cachedMeta.vScale,i=this.getParsed(e);return{label:t.getLabels()[e],value:""+t.getLabelForValue(i[t.axis])}}parseObjectData(e,t,i,r){return tE.bind(this)(e,t,i,r)}update(e){let t=this._cachedMeta,i=t.dataset,r=t.data||[],s=t.iScale.getLabels();if(i.points=r,"resize"!==e){let t=this.resolveDatasetElementOptions(e);this.options.showLine||(t.borderWidth=0);let a={_loop:!0,_fullLoop:s.length===r.length,options:t};this.updateElement(i,void 0,a,e)}this.updateElements(r,0,r.length,e)}updateElements(e,t,i,r){let s=this._cachedMeta.rScale,a="reset"===r;for(let o=t;o<t+i;o++){let t=e[o],i=this.resolveDataElementOptions(o,t.active?"active":r),h=s.getPointPositionForValue(o,this.getParsed(o).r),c=a?s.xCenter:h.x,d=a?s.yCenter:h.y,u={x:c,y:d,angle:h.angle,skip:isNaN(c)||isNaN(d),options:i};this.updateElement(t,o,u,r)}}},ScatterController:iv});function ix(){throw Error("This method is not implemented: Check that a complete date adapter is provided.")}class ib{static override(e){Object.assign(ib.prototype,e)}options;constructor(e){this.options=e||{}}init(){}formats(){return ix()}parse(){return ix()}format(){return ix()}add(){return ix()}diff(){return ix()}startOf(){return ix()}endOf(){return ix()}}function iw(e,t,i,r,s){let a=e.getSortedVisibleDatasetMetas(),o=i[t];for(let e=0,i=a.length;e<i;++e){let{index:i,data:h}=a[e],{lo:c,hi:d}=function(e,t,i,r){let{controller:s,data:a,_sorted:o}=e,h=s._cachedMeta.iScale,c=e.dataset&&e.dataset.options?e.dataset.options.spanGaps:null;if(h&&t===h.axis&&"r"!==t&&o&&a.length){let o=h._reversePixels?eD:eP;if(r){if(s._sharedOptions){let e=a[0],r="function"==typeof e.getRange&&e.getRange(t);if(r){let e=o(a,t,i-r),s=o(a,t,i+r);return{lo:e.lo,hi:s.hi}}}}else{let r=o(a,t,i);if(c){let{vScale:t}=s._cachedMeta,{_parsed:i}=e,a=i.slice(0,r.lo+1).reverse().findIndex(e=>!B(e[t.axis]));r.lo-=Math.max(0,a);let o=i.slice(r.hi).findIndex(e=>!B(e[t.axis]));r.hi+=Math.max(0,o)}return r}}return{lo:0,hi:a.length-1}}(a[e],t,o,s);for(let e=c;e<=d;++e){let t=h[e];t.skip||r(t,i,e)}}}function i_(e,t,i,r,s){let a=[];return(s||e.isPointInArea(t))&&iw(e,i,t,function(i,o,h){(s||e9(i,e.chartArea,0))&&i.inRange(t.x,t.y,r)&&a.push({element:i,datasetIndex:o,index:h})},!0),a}function iS(e,t,i,r,s,a){let o,h,c,d,u,p;return a||e.isPointInArea(t)?"r"!==i||r?(o=[],h=-1!==i.indexOf("x"),
8198c=-1!==i.indexOf("y"),d=function(e,t){return Math.sqrt(Math.pow(h?Math.abs(e.x-t.x):0,2)+Math.pow(c?Math.abs(e.y-t.y):0,2))},u=1/0,iw(e,i,t,function(i,h,c){let p=i.inRange(t.x,t.y,s);if(r&&!p)return;let f=i.getCenterPoint(s);if(!(a||e.isPointInArea(f))&&!p)return;let m=d(t,f);m<u?(o=[{element:i,datasetIndex:h,index:c}],u=m):m===u&&o.push({element:i,datasetIndex:h,index:c})}),o):(p=[],iw(e,i,t,function(e,i,r){let{startAngle:a,endAngle:o}=e.getProps(["startAngle","endAngle"],s),{angle:h}=ew(e,{x:t.x,y:t.y});eM(h,a,o)&&p.push({element:e,datasetIndex:i,index:r})}),p):[]}function iC(e,t,i,r,s){let a=[],o="x"===i?"inXRange":"inYRange",h=!1;return(iw(e,i,t,(e,r,c)=>{e[o]&&e[o](t[i],s)&&(a.push({element:e,datasetIndex:r,index:c}),h=h||e.inRange(t.x,t.y,s))}),r&&!h)?[]:a}var iM={modes:{index(e,t,i,r){let s=tz(t,e),a=i.axis||"x",o=i.includeInvisible||!1,h=i.intersect?i_(e,s,a,r,o):iS(e,s,a,!1,r,o),c=[];return h.length?(e.getSortedVisibleDatasetMetas().forEach(e=>{let t=h[0].index,i=e.data[t];i&&!i.skip&&c.push({element:i,datasetIndex:e.index,index:t})}),c):[]},dataset(e,t,i,r){let s=tz(t,e),a=i.axis||"xy",o=i.includeInvisible||!1,h=i.intersect?i_(e,s,a,r,o):iS(e,s,a,!1,r,o);if(h.length>0){let t=h[0].datasetIndex,i=e.getDatasetMeta(t).data;h=[];for(let e=0;e<i.length;++e)h.push({element:i[e],datasetIndex:t,index:e})}return h},point(e,t,i,r){let s=tz(t,e);return i_(e,s,i.axis||"xy",r,i.includeInvisible||!1)},nearest(e,t,i,r){let s=tz(t,e),a=i.axis||"xy",o=i.includeInvisible||!1;return iS(e,s,a,i.intersect,r,o)},x(e,t,i,r){let s=tz(t,e);return iC(e,s,"x",i.intersect,r)},y(e,t,i,r){let s=tz(t,e);return iC(e,s,"y",i.intersect,r)}}};let iE=["left","top","right","bottom"];function iA(e,t){return e.filter(e=>e.pos===t)}function iT(e,t){return e.filter(e=>-1===iE.indexOf(e.pos)&&e.box.axis===t)}function iP(e,t){return e.sort((e,i)=>{let r=t?i:e,s=t?e:i;return r.weight===s.weight?r.index-s.index:r.weight-s.weight})}function iD(e,t,i,r){return Math.max(e[i],t[i])+Math.max(e[r],t[r])}function iO(e,t){e.top=Math.max(e.top,t.top),e.left=Math.max(e.left,t.left),e.bottom=Math.max(e.bottom,t.bottom),e.right=Math.max(e.right,t.right)}function iL(e,t,i,r){let s,a,o,h,c,d,u=[];for(s=0,a=e.length,c=0;s<a;++s){(h=(o=e[s]).box).update(o.width||t.w,o.height||t.h,function(e,t){let i=t.maxPadding;return function(e){let r={left:0,top:0,right:0,bottom:0};return e.forEach(e=>{r[e]=Math.max(t[e],i[e])}),r}(e?["left","right"]:["top","bottom"])}(o.horizontal,t));let{same:a,other:p}=function(e,t,i,r){let{pos:s,box:a}=i,o=e.maxPadding;if(!N(s)){i.size&&(e[s]-=i.size);let t=r[i.stack]||{size:0,count:1};t.size=Math.max(t.size,i.horizontal?a.height:a.width),i.size=t.size/t.count,e[s]+=i.size}a.getPadding&&iO(o,a.getPadding());let h=Math.max(0,t.outerWidth-iD(o,e,"left","right")),c=Math.max(0,t.outerHeight-iD(o,e,"top","bottom")),d=h!==e.w,u=c!==e.h;return e.w=h,e.h=c,i.horizontal?{same:d,other:u}:{same:u,other:d}}(t,i,o,r);c|=a&&u.length,d=d||p,h.fullSize||u.push(o)}return c&&iL(u,t,i,r)||d}function iI(e,t,i,r,s){e.top=i,e.left=t,e.right=t+r,e.bottom=i+s,e.width=r,e.height=s}function iR(e,t,i,r){let s=i.padding,{x:a,y:o}=t;for(let h of e){let e=h.box,c=r[h.stack]||{count:1,placed:0,weight:1},d=h.stackWeight/c.weight||1;if(h.horizontal){let r=t.w*d,a=c.size||e.height;et(c.start)&&(o=c.start),e.fullSize?iI(e,s.left,o,i.outerWidth-s.right-s.left,a):iI(e,t.left+c.placed,o,r,a),c.start=o,c.placed+=r,o=e.bottom}else{let r=t.h*d,o=c.size||e.width;et(c.start)&&(a=c.start),e.fullSize?iI(e,a,s.top,o,i.outerHeight-s.bottom-s.top):iI(e,a,t.top+c.placed,o,r),c.start=a,c.placed+=r,a=e.right}}t.x=a,t.y=o}var ik={addBox(e,t){e.boxes||(e.boxes=[]),t.fullSize=t.fullSize||!1,t.position=t.position||"top",t.weight=t.weight||0,t._layers=t._layers||function(){return[{z:0,draw(e){t.draw(e)}}]},e.boxes.push(t)},removeBox(e,t){let i=e.boxes?e.boxes.indexOf(t):-1;-1!==i&&e.boxes.splice(i,1)},configure(e,t,i){t.fullSize=i.fullSize,t.position=i.position,t.weight=i.weight},update(e,t,i,r){let s,a,o,h,c,d,u,p;if(!e)return;let f=td(e.options.layout.padding),m=Math.max(t-f.width,0),g=Math.max(i-f.height,0),v=(a=iP((s=function(e){let t,i,r,s,a,o,h=[];for(t=0,i=(e||[]).length;t<i;++t)r=e[t],({position:s,options:{stack:a,stackWeight:o=1}}=r),h.push({index:t,box:r,pos:s,horizontal:r.isHorizontal(),weight:r.weight,stack:a&&s+a,stackWeight:o});return h}(e.boxes)).filter(e=>e.box.fullSize),!0),o=iP(iA(s,"left"),!0),h=iP(iA(s,"right")),c=iP(iA(s,"top"),!0),d=iP(iA(s,"bottom")),u=iT(s,"x"),p=iT(s,"y"),{fullSize:a,leftAndTop:o.c
8198oncat(c),rightAndBottom:h.concat(p).concat(d).concat(u),chartArea:iA(s,"chartArea"),vertical:o.concat(h).concat(p),horizontal:c.concat(d).concat(u)}),y=v.vertical,x=v.horizontal;H(e.boxes,e=>{"function"==typeof e.beforeLayout&&e.beforeLayout()});let b=Object.freeze({outerWidth:t,outerHeight:i,padding:f,availableWidth:m,availableHeight:g,vBoxMaxWidth:m/2/(y.reduce((e,t)=>t.box.options&&!1===t.box.options.display?e:e+1,0)||1),hBoxMaxHeight:g/2}),w=Object.assign({},f);iO(w,td(r));let _=Object.assign({maxPadding:w,w:m,h:g,x:f.left,y:f.top},f),S=function(e,t){let i,r,s,a=function(e){let t={};for(let i of e){let{stack:e,pos:r,stackWeight:s}=i;if(!e||!iE.includes(r))continue;let a=t[e]||(t[e]={count:0,placed:0,weight:0,size:0});a.count++,a.weight+=s}return t}(e),{vBoxMaxWidth:o,hBoxMaxHeight:h}=t;for(i=0,r=e.length;i<r;++i){let{fullSize:r}=(s=e[i]).box,c=a[s.stack],d=c&&s.stackWeight/c.weight;s.horizontal?(s.width=d?d*o:r&&t.availableWidth,s.height=h):(s.width=o,s.height=d?d*h:r&&t.availableHeight)}return a}(y.concat(x),b);iL(v.fullSize,_,b,S),iL(y,_,b,S),iL(x,_,b,S)&&iL(y,_,b,S);let C=_.maxPadding;function M(e){let t=Math.max(C[e]-_[e],0);return _[e]+=t,t}_.y+=M("top"),_.x+=M("left"),M("right"),M("bottom"),iR(v.leftAndTop,_,b,S),_.x+=_.w,_.y+=_.h,iR(v.rightAndBottom,_,b,S),e.chartArea={left:_.left,top:_.top,right:_.left+_.w,bottom:_.top+_.h,height:_.h,width:_.w},H(v.chartArea,t=>{let i=t.box;Object.assign(i,e.chartArea),i.update(_.w,_.h,{left:0,top:0,right:0,bottom:0})})}};class iB{acquireContext(e,t){}releaseContext(e){return!1}addEventListener(e,t,i){}removeEventListener(e,t,i){}getDevicePixelRatio(){return 1}getMaximumSize(e,t,i,r){return t=Math.max(0,t||e.width),i=i||e.height,{width:t,height:Math.max(0,r?Math.floor(t/r):i)}}isAttached(e){return!0}updateConfig(e){}}class iz extends iB{acquireContext(e){return e&&e.getContext&&e.getContext("2d")||null}updateConfig(e){e.options.animation=!1}}let iN="$chartjs",iF={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},ij=e=>null===e||""===e,iU=!!tj&&{passive:!0};function iV(e,t){for(let i of e)if(i===t||i.contains(t))return!0}function iW(e,t,i){let r=e.canvas,s=new MutationObserver(e=>{let t=!1;for(let i of e)t=(t=t||iV(i.addedNodes,r))&&!iV(i.removedNodes,r);t&&i()});return s.observe(document,{childList:!0,subtree:!0}),s}function iH(e,t,i){let r=e.canvas,s=new MutationObserver(e=>{let t=!1;for(let i of e)t=(t=t||iV(i.removedNodes,r))&&!iV(i.addedNodes,r);t&&i()});return s.observe(document,{childList:!0,subtree:!0}),s}let iG=new Map,iq=0;function iX(){let e=window.devicePixelRatio;e!==iq&&(iq=e,iG.forEach((t,i)=>{i.currentDevicePixelRatio!==e&&t()}))}function iY(e,t,i){let r=e.canvas,s=r&&tL(r);if(!s)return;let a=ek((e,t)=>{let r=s.clientWidth;i(e,t),r<s.clientWidth&&i()},window),o=new ResizeObserver(e=>{let t=e[0],i=t.contentRect.width,r=t.contentRect.height;(0!==i||0!==r)&&a(i,r)});return o.observe(s),iG.size||window.addEventListener("resize",iX),iG.set(e,a),o}function iQ(e,t,i){i&&i.disconnect(),"resize"===t&&(iG.delete(e),iG.size||window.removeEventListener("resize",iX))}function iZ(e,t,i){let r=e.canvas,s=ek(t=>{null!==e.ctx&&i(function(e,t){let i=iF[e.type]||e.type,{x:r,y:s}=tz(e,t);return{type:i,chart:t,native:e,x:void 0!==r?r:null,y:void 0!==s?s:null}}(t,e))},e);return r&&r.addEventListener(t,s,iU),s}class iK extends iB{acquireContext(e,t){let i=e&&e.getContext&&e.getContext("2d");return i&&i.canvas===e?(!function(e,t){let i=e.style,r=e.getAttribute("height"),s=e.getAttribute("width");if(e[iN]={initial:{height:r,width:s,style:{display:i.display,height:i.height,width:i.width}}},i.display=i.display||"block",i.boxSizing=i.boxSizing||"border-box",ij(s)){let t=tU(e,"width");void 0!==t&&(e.width=t)}if(ij(r))if(""===e.style.height)e.height=e.width/(t||2);else{let t=tU(e,"height");void 0!==t&&(e.height=t)}}(e,t),i):null}releaseContext(e){let t=e.canvas;if(!t[iN])return!1;let i=t[iN].initial;["height","width"].forEach(e=>{let r=i[e];B(r)?t.removeAttribute(e):t.setAttribute(e,r)});let r=i.style||{};
8198return Object.keys(r).forEach(e=>{t.style[e]=r[e]}),t.width=t.width,delete t[iN],!0}addEventListener(e,t,i){this.removeEventListener(e,t);let r=e.$proxies||(e.$proxies={}),s={attach:iW,detach:iH,resize:iY}[t]||iZ;r[t]=s(e,t,i)}removeEventListener(e,t){let i=e.$proxies||(e.$proxies={}),r=i[t];r&&((({attach:iQ,detach:iQ,resize:iQ})[t]||function(e,t,i){e&&e.canvas&&e.canvas.removeEventListener(t,i,iU)})(e,t,r),i[t]=void 0)}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(e,t,i,r){return function(e,t,i,r){let s=tR(e),a=tB(s,"margin"),o=tI(s.maxWidth,e,"clientWidth")||eo,h=tI(s.maxHeight,e,"clientHeight")||eo,c=function(e,t,i){let r,s;if(void 0===t||void 0===i){let a=e&&tL(e);if(a){let e=a.getBoundingClientRect(),o=tR(a),h=tB(o,"border","width"),c=tB(o,"padding");t=e.width-c.width-h.width,i=e.height-c.height-h.height,r=tI(o.maxWidth,a,"clientWidth"),s=tI(o.maxHeight,a,"clientHeight")}else t=e.clientWidth,i=e.clientHeight}return{width:t,height:i,maxWidth:r||eo,maxHeight:s||eo}}(e,t,i),{width:d,height:u}=c;if("content-box"===s.boxSizing){let e=tB(s,"border","width"),t=tB(s,"padding");d-=t.width+e.width,u-=t.height+e.height}return d=Math.max(0,d-a.width),u=Math.max(0,r?d/r:u-a.height),d=tN(Math.min(d,o,c.maxWidth)),u=tN(Math.min(u,h,c.maxHeight)),d&&!u&&(u=tN(d/2)),(void 0!==t||void 0!==i)&&r&&c.height&&u>c.height&&(d=tN(Math.floor((u=c.height)*r))),{width:d,height:u}}(e,t,i,r)}isAttached(e){let t=e&&tL(e);return!!(t&&t.isConnected)}}class iJ{static defaults={};static defaultRoutes=void 0;x;y;active=!1;options;$animations;tooltipPosition(e){let{x:t,y:i}=this.getProps(["x","y"],e);return{x:t,y:i}}hasValue(){return eg(this.x)&&eg(this.y)}getProps(e,t){let i=this.$animations;if(!t||!i)return this;let r={};return e.forEach(e=>{r[e]=i[e]&&i[e].active()?i[e]._to:this[e]}),r}}function i$(e,t,i,r,s){let a,o,h,c=U(r,0),d=Math.min(U(s,e.length),e.length),u=0;for(i=Math.ceil(i),s&&(i=(a=s-r)/Math.floor(a/i)),h=c;h<0;)h=Math.round(c+ ++u*i);for(o=Math.max(c,0);o<d;o++)o===h&&(t.push(e[o]),h=Math.round(c+ ++u*i))}let i0=(e,t,i)=>"top"===t||"left"===t?e[t]+i:e[t]-i,i1=(e,t)=>Math.min(t||e,e);function i2(e,t){let i=[],r=e.length/t,s=e.length,a=0;for(;a<s;a+=r)i.push(e[Math.floor(a)]);return i}function i3(e){return e.drawTicks?e.tickLength:0}function i4(e,t){if(!e.display)return 0;let i=tu(e.font,t),r=td(e.padding);return(z(e.text)?e.text.length:1)*i.lineHeight+r.height}class i5 extends iJ{constructor(e){super(),this.id=e.id,this.type=e.type,this.options=void 0,this.ctx=e.ctx,this.chart=e.chart,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this._margins={left:0,right:0,top:0,bottom:0},this.maxWidth=void 0,this.maxHeight=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.axis=void 0,this.labelRotation=void 0,this.min=void 0,this.max=void 0,this._range=void 0,this.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=0,this._maxLength=0,this._longestTextCache={},this._startPixel=void 0,this._endPixel=void 0,this._reversePixels=!1,this._userMax=void 0,this._userMin=void 0,this._suggestedMax=void 0,this._suggestedMin=void 0,this._ticksLength=0,this._borderValue=0,this._cache={},this._dataLimitsCached=!1,this.$context=void 0}init(e){this.options=e.setContext(this.getContext()),this.axis=e.axis,this._userMin=this.parse(e.min),this._userMax=this.parse(e.max),this._suggestedMin=this.parse(e.suggestedMin),this._suggestedMax=this.parse(e.suggestedMax)}parse(e,t){return e}getUserBounds(){let{_userMin:e,_userMax:t,_suggestedMin:i,_suggestedMax:r}=this;return e=j(e,1/0),t=j(t,-1/0),i=j(i,1/0),r=j(r,-1/0),{min:j(e,i),max:j(t,r),minDefined:F(e),maxDefined:F(t)}}getMinMax(e){let t,{min:i,max:r,minDefined:s,maxDefined:a}=this.getUserBounds();if(s&&a)return{min:i,max:r};let o=this.getMatchingVisibleMetas();for(let h=0,c=o.length;h<c;++h)t=o[h].controller.getMinMax(this,e),s||(i=Math.min(i,t.min)),a||(r=Math.max(r,t.max));return i=a&&i>r?r:i,r=s&&i>r?i:r,{min:j(i,j(r,i)),max:j(r,j(i,r))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){let e=this.chart.data;return this.options.labels||(this.isHorizontal()?e.xLabels:e.yLabels)||e.labels||[]}
8198getLabelItems(e=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(e))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){W(this.options.beforeUpdate,[this])}update(e,t,i){let{beginAtZero:r,grace:s,ticks:a}=this.options,o=a.sampleSize;this.beforeUpdate(),this.maxWidth=e,this.maxHeight=t,this._margins=i=Object.assign({left:0,right:0,top:0,bottom:0},i),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+i.left+i.right:this.height+i.top+i.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=function(e,t,i){let{min:r,max:s}=e,a=V(t,(s-r)/2),o=(e,t)=>i&&0===e?0:e+t;return{min:o(r,-Math.abs(a)),max:o(s,a)}}(this,s,r),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();let h=o<this.ticks.length;this._convertTicksToLabels(h?i2(this.ticks,o):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),a.display&&(a.autoSkip||"auto"===a.source)&&(this.ticks=function(e,t){var i;let r,s,a=e.options.ticks,o=(r=(i=e).options.offset,s=i._tickSize(),Math.floor(Math.min(i._length/s+ +!r,i._maxLength/s))),h=Math.min(a.maxTicksLimit||o,o),c=a.major.enabled?function(e){let t,i,r=[];for(t=0,i=e.length;t<i;t++)e[t].major&&r.push(t);return r}(t):[],d=c.length,u=c[0],p=c[d-1],f=[];if(d>h)return function(e,t,i,r){let s,a=0,o=i[0];for(s=0,r=Math.ceil(r);s<e.length;s++)s===o&&(t.push(e[s]),o=i[++a*r])}(t,f,c,d/h),f;let m=function(e,t,i){let r=function(e){let t,i,r=e.length;if(r<2)return!1;for(i=e[0],t=1;t<r;++t)if(e[t]-e[t-1]!==i)return!1;return i}(e),s=t.length/i;if(!r)return Math.max(s,1);let a=function(e){let t,i=[],r=Math.sqrt(e);for(t=1;t<r;t++)e%t==0&&(i.push(t),i.push(e/t));return r===(0|r)&&i.push(r),i.sort((e,t)=>e-t).pop(),i}(r);for(let e=0,t=a.length-1;e<t;e++){let t=a[e];if(t>s)return t}return Math.max(s,1)}(c,t,h);if(d>0){let e,i,r=d>1?Math.round((p-u)/(d-1)):null;for(i$(t,f,m,B(r)?0:u-r,u),e=0,i=d-1;e<i;e++)i$(t,f,m,c[e],c[e+1]);return i$(t,f,m,p,B(r)?t.length:p+r),f}return i$(t,f,m),f}(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),h&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let e,t,i=this.options.reverse;this.isHorizontal()?(e=this.left,t=this.right):(e=this.top,t=this.bottom,i=!i),this._startPixel=e,this._endPixel=t,this._reversePixels=i,this._length=t-e,this._alignToPixels=this.options.alignToPixels}afterUpdate(){W(this.options.afterUpdate,[this])}beforeSetDimensions(){W(this.options.beforeSetDimensions,[this])}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=0,this.right=this.width):(this.height=this.maxHeight,this.top=0,this.bottom=this.height),this.paddingLeft=0,this.paddingTop=0,this.paddingRight=0,this.paddingBottom=0}afterSetDimensions(){W(this.options.afterSetDimensions,[this])}_callHooks(e){this.chart.notifyPlugins(e,this.getContext()),W(this.options[e],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){W(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(e){let t,i,r,s=this.options.ticks;for(t=0,i=e.length;t<i;t++)(r=e[t]).label=W(s.callback,[r.value,t,e],this)}afterTickToLabelConversion(){W(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){W(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){let e,t,i,r=this.options,s=r.ticks,a=i1(this.ticks.length,r.ticks.maxTicksLimit),o=s.minRotation||0,h=s.maxRotation,c=o;if(!this._isVisible()||!s.display||o>=h||a<=1||!this.isHorizontal()){this.labelRotation=o;return}let d=this._getLabelSizes(),u=d.widest.width,p=d.highest.height,f=eE(this.chart.width-u,0,this.maxWidth);u+6>(e=r.offset?this.maxWidth/a:f/(a-1))&&(e=f/(a-(r.offset?.5:1)),t=this.maxHeight-i3(r.grid)-s.padding-i4(r.title,this.chart.options.font),i=Math.sqrt(u*u+p*p),c=Math.max(o,Math.min(h,c=ex(Math.min(Math.asin(eE((d.highest.height+6)/e,-1,1)),Math.asin(eE(t/i,-1,1))-Math.asin(eE(p/i,-1,1))))))),this.labelRotation=c}afterCalculateLabelRotation(){W(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){W(this.options.beforeFit,[this])}fit(){let e={width:0,height:0},{chart:t,options:{ticks:i,title:r,grid:s}}=this,a=this._isVisible(),o=this.isHorizontal();if(a){let a=i4(r,t.options.font);if(o?(e.width=this.maxWidth,e.height=i3(s)+a):(e.height=this.maxHeight,e.width=i3(s)+a),i.display&&this.ticks.length){let{first:t,last:r,widest:s,highest:a}=this._getLabelSizes(),h=2*i.padding,c=ey(this.labelRotation),d=Math.cos(c),u=Math.sin(c);if(o){let t=i.mirror?0:u*s.width+d*a.height;e.height=Math.min(this.maxHeight,e.height+t+h)}else{let t=i.mirror?0:d*s.width+u*a.height;e.width=Math.min(this.maxWidth,e.width+t+h)}this._calculatePadding(t,r,u,d)}}this._handleMargins(),o?(this.width=this._length=t.width-this._margins.left-this._margins.right,this.height=e.height):(this.width=e.width,this.height=this._length=t.height-this._margins.top-this._margins.bottom)}_calculatePadding(e,t,i,r){let{ticks:{align:s,padding:a},position:o}=this.options,h=0!==this.labelRotation,c="top"!==o&&"x"===this.axis;if(this.isHorizontal()){let o=this.getPixelForTick(0)-this.left,d=this.right-this.getPixelForTick(this.ticks.length-1),u=0,p=0;h?c?(u=r*e.width,p=i*t.height):(u=i*e.height,p=r*t.width):"start"===s?p=t.width:"end"===s?u=e.width:"inner"!==s&&(u=e.width/2,p=t.width/2),this.paddingLeft=Math.max((u-o+a)*this.width/(this.width-o),0),this.paddingRight=Math.max((p-d+a)*this.width/(this.width-d),0)}else{let i=t.height/2,r=e.height/2;"start"===s?(i=0,r=e.height):"end"===s&&(i=t.height,r=0),this.paddingTop=i+a,this.paddingBottom=r+a}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){W(this.options.afterFit,[this])}isHorizontal(){let{axis:e,position:t}=this.options;return"top"===t||"bottom"===t||"x"===e}isFullSize(){return this.options.fullSize}_convertTicksToLabels(e){let t,i;for(this.beforeTickToLabelConversion(),this.generateTickLabels(e),t=0,i=e.length;t<i;t++)B(e[t].label)&&(e.splice(t,1),i--,t--);this.afterTickToLabelConversion()}_getLabelSizes(){let e=this._labelSizes;if(!e){let t=this.options.ticks.sampleSize,i=this.ticks;t<i.length&&(i=i2(i,t)),this._labelSizes=e=this._computeLabelSizes(i,i.length,this.options.ticks.maxTicksLimit)}return e}_computeLabelSizes(e,t,i){let r,s,a,o,h,c,d,u,p,f,m,{ctx:g,_longestTextCache:v}=this,y=[],x=[],b=Math.floor(t/i1(t,i)),w=0,_=0;for(r=0;r<t;r+=b){if(o=e[r].label,g.font=c=(h=this._resolveTickFontOptions(r)).string,d=v[c]=v[c]||{data:{},gc:[]},u=h.lineHeight,p=f=0,B(o)||z(o)){if(z(o))for(s=0,a=o.length;s<a;++s)B(m=o[s])||z(m)||(p=e3(g,d.data,d.gc,p,m),f+=u)}
8198else p=e3(g,d.data,d.gc,p,o),f=u;y.push(p),x.push(f),w=Math.max(p,w),_=Math.max(f,_)}H(v,e=>{let i,r=e.gc,s=r.length/2;if(s>t){for(i=0;i<s;++i)delete e.data[r[i]];r.splice(0,s)}});let S=y.indexOf(w),C=x.indexOf(_),M=e=>({width:y[e]||0,height:x[e]||0});return{first:M(0),last:M(t-1),widest:M(S),highest:M(C),widths:y,heights:x}}getLabelForValue(e){return e}getPixelForValue(e,t){return NaN}getValueForPixel(e){}getPixelForTick(e){let t=this.ticks;return e<0||e>t.length-1?null:this.getPixelForValue(t[e].value)}getPixelForDecimal(e){this._reversePixels&&(e=1-e);let t=this._startPixel+e*this._length;return eE(this._alignToPixels?e4(this.chart,t,0):t,-32768,32767)}getDecimalForPixel(e){let t=(e-this._startPixel)/this._length;return this._reversePixels?1-t:t}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){let{min:e,max:t}=this;return e<0&&t<0?t:e>0&&t>0?e:0}getContext(e){var t,i;let r=this.ticks||[];if(e>=0&&e<r.length){let i=r[e];return i.$context||(t=this.getContext(),i.$context=tf(t,{tick:i,index:e,type:"tick"}))}return this.$context||(this.$context=(i=this.chart.getContext(),tf(i,{scale:this,type:"scale"})))}_tickSize(){let e=this.options.ticks,t=ey(this.labelRotation),i=Math.abs(Math.cos(t)),r=Math.abs(Math.sin(t)),s=this._getLabelSizes(),a=e.autoSkipPadding||0,o=s?s.widest.width+a:0,h=s?s.highest.height+a:0;return this.isHorizontal()?h*i>o*r?o/i:h/r:h*r<o*i?h/i:o/r}_isVisible(){let e=this.options.display;return"auto"!==e?!!e:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(e){let t,i,r,s,a,o,h,c,d,u,p,f,m=this.axis,g=this.chart,v=this.options,{grid:y,position:x,border:b}=v,w=y.offset,_=this.isHorizontal(),S=this.ticks.length+ +!!w,C=i3(y),M=[],E=b.setContext(this.getContext()),A=E.display?E.width:0,T=A/2,P=function(e){return e4(g,e,A)};if("top"===x)t=P(this.bottom),o=this.bottom-C,c=t-T,u=P(e.top)+T,f=e.bottom;else if("bottom"===x)t=P(this.top),u=e.top,f=P(e.bottom)-T,o=t+T,c=this.top+C;else if("left"===x)t=P(this.right),a=this.right-C,h=t-T,d=P(e.left)+T,p=e.right;else if("right"===x)t=P(this.left),d=e.left,p=P(e.right)-T,a=t+T,h=this.left+C;else if("x"===m){if("center"===x)t=P((e.top+e.bottom)/2+.5);else if(N(x)){let e=Object.keys(x)[0],i=x[e];t=P(this.chart.scales[e].getPixelForValue(i))}u=e.top,f=e.bottom,c=(o=t+T)+C}else if("y"===m){if("center"===x)t=P((e.left+e.right)/2);else if(N(x)){let e=Object.keys(x)[0],i=x[e];t=P(this.chart.scales[e].getPixelForValue(i))}h=(a=t-T)-C,d=e.left,p=e.right}let D=U(v.ticks.maxTicksLimit,S),O=Math.max(1,Math.ceil(S/D));for(i=0;i<S;i+=O){let e=this.getContext(i),t=y.setContext(e),m=b.setContext(e),v=t.lineWidth,x=t.color,S=m.dash||[],C=m.dashOffset,E=t.tickWidth,A=t.tickColor,T=t.tickBorderDash||[],P=t.tickBorderDashOffset;void 0!==(r=function(e,t,i){let r,s=e.ticks.length,a=Math.min(t,s-1),o=e._startPixel,h=e._endPixel,c=e.getPixelForTick(a);if(!i||(r=1===s?Math.max(c-o,h-c):0===t?(e.getPixelForTick(1)-c)/2:(c-e.getPixelForTick(a-1))/2,!((c+=a<t?r:-r)<o-1e-6)&&!(c>h+1e-6)))return c}(this,i,w))&&(s=e4(g,r,v),_?a=h=d=p=s:o=c=u=f=s,M.push({tx1:a,ty1:o,tx2:h,ty2:c,x1:d,y1:u,x2:p,y2:f,width:v,color:x,borderDash:S,borderDashOffset:C,tickWidth:E,tickColor:A,tickBorderDash:T,tickBorderDashOffset:P}))}return this._ticksLength=S,this._borderValue=t,M}_computeLabelItems(e){let t,i,r,s,a,o,h,c,d,u,p,f=this.axis,m=this.options,{position:g,ticks:v}=m,y=this.isHorizontal(),x=this.ticks,{align:b,crossAlign:w,padding:_,mirror:S}=v,C=i3(m.grid),M=C+_,E=S?-_:M,A=-ey(this.labelRotation),T=[],P="middle";if("top"===g)a=this.bottom-E,o=this._getXAxisLabelAlignment();else if("bottom"===g)a=this.top+E,o=this._getXAxisLabelAlignment();else if("left"===g){let e=this._getYAxisLabelAlignment(C);o=e.textAlign,s=e.x}else if("right"===g){let e=this._getYAxisLabelAlignment(C);o=e.textAlign,s=e.x}else if("x"===f){if("center"===g)a=(e.top+e.bottom)/2+M;else if(N(g)){let e=Object.keys(g)[0],t=g[e];a=this.chart.scales[e].getPixelForValue(t)+M}o=this._getXAxisLabelAlignment()}else if("y"===f){if("center"===g)s=(e.left+e.right)/2-M;else if(N(g)){let e=Object.keys(g)[0],t=g[e];s=this.chart.scales[e].getPixelForValue(t)}o=this._getYAxisLabelAlignment(C).textAlign}"y"===f&&("start"===b?P="top":"end"===b&&(P="bottom"));let D=this._getLabelSizes();for(t=0,i=x.length;t<i;++t){let e;r=x[t].label;let f=v.setContext(this.getContext(t));h=this.getPixelForTick(t)+v.labelOffset,d=(c=this._resolveTickFontOptions(t)).lineHeight;let m=(u=z(r)?r.length:1)/2,b=f.color,_=f.textStrokeColor,C=f.textStrokeWidth,M=o;
vendor: 1,844 bytes, line 8198
8198if(y?(s=h,"inner"===o&&(M=t===i-1?this.options.reverse?"left":"right":0===t?this.options.reverse?"right":"left":"center"),p="top"===g?"near"===w||0!==A?-u*d+d/2:"center"===w?-D.highest.height/2-m*d+d:-D.highest.height+d/2:"near"===w||0!==A?d/2:"center"===w?D.highest.height/2-m*d:D.highest.height-u*d,S&&(p*=-1),0===A||f.showLabelBackdrop||(s+=d/2*Math.sin(A))):(a=h,p=(1-u)*d/2),f.showLabelBackdrop){let r=td(f.backdropPadding),s=D.heights[t],a=D.widths[t],h=p-r.top,c=0-r.left;switch(P){case"middle":h-=s/2;break;case"bottom":h-=s}switch(o){case"center":c-=a/2;break;case"right":c-=a;break;case"inner":t===i-1?c-=a:t>0&&(c-=a/2)}e={left:c,top:h,width:a+r.width,height:s+r.height,color:f.backdropColor}}T.push({label:r,font:c,textOffset:p,options:{rotation:A,color:b,strokeColor:_,strokeWidth:C,textAlign:M,textBaseline:P,translation:[s,a],backdrop:e}})}return T}_getXAxisLabelAlignment(){let{position:e,ticks:t}=this.options;if(-ey(this.labelRotation))return"top"===e?"left":"right";let i="center";return"start"===t.align?i="left":"end"===t.align?i="right":"inner"===t.align&&(i="inner"),i}_getYAxisLabelAlignment(e){let t,i,{position:r,ticks:{crossAlign:s,mirror:a,padding:o}}=this.options,h=this._getLabelSizes(),c=e+o,d=h.widest.width;return"left"===r?a?(i=this.right+o,"near"===s?t="left":"center"===s?(t="center",i+=d/2):(t="right",i+=d)):(i=this.right-c,"near"===s?t="right":"center"===s?(t="center",i-=d/2):(t="left",i=this.left)):"right"===r?a?(i=this.left+o,"near"===s?t="right":"center"===s?(t="center",i-=d/2):(t="left",i-=d)):(i=this.left+c,"near"===s?t="left":"center"===s?(t="center",i+=d/2):(t="right",i=this.right)):t="right",{textAlign:t,x:i}}_computeLabelArea(){if(this.options.ticks.mirror)return;let e=this.chart,t=this.options.position;return"left"===t||"right"===t?{top:0,left:this.left,bottom:e.height,right:this.right}
8198:"top"===t||"bottom"===t?{top:this.top,left:0,bottom:this.bottom,right:e.width}:void 0}drawBackground(){let{ctx:e,options:{backgroundColor:t},left:i,top:r,width:s,height:a}=this;t&&(e.save(),e.fillStyle=t,e.fillRect(i,r,s,a),e.restore())}getLineWidthForValue(e){let t=this.options.grid;if(!this._isVisible()||!t.display)return 0;let i=this.ticks.findIndex(t=>t.value===e);return i>=0?t.setContext(this.getContext(i)).lineWidth:0}drawGrid(e){let t,i,r=this.options.grid,s=this.ctx,a=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(e)),o=(e,t,i)=>{i.width&&i.color&&(s.save(),s.lineWidth=i.width,s.strokeStyle=i.color,s.setLineDash(i.borderDash||[]),s.lineDashOffset=i.borderDashOffset,s.beginPath(),s.moveTo(e.x,e.y),s.lineTo(t.x,t.y),s.stroke(),s.restore())};if(r.display)for(t=0,i=a.length;t<i;++t){let e=a[t];r.drawOnChartArea&&o({x:e.x1,y:e.y1},{x:e.x2,y:e.y2},e),r.drawTicks&&o({x:e.tx1,y:e.ty1},{x:e.tx2,y:e.ty2},{color:e.tickColor,width:e.tickWidth,borderDash:e.tickBorderDash,borderDashOffset:e.tickBorderDashOffset})}}drawBorder(){let e,t,i,r,{chart:s,ctx:a,options:{border:o,grid:h}}=this,c=o.setContext(this.getContext()),d=o.display?c.width:0;if(!d)return;let u=h.setContext(this.getContext(0)).lineWidth,p=this._borderValue;this.isHorizontal()?(e=e4(s,this.left,d)-d/2,t=e4(s,this.right,u)+u/2,i=r=p):(i=e4(s,this.top,d)-d/2,r=e4(s,this.bottom,u)+u/2,e=t=p),a.save(),a.lineWidth=c.width,a.strokeStyle=c.color,a.beginPath(),a.moveTo(e,i),a.lineTo(t,r),a.stroke(),a.restore()}drawLabels(e){if(!this.options.ticks.display)return;let t=this.ctx,i=this._computeLabelArea();for(let r of(i&&e7(t,i),this.getLabelItems(e))){let e=r.options,i=r.font;tr(t,r.label,0,r.textOffset,i,e)}i&&te(t)}drawTitle(){let e,t,{ctx:i,options:{position:r,title:s,reverse:a}}=this;if(!s.display)return;let o=tu(s.font),h=td(s.padding),c=s.align,d=o.lineHeight/2;"bottom"===r||"center"===r||N(r)?(d+=h.bottom,z(s.text)&&(d+=o.lineHeight*(s.text.length-1))):d+=h.top;let{titleX:u,titleY:p,maxWidth:f,rotation:m}=function(e,t,i,r){let s,a,o,{top:h,left:c,bottom:d,right:u,chart:p}=e,{chartArea:f,scales:m}=p,g=0,v=d-h,y=u-c;if(e.isHorizontal()){if(a=ez(r,c,u),N(i)){let e=Object.keys(i)[0],r=i[e];o=m[e].getPixelForValue(r)+v-t}else o="center"===i?(f.bottom+f.top)/2+v-t:i0(e,i,t);s=u-c}else{if(N(i)){let e=Object.keys(i)[0],r=i[e];a=m[e].getPixelForValue(r)-y+t}else a="center"===i?(f.left+f.right)/2-y+t:i0(e,i,t);o=ez(r,d,h),g="left"===i?-eh:eh}return{titleX:a,titleY:o,maxWidth:s,rotation:g}}(this,d,r,c);tr(i,s.text,0,0,o,{color:s.color,maxWidth:f,rotation:m,textAlign:(e=eB(c),(a&&"right"!==r||!a&&"right"===r)&&(e="left"===(t=e)?"right":"right"===t?"left":t),e),textBaseline:"middle",translation:[u,p]})}draw(e){this._isVisible()&&(this.drawBackground(),this.drawGrid(e),this.drawBorder(),this.drawTitle(),this.drawLabels(e))}_layers(){let e=this.options,t=e.ticks&&e.ticks.z||0,i=U(e.grid&&e.grid.z,-1),r=U(e.border&&e.border.z,0);return this._isVisible()&&this.draw===i5.prototype.draw?[{z:i,draw:e=>{this.drawBackground(),this.drawGrid(e),this.drawTitle()}},{z:r,draw:()=>{this.drawBorder()}},{z:t,draw:e=>{this.drawLabels(e)}}]:[{z:t,draw:e=>{this.draw(e)}}]}getMatchingVisibleMetas(e){let t,i,r=this.chart.getSortedVisibleDatasetMetas(),s=this.axis+"AxisID",a=[];for(t=0,i=r.length;t<i;++t){let i=r[t];i[s]!==this.id||e&&i.type!==e||a.push(i)}return a}_resolveTickFontOptions(e){return tu(this.options.ticks.setContext(this.getContext(e)).font)}_maxDigits(){let e=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/e}}class i6{constructor(e,t,i){this.type=e,this.scope=t,this.override=i,this.items=Object.create(null)}isForType(e){return Object.prototype.isPrototypeOf.call(this.type.prototype,e.prototype)}register(e){var t,i,r,s,a,o;let h,c,d=Object.getPrototypeOf(e);"id"in(t=d)&&"defaults"in t&&(c=this.register(d));let u=this.items,p=e.id,f=this.scope+"."+p;if(!p)throw Error("class does not have id: "+e);return p in u||(u[p]=e,i=e,r=f,s=c,h=Q(Object.create(null),[s?e2.get(s):{},e2.get(r),i.defaults]),e2.set(r,h),i.defaultRoutes&&(a=r,Object.keys(o=i.defaultRoutes).forEac
8198h(e=>{let t=e.split("."),i=t.pop(),r=[a].concat(t).join("."),s=o[e].split("."),h=s.pop(),c=s.join(".");e2.route(r,i,c,h)})),i.descriptors&&e2.describe(r,i.descriptors),this.override&&e2.override(e.id,e.overrides)),f}get(e){return this.items[e]}unregister(e){let t=this.items,i=e.id,r=this.scope;i in t&&delete t[i],r&&i in e2[r]&&(delete e2[r][i],this.override&&delete eJ[i])}}var i8=new class{constructor(){this.controllers=new i6(il,"datasets",!0),this.elements=new i6(iJ,"elements"),this.plugins=new i6(Object,"plugins"),this.scales=new i6(i5,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...e){this._each("register",e)}remove(...e){this._each("unregister",e)}addControllers(...e){this._each("register",e,this.controllers)}addElements(...e){this._each("register",e,this.elements)}addPlugins(...e){this._each("register",e,this.plugins)}addScales(...e){this._each("register",e,this.scales)}getController(e){return this._get(e,this.controllers,"controller")}getElement(e){return this._get(e,this.elements,"element")}getPlugin(e){return this._get(e,this.plugins,"plugin")}getScale(e){return this._get(e,this.scales,"scale")}removeControllers(...e){this._each("unregister",e,this.controllers)}removeElements(...e){this._each("unregister",e,this.elements)}removePlugins(...e){this._each("unregister",e,this.plugins)}removeScales(...e){this._each("unregister",e,this.scales)}_each(e,t,i){[...t].forEach(t=>{let r=i||this._getRegistryForType(t);i||r.isForType(t)||r===this.plugins&&t.id?this._exec(e,r,t):H(t,t=>{let r=i||this._getRegistryForType(t);this._exec(e,r,t)})})}_exec(e,t,i){let r=ee(e);W(i["before"+r],[],i),t[e](i),W(i["after"+r],[],i)}_getRegistryForType(e){for(let t=0;t<this._typedRegistries.length;t++){let i=this._typedRegistries[t];if(i.isForType(e))return i}return this.plugins}_get(e,t,i){let r=t.get(e);if(void 0===r)throw Error('"'+e+'" is not a registered '+i+".");return r}};class i9{constructor(){this._init=[]}notify(e,t,i,r){"beforeInit"===t&&(this._init=this._createDescriptors(e,!0),this._notify(this._init,e,"install"));let s=r?this._descriptors(e).filter(r):this._descriptors(e),a=this._notify(s,e,t,i);return"afterDestroy"===t&&(this._notify(s,e,"stop"),this._notify(this._init,e,"uninstall")),a}_notify(e,t,i,r){for(let s of(r=r||{},e)){let e=s.plugin;if(!1===W(e[i],[t,r,s.options],e)&&r.cancelable)return!1}return!0}invalidate(){B(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(e){if(this._cache)return this._cache;let t=this._cache=this._createDescriptors(e);return this._notifyStateChanges(e),t}_createDescriptors(e,t){let i=e&&e.config,r=U(i.options&&i.options.plugins,{}),s=function(e){let t={},i=[],r=Object.keys(i8.plugins.items);for(let e=0;e<r.length;e++)i.push(i8.getPlugin(r[e]));let s=e.plugins||[];for(let e=0;e<s.length;e++){let r=s[e];-1===i.indexOf(r)&&(i.push(r),t[r.id]=!0)}return{plugins:i,localIds:t}}(i);return!1!==r||t?function(e,{plugins:t,localIds:i},r,s){let a=[],o=e.getContext();for(let c of t){var h;let t=c.id,d=(h=r[t],s||!1!==h?!0===h?{}:h:null);null!==d&&a.push({plugin:c,options:function(e,{plugin:t,local:i},r,s){let a=e.pluginScopeKeys(t),o=e.getOptionScopes(r,a);return i&&t.defaults&&o.push(t.defaults),e.createResolver(o,s,[""],{scriptable:!1,indexable:!1,allKeys:!0})}(e.config,{plugin:c,local:i[t]},d,o)})}return a}(e,s,r,t):[]}_notifyStateChanges(e){let t=this._oldCache||[],i=this._cache,r=(e,t)=>e.filter(e=>!t.some(t=>e.plugin.id===t.plugin.id));this._notify(r(t,i),e,"stop"),this._notify(r(i,t),e,"start")}}function i7(e,t){let i=e2.datasets[e]||{};return((t.datasets||{})[e]||{}).indexAxis||t.indexAxis||i.indexAxis||"x"}function re(e){if("x"===e||"y"===e||"r"===e)return e}function rt(e,...t){if(re(e))return e;for(let r of t){var i;let t=r.axis||("top"===(i=r.position)||"bottom"===i?"x":"left"===i||"right"===i?"y":void 0)||e.length>1&&re(e[0].toLowerCase());if(t)return t}throw Error(`Cannot determine type of '${e}' axis. Please provide 'axis' or 'position' option.`)}function ri(e,t,i){if(i[t+"AxisID"]===e)return{axis:t}}function rr(e){let t,i,r,s,a=e.options||(e.options={});a.plugins=U(a.plugins,{}),t=eJ[e.type]||{scales:{}},i=a.scales||{}
8198,r=i7(e.type,a),s=Object.create(null),Object.keys(i).forEach(a=>{let o=i[a];if(!N(o))return console.error(`Invalid scale configuration for scale: ${a}`);if(o._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${a}`);let h=rt(a,o,function(e,t){if(t.data&&t.data.datasets){let i=t.data.datasets.filter(t=>t.xAxisID===e||t.yAxisID===e);if(i.length)return ri(e,"x",i[0])||ri(e,"y",i[0])}return{}}(a,e),e2.scales[o.type]),c=h===r?"_index_":"_value_",d=t.scales||{};s[a]=Z(Object.create(null),[{axis:h},o,d[h],d[c]])}),e.data.datasets.forEach(t=>{let r=t.type||e.type,o=t.indexAxis||i7(r,a),h=(eJ[r]||{}).scales||{};Object.keys(h).forEach(e=>{let r,a=(r=e,"_index_"===e?r=o:"_value_"===e&&(r="x"===o?"y":"x"),r),c=t[a+"AxisID"]||a;s[c]=s[c]||Object.create(null),Z(s[c],[{axis:a},i[c],h[e]])})}),Object.keys(s).forEach(e=>{let t=s[e];Z(t,[e2.scales[t.type],e2.scale])}),a.scales=s}function rs(e){return(e=e||{}).datasets=e.datasets||[],e.labels=e.labels||[],e}let ra=new Map,rn=new Set;function ro(e,t){let i=ra.get(e);return i||(i=t(),ra.set(e,i),rn.add(i)),i}let rl=(e,t,i)=>{let r=$(t,i);void 0!==r&&e.add(r)};class rh{constructor(e){this._config=function(e){return(e=e||{}).data=rs(e.data),rr(e),e}(e),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(e){this._config.type=e}get data(){return this._config.data}set data(e){this._config.data=rs(e)}get options(){return this._config.options}set options(e){this._config.options=e}get plugins(){return this._config.plugins}update(){let e=this._config;this.clearCache(),rr(e)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(e){return ro(e,()=>[[`datasets.${e}`,""]])}datasetAnimationScopeKeys(e,t){return ro(`${e}.transition.${t}`,()=>[[`datasets.${e}.transitions.${t}`,`transitions.${t}`],[`datasets.${e}`,""]])}datasetElementScopeKeys(e,t){return ro(`${e}-${t}`,()=>[[`datasets.${e}.elements.${t}`,`datasets.${e}`,`elements.${t}`,""]])}pluginScopeKeys(e){let t=e.id,i=this.type;return ro(`${i}-plugin-${t}`,()=>[[`plugins.${t}`,...e.additionalOptionScopes||[]]])}_cachedScopes(e,t){let i=this._scopeCache,r=i.get(e);return(!r||t)&&(r=new Map,i.set(e,r)),r}getOptionScopes(e,t,i){let{options:r,type:s}=this,a=this._cachedScopes(e,i),o=a.get(t);if(o)return o;let h=new Set;t.forEach(t=>{e&&(h.add(e),t.forEach(t=>rl(h,e,t))),t.forEach(e=>rl(h,r,e)),t.forEach(e=>rl(h,eJ[s]||{},e)),t.forEach(e=>rl(h,e2,e)),t.forEach(e=>rl(h,e$,e))});let c=Array.from(h);return 0===c.length&&c.push(Object.create(null)),rn.has(t)&&a.set(t,c),c}chartOptionScopes(){let{options:e,type:t}=this;return[e,eJ[t]||{},e2.datasets[t]||{},{type:t},e2,e$]}resolveNamedOptions(e,t,i,r=[""]){let s={$shared:!0},{resolver:a,subPrefixes:o}=rc(this._resolverCache,e,r),h=a;if(function(e,t){let{isScriptable:i,isIndexable:r}=tv(e);for(let s of t){let t=i(s),a=r(s),o=(a||t)&&e[s];if(t&&(ei(o)||rd(o))||a&&z(o))return!0}return!1}(a,t)){s.$shared=!1,i=ei(i)?i():i;let t=this.createResolver(e,i,o);h=tg(a,i,t)}for(let e of t)s[e]=h[e];return s}createResolver(e,t,i=[""],r){let{resolver:s}=rc(this._resolverCache,e,i);return N(t)?tg(s,t,void 0,r):s}}function rc(e,t,i){let r=e.get(t);r||(r=new Map,e.set(t,r));let s=i.join(),a=r.get(s);return a||(a={resolver:tm(t,i),subPrefixes:i.filter(e=>!e.toLowerCase().includes("hover"))},r.set(s,a)),a}let rd=e=>N(e)&&Object.getOwnPropertyNames(e).some(t=>ei(e[t])),ru=["top","bottom","left","right","chartArea"];function rp(e,t){return"top"===e||"bottom"===e||-1===ru.indexOf(e)&&"x"===t}function rf(e,t){return function(i,r){return i[e]===r[e]?i[t]-r[t]:i[e]-r[e]}}function rm(e){let t=e.chart,i=t.options.animation;t.notifyPlugins("afterRender"),W(i&&i.onComplete,[e],t)}function rg(e){let t=e.chart,i=t.options.animation;W(i&&i.onProgress,[e],t)}function rv(e){return tO()&&"string"==typeof e?e=document.getElementById(e):e&&e.length&&(e=e[0]),e&&e.canvas&&(e=e.canvas),e}let ry={},rx=e=>{let t=rv(e);return Object.values(ry).filter(e=>e.canvas===t).pop()};class rb{static defaults=e2;static instances=ry;static overrides=eJ;static registry=i8;static version="4.5.0";static getChart=rx;static register(...e){i8.add(...e),rw()}static unregister(...e){i8.remove(...e),rw()}constructor(e,t){const i=this.config=new rh(t),r=rv(e),s=rx(r);if(s)throw Error("Canvas is already in use. Chart with ID '"+s.id+"' must be destroyed before the canvas with ID '"+s.canvas.id+"' can be reused.");const a=i.createResolver(i.chartOptionScopes(),this.getContext());this.platform=new(i.platform||function(e){return!tO()||"u">typeof OffscreenCanvas&&e instanceof OffscreenCanvas?iz:iK}(r)),this.platform.updateConfig(i);const o=this.platform.acquireContext(r,a.aspectRatio),h=o&&o.canvas,c=h&&h.height,d=h&&h.width;if(this.id=k(),this.ctx=o,this.canvas=h,this.width=d,this.height=c,this._options=a,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new i9,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=function(e,t){let i;return function(...r){return t?(clearTimeout(i),i=setTimeout(e,t,r)):e.apply(this,r),t}}(e=>this.update(e),a.resizeDelay||0),this._dataChanges=[],ry[this.id]=this,!o||!h)return void console.error("Failed to create chart: can't acquire context from the given item");t2.listen(this,"complete",rm),t2.listen(this,"progress",rg),this._initialize(),this.attached&&this.update()}get aspectRatio(){let{options:{aspectRatio:e,maintainAspectRatio:t},width:i,height:r,_aspectRatio:s}=this;return B(e)?t&&s?s:r?i/r:null:e}get data(){return this.config.data}set data(e){this.config.data=e}get options(){return this._options}set options(e){this.config.options=e}get registry(){return i8}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():tF(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return e5(this.canvas,this.ctx),this}stop(){return t2.stop(this),this}resize(e,t){t2.running(this)?this._resizeBeforeDraw={width:e,height:t}:this._resize(e,t)}_resize(e,t){let i=this.options,r=this.canvas,s=i.maintainAspectRatio&&this.aspectRatio,a=this.platform.getMaximumSize(r,e,t,s),o=i.devicePixelRatio||this.platform.getDevicePixelRatio(),h=this.width?"resize":"attach";this.width=a.width,this.height=a.height,this._aspectRatio=this.aspectRatio,tF(this,o,!0)&&(this.notifyPlugins("resize",{size:a}),W(i.onResize,[this,a],this),this.attached&&this._doResize(h)&&this.render())}ensureScalesHaveIDs(){H(this.options.scales||{},(e,t)=>
8198{e.id=t})}buildOrUpdateScales(){let e=this.options,t=e.scales,i=this.scales,r=Object.keys(i).reduce((e,t)=>(e[t]=!1,e),{}),s=[];t&&(s=s.concat(Object.keys(t).map(e=>{let i=t[e],r=rt(e,i),s="r"===r,a="x"===r;return{options:i,dposition:s?"chartArea":a?"bottom":"left",dtype:s?"radialLinear":a?"category":"linear"}}))),H(s,t=>{let s=t.options,a=s.id,o=rt(a,s),h=U(s.type,t.dtype);(void 0===s.position||rp(s.position,o)!==rp(t.dposition))&&(s.position=t.dposition),r[a]=!0;let c=null;a in i&&i[a].type===h?c=i[a]:i[(c=new(i8.getScale(h))({id:a,type:h,ctx:this.ctx,chart:this})).id]=c,c.init(s,e)}),H(r,(e,t)=>{e||delete i[t]}),H(i,e=>{ik.configure(this,e,e.options),ik.addBox(this,e)})}_updateMetasets(){let e=this._metasets,t=this.data.datasets.length,i=e.length;if(e.sort((e,t)=>e.index-t.index),i>t){for(let e=t;e<i;++e)this._destroyDatasetMeta(e);e.splice(t,i-t)}this._sortedMetasets=e.slice(0).sort(rf("order","index"))}_removeUnreferencedMetasets(){let{_metasets:e,data:{datasets:t}}=this;e.length>t.length&&delete this._stacks,e.forEach((e,i)=>{0===t.filter(t=>t===e._dataset).length&&this._destroyDatasetMeta(i)})}buildOrUpdateControllers(){let e,t,i=[],r=this.data.datasets;for(this._removeUnreferencedMetasets(),e=0,t=r.length;e<t;e++){let t=r[e],s=this.getDatasetMeta(e),a=t.type||this.config.type;if(s.type&&s.type!==a&&(this._destroyDatasetMeta(e),s=this.getDatasetMeta(e)),s.type=a,s.indexAxis=t.indexAxis||i7(a,this.options),s.order=t.order||0,s.index=e,s.label=""+t.label,s.visible=this.isDatasetVisible(e),s.controller)s.controller.updateIndex(e),s.controller.linkScales();else{let t=i8.getController(a),{datasetElementType:r,dataElementType:o}=e2.datasets[a];Object.assign(t,{dataElementType:i8.getElement(o),datasetElementType:r&&i8.getElement(r)}),s.controller=new t(this,e),i.push(s.controller)}}return this._updateMetasets(),i}_resetElements(){H(this.data.datasets,(e,t)=>{this.getDatasetMeta(t).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(e){let t=this.config;t.update();let i=this._options=t.createResolver(t.chartOptionScopes(),this.getContext()),r=this._animationsDisabled=!i.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),!1===this.notifyPlugins("beforeUpdate",{mode:e,cancelable:!0}))return;let s=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let a=0;for(let e=0,t=this.data.datasets.length;e<t;e++){let{controller:t}=this.getDatasetMeta(e),i=!r&&-1===s.indexOf(t);t.buildOrUpdateElements(i),a=Math.max(+t.getMaxOverflow(),a)}a=this._minPadding=i.layout.autoPadding?a:0,this._updateLayout(a),r||H(s,e=>{e.reset()}),this._updateDatasets(e),this.notifyPlugins("afterUpdate",{mode:e}),this._layers.sort(rf("z","_idx"));let{_active:o,_lastEvent:h}=this;h?this._eventHandler(h,!0):o.length&&this._updateHoverStyles(o,o,!0),this.render()}_updateScales(){H(this.scales,e=>{ik.removeBox(this,e)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){let e=this.options;er(new Set(Object.keys(this._listeners)),new Set(e.events))&&!!this._responsiveListeners===e.responsive||(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){let{_hiddenIndices:e}=this;for(let{method:i,start:r,count:s}of this._getUniformDataChanges()||[]){var t="_removeElements"===i?-s:s;for(let i of Object.keys(e)){let s=+i;if(s>=r){let a=e[i];delete e[i],(t>0||s>r)&&(e[s+t]=a)}}}}_getUniformDataChanges(){let e=this._dataChanges;if(!e||!e.length)return;this._dataChanges=[];let t=this.data.datasets.length,i=t=>new Set(e.filter(e=>e[0]===t).map((e,t)=>t+","+e.splice(1).join(","))),r=i(0);for(let e=1;e<t;e++)if(!er(r,i(e)))return;return Array.from(r).map(e=>e.split(",")).map(e=>({method:e[1],start:+e[2],count:+e[3]}))}_updateLayout(e){if(!1===this.notifyPlugins("beforeLayout",{cancelable:!0}))return;ik.update(this,this.width,this.height,e);let t=this.chartArea,i=t.width<=0||t.height<=0;this._layers=[],H(this.boxes,e=>{i&&"chartArea"===e.position||(e.configure&&e.configure(),this._layers.push(...e._layers()))}
8198,this),this._layers.forEach((e,t)=>{e._idx=t}),this.notifyPlugins("afterLayout")}_updateDatasets(e){if(!1!==this.notifyPlugins("beforeDatasetsUpdate",{mode:e,cancelable:!0})){for(let e=0,t=this.data.datasets.length;e<t;++e)this.getDatasetMeta(e).controller.configure();for(let t=0,i=this.data.datasets.length;t<i;++t)this._updateDataset(t,ei(e)?e({datasetIndex:t}):e);this.notifyPlugins("afterDatasetsUpdate",{mode:e})}}_updateDataset(e,t){let i=this.getDatasetMeta(e),r={meta:i,index:e,mode:t,cancelable:!0};!1!==this.notifyPlugins("beforeDatasetUpdate",r)&&(i.controller._update(t),r.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",r))}render(){!1!==this.notifyPlugins("beforeRender",{cancelable:!0})&&(t2.has(this)?this.attached&&!t2.running(this)&&t2.start(this):(this.draw(),rm({chart:this})))}draw(){let e;if(this._resizeBeforeDraw){let{width:e,height:t}=this._resizeBeforeDraw;this._resizeBeforeDraw=null,this._resize(e,t)}if(this.clear(),this.width<=0||this.height<=0||!1===this.notifyPlugins("beforeDraw",{cancelable:!0}))return;let t=this._layers;for(e=0;e<t.length&&t[e].z<=0;++e)t[e].draw(this.chartArea);for(this._drawDatasets();e<t.length;++e)t[e].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(e){let t,i,r=this._sortedMetasets,s=[];for(t=0,i=r.length;t<i;++t){let i=r[t];(!e||i.visible)&&s.push(i)}return s}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(!1===this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0}))return;let e=this.getSortedVisibleDatasetMetas();for(let t=e.length-1;t>=0;--t)this._drawDataset(e[t]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(e){let t=this.ctx,i={meta:e,index:e.index,cancelable:!0},r=t1(this,e);!1!==this.notifyPlugins("beforeDatasetDraw",i)&&(r&&e7(t,r),e.controller.draw(),r&&te(t),i.cancelable=!1,this.notifyPlugins("afterDatasetDraw",i))}isPointInArea(e){return e9(e,this.chartArea,this._minPadding)}getElementsAtEventForMode(e,t,i,r){let s=iM.modes[t];return"function"==typeof s?s(this,e,i,r):[]}getDatasetMeta(e){let t=this.data.datasets[e],i=this._metasets,r=i.filter(e=>e&&e._dataset===t).pop();return r||(r={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:t&&t.order||0,index:e,_dataset:t,_parsed:[],_sorted:!1},i.push(r)),r}getContext(){return this.$context||(this.$context=tf(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(e){let t=this.data.datasets[e];if(!t)return!1;let i=this.getDatasetMeta(e);return"boolean"==typeof i.hidden?!i.hidden:!t.hidden}setDatasetVisibility(e,t){this.getDatasetMeta(e).hidden=!t}toggleDataVisibility(e){this._hiddenIndices[e]=!this._hiddenIndices[e]}getDataVisibility(e){return!this._hiddenIndices[e]}_updateVisibility(e,t,i){let r=i?"show":"hide",s=this.getDatasetMeta(e),a=s.controller._resolveAnimations(void 0,r);et(t)?(s.data[t].hidden=!i,this.update()):(this.setDatasetVisibility(e,i),a.update(s,{visible:i}),this.update(t=>t.datasetIndex===e?r:void 0))}hide(e,t){this._updateVisibility(e,t,!1)}show(e,t){this._updateVisibility(e,t,!0)}_destroyDatasetMeta(e){let t=this._metasets[e];t&&t.controller&&t.controller._destroy(),delete this._metasets[e]}_stop(){let e,t;for(this.stop(),t2.remove(this),e=0,t=this.data.datasets.length;e<t;++e)this._destroyDatasetMeta(e)}destroy(){this.notifyPlugins("beforeDestroy");let{canvas:e,ctx:t}=this;this._stop(),this.config.clearCache(),e&&(this.unbindEvents(),e5(e,t),this.platform.releaseContext(t),this.canvas=null,this.ctx=null),delete ry[this.id],this.notifyPlugins("afterDestroy")}toBase64Image(...e){return this.canvas.toDataURL(...e)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){let e=this._listeners,t=this.platform,i=(i,r)=>{t.addEventListener(this,i,r),e[i]=r},r=(e,t,i)=>{e.offsetX=t,e.offsetY=i,this._eventHandler(e)};H(this.options.events,e=>i(e,r))}bindResponsiveEvents(){let e;this._responsiveListeners||(this._responsiveListeners={});let t=this._responsiveListeners,i=this.platform,r=(e,r)=>{i.addEventListener(this,e,r),t[e]=r},s=(e,r)=>{t[e]&&(i.removeEventListener(this,e,r),delete t[e])},a=(e,t)=>{this.canvas&&this.resize(e,t)},o=()=>{s("attach",o),this.attached=!0,this.resize(),r("resize",a),r("detach",e)};e=()=>{this.attached=!1,s("resize",a),this._stop(),this._resize(0,0),r("attach",o)},i.isAttached(this.canvas)?o():e()}unbindEvents(){H(this._listeners,(e,t)=>{this.platform.removeEventListener(this,t,e)}),this._listeners={},H(this._responsiveListeners,(e,t)=>{this.platform.removeEventListener(this,t,e)}),this._responsiveListeners=void 0}updateHoverStyle(e,t,i){let r,s,a,o=i?"set":"remove";for("dataset"===t&&this.getDatasetMeta(e[0].datasetIndex).controller["_"+o+"DatasetHoverStyle"](),s=0,a=e.length;s<a;++s){let t=(r=e[s])&&this.getDatasetMeta(r.datasetIndex).controller;t&&t[o+"HoverStyle"](r.element,r.datasetIndex,r.index)}}getActiveElements(){return this._active||[]}setActiveElements(e){let t=this._active||[],i=e.map(({datasetIndex:e,index:t})=>{let i=this.getDatasetMeta(e);if(!i)throw Error("No dataset found at index "+e);return{datasetIndex:e,element:i.data[t],index:t}});G(i,t)||(this._active=i,this._lastEvent=null,this._updateHoverStyles(i,t))}notifyPlugins(e,t,i){return this._plugins.notify(this,e,t,i)}isPluginEnabled(e){return 1===this._plugins._cache.filter(t=>t.plugin.id===e).length}_updateHoverStyles(e,t,i){let r=this.options.hover,s=(e,t)=>e.filter(e=>!t.some(t=>e.datasetIndex===t.datasetIndex&&e.index===t.index)),a=s(t,e),o=i?e:s(e,t);a.length&&this.updateHoverStyle(a,r.mode,!1),o.length&&r.mode&&this.updateHoverStyle(o,r.mode,!0)}_eventHandler(e,t){let i={event:e,replay:t,cancelable:!0,inChartArea:this.isPointInArea(e)},r=t=>(t.options.events||this.options.events).includes(e.native.type);if(!1===this.notifyPlugins("beforeEvent",i,r))return;let s=this._handleEvent(e,t,i.inChartArea);return i.cancelable=!1,this.notifyPlugins("afterEvent",i,r),(s||i.changed)&&this.render(),this}_handleEvent(e,t,i){var r;let{_active:s=[],options:a}=this,o=this._getActiveElements(e,s,i,t),h="mouseup"===e.type||"click"===e.type||"contextmenu"===e.type,c=(r=this._lastEvent,i&&"mouseout"!==e.type?h?r:e:null);i&&(this._lastEvent=null,W(a.onHover,[e,o,this],this),h&&W(a.onClick,[e,o,this],this));
8198let d=!G(o,s);return(d||t)&&(this._active=o,this._updateHoverStyles(o,s,t)),this._lastEvent=c,d}_getActiveElements(e,t,i,r){if("mouseout"===e.type)return[];if(!i)return t;let s=this.options.hover;return this.getElementsAtEventForMode(e,s.mode,s,r)}}function rw(){return H(rb.instances,e=>e._plugins.invalidate())}function r_(e,t,i,r){return{x:i+e*Math.cos(t),y:r+e*Math.sin(t)}}function rS(e,t,i,r,s,a){var o,h,c,d;let u,p,f,m,{x:g,y:v,startAngle:y,pixelMargin:x,innerRadius:b}=t,w=Math.max(t.outerRadius+r+i-x,0),_=b>0?b+r+i+x:0,S=0,C=s-y;if(r){let e=w>0?w-r:0,t=((b>0?b-r:0)+e)/2;S=(C-(0!==t?C*t/(t+r):C))/2}let M=Math.max(.001,C*w-i/es)/w,E=(C-M)/2,A=y+E+S,T=s-E-S,{outerStart:P,outerEnd:D,innerStart:O,innerEnd:L}=(o=t,h=_,c=w,d=T-A,u=tl(o.options.borderRadius,["outerStart","outerEnd","innerStart","innerEnd"]),f=Math.min(p=(c-h)/2,d*h/2),{outerStart:(m=e=>{let t=(c-Math.min(p,e))*d/2;return eE(e,0,Math.min(p,t))})(u.outerStart),outerEnd:m(u.outerEnd),innerStart:eE(u.innerStart,0,f),innerEnd:eE(u.innerEnd,0,f)}),I=w-P,R=w-D,k=A+P/I,B=T-D/R,z=_+O,N=_+L,F=A+O/z,j=T-L/N;if(e.beginPath(),a){let t=(k+B)/2;if(e.arc(g,v,w,k,t),e.arc(g,v,w,t,B),D>0){let t=r_(R,B,g,v);e.arc(t.x,t.y,D,B,T+eh)}let i=r_(N,T,g,v);if(e.lineTo(i.x,i.y),L>0){let t=r_(N,j,g,v);e.arc(t.x,t.y,L,T+eh,j+Math.PI)}let r=(T-L/_+(A+O/_))/2;if(e.arc(g,v,_,T-L/_,r,!0),e.arc(g,v,_,r,A+O/_,!0),O>0){let t=r_(z,F,g,v);e.arc(t.x,t.y,O,F+Math.PI,A-eh)}let s=r_(I,A,g,v);if(e.lineTo(s.x,s.y),P>0){let t=r_(I,k,g,v);e.arc(t.x,t.y,P,A-eh,k)}}else{e.moveTo(g,v);let t=Math.cos(k)*w+g,i=Math.sin(k)*w+v;e.lineTo(t,i);let r=Math.cos(B)*w+g,s=Math.sin(B)*w+v;e.lineTo(r,s)}e.closePath()}function rC(e,t,i=t){e.lineCap=U(i.borderCapStyle,t.borderCapStyle),e.setLineDash(U(i.borderDash,t.borderDash)),e.lineDashOffset=U(i.borderDashOffset,t.borderDashOffset),e.lineJoin=U(i.borderJoinStyle,t.borderJoinStyle),e.lineWidth=U(i.borderWidth,t.borderWidth),e.strokeStyle=U(i.borderColor,t.borderColor)}function rM(e,t,i){e.lineTo(i.x,i.y)}function rE(e,t,i={}){let r=e.length,{start:s=0,end:a=r-1}=i,{start:o,end:h}=t,c=Math.max(s,o),d=Math.min(a,h);return{count:r,start:c,loop:t.loop,ilen:d<c&&!(s<o&&a<o||s>h&&a>h)?r+d-c:d-c}}function rA(e,t,i,r){let s,a,o,{points:h,options:c}=t,{count:d,start:u,loop:p,ilen:f}
8198=rE(h,i,r),m=c.stepped?tt:c.tension||"monotone"===c.cubicInterpolationMode?ti:rM,{move:g=!0,reverse:v}=r||{};for(s=0;s<=f;++s)(a=h[(u+(v?f-s:s))%d]).skip||(g?(e.moveTo(a.x,a.y),g=!1):m(e,o,a,v,c.stepped),o=a);return p&&m(e,o,a=h[(u+(v?f:0))%d],v,c.stepped),!!p}function rT(e,t,i,r){let s,a,o,h,c,d,u=t.points,{count:p,start:f,ilen:m}=rE(u,i,r),{move:g=!0,reverse:v}=r||{},y=0,x=0,b=e=>(f+(v?m-e:e))%p,w=()=>{h!==c&&(e.lineTo(y,c),e.lineTo(y,h),e.lineTo(y,d))};for(g&&(a=u[b(0)],e.moveTo(a.x,a.y)),s=0;s<=m;++s){if((a=u[b(s)]).skip)continue;let t=a.x,i=a.y,r=0|t;r===o?(i<h?h=i:i>c&&(c=i),y=(x*y+t)/++x):(w(),e.lineTo(t,i),o=r,x=0,h=c=i),d=i}w()}function rP(e){let t=e.options,i=t.borderDash&&t.borderDash.length;return e._decimated||e._loop||t.tension||"monotone"===t.cubicInterpolationMode||t.stepped||i?rA:rT}let rD="function"==typeof Path2D;class rO extends iJ{static id="line";static defaults={borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};static descriptors={_scriptable:!0,_indexable:e=>"borderDash"!==e&&"fill"!==e};constructor(e){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,e&&Object.assign(this,e)}updateControlPoints(e,t){let i=this.options;if((i.tension||"monotone"===i.cubicInterpolationMode)&&!i.stepped&&!this._pointsUpdated){let r=i.spanGaps?this._loop:this._fullLoop;!function(e,t,i,r,s){let a,o,h,c;if(t.spanGaps&&(e=e.filter(e=>!e.skip)),"monotone"===t.cubicInterpolationMode)!function(e,t="x"){let i,r,s,a=tP(t),o=e.length,h=Array(o).fill(0),c=Array(o),d=tT(e,0);for(i=0;i<o;++i)if(r=s,s=d,d=tT(e,i+1),s){if(d){let e=d[t]-s[t];h[i]=0!==e?(d[a]-s[a])/e:0}c[i]=r?d?ep(h[i-1])!==ep(h[i])?0:(h[i-1]+h[i])/2:h[i-1]:h[i]}!function(e,t,i){let r,s,a,o,h,c=e.length,d=tT(e,0);for(let u=0;u<c-1;++u)if(h=d,d=tT(e,u+1),h&&d){if(ef(t[u],0,tA)){i[u]=i[u+1]=0;continue}(o=Math.pow(r=i[u]/t[u],2)+Math.pow(s=i[u+1]/t[u],2))<=9||(a=3/Math.sqrt(o),i[u]=r*a*t[u],i[u+1]=s*a*t[u])}}(e,h,c),function(e,t,i="x"){let r,s,a,o=tP(i),h=e.length,c=tT(e,0);for(let d=0;d<h;++d){if(s=a,a=c,c=tT(e,d+1),!a)continue;let h=a[i],u=a[o];s&&(r=(h-s[i])/3,a[`cp1${i}`]=h-r,a[`cp1${o}`]=u-r*t[d]),c&&(r=(c[i]-h)/3,a[`cp2${i}`]=h+r,a[`cp2${o}`]=u+r*t[d])}}(e,c,t)}(e,s);else{let i=r?e[e.length-1]:e[0];for(a=0,o=e.length;a<o;++a)c=function(e,t,i,r){let s=e.skip?t:e,a=i.skip?t:i,o=e_(t,s),h=e_(a,t),c=o/(o+h),d=h/(o+h);c=isNaN(c)?0:c,d=isNaN(d)?0:d;let u=r*c,p=r*d;return{previous:{x:t.x-u*(a.x-s.x),y:t.y-u*(a.y-s.y)},next:{x:t.x+p*(a.x-s.x),y:t.y+p*(a.y-s.y)}}}(i,h=e[a],e[Math.min(a+1,o-!r)%o],t.tension),h.cp1x=c.previous.x,h.cp1y=c.previous.y,h.cp2x=c.next.x,h.cp2y=c.next.y,i=h}t.capBezierPoints&&function(e,t){let i,r,s,a,o,h=e9(e[0],t);for(i=0,r=e.length;i<r;++i)o=a,a=h,h=i<r-1&&e9(e[i+1],t),a&&(s=e[i],o&&(s.cp1x=tD(s.cp1x,t.left,t.right),s.cp1y=tD(s.cp1y,t.top,t.bottom)),h&&(s.cp2x=tD(s.cp2x,t.left,t.right),s.cp2y=tD(s.cp2y,t.top,t.bottom)))}(e,i)}(this._points,i,e,r,t),this._pointsUpdated=!0}}set points(e){this._points=e,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=function(e,t){let i=e.points,r=e.options.spanGaps,s=i.length;if(!s)return[];let a=!!e._loop,{start:o,end:h}=function(e,t,i,r){let s=0,a=t-1;if(i&&!r)for(;s<t&&!e[s].skip;)s++;for(;s<t&&e[s].skip;)s++;for(s%=t,i&&(a+=s);a>s&&e[a%t].skip;)a--;return{start:s,end:a%=t}}(i,s,a,r);if(!0===r)return tJ(e,[{start:o,end:h,loop:a}],i,t);let c=h<o?h+s:h,d=!!e._fullLoop&&0===o&&h===s-1;return tJ(e,function(e,t,i,r){let s,a=e.length,o=[],h=t,c=e[t];for(s=t+1;s<=i;++s){let i=e[s%a];i.skip||i.stop?c.skip||(r=!1,o.push({start:t%a,end:(s-1)%a,loop:r}),t=h=i.stop?s:null):(h=s,c.skip&&(t=s)),c=i}return null!==h&&o.push({start:t%a,end:h%a,loop:r}),o}(i,o,c,d),i,t)}(this,this.options.segment))}first(){let e=this.segments,t=this.points;return e.length&&t[e[0].start]}last(){let e=this.segments,t=this.points,i=e.length;return i&&t[e[i-1].end]}interpolate(e,t){let i,r,s=this.options,a=e[t],o=this.points,h=tK(this,{property:t,start:a,end:a});if(!h.length)return;let c=[],d=s.stepped?tW:s.tension||"monotone"===s.cubicInterpolationMode?tH:tV;for(i=0,r=h.length;i<r;++i){let{start:r,end:u}=h[i],p=o[r],f=o[u];if(p===f){c.push(p);continue}
8198let m=Math.abs((a-p[t])/(f[t]-p[t])),g=d(p,f,m,s.stepped);g[t]=e[t],c.push(g)}return 1===c.length?c[0]:c}pathSegment(e,t,i){return rP(this)(e,this,t,i)}path(e,t,i){let r=this.segments,s=rP(this),a=this._loop;for(let o of(t=t||0,i=i||this.points.length-t,r))a&=s(e,this,o,{start:t,end:t+i-1});return!!a}draw(e,t,i,r){let s=this.options||{};(this.points||[]).length&&s.borderWidth&&(e.save(),function(e,t,i,r){if(rD&&!t.options.segment){let s;(s=t._path)||(s=t._path=new Path2D,t.path(s,i,r)&&s.closePath()),rC(e,t.options),e.stroke(s)}else!function(e,t,i,r){let{segments:s,options:a}=t,o=rP(t);for(let h of s)rC(e,a,h.style),e.beginPath(),o(e,t,h,{start:i,end:i+r-1})&&e.closePath(),e.stroke()}(e,t,i,r)}(e,this,i,r),e.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}}function rL(e,t,i,r){let s=e.options,{[i]:a}=e.getProps([i],r);return Math.abs(t-a)<s.radius+s.hitRadius}function rI(e,t){let i,r,s,a,o,{x:h,y:c,base:d,width:u,height:p}=e.getProps(["x","y","base","width","height"],t);return e.horizontal?(o=p/2,i=Math.min(h,d),r=M
vendor: 4,203 bytes, line 8198
8198ath.max(h,d),s=c-o,a=c+o):(i=h-(o=u/2),r=h+o,s=Math.min(c,d),a=Math.max(c,d)),{left:i,top:s,right:r,bottom:a}}function rR(e,t,i,r){return e?0:eE(t,i,r)}function rk(e,t,i,r){let s=null===t,a=null===i,o=e&&!(s&&a)&&rI(e,r);return o&&(s||eA(t,o.left,o.right))&&(a||eA(i,o.top,o.bottom))}function rB(e,t){e.rect(t.x,t.y,t.w,t.h)}function rz(e,t,i={}){let r=e.x!==i.x?-t:0,s=e.y!==i.y?-t:0,a=(e.x+e.w!==i.x+i.w?t:0)-r,o=(e.y+e.h!==i.y+i.h?t:0)-s;return{x:e.x+r,y:e.y+s,w:e.w+a,h:e.h+o,radius:e.radius}}var rN=Object.freeze({__proto__:null,ArcElement:class extends iJ{static id="arc";static defaults={borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0,selfJoin:!1};static defaultRoutes={backgroundColor:"backgroundColor"};static descriptors={_scriptable:!0,_indexable:e=>"borderDash"!==e};circumference;endAngle;fullCircles;innerRadius;outerRadius;pixelMargin;startAngle;constructor(e){super(),this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,e&&Object.assign(this,e)}inRange(e,t,i){let{angle:r,distance:s}=ew(this.getProps(["x","y"],i),{x:e,y:t}),{startAngle:a,endAngle:o,innerRadius:h,outerRadius:c,circumference:d}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],i),u=(this.options.spacing+this.options.borderWidth)/2,p=U(d,o-a),f=eM(r,a,o)&&a!==o,m=p>=ea||f,g=eA(s,h+u,c+u);return m&&g}getCenterPoint(e){let{x:t,y:i,startAngle:r,endAngle:s,innerRadius:a,outerRadius:o}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],e),{offset:h,spacing:c}=this.options,d=(r+s)/2,u=(a+o+c+h)/2;return{x:t+Math.cos(d)*u,y:i+Math.sin(d)*u}}tooltipPosition(e){return this.getCenterPoint(e)}draw(e){let{options:t,circumference:i}=this,r=(t.offset||0)/4,s=(t.spacing||0)/2,a=t.circular;if(this.pixelMargin=.33*("inner"===t.borderAlign),this.fullCircles=i>ea?Math.floor(i/ea):0,0===i||this.innerRadius<0||this.outerRadius<0)return;e.save();let o=(this.startAngle+this.endAngle)/2;e.translate(Math.cos(o)*r,Math.sin(o)*r);let h=r*(1-Math.sin(Math.min(es,i||0)));e.fillStyle=t.backgroundColor,e.strokeStyle=t.borderColor,function(e,t,i,r,s){let{fullCircles:a,startAngle:o,circumference:h}=t,c=t.endAngle;if(a){rS(e,t,i,r,c,s);for(let t=0;t<a;++t)e.fill();isNaN(h)||(c=o+(h%ea||ea))}rS(e,t,i,r,c,s),e.fill()}(e,this,h,s,a),function(e,t,i,r,s){let{fullCircles:a,startAngle:o,circumference:h,options:c}=t,{borderWidth:d,borderJoinStyle:u,borderDash:p,borderDashOffset:f,borderRadius:m}=c,g="inner"===c.borderAlign;if(!d)return;e.setLineDash(p||[]),e.lineDashOffset=f,g?(e.lineWidth=2*d,e.lineJoin=u||"round"):(e.lineWidth=d,e.lineJoin=u||"bevel");let v=t.endAngle;if(a){rS(e,t,i,r,v,s);for(let t=0;t<a;++t)e.stroke();isNaN(h)||(v=o+(h%ea||ea))}g&&function(e,t,i){let{startAngle:r,pixelMargin:s,x:a,y:o,outerRadius:h,innerRadius:c}=t,d=s/h;e.beginPath(),e.arc(a,o,h,r-d,i+d),c>s?(d=s/c,e.arc(a,o,c,i+d,r-d,!0)):e.arc(a,o,s,i+eh,r-eh),e.closePath(),e.clip()}(e,t,v),c.selfJoin&&v-o>=es&&0===m&&"miter"!==u&&function(e,t,i){let{startAngle:r,x:s,y:a,outerRadius:o,innerRadius:h,options:c}=t,{borderWidth:d,borderJoinStyle:u}=c,p=Math.min(d/o,eC(r-i));if(e.beginPath(),e.arc(s,a,o-d/2,r+p/2,i-p/2),h>0){let t=Math.min(d/h,eC(r-i));e.arc(s,a,h+d/2,i-t/2,r+t/2,!0)}else{let t=Math.min(d/2,o*eC(r-i));if("round"===u)e.arc(s,a,t,i-es/2,r+es/2,!0);else if("bevel"===u){let o=2*t*t,h=-o*Math.cos(i+es/2)+s,c=-o*Math.sin(i+es/2)+a,d=o*Math.cos(r+es/2)+s,u=o*Math.sin(r+es/2)+a;e.lineTo(h,c),e.lineTo(d,u)}}e.closePath(),e.moveTo(0,0),e.rect(0,0,e.canvas.width,e.canvas.height),e.clip("evenodd")}(e,t,v),a||(rS(e,t,i,r,v,s),e.stroke())}(e,this,h,s,a),e.restore()}},BarElement:class extends iJ{static id="bar";static defaults={borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};constructor(e){super(),this.options=void 0,this.horizontal=void 0,this.base=void 0,this.width=void 0,this.height=void 0,this.inflateAmou
8198nt=void 0,e&&Object.assign(this,e)}draw(e){var t,i,r;let s,a,o,h,c,d,u,p,{inflateAmount:f,options:{borderColor:m,backgroundColor:g}}=this,{inner:v,outer:y}=(a=(s=rI(this)).right-s.left,o=s.bottom-s.top,t=a/2,i=o/2,h=this.options.borderWidth,c=this.borderSkipped,d=th(h),u={t:rR(c.top,d.top,0,i),r:rR(c.right,d.right,0,t),b:rR(c.bottom,d.bottom,0,i),l:rR(c.left,d.left,0,t)},p=function(e,t,i){let{enableBorderRadius:r}=e.getProps(["enableBorderRadius"]),s=e.options.borderRadius,a=tc(s),o=Math.min(t,i),h=e.borderSkipped,c=r||N(s);return{topLeft:rR(!c||h.top||h.left,a.topLeft,0,o),topRight:rR(!c||h.top||h.right,a.topRight,0,o),bottomLeft:rR(!c||h.bottom||h.left,a.bottomLeft,0,o),bottomRight:rR(!c||h.bottom||h.right,a.bottomRight,0,o)}}(this,a/2,o/2),{outer:{x:s.left,y:s.top,w:a,h:o,radius:p},inner:{x:s.left+u.l,y:s.top+u.t,w:a-u.l-u.r,h:o-u.t-u.b,radius:{topLeft:Math.max(0,p.topLeft-Math.max(u.t,u.l)),topRight:Math.max(0,p.topRight-Math.max(u.t,u.r)),bottomLeft:Math.max(0,p.bottomLeft-Math.max(u.b,u.l)),bottomRight:Math.max(0,p.bottomRight-Math.max(u.b,u.r))}}}),x=(r=y.radius).topLeft||r.topRight||r.bottomLeft||r.bottomRight?ts:rB;e.save(),(y.w!==v.w||y.h!==v.h)&&(e.beginPath(),x(e,rz(y,f,v)),e.clip(),x(e,rz(v,-f,y)),e.fillStyle=m,e.fill("evenodd")),e.beginPath(),x(e,rz(v,f)),e.fillStyle=g,e.fill(),e.restore()}inRange(e,t,i){return rk(this,e,t,i)}inXRange(e,t){return rk(this,e,null,t)}inYRange(e,t){return rk(this,null,e,t)}getCenterPoint(e){let{x:t,y:i,base:r,horizontal:s}=this.getProps(["x","y","base","horizontal"],e);return{x:s?(t+r)/2:t,y:s?i:(i+r)/2}}getRange(e){return"x"===e?this.width/2:this.height/2}},LineElement:rO,PointElement:class extends iJ{static id="point";parsed;skip;stop;static defaults={borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};constructor(e){super(),this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,e&&Object.assign(this,e)}inRange(e,t,i){let r=this.options,{x:s,y:a}=this.getProps(["x","y"],i);return Math.pow(e-s,2)+Math.pow(t-a,2)<Math.pow(r.hitRadius+r.radius,2)}inXRange(e,t){return rL(this,e,"x",t)}inYRange(e,t){return rL(this,e,"y",t)}getCenterPoint(e){let{x:t,y:i}=this.getProps(["x","y"],e);return{x:t,y:i}}size(e){let t=(e=e||this.options||{}).radius||0,i=(t=Math.max(t,t&&e.hoverRadius||0))&&e.borderWidth||0;return(t+i)*2}draw(e,t){let i=this.options;!this.skip&&!(i.radius<.1)&&e9(this,t,this.size(i)/2)&&(e.strokeStyle=i.borderColor,e.lineWidth=i.borderWidth,e.fillStyle=i.backgroundColor,e6(e,i,this.x,this.y))}getRange(){let e=this.options||{};return e.radius+e.hitRadius}}});let rF=["rgb(54, 162, 235)","rgb(255, 99, 132)","rgb(255, 159, 64)","rgb(255, 205, 86)","rgb(75, 192, 192)","rgb(153, 102, 255)","rgb(201, 203, 207)"],rj=rF.map(e=>e.replace("rgb(","rgba(").replace(")",", 0.5)"));function rU(e){return rF[e%rF.length]}function rV(e){return rj[e%rj.length]}function rW(e){let t;for(t in e)if(e[t].borderColor||e[t].backgroundColor)return!0;return!1}function rH(e){if(e._decimated){let t=e._data;delete e._decimated,delete e._data,Object.defineProperty(e,"data",{configurable:!0,enumerable:!0,writable:!0,value:t})}}function rG(e){e.data.datasets.forEach(e=>{rH(e)})}function rq(e,t,i,r){if(r)return;let s=t[e],a=i[e];return"angle"===e&&(s=eC(s),a=eC(a)),{property:e,start:s,end:a}}function rX(e,t,i){for(;t>e;t--){let e=i[t];if(!isNaN(e.x)&&!isNaN(e.y))break}return t}function rY(e,t,i,r){return e&&t?r(e[i],t[i]):e?e[i]:t?t[i]:0}function rQ(e,t){let i=[],r=!1;return z(e)?(r=!0,i=e):i=function(e,t){let{x:i=null,y:r=null}=e||{},s=t.points,a=[];return t.segments.forEach(({start:e,end:t})=>{t=rX(e,t,s);let o=s[e],h=s[t];null!==r?(a.push({x:o.x,y:r}),a.push({x:h.x,y:r})):null!==i&&(a.push({x:i,y:o.y}),a.push({x:i,y:h.y}))}),a}(e,t),i.length?new rO({points:i,options:{tension:0},_loop:r,_fullLoop:r}):null}function rZ(e){return e&&!1!==e.fill}class rK{constructor(e){this.x=e.x,this.y=e.y,this.radius=e.radius}pathSegment(e,t,i){let{x:r,y:s,radius:a}=this;return t=t||{start:0,end:ea},e.arc(r,s,a,t.end,t.start,!0),!i.bounds}interpolate(e){let{x:t,y:i,radius:r}=this,s=e.angle;return{x:t+Math.cos(s)*r,y:i+Math.sin(s)*r,angle:s}}}function rJ(e,t,i){let r=function(e){var t,i,r;let{chart:s,fill:a,line:o}=e;if(F(a)){let e;return t=s,i=a,(e=t.getDatasetMeta(i))&&t.isDatasetVisible(i)?e.dataset:null}if("stack"===a)return function(e){let{scale:t,index:i,line:r}=e,s=[],a=r.segments,o=r.points,h=function(e,t){let i=[],r=e.getMatchingVisibleMetas("line");for(let e=0;e<r.length;e++){let s=r[e];if(s.index===t)break;s.hidden||i.unshift(s.dataset)}return i}(t,i);h.push(rQ({x:null,y:t.bottom},r));for(let e=0;e<a.length;e++){let t=a[e];for(let e=t.start;e<=t.end;e++)!function(e,t,i){let r=[];for(let s=0;s<i.length;s++){let{first:a,last:o,point:h}=function(e,t){let i=e.interpolate(t,"x");
8198if(!i)return{};let r=i.x,s=e.segments,a=e.points,o=!1,h=!1;for(let e=0;e<s.length;e++){let t=s[e],i=a[t.start].x,c=a[t.end].x;if(eA(r,i,c)){o=r===i,h=r===c;break}}return{first:o,last:h,point:i}}(i[s],t);if(h&&(!a||!o)){if(a)r.unshift(h);else if(e.push(h),!o)break}}e.push(...r)}(s,o[e],h)}return new rO({points:s,options:{}})}(e);if("shape"===a)return!0;let h=((r=e).scale||{}).getPointPositionForValue?function(e){let{scale:t,fill:i}=e,r=t.options,s=t.getLabels().length,a=r.reverse?t.max:t.min,o="start"===i?a:"end"===i?t.options.reverse?t.min:t.max:N(i)?i.value:t.getBaseValue(),h=[];if(r.grid.circular){let e=t.getPointPositionForValue(0,a);return new rK({x:e.x,y:e.y,radius:t.getDistanceFromCenterForValue(o)})}for(let e=0;e<s;++e)h.push(t.getPointPositionForValue(e,o));return h}(r):function(e){let t,{scale:i={},fill:r}=e,s=(t=null,"start"===r?t=i.bottom:"end"===r?t=i.top:N(r)?t=i.getPixelForValue(r.value):i.getBasePixel&&(t=i.getBasePixel()),t);if(F(s)){let e=i.isHorizontal();return{x:e?s:null,y:e?null:s}}return null}(r);return h instanceof rK?h:rQ(h,o)}(t),{chart:s,index:a,line:o,scale:h,axis:c}=t,d=o.options,u=d.fill,p=d.backgroundColor,{above:f=p,below:m=p}=u||{},g=s.getDatasetMeta(a),v=t1(s,g);r&&o.points.length&&(e7(e,i),function(e,t){let{line:i,target:r,above:s,below:a,area:o,scale:h,clip:c}=t,d=i._loop?"angle":t.axis;e.save();let u=a;a!==s&&("x"===d?(r$(e,r,o.top),r1(e,{line:i,target:r,color:s,scale:h,property:d,clip:c}),e.restore(),e.save(),r$(e,r,o.bottom)):"y"===d&&(r0(e,r,o.left),r1(e,{line:i,target:r,color:a,scale:h,property:d,clip:c}),e.restore(),e.save(),r0(e,r,o.right),u=s)),r1(e,{line:i,target:r,color:u,scale:h,property:d,clip:c}),e.restore()}(e,{line:o,target:r,above:f,below:m,area:i,scale:h,axis:c,clip:v}),te(e))}function r$(e,t,i){let{segments:r,points:s}=t,a=!0,o=!1;for(let h of(e.beginPath(),r)){let{start:r,end:c}=h,d=s[r],u=s[rX(r,c,s)];a?(e.moveTo(d.x,d.y),a=!1):(e.lineTo(d.x,i),e.lineTo(d.x,d.y)),(o=!!t.pathSegment(e,h,{move:o}))?e.closePath():e.lineTo(u.x,i)}e.lineTo(t.first().x,i),e.closePath(),e.clip()}function r0(e,t,i){let{segments:r,points:s}=t,a=!0,o=!1;for(let h of(e.beginPath(),r)){let{start:r,end:c}=h,d=s[r],u=s[rX(r,c,s)];a?(e.moveTo(d.x,d.y),a=!1):(e.lineTo(i,d.y),e.lineTo(d.x,d.y)),(o=!!t.pathSegment(e,h,{move:o}))?e.closePath():e.lineTo(i,u.y)}e.lineTo(i,t.first().y),e.closePath(),e.clip()}function r1(e,t){let{line:i,target:r,property:s,color:a,scale:o,clip:h}=t;for(let{source:t,target:c,start:d,end:u}of function(e,t,i){let r=e.segments,s=e.points,a=t.points,o=[];for(let e of r){let{start:r,end:h}=e;h=rX(r,h,s);let c=rq(i,s[r],s[h],e.loop);if(!t.segments){o.push({source:e,target:c,start:s[r],end:s[h]});continue}for(let r of tK(t,c)){let t=rq(i,a[r.start],a[r.end],r.loop);for(let a of tZ(e,s,t))o.push({source:a,target:r,start:{[i]:rY(c,t,"start",Math.max)},end:{[i]:rY(c,t,"end",Math.min)}})}}return o}(i,r,s)){let p,{style:{backgroundColor:f=a}={}}=t,m=!0!==r;e.save(),e.fillStyle=f,function(e,t,i,r){let s=t.chart.chartArea,{property:a,start:o,end:h}=r||{};if("x"===a||"y"===a){let t,r,c,d;"x"===a?(t=o,r=s.top,c=h,d=s.bottom):(t=s.left,r=o,c=s.right,d=h),e.beginPath(),i&&(t=Math.max(t,i.left),c=Math.min(c,i.right),r=Math.max(r,i.top),d=Math.min(d,i.bottom)),e.rect(t,r,c-t,d-r),e.clip()}}(e,o,h,m&&rq(s,d,u)),e.beginPath();let g=!!i.pathSegment(e,t);if(m){g?e.closePath():r2(e,r,u,s);let t=!!r.pathSegment(e,c,{move:g,reverse:!0});(p=g&&t)||r2(e,r,d,s)}e.closePath(),e.fill(p?"evenodd":"nonzero"),e.restore()}}function r2(e,t,i,r){let s=t.interpolate(i,r);s&&e.lineTo(s.x,s.y)}let r3=(e,t)=>{let{boxHeight:i=t,boxWidth:r=t}=e;return e.usePointStyle&&(i=Math.min(i,t),r=e.pointStyleWidth||Math.min(r,t)),{boxWidth:r,boxHeight:i,itemHeight:Math.max(t,i)}};class r4 extends iJ{constructor(e){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=e.chart,this.options=e.options,this.ctx=e.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(e,t,i){this.maxWidth=e,this.maxHeight=t,this._margins=i,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){let e=this.options.labels||{},t=W(e.generateLabels,[this.chart],this)||[];e.filter&&(t=t.filter(t=>e.filter(t,this.chart.data))),e.sort&&(t=t.sort((t,i)=>e.sort(t,i,this.chart.data))),this.options.reverse&&t.reverse(),this.legendItems=t}fit(){let e,t,{options:i,ctx:r}=this;if(!i.display){this.width=this.height=0;return}let s=i.labels,a=tu(s.font),o=a.size,h=this._computeTitleHeight(),{boxWidth:c,itemHeight:d}=r3(s,o);r.font=a.string,this.isHorizontal()?(e=this.maxWidth,t=this._fitRows(h,o,c,d)+10):(t=this.maxHeight,e=this._fitCols(h,a,c,d)+10),this.width=Math.min(e,i.maxWidth||this.maxWidth),this.height=Math.min(t,i.maxHeight||this.maxHeight)}_fitRows(e,t,i,r){let{ctx:s,maxWidth:a,options:{labels:{padding:o}}}=this,h=this.legendHitBoxes=[],c=this.lineWidths=[0],d=r+o,u=e;s.textAlign="left",s.textBaseline="middle";let p=-1,f=-d;
8198return this.legendItems.forEach((e,m)=>{let g=i+t/2+s.measureText(e.text).width;(0===m||c[c.length-1]+g+2*o>a)&&(u+=d,c[c.length-(m>0?0:1)]=0,f+=d,p++),h[m]={left:0,top:f,row:p,width:g,height:r},c[c.length-1]+=g+o}),u}_fitCols(e,t,i,r){let{ctx:s,maxHeight:a,options:{labels:{padding:o}}}=this,h=this.legendHitBoxes=[],c=this.columnSizes=[],d=a-e,u=o,p=0,f=0,m=0,g=0;return this.legendItems.forEach((e,a)=>{var v,y,x,b,w,_,S,C,M,E,A,T;let P,D,{itemWidth:O,itemHeight:L}=(v=i,y=t,x=s,b=e,w=r,{itemWidth:(_=b,S=v,C=y,M=x,(P=_.text)&&"string"!=typeof P&&(P=P.reduce((e,t)=>e.length>t.length?e:t)),S+C.size/2+M.measureText(P).width),itemHeight:(E=w,A=b,T=y.lineHeight,D=E,"string"!=typeof A.text&&(D=r5(A,T)),D)});a>0&&f+L+2*o>d&&(u+=p+o,c.push({width:p,height:f}),m+=p+o,g++,p=f=0),h[a]={left:m,top:f,col:g,width:O,height:L},p=Math.max(p,O),f+=L+o}),u+=p,c.push({width:p,height:f}),u}adjustHitBoxes(){if(!this.options.display)return;let e=this._computeTitleHeight(),{legendHitBoxes:t,options:{align:i,labels:{padding:r},rtl:s}}=this,a=tG(s,this.left,this.width);if(this.isHorizontal()){let s=0,o=ez(i,this.left+r,this.right-this.lineWidths[s]);for(let h of t)s!==h.row&&(s=h.row,o=ez(i,this.left+r,this.right-this.lineWidths[s])),h.top+=this.top+e+r,h.left=a.leftForLtr(a.x(o),h.width),o+=h.width+r}else{let s=0,o=ez(i,this.top+e+r,this.bottom-this.columnSizes[s].height);for(let h of t)h.col!==s&&(s=h.col,o=ez(i,this.top+e+r,this.bottom-this.columnSizes[s].height)),h.top=o,h.left+=this.left+r,h.left=a.leftForLtr(a.x(h.left),h.width),o+=h.height+r}}isHorizontal(){return"top"===this.options.position||"bottom"===this.options.position}draw(){if(this.options.display){let e=this.ctx;e7(e,this),this._draw(),te(e)}}_draw(){let e,{options:t,columnSizes:i,lineWidths:r,ctx:s}=this,{align:a,labels:o}=t,h=e2.color,c=tG(t.rtl,this.left,this.width),d=tu(o.font),{padding:u}=o,p=d.size,f=p/2;this.drawTitle(),s.textAlign=c.textAlign("left"),s.textBaseline="middle",s.lineWidth=.5,s.font=d.string;let{boxWidth:m,boxHeight:g,itemHeight:v}=r3(o,p),y=function(e,t,i){if(isNaN(m)||m<=0||isNaN(g)||g<0)return;s.save();let r=U(i.lineWidth,1);if(s.fillStyle=U(i.fillStyle,h),s.lineCap=U(i.lineCap,"butt"),s.lineDashOffset=U(i.lineDashOffset,0),s.lineJoin=U(i.lineJoin,"miter"),s.lineWidth=r,s.strokeStyle=U(i.strokeStyle,h),s.setLineDash(U(i.lineDash,[])),o.usePointStyle)e8(s,{radius:g*Math.SQRT2/2,pointStyle:i.pointStyle,rotation:i.rotation,borderWidth:r},c.xPlus(e,m/2),t+f,o.pointStyleWidth&&m);else{let a=t+Math.max((p-g)/2,0),o=c.leftForLtr(e,m),h=tc(i.borderRadius);s.beginPath(),Object.values(h).some(e=>0!==e)?ts(s,{x:o,y:a,w:m,h:g,radius:h}):s.rect(o,a,m,g),s.fill(),0!==r&&s.stroke()}s.restore()},x=function(e,t,i){tr(s,i.text,e,t+v/2,d,{strikethrough:i.hidden,textAlign:c.textAlign(i.textAlign)})},b=this.isHorizontal(),w=this._computeTitleHeight();e=b?{x:ez(a,this.left+u,this.right-r[0]),y:this.top+u+w,line:0}:{x:this.left+u,y:ez(a,this.top+w+u,this.bottom-i[0].height),line:0},tq(this.ctx,t.textDirection);let _=v+u;this.legendItems.forEach((h,p)=>{var g,v;s.strokeStyle=h.fontColor,s.fillStyle=h.fontColor;let S=s.measureText(h.text).width,C=c.textAlign(h.textAlign||(h.textAlign=o.textAlign)),M=m+f+S,E=e.x,A=e.y;if(c.setWidth(this.width),b?p>0&&E+M+u>this.right&&(A=e.y+=_,e.line++,E=e.x=ez(a,this.left+u,this.right-r[e.line])):p>0&&A+_>this.bottom&&(E=e.x=E+i[e.line].width+u,e.line++,A=e.y=ez(a,this.top+w+u,this.bottom-i[e.line].height)),y(c.x(E),A,h),g=E+m+f,v=b?E+M:this.right,E=C===(t.rtl?"left":"right")?v:"center"===C?(g+v)/2:g,x(c.x(E),A,h),b)e.x+=M+u;else if("string"!=typeof h.text){let t=d.lineHeight;e.y+=r5(h,t)+u}else e.y+=_}),tX(this.ctx,t.textDirection)}drawTitle(){let e,t=this.options,i=t.title,r=tu(i.font),s=td(i.padding);if(!i.display)return;let a=tG(t.rtl,this.left,this.width),o=this.ctx,h=i.position,c=r.size/2,d=s.top+c,u=this.left,p=this.width;if(this.isHorizontal())p=Math.max(...this.lineWidths),e=this.top+d,u=ez(t.align,u,this.right-p);else{let i=this.columnSizes.reduce((e,t)=>Math.max(e,t.height),0);e=d+ez(t.align,this.top,this.bottom-i-t.labels.padding-this._computeTitleHeight())}let f=ez(h,u,u+p);o.textAlign=a.textAlign(eB(h)),o.textBaseline="middle",o.strokeStyle=i.color,o.fillStyle=i.color,o.font=r.string,tr(o,i.text,f,e,r)}_computeTitleHeight(){let e=this.options.title,t=tu(e.font),i=td(e.padding);return e.display?t.lineHeight+i.height:0}_getLegendItemAt(e,t){let i,r,s;if(eA(e,this.left,this.right)&&eA(t,this.top,this.bottom)){for(i=0,s=this.legendHitBoxes;i<s.length;
8198++i)if(eA(e,(r=s[i]).left,r.left+r.width)&&eA(t,r.top,r.top+r.height))return this.legendItems[i]}return null}handleEvent(e){var t,i;let r=this.options;if(t=e.type,i=r,("mousemove"!==t&&"mouseout"!==t||!i.onHover&&!i.onLeave)&&(!i.onClick||"click"!==t&&"mouseup"!==t))return;let s=this._getLegendItemAt(e.x,e.y);if("mousemove"===e.type||"mouseout"===e.type){let t=this._hoveredItem,i=null!==t&&null!==s&&t.datasetIndex===s.datasetIndex&&t.index===s.index;t&&!i&&W(r.onLeave,[e,t,this],this),this._hoveredItem=s,s&&!i&&W(r.onHover,[e,s,this],this)}else s&&W(r.onClick,[e,s,this],this)}}function r5(e,t){return t*(e.text?e.text.length:0)}class r6 extends iJ{constructor(e){super(),this.chart=e.chart,this.options=e.options,this.ctx=e.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(e,t){let i=this.options;if(this.left=0,this.top=0,!i.display){this.width=this.height=this.right=this.bottom=0;return}this.width=this.right=e,this.height=this.bottom=t;let r=z(i.text)?i.text.length:1;this._padding=td(i.padding);let s=r*tu(i.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=s:this.width=s}isHorizontal(){let e=this.options.position;return"top"===e||"bottom"===e}_drawArgs(e){let t,i,r,{top:s,left:a,bottom:o,right:h,options:c}=this,d=c.align,u=0;return this.isHorizontal()?(i=ez(d,a,h),r=s+e,t=h-a):("left"===c.position?(i=a+e,r=ez(d,o,s),u=-.5*es):(i=h-e,r=ez(d,s,o),u=.5*es),t=o-s),{titleX:i,titleY:r,maxWidth:t,rotation:u}}draw(){let e=this.ctx,t=this.options;if(!t.display)return;let i=tu(t.font),r=i.lineHeight/2+this._padding.top,{titleX:s,titleY:a,maxWidth:o,rotation:h}=this._drawArgs(r);tr(e,t.text,0,0,i,{color:t.color,maxWidth:o,rotation:h,textAlign:eB(t.align),textBaseline:"middle",translation:[s,a]})}}let r8=new WeakMap,r9={average(e){let t,i;if(!e.length)return!1;let r=new Set,s=0,a=0;for(t=0,i=e.length;t<i;++t){let i=e[t].element;if(i&&i.hasValue()){let e=i.tooltipPosition();r.add(e.x),s+=e.y,++a}}return 0!==a&&0!==r.size&&{x:[...r].reduce((e,t)=>e+t)/r.size,y:s/a}},nearest(e,t){let i,r,s;if(!e.length)return!1;let a=t.x,o=t.y,h=1/0;for(i=0,r=e.length;i<r;++i){let r=e[i].element;if(r&&r.hasValue()){let e=e_(t,r.getCenterPoint());e<h&&(h=e,s=r)}}if(s){let e=s.tooltipPosition();a=e.x,o=e.y}return{x:a,y:o}}};function r7(e,t){return t&&(z(t)?Array.prototype.push.apply(e,t):e.push(t)),e}function se(e){return("string"==typeof e||e instanceof String)&&e.indexOf("\n")>-1?e.split("\n"):e}function st(e,t){let i=e.chart.ctx,{body:r,footer:s,title:a}=e,{boxWidth:o,boxHeight:h}=t,c=tu(t.bodyFont),d=tu(t.titleFont),u=tu(t.footerFont),p=a.length,f=s.length,m=r.length,g=td(t.padding),v=g.height,y=0,x=r.reduce((e,t)=>e+t.before.length+t.lines.length+t.after.length,0);x+=e.beforeBody.length+e.afterBody.length,p&&(v+=p*d.lineHeight+(p-1)*t.titleSpacing+t.titleMarginBottom),x&&(v+=m*(t.displayColors?Math.max(h,c.lineHeight):c.lineHeight)+(x-m)*c.lineHeight+(x-1)*t.bodySpacing),f&&(v+=t.footerMarginTop+f*u.lineHeight+(f-1)*t.footerSpacing);let b=0,w=function(e){y=Math.max(y,i.measureText(e).width+b)};return i.save(),i.font=d.string,H(e.title,w),i.font=c.string,H(e.beforeBody.concat(e.afterBody),w),b=t.displayColors?o+2+t.boxPadding:0,H(r,e=>{H(e.before,w),H(e.lines,w),H(e.after,w)}),b=0,i.font=u.string,H(e.footer,w),i.restore(),{width:y+=g.width,height:v}}function si(e,t,i){let r=i.yAlign||t.yAlign||function(e,t){let{y:i,height:r}=t;return i<r/2?"top":i>e.height-r/2?"bottom":"center"}(e,i);return{xAlign:i.xAlign||t.xAlign||function(e,t,i,r){let{x:s,width:a}=i,{width:o,chartArea:{left:h,right:c}}=e,d="center";return"center"===r?d=s<=(h+c)/2?"left":"right":s<=a/2?d="left":s>=o-a/2&&(d="right"),function(e,t,i,r){let{x:s,width:a}=r,o=i.caretSize+i.caretPadding;if("left"===e&&s+a+o>t.width||"right"===e&&s-a-o<0)return!0}(d,e,t,i)&&(d="center"),d}(e,t,i,r),yAlign:r}}function sr(e,t,i,r){let{caretSize:s,caretPadding:a,cornerRadius:o}=e,{xAlign:h,yAlign:c}=i,d=s+a,{topLeft:u,topRight:p,bottomLeft:f,bottomRight:m}=tc(o),g=function(e,t){let{x:i,width:r}=e;return"right"===t?i-=r:"center"===t&&(i-=r/2),i}(t,h),v=function(e,t,i){let{y:r,height:s}=e;return"top"===t?r+=i:"bottom"===t?r-=s+i:r-=s/2,r}(t,c,d);return"center"===c?"left"===h?g+=d:"right"===h&&(g-=d):"left"===h?g-=Math.max(u,f)+s:"right"===h&&(g+=Math.max(p,m)+s),{x:eE(g,0,r.width-t.width),y:eE(v,0,r.height-t.height)}}function ss(e,t,i){let r=td(i.padding);return"center"===t?e.x+e.width/2:"right"===t?e.x+e.width-r.right:e.x+r.left}function sa(e,t){let i=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return i?e.override(i):e}let sn={beforeTitle:R,title(e){if(e.length>0){let t=e[0],i=t.chart.data.labels,r=i?i.length:0;if(this&&this.options&&"dataset"===this.options.mode)return t.dataset.label||"";if(t.label)return t.label;if(r>0&&t.dataIndex<r)return i[t.dataIndex]}return""},afterTitle:R,beforeBody:R,beforeLabel:R,label(e){if(this&&this.options&&"dataset"===this.options.mode)return e.label+": "+e.formattedValue||e.formattedValue;let t=e.dataset.label||"";t&&(t+=": ");let i=e.formattedValue;return B(i)||(t+=i),t},labelColor(e){let t=e.chart.getDatasetMeta(e.datasetIndex).controller.getStyle(e.dataIndex);return{borderColor:t.borderColor,backgroundColor:t.backgroundColor,borderWidth:t.borderWidth,borderDash:t.borderDash,borderDashOffset:t.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(e){let t=e.chart.getDatasetMeta(e.datasetIndex).controller.getStyle(e.dataIndex);return{pointStyle:t.pointStyle,rotation:t.rotation}},afterLabel:R,afterBody:R,beforeFooter:R,footer:R,afterFooter:R};function so(e,t,i,r){let s=e[t].call(i,r);return void 0===s?sn[t].call(i,r):s}class sl extends iJ{static positioners=r9;constructor(e){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=e.chart,this.options=e.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(e){this.options=e,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){let e=this._cachedAnimations;if(e)return e;let t=this.chart,i=this.options.setContext(this.getContext()),r=i.enabled&&t.options.animation&&i.animations,s=new t6(this.chart,r);return r._cacheable&&(this._cachedAnimations=Object.freeze(s)),s}getContext(){var e;return this.$context||(this.$context=(e=this.chart.getContext(),tf(e,{tooltip:this,tooltipItems:this._tooltipItems,type:"tooltip"})))}getTitle(e,t){let{callbacks:i}=t,r=so(i,"beforeTitle",this,e),s=so(i,"title",this,e),a=so(i,"afterTitle",this,e),o=[];return o=r7(o,se(r)),o=r7(o,se(s)),o=r7(o,se(a))}getBeforeBody(e,t){return r7([],se(so(t.callbacks,"beforeBody",this,e)))}getBody(e,t){let{callbacks:i}=t,r=[];return H(e,e=>{let t={before:[],lines:[],after:[]},s=sa(i,e);r7(t.before,se(so(s,"beforeLabel",this,e))),r7(t.lines,so(s,"label",this,e)),r7(t.after,se(so(s,"afterLabel",this,e))),r.push(t)}),r}getAfterBody(e,t){return r7([],se(so(t.callbacks,"afterBody",this,e)))}getFooter(e,t){let{callbacks:i}=t,r=so(i,"beforeFooter",this,e),s=so(i,"footer",this,e),a=so(i,"afterFooter",this,e),o=[];return o=r7(o,se(r)),o=r7(o,se(s)),o=r7(o,se(a))}_createItems(e){let t,i,r=this._active,s=this.chart.data,a=[],o=[],h=[],c=[];for(t=0,i=r.length;t<i;++t)c.push(function(e,t){let{element:i,datasetIndex:r,index:s}=t,a=e.getDatasetMeta(r).controller,{label:o,value:h}=a.getLabelAndValue(s);return{chart:e,label:o,parsed:a.getParsed(s),raw:e.data.datasets[r].data[s],formattedValue:h,dataset:a.getDataset(),dataIndex:s,datasetIndex:r,element:i}}(this.chart,r[t]));return e.filter&&(c=c.filter((t,i,r)=>e.filter(t,i,r,s))),e.itemSort&&(c=c.sort((t,i)=>e.itemSort(t,i,s))),H(c,t=>{let i=sa(e.callbacks,t);a.push(so(i,"labelColor",this,t)),o.push(so(i,"labelPointStyle",this,t)),h.push(so(i,"labelTextColor",this,t))}),this.labelColors=a,this.labelPointStyles=o,this.labelTextColors=h,this.dataPoints=c,c}update(e,t){let i,r=this.options.setContext(this.getContext()),s=this._active,a=[];if(s.length){let e=r9[r.position].call(this,s,this._eventPosition);a=this._createItems(r),this.title=this.getTitle(a,r),this.beforeBody=this.getBeforeBody(a,r),this.body=this.getBody(a,r),this.afterBody=this.getAfterBody(a,r),this.footer=this.getFooter(a,r);let t=this._size=st(this,r),o=Object.assign({},e,t),h=si(this.chart,r,o),c=sr(r,o,h,this.chart);this.xAlign=h.xAlign,this.yAlign=h.yAlign,i={opacity:1,x:c.x,y:c.y,width:t.width,height:t.height,caretX:e.x,caretY:e.y}}else 0!==this.opacity&&(i={opacity:0}
8198);this._tooltipItems=a,this.$context=void 0,i&&this._resolveAnimations().update(this,i),e&&r.external&&r.external.call(this,{chart:this.chart,tooltip:this,replay:t})}drawCaret(e,t,i,r){let s=this.getCaretPosition(e,i,r);t.lineTo(s.x1,s.y1),t.lineTo(s.x2,s.y2),t.lineTo(s.x3,s.y3)}getCaretPosition(e,t,i){let r,s,a,o,h,c,{xAlign:d,yAlign:u}=this,{caretSize:p,cornerRadius:f}=i,{topLeft:m,topRight:g,bottomLeft:v,bottomRight:y}=tc(f),{x:x,y:b}=e,{width:w,height:_}=t;return"center"===u?(h=b+_/2,"left"===d?(s=(r=x)-p,o=h+p,c=h-p):(s=(r=x+w)+p,o=h-p,c=h+p),a=r):(s="left"===d?x+Math.max(m,v)+p:"right"===d?x+w-Math.max(g,y)-p:this.caretX,"top"===u?(h=(o=b)-p,r=s-p,a=s+p):(h=(o=b+_)+p,r=s+p,a=s-p),c=o),{x1:r,x2:s,x3:a,y1:o,y2:h,y3:c}}drawTitle(e,t,i){let r,s,a,o=this.title,h=o.length;if(h){let c=tG(i.rtl,this.x,this.width);for(a=0,e.x=ss(this,i.titleAlign,i),t.textAlign=c.textAlign(i.titleAlign),t.textBaseline="middle",r=tu(i.titleFont),s=i.titleSpacing,t.fillStyle=i.titleColor,t.font=r.string;a<h;++a)t.fillText(o[a],c.x(e.x),e.y+r.lineHeight/2),e.y+=r.lineHeight+s,a+1===h&&(e.y+=i.titleMarginBottom-s)}}_drawColorBox(e,t,i,r,s){let a=this.labelColors[i],o=this.labelPointStyles[i],{boxHeight:h,boxWidth:c}=s,d=tu(s.bodyFont),u=ss(this,"left",s),p=r.x(u),f=h<d.lineHeight?(d.lineHeight-h)/2:0,m=t.y+f;if(s.usePointStyle){let t={radius:Math.min(c,h)/2,pointStyle:o.pointStyle,rotation:o.rotation,borderWidth:1},i=r.leftForLtr(p,c)+c/2,d=m+h/2;e.strokeStyle=s.multiKeyBackground,e.fillStyle=s.multiKeyBackground,e6(e,t,i,d),e.strokeStyle=a.borderColor,e.fillStyle=a.backgroundColor,e6(e,t,i,d)}else{e.lineWidth=N(a.borderWidth)?Math.max(...Object.values(a.borderWidth)):a.borderWidth||1,e.strokeStyle=a.borderColor,e.setLineDash(a.borderDash||[]),e.lineDashOffset=a.borderDashOffset||0;let t=r.leftForLtr(p,c),i=r.leftForLtr(r.xPlus(p,1),c-2),o=tc(a.borderRadius);Object.values(o).some(e=>0!==e)?(e.beginPath(),e.fillStyle=s.multiKeyBackground,ts(e,{x:t,y:m,w:c,h:h,radius:o}),e.fill(),e.stroke(),e.fillStyle=a.backgroundColor,e.beginPath(),ts(e,{x:i,y:m+1,w:c-2,h:h-2,radius:o}),e.fill()):(e.fillStyle=s.multiKeyBackground,e.fillRect(t,m,c,h),e.strokeRect(t,m,c,h),e.fillStyle=a.backgroundColor,e.fillRect(i,m+1,c-2,h-2))}e.fillStyle=this.labelTextColors[i]}drawBody(e,t,i){let r,s,a,o,h,c,{body:d}=this,{bodySpacing:u,bodyAlign:p,displayColors:f,boxHeight:m,boxWidth:g,boxPadding:v}=i,y=tu(i.bodyFont),x=y.lineHeight,b=0,w=tG(i.rtl,this.x,this.width),_=function(i){t.fillText(i,w.x(e.x+b),e.y+x/2),e.y+=x+u},S=w.textAlign(p);for(t.textAlign=p,t.textBaseline="middle",t.font=y.string,e.x=ss(this,S,i),t.fillStyle=i.bodyColor,H(this.beforeBody,_),b=f&&"right"!==S?"center"===p?g/2+v:g+2+v:0,a=0,h=d.length;a<h;++a){for(r=d[a],t.fillStyle=this.labelTextColors[a],H(r.before,_),s=r.lines,f&&s.length&&(this._drawColorBox(t,e,a,w,i),x=Math.max(y.lineHeight,m)),o=0,c=s.length;o<c;++o)_(s[o]),x=y.lineHeight;H(r.after,_)}b=0,x=y.lineHeight,H(this.afterBody,_),e.y-=u}drawFooter(e,t,i){let r,s,a=this.footer,o=a.length;if(o){let h=tG(i.rtl,this.x,this.width);for(e.x=ss(this,i.footerAlign,i),e.y+=i.footerMarginTop,t.textAlign=h.textAlign(i.footerAlign),t.textBaseline="middle",r=tu(i.footerFont),t.fillStyle=i.footerColor,t.font=r.string,s=0;s<o;++s)t.fillText(a[s],h.x(e.x),e.y+r.lineHeight/2),e.y+=r.lineHeight+i.footerSpacing}}drawBackground(e,t,i,r){let{xAlign:s,yAlign:a}=this,{x:o,y:h}=e,{width:c,height:d}=i,{topLeft:u,topRight:p,bottomLeft:f,bottomRight:m}=tc(r.cornerRadius);t.fillStyle=r.backgroundColor,t.strokeStyle=r.borderColor,t.lineWidth=r.borderWidth,t.beginPath(),t.moveTo(o+u,h),"top"===a&&this.drawCaret(e,t,i,r),t.lineTo(o+c-p,h),t.quadraticCurveTo(o+c,h,o+c,h+p),"center"===a&&"right"===s&&this.drawCaret(e,t,i,r),t.lineTo(o+c,h+d-m),t.quadraticCurveTo(o+c,h+d,o+c-m,h+d),"bottom"===a&&this.drawCaret(e,t,i,r),t.lineTo(o+f,h+d),t.quadraticCurveTo(o,h+d,o,h+d-f),"center"===a&&"left"===s&&this.drawCaret(e,t,i,r),t.lineTo(o,h+u),t.quadraticCurveTo(o,h,o+u,h),t.closePath(),t.fill(),r.borderWidth>0&&t.stroke()}_updateAnimationTarget(e){let t=this.chart,i=this.$animations,r=i&&i.x,s=i&&i.y;if(r||s){let i=r9[e.position].call(this,this._active,this._eventPosition);if(!i)return;let a=this._size=st(this,e),o=Object.assign({},i,this._size),h=si(t,e,o),c=sr(e,o,h,t);(r._to!==c.x||s._to!==c.y)&&(this.xAlign=h.xAlign,this.yAlign=h.yAlign,this.width=a.width,this.height=a.height,this.caretX=i.x,this.caretY=i.y,this._resolveAnimations().update(this,c))}}_willRender(){return!!this.opacity}draw(e){let t=this.options.setContext(this.getContext()),i=this.opacity;if(!i)return;this._updateAnimationTarget(t);let r={width:this.width,height:this.height},s={x:this.x,y:this.y};i=.001>Math.abs(i)?0:i;let a=td(t.padding),o=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;
8198t.enabled&&o&&(e.save(),e.globalAlpha=i,this.drawBackground(s,e,r,t),tq(e,t.textDirection),s.y+=a.top,this.drawTitle(s,e,t),this.drawBody(s,e,t),this.drawFooter(s,e,t),tX(e,t.textDirection),e.restore())}getActiveElements(){return this._active||[]}setActiveElements(e,t){let i=this._active,r=e.map(({datasetIndex:e,index:t})=>{let i=this.chart.getDatasetMeta(e);if(!i)throw Error("Cannot find a dataset at index "+e);return{datasetIndex:e,element:i.data[t],index:t}}),s=!G(i,r),a=this._positionChanged(r,t);(s||a)&&(this._active=r,this._eventPosition=t,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(e,t,i=!0){if(t&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;let r=this.options,s=this._active||[],a=this._getActiveElements(e,s,t,i),o=this._positionChanged(a,e),h=t||!G(a,s)||o;return h&&(this._active=a,(r.enabled||r.external)&&(this._eventPosition={x:e.x,y:e.y},this.update(!0,t))),h}_getActiveElements(e,t,i,r){let s=this.options;if("mouseout"===e.type)return[];if(!r)return t.filter(e=>this.chart.data.datasets[e.datasetIndex]&&void 0!==this.chart.getDatasetMeta(e.datasetIndex).controller.getParsed(e.index));let a=this.chart.getElementsAtEventForMode(e,s.mode,s,i);return s.reverse&&a.reverse(),a}_positionChanged(e,t){let{caretX:i,caretY:r,options:s}=this,a=r9[s.position].call(this,e,t);return!1!==a&&(i!==a.x||r!==a.y)}}var sh=Object.freeze({__proto__:null,Colors:{id:"colors",defaults:{enabled:!0,forceOverride:!1},beforeLayout(e,t,i){let r;if(!i.enabled)return;let{data:{datasets:s},options:a}=e.config,{elements:o}=a,h=rW(s)||a&&(a.borderColor||a.backgroundColor)||o&&rW(o)||"rgba(0,0,0,0.1)"!==e2.borderColor||"rgba(0,0,0,0.1)"!==e2.backgroundColor;if(!i.forceOverride&&h)return;let c=(r=0,(t,i)=>{var s,a,o;let h=e.getDatasetMeta(i).controller;h instanceof im?(s=r,t.backgroundColor=t.data.map(()=>rU(s++)),r=s):h instanceof ig?(a=r,t.backgroundColor=t.data.map(()=>rV(a++)),r=a):h&&(t.borderColor=rU(o=r),t.backgroundColor=rV(o),r=++o)});s.forEach(c)}},Decimation:{id:"decimation",defaults:{algorithm:"min-max",enabled:!1},beforeElementsUpdate:(e,t,i)=>{if(!i.enabled)return void rG(e);let r=e.width;e.data.datasets.forEach((t,s)=>{let a,{_data:o,indexAxis:h}=t,c=e.getDatasetMeta(s),d=o||t.data;if("y"===tp([h,e.options.indexAxis])||!c.controller.supportsDecimation)return;let u=e.scales[c.xAxisID];if("linear"!==u.type&&"time"!==u.type||e.options.parsing)return;let{start:p,count:f}=function(e,t){let i,r=t.length,s=0,{iScale:a}=e,{min:o,max:h,minDefined:c,maxDefined:d}=a.getUserBounds();return c&&(s=eE(eP(t,a.axis,o).lo,0,r-1)),i=d?eE(eP(t,a.axis,h).hi+1,s,r)-s:r-s,{start:s,count:i}}(c,d);if(f<=(i.threshold||4*r))return void rH(t);switch(B(o)&&(t._data=d,delete t.data,Object.defineProperty(t,"data",{configurable:!0,enumerable:!0,get:function(){return this._decimated},set:function(e){this._data=e}})),i.algorithm){case"lttb":a=function(e,t,i,r,s){let a,o,h,c,d,u=s.samples||r;if(u>=i)return e.slice(t,t+i);let p=[],f=(i-2)/(u-2),m=0,g=t+i-1,v=t;for(a=0,p[m++]=e[v];a<u-2;a++){let r,s=0,u=0,g=Math.floor((a+1)*f)+1+t,y=Math.min(Math.floor((a+2)*f)+1,i)+t,x=y-g;for(r=g;r<y;r++)s+=e[r].x,u+=e[r].y;s/=x,u/=x;let b=Math.floor(a*f)+1+t,w=Math.min(Math.floor((a+1)*f)+1,i)+t,{x:_,y:S}=e[v];for(h=c=-1,r=b;r<w;r++)(c=.5*Math.abs((_-s)*(e[r].y-S)-(_-e[r].x)*(u-S)))>h&&(h=c,o=e[r],d=r);p[m++]=o,v=d}return p[m++]=e[g],p}(d,p,f,r,i);break;case"min-max":a=function(e,t,i,r){let s,a,o,h,c,d,u,p,f,m,g=0,v=0,y=[],x=e[t].x,b=e[t+i-1].x-x;for(s=t;s<t+i;++s){o=((a=e[s]).x-x)/b*r,h=a.y;let t=0|o;if(t===c)h<f?(f=h,d=s):h>m&&(m=h,u=s),g=(v*g+a.x)/++v;else{let i=s-1;if(!B(d)&&!B(u)){let t=Math.min(d,u),r=Math.max(d,u);t!==p&&t!==i&&y.push({...e[t],x:g}),r!==p&&r!==i&&y.push({...e[r],x:g})}s>0&&i!==p&&y.push(e[i]),y.push(a),c=t,v=0,f=m=h,d=u=p=s}}return y}(d,p,f,r);break;default:throw Error(`Unsupported decimation algorithm '${i.algorithm}'`)}t._decimated=a})},destroy(e){rG(e)}},Filler:{id:"filler",afterDatasetsUpdate(e,t,i){let r,s,a,o,h=(e.data.datasets||[]).length,c=[];for(s=0;s<h;++s)a=(r=e.getDatasetMeta(s)).dataset,o=null,a&&a.options&&a instanceof rO&&(o={visible:e.isDatasetVisible(s),index:s,fill:function(e,t,i){var r,s,a,o;
8198let h=function(e){let t=e.options,i=t.fill,r=U(i&&i.target,i);return void 0===r&&(r=!!t.backgroundColor),!1!==r&&null!==r&&(!0===r?"origin":r)}(e);if(N(h))return!isNaN(h.value)&&h;let c=parseFloat(h);return F(c)&&Math.floor(c)===c?(r=h[0],s=t,a=c,o=i,("-"===r||"+"===r)&&(a=s+a),a!==s&&!(a<0)&&!(a>=o)&&a):["origin","start","end","stack","shape"].indexOf(h)>=0&&h}(a,s,h),chart:e,axis:r.controller.options.indexAxis,scale:r.vScale,line:a}),r.$filler=o,c.push(o);for(s=0;s<h;++s)(o=c[s])&&!1!==o.fill&&(o.fill=function(e,t,i){let r,s=e[t].fill,a=[t];if(!i)return s;for(;!1!==s&&-1===a.indexOf(s);){if(!F(s))return s;if(!(r=e[s]))break;if(r.visible)return s;a.push(s),s=r.fill}return!1}(c,s,i.propagate))},beforeDraw(e,t,i){let r="beforeDraw"===i.drawTime,s=e.getSortedVisibleDatasetMetas(),a=e.chartArea;for(let t=s.length-1;t>=0;--t){let i=s[t].$filler;i&&(i.line.updateControlPoints(a,i.axis),r&&i.fill&&rJ(e.ctx,i,a))}},beforeDatasetsDraw(e,t,i){if("beforeDatasetsDraw"!==i.drawTime)return;let r=e.getSortedVisibleDatasetMetas();for(let t=r.length-1;t>=0;--t){let i=r[t].$filler;rZ(i)&&rJ(e.ctx,i,e.chartArea)}},beforeDatasetDraw(e,t,i){let r=t.meta.$filler;rZ(r)&&"beforeDatasetDraw"===i.drawTime&&rJ(e.ctx,r,e.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}},Legend:{id:"legend",_element:r4,start(e,t,i){let r=e.legend=new r4({ctx:e.ctx,options:i,chart:e});ik.configure(e,r,i),ik.addBox(e,r)},stop(e){ik.removeBox(e,e.legend),delete e.legend},beforeUpdate(e,t,i){let r=e.legend;ik.configure(e,r,i),r.options=i},afterUpdate(e){let t=e.legend;t.buildLabels(),t.adjustHitBoxes()},afterEvent(e,t){t.replay||e.legend.handleEvent(t.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(e,t,i){let r=t.datasetIndex,s=i.chart;s.isDatasetVisible(r)?(s.hide(r),t.hidden=!0):(s.show(r),t.hidden=!1)},onHover:null,onLeave:null,labels:{color:e=>e.chart.options.color,boxWidth:40,padding:10,generateLabels(e){let t=e.data.datasets,{labels:{usePointStyle:i,pointStyle:r,textAlign:s,color:a,useBorderRadius:o,borderRadius:h}}=e.legend.options;return e._getSortedDatasetMetas().map(e=>{let c=e.controller.getStyle(i?0:void 0),d=td(c.borderWidth);return{text:t[e.index].label,fillStyle:c.backgroundColor,fontColor:a,hidden:!e.visible,lineCap:c.borderCapStyle,lineDash:c.borderDash,lineDashOffset:c.borderDashOffset,lineJoin:c.borderJoinStyle,lineWidth:(d.width+d.height)/4,strokeStyle:c.borderColor,pointStyle:r||c.pointStyle,rotation:c.rotation,textAlign:s||c.textAlign,borderRadius:o&&(h||c.borderRadius),datasetIndex:e.index}},this)}},title:{color:e=>e.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:e=>!e.startsWith("on"),labels:{_scriptable:e=>!["generateLabels","filter","sort"].includes(e)}}},SubTitle:{id:"subtitle",start(e,t,i){let r=new r6({ctx:e.ctx,options:i,chart:e});ik.configure(e,r,i),ik.addBox(e,r),r8.set(e,r)},stop(e){ik.removeBox(e,r8.get(e)),r8.delete(e)},beforeUpdate(e,t,i){let r=r8.get(e);ik.configure(e,r,i),r.options=i},defaults:{align:"center",display:!1,font:{weight:"normal"},fullSize:!0,padding:0,position:"top",text:"",weight:1500},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}},Title:{id:"title",_element:r6,start(e,t,i){let r;r=new r6({ctx:e.ctx,options:i,chart:e}),ik.configure(e,r,i),ik.addBox(e,r),e.titleBlock=r},stop(e){let t=e.titleBlock;ik.removeBox(e,t),delete e.titleBlock},beforeUpdate(e,t,i){let r=e.titleBlock;ik.configure(e,r,i),r.options=i},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}},Tooltip:{id:"tooltip",_element:sl,positioners:r9,afterInit(e,t,i){i&&(e.tooltip=new sl({chart:e,options:i}))},beforeUpdate(e,t,i){e.tooltip&&e.tooltip.initialize(i)},reset(e,t,i){e.tooltip&&e.tooltip.initialize(i)},afterDraw(e){let t=e.tooltip;if(t&&t._willRender()){let i={tooltip:t};if(!1===e.notifyPlugins("beforeTooltipDraw",{...i,cancelable:!0}))return;t.draw(e.ctx),e.notifyPlugins("afterTooltipDraw",i)}},afterEvent(e,t){if(e.tooltip){let i=t.replay;e.tooltip.handleEvent(t.event,i,t.inChartArea)&&(t.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(e,t)=>
8198t.bodyFont.size,boxWidth:(e,t)=>t.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:sn},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:e=>"filter"!==e&&"itemSort"!==e&&"external"!==e,_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]}});function sc(e){let t=this.getLabels();return e>=0&&e<t.length?t[e]:e}function sd(e,t,{horizontal:i,minRotation:r}){let s=ey(r),a=(i?Math.sin(s):Math.cos(s))||.001,o=.75*t*(""+e).length;return Math.min(t/a,o)}class su extends i5{constructor(e){super(e),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(e,t){return B(e)||("number"==typeof e||e instanceof Number)&&!isFinite(+e)?null:+e}handleTickRangeOptions(){let{beginAtZero:e}=this.options,{minDefined:t,maxDefined:i}=this.getUserBounds(),{min:r,max:s}=this,a=e=>r=t?r:e,o=e=>s=i?s:e;if(e){let e=ep(r),t=ep(s);e<0&&t<0?o(0):e>0&&t>0&&a(0)}if(r===s){let t=0===s?1:Math.abs(.05*s);o(s+t),e||a(r-t)}this.min=r,this.max=s}getTickLimit(){let e,{maxTicksLimit:t,stepSize:i}=this.options.ticks;return i?(e=Math.ceil(this.max/i)-Math.floor(this.min/i)+1)>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${i} would result generating up to ${e} ticks. Limiting to 1000.`),e=1e3):(e=this.computeTickLimit(),t=t||11),t&&(e=Math.min(t,e)),e}computeTickLimit(){return 1/0}buildTicks(){let e=this.options,t=e.ticks,i=this.getTickLimit(),r=function(e,t){var i,r;let s,a,o,h,c,d=[],{bounds:u,step:p,min:f,max:m,precision:g,count:v,maxTicks:y,maxDigits:x,includeBounds:b}=e,w=p||1,_=y-1,{min:S,max:C}=t,M=!B(f),E=!B(m),A=!B(v),T=(C-S)/(x+1),P=em((C-S)/_/w)*w;if(P<1e-14&&!M&&!E)return[{value:S},{value:C}];(h=Math.ceil(C/P)-Math.floor(S/P))>_&&(P=em(h*P/_/w)*w),B(g)||(P=Math.ceil(P*(s=Math.pow(10,g)))/s),"ticks"===u?(a=Math.floor(S/P)*P,o=Math.ceil(C/P)*P):(a=S,o=C),M&&E&&p&&(i=(m-f)/p,r=P/1e3,(c=Math.round(i))-r<=i&&c+r>=i)?(h=Math.round(Math.min((m-f)/P,y)),P=(m-f)/h,a=f,o=m):A?(a=M?f:a,P=((o=E?m:o)-a)/(h=v-1)):h=ef(h=(o-a)/P,Math.round(h),P/1e3)?Math.round(h):Math.ceil(h);let D=Math.max(eb(P),eb(a));a=Math.round(a*(s=Math.pow(10,B(g)?D:g)))/s,o=Math.round(o*s)/s;let O=0;for(M&&(b&&a!==f?(d.push({value:f}),a<f&&O++,ef(Math.round((a+O*P)*s)/s,f,sd(f,T,e))&&O++):a<f&&O++);O<h;++O){let e=Math.round((a+O*P)*s)/s;if(E&&e>m)break;d.push({value:e})}return E&&b&&o!==m?d.length&&ef(d[d.length-1].value,m,sd(m,T,e))?d[d.length-1].value=m:d.push({value:m}):E&&o!==m||d.push({value:o}),d}({maxTicks:i=Math.max(2,i),bounds:e.bounds,min:e.min,max:e.max,precision:t.precision,step:t.stepSize,count:t.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:t.minRotation||0,includeBounds:!1!==t.includeBounds},this._range||this);return"ticks"===e.bounds&&ev(r,this,"value"),e.reverse?(r.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),r}configure(){let e=this.ticks,t=this.min,i=this.max;if(super.configure(),this.options.offset&&e.length){let r=(i-t)/Math.max(e.length-1,1)/2;t-=r,i+=r}this._startValue=t,this._endValue=i,this._valueRange=i-t}getLabelForValue(e){return eZ(e,this.chart.options.locale,this.options.ticks.format)}}class sp extends su{static id="linear";static defaults={ticks:{callback:eK.numeric}};determineDataLimits(){let{min:e,max:t}=this.getMinMax(!0);this.min=F(e)?e:0,this.max=F(t)?t:1,this.handleTickRangeOptions()}computeTickLimit(){let e=this.isHorizontal(),t=e?this.width:this.height,i=ey(this.options.ticks.minRotation),r=(e?Math.sin(i):Math.cos(i))||.001;return Math.ceil(t/Math.min(40,this._resolveTickFontOptions(0).lineHeight/r))}getPixelForValue(e){return null===e?NaN:this.getPixelForDecimal((e-this._startValue)/this._valueRange)}getValueForPixel(e){return this._startValue+this.getDecimalForPixel(e)*this._valueRange}}let sf=e=>Math.floor(eu(e)),sm=(e,t)=>Math.pow(10,sf(e)+t);function sg(e){return 1==e/Math.pow(10,sf(e))}function sv(e,t,i){let r=Math.pow(10,i),s=Math.floor(e/r);return Math.ceil(t/r)-s}class sy extends i5{static id="logarithmic";static defaults={ticks:{callback:eK.logarithmic,major:{enabled:!0}}};constructor(e){super(e),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(e,t){let i=su.prototype.parse.apply(this,[e,t]);if(0===i){this._zero=!0;return}return F(i)&&i>0?i:null}determineDataLimits(){let{min:e,max:t}=this.getMinMax(!0);this.min=F(e)?Math.max(0,e):null,this.max=F(t)?Math.max(0,t):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!F(this._userMin)&&(this.min=e===sm(this.min,0)?sm(this.min,-1):sm(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){let{minDefined:e,maxDefined:t}=this.getUserBounds(),i=this.min,r=this.max,s=t=>i=e?i:t,a=e=>r=t?r:e;i===r&&(i<=0?(s(1),a(10)):(s(sm(i,-1)),a(sm(r,1)))),i<=0&&s(sm(r,-1)),r<=0&&a(sm(i,1)),this.min=i,this.max=r}buildTicks(){let e=this.options,t=function(e,{min:t,max:i}){t=j(e.min,t);let r=[],s=sf(t),a=function(e,t){let i=sf(t-e);for(;sv(e,t,i)>10;)i++;for(;10>sv(e,t,i);)i--;return Math.min(i,sf(e))}
8198(t,i),o=a<0?Math.pow(10,Math.abs(a)):1,h=Math.pow(10,a),c=s>a?Math.pow(10,s):0,d=Math.round((t-c)*o)/o,u=Math.floor((t-c)/h/10)*h*10,p=Math.floor((d-u)/Math.pow(10,a)),f=j(e.min,Math.round((c+u+p*Math.pow(10,a))*o)/o);for(;f<i;)r.push({value:f,major:sg(f),significand:p}),p>=10?p=p<15?15:20:p++,p>=20&&(p=2,o=++a>=0?1:o),f=Math.round((c+u+p*Math.pow(10,a))*o)/o;let m=j(e.max,f);return r.push({value:m,major:sg(m),significand:p}),r}({min:this._userMin,max:this._userMax},this);return"ticks"===e.bounds&&ev(t,this,"value"),e.reverse?(t.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),t}getLabelForValue(e){return void 0===e?"0":eZ(e,this.chart.options.locale,this.options.ticks.format)}configure(){let e=this.min;super.configure(),this._startValue=eu(e),this._valueRange=eu(this.max)-eu(e)}getPixelForValue(e){return((void 0===e||0===e)&&(e=this.min),null===e||isNaN(e))?NaN:this.getPixelForDecimal(e===this.min?0:(eu(e)-this._startValue)/this._valueRange)}getValueForPixel(e){let t=this.getDecimalForPixel(e);return Math.pow(10,this._startValue+t*this._valueRange)}}function sx(e){let t=e.ticks;if(t.display&&e.display){let e=td(t.backdropPadding);return U(t.font&&t.font.size,e2.font.size)+e.height}return 0}function sb(e,t,i,r,s){return e===r||e===s?{start:t-i/2,end:t+i/2}:e<r||e>s?{start:t-i,end:t}:{start:t,end:t+i}}function sw(e,t,i,r){let{ctx:s}=e;if(i)s.arc(e.xCenter,e.yCenter,t,0,ea);else{let i=e.getPointPosition(0,t);s.moveTo(i.x,i.y);for(let a=1;a<r;a++)i=e.getPointPosition(a,t),s.lineTo(i.x,i.y)}}class s_ extends su{static id="radialLinear";static defaults={display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:eK.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback:e=>e,padding:5,centerPointLabels:!1}};static defaultRoutes={"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"};static descriptors={angleLines:{_fallback:"grid"}};constructor(e){super(e),this.xCenter=void 0,this.yCenter=void 0,this.drawingArea=void 0,this._pointLabels=[],this._pointLabelItems=[]}setDimensions(){let e=this._padding=td(sx(this.options)/2),t=this.width=this.maxWidth-e.width,i=this.height=this.maxHeight-e.height;this.xCenter=Math.floor(this.left+t/2+e.left),this.yCenter=Math.floor(this.top+i/2+e.top),this.drawingArea=Math.floor(Math.min(t,i)/2)}determineDataLimits(){let{min:e,max:t}=this.getMinMax(!1);this.min=F(e)&&!isNaN(e)?e:0,this.max=F(t)&&!isNaN(t)?t:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/sx(this.options))}generateTickLabels(e){su.prototype.generateTickLabels.call(this,e),this._pointLabels=this.getLabels().map((e,t)=>{let i=W(this.options.pointLabels.callback,[e,t],this);return i||0===i?i:""}).filter((e,t)=>this.chart.getDataVisibility(t))}fit(){let e=this.options;e.display&&e.pointLabels.display?function(e){let t={l:e.left+e._padding.left,r:e.right-e._padding.right,t:e.top+e._padding.top,b:e.bottom-e._padding.bottom},i=Object.assign({},t),r=[],s=[],a=e._pointLabels.length,o=e.options.pointLabels,h=o.centerPointLabels?es/a:0;for(let u=0;u<a;u++){var c,d;let a=o.setContext(e.getPointLabelContext(u));s[u]=a.padding;let p=e.getPointPosition(u,e.drawingArea+s[u],h),f=tu(a.font),m=(c=e.ctx,d=z(d=e._pointLabels[u])?d:[d],{w:function(e,t,i,r){let s,a,o,h,c,d=(r=r||{}).data=r.data||{},u=r.garbageCollect=r.garbageCollect||[];r.font!==t&&(d=r.data={},u=r.garbageCollect=[],r.font=t),e.save(),e.font=t;let p=0,f=i.length;for(s=0;s<f;s++)if(null==(h=i[s])||z(h)){if(z(h))for(a=0,o=h.length;a<o;a++)null==(c=h[a])||z(c)||(p=e3(e,d,u,p,c))}else p=e3(e,d,u,p,h);e.restore();let m=u.length/2;if(m>i.length){for(s=0;s<m;s++)delete d[u[s]];u.splice(0,m)}return p}(c,f.string,d),h:d.length*f.lineHeight});r[u]=m;let g=eC(e.getIndexAngle(u)+h),v=Math.round(ex(g));!function(e,t,i,r,s){let a=Math.abs(Math.sin(i)),o=Math.abs(Math.cos(i)),h=0,c=0;
8198r.start<t.l?(h=(t.l-r.start)/a,e.l=Math.min(e.l,t.l-h)):r.end>t.r&&(h=(r.end-t.r)/a,e.r=Math.max(e.r,t.r+h)),s.start<t.t?(c=(t.t-s.start)/o,e.t=Math.min(e.t,t.t-c)):s.end>t.b&&(c=(s.end-t.b)/o,e.b=Math.max(e.b,t.b+c))}(i,t,g,sb(v,p.x,m.w,0,180),sb(v,p.y,m.h,90,270))}e.setCenterPoint(t.l-i.l,i.r-t.r,t.t-i.t,i.b-t.b),e._pointLabelItems=function(e,t,i){let r,s=[],a=e._pointLabels.length,o=e.options,{centerPointLabels:h,display:c}=o.pointLabels,d={extra:sx(o)/2,additionalAngle:h?es/a:0};for(let o=0;o<a;o++){d.padding=i[o],d.size=t[o];let a=function(e,t,i){var r,s,a,o,h,c,d;let u=e.drawingArea,{extra:p,additionalAngle:f,padding:m,size:g}=i,v=e.getPointPosition(t,u+p+m,f),y=Math.round(ex(eC(v.angle+eh))),x=(r=v.y,s=g.h,90===(a=y)||270===a?r-=s/2:(a>270||a<90)&&(r-=s),r),b=0===(o=y)||180===o?"center":o<180?"left":"right",w=(h=v.x,c=g.w,"right"===(d=b)?h-=c:"center"===d&&(h-=c/2),h);return{visible:!0,x:v.x,y:x,textAlign:b,left:w,top:x,right:w+g.w,bottom:x+g.h}}(e,o,d);s.push(a),"auto"===c&&(a.visible=function(e,t){if(!t)return!0;let{left:i,top:r,right:s,bottom:a}=e;return!(e9({x:i,y:r},t)||e9({x:i,y:a},t)||e9({x:s,y:r},t)||e9({x:s,y:a},t))}(a,r),a.visible&&(r=a))}return s}(e,r,s)}(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(e,t,i,r){this.xCenter+=Math.floor((e-t)/2),this.yCenter+=Math.floor((i-r)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(e,t,i,r))}getIndexAngle(e){return eC(e*(ea/(this._pointLabels.length||1))+ey(this.options.startAngle||0))}getDistanceFromCenterForValue(e){if(B(e))return NaN;let t=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-e)*t:(e-this.min)*t}getValueForDistanceFromCenter(e){if(B(e))return NaN;let t=e/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-t:this.min+t}getPointLabelContext(e){let t=this._pointLabels||[];if(e>=0&&e<t.length){var i;let r=t[e];return i=this.getContext(),tf(i,{label:r,index:e,type:"pointLabel"})}}getPointPosition(e,t,i=0){let r=this.getIndexAngle(e)-eh+i;return{x:Math.cos(r)*t+this.xCenter,y:Math.sin(r)*t+this.yCenter,angle:r}}getPointPositionForValue(e,t){return this.getPointPosition(e,this.getDistanceFromCenterForValue(t))}getBasePosition(e){return this.getPointPositionForValue(e||0,this.getBaseValue())}getPointLabelPosition(e){let{left:t,top:i,right:r,bottom:s}=this._pointLabelItems[e];return{left:t,top:i,right:r,bottom:s}}drawBackground(){let{backgroundColor:e,grid:{circular:t}}=this.options;if(e){let i=this.ctx;i.save(),i.beginPath(),sw(this,this.getDistanceFromCenterForValue(this._endValue),t,this._pointLabels.length),i.closePath(),i.fillStyle=e,i.fill(),i.restore()}}drawGrid(){let e,t,i,r=this.ctx,s=this.options,{angleLines:a,grid:o,border:h}=s,c=this._pointLabels.length;if(s.pointLabels.display&&function(e,t){let{ctx:i,options:{pointLabels:r}}=e;for(let s=t-1;s>=0;s--){let t=e._pointLabelItems[s];if(!t.visible)continue;let a=r.setContext(e.getPointLabelContext(s));!function(e,t,i){let{left:r,top:s,right:a,bottom:o}=i,{backdropColor:h}=t;if(!B(h)){let i=tc(t.borderRadius),c=td(t.backdropPadding);e.fillStyle=h;let d=r-c.left,u=s-c.top,p=a-r+c.width,f=o-s+c.height;Object.values(i).some(e=>0!==e)?(e.beginPath(),ts(e,{x:d,y:u,w:p,h:f,radius:i}),e.fill()):e.fillRect(d,u,p,f)}}(i,a,t);
8198let o=tu(a.font),{x:h,y:c,textAlign:d}=t;tr(i,e._pointLabels[s],h,c+o.lineHeight/2,o,{color:a.color,textAlign:d,textBaseline:"middle"})}}(this,c),o.display&&this.ticks.forEach((e,i)=>{if(0!==i||0===i&&this.min<0){t=this.getDistanceFromCenterForValue(e.value);let r=this.getContext(i),s=o.setContext(r),a=h.setContext(r);!function(e,t,i,r,s){let a=e.ctx,o=t.circular,{color:h,lineWidth:c}=t;(o||r)&&h&&c&&!(i<0)&&(a.save(),a.strokeStyle=h,a.lineWidth=c,a.setLineDash(s.dash||[]),a.lineDashOffset=s.dashOffset,a.beginPath(),sw(e,i,o,r),a.closePath(),a.stroke(),a.restore())}(this,s,t,c,a)}}),a.display){for(r.save(),e=c-1;e>=0;e--){let o=a.setContext(this.getPointLabelContext(e)),{color:h,lineWidth:c}=o;c&&h&&(r.lineWidth=c,r.strokeStyle=h,r.setLineDash(o.borderDash),r.lineDashOffset=o.borderDashOffset,t=this.getDistanceFromCenterForValue(s.reverse?this.min:this.max),i=this.getPointPosition(e,t),r.beginPath(),r.moveTo(this.xCenter,this.yCenter),r.lineTo(i.x,i.y),r.stroke())}r.restore()}}drawBorder(){}drawLabels(){let e,t,i=this.ctx,r=this.options,s=r.ticks;if(!s.display)return;let a=this.getIndexAngle(0);i.save(),i.translate(this.xCenter,this.yCenter),i.rotate(a),i.textAlign="center",i.textBaseline="middle",this.ticks.forEach((a,o)=>{if(0===o&&this.min>=0&&!r.reverse)return;let h=s.setContext(this.getContext(o)),c=tu(h.font);if(e=this.getDistanceFromCenterForValue(this.ticks[o].value),h.showLabelBackdrop){i.font=c.string,t=i.measureText(a.label).width,i.fillStyle=h.backdropColor;let r=td(h.backdropPadding);i.fillRect(-t/2-r.left,-e-c.size/2-r.top,t+r.width,c.size+r.height)}tr(i,a.label,0,-e,c,{color:h.color,strokeColor:h.textStrokeColor,strokeWidth:h.textStrokeWidth})}),i.restore()}drawTitle(){}}let sS={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},sC=Object.keys(sS);function sM(e,t){return e-t}function sE(e,t){if(B(t))return null;let i=e._adapter,{parser:r,round:s,isoWeekday:a}=e._parseOpts,o=t;return("function"==typeof r&&(o=r(o)),F(o)||(o="string"==typeof r?i.parse(o,r):i.parse(o)),null===o)?null:(s&&(o="week"===s&&(eg(a)||!0===a)?i.startOf(o,"isoWeek",a):i.startOf(o,s)),+o)}function sA(e,t,i,r){let s=sC.length;for(let a=sC.indexOf(e);a<s-1;++a){let e=sS[sC[a]],s=e.steps?e.steps:Number.MAX_SAFE_INTEGER;if(e.common&&Math.ceil((i-t)/(s*e.size))<=r)return sC[a]}return sC[s-1]}function sT(e,t,i){if(i){if(i.length){let{lo:r,hi:s}=eT(i,t);e[i[r]>=t?i[r]:i[s]]=!0}}else e[t]=!0}function sP(e,t,i){let r,s,a=[],o={},h=t.length;for(r=0;r<h;++r)o[s=t[r]]=r,a.push({value:s,major:!1});return 0!==h&&i?function(e,t,i,r){let s,a,o=e._adapter,h=+o.startOf(t[0].value,r),c=t[t.length-1].value;for(s=h;s<=c;s=+o.add(s,1,r))(a=i[s])>=0&&(t[a].major=!0);return t}(e,a,o,i):a}class sD extends i5{static id="time";static defaults={bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",callback:!1,major:{enabled:!1}}};constructor(e){super(e),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(e,t={}){let i=e.time||(e.time={}),r=this._adapter=new ib(e.adapters.date);r.init(t),Z(i.displayFormats,r.formats()),this._parseOpts={parser:i.parser,round:i.round,isoWeekday:i.isoWeekday},super.init(e),this._normalized=t.normalized}parse(e,t){return void 0===e?null:sE(this,e)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){let e=this.options,t=this._adapter,i=e.time.unit||"day",{min:r,max:s,minDefined:a,maxDefined:o}=this.getUserBounds();function h(e){a||isNaN(e.min)||(r=Math.min(r,e.min)),o||isNaN(e.max)||(s=Math.max(s,e.max))}a&&o||(h(this._getLabelBounds()),("ticks"!==e.bounds||"labels"!==e.ticks.source)&&h(this.getMinMax(!1))),r=F(r)&&!isNaN(r)?r:+t.startOf(Date.now(),i),s=F(s)&&!isNaN(s)?s:+t.endOf(Date.now(),i)+1,this.min=Math.min(r,s-1),this.max=Math.max(r+1,s)}_getLabelBounds(){let e=this.getLabelTimestamps(),t=1/0,i=-1/0;return e.length&&(t=e[0],i=e[e.length-1]),{min:t,max:i}}buildTicks(){let e=this.options,t=e.time,i=e.ticks,r="labels"===i.source?this.getLabelTimestamps():this._generate();"ticks"===e.bounds&&r.length&&(this.min=this._userMin||r[0],this.max=this._userMax||r[r.length-1]);let s=this.min,a=function(e,t,i){let r=0,s=e.length;for(;r<s&&e[r]<t;)r++;for(;s>r&&e[s-1]>i;)s--;return r>0||s<e.length?e.slice(r,s):e}(r,s,this.max);return this._unit=t.unit||(i.autoSkip?sA(t.minUnit,this.min,this.max,this._getLabelCapacity(s)):function(e,t,i,r,s){for(let a=sC.length-1;a>=sC.indexOf(i);a--){let i=sC[a];if(sS[i].common&&e._adapter.diff(s,r,i)>=t-1)return i}return sC[i?sC.indexOf(i):0]}(this,a.length,t.minUnit,this.min,this.max)),this._majorUnit=i.major.enabled&&"year"!==this._unit?function(e){for(let t=sC.indexOf(e)+1,i=sC.length;t<i;++t)if(sS[sC[t]].common)return sC[t]}(this._unit):void 0,this.initOffsets(r),e.reverse&&a.reverse(),sP(this,a,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(e=>+e.value))}initOffsets(e=[]){let t,i,r=0,s=0;this.options.offset&&e.length&&(t=this.getDecimalForValue(e[0]),r=1===e.length?1-t:(this.getDecimalForValue(e[1])-t)/2,i=this.getDecimalForValue(e[e.length-1]),s=1===e.length?
8198i:(i-this.getDecimalForValue(e[e.length-2]))/2);let a=e.length<3?.5:.25;r=eE(r,0,a),s=eE(s,0,a),this._offsets={start:r,end:s,factor:1/(r+1+s)}}_generate(){let e,t,i=this._adapter,r=this.min,s=this.max,a=this.options,o=a.time,h=o.unit||sA(o.minUnit,r,s,this._getLabelCapacity(r)),c=U(a.ticks.stepSize,1),d="week"===h&&o.isoWeekday,u=eg(d)||!0===d,p={},f=r;if(u&&(f=+i.startOf(f,"isoWeek",d)),f=+i.startOf(f,u?"day":h),i.diff(s,r,h)>1e5*c)throw Error(r+" and "+s+" are too far apart with stepSize of "+c+" "+h);let m="data"===a.ticks.source&&this.getDataTimestamps();for(e=f,t=0;e<s;e=+i.add(e,c,h),t++)sT(p,e,m);return(e===s||"ticks"===a.bounds||1===t)&&sT(p,e,m),Object.keys(p).sort(sM).map(e=>+e)}getLabelForValue(e){let t=this._adapter,i=this.options.time;return i.tooltipFormat?t.format(e,i.tooltipFormat):t.format(e,i.displayFormats.datetime)}format(e,t){let i=this.options.time.displayFormats,r=this._unit,s=t||i[r];return this._adapter.format(e,s)}_tickFormatFunction(e,t,i,r){let s=this.options,a=s.ticks.callback;if(a)return W(a,[e,t,i],this);let o=s.time.displayFormats,h=this._unit,c=this._majorUnit,d=h&&o[h],u=c&&o[c],p=i[t],f=c&&u&&p&&p.major;return this._adapter.format(e,r||(f?u:d))}generateTickLabels(e){let t,i,r;for(t=0,i=e.length;t<i;++t)(r=e[t]).label=this._tickFormatFunction(r.value,t,e)}getDecimalForValue(e){return null===e?NaN:(e-this.min)/(this.max-this.min)}getPixelForValue(e){let t=this._offsets,i=this.getDecimalForValue(e);return this.getPixelForDecimal((t.start+i)*t.factor)}getValueForPixel(e){let t=this._offsets,i=this.getDecimalForPixel(e)/t.factor-t.end;return this.min+i*(this.max-this.min)}_getLabelSize(e){let t=this.options.ticks,i=this.ctx.measureText(e).width,r=ey(this.isHorizontal()?t.maxRotation:t.minRotation),s=Math.cos(r),a=Math.sin(r),o=this._resolveTickFontOptions(0).size;return{w:i*s+o*a,h:i*a+o*s}}_getLabelCapacity(e){let t=this.options.time,i=t.displayFormats,r=i[t.unit]||i.millisecond,s=this._tickFormatFunction(e,0,sP(this,[e],this._majorUnit),r),a=this._getLabelSize(s),o=Math.floor(this.isHorizontal()?this.width/a.w:this.height/a.h)-1;return o>0?o:1}getDataTimestamps(){let e,t,i=this._cache.data||[];if(i.length)return i;let r=this.getMatchingVisibleMetas();if(this._normalized&&r.length)return this._cache.data=r[0].controller.getAllParsedValues(this);for(e=0,t=r.length;e<t;++e)i=i.concat(r[e].controller.getAllParsedValues(this));return this._cache.data=this.normalize(i)}getLabelTimestamps(){let e,t,i=this._cache.labels||[];if(i.length)return i;let r=this.getLabels();for(e=0,t=r.length;e<t;++e)i.push(sE(this,r[e]));return this._cache.labels=this._normalized?i:this.normalize(i)}normalize(e){return eI(e.sort(sM))}}function sO(e,t,i){let r,s,a,o,h=0,c=e.length-1;i?(t>=e[h].pos&&t<=e[c].pos&&({lo:h,hi:c}=eP(e,"pos",t)),{pos:r,time:a}=e[h],{pos:s,time:o}=e[c]):(t>=e[h].time&&t<=e[c].time&&({lo:h,hi:c}=eP(e,"time",t)),{time:r,pos:a}=e[h],{time:s,pos:o}=e[c]);let d=s-r;return d?a+(o-a)*(t-r)/d:a}class sL extends sD{static id="timeseries";static defaults=sD.defaults;constructor(e){super(e),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){let e=this._getTimestampsForTable(),t=this._table=this.buildLookupTable(e);this._minPos=sO(t,this.min),this._tableRange=sO(t,this.max)-this._minPos,super.initOffsets(e)}buildLookupTable(e){let t,i,r,{min:s,max:a}=this,o=[],h=[];for(t=0,i=e.length;t<i;++t)(r=e[t])>=s&&r<=a&&o.push(r);if(o.length<2)return[{time:s,pos:0},{time:a,pos:1}];for(t=0,i=o.length;t<i;++t)Math.round((o[t+1]+o[t-1])/2)!==(r=o[t])&&h.push({time:r,pos:t/(i-1)});return h}_generate(){let e=this.min,t=this.max,i=super.getDataTimestamps();return i.includes(e)&&i.length||i.splice(0,0,e),i.includes(t)&&1!==i.length||i.push(t),i.sort((e,t)=>e-t)}_getTimestampsForTable(){let e=this._cache.all||[];if(e.length)return e;let t=this.getDataTimestamps(),i=this.getLabelTimestamps();return e=t.length&&i.length?this.normalize(t.concat(i)):t.length?t:i,e=this._cache.all=e}getDecimalForValue(e){return(sO(this._table,e)-this._minPos)/this._tableRange}getValueForPixel(e){let t=this._offsets,i=this.getDecimalForPixel(e)/t.factor-t.end;return sO(this._table,i*this._tableRange+this._minPos,!0)}}var sI=Object.freeze({__proto__:null,CategoryScale:class extends i5{static id="category";static defaults={ticks:{callback:sc}};constructor(e){super(e),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(e){let t=this._addedLabels;if(t.length){let e=this.getLabels();for(let{index:i,label:r}of t)e[i]===r&&e.splice(i,1);this._addedLabels=[]}super.init(e)}parse(e,t){let i,r;if(B(e))return null;let s=this.getLabels();return i=t=isFinite(t)&&s[t]===e?t:function(e,t,i,r){let s=e.indexOf(t);if(-1===s){var a;return a=i,"string"==typeof t?(a=e.push(t)-1,r.unshift({index:a,label:t})):isNaN(t)&&(a=null),a}return s!==e.lastIndexOf(t)?i:s}(s,e,U(t,e),this._addedLabels),r=s.length-1,null===i?null:eE(Math.round(i),0,r)}determineDataLimits(){let{minDefined:e,maxDefined:t}=this.getUserBounds(),{min:i,max:r}=this.getMinMax(!0);"ticks"===this.options.bounds&&(e||(i=0),t||(r=this.getLabels().length-1)),this.min=i,this.max=r}buildTicks(){let e=this.min,t=this.max,i=this.options.offset,r=[],s=this.getLabels();s=0===e&&t===s.length-1?s:s.slice(e,t+1),this._valueRange=Math.max(s.length-!i,1),this._startValue=this.min-.5*!!i;for(let i=e;i<=t;i++)r.push({value:i});return r}getLabelForValue(e){return sc.call(this,e)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(e){return"number"!=typeof e&&(e=this.parse(e)),null===e?NaN:this.getPixelForDecimal((e-this._startValue)/this._valueRange)}getPixelForTick(e){let t=this.ticks;return e<0||e>t.length-1?null:this.getPixelForValue(t[e].value)}getValueForPixel(e){return Math.round(this._startValue+this.getDecimalForPixel(e)*this._valueRange)}getBasePixel(){return this.bottom}},LinearScale:sp,LogarithmicScale:sy,RadialLinearScale:s_,TimeScale:sD,TimeSeriesScale:sL});rb.register(iy,rN,sh,sI);var sR=e.i(131173);let sk="label";function sB(e,t){"function"==typeof e?e(t):e&&(e.current=t)}function sz(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:sk,r=[];e.datasets=t.map(t=>{let s=e.datasets.find(e=>e[i]===t[i]);return!s||!t.data||r.includes(s)?{...t}:(r.push(s),Object.assign(s,t),s)})}let sN=(0,sR.forwardRef)(function(e,t){let{height:i=150,width:r=300,redraw:s=!1,datasetIdKey:a,type:o,data:h,options:c,plugins:d=[],fallbackContent:u,updateMode:p,...f}=e,m=(0,sR.useRef)(null),g=(0,sR.useRef)(null),v=()=>
8198{m.current&&(g.current=new rb(m.current,{type:o,data:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:sk,i={labels:[],datasets:[]};return i.labels=e.labels,sz(i,e.datasets,t),i}(h,a),options:c&&{...c},plugins:d}),sB(t,g.current))},y=()=>{sB(t,null),g.current&&(g.current.destroy(),g.current=null)};return(0,sR.useEffect)(()=>{var e;let t;!s&&g.current&&c&&(e=g.current,(t=e.options)&&c&&Object.assign(t,c))},[s,c]),(0,sR.useEffect)(()=>{!s&&g.current&&(g.current.config.data.labels=h.labels)},[s,h.labels]),(0,sR.useEffect)(()=>{!s&&g.current&&h.datasets&&sz(g.current.config.data,h.datasets,a)},[s,h.datasets]),(0,sR.useEffect)(()=>{g.current&&(s?(y(),setTimeout(v)):g.current.update(p))},[s,c,h.labels,h.datasets,p]),(0,sR.useEffect)(()=>{g.current&&(y(),setTimeout(v))},[o]),(0,sR.useEffect)(()=>(v(),()=>y()),[]),sR.default.createElement("canvas",{ref:m,role:"img",height:i,width:r,...f},u)}),sF=(rb.register(iv),(0,sR.forwardRef)((e,t)=>sR.default.createElement(sN,{...e,ref:t,type:"scatter"}))),sj={point:(e,t)=>sV(e,t,{intersect:!0}),nearest:(e,t,i)=>{var r,s;let a;return a=1/0,sV(e,r=t,s=i).reduce((e,t)=>{var i;let o=t.getCenterPoint(),h="x"===(i=s.axis)?{x:r.x,y:o.y}:"y"===i?{x:o.x,y:r.y}:o,c=e_(r,h);return c<a?(e=[t],a=c):c===a&&e.push(t),e},[]).sort((e,t)=>e._index-t._index).slice(0,1)},x:(e,t,i)=>sV(e,t,{intersect:i.intersect,axis:"x"}),y:(e,t,i)=>sV(e,t,{intersect:i.intersect,axis:"y"})};function sU(e,t,i){return(sj[i.mode]||sj.nearest)(e,t,i)}function sV(e,t,i){return e.filter(e=>{var r;return i.intersect?e.inRange(t.x,t.y):"x"!==(r=i.axis)&&"y"!==r?e.inRange(t.x,t.y,"x",!0)||e.inRange(t.x,t.y,"y",!0):e.inRange(t.x,t.y,r,!0)})}function sW(e,t,i){let r=Math.cos(i),s=Math.sin(i),a=t.x,o=t.y;return{x:a+r*(e.x-a)-s*(e.y-o),y:o+s*(e.x-a)+r*(e.y-o)}}let sH=(e,t)=>t>e||e.length>t.length&&e.slice(0,t.length)===t,sG=(e,t,i)=>Math.min(i,Math.max(t,e)),sq=(e,t)=>e.value>=e.start-t&&e.value<=e.end+t;function sX(e,{x:t,y:i,x2:r,y2:s},a,{borderWidth:o,hitTolerance:h}){let c=(o+h)/2,d=e.x>=t-c-.001&&e.x<=r+c+.001,u=e.y>=i-c-.001&&e.y<=s+c+.001;return"x"===a?d:"y"===a?u:d&&u}function sY(e,{rect:t,center:i},r,{rotation:s,borderWidth:a,hitTolerance:o}){return sX(sW(e,i,ey(-s)),t,r,{borderWidth:a,hitTolerance:o})}function sQ(e,t){let{centerX:i,centerY:r}=e.getProps(["centerX","centerY"],t);return{x:i,y:r}}let sZ=e=>"string"==typeof e&&e.endsWith("%"),sK=e=>sG(parseFloat(e)/100,0,1),sJ=(e,t)=>({x:e,y:t,x2:e,y2:t,width:0,height:0}),s$={box:e=>sJ(e.centerX,e.centerY),doughnutLabel:e=>sJ(e.centerX,e.centerY),ellipse:e=>({centerX:e.centerX,centerY:e.centerX,radius:0,width:0,height:0}),label:e=>sJ(e.centerX,e.centerY),line:e=>sJ(e.x,e.y),point:e=>({centerX:e.centerX,centerY:e.centerY,radius:0,width:0,height:0}),polygon:e=>sJ(e.centerX,e.centerY)};function s0(e,t){return"start"===t?0:"end"===t?e:sZ(t)?sK(t)*e:e/2}function s1(e,t,i=!0){return"number"==typeof t?t:sZ(t)?(i?sK(t):parseFloat(t)/100)*e:e}function s2(e,t,{borderWidth:i,position:r,xAdjust:s,yAdjust:a},o){let h=N(o),c=t.width+(h?o.width:0)+i,d=t.height+(h?o.height:0)+i,u=s3(r),p=s8(e.x,c,s,u.x),f=s8(e.y,d,a,u.y);return{x:p,y:f,x2:p+c,y2:f+d,width:c,height:d,centerX:p+c/2,centerY:f+d/2}}function s3(e,t="center"){return N(e)?{x:U(e.x,t),y:U(e.y,t)}:{x:e=U(e,t),y:e}}let s4=(e,t)=>e&&e.autoFit&&t<1;function s5(e,t){let i=e.font,r=z(i)?i:[i];return s4(e,t)?r.map(function(e){let i=tu(e);return i.size=Math.floor(e.size*t),i.lineHeight=e.lineHeight,tu(i)}):r.map(e=>tu(e))}function s6(e){return e&&(et(e.xValue)||et(e.yValue))}function s8(e,t,i=0,r){return e-s0(t,r)+i}function s9(e,t,i){var r,s,a;let o,h=i.init;return h?!0===h?ae(t,i):(r=e,s=t,!0===(o=W((a=i).init,[{chart:r,properties:s,options:a}]))?ae(s,a):N(o)?o:void 0):void 0}function s7(e,t,i){let r=!1;return t.forEach(t=>{ei(e[t])?(r=!0,i[t]=e[t]):et(i[t])&&delete i[t]}),r}function ae(e,t){return s$[t.type||"line"](e)}let at=new Map;function ai(e){if(e&&"object"==typeof e){let t=e.toString();return"[object HTMLImageElement]"===t||"[object HTMLCanvasElement]"===t}}function ar(e,{x:t,y:i},r){r&&(e.translate(t,i),e.rotate(ey(r)),e.translate(-t,-i))}function as(e,t){if(t&&t.borderWidth)return e.lineCap=t.borderCapStyle||"butt",e.setLineDash(t.borderDash),e.lineDashOffset=t.borderDashOffset,e.lineJoin=t.borderJoinStyle||"miter",e.lineWidth=t.borderWidth,e.strokeStyle=t.borderColor,!0}function aa(e,t){e.shadowColor=t.backgroundShadowColor,e.shadowBlur=t.shadowBlur,e.shadowOffsetX=t.shadowOffsetX,e.shadowOffsetY=t.shadowOffsetY}function an(e,t){let i=t.content;if(ai(i))return{width:s1(i.width,t.width),height:s1(i.height,t.height)};let r=s5(t),s=t.textStrokeWidth,a=z(i)?i:[i],o=a.join()+r.reduce(function(e,t){return e+t.string},"")+s+(e._measureText?"-spriting":"");return at.has(o)||at.set(o,function(e,t,i,r){e.save();let s=t.length,a=0,o=r;for(let h=0;h<s;h++){let s=i[Math.min(h,i.length-1)];e.font=s.string;
8198let c=t[h];a=Math.max(a,e.measureText(c).width+r),o+=s.lineHeight}return e.restore(),{width:a,height:o}}(e,a,r,s)),at.get(o)}function ao(e,t,i){let{x:r,y:s,width:a,height:o}=t;e.save(),aa(e,i);let h=as(e,i);e.fillStyle=i.backgroundColor,e.beginPath(),ts(e,{x:r,y:s,w:a,h:o,radius:function(e,t){for(let i of Object.keys(e))e[i]=sG(e[i],0,t);return e}(tc(i.borderRadius),Math.min(a,o)/2)}),e.closePath(),e.fill(),h&&(e.shadowColor=i.borderShadowColor,e.stroke()),e.restore()}function al(e,t,i,r){let s=i.content;if(ai(s)){var a,o;let r;e.save(),a=i.opacity,o=s.style.opacity,r=eg(a)?a:o,e.globalAlpha=eg(r)?sG(r,0,1):1,e.drawImage(s,t.x,t.y,t.width,t.height),e.restore();return}let h=z(s)?s:[s],c=s5(i,r),d=i.color,u=z(d)?d:[d],p=function(e,t){let{x:i,width:r}=e,s=t.textAlign;return"center"===s?i+r/2:"end"===s||"right"===s?i+r:i}(t,i),f=t.y+i.textStrokeWidth/2;e.save(),e.textBaseline="middle",e.textAlign=i.textAlign,function(e,t){if(t.textStrokeWidth>0)return e.lineJoin="round",e.miterLimit=2,e.lineWidth=t.textStrokeWidth,e.strokeStyle=t.textStrokeColor,!0}(e,i)&&function(e,{x:t,y:i},r,s){e.beginPath();let a=0;r.forEach(function(r,o){let h=s[Math.min(o,s.length-1)],c=h.lineHeight;e.font=h.string,e.strokeText(r,t,i+c/2+a),a+=c}),e.stroke()}(e,{x:p,y:f},h,c),function(e,{x:t,y:i},r,{fonts:s,colors:a}){let o=0;r.forEach(function(r,h){let c=a[Math.min(h,a.length-1)],d=s[Math.min(h,s.length-1)],u=d.lineHeight;e.beginPath(),e.font=d.string,e.fillStyle=c,e.fillText(r,t,i+u/2+o),o+=u,e.fill()})}(e,{x:p,y:f},h,{fonts:c,colors:u}),e.restore()}let ah=["left","bottom","top","right"],ac={xScaleID:{min:"xMin",max:"xMax",start:"left",end:"right",startProp:"x",endProp:"x2"},yScaleID:{min:"yMin",max:"yMax",start:"bottom",end:"top",startProp:"y",endProp:"y2"}};function ad(e,t,i){return F(t="number"==typeof t?t:e.parse(t))?e.getPixelForValue(t):i}function au(e,t,i){let r=t[i];if(r||"scaleID"===i)return r;let s=i.charAt(0),a=Object.values(e).filter(e=>e.axis&&e.axis===s);return a.length?a[0].id:s}function ap(e,t){if(e){let i=e.options.reverse;return{start:ad(e,t.min,i?t.end:t.start),end:ad(e,t.max,i?t.start:t.end)}}}function af(e,t){let{chartArea:i,scales:r}=e,s=r[au(r,t,"xScaleID")],a=r[au(r,t,"yScaleID")],o=i.width/2,h=i.height/2;return s&&(o=ad(s,t.xValue,s.left+s.width/2)),a&&(h=ad(a,t.yValue,a.top+a.height/2)),{x:o,y:h}}function am(e,t){let i=e.scales,r=i[au(i,t,"xScaleID")],s=i[au(i,t,"yScaleID")];if(!r&&!s)return{};let{left:a,right:o}=r||e.chartArea,{top:h,bottom:c}=s||e.chartArea,d=ay(r,{min:t.xMin,max:t.xMax,start:a,end:o});a=d.start,o=d.end;let u=ay(s,{min:t.yMin,max:t.yMax,start:c,end:h});return{x:a,y:h=u.start,x2:o,y2:c=u.end,width:o-a,height:c-h,centerX:a+(o-a)/2,centerY:h+(c-h)/2}}function ag(e,t){var i;let r,s;if(!s6(t)){let i=am(e,t),r=t.radius;(!r||isNaN(r))&&(t.radius=r=Math.min(i.width,i.height)/2);let s=2*r,a=i.centerX+t.xAdjust,o=i.centerY+t.yAdjust;return{x:a-r,y:o-r,x2:a+r,y2:o+r,centerX:a,centerY:o,width:s,height:s,radius:r}}return r=af(e,i=t),s=2*i.radius,{x:r.x-i.radius+i.xAdjust,y:r.y-i.radius+i.yAdjust,x2:r.x+i.radius+i.xAdjust,y2:r.y+i.radius+i.yAdjust,centerX:r.x+i.xAdjust,centerY:r.y+i.yAdjust,radius:i.radius,width:s,height:s}}function av(e,t){var i,r,s;let a,o,h,c,d,u,p,f,m=am(e,t);return m.initProperties=s9(e,m,t),m.elements=[{type:"label",optionScope:"label",properties:(i=e,r=m,(a=(s=t).label).backgroundColor="transparent",a.callout.display=!1,o=s3(a.position),h=td(a.padding),d=function({properties:e,options:t},i,r,s){let{x:a,x2:o,width:h}=e;return ax({start:a,end:o,size:h,borderWidth:t.borderWidth},{position:r.x,padding:{start:s.left,end:s.right},adjust:t.label.xAdjust,size:i.width})}({properties:r,options:s},c=an(i.ctx,a),o,h),u=function({properties:e,options:t},i,r,s){let{y:a,y2:o,height:h}=e;return ax({start:a,end:o,size:h,borderWidth:t.borderWidth},{position:r.y,padding:{start:s.top,end:s.bottom},adjust:t.label.yAdjust,size:i.height})}({properties:r,options:s},c,o,h),p=c.width+h.width,{x:d,y:u,x2:d+p,y2:u+(f=c.height+h.height),width:p,height:f,centerX:d+p/2,centerY:u+f/2,rotation:a.rotation}),initProperties:m.initProperties}],m}function ay(e,t){let i=ap(e,t)||t;return{start:Math.min(i.start,i.end),end:Math.max(i.start,i.end)}}function ax(e,t){let{start:i,end:r,borderWidth:s}=e,{position:a,padding:{start:o,end:h},adjust:c}=t,d=r-s-i-o-h-t.size;return i+s/2+c+s0(d,a)}let ab=["enter","leave"],aw=ab.concat("click");function a_({state:e,event:t},i,r,s){let a;for(let o of r)0>s.indexOf(o)&&(a=aS(o.options[i]||e.listeners[i],o,t)||a);return a}function aS(e,t,i){return!0===W(e,[t.$context,i])}let aC=["afterDraw","beforeDraw"];function aM(e,t,i){if(e.hooked)return W(t.options[i]||e.hooks[i],[t.$context])}function aE(e,t,i,r){var s,a,o;if(F(t[i])&&(s=e.options,a=i,o=r,!(et(s[a])||et(s[o])))){let r=e[i]!==t[i];return e[i]=t[i],r}}function aA(e,t,i,r){for(let s of i){let i=e[s];if(et(i)){let e=t.parse(i);r.min=Math.min(r.min,e),r.max=Math.max(r.max,e)}}}class aT extends iJ{inRange(e,t,i,r){let{x:s,y:a}=sW({x:e,y:t},this.getCenterPoint(r),ey(-this.options.rotation));return sX({x:s,y:a},this.getProps(["x","y","x2","y2"],r),i,this.options)}getCenterPoint(e){return sQ(this,e)}draw(e){e.save(),ar(e,this.getCenterPoint(),this.options.rotation),ao(e,this,this.options),e.restore(
8198)}get label(){return this.elements&&this.elements[0]}resolveElementProperties(e,t){return av(e,t)}}aT.id="boxAnnotation",aT.defaults={adjustScaleRange:!0,backgroundShadowColor:"transparent",borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderRadius:0,borderShadowColor:"transparent",borderWidth:1,display:!0,init:void 0,hitTolerance:0,label:{backgroundColor:"transparent",borderWidth:0,callout:{display:!1},color:"black",content:null,display:!1,drawTime:void 0,font:{family:void 0,lineHeight:void 0,size:void 0,style:void 0,weight:"bold"},height:void 0,hitTolerance:void 0,opacity:void 0,padding:6,position:"center",rotation:void 0,textAlign:"start",textStrokeColor:void 0,textStrokeWidth:0,width:void 0,xAdjust:0,yAdjust:0,z:void 0},rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,xMax:void 0,xMin:void 0,xScaleID:void 0,yMax:void 0,yMin:void 0,yScaleID:void 0,z:0},aT.defaultRoutes={borderColor:"color",backgroundColor:"color"},aT.descriptors={label:{_fallback:!0}};class aP extends iJ{inRange(e,t,i,r){return sY({x:e,y:t},{rect:this.getProps(["x","y","x2","y2"],r),center:this.getCenterPoint(r)},i,{rotation:this.rotation,borderWidth:0,hitTolerance:this.options.hitTolerance})}getCenterPoint(e){return sQ(this,e)}draw(e){let t=this.options;t.display&&t.content&&(function(e,t){let{_centerX:i,_centerY:r,_radius:s,_startAngle:a,_endAngle:o,_counterclockwise:h,options:c}=t;e.save();let d=as(e,c);e.fillStyle=c.backgroundColor,e.beginPath(),e.arc(i,r,s,a,o,h),e.closePath(),e.fill(),d&&e.stroke(),e.restore()}(e,this),e.save(),ar(e,this.getCenterPoint(),this.rotation),al(e,this,t,this._fitRatio),e.restore())}resolveElementProperties(e,t){var i,r;let s=(i=e,r=t,i.getSortedVisibleDatasetMetas().reduce(function(e,t){let s=t.controller;return s instanceof im&&function(e,t,i){if(!t.autoHide)return!0;for(let t=0;t<i.length;t++)if(!i[t].hidden&&e.getDataVisibility(t))return!0}(i,r,t.data)&&(!e||s.innerRadius<e.controller.innerRadius)&&s.options.circumference>=90?t:e},void 0));if(!s)return{};let{controllerMeta:a,point:o,radius:h}=function({chartArea:e},t,i){let{left:r,top:s,right:a,bottom:o}=e,{innerRadius:h,offsetX:c,offsetY:d}=i.controller,u=(r+a)/2+c,p=(s+o)/2+d,f={left:Math.max(u-h,r),right:Math.min(u+h,a),top:Math.max(p-h,s),bottom:Math.min(p+h,o)},m={x:(f.left+f.right)/2,y:(f.top+f.bottom)/2},g=t.spacing+t.borderWidth/2,v=h-g,y=m.y>p,x=function(e,t,i,r){let s=-2*t,a=Math.pow(s,2)-4*(Math.pow(t,2)+Math.pow(i-e,2)-Math.pow(r,2));if(a<=0)return{_startAngle:0,_endAngle:ea};let o=(-s-Math.sqrt(a))/2,h=(-s+Math.sqrt(a))/2;return{_startAngle:ew({x:t,y:i},{x:o,y:e}).angle,_endAngle:ew({x:t,y:i},{x:h,y:e}).angle}}(y?s+g:o-g,u,p,v);return{controllerMeta:{_centerX:u,_centerY:p,_radius:v,_counterclockwise:y,...x},point:m,radius:Math.min(h,Math.min(f.right-f.left,f.bottom-f.top)/2)}}(e,t,s),c=an(e.ctx,t),d=function({width:e,height:t},i){return 2*i/Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}(c,h);s4(t,d)&&(c={width:c.width*d,height:c.height*d});let{position:u,xAdjust:p,yAdjust:f}=t,m=s2(o,c,{borderWidth:0,position:u,xAdjust:p,yAdjust:f});return{initProperties:s9(e,m,t),...m,...a,rotation:t.rotation,_fitRatio:d}}}aP.id="doughnutLabelAnnotation",aP.defaults={autoFit:!0,autoHide:!0,backgroundColor:"transparent",backgroundShadowColor:"transparent",borderColor:"transparent",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderShadowColor:"transparent",borderWidth:0,color:"black",content:null,display:!0,font:{family:void 0,lineHeight:void 0,size:void 0,style:void 0,weight:void 0},height:void 0,hitTolerance:0,init:void 0,opacity:void 0,position:"center",rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,spacing:1,textAlign:"center",textStrokeColor:void 0,textStrokeWidth:0,width:void 0,xAdjust:0,yAdjust:0},aP.defaultRoutes={};class aD extends iJ{inRange(e,t,i,r){return sY({x:e,y:t},{rect:this.getProps(["x","y","x2","y2"],r),center:this.getCenterPoint(r)},i,{rotation:this.rotation,borderWidth:this.options.borderWidth,hitTolerance:this.options.hitTolerance})}getCenterPoint(e){return sQ(this,e)}draw(e){let t=this.options,i=!et(this._visible)||this._visible;t.display&&t.content&&i&&(e.save(),ar(e,this.getCenterPoint(),this.rotation),function(e,t){var i,r;let s,{pointX:a,pointY:o,options:h}=t,c=h.callout,d=c&&c.display&&(i=t,s=(r=c).position,ah.includes(s)?s:function(e,t){let{x:i,y:r,x2:s,y2:a,width:o,height:h,pointX:c,pointY:d,centerX:u,centerY:p,rotation:f}=e,m={x:u,y:p},g=t.start,v=s1(o,g),y=s1(h,g),x=[i,i+v,i+v,s],b=[r+y,a,r,a],w=[];for(let e=0;e<4;e++){let t=sW({x:x[e],y:b[e]},m,ey(f));w.push({position:ah[e],distance:e_(t,{x:c,y:d})})}return w.sort((e,t)=>
8198e.distance-t.distance)[0].position}(i,r));if(!d||function(e,t,i){let{pointX:r,pointY:s}=e,a=t.margin,o=r,h=s;return"left"===i?o+=a:"right"===i?o-=a:"top"===i?h+=a:"bottom"===i&&(h-=a),e.inRange(o,h)}(t,c,d))return;if(e.save(),e.beginPath(),!as(e,c))return e.restore();let{separatorStart:u,separatorEnd:p}=function(e,t){let i,r,{x:s,y:a,x2:o,y2:h}=e,c=function(e,t){let{width:i,height:r,options:s}=e,a=s.callout.margin+s.borderWidth/2;return"right"===t?i+a:"bottom"===t?r+a:-a}(e,t);return r="left"===t||"right"===t?{x:(i={x:s+c,y:a}).x,y:h}:{x:o,y:(i={x:s,y:a+c}).y},{separatorStart:i,separatorEnd:r}}(t,d),{sideStart:f,sideEnd:m}=function(e,t,i){var r;let s,a,o,{y:h,width:c,height:d,options:u}=e,p=u.callout.start,f=(r=t,s=u.callout.side,"left"===r||"top"===r?-s:s);return o="left"===t||"right"===t?{x:(a={x:i.x,y:h+s1(d,p)}).x+f,y:a.y}:{x:(a={x:i.x+s1(c,p),y:i.y}).x,y:a.y+f},{sideStart:a,sideEnd:o}}(t,d,u);(c.margin>0||0===h.borderWidth)&&(e.moveTo(u.x,u.y),e.lineTo(p.x,p.y)),e.moveTo(f.x,f.y),e.lineTo(m.x,m.y);let g=sW({x:a,y:o},t.getCenterPoint(),ey(-t.rotation));e.lineTo(g.x,g.y),e.stroke(),e.restore()}(e,this),ao(e,this,t),al(e,function({x:e,y:t,width:i,height:r,options:s}){let a=s.borderWidth/2,o=td(s.padding);return{x:e+o.left+a,y:t+o.top+a,width:i-o.left-o.right-s.borderWidth,height:r-o.top-o.bottom-s.borderWidth}}(this),t),e.restore())}resolveElementProperties(e,t){let i;if(s6(t))i=af(e,t);else{let{centerX:r,centerY:s}=am(e,t);i={x:r,y:s}}let r=td(t.padding),s=s2(i,an(e.ctx,t),t,r);return{initProperties:s9(e,s,t),pointX:i.x,pointY:i.y,...s,rotation:t.rotation}}}aD.id="labelAnnotation",aD.defaults={adjustScaleRange:!0,backgroundColor:"transparent",backgroundShadowColor:"transparent",borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderRadius:0,borderShadowColor:"transparent",borderWidth:0,callout:{borderCapStyle:"butt",borderColor:void 0,borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:1,display:!1,margin:5,position:"auto",side:5,start:"50%"},color:"black",content:null,display:!0,font:{family:void 0,lineHeight:void 0,size:void 0,style:void 0,weight:void 0},height:void 0,hitTolerance:0,init:void 0,opacity:void 0,padding:6,position:"center",rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,textAlign:"center",textStrokeColor:void 0,textStrokeWidth:0,width:void 0,xAdjust:0,xMax:void 0,xMin:void 0,xScaleID:void 0,xValue:void 0,yAdjust:0,yMax:void 0,yMin:void 0,yScaleID:void 0,yValue:void 0,z:0},aD.defaultRoutes={borderColor:"color"};let aO=(e,t,i)=>({x:e.x+i*(t.x-e.x),y:e.y+i*(t.y-e.y)}),aL=(e,t,i)=>aO(t,i,Math.abs((e-t.y)/(i.y-t.y))).x,aI=(e,t,i)=>aO(t,i,Math.abs((e-t.x)/(i.x-t.x))).y,aR=(e,t,i,r)=>(1-r)*(1-r)*e+2*(1-r)*r*t+r*r*i,ak=(e,t,i,r)=>({x:aR(e.x,t.x,i.x,r),y:aR(e.y,t.y,i.y,r)}),aB=(e,t,i,r)=>2*(1-r)*(t-e)+2*r*(i-t),az=(e,t,i,r)=>-Math.atan2(aB(e.x,t.x,i.x,r),aB(e.y,t.y,i.y,r))+.5*es;class aN extends iJ{inRange(e,t,i,r){let s=(this.options.borderWidth+this.options.hitTolerance)/2;if("x"!==i&&"y"!==i){let i={mouseX:e,mouseY:t},{path:a,ctx:o}=this;if(a){as(o,this.options),o.lineWidth+=this.options.hitTolerance;let{chart:s}=this.$context,h=e*s.currentDevicePixelRatio,c=t*s.currentDevicePixelRatio,d=o.isPointInStroke(a,h,c)||aU(this,i,r);
8198return o.restore(),d}return function(e,{mouseX:t,mouseY:i},r=.001,s){let a,o,h,c,{x:d,y:u,x2:p,y2:f}=e.getProps(["x","y","x2","y2"],s),m=p-d,g=f-u,v=m*m+g*g,y=0===v?-1:((t-d)*m+(i-u)*g)/v;return y<0?(a=d,o=u):y>1?(a=p,o=f):(a=d+y*m,o=u+y*g),(h=t-a)*h+(c=i-o)*c<=r}(this,i,s*s,r)||aU(this,i,r)}return function(e,{mouseX:t,mouseY:i},r,{hitSize:s,useFinalPosition:a}){return sq(((e,t,{x:i,y:r,x2:s,y2:a},o)=>"y"===o?{start:Math.min(r,a),end:Math.max(r,a),value:t}:{start:Math.min(i,s),end:Math.max(i,s),value:e})(t,i,e.getProps(["x","y","x2","y2"],a),r),s)||aU(e,{mouseX:t,mouseY:i},a,r)}(this,{mouseX:e,mouseY:t},i,{hitSize:s,useFinalPosition:r})}getCenterPoint(e){return sQ(this,e)}draw(e){let{x:t,y:i,x2:r,y2:s,cp:a,options:o}=this;if(e.save(),!as(e,o))return e.restore();aa(e,o);let h=Math.sqrt(Math.pow(r-t,2)+Math.pow(s-i,2));if(o.curve&&a)return function(e,t,i,r){let{x:s,y:a,x2:o,y2:h,options:c}=t,{startOpts:d,endOpts:u,startAdjust:p,endAdjust:f}=aH(t),m={x:s,y:a},g={x:o,y:h},v=az(m,i,g,0),y=az(m,i,g,1)-es,x=ak(m,i,g,p/r),b=ak(m,i,g,1-f/r),w=new Path2D;e.beginPath(),w.moveTo(x.x,x.y),w.quadraticCurveTo(i.x,i.y,b.x,b.y),e.shadowColor=c.borderShadowColor,e.stroke(w),t.path=w,t.ctx=e,aX(e,x,{angle:v,adjust:p},d),aX(e,b,{angle:y,adjust:f},u)}(e,this,a,h),e.restore();let{startOpts:c,endOpts:d,startAdjust:u,endAdjust:p}=aH(this),f=Math.atan2(s-i,r-t);e.translate(t,i),e.rotate(f),e.beginPath(),e.moveTo(0+u,0),e.lineTo(h-p,0),e.shadowColor=o.borderShadowColor,e.stroke(),aq(e,0,u,c),aq(e,h,-p,d),e.restore()}get label(){return this.elements&&this.elements[0]}resolveElementProperties(e,t){var i,r,s;let a,o,h,c=function(e,t){var i,r,s;let a,o,{scales:h,chartArea:c}=e,d=h[t.scaleID],u={x:c.left,y:c.top,x2:c.right,y2:c.bottom};return d?(i=d,r=u,a=ad(i,(s=t).value,NaN),o=ad(i,s.endValue,a),i.isHorizontal()?(r.x=a,r.x2=o):(r.y=a,r.y2=o)):function(e,t,i){for(let r of Object.keys(ac)){let s=e[au(e,i,r)];if(s){let{min:e,max:a,start:o,end:h,startProp:c,endProp:d}=ac[r],u=ap(s,{min:i[e],max:i[a],start:s[o],end:s[h]});t[c]=u.start,t[d]=u.end}}}(h,u,t),u}(e,t),{x:d,y:u,x2:p,y2:f}=c,m=function({x:e,y:t,x2:i,y2:r},{top:s,right:a,bottom:o,left:h}){return!(e<h&&i<h||e>a&&i>a||t<s&&r<s||t>o&&r>o)}(c,e.chartArea),g=m?function(e,t,i){let{x:r,y:s}=aj(e,t,i),{x:a,y:o}=aj(t,e,i);return{x:r,y:s,x2:a,y2:o,width:Math.abs(a-r),height:Math.abs(o-s)}}({x:d,y:u},{x:p,y:f},e.chartArea):{x:d,y:u,x2:p,y2:f,width:Math.abs(p-d),height:Math.abs(f-u)};if(g.centerX=(p+d)/2,g.centerY=(f+u)/2,g.initProperties=s9(e,g,t),t.curve){let e={x:g.x,y:g.y},i={x:g.x2,y:g.y2};g.cp=function(e,t,i){let{x:r,y:s,x2:a,y2:o,centerX:h,centerY:c}=e,d=Math.atan2(o-s,a-r),u=s3(t.controlPoint,0);return sW({x:h+s1(i,u.x,!1),y:c+s1(i,u.y,!1)},{x:h,y:c},d)}(g,t,e_(e,i))}let v=(i=e,r=g,a=(s=t.label).borderWidth,o=td(s.padding),h=an(i.ctx,s),function(e,t,i,r){var s,a,o,h,c,d;let u,p,f,{width:m,height:g,padding:v}=i,{xAdjust:y,yAdjust:x}=t,b={x:e.x,y:e.y},w={x:e.x2,y:e.y2},_="auto"===t.rotation?function(e){let{x:t,y:i,x2:r,y2:s}=e,a=Math.atan2(s-i,r-t);return a>es/2?a-es:a<-(es/2)?a+es:a}(e):ey(t.rotation),S=(s=m,a=g,u=Math.cos(o=_),{w:Math.abs(s*u)+Math.abs(a*(p=Math.sin(o))),h:Math.abs(s*p)+Math.abs(a*u)}),C=(h=e,c=t,d={labelSize:S,padding:v},f=function(e,t){let{x:i,x2:r,y:s,y2:a}=e,o=Math.min(s,a)-t.top,h=Math.min(i,r)-t.left,c=t.bottom-Math.max(s,a),d=t.right-Math.max(i,r);return{x:Math.min(h,d),y:Math.min(o,c),dx:h<=d?1:-1,dy:o<=c?1:-1}}(h,r),"start"===c.position?aV({w:h.x2-h.x,h:h.y2-h.y},d,c,f):"end"===c.position?1-aV({w:h.x-h.x2,h:h.y-h.y2},d,c,f):s0(1,c.position)),M=e.cp?ak(b,e.cp,w,C):aO(b,w,C),E={size:S.w,min:r.left,max:r.right,padding:v.left},A={size:S.h,min:r.top,max:r.bottom,padding:v.top},T=aW(M.x,E)+y,P=aW(M.y,A)+x;return{x:T-m/2,y:P-g/2,x2:T+m/2,y2:P+g/2,centerX:T,centerY:P,pointX:M.x,pointY:M.y,width:m,height:g,rotation:ex(_)}}(r,s,{width:h.width+o.width+a,height:h.height+o.height+a,padding:o},i.chartArea));return v._visible=m,g.elements=[{type:"label",optionScope:"label",properties:v,initProperties:g.initProperties}],g}}aN.id="lineAnnotation";let aF={backgroundColor:void 0,backgroundShadowColor:void 0,borderColor:void 0,borderDash:void 0,borderDashOffset:void 0,borderShadowColor:void 0,borderWidth:void 0,display:void 0,fill:void 0,length:void 0,shadowBlur:void 0,shadowOffsetX:void 0,shadowOffsetY:void 0,width:void 0};function aj({x:e,y:t}
8198,i,{top:r,right:s,bottom:a,left:o}){return e<o&&(t=aI(o,{x:e,y:t},i),e=o),e>s&&(t=aI(s,{x:e,y:t},i),e=s),t<r&&(e=aL(r,{x:e,y:t},i),t=r),t>a&&(e=aL(a,{x:e,y:t},i),t=a),{x:e,y:t}}function aU(e,{mouseX:t,mouseY:i},r,s){let a=e.label;return a.options.display&&a.inRange(t,i,s,r)}function aV(e,t,i,r){let{labelSize:s,padding:a}=t,o=e.w*r.dx,h=e.h*r.dy;return sG(Math.max(o>0&&(s.w/2+a.left-r.x)/o,h>0&&(s.h/2+a.top-r.y)/h),0,.25)}function aW(e,t){let{size:i,min:r,max:s,padding:a}=t,o=i/2;return i>s-r?(s+r)/2:(r>=e-a-o&&(e=r+a+o),s<=e+a+o&&(e=s-a-o),e)}function aH(e){let t=e.options,i=t.arrowHeads&&t.arrowHeads.start,r=t.arrowHeads&&t.arrowHeads.end;return{startOpts:i,endOpts:r,startAdjust:aG(e,i),endAdjust:aG(e,r)}}function aG(e,t){if(!t||!t.display)return 0;let{length:i,width:r}=t,s=e.options.borderWidth/2;return Math.abs(aL(0,{x:i,y:r+s},{x:0,y:s}))}function aq(e,t,i,r){if(!r||!r.display)return;let{length:s,width:a,fill:o,backgroundColor:h,borderColor:c}=r,d=Math.abs(t-s)+i;e.beginPath(),aa(e,r),as(e,r),e.moveTo(d,-a),e.lineTo(t+i,0),e.lineTo(d,a),!0===o?(e.fillStyle=h||c,e.closePath(),e.fill(),e.shadowColor="transparent"):e.shadowColor=r.borderShadowColor,e.stroke()}function aX(e,{x:t,y:i},{angle:r,adjust:s},a){a&&a.display&&(e.save(),e.translate(t,i),e.rotate(r),aq(e,0,-s,a),e.restore())}aN.defaults={adjustScaleRange:!0,arrowHeads:{display:!1,end:Object.assign({},aF),fill:!1,length:12,start:Object.assign({},aF),width:6},borderDash:[],borderDashOffset:0,borderShadowColor:"transparent",borderWidth:2,curve:!1,controlPoint:{y:"-50%"},display:!0,endValue:void 0,init:void 0,hitTolerance:0,label:{backgroundColor:"rgba(0,0,0,0.8)",backgroundShadowColor:"transparent",borderCapStyle:"butt",borderColor:"black",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderRadius:6,borderShadowColor:"transparent",borderWidth:0,callout:Object.assign({},aD.defaults.callout),color:"#fff",content:null,display:!1,drawTime:void 0,font:{family:void 0,lineHeight:void 0,size:void 0,style:void 0,weight:"bold"},height:void 0,hitTolerance:void 0,opacity:void 0,padding:6,position:"center",rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,textAlign:"center",textStrokeColor:void 0,textStrokeWidth:0,width:void 0,xAdjust:0,yAdjust:0,z:void 0},scaleID:void 0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,value:void 0,xMax:void 0,xMin:void 0,xScaleID:void 0,yMax:void 0,yMin:void 0,yScaleID:void 0,z:0},aN.descriptors={arrowHeads:{start:{_fallback:!0},end:{_fallback:!0},_fallback:!0}},aN.defaultRoutes={borderColor:"color"};class aY extends iJ{inRange(e,t,i,r){let s=this.options.rotation,a=(this.options.borderWidth+this.options.hitTolerance)/2;if("x"!==i&&"y"!==i)return function(e,t,i,r){let{width:s,height:a,centerX:o,centerY:h}=t,c=s/2,d=a/2;if(c<=0||d<=0)return!1;let u=ey(i||0),p=Math.cos(u),f=Math.sin(u);return Math.pow(p*(e.x-o)+f*(e.y-h),2)/Math.pow(c+r,2)+Math.pow(f*(e.x-o)-p*(e.y-h),2)/Math.pow(d+r,2)<=1.0001}({x:e,y:t},this.getProps(["width","height","centerX","centerY"],r),s,a);let{x:o,y:h,x2:c,y2:d}=this.getProps(["x","y","x2","y2"],r),u="y"===i?{start:h,end:d}:{start:o,end:c},p=sW({x:e,y:t},this.getCenterPoint(r),ey(-s));return p[i]>=u.start-a-.001&&p[i]<=u.end+a+.001}getCenterPoint(e){return sQ(this,e)}draw(e){let{width:t,height:i,centerX:r,centerY:s,options:a}=this;e.save(),ar(e,this.getCenterPoint(),a.rotation),aa(e,this.options),e.beginPath(),e.fillStyle=a.backgroundColor;let o=as(e,a);e.ellipse(r,s,i/2,t/2,es/2,0,2*es),e.fill(),o&&(e.shadowColor=a.borderShadowColor,e.stroke()),e.restore()}get label(){return this.elements&&this.elements[0]}resolveElementProperties(e,t){return av(e,t)}}aY.id="ellipseAnnotation",aY.defaults={adjustScaleRange:!0,backgroundShadowColor:"transparent",borderDash:[],borderDashOffset:0,borderShadowColor:"transparent",borderWidth:1,display:!0,hitTolerance:0,init:void 0,label:Object.assign({},aT.defaults.label),rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,xMax:void 0,xMin:void 0,xScaleID:void 0,yMax:void 0,yMin:void 0,yScaleID:void 0,z:0},aY.defaultRoutes={borderColor:"color",backgroundColor:"color"},aY.descriptors={label:{_fallback:!0}};class aQ extends iJ{inRange(e,t,i,r){let{x:s,y:a,x2:o,y2:h,width:c}=this.getProps(["x","y","x2","y2","width"],r),d=(this.options.borderWidth+this.options.hitTolerance)/2;if("x"!==i&&"y"!==i){var u,p,f;return u={x:e,y:t},p=this.getCenterPoint(r),f=c/2,!!u&&!!p&&!(f<=0)&&Math.pow(u.x-p.x,2)+Math.pow(u.
8198y-p.y,2)<=Math.pow(f+d,2)}return sq("y"===i?{start:a,end:h,value:t}:{start:s,end:o,value:e},d)}getCenterPoint(e){return sQ(this,e)}draw(e){let t=this.options,i=t.borderWidth;if(t.radius<.1)return;e.save(),e.fillStyle=t.backgroundColor,aa(e,t);let r=as(e,t);!function(e,t,i,r){let{radius:s,options:a}=t,o=a.pointStyle,h=a.rotation,c=(h||0)*el;if(ai(o)){e.save(),e.translate(i,r),e.rotate(c),e.drawImage(o,-o.width/2,-o.height/2,o.width,o.height),e.restore();return}isNaN(s)||s<=0||function(e,{x:t,y:i,radius:r,rotation:s,style:a,rad:o}){let h,c,d,u;switch(e.beginPath(),a){default:e.arc(t,i,r,0,ea),e.closePath();break;case"triangle":e.moveTo(t+Math.sin(o)*r,i-Math.cos(o)*r),o+=ed,e.lineTo(t+Math.sin(o)*r,i-Math.cos(o)*r),o+=ed,e.lineTo(t+Math.sin(o)*r,i-Math.cos(o)*r),e.closePath();break;case"rectRounded":u=.516*r,h=Math.cos(o+ec)*(d=r-u),c=Math.sin(o+ec)*d,e.arc(t-h,i-c,u,o-es,o-eh),e.arc(t+c,i-h,u,o-eh,o),e.arc(t+h,i+c,u,o,o+eh),e.arc(t-c,i+h,u,o+eh,o+es),e.closePath();break;case"rect":if(!s){d=Math.SQRT1_2*r,e.rect(t-d,i-d,2*d,2*d);break}o+=ec;case"rectRot":h=Math.cos(o)*r,c=Math.sin(o)*r,e.moveTo(t-h,i-c),e.lineTo(t+c,i-h),e.lineTo(t+h,i+c),e.lineTo(t-c,i+h),e.closePath();break;case"crossRot":o+=ec;case"cross":h=Math.cos(o)*r,c=Math.sin(o)*r,e.moveTo(t-h,i-c),e.lineTo(t+h,i+c),e.moveTo(t+c,i-h),e.lineTo(t-c,i+h);break;case"star":h=Math.cos(o)*r,c=Math.sin(o)*r,e.moveTo(t-h,i-c),e.lineTo(t+h,i+c),e.moveTo(t+c,i-h),e.lineTo(t-c,i+h),o+=ec,h=Math.cos(o)*r,c=Math.sin(o)*r,e.moveTo(t-h,i-c),e.lineTo(t+h,i+c),e.moveTo(t+c,i-h),e.lineTo(t-c,i+h);break;case"line":h=Math.cos(o)*r,c=Math.sin(o)*r,e.moveTo(t-h,i-c),e.lineTo(t+h,i+c);break;case"dash":e.moveTo(t,i),e.lineTo(t+Math.cos(o)*r,i+Math.sin(o)*r)}e.fill()}(e,{x:i,y:r,radius:s,rotation:h,style:o,rad:c})}(e,this,this.centerX,this.centerY),r&&!ai(t.pointStyle)&&(e.shadowColor=t.borderShadowColor,e.stroke()),e.restore(),t.borderWidth=i}resolveElementProperties(e,t){let i=ag(e,t);return i.initProperties=s9(e,i,t),i}}aQ.id="pointAnnotation",aQ.defaults={adjustScaleRange:!0,backgroundShadowColor:"transparent",borderDash:[],borderDashOffset:0,borderShadowColor:"transparent",borderWidth:1,display:!0,hitTolerance:0,init:void 0,pointStyle:"circle",radius:10,rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,xAdjust:0,xMax:void 0,xMin:void 0,xScaleID:void 0,xValue:void 0,yAdjust:0,yMax:void 0,yMin:void 0,yScaleID:void 0,yValue:void 0,z:0},aQ.defaultRoutes={borderColor:"color",backgroundColor:"color"};class aZ extends iJ{inRange(e,t,i,r){if("x"!==i&&"y"!==i)return this.options.radius>=.1&&this.elements.length>1&&function(e,t,i,r){let s=!1,a=e[e.length-1].getProps(["bX","bY"],r);for(let o of e){let e=o.getProps(["bX","bY"],r);e.bY>i!=a.bY>i&&t<(a.bX-e.bX)*(i-e.bY)/(a.bY-e.bY)+e.bX&&(s=!s),a=e}return s}(this.elements,e,t,r);let s=sW({x:e,y:t},this.getCenterPoint(r),ey(-this.options.rotation)),a=this.elements.map(e=>"y"===i?e.bY:e.bX),o=Math.min(...a),h=Math.max(...a);return s[i]>=o&&s[i]<=h}getCenterPoint(e){return sQ(this,e)}draw(e){let{elements:t,options:i}=this;e.save(),e.beginPath(),e.fillStyle=i.backgroundColor,aa(e,i);let r=as(e,i),s=!0;for(let i of t)s?(e.moveTo(i.x,i.y),s=!1):e.lineTo(i.x,i.y);e.closePath(),e.fill(),r&&(e.shadowColor=i.borderShadowColor,e.stroke()),e.restore()}resolveElementProperties(e,t){let i=ag(e,t),{sides:r,rotation:s}=t,a=[],o=2*es/r,h=s*el;for(let s=0;s<r;s++,h+=o){let r=function({centerX:e,centerY:t},{radius:i,borderWidth:r,hitTolerance:s},a){let o=(r+s)/2,h=Math.sin(a),c=Math.cos(a),d={x:e+h*i,y:t-c*i};return{type:"point",optionScope:"point",properties:{x:d.x,y:d.y,centerX:d.x,centerY:d.y,bX:e+h*(i+o),bY:t-c*(i+o)}}}(i,t,h);r.initProperties=s9(e,i,t),a.push(r)}return i.elements=a,i}}aZ.id="polygonAnnotation",aZ.defaults={adjustScaleRange:!0,backgroundShadowColor:"transparent",borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderShadowColor:"transparent",borderWidth:1,display:!0,hitTolerance:0,init:void 0,point:{radius:0},radius:10,rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,sides:3,xAdjust:0,xMax:void 0,xMin:void 0,xScaleID:void 0,xValue:void 0,yAdjust:0,yMax:void 0,yMin:void 0,yScaleID:void 0,yValue:void 0,z:0},aZ.defaultRoutes={borderColor:"color",backgroundColor:"color"};let aK={box:aT,doughnutLabel:aP,ellipse:aY,label:aD,line:aN,point:aQ,polygon:aZ};
8198Object.keys(aK).forEach(e=>{e2.describe(`elements.${aK[e].id}`,{_fallback:"plugins.annotation.common"})});let aJ={update:Object.assign},a$=aw.concat(aC),a0=(e,t)=>N(t)?a5(e,t):e,a1=e=>"color"===e||"font"===e;function a2(e="line"){return aK[e]?e:(console.warn(`Unknown annotation type: '${e}', defaulting to 'line'`),"line")}function a3(e,t,i,r){let s=aK[a2(i)],a=e[t];return a&&a instanceof s||Object.assign(a=e[t]=new s,r),a}function a4(e){let t=aK[a2(e.type)],i={};for(let r of(i.id=e.id,i.type=e.type,i.drawTime=e.drawTime,Object.assign(i,a5(e,t.defaults),a5(e,t.defaultRoutes)),a$))i[r]=e[r];return i}function a5(e,t){let i={};for(let r of Object.keys(t)){let s=t[r],a=e[r];a1(r)&&z(a)?i[r]=a.map(e=>a0(e,s)):i[r]=a0(a,s)}return i}let a6=new Map,a8=e=>"doughnutLabel"!==e.type,a9=aw.concat(aC);function a7(e,t,i){let{ctx:r,chartArea:s}=e,a=a6.get(e);for(let e of(i&&e7(r,s),(function(e,t){let i=[];for(let r of e)if(r.options.drawTime===t&&i.push({element:r,main:!0}),r.elements&&r.elements.length)for(let e of r.elements)e.options.display&&e.options.drawTime===t&&i.push({element:e});return i})(a.visibleElements,t).sort((e,t)=>e.element.options.z-t.element.options.z)))!function(e,t,i,r){let s=r.element;r.main?(aM(i,s,"beforeDraw"),s.draw(e,t),aM(i,s,"afterDraw")):s.draw(e,t)}(r,s,a,e);i&&te(r)}var ne=e.i(378081),nt=e.i(25211);function ni({data:{yLabel:e,unit:t,columns:i},hideLegend:s}){if(!i)return null;let a=i.map(e=>e.title.split("^^")),o=Math.max(...i.map(e=>
8198Math.max(e.nodes1||0,e.nodes8||0,e.nodes9||0,e.nodes64||0))),h=i.some(e=>e.nodes1),c=i.some(e=>e.nodes8),d=i.some(e=>e.nodes9),u=i.some(e=>e.nodes64),p=[],f={pointRadius:8,pointHoverRadius:10,showLine:!1};h&&p.push({...f,label:"1 Node",backgroundColor:"#CCD7CF",borderColor:"#003911",data:i.map((e,t)=>({x:t+1,y:e.nodes1}))}),c&&p.push({...f,label:"8 Node",backgroundColor:"#003911",borderColor:"#003911",data:i.map((e,t)=>({x:t+1,y:e.nodes8}))}),d&&p.push({...f,label:"9 Node",backgroundColor:"#00601b",borderColor:"#00601b",data:i.map((e,t)=>({x:t+1,y:e.has9Node}))}),u&&p.push({...f,label:"64 Node",backgroundColor:"#A9DAC7",borderColor:"#A9DAC7",data:i.map((e,t)=>({x:t+1,y:e.nodes64}))});let m=Math.ceil(Math.round(1.2*o));m||(m=1);let g={animation:{duration:500,delay:0},transitions:{active:{animation:{delay:0}}},plugins:{annotation:{annotations:{box1:{type:"box",xMin:.75,xMax:1.25,yMin:0,yMax:m,backgroundColor:"#EBFFAD",borderWidth:0,drawTime:"beforeDatasetsDraw"}}},legend:{position:"bottom",align:"end",display:!s,labels:{usePointStyle:!0,padding:20}},tooltip:{enabled:!1,external:function(e){let r=document.getElementById("chartjs-tooltip");r||((r=document.createElement("div")).id="chartjs-tooltip",r.innerHTML="<table></table>",r.innerHTML+='<div style="width: 20px; height: 20px; position: absolute; top: calc(100% - 6px); left: calc(50% - 7px); color: white; text-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);">▼</div>',document.body.appendChild(r));let s=e.tooltip;if(0===s.opacity){r.style.opacity="0%";return}if(r.classList.remove("above","below","no-transform"),s.yAlign?r.classList.add(s.yAlign):r.classList.add("no-transform"),s.body){let e=s.title||[],a="<thead>";e.forEach(e=>{a+='<tr><th style="font-size: 18px; color: #003911; font-family: var(--font-mono);">'+e+"</th></tr>"}),a+='</thead><tbody style="color: #6f6f6f;">';let o=s?.body?.[0]?.lines?.[0]?.split(":")?.[0];a+=`<tr><td>${o}</td></tr>`;let h=o.split(" ")[0],[c,d]=[i.find(t=>t.title===e?.[0])?.[`nodes${h}`],i[0][`nodes${h}`]],u=(0,ne.roundTo2dp)((c-d)/d*100);e?.[0]==="SMC"?a+=`<tr><td>${c} ${t}</td></tr><tr></tr>`:a+=`<tr><td>${c} ${t}</td></tr><tr><td>${u>0?"+":""}${u}% variance from SMC</td></tr>`,a+="</tbody>";let p=r.querySelector("table");p&&(p.innerHTML=a)}r.style.opacity="0%",r.style.position="absolute",r.style.backgroundColor="white",r.style.boxShadow="0 0 10px rgba(0, 0, 0, 0.2)",r.style.borderRadius="4px",r.style.padding="8px",r.style.pointerEvents="none",r.style.textAlign="left",requestAnimationFrame(()=>{let t=e.chart.canvas.getBoundingClientRect(),i=document.body.getBoundingClientRect(),a=r.offsetWidth,o=r.offsetHeight;r.style.left=t.left+window.scrollX+s.caretX-a/2+"px",r.style.top=t.top-i.top+s.caretY-o-20+"px",r.style.opacity="100%"})}}},scales:{x:{min:1,max:a.length,offset:!0,display:!0,title:{display:!0,text:"Submitter"},grid:{display:!1},ticks:{font:{size:8},callback:e=>{let t=a[e-1]?.toString().toUpperCase()||"";return"smc"===t.toLowerCase()?"FIRMUS":t},stepSize:1}},y:{min:0,max:m,display:!0,title:{display:!0,text:`${e} (${t})`},ticks:{stepSize:m/4,callback:e=>e}}},maintainAspectRatio:!1};return(0,r.jsx)("div",{className:nt.default.Chart,children:(0,r.jsx)(sF,{data:{labels:a,datasets:p},options:g,height:"400"})})}rb.register({id:"annotation",version:"3.1.0",beforeRegister(){!function(e,t,i=!0){let r=t.split("."),s=0;for(let a of"4.0".split(".")){let o=r[s++];if(parseInt(a,10)<parseInt(o,10))break;if(sH(o,a))if(!i)return!1;else throw Error(`${e} v${t} is not supported. v4.0 or newer is required.`)}}("chart.js",rb.version)},afterRegister(){rb.register(aK)},afterUnregister(){rb.unregister(aK)},beforeInit(e){a6.set(e,{annotations:[],elements:[],visibleElements:[],listeners:{},listened:!1,moveListened:!1,hooks:{},hooked:!1,hovered:[]})},beforeUpdate(e,t,i){let r=a6.get(e).annotations=[],s=i.annotations;N(s)?Object.keys(s).forEach(e=>{let t=s[e];N(t)&&(t.id=e,r.push(t))}):z(s)&&r.push(...s);var a=r.filter(a8),o=e.scales;for(let e of a){var h=e,c=o;for(let e of["scaleID","xScaleID","yScaleID"]){let t=au(c,h,e);t&&!c[t]&&function(e,t){if("scaleID"===t)return!0;let i=t.charAt(0);for(let t of["Min","Max","Value"])if(et(e[i+t]))return!0;return!1}
8198(h,e)&&console.warn(`No scale found with id '${t}' for annotation '${h.id}'`)}}},afterDataLimits(e,t){var i,r;let s,a,o=a6.get(e);i=t.scale,r=o.annotations.filter(a8).filter(e=>e.display&&e.adjustScaleRange),s=function(e,t,i){let r=t.axis,s=t.id,a=r+"ScaleID",o={min:U(t.min,-1/0),max:U(t.max,1/0)};for(let h of i)h.scaleID===s?aA(h,t,["value","endValue"],o):au(e,h,a)===s&&aA(h,t,[r+"Min",r+"Max",r+"Value"],o);return o}(e.scales,i,r),a=aE(i,s,"min","suggestedMin"),(a=aE(i,s,"max","suggestedMax")||a)&&ei(i.handleTickRangeOptions)&&i.handleTickRangeOptions()},afterUpdate(e,t,i){let r,s=a6.get(e);s.listened=s7(i,aw,s.listeners),s.moveListened=!1,ab.forEach(e=>{ei(i[e])&&(s.moveListened=!0)}),s.listened&&s.moveListened||s.annotations.forEach(e=>{!s.listened&&ei(e.click)&&(s.listened=!0),s.moveListened||ab.forEach(t=>{ei(e[t])&&(s.listened=!0,s.moveListened=!0)})}),function(e,t,i,r){var s,a,o,h,c,d,u,p,f;let m,g,v=(s=e,a=i.animations,"reset"===(o=r)||"none"===o||"resize"===o?aJ:new t6(s,a)),y=t.annotations,x=(h=t.elements,m=y.length,(g=h.length)<m?h.splice(g,0,...Array(m-g)):g>m&&h.splice(m,g-m),h);for(let t=0;t<y.length;t++){let i=y[t],r=a3(x,t,i.type),s=i.setContext((c=e,d=r,u=x,p=i,d.$context||(d.$context=Object.assign(Object.create(c.getContext()),{element:d,get elements(){return u.filter(e=>e&&e.options)},id:p.id,type:"annotation"})))),a=r.resolveElementProperties(e,s);a.skip=isNaN((f=a).x)||isNaN(f.y),"elements"in a&&(function(e,t,i,r){let s=e.elements||(e.elements=[]);s.length=t.length;for(let e=0;e<t.length;e++){let a=t[e],o=a.properties,h=a3(s,e,a.type,a.initProperties);o.options=a4(i[a.optionScope].override(a)),r.update(h,o)}}(r,a.elements,s,v),delete a.elements),et(r.x)||Object.assign(r,a),Object.assign(r,a.initProperties),a.options=a4(s),v.update(r,a)}}(e,s,i,t.mode),s.visibleElements=s.elements.filter(e=>!e.skip&&e.options.display),r=s.visibleElements,s.hooked=s7(i,aC,s.hooks),s.hooked||r.forEach(e=>{s.hooked||aC.forEach(t=>{ei(e.options[t])&&(s.hooked=!0)})})},beforeDatasetsDraw(e,t,i){a7(e,"beforeDatasetsDraw",i.clip)},afterDatasetsDraw(e,t,i){a7(e,"afterDatasetsDraw",i.clip)},beforeDatasetDraw(e,t,i){a7(e,t.index,i.clip)},beforeDraw(e,t,i){a7(e,"beforeDraw",i.clip)},afterDraw(e,t,i){a7(e,"afterDraw",i.clip)},beforeEvent(e,t,i){(function(e,t,i){if(e.listened)switch(t.type){case"mousemove":case"mouseout":let r;var s=e,a=t,o=i;if(!s.moveListened)return;r="mousemove"===a.type?sU(s.visibleElements,a,o.interaction):[];let h=s.hovered;s.hovered=r;let c={state:s,event:a},d=a_(c,"leave",h,r);return a_(c,"enter",r,h)||d;case"click":var u=e,p=t,f=i;let m,g=u.listeners;for(let e of sU(u.visibleElements,p,f.interaction))m=aS(e.options.click||g.click,e,p)||m;return m}})(a6.get(e),t.event,i)&&(t.changed=!0)},afterDestroy(e){a6.delete(e)},getAnnotations(e){let t=a6.get(e);return t?t.elements:[]},_getAnnotationElementsAtEventForMode:(e,t,i)=>sU(e,t,i),defaults:{animations:{numbers:{properties:["x","y","x2","y2","width","height","centerX","centerY","pointX","pointY","radius"],type:"number"},colors:{properties:["backgroundColor","borderColor"],type:"color"}},clip:!0,interaction:{mode:void 0,axis:void 0,intersect:void 0},common:{drawTime:"afterDatasetsDraw",init:!1,label:{}}},descriptors:{_indexable:!1,_scriptable:e=>!a9.includes(e)&&"init"!==e,annotations:{_allKeys:!1,_fallback:(e,t)=>`elements.${aK[a2(t.type)].id}`},interaction:{_fallback:!0},common:{label:{_indexable:a1,_fallback:!0},_indexable:a1}},additionalOptionScopes:[""]});var nr=e.i(792668),ns=e.i(389264);function na({section:e}){let{title:t,hideTitle:i,copy:a,table:o,image:h,resultsSections:c,chart:d,footnote:u}=e;return(0,r.jsxs)("div",{className:nt.default.Section,children:[c&&(0,r.jsx)("div",{className:nt.default.ResultsSections,children:c?.map((e,t)=>{let{title:i,copy:a,tables:o}=e;return(0,r.jsxs)("div",{className:nt.default.ResultsSection,children:[(0,r.jsx)("div",{className:(0,s.default)("smallCaps",nt.default.ResultsSectionTitle),dangerouslySetInnerHTML:{__html:i}}),(0,r.jsx)("div",{className:nt.default.ResultsSectionCopy,children:a&&(0,r.jsx)(ns.default,{copy:a,size:"medium"})}),o&&(0,r.jsx)("div",{className:nt.default.ResultsSectionTables,children:o?.map((e,t)=>{let{title:i,table:a}=e;return(0,r.jsxs)("div",{className:nt.default.ResultsSectionTableCont,children:[(0,r.jsx)("div",{className:(0,s.default)("smallCaps",nt.default.ResultsSectionTableTitle),dangerouslySetInnerHTML:{__html:i}}),(0,r.jsx)("div",{className:nt.default.ResultsSectionTable,dangerouslySetInnerHTML:{__html:a}})]},t)})})]},t)})}),t&&!i&&(0,r.jsx)("div",{className:nt.default.SectionTitle,children:t}),a&&(0,r.jsx)("div",{className:nt.default.SectionCopy,children:a&&(0,r.jsx)(ns.default,{copy:a,size:"small"})}),o&&(0,r.jsx)("div",{className:nt.default.Table,dangerouslySetInnerHTML:{__html:o}}),d?.unit?(0,r.jsx)(ni,{data:d,hideLegend:!1}):null,h&&(0,r.jsx)("div",{className:nt.default.SectionImage,children:(0,r.jsx)(nr.default,{image:h,blur:!0})}),u&&(0,r.jsx)("div",{className:nt.default.SectionFootnote,children:u})]})}e.s(["default",0,function({sections:e}){return(0,r.jsx)("section",{className:nt.default.BenchmarkModel,children:(0,r.jsx)("div",{className:nt.default.Main,children:(0,r.jsx)("div",{children:e&&(0,r.jsx)("div",{className:nt.default.Sections,children:e?.map((e,t)=>(0,r.jsx)(na,{section:e},t))})})})})}],633534)},435737,e=>{e.v({Animation:"ThreeColTiles-module-scss-module__puTpKq__Animation",BgImage:"ThreeColTiles-module-scss-module__puTpKq__BgImage",Cont:"ThreeColTiles-module-scss-module__puTpKq__Cont",Copy:"ThreeColTiles-module-scss-module__puTpKq__Copy",Grid:"ThreeColTiles-module-scss-module__puTpKq__Grid",HasImage:"ThreeColTiles-module-scss-module__puTpKq__HasImage",Intro:"ThreeColTiles-module-scss-module__puTpKq__Intro",PreTitle:"ThreeColTiles-module-scss-module__puTpKq__PreTitle",ThreeColTiles:"ThreeColTiles-module-scss-module__puTpKq__ThreeColTiles",Tile:"ThreeColTiles-module-scss-module__puTpKq__Tile",Title:"ThreeColTiles-module-scss-module__puTpKq__Title"})},375962,e=>{"use strict";var t=e.i(395633),i=e.i(7284),r=e.i(507251),s=e.i(378081),a=e.i(481818),o=e.i(183102),h=e.i(588610),c=e.i(170586),d=e.i(616827),u=e.i(470989),p=e.i(435737);e.s(["default",0,function({preTitle:e,title:f,copy:m,tiles:g}){return(0,t.jsx)("section",{className:p.default.ThreeColTiles,children:(0,t.jsxs)("div",{className:(0,i.default)(p.default.Cont,"container"),children:[(0,t.jsx)("div",{className:p.default.Intro,children:(0,t.jsx)(d.default,{preTitle:e,title:f,copy:m})}),(0,t.jsx)("div",{className:p.default.Grid,children:g?.map((e,d)=>{let{title:f,link:m,copy:g,image:v}=e||{},y=(0,a.urlForImage)(v)?.url(),x=(m?.linkType==="internal"||m?.linkType==="external")&&(0,s.getSanityLink)(m)||null,b=(0,t.jsxs)(t.Fragment,{children:[f&&(0,t.jsx)("h4",{className:p.default.Title,dangerouslySetInnerHTML:{__html:f}}),(0,t.jsx)("div",{className:p.default.Animation,children:(0,t.jsx)(h.default,{})}),(0,t.jsxs)("div",{className:p.default.Copy,children:[g&&(0,t.jsx)("p",{children:g}),m&&(()=>{if(x)return(0,t.jsx)(c.default,{title:x.title,transparent:!0})})()]}),y?(0,t.jsx)(r.default,{src:y,width:280,height:350,alt:"",className:p.default.BgImage}):null]});return(0,t.jsx)(o.AnimatedElement,{element:"div",className:(0,i.default)(p.default.Tile,{[p.default.HasImage]:!!y}),delay:.05*d,duration:.6,children:x?(0,t.jsx)(u.default,{href:x.url,children:b}):(0,t.jsx)("div",{children:b})},d)})})]})})}])},419799,e=>{e.v({Accordion:"ThreeColContent-module-scss-module__U4F_jq__Accordion",Black:"ThreeColContent-module-scss-module__U4F_jq__Black",Button:"ThreeColContent-module-scss-module__U4F_jq__Button",Cont:"ThreeColContent-module-scss-module__U4F_jq__Cont",Copy:"ThreeColContent-module-scss-module__U4F_jq__Copy",Dark:"ThreeColContent-module-scss-module__U4F_jq__Dark",DarkGreen:"ThreeColContent-module-scss-module__U4F_jq__DarkGreen",Grey:"ThreeColContent-module-scss-module__U4F_jq__Grey",Image:"ThreeColContent-module-scss-module__U4F_jq__Image",PreTitle:"ThreeColContent-module-scss-module__U4F_jq__PreTitle",ThreeColContent:"ThreeColContent-module-scss-module__U4F_jq__ThreeColContent",Title:"ThreeColContent-module-scss-module__U4F_jq__Title"})},189610,e=>{"use strict";var t=e.i(395633),i=e.i(7284),r=e.i(170586),s=e.i(378081),a=e.i(792668),o=e.i(419799),h=e.i(389264),c=e.i(5593);e.s(["default",0,function({backgroundColour:e,preTitle:d,columns:u}){let p="black"===e||"dark-green"===e;return(0,t.jsx)("section",{className:(0,i.default)(o.default.ThreeColContent,"black"===e&&o.default.Black,"dark-green"===e&&o.default.DarkGreen,"white"===e&&o.default.White,"grey"===e&&o.default.Grey,p&&o.default.Dark),children:(0,t.jsx)("div",{className:(0,i.default)(o.default.Cont,"container"),children:u?.map((u,f)=>(0,t.jsxs)("div",{children:[0===f&&d&&(0,t.jsx)("p",{className:(0,i.default)(o.default.PreTitle,p&&"light","preTitle"),children:d}),"logo"===u._type&&u.asset&&(0,t.jsx)("div",{className:o.default.Image,children:(0,t.jsx)(a.default,{image:u,contain:!0})}),"copy"===u._type&&u.copy&&(0,t.jsx)("div",{className:o.default.Copy,children:(0,t.jsx)(h.default,{copy:u.copy,size:"large"})}
8198),"accordion"===u._type&&u.items&&u.items.length>0&&(0,t.jsxs)("div",{className:o.default.Accordion,children:[u.title&&(0,t.jsx)("h4",{className:(0,i.default)(o.default.Title),children:u.title}),(0,t.jsx)(c.default,{items:u.items,white:"white"!==e}),u.buttons?.map(i=>{let a=(i?.linkType==="internal"||i?.linkType==="external")&&(0,s.getSanityLink)(i)||null;return(0,t.jsx)(r.default,{...a,className:o.default.Button,transparent:!0,white:"dark-green"===e||"black"===e},i.title)})]})]},u._key))})})}])},504799,e=>{e.v({Content:"Press-module-scss-module__fsYuqa__Content",Date:"Press-module-scss-module__fsYuqa__Date",Image:"Press-module-scss-module__fsYuqa__Image",List:"Press-module-scss-module__fsYuqa__List",Navigation:"Press-module-scss-module__fsYuqa__Navigation",Press:"Press-module-scss-module__fsYuqa__Press",PressItem:"Press-module-scss-module__fsYuqa__PressItem",Slide:"Press-module-scss-module__fsYuqa__Slide",Slider:"Press-module-scss-module__fsYuqa__Slider"})},635616,e=>{e.v({Active:"PostGridInner-module-scss-module__TqsmCq__Active",Categories:"PostGridInner-module-scss-module__TqsmCq__Categories",CategoriesMobile:"PostGridInner-module-scss-module__TqsmCq__CategoriesMobile",Category:"PostGridInner-module-scss-module__TqsmCq__Category",Grid:"PostGridInner-module-scss-module__TqsmCq__Grid",LoadMore:"PostGridInner-module-scss-module__TqsmCq__LoadMore",Loading:"PostGridInner-module-scss-module__TqsmCq__Loading",Skeleton:"PostGridInner-module-scss-module__TqsmCq__Skeleton",pulse:"PostGridInner-module-scss-module__TqsmCq__pulse"})},864324,e=>{"use strict";var t=e.i(395633),i=e.i(131173),r=e.i(7284),s=e.i(352636),a=e.i(884825),o=e.i(832410),h=e.i(170586),c=e.i(53030),d=e.i(440085),u=e.i(308562),p=e.i(682623),f=e.i(378081),m=e.i(470989),g=e.i(792668),v=e.i(504799);function y({item:e}){let{title:i,date:r,link:s,image:a}=e;return s?(0,t.jsxs)(m.default,{className:v.default.PressItem,href:s,children:[(0,t.jsx)("div",{className:v.default.Image,children:a&&(0,t.jsx)(g.default,{image:a})}),(0,t.jsxs)("div",{className:v.default.Content,children:[i&&(0,t.jsx)("div",{className:v.default.ItemTitle,dangerouslySetInnerHTML:{__html:`${i} →`}}),r&&(0,t.jsx)("div",{className:v.default.Date,children:(0,f.returnDate)(r)})]})]}):null}function x({data:e}){let s=(0,i.useRef)(null),{title:a,pressItems:o}=e;return e&&o?(0,t.jsxs)("section",{className:v.default.Press,children:[a&&(0,t.jsx)("div",{className:(0,r.default)(v.default.Title,"preTitle"),children:a}),(0,t.jsx)(d.Swiper,{ref:s,className:v.default.Slider,modules:[u.A11y,p.Navigation],spaceBetween:20,slidesPerView:2.3,loop:!0,allowTouchMove:!0,children:o.map((e,i)=>e.link?(0,t.jsx)(d.SwiperSlide,{className:v.default.Slide,children:(0,t.jsx)(y,{item:e})},i):null)}),o.length>2&&(0,t.jsxs)("div",{className:v.default.Navigation,children:[(0,t.jsx)("button",{onClick:()=>s.current?.swiper.slidePrev(),children:"←"}),(0,t.jsx)("button",{onClick:()=>s.current?.swiper.slideNext(),children:"→"})]}),(0,t.jsx)("div",{className:v.default.List,children:o.map((e,i)=>e.link?(0,t.jsx)("div",{className:v.default.PressListItem,children:(0,t.jsx)(y,{item:e})},i):null)})]}):null}var b=e.i(635616);e.s(["default",0,function({categories:e,initialPosts:d,press:u,firstPost:p}){let[f,m]=(0,i.useState)(d),[g,v]=(0,i.useState)("all"),[y,w]=(0,i.useState)(12),[_,S]=(0,i.useState)(!1),[C,M]=(0,i.useState)(!1),[E,A]=(0,i.useState)(!0),T=p?._id,P=async()=>{M(!0);try{let e,t={firstPostId:T};"all"===g?e=a.groq`
8199                    *[_type == "post" && _id != $firstPostId] | order(publishDate desc) [${y}...${y+12}] {
8200                        ...,
8201                        _id,
8202                        title,
8203                        "slug": slug.current,
8204                        categories[]-> {
8205                            name,
8206                            "slug": slug.current
8207                        },
8208                        featuredImage {
8209                            ...,
8210                            asset-> {
8211                                url,
8212                                altText,
8213                                metadata {
8214                                    lqip,
8215                                }
8216                            }
8217                        },
8218                    }
8219                `:(e=a.groq`
8220                    *[_type == "post" && _id != $firstPostId && $category in categories[]->slug.current] | order(publishDate desc) [${y}...${y+12}] {
8221                        ...,
8222                        _id,
8223                        title,
8224                        "slug": slug.current,
8225                        categories[]-> {
8226                            name,
8227                            "slug": slug.current
8228                        },
8229                        featuredImage {
8230                            ...,
8231                            asset-> {
8232                                url,
8233                                altText,
8234                                metadata {
8235                                    lqip,
8236                                }
8237                            }
8238                        },
8239                    }
8240                `,t={category:g,firstPostId:T});let i=await (0,o.sanityFetch)({query:e,params:t,tags:["post"]});m(e=>[...e,...i]),w(e=>e+12),i.length<12&&A(!1)}catch(e){console.error("Failed to load more posts:",e)}finally{M(!1)}};return(0,i.useEffect)(()=>
8240{if(S(!0),w(12),A(!0),"all"===g){m(d),A(12===d.length),S(!1);return}(async()=>{let e=a.groq`
8241                *[_type == "post" && _id != $firstPostId && $category in categories[]->slug.current] | order(publishDate desc) [0...12] {
8242                    ...,
8243                    _id,
8244                    title,
8245                    "slug": slug.current,
8246                    categories[]-> {
8247                        name,
8248                        "slug": slug.current
8249                    },
8250                    featuredImage {
8251                        ...,
8252                        asset-> {
8253                            url,
8254                            altText,
8255                            metadata {
8256                                lqip,
8257                            }
8258                        }
8259                    },
8260                }
8261            `,t=await (0,o.sanityFetch)({query:e,params:{category:g,firstPostId:T},tags:["post"]});m(t),A(12===t.length),S(!1)})()},[g,d,T]),(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:b.default.Categories,children:[(0,t.jsx)("button",{className:(0,r.default)(b.default.Category,"smallCaps","all"===g&&b.default.Active),onClick:()=>v("all"),children:"All"},"all"),e.map(e=>(0,t.jsx)("button",{className:(0,r.default)(b.default.Category,"smallCaps",g===e.slug&&b.default.Active),onClick:()=>v(e.slug),children:e.name},e._id))]}),(0,t.jsx)("div",{className:b.default.CategoriesMobile,children:(0,t.jsx)(s.default,{className:b.default.Select,classNamePrefix:"react-select",options:[{value:"all",label:"All"},...e.map(e=>({value:e.slug,label:e.name??""}))],value:"all"===g?{value:"all",label:"All"}:{value:g,label:e.find(e=>e.slug===g)?.name||""},onChange:e=>{e&&v(e.value)},isSearchable:!1})}),(0,t.jsx)("div",{className:b.default.Grid,children:_?(0,t.jsxs)("div",{className:b.default.Loading,children:[(0,t.jsxs)("div",{className:b.default.Skeleton,children:[(0,t.jsx)("div",{}),(0,t.jsx)("div",{}),(0,t.jsx)("div",{})]}),(0,t.jsxs)("div",{className:b.default.Skeleton,children:[(0,t.jsx)("div",{}),(0,t.jsx)("div",{}),(0,t.jsx)("div",{})]}),(0,t.jsxs)("div",{className:b.default.Skeleton,children:[(0,t.jsx)("div",{}),(0,t.jsx)("div",{}),(0,t.jsx)("div",{})]})]}):0===f.length?(0,t.jsx)("div",{className:b.default.NoPostsMessage,children:"No posts found."}):f.map((e,r)=>(0,t.jsxs)(i.Fragment,{children:[(0,t.jsx)(c.default,{post:e}),"all"===g&&(window.innerWidth<1260&&3===r||window.innerWidth>=1260&&2===r)&&(0,t.jsx)(x,{data:u})]},r))}),E&&!_&&(0,t.jsx)(h.default,{className:b.default.LoadMore,title:C?"Loading...":"Load More",handleClick:P,disabled:C,noArrow:!0})]})}],864324)},399909,e=>{"use strict";var t=e.i(860519),i=e.i(697725),r=e.i(133869);let s=(0,t.createMotionComponent)("div",void 0,r.featureBundle,i.createDomVisualElement);e.s(["div",0,s],399909)},195982,e=>{e.v({Active:"OptionsSelector-module-scss-module__0x64uG__Active",Bg:"OptionsSelector-module-scss-module__0x64uG__Bg",OptionsSelector:"OptionsSelector-module-scss-module__0x64uG__OptionsSelector",Vertical:"OptionsSelector-module-scss-module__0x64uG__Vertical"})},826638,e=>{"use strict";var t=e.i(395633),i=e.i(7284),r=e.i(399909),s=e.i(195982);e.s(["default",0,function({selectedOption:e,options:a,handleOptionClick:o,layoutId:h,vertical:c}){return(0,t.jsx)("div",{className:(0,i.default)(s.default.OptionsSelector,c&&s.default.Vertical),children:(0,t.jsx)("div",{children:a?.map((i,a)=>(0,t.jsxs)(r.div,{children:[(0,t.jsx)("button",{className:e===i.value?s.default.Active:"",onClick:()=>o(i.value),children:i.label}),e===i.value?(0,t.jsx)(r.div,{className:s.default.Bg,layoutId:`underline-${h}`,id:`underline-${h}`}):null]},a))})})}])},321206,e=>{e.v({Active:"PricingCalculator-module-scss-module__HO3eYq__Active",Button:"PricingCalculator-module-scss-module__HO3eYq__Button",Calc:"PricingCalculator-module-scss-module__HO3eYq__Calc",Cont:"PricingCalculator-module-scss-module__HO3eYq__Cont",Copy:"PricingCalculator-module-scss-module__HO3eYq__Copy",Details:"PricingCalculator-module-scss-module__HO3eYq__Details",Disclaimer:"PricingCalculator-module-scss-module__HO3eYq__Disclaimer",Gpus:"PricingCalculator-module-scss-module__HO3eYq__Gpus",Inactive:"PricingCalculator-module-scss-module__HO3eYq__Inactive",Instance:"PricingCalculator-module-scss-module__HO3eYq__Instance",InstanceCounter:"PricingCalculator-module-scss-module__HO3eYq__InstanceCounter",Instances:"PricingCalculator-module-scss-module__HO3eYq__Instances",Intro:"PricingCalculator-module-scss-module__HO3eYq__Intro",Main:"PricingCalculator-module-scss-module__HO3eYq__Main",NoResult:"PricingCalculator-module-scss-module__HO3eYq__NoResult",NumberOfInstances:"PricingCalculator-module-scss-module__HO3eYq__NumberOfInstances",PricingCalculator:"PricingCalculator-module-scss-module__HO3eYq__PricingCalculator",Result:"PricingCalculator-module-scss-module__HO3eYq__Result",Selectable:"PricingCalculator-module-scss-module__HO3eYq__Selectable",Subtitle:"PricingCalculator-module-scss-module__HO3eYq__Subtitle",Term:"PricingCalculator-module-scss-module__HO3eYq__Term",TotalCost:"PricingCalculator-module-scss-module__HO3eYq__TotalCost"})},995106,e=>{"use strict";var t=e.i(395633),i=e.i(131173),r=e.i(7284),s=e.i(616827),a=e.i(826638),o=e.i(170586),h=e.i(321206);function c({instance:e,gpuCount:i,instanceCount:s,term:a,resultsDisclaimer:d}){let u=a&&e?"3year"===a?e?.costPer3Years*36:"year"===a?e?.costPerYear*12:e?.costPerMonth:null,p=e&&null!==i&&null!==s?u*i*s:null,f=p&&null!==s?p/(24*s*30*("3year"===a?36:"year"===a?12:1)):null,m=p&&null!==i&&null!==s?p/(i*s*720*("3year"===a?36:"year"===a?12:1)):null;return(0,t.jsx)("div",{className:(0,r.default)(h.default.Result,!e&&h.default.No
8261Result),children:(0,t.jsx)("div",{children:e?(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"smallCaps",dangerouslySetInnerHTML:{__html:"Instance"}}),e&&(0,t.jsxs)("div",{className:h.default.Instance,children:[(0,t.jsx)("h3",{dangerouslySetInnerHTML:{__html:e?.title}}),(0,t.jsx)("p",{className:"smallCaps",dangerouslySetInnerHTML:{__html:e?.description}})]}),(0,t.jsxs)("div",{className:h.default.Details,children:[s&&(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"smallCaps",children:"Instances"}),(0,t.jsx)("span",{className:"smallCaps",children:s})]}),i&&s&&(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"smallCaps",children:"Total GPUs"}),(0,t.jsx)("span",{className:"smallCaps",children:i*s})]}),i&&s&&a&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"smallCaps",children:"Cost per instance per hour"}),(0,t.jsxs)("span",{className:"smallCaps",children:["$",f?.toFixed(2)]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"smallCaps",children:"Cost per GPU per hour"}),(0,t.jsxs)("span",{className:"smallCaps",children:["$",m?.toFixed(2)]})]})]})]}),(0,t.jsx)("div",{className:h.default.Button,children:(0,t.jsx)(o.default,{url:"/enquire",title:"Enquire",interfaceGreen:!0})})]}):(0,t.jsx)("p",{children:"Customize your plan from the choices available."})})})}var d=e.i(852756);let u=[{label:"1X",value:1},{label:"2X",value:2},{label:"4X",value:4},{label:"8X",value:8}];e.s(["default",0,function({subtitle:e,title:o,copy:p,pricingFields:f,navLabel:m,resultsDisclaimer:g}){let[v,y]=(0,i.useState)(null),[x,b]=(0,i.useState)(1),[w,_]=(0,i.useState)(1),[S,C]=(0,i.useState)("month"),[M,E]=(0,i.useState)(1024);return(0,i.useEffect)(()=>{if(v&&(E(v.maxInstances),!v.availableGpusPerInstance[`x${x}`])){let e=u.find(e=>v.availableGpusPerInstance[`x${e.value}`]);e&&b(e.value)}},[v,x]),(0,t.jsx)("section",{className:h.default.PricingCalculator,id:m?.toLowerCase()?.replaceAll(" ","-"),children:(0,t.jsxs)("div",{className:(0,r.default)(h.default.Cont,"container"),children:[(0,t.jsx)("div",{className:h.default.Intro,children:(0,t.jsx)(s.default,{preTitle:e,title:o,copy:p})}),(0,t.jsxs)("div",{className:(0,r.default)(h.default.Main),children:[(0,t.jsxs)("div",{className:h.default.Calc,children:[(0,t.jsxs)("div",{className:h.default.Instances,children:[(0,t.jsx)("span",{className:"smallCaps",dangerouslySetInnerHTML:{__html:"Select Instance"}}),f&&(0,t.jsx)("ul",{children:f?.map((e,i)=>{let{title:s,description:a,inactive:o}=e;return(0,t.jsxs)("li",{className:(0,r.default)(h.default.Selectable,h.default.Instance,v===e&&h.default.Active,o&&h.default.Inactive),onClick:()=>y(e),children:[(0,t.jsx)("h4",{dangerouslySetInnerHTML:{__html:s}}),(0,t.jsx)("p",{className:"smallCaps",dangerouslySetInnerHTML:{__html:a}})]},i)})})]}),(0,t.jsxs)("div",{className:h.default.Gpus,children:[(0,t.jsx)("span",{className:"smallCaps",dangerouslySetInnerHTML:{__html:"GPUs per instance"}}),(0,t.jsx)(a.default,{options:u.filter(e=>!v||v.availableGpusPerInstance[`x${e.value}`]),selectedOption:x,handleOptionClick:e=>b(e),layoutId:"gpu-count-options"})]}),(0,t.jsxs)("div",{className:h.default.Term,children:[(0,t.jsx)("span",{className:"smallCaps",dangerouslySetInnerHTML:{__html:"Term"}}),(0,t.jsxs)("p",{children:["For committed and dedicated access with long term pricing, ",(0,t.jsx)(d.default,{href:"/enquire",children:"contact sales"}),"."]})]})]}),(0,t.jsx)(c,{instance:v,gpuCount:x,instanceCount:w,term:S,resultsDisclaimer:g})]})]})})}],995106)},34939,e=>{e.v({Error:"Subscribe-module-scss-module__3_hNxa__Error",InputCont:"Subscribe-module-scss-module__3_hNxa__InputCont",Message:"Subscribe-module-scss-module__3_hNxa__Message",Subscribe:"Subscribe-module-scss-module__3_hNxa__Subscribe",TagsList:"Subscribe-module-scss-module__3_hNxa__TagsList"})},510847,e=>{e.v({Outer:"CheckboxField-module-scss-module__ZMWeHa__Outer"})},928535,e=>{"use strict";var t=e.i(395633),i=e.i(7284),r=e.i(170586),s=e.i(131173),a=e.i(378081),o=e.i(640288),h=e.i(34939),c=e.i(618915),d=e.i(510847);function u({label:e,value:i,checked:r,onChange:s}){return(0,t.jsxs)("label",{className:d.default.Outer,children:[(0,t.jsx)("input",{type:"checkbox",name:e,value:i,checked:r,onChange:s}),(0,t.jsx)("i",{children:c.icons.tick}),(0,t.jsx)("span",{children:e})]})}e.s(["default",0,function({subscribeTags:e}
8261){let[c,d]=(0,s.useState)(""),[p,f]=(0,s.useState)(""),[m,g]=(0,s.useState)(null),[v,y]=(0,s.useState)([]),x=(0,s.useRef)(null),b=e?.filter(e=>e.label&&e.listId),w=async()=>{if(g("submitting"),!c)return g("error"),f("Please enter an email address."),setTimeout(()=>{f("")},3e3),null;if(!(0,a.validateEmail)(c))return g("error"),f("Please enter a valid email address."),setTimeout(()=>{f("")},3e3),null;let e=await (0,o.subscribe)(c,v);"success"===e?(d(""),g("success"),f("Thank you for subscribing!"),setTimeout(()=>{f("")},3e3)):(g("error"),f("conflict"===e?"We have updated your details now.":"Something went wrong, please try again."),setTimeout(()=>{f("")},3e3))};return(0,t.jsxs)("div",{className:h.default.Subscribe,children:[(0,t.jsxs)("div",{className:h.default.InputCont,children:[(0,t.jsx)("input",{placeholder:"Enter email here",type:"email",value:c,onChange:e=>d(e.target.value),ref:x}),(0,t.jsx)(r.default,{className:h.default.Button,handleClick:w,title:"Subscribe",interfaceGreen:!0,disabled:"submitting"===m||b?.length>0&&!v.length})]}),b?.length?(0,t.jsx)("ul",{className:h.default.TagsList,children:b.map(e=>(0,t.jsx)("li",{children:(0,t.jsx)(u,{label:e.label,value:e.listId,checked:v.includes(e.listId),onChange:t=>{t.target.checked?y([...v,e.listId]):y(v.filter(t=>t!==e.listId))}})},e.listId))}):null,p&&(0,t.jsx)("p",{className:(0,i.default)(h.default.Message,"error"===m&&h.default.Error),children:p})]})}],928535)},321801,e=>{e.v({Active:"MultiTabFaqs-module-scss-module__6PKqia__Active",CTA:"MultiTabFaqs-module-scss-module__6PKqia__CTA",CTAImage:"MultiTabFaqs-module-scss-module__6PKqia__CTAImage",CTALink:"MultiTabFaqs-module-scss-module__6PKqia__CTALink",CTATitle:"MultiTabFaqs-module-scss-module__6PKqia__CTATitle",Cont:"MultiTabFaqs-module-scss-module__6PKqia__Cont",Intro:"MultiTabFaqs-module-scss-module__6PKqia__Intro",Items:"MultiTabFaqs-module-scss-module__6PKqia__Items",Main:"MultiTabFaqs-module-scss-module__6PKqia__Main",MainTitle:"MultiTabFaqs-module-scss-module__6PKqia__MainTitle",MultiTabFaqs:"MultiTabFaqs-module-scss-module__6PKqia__MultiTabFaqs",Tab:"MultiTabFaqs-module-scss-module__6PKqia__Tab",Tabs:"MultiTabFaqs-module-scss-module__6PKqia__Tabs",TabsCont:"MultiTabFaqs-module-scss-module__6PKqia__TabsCont","paperbark-light":"MultiTabFaqs-module-scss-module__6PKqia__paperbark-light"})},248761,e=>{"use strict";var t=e.i(395633),i=e.i(131173),r=e.i(852756),s=e.i(7284),a=e.i(378081),o=e.i(5593),h=e.i(616827),c=e.i(170586),d=e.i(792668),u=e.i(321801);e.s(["default",0,function({title:e,tabs:p,background:f}){let m,[g,v]=(0,i.useState)(0),y=p?.[g];if(!y)return null;let{title:x,mainTitle:b,link:w,items:_}=y,S=(w?.linkType==="internal"||w?.linkType==="external")&&(0,a.getSanityLink)(w)||null,C=y.cta?.link??null,M=(C?.linkType==="internal"||C?.linkType==="external")&&(0,a.getSanityLink)(C)||null,E=y.cta&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(d.default,{className:u.default.CTAImage,image:y.cta.image}),y.cta.title&&(0,t.jsx)("div",{className:u.default.CTATitle,dangerouslySetInnerHTML:{__html:y.cta.title}}),M&&(0,t.jsx)(c.default,{className:u.default.CTALink,title:M.title,interfaceGreen:!0,asSpan:!0})]});return(0,t.jsxs)("section",{className:u.default.MultiTabFaqs,children:[e&&(0,t.jsx)("div",{className:(0,s.default)(u.default.MainTitle,"container"),children:(0,t.jsx)("h2",{dangerouslySetInnerHTML:{__html:e}})}),p&&p.length>1&&(0,t.jsx)("div",{className:(0,s.default)(u.default.TabsCont,"container"),children:(0,t.jsx)("div",{className:u.default.Tabs,role:"tablist",children:p.map((e,i)=>(0,t.jsx)("button",{className:(0,s.default)(u.default.Tab,i===g&&u.default.Active),onClick:()=>v(i),role:"tab","aria-selected":i===g,children:e.tabTitle},e._key))})}),(0,t.jsx)("div",{className:(0,s.default)(u.default.Main,f&&u.default[f]),children:(0,t.jsxs)("div",{className:(0,s.default)(u.default.Cont,"container"),children:[(0,t.jsxs)("div",{className:u.default.Intro,children:[(0,t.jsx)(h.default,{preTitle:x,title:b}),S&&(0,t.jsx)(c.default,{...S,darkGreen:!0}),y.cta&&(M?.url?(0,t.jsx)(r.default,{className:u.default.CTA,href:M.url,...(m=M.url,/^(https?:|tel:|mailto:)/.test(m)&&{target:"_blank",rel:"noreferrer"}),children:E}):(0,t.jsx)("div",{className:u.default.CTA,children:E}))]}),_&&_.length>0?(0,t.jsx)("div",{className:u.default.Items,children:(0,t.jsx)(o.default,{items:_,grey:"paperbark-light"!==f},y._key)}):null]})})]})}])},314859,e=>
8261{e.v({Control:"TabContainer-module-scss-module__gqOHWa__Control",Controls:"TabContainer-module-scss-module__gqOHWa__Controls",Copy:"TabContainer-module-scss-module__gqOHWa__Copy",CopyCont:"TabContainer-module-scss-module__gqOHWa__CopyCont",MainContent:"TabContainer-module-scss-module__gqOHWa__MainContent",MainContentCont:"TabContainer-module-scss-module__gqOHWa__MainContentCont",NoClick:"TabContainer-module-scss-module__gqOHWa__NoClick",Selected:"TabContainer-module-scss-module__gqOHWa__Selected",Subtitle:"TabContainer-module-scss-module__gqOHWa__Subtitle",TabContainer:"TabContainer-module-scss-module__gqOHWa__TabContainer",TitleCont:"TabContainer-module-scss-module__gqOHWa__TitleCont","animate-in":"TabContainer-module-scss-module__gqOHWa__animate-in"})},223147,e=>{e.v({Cont:"TechSpecs-module-scss-module__z--47q__Cont",Cta:"TechSpecs-module-scss-module__z--47q__Cta",FeatureCopy:"TechSpecs-module-scss-module__z--47q__FeatureCopy",FeatureIcon:"TechSpecs-module-scss-module__z--47q__FeatureIcon",FeatureTitle:"TechSpecs-module-scss-module__z--47q__FeatureTitle",Features:"TechSpecs-module-scss-module__z--47q__Features",Intro:"TechSpecs-module-scss-module__z--47q__Intro",SpecButtons:"TechSpecs-module-scss-module__z--47q__SpecButtons",SpecContent:"TechSpecs-module-scss-module__z--47q__SpecContent",SpecImage:"TechSpecs-module-scss-module__z--47q__SpecImage",SpecTitle:"TechSpecs-module-scss-module__z--47q__SpecTitle",Specs:"TechSpecs-module-scss-module__z--47q__Specs",TechSpecs:"TechSpecs-module-scss-module__z--47q__TechSpecs",Title:"TechSpecs-module-scss-module__z--47q__Title"})},656374,e=>{"use strict";var t=e.i(395633),i=e.i(131173),r=e.i(7284),s=e.i(792668),a=e.i(389264),o=e.i(616827),h=e.i(183102),c=e.i(826638),d=e.i(314859);function u({items:e,mainContent:r,selectedItem:s,setSelectedItem:a}){let o=(0,i.useRef)(null),p=(0,i.useRef)(null),f=e.map((e,t)=>({label:e.title,value:t}));return(0,t.jsx)("div",{className:d.default.TabContainer,ref:p,children:(0,t.jsx)(h.AnimatedElement,{delay:0,children:(0,t.jsxs)("div",{className:d.default.MainContentCont,children:[e&&(0,t.jsx)("div",{className:d.default.Controls,ref:o,children:(0,t.jsx)(c.default,{options:f,selectedOption:s,handleOptionClick:e=>a?(e=>{if(a(e),o.current){let t=o.current?.children?.item(e);o.current?.scrollTo({left:t?.offsetLeft,behavior:"smooth"})}})(e):()=>{},layoutId:"tab-controls",vertical:!0})}),(0,t.jsx)("div",{className:d.default.MainContent,children:r},s)]})})})}var p=e.i(378081),f=e.i(223147),m=e.i(170586);e.s(["default",0,function({preTitle:e,title:h,copy:c,specs:d,cta:g}){let v,[y,x]=(0,i.useState)(0);if(!d)return;let b=d[y];if(!b)return null;let{title:w,subtitle:_,copy:S,features:C}=b;return(0,t.jsx)("section",{className:f.default.TechSpecs,children:(0,t.jsxs)("div",{className:(0,r.default)(f.default.Cont,"container"),children:[(0,t.jsx)("div",{className:f.default.Intro,children:(0,t.jsx)(o.default,{preTitle:e,title:h,copy:c})}),(0,t.jsxs)("div",{className:(0,r.default)(f.default.Specs),children:[(0,t.jsx)(u,{items:d,selectedItem:y,setSelectedItem:x,mainContent:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:f.default.SpecContent,children:[w&&(0,t.jsx)("div",{className:(0,r.default)(f.default.SpecTitle,"smallCaps"),dangerouslySetInnerHTML:{__html:w}}),_&&(0,t.jsx)("h5",{dangerouslySetInnerHTML:{__html:_}}),S&&(0,t.jsx)(a.default,{className:"copy",copy:S,size:"small"})]}),C&&(0,t.jsx)("div",{className:f.default.Features,children:C.map((e,i)=>{let{icon:o,title:h,copy:c}=e;return(0,t.jsxs)("div",{className:f.default.Feature,children:[(0,t.jsx)("div",{className:f.default.FeatureIcon,children:o&&(0,t.jsx)(s.default,{image:o})}),h&&(0,t.jsx)("div",{className:(0,r.default)(f.default.FeatureTitle,"smallCaps"),dangerouslySetInnerHTML:{__html:h}}),c&&(0,t.jsx)(a.default,{className:"copy small",copy:c})]},i)})})]})}),g?.copy&&(0,t.jsxs)("div",{className:f.default.Cta,children:[(0,t.jsx)(a.default,{copy:g.copy}),g.link&&(v=(g.link?.linkType==="internal"||g.link?.linkType==="external")&&(0,p.getSanityLink)(g.link)||null,(0,t.jsx)(m.default,{...v,transparent:!0}))]})]})]})})}],656374)},28889,e=>{e.v({Active:"ImageAccordion-module-scss-module__vdvt-G__Active",Carousel:"ImageAccordion-module-scss-module__vdvt-G__Carousel",Cont:"ImageAccordion-module-scss-module__vdvt-G__Cont",Content:"ImageAccordion-module-scss-module__vdvt-G__Content",Copy:"ImageAccordion-module-scss-module__vdvt-G__Copy",Grid:"ImageAccordion-module-scss-module__vdvt-G__Grid",Image:"ImageAccordion-module-scss-module__vdvt-G__Image",ImageAccordion:"ImageAccordion-module-scss-module__vdvt-G__ImageAccordion",Intro:"ImageAccordion-module-scss-module__vdvt-G__Intro",Item:"ImageAccordion-module-scss-module__vdvt-G__Item",Navigation:"ImageAccordion-module-scss-module__vdvt-G__Navigation",Number:"ImageAccordion-module-scss-module__vdvt-G__Number",Overlay:"ImageAccordion-module-scss-module__vdvt-G__Overlay",PreTitle:"ImageAccordion-module-scss-module__vdvt-G__PreTitle",Slide:"ImageAccordion-module-scss-module__vdvt-G__Slide",Stat:"ImageAccordion-module-scss-module__vdvt-G__Stat",StatCopy:"ImageAccordion-module-scss-module__vdvt-G__StatCopy",Stats:"ImageAccordion-module-scss-module__vdvt-G__Stats",StatsIndex:"ImageAccordion-module-scss-module__vdvt-G__StatsIndex",Title:"ImageAccordion-module-scss-module__vdvt-G__Title"})},39509,e=>{"use strict";var t=e.i(395633),i=e.i(131173),r=e.i(7284),s=e.i(389264),a=e.i(792668),o=e.i(616827),h=e.i(488265),c=e.i(28889);function d({stat:e,active:i}){let{stat:s,prefix:a,suffix:o}=e||{};return s?(0,t.jsx)("div",{className:(0,r.default)(c.default.Number,"smallCaps"),children:(0,t.jsx)(h.default,{end:i?s:0,decimals:+!!s.toString().includes("."),duration:3,prefix:a||"",suffix:o||"",start:0})}):null}var u=e.i(440085),p=e.i(682623),f=e.i(308562);function m({items:e}){let r=(0,i.useRef)(null);if(e&&e?.length)return(0,t.jsxs)(u.Swiper,{ref:r,className:c.default.Swiper,modules:[f.A11y,p.Navigation],spaceBetween:0,slidesPerView:1.2,loop:!0,allowTouchMove:!0,children:[e.map((e,i)=>{let{image:r,copy:o,title:h,stats:p}=e;return(0,t.jsxs)(u.SwiperSlide,{className:c.default.Slide,children:[(0,t.jsxs)("div",{className:c.default.StatsIndex,children:["(",i+1,")"]}),(0,t.jsx)(a.default,{image:r}),(0,t.jsxs)("div",{className:c.default.Content,children:[(0,t.jsx)("h5",{className:c.default.Title,children:h}),(0,t.jsx)(s.default,{className:c.default.Copy,copy:o})]}),(0,t.jsx)("div",{className:c.default.Stats,children:p?.length&&p.map(e=>{let{fixedStat:i,copy:r}=e;return(0,t.jsxs)("div",{className:c.default.Stat,children:[i&&(0,t.jsx)("span",{className:c.default.FixedStat,children:i}),e.stat&&(0,t.jsx)(d,{stat:e,active:!0}),r&&(0,t.jsx)("div",{className:c.default.StatCopy,children:r})]},e._key)})})]},e._key)}),(0,t.jsxs)("div",{className:c.default.Navigation,children:[(0,t.jsx)("button",{onClick:()=>r?.current?.swiper.slidePrev(),children:"←"}),(0,t.jsx)("button",{onClick:()=>r?.current?.swiper.slideNext(),children:"→"})]})]})}e.s(["default",0,function({preTitle:e,title:h,copy:u,items:p}){let[f,g]=(0,i.useState)(0);return(0,t.jsxs)("section",{className:c.default.ImageAccordion,children:[(0,t.jsxs)("div",{className:(0,r.default)(c.default.Cont,"container"),children:[(0,t.jsx)("div",{className:c.default.Intro,children:(0,t.jsx)(o.default,{preTitle:e,title:h,copy:u})}),(0,t.jsx)("div",{className:c.default.Grid,children:p?.map((e,i)=>{let{image:o,title:h,copy:u,stats:p}=e||{};return(0,t.jsxs)("div",{onMouseEnter:()=>g(i),className:(0,r.default)(c.default.Item,f===i&&c.default.Active),children:[(0,t.jsx)("div",{className:c.default.Overlay}),(0,t.jsxs)("div",{className:c.default.Stats,children:[(0,t.jsxs)("div",{className:c.default.StatsIndex,children:["(",i+1,")"]}),p?.length&&p.map(e=>{let{fixedStat:r,copy:s}=e;return(0,t.jsxs)("div",{className:c.default.Stat,children:[r&&(0,t.jsx)("span",{className:c.default.FixedStat,children:r}),e.stat&&(0,t.jsx)(d,{stat:e,active:f===i}),s&&(0,t.jsx)("div",{className:c.default.StatCopy,children:s})]},e._key)})]}),(0,t.jsxs)("div",{className:c.default.Content,children:[(0,t.jsx)("h5",{className:c.default.Title,children:h}),(0,t.jsx)(s.default,{className:c.default.Copy,copy:u})]}),(0,t.jsx)("div",{className:c.default.Image,children:(0,t.jsx)(a.default,{image:o})})]},i)})})]}),(0,t.jsx)("div",{className:c.default.Carousel,children:(0,t.jsx)(m,{items:p})})]})}],39509)},83366,e=>{e.v({Active:"Timeline-module-scss-module__Mh6y_a__Active",Cont:"Timeline-module-scss-module__Mh6y_a__Cont",Control:"Timeline-module-scss-module__Mh6y_a__Control",Controls:"Timeline-module-scss-module__Mh6y_a__Controls",Copy:"Timeline-module-scss-module__Mh6y_a__Copy",Intro:"Timeline-module-scss-module__Mh6y_a__Intro",Item:"Timeline-module-scss-module__Mh6y_a__Item",ItemCopy:"Timeline-module-scss-module__Mh6y_a__ItemCopy",Items:"Timeline-module-scss-module__Mh6y_a__Items",Swiper:"Timeline-module-scss-module__Mh6y_a__Swiper",Timeline:"Timeline-module-scss-module__Mh6y_a__Timeline",Year:"Timeline-module-scss-module__Mh6y_a__Year"})},151328,e=>{"use strict";var t=e.i(395633),i=e.i(131173),r=e.i(7284),s=e.i(308562),a=e.i(682623),o=e.i(482231),h=e.i(640437);function c(e){let t,i,{swiper:r,extendParams:s,on:a,emit:c}=e,d=(0,o.a)();s({mousewheel:{enabled:!1,releaseOnEdges:!1,invert:!1,forceToAxis:!1,sensitivity:1,eventsTarget:"container",thresholdDelta:null,thresholdTime:null,noMousewheelClass:"swiper-no-mousewheel"}}),r.mousewheel={enabled:!1};let u=(0,h.f)(),p=[];function f(){r.enabled&&(r.mouseEntered=!0)}function m(){r.enabled&&(r.mouseEntered=!1)}function g(e){return!(r.params.mousewheel.thresholdDelta&&e.delta<r.params.mousewheel.thresholdDelta||r.params.mousewheel.thresholdTime&&(0,h.f)()-u<r.params.mousewheel.thresholdTime)&&(!!(e.delta>=6&&(0,h.f)()-u<60)||(e.direction<0?r.isEnd&&!r.params.loop||r.animating||(r.slideNext(),c("scroll",e.raw)):r.isBeginning&&!r.params.loop||r.animating||(r.slidePrev(),c("scroll",e.raw)),u=new d.Date().getTime(),!1))}function v(e){var s;let a,o,d,u,f=e;if(!r.enabled||e.target.closest(`.${r.params.mousewheel.noMousewheelClass}`))return;let m=r.params.mousewheel;r.params.cssMode&&f.preventDefault();let v=r.el;"container"!==r.params.mousewheel.eventsTarget&&(v=document.querySelector(r.params.mousewheel.eventsTarget));let y=v&&v.contains(f.target);if(!r.mouseEntered&&!y&&!m.releaseOnEdges)return!0;f.originalEvent&&(f=f.originalEvent);let x=0,b=r.rtlTranslate?-1:1,w=(a=0,o=0,d=0,u=0,"detail"in(s=f)&&(o=s.detail),"wheelDelta"in s&&
8261(o=-s.wheelDelta/120),"wheelDeltaY"in s&&(o=-s.wheelDeltaY/120),"wheelDeltaX"in s&&(a=-s.wheelDeltaX/120),"axis"in s&&s.axis===s.HORIZONTAL_AXIS&&(a=o,o=0),d=10*a,u=10*o,"deltaY"in s&&(u=s.deltaY),"deltaX"in s&&(d=s.deltaX),s.shiftKey&&!d&&(d=u,u=0),(d||u)&&s.deltaMode&&(1===s.deltaMode?(d*=40,u*=40):(d*=800,u*=800)),d&&!a&&(a=d<1?-1:1),u&&!o&&(o=u<1?-1:1),{spinX:a,spinY:o,pixelX:d,pixelY:u});if(m.forceToAxis)if(r.isHorizontal())if(!(Math.abs(w.pixelX)>Math.abs(w.pixelY)))return!0;else x=-w.pixelX*b;else{if(!(Math.abs(w.pixelY)>Math.abs(w.pixelX)))return!0;x=-w.pixelY}else x=Math.abs(w.pixelX)>Math.abs(w.pixelY)?-w.pixelX*b:-w.pixelY;if(0===x)return!0;m.invert&&(x=-x);let _=r.getTranslate()+x*m.sensitivity;if(_>=r.minTranslate()&&(_=r.minTranslate()),_<=r.maxTranslate()&&(_=r.maxTranslate()),(r.params.loop||_!==r.minTranslate()&&_!==r.maxTranslate())&&r.params.nested&&f.stopPropagation(),r.params.freeMode&&r.params.freeMode.enabled){let e={time:(0,h.f)(),delta:Math.abs(x),direction:Math.sign(x)},s=i&&e.time<i.time+500&&e.delta<=i.delta&&e.direction===i.direction;if(!s){i=void 0;let a=r.getTranslate()+x*m.sensitivity,o=r.isBeginning,d=r.isEnd;if(a>=r.minTranslate()&&(a=r.minTranslate()),a<=r.maxTranslate()&&(a=r.maxTranslate()),r.setTransition(0),r.setTranslate(a),r.updateProgress(),r.updateActiveIndex(),r.updateSlidesClasses(),(!o&&r.isBeginning||!d&&r.isEnd)&&r.updateSlidesClasses(),r.params.loop&&r.loopFix({direction:e.direction<0?"next":"prev",byMousewheel:!0}),r.params.freeMode.sticky){clearTimeout(t),t=void 0,p.length>=15&&p.shift();let s=p.length?p[p.length-1]:void 0,a=p[0];if(p.push(e),s&&(e.delta>s.delta||e.direction!==s.direction))p.splice(0);else if(p.length>=15&&e.time-a.time<500&&a.delta-e.delta>=1&&e.delta<=6){let s=x>0?.8:.2;i=e,p.splice(0),t=(0,h.n)(()=>{!r.destroyed&&r.params&&r.slideToClosest(r.params.speed,!0,void 0,s)},0)}t||(t=(0,h.n)(()=>{r.destroyed||!r.params||(i=e,p.splice(0),r.slideToClosest(r.params.speed,!0,void 0,.5))},500))}if(s||c("scroll",f),r.params.autoplay&&r.params.autoplay.disableOnInteraction&&r.autoplay.stop(),m.releaseOnEdges&&(a===r.minTranslate()||a===r.maxTranslate()))return!0}}else{let t={time:(0,h.f)(),delta:Math.abs(x),direction:Math.sign(x),raw:e};p.length>=2&&p.shift();let i=p.length?p[p.length-1]:void 0;if(p.push(t),i?(t.direction!==i.direction||t.delta>i.delta||t.time>i.time+150)&&g(t):g(t),function(e){let t=r.params.mousewheel;if(e.direction<0){if(r.isEnd&&!r.params.loop&&t.releaseOnEdges)return!0}else if(r.isBeginning&&!r.params.loop&&t.releaseOnEdges)return!0;return!1}(t))return!0}return f.preventDefault?f.preventDefault():f.returnValue=!1,!1}function y(e){let t=r.el;"container"!==r.params.mousewheel.eventsTarget&&(t=document.querySelector(r.params.mousewheel.eventsTarget)),t[e]("mouseenter",f),t[e]("mouseleave",m),t[e]("wheel",v)}function x(){return r.params.cssMode?(r.wrapperEl.removeEventListener("wheel",v),!0):!r.mousewheel.enabled&&(y("addEventListener"),r.mousewheel.enabled=!0,!0)}function b(){return r.params.cssMode?(r.wrapperEl.addEventListener(event,v),!0):!!r.mousewheel.enabled&&(y("removeEventListener"),r.mousewheel.enabled=!1,!0)}a("init",()=>{!r.params.mousewheel.enabled&&r.params.cssMode&&b(),r.params.mousewheel.enabled&&x()}),a("destroy",()=>{r.params.cssMode&&x(),r.mousewheel.enabled&&b()}),Object.assign(r.mousewheel,{enable:x,disable:b})}var d=e.i(440085),u=e.i(616827),p=e.i(83366);e.s(["default",0,function({preTitle:e,title:o,copy:h,items:f}){let m=(0,i.useRef)(null),[g,v]=(0,i.useState)(0);return(0,t.jsx)("section",{className:p.default.Timeline,children:(0,t.jsxs)("div",{className:(0,r.default)(p.default.Cont,"container"),children:[(0,t.jsx)("div",{className:p.default.Intro,children:(0,t.jsx)(u.default,{preTitle:e,title:o,copy:h})}),(0,t.jsxs)("div",{className:p.default.Items,children:[(0,t.jsx)("div",{className:p.default.Controls,children:f?.map((e,i)=>{let{year:s}=e;return(0,t.jsx)("div",{className:(0,r.default)(p.default.Control,"smallCaps",i===g?p.default.Active:""),onClick:()=>{m.current?.swiper.slideTo(i),v(i)},children:s},i)})}),(0,t.jsx)(d.Swiper,{className:p.default.Swiper,modules:[s.A11y,a.Navigation,c],direction:"vertical",spaceBetween:6,slidesPerView:"auto",allowTouchMove:!0,mousewheel:!0,ref:m,onSwiper:e=>{v(e.activeIndex)},onSlideChange:e=>{v(e.activeIndex)},children:f?.map((e,i)=>{let{year:r,copy:s}=e;return(0,t.jsxs)(d.SwiperSlide,{className:p.default.Item,children:[(0,t.jsx)("div",{className:p.default.Year,children:r}),(0,t.jsx)("div",{className:p.default.ItemCopy,children:s})]},i)})})]})]})})}],151328)},736344,e=>{e.v({ButtonRow:"JobBoard-module-scss-module__eB9APa__ButtonRow",Clear:"JobBoard-module-scss-module__eB9APa__Clear",Cont:"JobBoard-module-scss-module__eB9APa__Cont",Content:"JobBoard-module-scss-module__eB9APa__Content",CopyCont:"JobBoard-module-scss-module__eB9APa__CopyCont",Enquiry:"JobBoard-module-scss-module__eB9APa__Enquiry",EnquiryModal:"JobBoard-module-scss-module__eB9APa__EnquiryModal",EnquiryModalContainer:"JobBoard-module-scss-module__eB9APa__EnquiryModalContainer",EnquirySuccess:"JobBoard-module-scss-module__eB9APa__EnquirySuccess",Filters:"JobBoard-module-scss-module__eB9APa__Filters",FiltersOuter:"JobBoard-module-scss-module__eB9APa__FiltersOuter",Intro:"JobBoard-module-scss-module__eB9APa__Intro",Job:"JobBoard-module-scss-module__eB9APa__Job",JobBoard:"JobBoard-module-scss-module__eB9APa__JobBoard",JobInfo:"JobBoard-module-scss-module__eB9APa__JobInfo",JobMain:"JobBoard-module-scss-module__eB9APa__JobMain",Jobs:"JobBoard-module-scss-module__eB9APa__Jobs",Locations:"JobBoard-module-scss-module__eB9APa__Locations",NoJobs:"JobBoard-module-scss-module__eB9APa__NoJobs",Visible:"JobBoard-module-scss-module__eB9APa__Visible","animate-in":"JobBoard-module-scss-module__eB9APa__animate-in"})},736452,e=>{"use strict";var t=e.i(395633),i=e.i(131173),r=e.i(7284),s=e.i(352636),a=e.i(470989),o=e.i(616827),h=e.i(736344);e.s(["default",0,function({preTitle:e,title:c,jobs:d}){let[u,p]=(0,i.useMemo)(()=>{let e=d?d.reduce((e,{departments:t})=>(t?.forEach(({name:t})=>{t&&!e.includes(t)&&e.push(t)}),e),[]).map(e=>({value:e,label:e})):[],t=d?d.reduce((e,{location:{name:t}})=>{let i=t.trim();return e.includes(i)||e.push(i),e},[]).map(e=>({value:e,label:e})):[];return t.unshift({value:"All",label:"All Locations"}),e.unshift({value:"All",label:"All Departments"}),[e,t]},[d]);(0,i.useEffect)(()=>{let e=new URLSearchParams(window.location.search),t=e.get("department"),i=e.get("location");if(console.log(i,t),t){let e=u.find(e=>e.value.toLowerCase().includes(t.toLowerCase()));e&&m(e)}if(i){let e=p.find(e=>e.value.toLowerCase().includes(i.toLowerCase()));e&&v(e)}},[]);let[f,m]=(0,i.useState)(u[0]??{value:"All",label:"All Departments"}),[g,v]=(0,i.useState)(p[0]??{value:"All",label:"All Locations"}),y=d?d.filter(e=>"All"===f.value&&"All"===g.value||("All"===f.value?e.location?.name===g.value:"All"===g.value?e.departments.find(({name:e})=>e===f.value):e.departments.find(({name:e})=>e===f.value)&&e.location?.name===g.value)):null,x="All"!==f.value||"All"!==g.value;return(0,t.jsxs)("div",{className:(0,r.default)(h.default.Cont,"container"),children:[(0,t.jsxs)("div",{className:h.default.Intro,children:[(0,t.jsx)("div",{className:h.default.CopyCont,"data-bg-theme":"dark",children:(0,t.jsx)(o.default,{preTitle:e,title:c})}),u.length>2||p.length>2?(0,t.jsxs)("div",{className:h.default.FiltersOuter,children:[(0,t.jsx)("button",{className:(0,r.default)(h.default.Clear,x&&h.default.Visible),onClick:()=>{m(u[0]??{value:"All",label:"All Departments"}),v(p[0]??{value:"All",label:"All Locations"})},children:(0,t.jsx)("span",{className:"smallCaps",children:"X clear"})}),(0,t.jsxs)("ul",{className:h.default.Filters,children:[u.length>2&&(0,t.jsx)("li",{children:(0,t.jsx)(s.default,{classNamePrefix:"react-select-dark",options:u,value:f,onChange:e=>{e&&m(e)}})}),p.length>2&&(0,t.jsx)("li",{children:(0,t.jsx)(s.default,{classNamePrefix:"react-select-dark",options:p,value:g,onChange:e=>{e&&v(e)}})})]})]}):null]}),(0,t.jsx)("ul",{className:h.default.Jobs,children:y&&y.length>0?y.map((e,i)=>{let{id:r,title:s,location:{name:o},departments:c}=e,d="Full time";return(0,t.jsx)("li",{children:(0,t.jsx)(a.default,{href:`/careers/${r}`,children:(0,t.jsxs)("div",{className:h.default.Job,children:[(0,t.jsxs)("div",{className:h.default.JobMain,children:[c?.length&&(0,t.jsx)("span",{className:"smallCaps",dangerouslySetInnerHTML:{__html:c.map(({name:e})=>e).join(", ")}}),s&&(0,t.jsx)("h2",{dangerouslySetInnerHTML:{__html:s}})]}),(0,t.jsxs)("div",{className:h.default.JobInfo,children:[(0,t.jsx)("div",{children:d&&(0,t.jsx)("span",{className:"smallCaps",dangerouslySetInnerHTML:{__html:d}})}),(0,t.jsx)("ul",{className:h.default.Locations,children:(0,t.jsx)("li",{children:o&&(0,t.jsx)("span",{className:"smallCaps",dangerouslySetInnerHTML:{__html:o}})})})]})]})})},i)}):(0,t.jsx)("li",{children:(0,t.jsx)("span",{className:(0,r.default)(h.default.NoJobs,"smallCaps"),children:"No Jobs found"})})},`${f.value}-${g.value}`)]})}])},12209,e=>
8261{e.v({BackgroundVideo:"LocationShowcase-module-scss-module__W6feBa__BackgroundVideo",Cont:"LocationShowcase-module-scss-module__W6feBa__Cont",Content:"LocationShowcase-module-scss-module__W6feBa__Content",Detail:"LocationShowcase-module-scss-module__W6feBa__Detail",DetailCopy:"LocationShowcase-module-scss-module__W6feBa__DetailCopy",DetailTitle:"LocationShowcase-module-scss-module__W6feBa__DetailTitle",Details:"LocationShowcase-module-scss-module__W6feBa__Details",GradientOverlay:"LocationShowcase-module-scss-module__W6feBa__GradientOverlay",LocationShowcase:"LocationShowcase-module-scss-module__W6feBa__LocationShowcase",Main:"LocationShowcase-module-scss-module__W6feBa__Main",Partner:"LocationShowcase-module-scss-module__W6feBa__Partner",Partners:"LocationShowcase-module-scss-module__W6feBa__Partners",PartnersList:"LocationShowcase-module-scss-module__W6feBa__PartnersList",Title:"LocationShowcase-module-scss-module__W6feBa__Title"})},150894,e=>{"use strict";var t=e.i(395633),i=e.i(7284),r=e.i(131173),s=e.i(270744),a=e.i(329316),o=e.i(404204),h=e.i(440855),c=e.i(616827),d=e.i(12209),u=e.i(792668);e.s(["default",0,function({preTitle:e,title:p,backgroundVideo:f,details:m,partners:g}){let v=(0,r.useRef)(null),{scrollYProgress:y}=(0,a.useScroll)({target:v,offset:["start end","center center"]}),x=(0,o.useTransform)(y,[0,1],["100%","0%"]);return(0,t.jsx)("section",{className:d.default.LocationShowcase,children:(0,t.jsx)("div",{className:(0,i.default)(d.default.Cont,"container"),children:(0,t.jsxs)("div",{className:d.default.Main,ref:v,children:[(0,t.jsxs)("div",{className:d.default.Content,"data-bg-theme":"dark",children:[(0,t.jsx)(c.default,{preTitle:e}),(0,t.jsx)("div",{className:d.default.Title,children:(0,t.jsx)(c.default,{title:p})}),(0,t.jsxs)("div",{className:d.default.Details,children:[m?.length&&m.map(e=>(0,t.jsxs)("div",{className:d.default.Detail,children:[(0,t.jsx)("p",{className:(0,i.default)(d.default.DetailTitle,"smallCaps"),children:e.title}),(0,t.jsx)("p",{className:d.default.DetailCopy,children:e.copy})]},e._key)),g?.length&&(0,t.jsxs)("div",{className:(0,i.default)(d.default.Detail,d.default.Partners),children:[(0,t.jsx)("p",{className:(0,i.default)(d.default.DetailTitle,"smallCaps"),children:"Supported by:"}),(0,t.jsx)("div",{className:d.default.PartnersList,children:g.map(e=>(0,t.jsx)("div",{className:d.default.Partner,children:(0,t.jsx)(u.default,{image:e})},e._key))})]})]})]}),f&&(0,t.jsxs)("div",{className:d.default.BackgroundVideo,children:[(0,t.jsx)(h.default,{video:f.file,darken:!0,autoPlay:!0}),(0,t.jsx)(s.motion.div,{className:d.default.GradientOverlay,style:{translateY:x}})]})]})})})}])},924039,e=>{e.v({Cont:"Contact-module-scss-module__jS286a__Cont",Contact:"Contact-module-scss-module__jS286a__Contact",Contacts:"Contact-module-scss-module__jS286a__Contacts",Form:"Contact-module-scss-module__jS286a__Form",Intro:"Contact-module-scss-module__jS286a__Intro"})},945695,e=>{"use strict";var t=e.i(395633),i=e.i(131173),r=e.i(7284),s=e.i(360474),a=e.i(372191),o=e.i(616827),h=e.i(924039),c=e.i(618915);e.s(["default",0,function({preTitle:e,title:d,form:u,contacts:p}){let[f,m]=(0,i.useState)(!1),{formSparkID:g,formBuilder:v,completionMessage:y,buttonTitle:x}=u??{},b=v?.formRows?.map(e=>({...e,formFields:e.formFields?.map(e=>({fieldId:e.fieldId||{current:e._key},label:e.label||e.placeholder,type:e.inputType||"text",required:e.required,placeholder:e.placeholder,options:e.options,hubSpotKey:e.hubSpotKey,_key:e._key}))||[]}))||[];return(0,t.jsx)("section",{className:h.default.Contact,children:(0,t.jsxs)("div",{className:(0,r.default)(h.default.Cont,"container"),children:[(0,t.jsxs)("div",{className:h.default.Intro,children:[(0,t.jsx)(o.default,{preTitle:e,title:d}),p?.length?(0,t.jsx)("ul",{className:h.default.Contacts,children:p.map(e=>(0,t.jsx)("li",{children:(0,t.jsxs)("a",{href:e.href,target:"_blank",rel:"noopener noreferrer",children:[e.icon&&(0,t.jsx)("span",{className:h.default.Icon,children:c.icons[e.icon]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("small",{className:h.default.Label,children:e.label}),(0,t.jsx)("span",{className:h.default.Value,children:e.value})]})]})},e._key))}):null]}),(0,t.jsxs)("div",{className:h.default.Form,children:[v&&g&&(0,t.jsx)(s.FormComponent,{formRows:b,formId:g,setFormSubmitted:m,buttonTitle:x,colourScheme:"light",postToHubSpot:v?.postToHubSpot}),(0,t.jsx)(a.default,{title:y?.title,body:y?.body,visible:f})]})]})})}])},821062,e=>{e.v({Active:"TabsWithPoints-module-scss-module__Xr3J6W__Active",Cont:"TabsWithPoints-module-scss-module__Xr3J6W__Cont",Content:"TabsWithPoints-module-scss-module__Xr3J6W__Content",Copy:"TabsWithPoints-module-scss-module__Xr3J6W__Copy",HasPoints:"TabsWithPoints-module-scss-module__Xr3J6W__HasPoints",Image:"TabsWithPoints-module-scss-module__Xr3J6W__Image",Intro:"TabsWithPoints-module-scss-module__Xr3J6W__Intro",Item:"TabsWithPoints-module-scss-module__Xr3J6W__Item",Link:"TabsWithPoints-module-scss-module__Xr3J6W__Link",LinkCopy:"TabsWithPoints-module-scss-module__Xr3J6W__LinkCopy",LinkImage:"TabsWithPoints-module-scss-module__Xr3J6W__LinkImage",LinkMain:"TabsWithPoints-module-scss-module__Xr3J6W__LinkMain",Links:"TabsWithPoints-module-scss-module__Xr3J6W__Links",LinksTitle:"TabsWithPoints-module-scss-module__Xr3J6W__LinksTitle",List:"TabsWithPoints-module-scss-module__Xr3J6W__List",ListItem:"TabsWithPoints-module-scss-module__Xr3J6W__ListItem",Main:"TabsWithPoints-module-scss-module__Xr3J6W__Main",Point:"TabsWithPoints-module-scss-module__Xr3J6W__Point",PointCopy:"TabsWithPoints-module-scss-module__Xr3J6W__PointCopy",Points:"TabsWithPoints-module-scss-module__Xr3J6W__Points",Tabs:"TabsWithPoints-module-scss-module__Xr3J6W__Tabs",TabsCont:"TabsWithPoints-module-scss-module__Xr3J6W__TabsCont",TabsWithPoints:"TabsWithPoints-module-scss-module__Xr3J6W__TabsWithPoints"})},850187,e=>{"use strict";var t=e.i(395633),i=e.i(131173),r=e.i(7284),s=e.i(616827),a=e.i(730399),o=e.i(399909),h=e.i(389264),c=e.i(821062);function d({subTitle:e,copy:i,contentKey:r}){return(0,t.jsx)(a.AnimatePresence,{mode:"wait",children:(0,t.jsxs)(o.div,{className:c.default.Content,initial:{opacity:0,y:5}
8261,animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.2,delay:.05},children:[e&&(0,t.jsx)("h5",{children:e}),i&&(0,t.jsx)("div",{className:c.default.Copy,children:(0,t.jsx)(h.default,{copy:i,size:"small"})})]},r)})}var u=e.i(792668),p=e.i(440855);function f({title:e,image:i,video:s,points:h,contentKey:d}){return(0,t.jsxs)(a.AnimatePresence,{mode:"wait",children:[e&&(0,t.jsx)("h4",{children:e}),(0,t.jsxs)(o.div,{className:(0,r.default)(c.default.Item,h&&h?.length>0&&c.default.HasPoints),initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:[s?(0,t.jsx)(p.default,{video:s?.file,darken:!1}):i&&(0,t.jsx)("div",{className:c.default.Image,children:(0,t.jsx)(u.default,{image:i})}),h&&h?.length>0&&(0,t.jsx)(o.div,{className:c.default.Points,initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2,delay:.1},children:h.map((e,i)=>{let{title:r,copy:s}=e;return(0,t.jsxs)("div",{className:c.default.Point,children:[r&&(0,t.jsx)("div",{children:r}),s&&(0,t.jsx)("div",{className:c.default.PointCopy,children:s})]},i)})},d)]},d)]})}var m=e.i(378081),g=e.i(470989);function v({linksTitle:e,links:i,contentKey:s}){return i&&0!==i.length?(0,t.jsx)(a.AnimatePresence,{mode:"wait",children:(0,t.jsxs)(o.div,{className:c.default.Links,initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2,delay:.1},children:[e&&(0,t.jsx)("div",{className:(0,r.default)(c.default.LinksTitle,"smallCaps"),children:e}),i&&i.length>0&&(0,t.jsx)("ul",{children:i.map((e,i)=>{let{link:s,image:a,copy:o}=e,h=(s?.linkType==="internal"||s?.linkType==="external")&&(0,m.getSanityLink)(s)||null;return h?(0,t.jsx)("li",{children:(0,t.jsxs)(g.default,{href:h?.url,className:c.default.Link,children:[(0,t.jsx)("div",{className:c.default.LinkImage,children:a&&(0,t.jsx)(u.default,{image:a})}),(0,t.jsxs)("div",{className:c.default.LinkMain,children:[(0,t.jsxs)("div",{className:c.default.LinkTitle,children:[h?.title," →"]}),(0,t.jsx)("div",{className:(0,r.default)(c.default.LinkCopy,"smallCaps"),children:o})]})]})},i):null})})]},s)}):null}e.s(["default",0,function({title:e,items:a}){let[o,h]=(0,i.useState)(0),u=(0,i.useRef)([]);return(0,i.useEffect)(()=>{let e=[];return u.current.forEach((t,i)=>{if(!t)return;let r=new IntersectionObserver(e=>{e.forEach(e=>{e.isIntersecting&&h(i)})},{root:null,rootMargin:"-50% 0px -50% 0px",threshold:0});r.observe(t),e.push(r)}),()=>{e.forEach(e=>e.disconnect())}},[a]),(0,t.jsx)("section",{className:c.default.TabsWithPoints,children:(0,t.jsxs)("div",{className:(0,r.default)(c.default.Cont,"container"),children:[(0,t.jsx)("div",{className:c.default.Intro,children:(0,t.jsx)(s.default,{preTitle:e})}),(0,t.jsxs)("div",{className:c.default.Main,children:[(0,t.jsxs)("div",{className:c.default.TabsCont,children:[(0,t.jsx)("div",{className:c.default.Tabs,children:a?.map((e,i)=>{let{title:s}=e;return(0,t.jsx)("button",{className:(0,r.default)(c.default.Tab,i===o&&c.default.Active),onClick:()=>{let e;return h(i),void((e=document.getElementById(`tabs-item-${i}`))&&e.scrollIntoView({behavior:"smooth",block:"start"}))},children:s},i)})}),a&&a?.length>0&&(0,t.jsx)(d,{...a[o],contentKey:o})]}),(0,t.jsx)("div",{className:c.default.List,children:a?.map((e,i)=>(0,t.jsxs)("div",{className:(0,r.default)(c.default.ListItem,{[c.default.Active]:i===o}),id:`tabs-item-${i}`,ref:e=>{u.current[i]=e},children:[(0,t.jsx)(f,{...e,contentKey:i}),(0,t.jsx)(d,{...e,contentKey:i}),e?.links&&e?.links?.length>0&&(0,t.jsx)(v,{...e,contentKey:i})]},i))})]})]})})}],850187)},877356,e=>{e.v({Cont:"Roadmap-module-scss-module__wpNawG__Cont",Content:"Roadmap-module-scss-module__wpNawG__Content",Copy:"Roadmap-module-scss-module__wpNawG__Copy",Intro:"Roadmap-module-scss-module__wpNawG__Intro",Milestone:"Roadmap-module-scss-module__wpNawG__Milestone",MilestoneFigure:"Roadmap-module-scss-module__wpNawG__MilestoneFigure",MilestoneSuffix:"Roadmap-module-scss-module__wpNawG__MilestoneSuffix",Navigation:"Roadmap-module-scss-module__wpNawG__Navigation",Roadmap:"Roadmap-module-scss-module__wpNawG__Roadmap",RoadmapContent:"Roadmap-module-scss-module__wpNawG__RoadmapContent",RoadmapItem:"Roadmap-module-scss-module__wpNawG__RoadmapItem",Subtitle:"Roadmap-module-scss-module__wpNawG__Subtitle",Title:"Roadmap-module-scss-module__wpNawG__Title"})},936326,e=>{"use strict";var t=e.i(395633),i=e.i(7284),r=e.i(308562),s=e.i(682623),a=e.i(440085),o=e.i(389264),h=e.i(616827),c=e.i(877356),d=e.i(131173),u=e.i(618915);e.s(["default",0,function({preTitle:e,title:p,copy:f,items:m,hidden:g}){let[v,y]=(0,d.useState)(null),[x,b]=(0,d.useState)(null);return g?null:(0,t.jsx)("section",{className:c.default.Roadmap,children:(0,t.jsxs)("div",{className:(0,i.default)(c.default.Cont,"container"),children:[(0,t.jsx)("div",{className:c.default.Intro,children:(0,t.jsx)(h.default,{preTitle:e,title:p})}),(0,t.jsxs)("div",{className:c.default.Content,children:[(0,t.jsx)("div",{className:c.default.Copy,children:(0,t.jsx)(o.default,{copy:f})}),(0,t.jsxs)("div",{className:c.default.RoadmapContent,children:[m?.length&&v&&x&&(0,t.jsx)(a.Swiper,{className:c.default.Swiper,modules:[r.A11y,s.Navigation],slidesPerView:"auto",allowTouchMove:!0,breakpoints:{1260:{allowTouchMove:!1}},loop:!1,navigation:{prevEl:v,nextEl:x},children:m.map(e=>{let{title:r,subtitle:s,milestones:o}=e;return(0,t.jsx)(a.SwiperSlide,{className:c.default.RoadmapItem,children:(0,t.jsxs)("div",{children:[(0,t.jsx)("h4",{className:c.default.Title,children:r}),(0,t.jsx)("h5",{className:c.default.Subtitle,children:s}),o?.length&&(0,t.jsx)("div",{className:c.default.Goals,children:o.map(e=>{let{year:r,figure:s,figureSuffix:a}=e;return(0,t.jsxs)("div",{className:c.default.Milestone,children:[(0,t.jsx)("div",{className:(0,i.default)(c.default.MilestoneYear,"smallCaps"),children:r}),(0,t.jsxs)("div",{className:c.default.MilestoneFigure,children:[s,(0,t.jsx)("span",{className:(0,i.default)(c.default.MilestoneSuffix,"smallCaps"),children:a})]})]},e._key)})})]})},e._key)})}),(0,t.jsxs)("div",{className:c.default.Navigation,children:[(0,t.jsxs)("button",{ref:e=>y(e),className:(0,i.default)(c.default.NavButton,c.default.Prev),"aria-label":"Previous",children:[(0,t.jsx)("span",{className:"sr-only",children:"Previous"}),u.icons.arrowLeft]}),(0,t.jsxs)("button",{ref:e=>b(e),className:(0,i.default)(c.default.NavButton,c.default.Next),"aria-label":"Next",children:[(0,t.jsx)("span",{className:"sr-only",children:"Next"}),u.icons.arrowRight]})]})]})]})]})})}])},231573,e=>{"use strict";var t=e.i(395633);let i=(0,t.jsx)("svg",{width:"22",height:"22",viewBox:"0 0 22 22",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,t.jsx)("path",{d:"M18.7283 21.3013L11.0098 13.5828L3.29122 21.3013L0.718366 18.7285L8.43692 11.0099L0.718366 3.2914L3.29122 0.718549L11.0098 8.4371L18.7283 0.718549L21.3012 3.2914L13.5826 11.0099L21.3012 18.7285L18.7283 21.3013Z",fill:"#660033"})});e.s(["default",0,i])},865841,e=>{e.v({Backdrop:"Modal-module-scss-module__k1ZY8q__Backdrop",Close:"Modal-module-scss-module__k1ZY8q__Close",FadeOut:"Modal-module-scss-module__k1ZY8q__FadeOut",Modal:"Modal-module-scss-module__k1ZY8q__Modal",ModalContainer:"Modal-module-scss-module__k1ZY8q__ModalContainer",ModalMain:"Modal-module-scss-module__k1ZY8q__ModalMain",Show:"Modal-module-scss-module__k1ZY8q__Show"})},785302,e=>{e.v({Cont:"VideoGrid-module-scss-module__wbWCtq__Cont",Grid:"VideoGrid-module-scss-module__wbWCtq__Grid",Item:"VideoGrid-module-scss-module__wbWCtq__Item",Main:"VideoGrid-module-scss-module__wbWCtq__Main",VideoGrid:"VideoGrid-module-scss-module__wbWCtq__VideoGrid"})},502297,e=>{"use strict";let t;var i=e.i(395633),r=e.i(131173);let s=/\.(m4a|m4b|mp4a|mpga|mp2|mp2a|mp3|m2a|m3a|wav|weba|aac|oga|spx)($|\?)/i,a=/\.(mp4|og[gv]|webm|mov|m4v)(#t=[,\d+]+)?($|\?)/i,o=/\.(m3u8)($|\?)/i,h=/\.(mpd)($|\?)/i,c=/stream\.mux\.com\/(?!\w+\.m3u8)(\w+)/,d=/(?:youtu\.be\/|youtube(?:-nocookie|education)?\.com\/(?:embed\/|v\/|watch\/|wat
8261ch\?v=|watch\?.+&v=|shorts\/|live\/))((\w|-){11})|youtube\.com\/playlist\?list=|youtube\.com\/user\//,u=/vimeo\.com\/(?!progressive_redirect).+/,p=/(?:wistia\.(?:com|net)|wi\.st)\/(?:medias|embed)\/(?:iframe\/)?([^?]+)/,f=/open\.spotify\.com\/(\w+)\/(\w+)/i,m=/(?:www\.|go\.)?twitch\.tv\/([a-zA-Z0-9_]+|(videos?\/|\?video=)\d+)($|\?)/,g=/tiktok\.com\/(?:player\/v1\/|share\/video\/|@[^/]+\/video\/)([0-9]+)/,v=(e,t)=>{if(Array.isArray(e)){for(let i of e)if("string"==typeof i&&v(i,t)||v(i.src,t))return!0;return!1}return t(e)},y=r.default.forwardRef((e,t)=>{let i=s.test(`${e.src}`)?"audio":"video";return r.default.createElement(i,{...e,ref:t},e.children)}),x=[{key:"hls",name:"hls.js",canPlay:e=>v(e,e=>o.test(e)),canEnablePIP:()=>!0,player:(0,r.lazy)(()=>e.A(525231))},{key:"dash",name:"dash.js",canPlay:e=>v(e,e=>h.test(e)),canEnablePIP:()=>!0,player:(0,r.lazy)(()=>e.A(580967))},{key:"mux",name:"Mux",canPlay:e=>c.test(e),canEnablePIP:()=>!0,player:(0,r.lazy)(()=>e.A(333890))},{key:"youtube",name:"YouTube",canPlay:e=>d.test(e),player:(0,r.lazy)(()=>e.A(321416))},{key:"vimeo",name:"Vimeo",canPlay:e=>u.test(e)&&!a.test(e)&&!o.test(e),player:(0,r.lazy)(()=>e.A(513417))},{key:"wistia",name:"Wistia",canPlay:e=>p.test(e),canEnablePIP:()=>!0,player:(0,r.lazy)(()=>e.A(132681))},{key:"spotify",name:"Spotify",canPlay:e=>f.test(e),canEnablePIP:()=>!1,player:(0,r.lazy)(()=>e.A(263731))},{key:"twitch",name:"Twitch",canPlay:e=>m.test(e),canEnablePIP:()=>!1,player:(0,r.lazy)(()=>e.A(217524))}
8261,{key:"tiktok",name:"TikTok",canPlay:e=>g.test(e),canEnablePIP:()=>!1,player:(0,r.lazy)(()=>e.A(63586))},{key:"html",name:"html",canPlay:e=>v(e,e=>s.test(e)||a.test(e)),canEnablePIP:()=>!0,player:y}],b={width:"320px",height:"180px",volume:1,playbackRate:1,previewTabIndex:0,previewAriaLabel:"",oEmbedUrl:"https://noembed.com/embed?url={url}"},w=r.default.forwardRef((e,t)=>{let{playing:i,pip:s}=e,a=e.activePlayer,o=(0,r.useRef)(null),h=(0,r.useRef)(!0);if((0,r.useEffect)(()=>{var t,r;o.current&&(o.current.paused&&!0===i&&o.current.play(),o.current.paused||!1!==i||o.current.pause(),o.current.playbackRate=null!=(t=e.playbackRate)?t:1,o.current.volume=null!=(r=e.volume)?r:1)}),(0,r.useEffect)(()=>{var e,t,i,r,a;if(o.current&&globalThis.document){if(s&&!document.pictureInPictureElement)try{null==(t=(e=o.current).requestPictureInPicture)||t.call(e)}catch(e){}if(!s&&document.pictureInPictureElement)try{null==(r=(i=o.current).exitPictureInPicture)||r.call(i),null==(a=document.exitPictureInPicture)||a.call(document)}catch(e){}}},[s]),!a)return null;let c={},d=["onReady","onStart"];for(let t in e)t.startsWith("on")&&!d.includes(t)&&(c[t]=e[t]);return r.default.createElement(a,{...c,style:e.style,className:e.className,slot:e.slot,ref:(0,r.useCallback)(e=>{o.current=e,"function"==typeof t?t(e):null!==t&&(t.current=e)},[t]),src:e.src,crossOrigin:e.crossOrigin,preload:e.preload,controls:e.controls,muted:e.muted,autoPlay:e.autoPlay,loop:e.loop,playsInline:e.playsInline,config:e.config,onLoadStart:t=>{var i,r;h.current=!0,null==(i=e.onReady)||i.call(e),null==(r=e.onLoadStart)||r.call(e,t)},onPlay:t=>{var i,r;h.current&&(h.current=!1,null==(i=e.onStart)||i.call(e,t)),null==(r=e.onPlay)||r.call(e,t)}},e.children)});w.displayName="Player";let _=(0,r.lazy)(()=>e.A(782814)),S=[],C=({children:e})=>e,M=x[x.length-1];var E=((t=r.default.forwardRef((e,t)=>{let i={...b,...e},{src:s,slot:a,className:o,style:h,width:c,height:d,fallback:u,wrapper:p}=i,[f,m]=(0,r.useState)(!!i.light);(0,r.useEffect)(()=>{i.light?m(!0):m(!1)},[i.light]);let g=e=>{var t;m(!1),null==(t=i.onClickPreview)||t.call(i,e)},v=null==p?C:p,y=!1===u?C:r.Suspense;return r.default.createElement(v,{slot:a,className:o,style:{width:c,height:d,...h}},r.default.createElement(y,{fallback:u},f?(e=>{if(!e)return null;let{light:t,playIcon:s,previewTabIndex:a,oEmbedUrl:o,previewAriaLabel:h}=i;return r.default.createElement(_,{src:e,light:t,playIcon:s,previewTabIndex:a,previewAriaLabel:h,oEmbedUrl:o,onClickPreview:g})})(s):(e=>{var s,h;let c=(e=>{for(let t of[...S,...x])if(e&&t.canPlay(e))return t;return M||null})(e);if(!c)return null;let{style:d,width:u,height:p,wrapper:f}=i,m=null==(s=i.config)?void 0:s[c.key];return r.default.createElement(w,{...i,ref:t,activePlayer:null!=(h=c.player)?h:c,slot:f?void 0:a,className:f?void 0:o,style:f?{display:"block",width:"100%",height:"100%"}:{display:"block",width:u,height:p,...d},config:m})})(s)))})).displayName="ReactPlayer",t.addCustomPlayer=e=>{S.push(e)},t.removeCustomPlayers=()=>{S.length=0},t.canPlay=e=>{if(e){for(let t of[...S,...x])if(t.canPlay(e))return!0}return!1},t.canEnablePIP=e=>{var t;if(e){for(let i of[...S,...x])if(i.canPlay(e)&&(null==(t=i.canEnablePIP)?void 0:t.call(i)))return!0}return!1},t),A=e.i(792668),T=e.i(440855),P=e.i(170586),D=e.i(222502),O=e.i(7284),L=e.i(231573),I=e.i(865841);let R=({children:e,close:t,hideClose:s,triggerClose:a,centred:o,containerClassName:h})=>{let[c,d]=(0,r.useState)(!1),[u,p]=(0,r.useState)(!1);(0,r.useEffect)(()=>{if(e){let e,t;d(!0),e=window.scrollX,t=window.scrollY,window.onscroll=function(){window.scrollTo(e,t)}}else d(!1)},[e]);let f=(0,r.useCallback)(()=>{p(!0),setTimeout(()=>{t()},150),window.onscroll=function(){};let e=new URL(window.location.href);e.searchParams.delete("m"),window.history.pushState({},"",e)},[t]);return(0,r.useEffect)(()=>{let e=e=>"Escape"===e.key?f():null;return document.body.addEventListener("keydown",e),()=>{document.body.removeEventListener("keydown",e)}},[f]),(0,r.useEffect)(()=>{a&&f()},[a,f]),D.default.createPortal((0,i.jsxs)("div",{className:(0,O.default)(I.default.Modal,c&&I.default.Show,u&&I.default.FadeOut,o&&I.default.Centred),children:[(0,i.jsx)("div",{className:I.default.Backdrop,onClick:f}),(0,i.jsxs)("div",{className:(0,O.default)(I.default.ModalContainer,h),children:[(0,i.jsx)("div",{className:I.default.ModalMain,children:(0,i.jsx)("div",{children:e})}),s?null:(0,i.jsx)("div",{className:I.default.Close,onClick:f,children:L.default})]})]}),document.getElementById("modal"))};var k=e.i(785302);e.s(["default",0,function({video:e}){let[t,s]=(0,r.useState)(!1);if(!e)return null;let{title:a,video:o,youtubeVideo:h,previewVideo:c,posterImage:d}=e;return(0,i.jsxs)("div",{className:k.default.Item,onClick:()=>s(!0),children:[(0,i.jsxs)("div",{className:k.default.Main,children:[c?(0,i.jsx)(T.default,{video:c.video}):d&&(0,i.jsx)(A.default,{image:d}),(0,i.jsx)(P.default,{title:"Play Video",interfaceGreen:!0})]}),a&&(0,i.jsx)("div",{className:"smallCaps",children:a}),t&&(0,i.jsx)(R,{close:()=>s(!1),children:(0,i.jsx)("div",{className:k.default.Modal,children:h?(0,i.jsx)(E,{src:h,playing:!0,style:{width:"100%",height:"auto",aspectRatio:"16/9"},controls:!0}):o?.video&&(0,i.jsx)(T.default,{video:o.video,darken:!1,controls:!0})})})]})}],502297)},666170,e=>{e.v({Backdrop:"PrincipleModal-module-scss-module__JPR_Tq__Backdrop",Close:"PrincipleModal-module-scss-module__JPR_Tq__Close",Excerpt:"PrincipleModal-module-scss-module__JPR_Tq__Excerpt",Intro:"PrincipleModal-module-scss-module__JPR_Tq__Intro",Modal:"PrincipleModal-module-scss-module__JPR_Tq__Modal",ModalColumns:"PrincipleModal-module-scss-module__JPR_Tq__ModalColumns",ModalContainer:"PrincipleModal-module-scss-module__JPR_Tq__ModalContainer",ModalContent:"PrincipleModal-module-scss-module__JPR_Tq__ModalContent",ModalImage:"PrincipleModal-module-scss-module__JPR_Tq__ModalImage",ModalMain:"PrincipleModal-module-scss-module__JPR_Tq__ModalMain",Show:"PrincipleModal-module-scss-module__JPR_Tq__Show"})},940712,e=>{e.v({Clickable:"Principle-module-scss-module__MIRYmq__Clickable",Excerpt:"Principle-module-scss-module__MIRYmq__Excerpt",Principle:"Principle-module-scss-module__MIRYmq__Principle",Thumbnail:"Principle-module-scss-module__MIRYmq__Thumbnail"})},666728,e=>{"use strict";var t=e.i(395633),i=e.i(131173),r=e.i(7284),s=e.i(792668),a=e.i(222502),o=e.i(389264),h=e.i(231573),c=e.i(666170);function d({principle:e,index:u,close:p}){let[f,m]=(0,i.useState)(!1),{title:g,image:v,column1:y,column2:x,excerpt:b,thumbnail:w,thumbnailVideo:_}=e;(0,i.useEffect)(()=>{m(!0)},[]);let S=(0,i.useCallback)(()=>{m(!1),setTimeout(p,500)},[p]);(0,i.useEffect)(()=>{let e=e=>"Escape"===e.key&&S();return document.body.addEventListener("keydown",e),()=>document.body.removeEventListener("keydown",e)},[S]);let C=document.getElementById("principle-modal");return C?a.default.createPortal((0,t.jsxs)("div",{className:(0,r.default)(c.default.Modal,f&&c.default.Show),children:[(0,t.jsx)("div",{className:c.default.Backdrop,onClick:S}),(0,t.jsxs)("div",{className:c.default.ModalContainer,children:[(0,t.jsxs)("div",{className:c.default.ModalMain,children:[(0,t.jsxs)("div",{className:c.default.ModalContent,children:[(0,t.jsxs)("div",{className:c.default.Intro,"data-count":u+1,children:[(0,t.jsx)("h4",{children:g}),b&&(0,t.jsx)("div",{className:c.default.Excerpt,children:b})]}),(0,t.jsxs)("div",{className:c.default.ModalColumns,children:[y&&(0,t.jsx)(o.default,{copy:y,size:"small"}),x&&(0,t.jsx)(o.default,{copy:x,size:"small"})]})]}),(0,t.jsxs)("div",{className:c.default.ModalImage,children:[_&&(0,t.jsx)("video",{autoPlay:!0,loop:!0,muted:!0,playsInl
8261ine:!0,className:c.default.Video,children:(0,t.jsx)("source",{src:_?.file?.asset?.fileURL,type:_.file.mimeType})}),w&&(0,t.jsx)(s.default,{image:w})]})]}),(0,t.jsx)("div",{className:c.default.Close,onClick:S,children:h.default})]})]}),C):null}var u=e.i(940712);e.s(["default",0,function({principle:e,index:a,last:o}){let[h,c]=(0,i.useState)(!1),{title:p,thumbnail:f,thumbnailVideo:m,excerpt:g,image:v,column1:y,column2:x}=e,b=v||y||x;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:(0,r.default)(u.default.Principle,b&&u.default.Clickable,o&&u.default.Last),onClick:()=>b&&c(!0),"data-count":a+1,children:[(0,t.jsxs)("div",{className:u.default.Thumbnail,children:[m&&(0,t.jsx)("video",{autoPlay:!0,loop:!0,muted:!0,playsInline:!0,className:u.default.Video,children:(0,t.jsx)("source",{src:m?.file?.asset?.fileURL,type:m.file.mimeType})}),f&&(0,t.jsx)(s.default,{image:f})]}),(0,t.jsx)("h4",{children:p}),g&&(0,t.jsx)("div",{className:u.default.Excerpt,children:g})]}),h&&(0,t.jsx)(d,{principle:e,index:a,close:()=>c(!1)})]})}],666728)},668215,e=>{e.v({Slider:"Slider-module-scss-module__0WHQHa__Slider"})},364337,e=>{"use strict";var t=e.i(395633),i=e.i(308562),r=e.i(860476),s=e.i(440085),a=e.i(666728),o=e.i(668215);e.s(["default",0,function({principles:e,downloadCta:h}){return(0,t.jsx)("div",{className:o.default.Slider,children:(0,t.jsxs)(s.Swiper,{className:o.default.Swiper,modules:[i.A11y,r.Pagination],slidesPerView:1.25,allowTouchMove:!0,loop:!0,centeredSlides:!0,spaceBetween:10,pagination:{clickable:!0},breakpoints:{768:{slidesPerView:1.8,spaceBetween:20}},children:[e.map((i,r)=>(0,t.jsx)(s.SwiperSlide,{children:(0,t.jsx)(a.default,{principle:i,index:r,last:r===e.length-1})},r)),h&&(0,t.jsx)(s.SwiperSlide,{children:h&&h})]})})}])},574585,e=>{e.v({Backdrop:"PrincipleModal-module-scss-module__uQbLGG__Backdrop",Close:"PrincipleModal-module-scss-module__uQbLGG__Close",Excerpt:"PrincipleModal-module-scss-module__uQbLGG__Excerpt",Intro:"PrincipleModal-module-scss-module__uQbLGG__Intro",Modal:"PrincipleModal-module-scss-module__uQbLGG__Modal",ModalColumns:"PrincipleModal-module-scss-module__uQbLGG__ModalColumns",ModalContainer:"PrincipleModal-module-scss-module__uQbLGG__ModalContainer",ModalContent:"PrincipleModal-module-scss-module__uQbLGG__ModalContent",ModalImage:"PrincipleModal-module-scss-module__uQbLGG__ModalImage",ModalMain:"PrincipleModal-module-scss-module__uQbLGG__ModalMain",Show:"PrincipleModal-module-scss-module__uQbLGG__Show"})},753891,e=>{e.v({Clickable:"Principle-module-scss-module__QKws7a__Clickable",Content:"Principle-module-scss-module__QKws7a__Content",Excerpt:"Principle-module-scss-module__QKws7a__Excerpt",Principle:"Principle-module-scss-module__QKws7a__Principle",Thumbnail:"Principle-module-scss-module__QKws7a__Thumbnail"})},988431,e=>{"use strict";var t=e.i(395633),i=e.i(131173),r=e.i(7284),s=e.i(792668),a=e.i(222502),o=e.i(389264),h=e.i(231573),c=e.i(574585);function d({principle:e,index:u,close:p}){let[f,m]=(0,i.useState)(!1),{title:g,image:v,column1:y,column2:x,excerpt:b}=e;(0,i.useEffect)(()=>{m(!0)},[]);let w=(0,i.useCallback)(()=>{m(!1),setTimeout(p,500)},[p]);(0,i.useEffect)(()=>{let e=e=>"Escape"===e.key&&w();return document.body.addEventListener("keydown",e),()=>document.body.removeEventListener("keydown",e)},[w]);let _=document.getElementById("water-modal");return _?a.default.createPortal((0,t.jsxs)("div",{className:(0,r.default)(c.default.Modal,f&&c.default.Show),children:[(0,t.jsx)("div",{className:c.default.Backdrop,onClick:w}),(0,t.jsxs)("div",{className:c.default.ModalContainer,children:[(0,t.jsxs)("div",{className:c.default.ModalMain,children:[(0,t.jsxs)("div",{className:c.default.ModalContent,children:[(0,t.jsxs)("div",{className:c.default.Intro,children:[(0,t.jsx)("h4",{children:g}),b&&(0,t.jsx)("div",{className:c.default.Excerpt,children:b})]}),(0,t.jsxs)("div",{className:c.default.ModalColumns,children:[y&&(0,t.jsx)(o.default,{copy:y,size:"small"}),x&&(0,t.jsx)(o.default,{copy:x,size:"small"})]})]}),v&&(0,t.jsx)("div",{className:c.default.ModalImage,children:(0,t.jsx)(s.default,{image:v})})]}),(0,t.jsx)("div",{className:c.default.Close,onClick:w,children:h.default})]})]}),_):null}var u=e.i(753891);e.s(["default",0,function({principle:e,index:a,last:o}){let[h,c]=(0,i.useState)(!1),{title:p,thumbnail:f,excerpt:m,image:g,column1:v,column2:y}=e,x=g||v||y;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:(0,r.default)(u.default.Principle,x&&u.default.Clickable,o&&u.default.Last),onClick:()=>x&&c(!0),children:[(0,t.jsxs)("div",{className:u.default.Content,children:[(0,t.jsx)("h4",{children:p}),m&&(0,t.jsx)("div",{className:u.default.Excerpt,children:m})]}),(0,t.jsx)("div",{className:u.default.Thumbnail,children:f&&(0,t.jsx)(s.default,{image:f})})]}),h&&(0,t.jsx)(d,{principle:e,index:a,close:()=>c(!1)})]})}],988431)},458415,e=>{e.v({Slider:"Slider-module-scss-module__SdUa9W__Slider"})},985808,e=>{"use strict";var t=e.i(395633),i=e.i(308562),r=e.i(860476),s=e.i(440085),a=e.i(988431),o=e.i(458415);e.s(["default",0,function({principles:e,downloadCta:h}){return(0,t.jsx)("div",{className:o.default.Slider,children:(0,t.jsxs)(s.Swiper,{className:o.default.Swiper,modules:[i.A11y,r.Pagination],slidesPerView:1.3,allowTouchMove:!0,loop:!0,centeredSlides:!0,spaceBetween:10,pagination:{clickable:!0},breakpoints:{768:{slidesPerView:1.8,spaceBetween:20}},children:[e.map((i,r)=>(0,t.jsx)(s.SwiperSlide,{children:(0,t.jsx)(a.default,{principle:i,index:r,last:r===e.length-1})},r)),h&&(0,t.jsx)(s.SwiperSlide,{children:h&&h})]})})}])},307347,e=>{e.v({Department:"Slide-module-scss-module__S-pkIG__Department",Details:"Slide-module-scss-module__S-pkIG__Details",Even:"Slide-module-scss-module__S-pkIG__Even",Image:"Slide-module-scss-module__S-pkIG__Image",Main:"Slide-module-scss-module__S-pkIG__Main",PlayPause:"Slide-module-scss-module__S-pkIG__PlayPause",Playing:"Slide-module-scss-module__S-pkIG__Playing",Position:"Slide-module-scss-module__S-pkIG__Position",Slide:"Slide-module-scss-module__S-pkIG__Slide",Title:"Slide-module-scss-module__S-pkIG__Title"})},527068,e=>{e.v({Slider:"Slider-module-scss-module__B_oJWa__Slider"})},986063,e=>{"use strict";var t=e.i(395633),i=e.i(131173),r=e.i(440085),s=e.i(7284),a=e.i(792668),o=e.i(307347);function h({tile:e,index:r,videoPlaying:c,setVideoPlaying:d}){let{title:u,position:p,department:f,image:m,video:g}=e,v=(0,i.useRef)(null);return(0,i.useEffect)(()=>{c===r?v.current?.play():v.current?.pause()},[c,r]),(0,t.jsxs)("div",{className:(0,s.default)(o.default.Slide,r%2==0&&o.default.Even,c===r&&o.default.Playing),onClick:()=>d(c===r?null:r),children:[g&&(0,t.jsx)("video",{src:g?.file?.asset?.fileURL,autoPlay:c===r,loop:!0,ref:v}),m&&(0,t.jsx)("div",{className:o.default.Image,children:(0,t.jsx)(a.default,{image:m,alt:u})}),(0,t.jsx)("div",{className:o.default.Department,children:f}),(0,t.jsxs)("div",{className:o.default.Main,children:[(0,t.jsx)("div",{className:o.default.PlayPause}),(0,t.jsxs)("div",{className:o.default.Details,children:[(0,t.jsx)("div",{className:o.default.Title,children:u}),(0,t.jsx)("div",{className:o.default.Position,children:p})]})]})]})}var c=e.i(527068);e.s(["default",0,function({tiles:e}){let[s,a]=(0,i.useState)(null),o=(0,i.useRef)(null);return(0,t.jsx)("div",{className:c.default.Slider,children:(0,t.jsx)(r.Swiper,{onSwiper:e=>{o.current=e},spaceBetween:20,slidesPerView:1.2,loop:!0,breakpoints:{500:{slidesPerView:1.6},1024:{slidesPerView:2.6}},children:e?.map((e,i)=>(0,t.jsx)(r.SwiperSlide,{children:(0,t.jsx)(h,{tile:e,index:i,videoPlaying:s,setVideoPlaying:a})},i))})})}],986063)},390104,e=>{e.v({Cont:"StatsShowcase-module-scss-module__HCOeeG__Cont",Copy:"StatsShowcase-module-scss-module__HCOeeG__Copy",Disclaimer:"StatsShowcase-module-scss-module__HCOeeG__Disclaimer",Intro:"StatsShowcase-module-scss-module__HCOeeG__Intro",MainIntro:"StatsShowcase-module-scss-module__HCOeeG__MainIntro",Number:"StatsShowcase-module-scss-module__HCOeeG__Number",Separator:"StatsShowcase-module-scss-module__HCOeeG__Separator",Stat:"StatsShowcase-module-scss-module__HCOeeG__Stat",StatOuter:"StatsShowcase-module-scss-module__HCOeeG__StatOuter",Stats:"StatsShowcase-module-scss-module__HCOeeG__Stats",StatsShowcase:"StatsShowcase-module-scss-module__HCOeeG__StatsShowcase"})},96820,e=>{"use strict";var t=e.i(395633),i=e.i(7284),r=e.i(488265),s=e.i(616827),a=e.i(390104);e.s(["default",0,function({preTitle:e,title:o,copy:h,stats:c}){return(0,t.jsx)("section",{className:a.default.StatsShowcase,children:(0,t.jsxs)("div",{className:(0,i.default)(a.default.Cont,"container"),children:[e||o?(0,t.jsx)("div",{className:a.default.MainIntro,children:(0,t.jsx)(s.default,{preTitle:e,title:o})}):null,h&&(0,t.jsx)("div",{className:a.default.Intro,children:(0,t.jsx)(s.default,{copy:h})}),(0,t.jsx)("div",{className:a.default.Stats,children:c?.map((e,i)=>
8261{let{number:s,prefix:o,suffix:h,countUp:c,copy:d,disclaimer:u}=e;return(0,t.jsxs)("div",{className:a.default.StatOuter,children:[(0,t.jsxs)("div",{className:a.default.Stat,children:[(0,t.jsx)("div",{className:a.default.Number,children:c?(0,t.jsx)(r.default,{end:s||0,prefix:o?`${o} `:"",suffix:h||"",enableScrollSpy:!0,scrollSpyOnce:!0}):(0,t.jsxs)(t.Fragment,{children:[o?`${o} `:"",s,h]})}),d&&(0,t.jsx)("div",{className:a.default.Copy,children:d}),(0,t.jsx)("div",{className:a.default.Separator})]}),u&&(0,t.jsx)("div",{className:a.default.Disclaimer,children:u})]},i)})})]})})}])},864125,e=>{e.v({Animation:"NewHero-module-scss-module__GqQkEW__Animation",BackgroundImage:"NewHero-module-scss-module__GqQkEW__BackgroundImage",Button:"NewHero-module-scss-module__GqQkEW__Button",ButtonBackgroundImage:"NewHero-module-scss-module__GqQkEW__ButtonBackgroundImage",Buttons:"NewHero-module-scss-module__GqQkEW__Buttons",Copy:"NewHero-module-scss-module__GqQkEW__Copy",Cutout:"NewHero-module-scss-module__GqQkEW__Cutout",Darken:"NewHero-module-scss-module__GqQkEW__Darken",HasBackgroundImage:"NewHero-module-scss-module__GqQkEW__HasBackgroundImage",HasMounted:"NewHero-module-scss-module__GqQkEW__HasMounted",Main:"NewHero-module-scss-module__GqQkEW__Main",NewHero:"NewHero-module-scss-module__GqQkEW__NewHero",NoButtons:"NewHero-module-scss-module__GqQkEW__NoButtons",Outer:"NewHero-module-scss-module__GqQkEW__Outer",TitleCont:"NewHero-module-scss-module__GqQkEW__TitleCont",White:"NewHero-module-scss-module__GqQkEW__White",interfaceGradient:"NewHero-module-scss-module__GqQkEW__interfaceGradient"})},973626,e=>{"use strict";var t=e.i(395633),i=e.i(131173),r=e.i(7284),s=e.i(378081),a=e.i(559229),o=e.i(389264),h=e.i(792668),c=e.i(470989),d=e.i(170586),u=e.i(864125);e.s(["default",0,function({title:e,copy:p,buttons:f,backgroundImage:m,darkenBackground:g}){let[v,y]=(0,i.useState)(!1);return(0,i.useEffect)(()=>{setTimeout(()=>{y(!0)},200)},[]),(0,a.useIsMobile)(),(0,t.jsx)("section",{className:(0,r.default)(u.default.NewHero,v&&u.default.HasMounted,!f?.length&&u.default.NoButtons),children:(0,t.jsx)("div",{className:(0,r.default)(u.default.Cont,"container"),children:(0,t.jsxs)("div",{className:u.default.Outer,children:[(0,t.jsxs)("div",{className:u.default.Main,children:[e&&(0,t.jsx)("h1",{dangerouslySetInnerHTML:{__html:e}}),p&&(0,t.jsx)("div",{className:u.default.Copy,children:(0,t.jsx)(o.default,{copy:p,size:"small"})}),m&&(0,t.jsx)("div",{className:(0,r.default)(u.default.BackgroundImage,g&&u.default.Darken),children:(0,t.jsx)(h.default,{image:m,priority:!0})})]}),f?.length&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:u.default.Buttons,children:f.map((e,i)=>{let{text:a,linkType:o,link:p,file:f,backgroundImage:m,backgroundColor:g}=e,v=(p?.linkType==="internal"||p?.linkType==="external")&&(0,s.getSanityLink)(p)||null,y="download"===o?f?.asset?.url?{url:(f?.asset).url||"/",title:"Download"}:null:v;return(0,t.jsxs)(c.default,{href:y?.url||"/",className:(0,r.default)(u.default.Button,g&&u.default[g],m&&u.default.HasBackgroundImage),children:[m&&(0,t.jsx)("div",{className:u.default.ButtonBackgroundImage,children:(0,t.jsx)(h.default,{image:m,priority:!0})}),a&&(0,t.jsx)("h5",{children:a}),(0,t.jsx)(d.default,{title:"download"===o?"Download":y?.title||"Learn More",darkGreen:!m,interfaceGreen:!!m,noArrow:!0})]},i)})}),(0,t.jsx)("div",{className:u.default.Cutout})]})]})})})}])},864702,e=>{e.v({Buttons:"SummaryStats-module-scss-module__Y8-XSW__Buttons",Cont:"SummaryStats-module-scss-module__Y8-XSW__Cont",Copy:"SummaryStats-module-scss-module__Y8-XSW__Copy",Files:"SummaryStats-module-scss-module__Y8-XSW__Files",FixedStat:"SummaryStats-module-scss-module__Y8-XSW__FixedStat",Grid:"SummaryStats-module-scss-module__Y8-XSW__Grid",Icon:"SummaryStats-module-scss-module__Y8-XSW__Icon",Intro:"SummaryStats-module-scss-module__Y8-XSW__Intro",Main:"SummaryStats-module-scss-module__Y8-XSW__Main",Number:"SummaryStats-module-scss-module__Y8-XSW__Number",Prefix:"SummaryStats-module-scss-module__Y8-XSW__Prefix",Resources:"SummaryStats-module-scss-module__Y8-XSW__Resources",Stat:"SummaryStats-module-scss-module__Y8-XSW__Stat",StatCopy:"SummaryStats-module-scss-module__Y8-XSW__StatCopy",StatValue:"SummaryStats-module-scss-module__Y8-XSW__StatValue",Stats:"SummaryStats-module-scss-module__Y8-XSW__Stats",Suffix:"SummaryStats-module-scss-module__Y8-XSW__Suffix",SummaryStats:"SummaryStats-module-scss-module__Y8-XSW__SummaryStats",TextColumns:"SummaryStats-module-scss-module__Y8-XSW__TextColumns",Title:"SummaryStats-module-scss-module__Y8-XSW__Title",TwoCol:"SummaryStats-module-scss-module__Y8-XSW__TwoCol"})},666787,e=>{"use strict";
8261var t=e.i(395633),i=e.i(488265),r=e.i(864702);e.s(["default",0,function({stat:e}){let{stat:s,prefix:a,suffix:o}=e||{};return s?(0,t.jsx)("div",{className:r.default.Number,children:(0,t.jsx)(i.default,{end:s,duration:5,prefix:a||"",suffix:o||"",enableScrollSpy:!0})}):null}])}]);

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.