@design-llm/motion 1.0.5 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,15 +1,15 @@
1
- "use strict";var Pc=Object.create;var da=Object.defineProperty;var Lc=Object.getOwnPropertyDescriptor;var Fc=Object.getOwnPropertyNames;var Ic=Object.getPrototypeOf,Uc=Object.prototype.hasOwnProperty;var Nc=(i,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Fc(e))!Uc.call(i,r)&&r!==t&&da(i,r,{get:()=>e[r],enumerable:!(n=Lc(e,r))||n.enumerable});return i};var Oc=(i,e,t)=>(t=i!=null?Pc(Ic(i)):{},Nc(e||!i||!i.__esModule?da(t,"default",{value:i,enumerable:!0}):t,i));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const de=require("react"),Mt=require("framer-motion"),Is=require("gsap");var qi={exports:{}},yi={};var fa;function Bc(){if(fa)return yi;fa=1;var i=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function t(n,r,s){var a=null;if(s!==void 0&&(a=""+s),r.key!==void 0&&(a=""+r.key),"key"in r){s={};for(var o in r)o!=="key"&&(s[o]=r[o])}else s=r;return r=s.ref,{$$typeof:i,type:n,key:a,ref:r!==void 0?r:null,props:s}}return yi.Fragment=e,yi.jsx=t,yi.jsxs=t,yi}var Ei={};var pa;function zc(){return pa||(pa=1,process.env.NODE_ENV!=="production"&&(function(){function i(N){if(N==null)return null;if(typeof N=="function")return N.$$typeof===F?null:N.displayName||N.name||null;if(typeof N=="string")return N;switch(N){case m:return"Fragment";case E:return"Profiler";case p:return"StrictMode";case T:return"Suspense";case A:return"SuspenseList";case M:return"Activity"}if(typeof N=="object")switch(typeof N.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),N.$$typeof){case _:return"Portal";case b:return N.displayName||"Context";case v:return(N._context.displayName||"Context")+".Consumer";case R:var ee=N.render;return N=N.displayName,N||(N=ee.displayName||ee.name||"",N=N!==""?"ForwardRef("+N+")":"ForwardRef"),N;case P:return ee=N.displayName||null,ee!==null?ee:i(N.type)||"Memo";case y:ee=N._payload,N=N._init;try{return i(N(ee))}catch{}}return null}function e(N){return""+N}function t(N){try{e(N);var ee=!1}catch{ee=!0}if(ee){ee=console;var me=ee.error,O=typeof Symbol=="function"&&Symbol.toStringTag&&N[Symbol.toStringTag]||N.constructor.name||"Object";return me.call(ee,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",O),e(N)}}function n(N){if(N===m)return"<>";if(typeof N=="object"&&N!==null&&N.$$typeof===y)return"<...>";try{var ee=i(N);return ee?"<"+ee+">":"<...>"}catch{return"<...>"}}function r(){var N=L.A;return N===null?null:N.getOwner()}function s(){return Error("react-stack-top-frame")}function a(N){if(C.call(N,"key")){var ee=Object.getOwnPropertyDescriptor(N,"key").get;if(ee&&ee.isReactWarning)return!1}return N.key!==void 0}function o(N,ee){function me(){Y||(Y=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",ee))}me.isReactWarning=!0,Object.defineProperty(N,"key",{get:me,configurable:!0})}function l(){var N=i(this.type);return J[N]||(J[N]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),N=this.props.ref,N!==void 0?N:null}function c(N,ee,me,O,Q,ce){var ne=me.ref;return N={$$typeof:g,type:N,key:ee,props:me,_owner:O},(ne!==void 0?ne:null)!==null?Object.defineProperty(N,"ref",{enumerable:!1,get:l}):Object.defineProperty(N,"ref",{enumerable:!1,value:null}),N._store={},Object.defineProperty(N._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(N,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(N,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:Q}),Object.defineProperty(N,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:ce}),Object.freeze&&(Object.freeze(N.props),Object.freeze(N)),N}function u(N,ee,me,O,Q,ce){var ne=ee.children;if(ne!==void 0)if(O)if(U(ne)){for(O=0;O<ne.length;O++)d(ne[O]);Object.freeze&&Object.freeze(ne)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else d(ne);if(C.call(ee,"key")){ne=i(N);var ve=Object.keys(ee).filter(function(Ce){return Ce!=="key"});O=0<ve.length?"{key: someKey, "+ve.join(": ..., ")+": ...}":"{key: someKey}",$[ne+O]||(ve=0<ve.length?"{"+ve.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
1
+ "use strict";var Pc=Object.create;var da=Object.defineProperty;var Lc=Object.getOwnPropertyDescriptor;var Fc=Object.getOwnPropertyNames;var Ic=Object.getPrototypeOf,Nc=Object.prototype.hasOwnProperty;var Uc=(i,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Fc(e))!Nc.call(i,r)&&r!==t&&da(i,r,{get:()=>e[r],enumerable:!(n=Lc(e,r))||n.enumerable});return i};var Oc=(i,e,t)=>(t=i!=null?Pc(Ic(i)):{},Uc(e||!i||!i.__esModule?da(t,"default",{value:i,enumerable:!0}):t,i));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const de=require("react"),Mt=require("framer-motion"),Ns=require("gsap");var qi={exports:{}},Si={};var fa;function Bc(){if(fa)return Si;fa=1;var i=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function t(n,r,s){var a=null;if(s!==void 0&&(a=""+s),r.key!==void 0&&(a=""+r.key),"key"in r){s={};for(var o in r)o!=="key"&&(s[o]=r[o])}else s=r;return r=s.ref,{$$typeof:i,type:n,key:a,ref:r!==void 0?r:null,props:s}}return Si.Fragment=e,Si.jsx=t,Si.jsxs=t,Si}var Ei={};var pa;function zc(){return pa||(pa=1,process.env.NODE_ENV!=="production"&&(function(){function i(U){if(U==null)return null;if(typeof U=="function")return U.$$typeof===F?null:U.displayName||U.name||null;if(typeof U=="string")return U;switch(U){case m:return"Fragment";case E:return"Profiler";case p:return"StrictMode";case T:return"Suspense";case A:return"SuspenseList";case M:return"Activity"}if(typeof U=="object")switch(typeof U.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),U.$$typeof){case _:return"Portal";case b:return U.displayName||"Context";case v:return(U._context.displayName||"Context")+".Consumer";case R:var ee=U.render;return U=U.displayName,U||(U=ee.displayName||ee.name||"",U=U!==""?"ForwardRef("+U+")":"ForwardRef"),U;case P:return ee=U.displayName||null,ee!==null?ee:i(U.type)||"Memo";case S:ee=U._payload,U=U._init;try{return i(U(ee))}catch{}}return null}function e(U){return""+U}function t(U){try{e(U);var ee=!1}catch{ee=!0}if(ee){ee=console;var me=ee.error,O=typeof Symbol=="function"&&Symbol.toStringTag&&U[Symbol.toStringTag]||U.constructor.name||"Object";return me.call(ee,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",O),e(U)}}function n(U){if(U===m)return"<>";if(typeof U=="object"&&U!==null&&U.$$typeof===S)return"<...>";try{var ee=i(U);return ee?"<"+ee+">":"<...>"}catch{return"<...>"}}function r(){var U=L.A;return U===null?null:U.getOwner()}function s(){return Error("react-stack-top-frame")}function a(U){if(C.call(U,"key")){var ee=Object.getOwnPropertyDescriptor(U,"key").get;if(ee&&ee.isReactWarning)return!1}return U.key!==void 0}function o(U,ee){function me(){j||(j=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",ee))}me.isReactWarning=!0,Object.defineProperty(U,"key",{get:me,configurable:!0})}function l(){var U=i(this.type);return J[U]||(J[U]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),U=this.props.ref,U!==void 0?U:null}function c(U,ee,me,O,Q,ce){var ne=me.ref;return U={$$typeof:g,type:U,key:ee,props:me,_owner:O},(ne!==void 0?ne:null)!==null?Object.defineProperty(U,"ref",{enumerable:!1,get:l}):Object.defineProperty(U,"ref",{enumerable:!1,value:null}),U._store={},Object.defineProperty(U._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(U,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(U,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:Q}),Object.defineProperty(U,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:ce}),Object.freeze&&(Object.freeze(U.props),Object.freeze(U)),U}function u(U,ee,me,O,Q,ce){var ne=ee.children;if(ne!==void 0)if(O)if(N(ne)){for(O=0;O<ne.length;O++)d(ne[O]);Object.freeze&&Object.freeze(ne)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else d(ne);if(C.call(ee,"key")){ne=i(U);var ve=Object.keys(ee).filter(function(Ce){return Ce!=="key"});O=0<ve.length?"{key: someKey, "+ve.join(": ..., ")+": ...}":"{key: someKey}",$[ne+O]||(ve=0<ve.length?"{"+ve.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
2
2
  let props = %s;
3
3
  <%s {...props} />
4
4
  React keys must be passed directly to JSX without using spread:
5
5
  let props = %s;
6
- <%s key={someKey} {...props} />`,O,ne,ve,ne),$[ne+O]=!0)}if(ne=null,me!==void 0&&(t(me),ne=""+me),a(ee)&&(t(ee.key),ne=""+ee.key),"key"in ee){me={};for(var Te in ee)Te!=="key"&&(me[Te]=ee[Te])}else me=ee;return ne&&o(me,typeof N=="function"?N.displayName||N.name||"Unknown":N),c(N,ne,me,r(),Q,ce)}function d(N){h(N)?N._store&&(N._store.validated=1):typeof N=="object"&&N!==null&&N.$$typeof===y&&(N._payload.status==="fulfilled"?h(N._payload.value)&&N._payload.value._store&&(N._payload.value._store.validated=1):N._store&&(N._store.validated=1))}function h(N){return typeof N=="object"&&N!==null&&N.$$typeof===g}var f=de,g=Symbol.for("react.transitional.element"),_=Symbol.for("react.portal"),m=Symbol.for("react.fragment"),p=Symbol.for("react.strict_mode"),E=Symbol.for("react.profiler"),v=Symbol.for("react.consumer"),b=Symbol.for("react.context"),R=Symbol.for("react.forward_ref"),T=Symbol.for("react.suspense"),A=Symbol.for("react.suspense_list"),P=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),M=Symbol.for("react.activity"),F=Symbol.for("react.client.reference"),L=f.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,C=Object.prototype.hasOwnProperty,U=Array.isArray,H=console.createTask?console.createTask:function(){return null};f={react_stack_bottom_frame:function(N){return N()}};var Y,J={},z=f.react_stack_bottom_frame.bind(f,s)(),j=H(n(s)),$={};Ei.Fragment=m,Ei.jsx=function(N,ee,me){var O=1e4>L.recentlyCreatedOwnerStacks++;return u(N,ee,me,!1,O?Error("react-stack-top-frame"):z,O?H(n(N)):j)},Ei.jsxs=function(N,ee,me){var O=1e4>L.recentlyCreatedOwnerStacks++;return u(N,ee,me,!0,O?Error("react-stack-top-frame"):z,O?H(n(N)):j)}})()),Ei}var ma;function kc(){return ma||(ma=1,process.env.NODE_ENV==="production"?qi.exports=Bc():qi.exports=zc()),qi.exports}var oe=kc();const Hc=(i,e)=>{const t=new Set([...Object.keys(i),...e.flatMap(r=>Object.keys(r))]),n={};return t.forEach(r=>{n[r]=[i[r],...e.map(s=>s[r])]}),n},Vc=({text:i="",delay:e=200,className:t="",animateBy:n="words",direction:r="top",threshold:s=.1,rootMargin:a="0px",animationFrom:o,animationTo:l,easing:c=_=>_,onAnimationComplete:u,stepDuration:d=.35,fontSize:h,fontFamily:f,color:g})=>{const _=n==="words"?i.split(" "):i.split(""),[m,p]=de.useState(!1),E=de.useRef(null);de.useEffect(()=>{if(!E.current)return;const F=new IntersectionObserver(([L])=>{L.isIntersecting&&(p(!0),F.unobserve(E.current))},{threshold:s,rootMargin:a});return F.observe(E.current),()=>F.disconnect()},[s,a]);const v=de.useMemo(()=>r==="top"?{filter:"blur(10px)",opacity:0,y:-50}:{filter:"blur(10px)",opacity:0,y:50},[r]),b=de.useMemo(()=>[{filter:"blur(5px)",opacity:.5,y:r==="top"?5:-5},{filter:"blur(0px)",opacity:1,y:0}],[r]),R=o??v,T=l??b,A=T.length+1,P=d*(A-1),y=Array.from({length:A},(F,L)=>A===1?0:L/(A-1)),M={...h&&{fontSize:h},...f&&{fontFamily:f},...g&&{color:g}};return oe.jsx("p",{ref:E,className:`blur-text ${t} flex flex-wrap`,style:M,children:_.map((F,L)=>{const C=Hc(R,T),U={duration:P,times:y,delay:L*e/1e3};return U.ease=c,oe.jsxs(Mt.motion.span,{className:"inline-block will-change-[transform,filter,opacity]",initial:R,animate:m?C:R,transition:U,onAnimationComplete:L===_.length-1?u:void 0,children:[F===" "?" ":F,n==="words"&&L<_.length-1&&" "]},L)})})},Gc=(i,e,t=!0)=>({from:e,to:e+360,ease:"linear",duration:i,type:"tween",repeat:t?1/0:0}),Bn=(i,e)=>({rotate:Gc(i,e),scale:{type:"spring",damping:20,stiffness:300}}),Wc=({text:i,spinDuration:e=20,onHover:t="speedUp",className:n="",fontSize:r,fontFamily:s,color:a})=>{const o=Array.from(i),l=Mt.useAnimation(),c=Mt.useMotionValue(0);de.useEffect(()=>{const f=c.get();l.start({rotate:f+360,scale:1,transition:Bn(e,f)})},[e,i,t,l,c]);const u=()=>{const f=c.get();if(!t)return;let g,_=1;switch(t){case"slowDown":g=Bn(e*2,f);break;case"speedUp":g=Bn(e/4,f);break;case"pause":g={rotate:{type:"spring",damping:20,stiffness:300},scale:{type:"spring",damping:20,stiffness:300}},_=1;break;case"goBonkers":g=Bn(e/20,f),_=.8;break;default:g=Bn(e,f)}l.start({rotate:f+360,scale:_,transition:g})},d=()=>{const f=c.get();l.start({rotate:f+360,scale:1,transition:Bn(e,f)})},h={...r&&{fontSize:r},...s&&{fontFamily:s},...a&&{color:a}};return oe.jsx(Mt.motion.div,{className:`m-0 mx-auto rounded-full w-[200px] h-[200px] relative text-white font-black text-center cursor-pointer origin-center ${n}`,style:{rotate:c,...h},initial:{rotate:0},animate:l,onMouseEnter:u,onMouseLeave:d,children:o.map((f,g)=>{const _=360/o.length*g,m=Math.PI/o.length,p=m*g,E=m*g,v=`rotateZ(${_}deg) translate3d(${p}px, ${E}px, 0)`;return oe.jsx("span",{className:"absolute inline-block inset-0 text-2xl transition-all duration-500 ease-[cubic-bezier(0,0,0,1)]",style:{transform:v,WebkitTransform:v,...h},children:f},g)})})};let bi,zn,ga=typeof Symbol=="function"?Symbol():"_split",Us,Xc=()=>Us||Ks.register(window.gsap),_a=typeof Intl<"u"&&"Segmenter"in Intl?new Intl.Segmenter:0,Ui=i=>typeof i=="string"?Ui(document.querySelectorAll(i)):"length"in i?Array.from(i).reduce((e,t)=>(typeof t=="string"?e.push(...Ui(t)):e.push(t),e),[]):[i],xa=i=>Ui(i).filter(e=>e instanceof HTMLElement),Ns=[],qr=function(){},qc={add:i=>i()},Yc=/\s+/g,va=new RegExp("\\p{RI}\\p{RI}|\\p{Emoji}(\\p{EMod}|\\u{FE0F}\\u{20E3}?|[\\u{E0020}-\\u{E007E}]+\\u{E007F})?(\\u{200D}\\p{Emoji}(\\p{EMod}|\\u{FE0F}\\u{20E3}?|[\\u{E0020}-\\u{E007E}]+\\u{E007F})?)*|.","gu"),Dr={left:0,top:0,width:0,height:0},$c=(i,e)=>{for(;++e<i.length&&i[e]===Dr;);return i[e]||Dr},Ma=({element:i,html:e,ariaL:t,ariaH:n})=>{i.innerHTML=e,t?i.setAttribute("aria-label",t):i.removeAttribute("aria-label"),n?i.setAttribute("aria-hidden",n):i.removeAttribute("aria-hidden")},Sa=(i,e)=>{if(e){let t=new Set(i.join("").match(e)||Ns),n=i.length,r,s,a,o;if(t.size)for(;--n>-1;){s=i[n];for(a of t)if(a.startsWith(s)&&a.length>s.length){for(r=0,o=s;a.startsWith(o+=i[n+ ++r])&&o.length<a.length;);if(r&&o.length===a.length){i[n]=a,i.splice(n+1,r);break}}}}return i},ya=i=>window.getComputedStyle(i).display==="inline"&&(i.style.display="inline-block"),kn=(i,e,t)=>e.insertBefore(typeof i=="string"?document.createTextNode(i):i,t),Os=(i,e,t)=>{let n=e[i+"sClass"]||"",{tag:r="div",aria:s="auto",propIndex:a=!1}=e,o=i==="line"?"block":"inline-block",l=n.indexOf("++")>-1,c=u=>{let d=document.createElement(r),h=t.length+1;return n&&(d.className=n+(l?" "+n+h:"")),a&&d.style.setProperty("--"+i,h+""),s!=="none"&&d.setAttribute("aria-hidden","true"),r!=="span"&&(d.style.position="relative",d.style.display=o),d.textContent=u,t.push(d),d};return l&&(n=n.replace("++","")),c.collection=t,c},jc=(i,e,t,n)=>{let r=Os("line",t,n),s=window.getComputedStyle(i).textAlign||"left";return(a,o)=>{let l=r("");for(l.style.textAlign=s,i.insertBefore(l,e[a]);a<o;a++)l.appendChild(e[a]);l.normalize()}},Dl=(i,e,t,n,r,s,a,o,l,c)=>{var u;let d=Array.from(i.childNodes),h=0,{wordDelimiter:f,reduceWhiteSpace:g=!0,prepareText:_}=e,m=i.getBoundingClientRect(),p=m,E=!g&&window.getComputedStyle(i).whiteSpace.substring(0,3)==="pre",v=0,b=t.collection,R,T,A,P,y,M,F,L,C,U,H,Y,J,z,j,$,N,ee;for(typeof f=="object"?(A=f.delimiter||f,T=f.replaceWith||""):T=f===""?"":f||" ",R=T!==" ";h<d.length;h++)if(P=d[h],P.nodeType===3){for(j=P.textContent||"",g?j=j.replace(Yc," "):E&&(j=j.replace(/\n/g,T+`
7
- `)),_&&(j=_(j,i)),P.textContent=j,y=T||A?j.split(A||T):j.match(o)||Ns,N=y[y.length-1],L=R?N.slice(-1)===" ":!N,N||y.pop(),p=m,F=R?y[0].charAt(0)===" ":!y[0],F&&kn(" ",i,P),y[0]||y.shift(),Sa(y,l),s&&c||(P.textContent=""),C=1;C<=y.length;C++)if($=y[C-1],!g&&E&&$.charAt(0)===`
8
- `&&((u=P.previousSibling)==null||u.remove(),kn(document.createElement("br"),i,P),$=$.slice(1)),!g&&$==="")kn(T,i,P);else if($===" ")i.insertBefore(document.createTextNode(" "),P);else{if(R&&$.charAt(0)===" "&&kn(" ",i,P),v&&C===1&&!F&&b.indexOf(v.parentNode)>-1?(M=b[b.length-1],M.appendChild(document.createTextNode(n?"":$))):(M=t(n?"":$),kn(M,i,P),v&&C===1&&!F&&M.insertBefore(v,M.firstChild)),n)for(H=_a?Sa([..._a.segment($)].map(me=>me.segment),l):$.match(o)||Ns,ee=0;ee<H.length;ee++)M.appendChild(H[ee]===" "?document.createTextNode(" "):n(H[ee]));if(s&&c){if(j=P.textContent=j.substring($.length+1,j.length),U=M.getBoundingClientRect(),U.top>p.top&&U.left<=p.left){for(Y=i.cloneNode(),J=i.childNodes[0];J&&J!==M;)z=J,J=J.nextSibling,Y.appendChild(z);i.parentNode.insertBefore(Y,i),r&&ya(Y)}p=U}(C<y.length||L)&&kn(C>=y.length?" ":R&&$.slice(-1)===" "?" "+T:T,i,P)}i.removeChild(P),v=0}else P.nodeType===1&&(a&&a.indexOf(P)>-1?(b.indexOf(P.previousSibling)>-1&&b[b.length-1].appendChild(P),v=P):(Dl(P,e,t,n,r,s,a,o,l,!0),v=0),r&&ya(P))};const Al=class wl{constructor(e,t){this.isSplit=!1,Xc(),this.elements=xa(e),this.chars=[],this.words=[],this.lines=[],this.masks=[],this.vars=t,this.elements.forEach(a=>{var o;t.overwrite!==!1&&((o=a[ga])==null||o._data.orig.filter(({element:l})=>l===a).forEach(Ma)),a[ga]=this}),this._split=()=>this.isSplit&&this.split(this.vars);let n=[],r,s=()=>{let a=n.length,o;for(;a--;){o=n[a];let l=o.element.offsetWidth;if(l!==o.width){o.width=l,this._split();return}}};this._data={orig:n,obs:typeof ResizeObserver<"u"&&new ResizeObserver(()=>{clearTimeout(r),r=setTimeout(s,200)})},qr(this),this.split(t)}split(e){return(this._ctx||qc).add(()=>{this.isSplit&&this.revert(),this.vars=e=e||this.vars||{};let{type:t="chars,words,lines",aria:n="auto",deepSlice:r=!0,smartWrap:s,onSplit:a,autoSplit:o=!1,specialChars:l,mask:c}=this.vars,u=t.indexOf("lines")>-1,d=t.indexOf("chars")>-1,h=t.indexOf("words")>-1,f=d&&!h&&!u,g=l&&("push"in l?new RegExp("(?:"+l.join("|")+")","gu"):l),_=g?new RegExp(g.source+"|"+va.source,"gu"):va,m=!!e.ignore&&xa(e.ignore),{orig:p,animTime:E,obs:v}=this._data,b;(d||h||u)&&(this.elements.forEach((R,T)=>{p[T]={element:R,html:R.innerHTML,ariaL:R.getAttribute("aria-label"),ariaH:R.getAttribute("aria-hidden")},n==="auto"?R.setAttribute("aria-label",(R.textContent||"").trim()):n==="hidden"&&R.setAttribute("aria-hidden","true");let A=[],P=[],y=[],M=d?Os("char",e,A):null,F=Os("word",e,P),L,C,U,H;if(Dl(R,e,F,M,f,r&&(u||f),m,_,g,!1),u){let Y=Ui(R.childNodes),J=jc(R,Y,e,y),z,j=[],$=0,N=Y.map(O=>O.nodeType===1?O.getBoundingClientRect():Dr),ee=Dr,me;for(L=0;L<Y.length;L++)z=Y[L],z.nodeType===1&&(z.nodeName==="BR"?((!L||Y[L-1].nodeName!=="BR")&&(j.push(z),J($,L+1)),$=L+1,ee=$c(N,L)):(me=N[L],L&&me.top>ee.top&&me.left<ee.left+ee.width-1&&(J($,L),$=L),ee=me));$<L&&J($,L),j.forEach(O=>{var Q;return(Q=O.parentNode)==null?void 0:Q.removeChild(O)})}if(!h){for(L=0;L<P.length;L++)if(C=P[L],d||!C.nextSibling||C.nextSibling.nodeType!==3)if(s&&!u){for(U=document.createElement("span"),U.style.whiteSpace="nowrap";C.firstChild;)U.appendChild(C.firstChild);C.replaceWith(U)}else C.replaceWith(...C.childNodes);else H=C.nextSibling,H&&H.nodeType===3&&(H.textContent=(C.textContent||"")+(H.textContent||""),C.remove());P.length=0,R.normalize()}this.lines.push(...y),this.words.push(...P),this.chars.push(...A)}),c&&this[c]&&this.masks.push(...this[c].map(R=>{let T=R.cloneNode();return R.replaceWith(T),T.appendChild(R),R.className&&(T.className=R.className.trim()+"-mask"),T.style.overflow="clip",T}))),this.isSplit=!0,zn&&u&&(o?zn.addEventListener("loadingdone",this._split):zn.status==="loading"&&console.warn("SplitText called before fonts loaded")),(b=a&&a(this))&&b.totalTime&&(this._data.anim=E?b.totalTime(E):b),u&&o&&this.elements.forEach((R,T)=>{p[T].width=R.offsetWidth,v&&v.observe(R)})}),this}kill(){let{obs:e}=this._data;e&&e.disconnect(),zn?.removeEventListener("loadingdone",this._split)}revert(){var e,t;if(this.isSplit){let{orig:n,anim:r}=this._data;this.kill(),n.forEach(Ma),this.chars.length=this.words.length=this.lines.length=n.length=this.masks.length=0,this.isSplit=!1,r&&(this._data.animTime=r.totalTime(),r.revert()),(t=(e=this.vars).onRevert)==null||t.call(e,this)}return this}static create(e,t){return new wl(e,t)}static register(e){bi=bi||e||window.gsap,bi&&(Ui=bi.utils.toArray,qr=bi.core.context||qr),!Us&&window.innerWidth>0&&(zn=document.fonts,Us=!0)}};Al.version="3.14.2";let Ks=Al;var Kc=/(?:^\s+|\s+$)/g,Zc=/([\uD800-\uDBFF][\uDC00-\uDFFF](?:[\u200D\uFE0F][\uD800-\uDBFF][\uDC00-\uDFFF]){2,}|\uD83D\uDC69(?:\u200D(?:(?:\uD83D\uDC69\u200D)?\uD83D\uDC67|(?:\uD83D\uDC69\u200D)?\uD83D\uDC66)|\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D(?:\uD83D\uDC69\u200D)?\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D(?:\uD83D\uDC69\u200D)?\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2642\u2640]\uFE0F|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDD27\uDCBC\uDD2C\uDE80\uDE92])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC6F\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3C-\uDD3E\uDDD6-\uDDDF])\u200D[\u2640\u2642]\uFE0F|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|(?:\u26F9|\uD83C[\uDFCC\uDFCB]|\uD83D\uDD75)(?:\uFE0F\u200D[\u2640\u2642]|(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642])\uFE0F|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2695\u2696\u2708]|\uD83D\uDC69\u200D[\u2695\u2696\u2708]|\uD83D\uDC68(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708]))\uFE0F|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83D\uDC69\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|\uD83D\uDC68(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:(?:\uD83D[\uDC68\uDC69])\u200D)?\uD83D\uDC66\u200D\uD83D\uDC66|(?:(?:\uD83D[\uDC68\uDC69])\u200D)?\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92])|(?:\uD83C[\uDFFB-\uDFFF])\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]))|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDD1-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\u200D(?:(?:(?:\uD83D[\uDC68\uDC69])\u200D)?\uD83D\uDC67|(?:(?:\uD83D[\uDC68\uDC69])\u200D)?\uD83D\uDC66)|\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC69\uDC6E\uDC70-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD18-\uDD1C\uDD1E\uDD1F\uDD26\uDD30-\uDD39\uDD3D\uDD3E\uDDD1-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])?|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDEEB\uDEEC\uDEF4-\uDEF8]|\uD83E[\uDD10-\uDD3A\uDD3C-\uDD3E\uDD40-\uDD45\uDD47-\uDD4C\uDD50-\uDD6B\uDD80-\uDD97\uDDC0\uDDD0-\uDDE6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u2660\u2663\u2665\u2666\u2668\u267B\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEF8]|\uD83E[\uDD10-\uDD3A\uDD3C-\uDD3E\uDD40-\uDD45\uDD47-\uDD4C\uDD50-\uDD6B\uDD80-\uDD97\uDDC0\uDDD0-\uDDE6])\uFE0F)/;function Zs(i){var e=i.nodeType,t="";if(e===1||e===9||e===11){if(typeof i.textContent=="string")return i.textContent;for(i=i.firstChild;i;i=i.nextSibling)t+=Zs(i)}else if(e===3||e===4)return i.nodeValue;return t}function Vt(i,e,t,n,r){if(i+="",t&&(i=i.trim?i.trim():i.replace(Kc,"")),e&&e!=="")return i.replace(/>/g,"&gt;").replace(/</g,"&lt;").split(e);for(var s=[],a=i.length,o=0,l,c;o<a;o++)c=i.charAt(o),(c.charCodeAt(0)>=55296&&c.charCodeAt(0)<=56319||i.charCodeAt(o+1)>=65024&&i.charCodeAt(o+1)<=65039)&&(l=((i.substr(o,12).split(Zc)||[])[1]||"").length||2,c=i.substr(o,l),s.emoji=1,o+=l-1),s.push(r?c:c===">"?"&gt;":c==="<"?"&lt;":n&&c===" "&&(i.charAt(o-1)===" "||i.charAt(o+1)===" ")?"&nbsp;":c);return s}var br=(function(){function i(t){this.chars=Vt(t),this.sets=[],this.length=50;for(var n=0;n<20;n++)this.sets[n]=ba(80,this.chars)}var e=i.prototype;return e.grow=function(n){for(var r=0;r<20;r++)this.sets[r]+=ba(n-this.length,this.chars);this.length=n},i})(),Rn,Cl,Rl=function(){return Rn||typeof window<"u"&&(Rn=window.gsap)&&Rn.registerPlugin&&Rn},Jc=1,Ea=/\s+/g,ba=function(e,t){for(var n=t.length,r="";--e>-1;)r+=t[~~(Math.random()*n)];return r},Bs="ABCDEFGHIJKLMNOPQRSTUVWXYZ",Ta=Bs.toLowerCase(),Qc={upperCase:new br(Bs),lowerCase:new br(Ta),upperAndLowerCase:new br(Bs+Ta)},Da=function(){Cl=Rn=Rl()},Ur={version:"3.14.2",name:"scrambleText",register:function(e,t,n){Rn=e,Da()},init:function(e,t,n,r,s){if(Cl||Da(),this.prop="innerHTML"in e?"innerHTML":"textContent"in e?"textContent":0,!!this.prop){this.target=e,typeof t!="object"&&(t={text:t});var a=t.text||t.value||"",o=t.trim!==!1,l=this,c,u,d,h;return l.delimiter=c=t.delimiter||"",l.original=Vt(Zs(e).replace(Ea," ").split("&nbsp;").join(""),c,o),(a==="{original}"||a===!0||a==null)&&(a=l.original.join(c)),l.text=Vt((a||"").replace(Ea," "),c,o),l.hasClass=!!(t.newClass||t.oldClass),l.newClass=t.newClass,l.oldClass=t.oldClass,h=c==="",l.textHasEmoji=h&&!!l.text.emoji,l.charsHaveEmoji=!!t.chars&&!!Vt(t.chars).emoji,l.length=h?l.original.length:l.original.join(c).length,l.lengthDif=(h?l.text.length:l.text.join(c).length)-l.length,l.fillChar=t.fillChar||t.chars&&~t.chars.indexOf(" ")?"&nbsp;":"",l.charSet=d=Qc[t.chars||"upperCase"]||new br(t.chars),l.speed=.05/(t.speed||1),l.prevScrambleTime=0,l.setIndex=Math.random()*20|0,u=l.length+Math.max(l.lengthDif,0),u>d.length&&d.grow(u),l.chars=d.sets[l.setIndex],l.revealDelay=t.revealDelay||0,l.tweenLength=t.tweenLength!==!1,l.tween=n,l.rightToLeft=!!t.rightToLeft,l._props.push("scrambleText","text"),Jc}},render:function(e,t){var n=t.target,r=t.prop,s=t.text,a=t.delimiter,o=t.tween,l=t.prevScrambleTime,c=t.revealDelay,u=t.setIndex,d=t.chars,h=t.charSet,f=t.length,g=t.textHasEmoji,_=t.charsHaveEmoji,m=t.lengthDif,p=t.tweenLength,E=t.oldClass,v=t.newClass,b=t.rightToLeft,R=t.fillChar,T=t.speed,A=t.original,P=t.hasClass,y=s.length,M=o._time,F=M-l,L,C,U,H,Y,J,z,j,$,N,ee;c&&(o._from&&(M=o._dur-M),e=M===0?0:M<c?1e-6:M===o._dur?1:o._ease((M-c)/(o._dur-c))),e<0?e=0:e>1&&(e=1),b&&(e=1-e),L=~~(e*y+.5),e?((F>T||F<-T)&&(t.setIndex=u=(u+(Math.random()*19|0))%20,t.chars=h.sets[u],t.prevScrambleTime+=F),H=d):H=A.join(a),ee=o._from?e:1-e,N=f+(p?o._from?ee*ee*ee:1-ee*ee*ee:1)*m,b?e===1&&(o._from||o.data==="isFromStart")?(U="",H=A.join(a)):(z=s.slice(L).join(a),_?U=Vt(H).slice(0,N-(g?Vt(z):z).length+.5|0).join(""):U=H.substr(0,N-(g?Vt(z):z).length+.5|0),H=z):(U=s.slice(0,L).join(a),C=(g?Vt(U):U).length,_?H=Vt(H).slice(C,N+.5|0).join(""):H=H.substr(C,N-C+.5|0)),P?(j=b?E:v,$=b?v:E,Y=j&&L!==0,J=$&&L!==y,z=(Y?"<span class='"+j+"'>":"")+U+(Y?"</span>":"")+(J?"<span class='"+$+"'>":"")+a+H+(J?"</span>":"")):z=U+a+H,n[r]=R==="&nbsp;"&&~z.indexOf(" ")?z.split(" ").join("&nbsp;&nbsp;"):z}};Ur.emojiSafeSplit=Vt;Ur.getText=Zs;Rl()&&Rn.registerPlugin(Ur);Is.gsap.registerPlugin(Ks,Ur);const eu=({radius:i=100,duration:e=1.2,speed:t=.5,scrambleChars:n=".:",className:r="",style:s={},children:a,fontSize:o,fontFamily:l,color:c})=>{const u=de.useRef(null);de.useEffect(()=>{if(!u.current)return;const h=Ks.create(u.current.querySelector("p"),{type:"chars",charsClass:"inline-block will-change-transform"});h.chars.forEach(_=>{const m=_;Is.gsap.set(m,{attr:{"data-content":m.innerHTML}})});const f=_=>{h.chars.forEach(m=>{const p=m,{left:E,top:v,width:b,height:R}=p.getBoundingClientRect(),T=_.clientX-(E+b/2),A=_.clientY-(v+R/2),P=Math.hypot(T,A);P<i&&Is.gsap.to(p,{overwrite:!0,duration:e*(1-P/i),scrambleText:{text:p.dataset.content||"",chars:n,speed:t},ease:"none"})})},g=u.current;return g.addEventListener("pointermove",f),()=>{g.removeEventListener("pointermove",f),h.revert()}},[i,e,t,n]);const d={...s,...o&&{fontSize:o},...l&&{fontFamily:l},...c&&{color:c}};return oe.jsx("div",{ref:u,className:`m-[7vw] max-w-[800px] font-mono text-[clamp(14px,4vw,32px)] text-white ${r}`,style:d,children:oe.jsx("p",{children:a})})},tu=({direction:i="clockwise",speed:e=.5,color:t="#71717a",dashLength:n=10,gapLength:r=5,width:s=300,height:a=200,strokeWidth:o=1,borderRadius:l=0})=>{const c=de.useRef(null);return de.useEffect(()=>{if(!c.current)return;const u=c.current,d=u.getTotalLength();u.style.strokeDasharray=`${n} ${r}`,u.style.strokeDashoffset=i==="clockwise"?d:0;let h,f=i==="clockwise"?d:0;const g=i==="clockwise"?-e:e,_=()=>{f+=g,i==="clockwise"?f<=-(n+r)&&(f=0):f>=n+r&&(f=0),u.style.strokeDashoffset=f,h=requestAnimationFrame(_)};return h=requestAnimationFrame(_),()=>{h&&cancelAnimationFrame(h)}},[i,e,n,r]),oe.jsx("svg",{width:s+o*2,height:a+o*2,className:"overflow-visible",children:oe.jsx(Mt.motion.rect,{ref:c,x:o,y:o,width:s,height:a,rx:l,ry:l,fill:"transparent",stroke:t,strokeWidth:o,strokeLinecap:"round",initial:{opacity:0},animate:{opacity:1},transition:{duration:.5}})})},nu=({color:i="var(--primary)",backgroundColor:e="var(--background)",duration:t=150,blurIntensity:n="1em",density:r=1,className:s})=>{const a=()=>[`radial-gradient(4px 100px at 0px 235px, ${i}, transparent)`,`radial-gradient(4px 100px at 300px 235px, ${i}, transparent)`,`radial-gradient(1.5px 1.5px at 150px 117.5px, ${i} 100%, transparent 150%)`,`radial-gradient(4px 100px at 0px 252px, ${i}, transparent)`,`radial-gradient(4px 100px at 300px 252px, ${i}, transparent)`,`radial-gradient(1.5px 1.5px at 150px 126px, ${i} 100%, transparent 150%)`,`radial-gradient(4px 100px at 0px 150px, ${i}, transparent)`,`radial-gradient(4px 100px at 300px 150px, ${i}, transparent)`,`radial-gradient(1.5px 1.5px at 150px 75px, ${i} 100%, transparent 150%)`,`radial-gradient(4px 100px at 0px 253px, ${i}, transparent)`,`radial-gradient(4px 100px at 300px 253px, ${i}, transparent)`,`radial-gradient(1.5px 1.5px at 150px 126.5px, ${i} 100%, transparent 150%)`,`radial-gradient(4px 100px at 0px 204px, ${i}, transparent)`,`radial-gradient(4px 100px at 300px 204px, ${i}, transparent)`,`radial-gradient(1.5px 1.5px at 150px 102px, ${i} 100%, transparent 150%)`,`radial-gradient(4px 100px at 0px 134px, ${i}, transparent)`,`radial-gradient(4px 100px at 300px 134px, ${i}, transparent)`,`radial-gradient(1.5px 1.5px at 150px 67px, ${i} 100%, transparent 150%)`,`radial-gradient(4px 100px at 0px 179px, ${i}, transparent)`,`radial-gradient(4px 100px at 300px 179px, ${i}, transparent)`,`radial-gradient(1.5px 1.5px at 150px 89.5px, ${i} 100%, transparent 150%)`,`radial-gradient(4px 100px at 0px 299px, ${i}, transparent)`,`radial-gradient(4px 100px at 300px 299px, ${i}, transparent)`,`radial-gradient(1.5px 1.5px at 150px 149.5px, ${i} 100%, transparent 150%)`,`radial-gradient(4px 100px at 0px 215px, ${i}, transparent)`,`radial-gradient(4px 100px at 300px 215px, ${i}, transparent)`,`radial-gradient(1.5px 1.5px at 150px 107.5px, ${i} 100%, transparent 150%)`,`radial-gradient(4px 100px at 0px 281px, ${i}, transparent)`,`radial-gradient(4px 100px at 300px 281px, ${i}, transparent)`,`radial-gradient(1.5px 1.5px at 150px 140.5px, ${i} 100%, transparent 150%)`,`radial-gradient(4px 100px at 0px 158px, ${i}, transparent)`,`radial-gradient(4px 100px at 300px 158px, ${i}, transparent)`,`radial-gradient(1.5px 1.5px at 150px 79px, ${i} 100%, transparent 150%)`,`radial-gradient(4px 100px at 0px 210px, ${i}, transparent)`,`radial-gradient(4px 100px at 300px 210px, ${i}, transparent)`,`radial-gradient(1.5px 1.5px at 150px 105px, ${i} 100%, transparent 150%)`].join(", "),o=["300px 235px","300px 235px","300px 235px","300px 252px","300px 252px","300px 252px","300px 150px","300px 150px","300px 150px","300px 253px","300px 253px","300px 253px","300px 204px","300px 204px","300px 204px","300px 134px","300px 134px","300px 134px","300px 179px","300px 179px","300px 179px","300px 299px","300px 299px","300px 299px","300px 215px","300px 215px","300px 215px","300px 281px","300px 281px","300px 281px","300px 158px","300px 158px","300px 158px","300px 210px","300px 210px"].join(", "),l="0px 220px, 3px 220px, 151.5px 337.5px, 25px 24px, 28px 24px, 176.5px 150px, 50px 16px, 53px 16px, 201.5px 91px, 75px 224px, 78px 224px, 226.5px 230.5px, 100px 19px, 103px 19px, 251.5px 121px, 125px 120px, 128px 120px, 276.5px 187px, 150px 31px, 153px 31px, 301.5px 120.5px, 175px 235px, 178px 235px, 326.5px 384.5px, 200px 121px, 203px 121px, 351.5px 228.5px, 225px 224px, 228px 224px, 376.5px 364.5px, 250px 26px, 253px 26px, 401.5px 105px, 275px 75px, 278px 75px, 426.5px 180px";return oe.jsxs("div",{className:aa("relative h-full w-full p-1",s),children:[oe.jsx(Mt.motion.div,{initial:{opacity:0},animate:{opacity:1},transition:{duration:.2},className:"size-full",children:oe.jsx(Mt.motion.div,{className:"relative size-full z-0",style:{backgroundColor:e,backgroundImage:a(),backgroundSize:o},variants:{initial:{backgroundPosition:l},animate:{backgroundPosition:[l,"0px 6800px, 3px 6800px, 151.5px 6917.5px, 25px 13632px, 28px 13632px, 176.5px 13758px, 50px 5416px, 53px 5416px, 201.5px 5491px, 75px 17175px, 78px 17175px, 226.5px 17301.5px, 100px 5119px, 103px 5119px, 251.5px 5221px, 125px 8428px, 128px 8428px, 276.5px 8495px, 150px 9876px, 153px 9876px, 301.5px 9965.5px, 175px 13391px, 178px 13391px, 326.5px 13540.5px, 200px 14741px, 203px 14741px, 351.5px 14848.5px, 225px 18770px, 228px 18770px, 376.5px 18910.5px, 250px 5082px, 253px 5082px, 401.5px 5161px, 275px 6375px, 278px 6375px, 426.5px 6480px"],transition:{duration:t,ease:"linear",repeat:Number.POSITIVE_INFINITY}}},initial:"initial",animate:"animate"})}),oe.jsx("div",{className:"absolute inset-0 z-1 dark:brightness-600",style:{backdropFilter:`blur(${n})`,backgroundImage:`radial-gradient(circle at 50% 50%, transparent 0, transparent 2px, ${e} 2px)`,backgroundSize:`${8*r}px ${8*r}px`}})]})},iu=({text:i,disabled:e=!1,speed:t=2,className:n="",color:r="#b5b5b5",shineColor:s="#ffffff",spread:a=120,yoyo:o=!1,pauseOnHover:l=!1,direction:c="left",delay:u=0,fontSize:d,fontFamily:h})=>{const[f,g]=de.useState(!1),_=Mt.useMotionValue(0),m=de.useRef(0),p=de.useRef(null),E=de.useRef(c==="left"?1:-1),v=t*1e3,b=u*1e3;Mt.useAnimationFrame(M=>{if(e||f){p.current=null;return}if(p.current===null){p.current=M;return}const F=M-p.current;if(p.current=M,m.current+=F,o){const L=v+b,C=L*2,U=m.current%C;if(U<v){const H=U/v*100;_.set(E.current===1?H:100-H)}else if(U<L)_.set(E.current===1?100:0);else if(U<L+v){const Y=100-(U-L)/v*100;_.set(E.current===1?Y:100-Y)}else _.set(E.current===1?0:100)}else{const L=v+b,C=m.current%L;if(C<v){const U=C/v*100;_.set(E.current===1?U:100-U)}else _.set(E.current===1?100:0)}}),de.useEffect(()=>{E.current=c==="left"?1:-1,m.current=0,_.set(0)},[c]);const R=Mt.useTransform(_,M=>`${150-M*2}% center`),T=de.useCallback(()=>{l&&g(!0)},[l]),A=de.useCallback(()=>{l&&g(!1)},[l]),y={...{backgroundImage:`linear-gradient(${a}deg, ${r} 0%, ${r} 35%, ${s} 50%, ${r} 65%, ${r} 100%)`,backgroundSize:"200% auto",WebkitBackgroundClip:"text",backgroundClip:"text",WebkitTextFillColor:"transparent"},backgroundPosition:R,...d&&{fontSize:d},...h&&{fontFamily:h}};return oe.jsx(Mt.motion.span,{className:`inline-block ${n}`,style:y,onMouseEnter:T,onMouseLeave:A,children:i})};const Js="163",Hn={ROTATE:0,DOLLY:1,PAN:2},Vn={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},ru=0,Aa=1,su=2,Pl=1,au=2,Jt=3,_n=0,St=1,Wt=2,en=0,ci=1,ui=2,wa=3,Ca=4,ou=5,wn=100,lu=101,cu=102,uu=103,hu=104,du=200,fu=201,pu=202,mu=203,zs=204,ks=205,gu=206,_u=207,xu=208,vu=209,Mu=210,Su=211,yu=212,Eu=213,bu=214,Tu=0,Du=1,Au=2,Ar=3,wu=4,Cu=5,Ru=6,Pu=7,Ll=0,Lu=1,Fu=2,pn=0,Iu=1,Uu=2,Nu=3,Qs=4,Ou=5,Bu=6,zu=7,Fl=300,pi=301,mi=302,Hs=303,Vs=304,Nr=306,Gs=1e3,Pn=1001,Ws=1002,Ut=1003,ku=1004,Yi=1005,zt=1006,Yr=1007,Ln=1008,mn=1009,Hu=1010,Vu=1011,Il=1012,Ul=1013,gi=1014,fn=1015,gn=1016,Nl=1017,Ol=1018,zi=1020,Gu=35902,Wu=1021,Xu=1022,Xt=1023,qu=1024,Yu=1025,hi=1026,Ni=1027,$u=1028,Bl=1029,ju=1030,zl=1031,kl=1033,$r=33776,jr=33777,Kr=33778,Zr=33779,Ra=35840,Pa=35841,La=35842,Fa=35843,Hl=36196,Ia=37492,Ua=37496,Na=37808,Oa=37809,Ba=37810,za=37811,ka=37812,Ha=37813,Va=37814,Ga=37815,Wa=37816,Xa=37817,qa=37818,Ya=37819,$a=37820,ja=37821,Jr=36492,Ka=36494,Za=36495,Ku=36283,Ja=36284,Qa=36285,eo=36286,Zu=3200,Ju=3201,Qu=0,eh=1,dn="",It="srgb",xn="srgb-linear",ea="display-p3",Or="display-p3-linear",wr="linear",Ke="srgb",Cr="rec709",Rr="p3",Gn=7680,to=519,th=512,nh=513,ih=514,Vl=515,rh=516,sh=517,ah=518,oh=519,no=35044,io="300 es",Qt=2e3,Pr=2001;class Nn{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const n=this._listeners;return n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const r=this._listeners[e];if(r!==void 0){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const n=this._listeners[e.type];if(n!==void 0){e.target=this;const r=n.slice(0);for(let s=0,a=r.length;s<a;s++)r[s].call(this,e);e.target=null}}}const mt=["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"];let ro=1234567;const di=Math.PI/180,Oi=180/Math.PI;function xi(){const i=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(mt[i&255]+mt[i>>8&255]+mt[i>>16&255]+mt[i>>24&255]+"-"+mt[e&255]+mt[e>>8&255]+"-"+mt[e>>16&15|64]+mt[e>>24&255]+"-"+mt[t&63|128]+mt[t>>8&255]+"-"+mt[t>>16&255]+mt[t>>24&255]+mt[n&255]+mt[n>>8&255]+mt[n>>16&255]+mt[n>>24&255]).toLowerCase()}function ht(i,e,t){return Math.max(e,Math.min(t,i))}function ta(i,e){return(i%e+e)%e}function lh(i,e,t,n,r){return n+(i-e)*(r-n)/(t-e)}function ch(i,e,t){return i!==e?(t-i)/(e-i):0}function Pi(i,e,t){return(1-t)*i+t*e}function uh(i,e,t,n){return Pi(i,e,1-Math.exp(-t*n))}function hh(i,e=1){return e-Math.abs(ta(i,e*2)-e)}function dh(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*(3-2*i))}function fh(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*i*(i*(i*6-15)+10))}function ph(i,e){return i+Math.floor(Math.random()*(e-i+1))}function mh(i,e){return i+Math.random()*(e-i)}function gh(i){return i*(.5-Math.random())}function _h(i){i!==void 0&&(ro=i);let e=ro+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function xh(i){return i*di}function vh(i){return i*Oi}function Mh(i){return(i&i-1)===0&&i!==0}function Sh(i){return Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))}function yh(i){return Math.pow(2,Math.floor(Math.log(i)/Math.LN2))}function Eh(i,e,t,n,r){const s=Math.cos,a=Math.sin,o=s(t/2),l=a(t/2),c=s((e+n)/2),u=a((e+n)/2),d=s((e-n)/2),h=a((e-n)/2),f=s((n-e)/2),g=a((n-e)/2);switch(r){case"XYX":i.set(o*u,l*d,l*h,o*c);break;case"YZY":i.set(l*h,o*u,l*d,o*c);break;case"ZXZ":i.set(l*d,l*h,o*u,o*c);break;case"XZX":i.set(o*u,l*g,l*f,o*c);break;case"YXY":i.set(l*f,o*u,l*g,o*c);break;case"ZYZ":i.set(l*g,l*f,o*u,o*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function ai(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return i/4294967295;case Uint16Array:return i/65535;case Uint8Array:return i/255;case Int32Array:return Math.max(i/2147483647,-1);case Int16Array:return Math.max(i/32767,-1);case Int8Array:return Math.max(i/127,-1);default:throw new Error("Invalid component type.")}}function xt(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return Math.round(i*4294967295);case Uint16Array:return Math.round(i*65535);case Uint8Array:return Math.round(i*255);case Int32Array:return Math.round(i*2147483647);case Int16Array:return Math.round(i*32767);case Int8Array:return Math.round(i*127);default:throw new Error("Invalid component type.")}}const Gl={DEG2RAD:di,RAD2DEG:Oi,generateUUID:xi,clamp:ht,euclideanModulo:ta,mapLinear:lh,inverseLerp:ch,lerp:Pi,damp:uh,pingpong:hh,smoothstep:dh,smootherstep:fh,randInt:ph,randFloat:mh,randFloatSpread:gh,seededRandom:_h,degToRad:xh,radToDeg:vh,isPowerOfTwo:Mh,ceilPowerOfTwo:Sh,floorPowerOfTwo:yh,setQuaternionFromProperEuler:Eh,normalize:xt,denormalize:ai};class ue{constructor(e=0,t=0){ue.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(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){const t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+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){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(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}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(ht(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}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,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,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){const n=Math.cos(t),r=Math.sin(t),s=this.x-e.x,a=this.y-e.y;return this.x=s*n-a*r+e.x,this.y=s*r+a*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Be{constructor(e,t,n,r,s,a,o,l,c){Be.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,r,s,a,o,l,c)}set(e,t,n,r,s,a,o,l,c){const u=this.elements;return u[0]=e,u[1]=r,u[2]=o,u[3]=t,u[4]=s,u[5]=l,u[6]=n,u[7]=a,u[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const 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){const n=e.elements,r=t.elements,s=this.elements,a=n[0],o=n[3],l=n[6],c=n[1],u=n[4],d=n[7],h=n[2],f=n[5],g=n[8],_=r[0],m=r[3],p=r[6],E=r[1],v=r[4],b=r[7],R=r[2],T=r[5],A=r[8];return s[0]=a*_+o*E+l*R,s[3]=a*m+o*v+l*T,s[6]=a*p+o*b+l*A,s[1]=c*_+u*E+d*R,s[4]=c*m+u*v+d*T,s[7]=c*p+u*b+d*A,s[2]=h*_+f*E+g*R,s[5]=h*m+f*v+g*T,s[8]=h*p+f*b+g*A,this}multiplyScalar(e){const 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(){const e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],u=e[8];return t*a*u-t*o*c-n*s*u+n*o*l+r*s*c-r*a*l}invert(){const e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],u=e[8],d=u*a-o*c,h=o*l-u*s,f=c*s-a*l,g=t*d+n*h+r*f;if(g===0)return this.set(0,0,0,0,0,0,0,0,0);const _=1/g;return e[0]=d*_,e[1]=(r*c-u*n)*_,e[2]=(o*n-r*a)*_,e[3]=h*_,e[4]=(u*t-r*l)*_,e[5]=(r*s-o*t)*_,e[6]=f*_,e[7]=(n*l-c*t)*_,e[8]=(a*t-n*s)*_,this}transpose(){let e;const 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){const 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,n,r,s,a,o){const l=Math.cos(s),c=Math.sin(s);return this.set(n*l,n*c,-n*(l*a+c*o)+a+e,-r*c,r*l,-r*(-c*a+l*o)+o+t,0,0,1),this}scale(e,t){return this.premultiply(Qr.makeScale(e,t)),this}rotate(e){return this.premultiply(Qr.makeRotation(-e)),this}translate(e,t){return this.premultiply(Qr.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,n=e.elements;for(let r=0;r<9;r++)if(t[r]!==n[r])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const Qr=new Be;function Wl(i){for(let e=i.length-1;e>=0;--e)if(i[e]>=65535)return!0;return!1}function Lr(i){return document.createElementNS("http://www.w3.org/1999/xhtml",i)}function bh(){const i=Lr("canvas");return i.style.display="block",i}const so={};function Th(i){i in so||(so[i]=!0,console.warn(i))}const ao=new Be().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),oo=new Be().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),$i={[xn]:{transfer:wr,primaries:Cr,toReference:i=>i,fromReference:i=>i},[It]:{transfer:Ke,primaries:Cr,toReference:i=>i.convertSRGBToLinear(),fromReference:i=>i.convertLinearToSRGB()},[Or]:{transfer:wr,primaries:Rr,toReference:i=>i.applyMatrix3(oo),fromReference:i=>i.applyMatrix3(ao)},[ea]:{transfer:Ke,primaries:Rr,toReference:i=>i.convertSRGBToLinear().applyMatrix3(oo),fromReference:i=>i.applyMatrix3(ao).convertLinearToSRGB()}},Dh=new Set([xn,Or]),je={enabled:!0,_workingColorSpace:xn,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(i){if(!Dh.has(i))throw new Error(`Unsupported working color space, "${i}".`);this._workingColorSpace=i},convert:function(i,e,t){if(this.enabled===!1||e===t||!e||!t)return i;const n=$i[e].toReference,r=$i[t].fromReference;return r(n(i))},fromWorkingColorSpace:function(i,e){return this.convert(i,this._workingColorSpace,e)},toWorkingColorSpace:function(i,e){return this.convert(i,e,this._workingColorSpace)},getPrimaries:function(i){return $i[i].primaries},getTransfer:function(i){return i===dn?wr:$i[i].transfer}};function fi(i){return i<.04045?i*.0773993808:Math.pow(i*.9478672986+.0521327014,2.4)}function es(i){return i<.0031308?i*12.92:1.055*Math.pow(i,.41666)-.055}let Wn;class Ah{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{Wn===void 0&&(Wn=Lr("canvas")),Wn.width=e.width,Wn.height=e.height;const n=Wn.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=Wn}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=Lr("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const r=n.getImageData(0,0,e.width,e.height),s=r.data;for(let a=0;a<s.length;a++)s[a]=fi(s[a]/255)*255;return n.putImageData(r,0,0),t}else if(e.data){const t=e.data.slice(0);for(let n=0;n<t.length;n++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[n]=Math.floor(fi(t[n]/255)*255):t[n]=fi(t[n]);return{data:t,width:e.width,height:e.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let wh=0;class Xl{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:wh++}),this.uuid=xi(),this.data=e,this.dataReady=!0,this.version=0}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const n={uuid:this.uuid,url:""},r=this.data;if(r!==null){let s;if(Array.isArray(r)){s=[];for(let a=0,o=r.length;a<o;a++)r[a].isDataTexture?s.push(ts(r[a].image)):s.push(ts(r[a]))}else s=ts(r);n.url=s}return t||(e.images[this.uuid]=n),n}}function ts(i){return typeof HTMLImageElement<"u"&&i instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&i instanceof ImageBitmap?Ah.getDataURL(i):i.data?{data:Array.from(i.data),width:i.width,height:i.height,type:i.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let Ch=0;class Tt extends Nn{constructor(e=Tt.DEFAULT_IMAGE,t=Tt.DEFAULT_MAPPING,n=Pn,r=Pn,s=zt,a=Ln,o=Xt,l=mn,c=Tt.DEFAULT_ANISOTROPY,u=dn){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Ch++}),this.uuid=xi(),this.name="",this.source=new Xl(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=r,this.magFilter=s,this.minFilter=a,this.anisotropy=c,this.format=o,this.internalFormat=null,this.type=l,this.offset=new ue(0,0),this.repeat=new ue(1,1),this.center=new ue(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Be,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=u,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.pmremVersion=0}get image(){return this.source.data}set image(e=null){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.channel=e.channel,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.colorSpace=e.colorSpace,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const n={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==Fl)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Gs:e.x=e.x-Math.floor(e.x);break;case Pn:e.x=e.x<0?0:1;break;case Ws:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case Gs:e.y=e.y-Math.floor(e.y);break;case Pn:e.y=e.y<0?0:1;break;case Ws:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}Tt.DEFAULT_IMAGE=null;Tt.DEFAULT_MAPPING=Fl;Tt.DEFAULT_ANISOTROPY=1;class dt{constructor(e=0,t=0,n=0,r=1){dt.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,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,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,n=this.y,r=this.z,s=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*r+a[12]*s,this.y=a[1]*t+a[5]*n+a[9]*r+a[13]*s,this.z=a[2]*t+a[6]*n+a[10]*r+a[14]*s,this.w=a[3]*t+a[7]*n+a[11]*r+a[15]*s,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const 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,n,r,s;const l=e.elements,c=l[0],u=l[4],d=l[8],h=l[1],f=l[5],g=l[9],_=l[2],m=l[6],p=l[10];if(Math.abs(u-h)<.01&&Math.abs(d-_)<.01&&Math.abs(g-m)<.01){if(Math.abs(u+h)<.1&&Math.abs(d+_)<.1&&Math.abs(g+m)<.1&&Math.abs(c+f+p-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const v=(c+1)/2,b=(f+1)/2,R=(p+1)/2,T=(u+h)/4,A=(d+_)/4,P=(g+m)/4;return v>b&&v>R?v<.01?(n=0,r=.707106781,s=.707106781):(n=Math.sqrt(v),r=T/n,s=A/n):b>R?b<.01?(n=.707106781,r=0,s=.707106781):(r=Math.sqrt(b),n=T/r,s=P/r):R<.01?(n=.707106781,r=.707106781,s=0):(s=Math.sqrt(R),n=A/s,r=P/s),this.set(n,r,s,t),this}let E=Math.sqrt((m-g)*(m-g)+(d-_)*(d-_)+(h-u)*(h-u));return Math.abs(E)<.001&&(E=1),this.x=(m-g)/E,this.y=(d-_)/E,this.z=(h-u)/E,this.w=Math.acos((c+f+p-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){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(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,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,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}}class Rh extends Nn{constructor(e=1,t=1,n={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new dt(0,0,e,t),this.scissorTest=!1,this.viewport=new dt(0,0,e,t);const r={width:e,height:t,depth:1};n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:zt,depthBuffer:!0,stencilBuffer:!1,depthTexture:null,samples:0,count:1},n);const s=new Tt(r,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.colorSpace);s.flipY=!1,s.generateMipmaps=n.generateMipmaps,s.internalFormat=n.internalFormat,this.textures=[];const a=n.count;for(let o=0;o<a;o++)this.textures[o]=s.clone(),this.textures[o].isRenderTargetTexture=!0;this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.depthTexture=n.depthTexture,this.samples=n.samples}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let r=0,s=this.textures.length;r<s;r++)this.textures[r].image.width=e,this.textures[r].image.height=t,this.textures[r].image.depth=n;this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let n=0,r=e.textures.length;n<r;n++)this.textures[n]=e.textures[n].clone(),this.textures[n].isRenderTargetTexture=!0;const t=Object.assign({},e.texture.image);return this.texture.source=new Xl(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class Ht extends Rh{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}}class ql extends Tt{constructor(e=null,t=1,n=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=Ut,this.minFilter=Ut,this.wrapR=Pn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Ph extends Tt{constructor(e=null,t=1,n=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=Ut,this.minFilter=Ut,this.wrapR=Pn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Fn{constructor(e=0,t=0,n=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=r}static slerpFlat(e,t,n,r,s,a,o){let l=n[r+0],c=n[r+1],u=n[r+2],d=n[r+3];const h=s[a+0],f=s[a+1],g=s[a+2],_=s[a+3];if(o===0){e[t+0]=l,e[t+1]=c,e[t+2]=u,e[t+3]=d;return}if(o===1){e[t+0]=h,e[t+1]=f,e[t+2]=g,e[t+3]=_;return}if(d!==_||l!==h||c!==f||u!==g){let m=1-o;const p=l*h+c*f+u*g+d*_,E=p>=0?1:-1,v=1-p*p;if(v>Number.EPSILON){const R=Math.sqrt(v),T=Math.atan2(R,p*E);m=Math.sin(m*T)/R,o=Math.sin(o*T)/R}const b=o*E;if(l=l*m+h*b,c=c*m+f*b,u=u*m+g*b,d=d*m+_*b,m===1-o){const R=1/Math.sqrt(l*l+c*c+u*u+d*d);l*=R,c*=R,u*=R,d*=R}}e[t]=l,e[t+1]=c,e[t+2]=u,e[t+3]=d}static multiplyQuaternionsFlat(e,t,n,r,s,a){const o=n[r],l=n[r+1],c=n[r+2],u=n[r+3],d=s[a],h=s[a+1],f=s[a+2],g=s[a+3];return e[t]=o*g+u*d+l*f-c*h,e[t+1]=l*g+u*h+c*d-o*f,e[t+2]=c*g+u*f+o*h-l*d,e[t+3]=u*g-o*d-l*h-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,n,r){return this._x=e,this._y=t,this._z=n,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=!0){const n=e._x,r=e._y,s=e._z,a=e._order,o=Math.cos,l=Math.sin,c=o(n/2),u=o(r/2),d=o(s/2),h=l(n/2),f=l(r/2),g=l(s/2);switch(a){case"XYZ":this._x=h*u*d+c*f*g,this._y=c*f*d-h*u*g,this._z=c*u*g+h*f*d,this._w=c*u*d-h*f*g;break;case"YXZ":this._x=h*u*d+c*f*g,this._y=c*f*d-h*u*g,this._z=c*u*g-h*f*d,this._w=c*u*d+h*f*g;break;case"ZXY":this._x=h*u*d-c*f*g,this._y=c*f*d+h*u*g,this._z=c*u*g+h*f*d,this._w=c*u*d-h*f*g;break;case"ZYX":this._x=h*u*d-c*f*g,this._y=c*f*d+h*u*g,this._z=c*u*g-h*f*d,this._w=c*u*d+h*f*g;break;case"YZX":this._x=h*u*d+c*f*g,this._y=c*f*d+h*u*g,this._z=c*u*g-h*f*d,this._w=c*u*d-h*f*g;break;case"XZY":this._x=h*u*d-c*f*g,this._y=c*f*d-h*u*g,this._z=c*u*g+h*f*d,this._w=c*u*d+h*f*g;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],r=t[4],s=t[8],a=t[1],o=t[5],l=t[9],c=t[2],u=t[6],d=t[10],h=n+o+d;if(h>0){const f=.5/Math.sqrt(h+1);this._w=.25/f,this._x=(u-l)*f,this._y=(s-c)*f,this._z=(a-r)*f}else if(n>o&&n>d){const f=2*Math.sqrt(1+n-o-d);this._w=(u-l)/f,this._x=.25*f,this._y=(r+a)/f,this._z=(s+c)/f}else if(o>d){const f=2*Math.sqrt(1+o-n-d);this._w=(s-c)/f,this._x=(r+a)/f,this._y=.25*f,this._z=(l+u)/f}else{const f=2*Math.sqrt(1+d-n-o);this._w=(a-r)/f,this._x=(s+c)/f,this._y=(l+u)/f,this._z=.25*f}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<Number.EPSILON?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(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=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(ht(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(n===0)return this;const r=Math.min(1,t/n);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,r=e._y,s=e._z,a=e._w,o=t._x,l=t._y,c=t._z,u=t._w;return this._x=n*u+a*o+r*c-s*l,this._y=r*u+a*l+s*o-n*c,this._z=s*u+a*c+n*l-r*o,this._w=a*u-n*o-r*l-s*c,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const n=this._x,r=this._y,s=this._z,a=this._w;let o=a*e._w+n*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=n,this._y=r,this._z=s,this;const l=1-o*o;if(l<=Number.EPSILON){const f=1-t;return this._w=f*a+t*this._w,this._x=f*n+t*this._x,this._y=f*r+t*this._y,this._z=f*s+t*this._z,this.normalize(),this}const c=Math.sqrt(l),u=Math.atan2(c,o),d=Math.sin((1-t)*u)/c,h=Math.sin(t*u)/c;return this._w=a*d+this._w*h,this._x=n*d+this._x*h,this._y=r*d+this._y*h,this._z=s*d+this._z*h,this._onChangeCallback(),this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),r=Math.sqrt(1-n),s=Math.sqrt(n);return this.set(r*Math.sin(e),r*Math.cos(e),s*Math.sin(t),s*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class I{constructor(e=0,t=0,n=0){I.prototype.isVector3=!0,this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(lo.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(lo.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[3]*n+s[6]*r,this.y=s[1]*t+s[4]*n+s[7]*r,this.z=s[2]*t+s[5]*n+s[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,r=this.z,s=e.elements,a=1/(s[3]*t+s[7]*n+s[11]*r+s[15]);return this.x=(s[0]*t+s[4]*n+s[8]*r+s[12])*a,this.y=(s[1]*t+s[5]*n+s[9]*r+s[13])*a,this.z=(s[2]*t+s[6]*n+s[10]*r+s[14])*a,this}applyQuaternion(e){const t=this.x,n=this.y,r=this.z,s=e.x,a=e.y,o=e.z,l=e.w,c=2*(a*r-o*n),u=2*(o*t-s*r),d=2*(s*n-a*t);return this.x=t+l*c+a*d-o*u,this.y=n+l*u+o*c-s*d,this.z=r+l*d+s*u-a*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,n=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*r,this.y=s[1]*t+s[5]*n+s[9]*r,this.z=s[2]*t+s[6]*n+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){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(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,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,r=e.y,s=e.z,a=t.x,o=t.y,l=t.z;return this.x=r*l-s*o,this.y=s*a-n*l,this.z=n*o-r*a,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return ns.copy(this).projectOnVector(e),this.sub(ns)}reflect(e){return this.sub(ns.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(ht(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+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,n){const r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,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(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const ns=new I,lo=new Fn;class ki{constructor(e=new I(1/0,1/0,1/0),t=new I(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t+=3)this.expandByPoint(Nt.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(Nt.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=Nt.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),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);const n=e.geometry;if(n!==void 0){const s=n.getAttribute("position");if(t===!0&&s!==void 0&&e.isInstancedMesh!==!0)for(let a=0,o=s.count;a<o;a++)e.isMesh===!0?e.getVertexPosition(a,Nt):Nt.fromBufferAttribute(s,a),Nt.applyMatrix4(e.matrixWorld),this.expandByPoint(Nt);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),ji.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),ji.copy(n.boundingBox)),ji.applyMatrix4(e.matrixWorld),this.union(ji)}const r=e.children;for(let s=0,a=r.length;s<a;s++)this.expandByObject(r[s],t);return this}containsPoint(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y||e.z<this.min.z||e.z>this.max.z)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y||e.max.z<this.min.z||e.min.z>this.max.z)}intersectsSphere(e){return this.clampPoint(e.center,Nt),Nt.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Ti),Ki.subVectors(this.max,Ti),Xn.subVectors(e.a,Ti),qn.subVectors(e.b,Ti),Yn.subVectors(e.c,Ti),sn.subVectors(qn,Xn),an.subVectors(Yn,qn),Sn.subVectors(Xn,Yn);let t=[0,-sn.z,sn.y,0,-an.z,an.y,0,-Sn.z,Sn.y,sn.z,0,-sn.x,an.z,0,-an.x,Sn.z,0,-Sn.x,-sn.y,sn.x,0,-an.y,an.x,0,-Sn.y,Sn.x,0];return!is(t,Xn,qn,Yn,Ki)||(t=[1,0,0,0,1,0,0,0,1],!is(t,Xn,qn,Yn,Ki))?!1:(Zi.crossVectors(sn,an),t=[Zi.x,Zi.y,Zi.z],is(t,Xn,qn,Yn,Ki))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Nt).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Nt).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(Yt[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Yt[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Yt[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Yt[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Yt[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Yt[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Yt[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Yt[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Yt),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)}}const Yt=[new I,new I,new I,new I,new I,new I,new I,new I],Nt=new I,ji=new ki,Xn=new I,qn=new I,Yn=new I,sn=new I,an=new I,Sn=new I,Ti=new I,Ki=new I,Zi=new I,yn=new I;function is(i,e,t,n,r){for(let s=0,a=i.length-3;s<=a;s+=3){yn.fromArray(i,s);const o=r.x*Math.abs(yn.x)+r.y*Math.abs(yn.y)+r.z*Math.abs(yn.z),l=e.dot(yn),c=t.dot(yn),u=n.dot(yn);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>o)return!1}return!0}const Lh=new ki,Di=new I,rs=new I;class Hi{constructor(e=new I,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const n=this.center;t!==void 0?n.copy(t):Lh.setFromPoints(e).getCenter(n);let r=0;for(let s=0,a=e.length;s<a;s++)r=Math.max(r,n.distanceToSquared(e[s]));return this.radius=Math.sqrt(r),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const 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){const n=this.center.distanceToSquared(e);return t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;Di.subVectors(e,this.center);const t=Di.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),r=(n-this.radius)*.5;this.center.addScaledVector(Di,r/n),this.radius+=r}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(rs.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Di.copy(e.center).add(rs)),this.expandByPoint(Di.copy(e.center).sub(rs))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const $t=new I,ss=new I,Ji=new I,on=new I,as=new I,Qi=new I,os=new I;class Br{constructor(e=new I,t=new I(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,$t)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=$t.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):($t.copy(this.origin).addScaledVector(this.direction,t),$t.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){ss.copy(e).add(t).multiplyScalar(.5),Ji.copy(t).sub(e).normalize(),on.copy(this.origin).sub(ss);const s=e.distanceTo(t)*.5,a=-this.direction.dot(Ji),o=on.dot(this.direction),l=-on.dot(Ji),c=on.lengthSq(),u=Math.abs(1-a*a);let d,h,f,g;if(u>0)if(d=a*l-o,h=a*o-l,g=s*u,d>=0)if(h>=-g)if(h<=g){const _=1/u;d*=_,h*=_,f=d*(d+a*h+2*o)+h*(a*d+h+2*l)+c}else h=s,d=Math.max(0,-(a*h+o)),f=-d*d+h*(h+2*l)+c;else h=-s,d=Math.max(0,-(a*h+o)),f=-d*d+h*(h+2*l)+c;else h<=-g?(d=Math.max(0,-(-a*s+o)),h=d>0?-s:Math.min(Math.max(-s,-l),s),f=-d*d+h*(h+2*l)+c):h<=g?(d=0,h=Math.min(Math.max(-s,-l),s),f=h*(h+2*l)+c):(d=Math.max(0,-(a*s+o)),h=d>0?s:Math.min(Math.max(-s,-l),s),f=-d*d+h*(h+2*l)+c);else h=a>0?-s:s,d=Math.max(0,-(a*h+o)),f=-d*d+h*(h+2*l)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,d),r&&r.copy(ss).addScaledVector(Ji,h),f}intersectSphere(e,t){$t.subVectors(e.center,this.origin);const n=$t.dot(this.direction),r=$t.dot($t)-n*n,s=e.radius*e.radius;if(r>s)return null;const a=Math.sqrt(s-r),o=n-a,l=n+a;return l<0?null:o<0?this.at(l,t):this.at(o,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,r,s,a,o,l;const c=1/this.direction.x,u=1/this.direction.y,d=1/this.direction.z,h=this.origin;return c>=0?(n=(e.min.x-h.x)*c,r=(e.max.x-h.x)*c):(n=(e.max.x-h.x)*c,r=(e.min.x-h.x)*c),u>=0?(s=(e.min.y-h.y)*u,a=(e.max.y-h.y)*u):(s=(e.max.y-h.y)*u,a=(e.min.y-h.y)*u),n>a||s>r||((s>n||isNaN(n))&&(n=s),(a<r||isNaN(r))&&(r=a),d>=0?(o=(e.min.z-h.z)*d,l=(e.max.z-h.z)*d):(o=(e.max.z-h.z)*d,l=(e.min.z-h.z)*d),n>l||o>r)||((o>n||n!==n)&&(n=o),(l<r||r!==r)&&(r=l),r<0)?null:this.at(n>=0?n:r,t)}intersectsBox(e){return this.intersectBox(e,$t)!==null}intersectTriangle(e,t,n,r,s){as.subVectors(t,e),Qi.subVectors(n,e),os.crossVectors(as,Qi);let a=this.direction.dot(os),o;if(a>0){if(r)return null;o=1}else if(a<0)o=-1,a=-a;else return null;on.subVectors(this.origin,e);const l=o*this.direction.dot(Qi.crossVectors(on,Qi));if(l<0)return null;const c=o*this.direction.dot(as.cross(on));if(c<0||l+c>a)return null;const u=-o*on.dot(os);return u<0?null:this.at(u/a,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class et{constructor(e,t,n,r,s,a,o,l,c,u,d,h,f,g,_,m){et.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,n,r,s,a,o,l,c,u,d,h,f,g,_,m)}set(e,t,n,r,s,a,o,l,c,u,d,h,f,g,_,m){const p=this.elements;return p[0]=e,p[4]=t,p[8]=n,p[12]=r,p[1]=s,p[5]=a,p[9]=o,p[13]=l,p[2]=c,p[6]=u,p[10]=d,p[14]=h,p[3]=f,p[7]=g,p[11]=_,p[15]=m,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new et().fromArray(this.elements)}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){const t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){const 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,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,n=e.elements,r=1/$n.setFromMatrixColumn(e,0).length(),s=1/$n.setFromMatrixColumn(e,1).length(),a=1/$n.setFromMatrixColumn(e,2).length();return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=0,t[4]=n[4]*s,t[5]=n[5]*s,t[6]=n[6]*s,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,n=e.x,r=e.y,s=e.z,a=Math.cos(n),o=Math.sin(n),l=Math.cos(r),c=Math.sin(r),u=Math.cos(s),d=Math.sin(s);if(e.order==="XYZ"){const h=a*u,f=a*d,g=o*u,_=o*d;t[0]=l*u,t[4]=-l*d,t[8]=c,t[1]=f+g*c,t[5]=h-_*c,t[9]=-o*l,t[2]=_-h*c,t[6]=g+f*c,t[10]=a*l}else if(e.order==="YXZ"){const h=l*u,f=l*d,g=c*u,_=c*d;t[0]=h+_*o,t[4]=g*o-f,t[8]=a*c,t[1]=a*d,t[5]=a*u,t[9]=-o,t[2]=f*o-g,t[6]=_+h*o,t[10]=a*l}else if(e.order==="ZXY"){const h=l*u,f=l*d,g=c*u,_=c*d;t[0]=h-_*o,t[4]=-a*d,t[8]=g+f*o,t[1]=f+g*o,t[5]=a*u,t[9]=_-h*o,t[2]=-a*c,t[6]=o,t[10]=a*l}else if(e.order==="ZYX"){const h=a*u,f=a*d,g=o*u,_=o*d;t[0]=l*u,t[4]=g*c-f,t[8]=h*c+_,t[1]=l*d,t[5]=_*c+h,t[9]=f*c-g,t[2]=-c,t[6]=o*l,t[10]=a*l}else if(e.order==="YZX"){const h=a*l,f=a*c,g=o*l,_=o*c;t[0]=l*u,t[4]=_-h*d,t[8]=g*d+f,t[1]=d,t[5]=a*u,t[9]=-o*u,t[2]=-c*u,t[6]=f*d+g,t[10]=h-_*d}else if(e.order==="XZY"){const h=a*l,f=a*c,g=o*l,_=o*c;t[0]=l*u,t[4]=-d,t[8]=c*u,t[1]=h*d+_,t[5]=a*u,t[9]=f*d-g,t[2]=g*d-f,t[6]=o*u,t[10]=_*d+h}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(Fh,e,Ih)}lookAt(e,t,n){const r=this.elements;return wt.subVectors(e,t),wt.lengthSq()===0&&(wt.z=1),wt.normalize(),ln.crossVectors(n,wt),ln.lengthSq()===0&&(Math.abs(n.z)===1?wt.x+=1e-4:wt.z+=1e-4,wt.normalize(),ln.crossVectors(n,wt)),ln.normalize(),er.crossVectors(wt,ln),r[0]=ln.x,r[4]=er.x,r[8]=wt.x,r[1]=ln.y,r[5]=er.y,r[9]=wt.y,r[2]=ln.z,r[6]=er.z,r[10]=wt.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,r=t.elements,s=this.elements,a=n[0],o=n[4],l=n[8],c=n[12],u=n[1],d=n[5],h=n[9],f=n[13],g=n[2],_=n[6],m=n[10],p=n[14],E=n[3],v=n[7],b=n[11],R=n[15],T=r[0],A=r[4],P=r[8],y=r[12],M=r[1],F=r[5],L=r[9],C=r[13],U=r[2],H=r[6],Y=r[10],J=r[14],z=r[3],j=r[7],$=r[11],N=r[15];return s[0]=a*T+o*M+l*U+c*z,s[4]=a*A+o*F+l*H+c*j,s[8]=a*P+o*L+l*Y+c*$,s[12]=a*y+o*C+l*J+c*N,s[1]=u*T+d*M+h*U+f*z,s[5]=u*A+d*F+h*H+f*j,s[9]=u*P+d*L+h*Y+f*$,s[13]=u*y+d*C+h*J+f*N,s[2]=g*T+_*M+m*U+p*z,s[6]=g*A+_*F+m*H+p*j,s[10]=g*P+_*L+m*Y+p*$,s[14]=g*y+_*C+m*J+p*N,s[3]=E*T+v*M+b*U+R*z,s[7]=E*A+v*F+b*H+R*j,s[11]=E*P+v*L+b*Y+R*$,s[15]=E*y+v*C+b*J+R*N,this}multiplyScalar(e){const 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(){const e=this.elements,t=e[0],n=e[4],r=e[8],s=e[12],a=e[1],o=e[5],l=e[9],c=e[13],u=e[2],d=e[6],h=e[10],f=e[14],g=e[3],_=e[7],m=e[11],p=e[15];return g*(+s*l*d-r*c*d-s*o*h+n*c*h+r*o*f-n*l*f)+_*(+t*l*f-t*c*h+s*a*h-r*a*f+r*c*u-s*l*u)+m*(+t*c*d-t*o*f-s*a*d+n*a*f+s*o*u-n*c*u)+p*(-r*o*u-t*l*d+t*o*h+r*a*d-n*a*h+n*l*u)}transpose(){const e=this.elements;let 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,n){const 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]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],u=e[8],d=e[9],h=e[10],f=e[11],g=e[12],_=e[13],m=e[14],p=e[15],E=d*m*c-_*h*c+_*l*f-o*m*f-d*l*p+o*h*p,v=g*h*c-u*m*c-g*l*f+a*m*f+u*l*p-a*h*p,b=u*_*c-g*d*c+g*o*f-a*_*f-u*o*p+a*d*p,R=g*d*l-u*_*l-g*o*h+a*_*h+u*o*m-a*d*m,T=t*E+n*v+r*b+s*R;if(T===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const A=1/T;return e[0]=E*A,e[1]=(_*h*s-d*m*s-_*r*f+n*m*f+d*r*p-n*h*p)*A,e[2]=(o*m*s-_*l*s+_*r*c-n*m*c-o*r*p+n*l*p)*A,e[3]=(d*l*s-o*h*s-d*r*c+n*h*c+o*r*f-n*l*f)*A,e[4]=v*A,e[5]=(u*m*s-g*h*s+g*r*f-t*m*f-u*r*p+t*h*p)*A,e[6]=(g*l*s-a*m*s-g*r*c+t*m*c+a*r*p-t*l*p)*A,e[7]=(a*h*s-u*l*s+u*r*c-t*h*c-a*r*f+t*l*f)*A,e[8]=b*A,e[9]=(g*d*s-u*_*s-g*n*f+t*_*f+u*n*p-t*d*p)*A,e[10]=(a*_*s-g*o*s+g*n*c-t*_*c-a*n*p+t*o*p)*A,e[11]=(u*o*s-a*d*s-u*n*c+t*d*c+a*n*f-t*o*f)*A,e[12]=R*A,e[13]=(u*_*r-g*d*r+g*n*h-t*_*h-u*n*m+t*d*m)*A,e[14]=(g*o*r-a*_*r-g*n*l+t*_*l+a*n*m-t*o*m)*A,e[15]=(a*d*r-u*o*r+u*n*l-t*d*l-a*n*h+t*o*h)*A,this}scale(e){const t=this.elements,n=e.x,r=e.y,s=e.z;return t[0]*=n,t[4]*=r,t[8]*=s,t[1]*=n,t[5]*=r,t[9]*=s,t[2]*=n,t[6]*=r,t[10]*=s,t[3]*=n,t[7]*=r,t[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,r))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const n=Math.cos(t),r=Math.sin(t),s=1-n,a=e.x,o=e.y,l=e.z,c=s*a,u=s*o;return this.set(c*a+n,c*o-r*l,c*l+r*o,0,c*o+r*l,u*o+n,u*l-r*a,0,c*l-r*o,u*l+r*a,s*l*l+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,r,s,a){return this.set(1,n,s,0,e,1,a,0,t,r,1,0,0,0,0,1),this}compose(e,t,n){const r=this.elements,s=t._x,a=t._y,o=t._z,l=t._w,c=s+s,u=a+a,d=o+o,h=s*c,f=s*u,g=s*d,_=a*u,m=a*d,p=o*d,E=l*c,v=l*u,b=l*d,R=n.x,T=n.y,A=n.z;return r[0]=(1-(_+p))*R,r[1]=(f+b)*R,r[2]=(g-v)*R,r[3]=0,r[4]=(f-b)*T,r[5]=(1-(h+p))*T,r[6]=(m+E)*T,r[7]=0,r[8]=(g+v)*A,r[9]=(m-E)*A,r[10]=(1-(h+_))*A,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,n){const r=this.elements;let s=$n.set(r[0],r[1],r[2]).length();const a=$n.set(r[4],r[5],r[6]).length(),o=$n.set(r[8],r[9],r[10]).length();this.determinant()<0&&(s=-s),e.x=r[12],e.y=r[13],e.z=r[14],Ot.copy(this);const c=1/s,u=1/a,d=1/o;return Ot.elements[0]*=c,Ot.elements[1]*=c,Ot.elements[2]*=c,Ot.elements[4]*=u,Ot.elements[5]*=u,Ot.elements[6]*=u,Ot.elements[8]*=d,Ot.elements[9]*=d,Ot.elements[10]*=d,t.setFromRotationMatrix(Ot),n.x=s,n.y=a,n.z=o,this}makePerspective(e,t,n,r,s,a,o=Qt){const l=this.elements,c=2*s/(t-e),u=2*s/(n-r),d=(t+e)/(t-e),h=(n+r)/(n-r);let f,g;if(o===Qt)f=-(a+s)/(a-s),g=-2*a*s/(a-s);else if(o===Pr)f=-a/(a-s),g=-a*s/(a-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return l[0]=c,l[4]=0,l[8]=d,l[12]=0,l[1]=0,l[5]=u,l[9]=h,l[13]=0,l[2]=0,l[6]=0,l[10]=f,l[14]=g,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,n,r,s,a,o=Qt){const l=this.elements,c=1/(t-e),u=1/(n-r),d=1/(a-s),h=(t+e)*c,f=(n+r)*u;let g,_;if(o===Qt)g=(a+s)*d,_=-2*d;else if(o===Pr)g=s*d,_=-1*d;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return l[0]=2*c,l[4]=0,l[8]=0,l[12]=-h,l[1]=0,l[5]=2*u,l[9]=0,l[13]=-f,l[2]=0,l[6]=0,l[10]=_,l[14]=-g,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){const t=this.elements,n=e.elements;for(let r=0;r<16;r++)if(t[r]!==n[r])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}const $n=new I,Ot=new et,Fh=new I(0,0,0),Ih=new I(1,1,1),ln=new I,er=new I,wt=new I,co=new et,uo=new Fn;let In=class Yl{constructor(e=0,t=0,n=0,r=Yl.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,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,n,r=this._order){return this._x=e,this._y=t,this._z=n,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,n=!0){const r=e.elements,s=r[0],a=r[4],o=r[8],l=r[1],c=r[5],u=r[9],d=r[2],h=r[6],f=r[10];switch(t){case"XYZ":this._y=Math.asin(ht(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-u,f),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(h,c),this._z=0);break;case"YXZ":this._x=Math.asin(-ht(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(o,f),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-d,s),this._z=0);break;case"ZXY":this._x=Math.asin(ht(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(-d,f),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-ht(d,-1,1)),Math.abs(d)<.9999999?(this._x=Math.atan2(h,f),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-a,c));break;case"YZX":this._z=Math.asin(ht(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-d,s)):(this._x=0,this._y=Math.atan2(o,f));break;case"XZY":this._z=Math.asin(-ht(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(h,c),this._y=Math.atan2(o,s)):(this._x=Math.atan2(-u,f),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return co.makeRotationFromQuaternion(e),this.setFromRotationMatrix(co,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return uo.setFromEuler(this),this.setFromQuaternion(uo,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}};In.DEFAULT_ORDER="XYZ";class $l{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}}let Uh=0;const ho=new I,jn=new Fn,jt=new et,tr=new I,Ai=new I,Nh=new I,Oh=new Fn,fo=new I(1,0,0),po=new I(0,1,0),mo=new I(0,0,1),go={type:"added"},Bh={type:"removed"},Kn={type:"childadded",child:null},ls={type:"childremoved",child:null};class yt extends Nn{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Uh++}),this.uuid=xi(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=yt.DEFAULT_UP.clone();const e=new I,t=new In,n=new Fn,r=new I(1,1,1);function s(){n.setFromEuler(t,!1)}function a(){t.setFromQuaternion(n,void 0,!1)}t._onChange(s),n._onChange(a),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new et},normalMatrix:{value:new Be}}),this.matrix=new et,this.matrixWorld=new et,this.matrixAutoUpdate=yt.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=yt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new $l,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return jn.setFromAxisAngle(e,t),this.quaternion.multiply(jn),this}rotateOnWorldAxis(e,t){return jn.setFromAxisAngle(e,t),this.quaternion.premultiply(jn),this}rotateX(e){return this.rotateOnAxis(fo,e)}rotateY(e){return this.rotateOnAxis(po,e)}rotateZ(e){return this.rotateOnAxis(mo,e)}translateOnAxis(e,t){return ho.copy(e).applyQuaternion(this.quaternion),this.position.add(ho.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(fo,e)}translateY(e){return this.translateOnAxis(po,e)}translateZ(e){return this.translateOnAxis(mo,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(jt.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?tr.copy(e):tr.set(e,t,n);const r=this.parent;this.updateWorldMatrix(!0,!1),Ai.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?jt.lookAt(Ai,tr,this.up):jt.lookAt(tr,Ai,this.up),this.quaternion.setFromRotationMatrix(jt),r&&(jt.extractRotation(r.matrixWorld),jn.setFromRotationMatrix(jt),this.quaternion.premultiply(jn.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(go),Kn.child=e,this.dispatchEvent(Kn),Kn.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}const t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(Bh),ls.child=e,this.dispatchEvent(ls),ls.child=null),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),jt.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),jt.multiply(e.parent.matrixWorld)),e.applyMatrix4(jt),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(go),Kn.child=e,this.dispatchEvent(Kn),Kn.child=null,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 n=0,r=this.children.length;n<r;n++){const a=this.children[n].getObjectByProperty(e,t);if(a!==void 0)return a}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);const r=this.children;for(let s=0,a=r.length;s<a;s++)r[s].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Ai,e,Nh),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Ai,Oh,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverseVisible(e)}traverseAncestors(e){const t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let n=0,r=t.length;n<r;n++){const s=t[n];(s.matrixWorldAutoUpdate===!0||e===!0)&&s.updateMatrixWorld(e)}}updateWorldMatrix(e,t){const n=this.parent;if(e===!0&&n!==null&&n.matrixWorldAutoUpdate===!0&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),t===!0){const r=this.children;for(let s=0,a=r.length;s<a;s++){const o=r[s];o.matrixWorldAutoUpdate===!0&&o.updateWorldMatrix(!1,!0)}}}toJSON(e){const t=e===void 0||typeof e=="string",n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});const r={};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.castShadow===!0&&(r.castShadow=!0),this.receiveShadow===!0&&(r.receiveShadow=!0),this.visible===!1&&(r.visible=!1),this.frustumCulled===!1&&(r.frustumCulled=!1),this.renderOrder!==0&&(r.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type="BatchedMesh",r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.visibility=this._visibility,r.active=this._active,r.bounds=this._bounds.map(o=>({boxInitialized:o.boxInitialized,boxMin:o.box.min.toArray(),boxMax:o.box.max.toArray(),sphereInitialized:o.sphereInitialized,sphereRadius:o.sphere.radius,sphereCenter:o.sphere.center.toArray()})),r.maxGeometryCount=this._maxGeometryCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.geometryCount=this._geometryCount,r.matricesTexture=this._matricesTexture.toJSON(e),this.boundingSphere!==null&&(r.boundingSphere={center:r.boundingSphere.center.toArray(),radius:r.boundingSphere.radius}),this.boundingBox!==null&&(r.boundingBox={min:r.boundingBox.min.toArray(),max:r.boundingBox.max.toArray()}));function s(o,l){return o[l.uuid]===void 0&&(o[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=s(e.geometries,this.geometry);const o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){const l=o.shapes;if(Array.isArray(l))for(let c=0,u=l.length;c<u;c++){const d=l[c];s(e.shapes,d)}else s(e.shapes,l)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const o=[];for(let l=0,c=this.material.length;l<c;l++)o.push(s(e.materials,this.material[l]));r.material=o}else r.material=s(e.materials,this.material);if(this.children.length>0){r.children=[];for(let o=0;o<this.children.length;o++)r.children.push(this.children[o].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let o=0;o<this.animations.length;o++){const l=this.animations[o];r.animations.push(s(e.animations,l))}}if(t){const o=a(e.geometries),l=a(e.materials),c=a(e.textures),u=a(e.images),d=a(e.shapes),h=a(e.skeletons),f=a(e.animations),g=a(e.nodes);o.length>0&&(n.geometries=o),l.length>0&&(n.materials=l),c.length>0&&(n.textures=c),u.length>0&&(n.images=u),d.length>0&&(n.shapes=d),h.length>0&&(n.skeletons=h),f.length>0&&(n.animations=f),g.length>0&&(n.nodes=g)}return n.object=r,n;function a(o){const l=[];for(const c in o){const u=o[c];delete u.metadata,l.push(u)}return l}}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.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,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.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n<e.children.length;n++){const r=e.children[n];this.add(r.clone())}return this}}yt.DEFAULT_UP=new I(0,1,0);yt.DEFAULT_MATRIX_AUTO_UPDATE=!0;yt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const Bt=new I,Kt=new I,cs=new I,Zt=new I,Zn=new I,Jn=new I,_o=new I,us=new I,hs=new I,ds=new I;let Ci=class oi{constructor(e=new I,t=new I,n=new I){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,r){r.subVectors(n,t),Bt.subVectors(e,t),r.cross(Bt);const s=r.lengthSq();return s>0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(e,t,n,r,s){Bt.subVectors(r,t),Kt.subVectors(n,t),cs.subVectors(e,t);const a=Bt.dot(Bt),o=Bt.dot(Kt),l=Bt.dot(cs),c=Kt.dot(Kt),u=Kt.dot(cs),d=a*c-o*o;if(d===0)return s.set(0,0,0),null;const h=1/d,f=(c*l-o*u)*h,g=(a*u-o*l)*h;return s.set(1-f-g,g,f)}static containsPoint(e,t,n,r){return this.getBarycoord(e,t,n,r,Zt)===null?!1:Zt.x>=0&&Zt.y>=0&&Zt.x+Zt.y<=1}static getInterpolation(e,t,n,r,s,a,o,l){return this.getBarycoord(e,t,n,r,Zt)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(s,Zt.x),l.addScaledVector(a,Zt.y),l.addScaledVector(o,Zt.z),l)}static isFrontFacing(e,t,n,r){return Bt.subVectors(n,t),Kt.subVectors(e,t),Bt.cross(Kt).dot(r)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,n,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),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 Bt.subVectors(this.c,this.b),Kt.subVectors(this.a,this.b),Bt.cross(Kt).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return oi.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return oi.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,r,s){return oi.getInterpolation(e,this.a,this.b,this.c,t,n,r,s)}containsPoint(e){return oi.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return oi.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,r=this.b,s=this.c;let a,o;Zn.subVectors(r,n),Jn.subVectors(s,n),us.subVectors(e,n);const l=Zn.dot(us),c=Jn.dot(us);if(l<=0&&c<=0)return t.copy(n);hs.subVectors(e,r);const u=Zn.dot(hs),d=Jn.dot(hs);if(u>=0&&d<=u)return t.copy(r);const h=l*d-u*c;if(h<=0&&l>=0&&u<=0)return a=l/(l-u),t.copy(n).addScaledVector(Zn,a);ds.subVectors(e,s);const f=Zn.dot(ds),g=Jn.dot(ds);if(g>=0&&f<=g)return t.copy(s);const _=f*c-l*g;if(_<=0&&c>=0&&g<=0)return o=c/(c-g),t.copy(n).addScaledVector(Jn,o);const m=u*g-f*d;if(m<=0&&d-u>=0&&f-g>=0)return _o.subVectors(s,r),o=(d-u)/(d-u+(f-g)),t.copy(r).addScaledVector(_o,o);const p=1/(m+_+h);return a=_*p,o=h*p,t.copy(n).addScaledVector(Zn,a).addScaledVector(Jn,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}};const jl={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},cn={h:0,s:0,l:0},nr={h:0,s:0,l:0};function fs(i,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?i+(e-i)*6*t:t<1/2?e:t<2/3?i+(e-i)*6*(2/3-t):i}let be=class{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){const r=e;r&&r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&&this.setStyle(r)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=It){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,je.toWorkingColorSpace(this,t),this}setRGB(e,t,n,r=je.workingColorSpace){return this.r=e,this.g=t,this.b=n,je.toWorkingColorSpace(this,r),this}setHSL(e,t,n,r=je.workingColorSpace){if(e=ta(e,1),t=ht(t,0,1),n=ht(n,0,1),t===0)this.r=this.g=this.b=n;else{const s=n<=.5?n*(1+t):n+t-n*t,a=2*n-s;this.r=fs(a,s,e+1/3),this.g=fs(a,s,e),this.b=fs(a,s,e-1/3)}return je.toWorkingColorSpace(this,r),this}setStyle(e,t=It){function n(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const a=r[1],o=r[2];switch(a){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,t);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=r[1],a=s.length;if(a===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(a===6)return this.setHex(parseInt(s,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=It){const n=jl[e.toLowerCase()];return n!==void 0?this.setHex(n,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=fi(e.r),this.g=fi(e.g),this.b=fi(e.b),this}copyLinearToSRGB(e){return this.r=es(e.r),this.g=es(e.g),this.b=es(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=It){return je.fromWorkingColorSpace(gt.copy(this),e),Math.round(ht(gt.r*255,0,255))*65536+Math.round(ht(gt.g*255,0,255))*256+Math.round(ht(gt.b*255,0,255))}getHexString(e=It){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=je.workingColorSpace){je.fromWorkingColorSpace(gt.copy(this),t);const n=gt.r,r=gt.g,s=gt.b,a=Math.max(n,r,s),o=Math.min(n,r,s);let l,c;const u=(o+a)/2;if(o===a)l=0,c=0;else{const d=a-o;switch(c=u<=.5?d/(a+o):d/(2-a-o),a){case n:l=(r-s)/d+(r<s?6:0);break;case r:l=(s-n)/d+2;break;case s:l=(n-r)/d+4;break}l/=6}return e.h=l,e.s=c,e.l=u,e}getRGB(e,t=je.workingColorSpace){return je.fromWorkingColorSpace(gt.copy(this),t),e.r=gt.r,e.g=gt.g,e.b=gt.b,e}getStyle(e=It){je.fromWorkingColorSpace(gt.copy(this),e);const t=gt.r,n=gt.g,r=gt.b;return e!==It?`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${r.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(n*255)},${Math.round(r*255)})`}offsetHSL(e,t,n){return this.getHSL(cn),this.setHSL(cn.h+e,cn.s+t,cn.l+n)}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,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(cn),e.getHSL(nr);const n=Pi(cn.h,nr.h,t),r=Pi(cn.s,nr.s,t),s=Pi(cn.l,nr.l,t);return this.setHSL(n,r,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,n=this.g,r=this.b,s=e.elements;return this.r=s[0]*t+s[3]*n+s[6]*r,this.g=s[1]*t+s[4]*n+s[7]*r,this.b=s[2]*t+s[5]*n+s[8]*r,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}};const gt=new be;be.NAMES=jl;let zh=0;class vi extends Nn{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:zh++}),this.uuid=xi(),this.name="",this.type="Material",this.blending=ci,this.side=_n,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=zs,this.blendDst=ks,this.blendEquation=wn,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new be(0,0,0),this.blendAlpha=0,this.depthFunc=Ar,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=to,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Gn,this.stencilZFail=Gn,this.stencilZPass=Gn,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const n=e[t];if(n===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const n={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==ci&&(n.blending=this.blending),this.side!==_n&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==zs&&(n.blendSrc=this.blendSrc),this.blendDst!==ks&&(n.blendDst=this.blendDst),this.blendEquation!==wn&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==Ar&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==to&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Gn&&(n.stencilFail=this.stencilFail),this.stencilZFail!==Gn&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==Gn&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function r(s){const a=[];for(const o in s){const l=s[o];delete l.metadata,a.push(l)}return a}if(t){const s=r(e.textures),a=r(e.images);s.length>0&&(n.textures=s),a.length>0&&(n.images=a)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let n=null;if(t!==null){const r=t.length;n=new Array(r);for(let s=0;s!==r;++s)n[s]=t[s].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}class Vi extends vi{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new be(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new In,this.combine=Ll,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const st=new I,ir=new ue;class Et{constructor(e,t,n=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=no,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=fn,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}get updateRange(){return Th("THREE.BufferAttribute: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let r=0,s=this.itemSize;r<s;r++)this.array[e+r]=t.array[n+r];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)ir.fromBufferAttribute(this,t),ir.applyMatrix3(e),this.setXY(t,ir.x,ir.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)st.fromBufferAttribute(this,t),st.applyMatrix3(e),this.setXYZ(t,st.x,st.y,st.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)st.fromBufferAttribute(this,t),st.applyMatrix4(e),this.setXYZ(t,st.x,st.y,st.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)st.fromBufferAttribute(this,t),st.applyNormalMatrix(e),this.setXYZ(t,st.x,st.y,st.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)st.fromBufferAttribute(this,t),st.transformDirection(e),this.setXYZ(t,st.x,st.y,st.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let n=this.array[e*this.itemSize+t];return this.normalized&&(n=ai(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=xt(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=ai(t,this.array)),t}setX(e,t){return this.normalized&&(t=xt(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=ai(t,this.array)),t}setY(e,t){return this.normalized&&(t=xt(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=ai(t,this.array)),t}setZ(e,t){return this.normalized&&(t=xt(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=ai(t,this.array)),t}setW(e,t){return this.normalized&&(t=xt(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=xt(t,this.array),n=xt(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,r){return e*=this.itemSize,this.normalized&&(t=xt(t,this.array),n=xt(n,this.array),r=xt(r,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this}setXYZW(e,t,n,r,s){return e*=this.itemSize,this.normalized&&(t=xt(t,this.array),n=xt(n,this.array),r=xt(r,this.array),s=xt(s,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this.array[e+3]=s,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==no&&(e.usage=this.usage),e}}class Kl extends Et{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class Zl extends Et{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class nt extends Et{constructor(e,t,n){super(new Float32Array(e),t,n)}}let kh=0;const Ft=new et,ps=new yt,Qn=new I,Ct=new ki,wi=new ki,ut=new I;class _t extends Nn{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:kh++}),this.uuid=xi(),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(Wl(e)?Zl:Kl)(e,1):this.index=e,this}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const n=this.attributes.normal;if(n!==void 0){const s=new Be().getNormalMatrix(e);n.applyNormalMatrix(s),n.needsUpdate=!0}const r=this.attributes.tangent;return r!==void 0&&(r.transformDirection(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return Ft.makeRotationFromQuaternion(e),this.applyMatrix4(Ft),this}rotateX(e){return Ft.makeRotationX(e),this.applyMatrix4(Ft),this}rotateY(e){return Ft.makeRotationY(e),this.applyMatrix4(Ft),this}rotateZ(e){return Ft.makeRotationZ(e),this.applyMatrix4(Ft),this}translate(e,t,n){return Ft.makeTranslation(e,t,n),this.applyMatrix4(Ft),this}scale(e,t,n){return Ft.makeScale(e,t,n),this.applyMatrix4(Ft),this}lookAt(e){return ps.lookAt(e),ps.updateMatrix(),this.applyMatrix4(ps.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Qn).negate(),this.translate(Qn.x,Qn.y,Qn.z),this}setFromPoints(e){const t=[];for(let n=0,r=e.length;n<r;n++){const s=e[n];t.push(s.x,s.y,s.z||0)}return this.setAttribute("position",new nt(t,3)),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new ki);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new I(-1/0,-1/0,-1/0),new I(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,r=t.length;n<r;n++){const s=t[n];Ct.setFromBufferAttribute(s),this.morphTargetsRelative?(ut.addVectors(this.boundingBox.min,Ct.min),this.boundingBox.expandByPoint(ut),ut.addVectors(this.boundingBox.max,Ct.max),this.boundingBox.expandByPoint(ut)):(this.boundingBox.expandByPoint(Ct.min),this.boundingBox.expandByPoint(Ct.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Hi);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new I,1/0);return}if(e){const n=this.boundingSphere.center;if(Ct.setFromBufferAttribute(e),t)for(let s=0,a=t.length;s<a;s++){const o=t[s];wi.setFromBufferAttribute(o),this.morphTargetsRelative?(ut.addVectors(Ct.min,wi.min),Ct.expandByPoint(ut),ut.addVectors(Ct.max,wi.max),Ct.expandByPoint(ut)):(Ct.expandByPoint(wi.min),Ct.expandByPoint(wi.max))}Ct.getCenter(n);let r=0;for(let s=0,a=e.count;s<a;s++)ut.fromBufferAttribute(e,s),r=Math.max(r,n.distanceToSquared(ut));if(t)for(let s=0,a=t.length;s<a;s++){const o=t[s],l=this.morphTargetsRelative;for(let c=0,u=o.count;c<u;c++)ut.fromBufferAttribute(o,c),l&&(Qn.fromBufferAttribute(e,c),ut.add(Qn)),r=Math.max(r,n.distanceToSquared(ut))}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(){const e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const n=t.position,r=t.normal,s=t.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new Et(new Float32Array(4*n.count),4));const a=this.getAttribute("tangent"),o=[],l=[];for(let P=0;P<n.count;P++)o[P]=new I,l[P]=new I;const c=new I,u=new I,d=new I,h=new ue,f=new ue,g=new ue,_=new I,m=new I;function p(P,y,M){c.fromBufferAttribute(n,P),u.fromBufferAttribute(n,y),d.fromBufferAttribute(n,M),h.fromBufferAttribute(s,P),f.fromBufferAttribute(s,y),g.fromBufferAttribute(s,M),u.sub(c),d.sub(c),f.sub(h),g.sub(h);const F=1/(f.x*g.y-g.x*f.y);isFinite(F)&&(_.copy(u).multiplyScalar(g.y).addScaledVector(d,-f.y).multiplyScalar(F),m.copy(d).multiplyScalar(f.x).addScaledVector(u,-g.x).multiplyScalar(F),o[P].add(_),o[y].add(_),o[M].add(_),l[P].add(m),l[y].add(m),l[M].add(m))}let E=this.groups;E.length===0&&(E=[{start:0,count:e.count}]);for(let P=0,y=E.length;P<y;++P){const M=E[P],F=M.start,L=M.count;for(let C=F,U=F+L;C<U;C+=3)p(e.getX(C+0),e.getX(C+1),e.getX(C+2))}const v=new I,b=new I,R=new I,T=new I;function A(P){R.fromBufferAttribute(r,P),T.copy(R);const y=o[P];v.copy(y),v.sub(R.multiplyScalar(R.dot(y))).normalize(),b.crossVectors(T,y);const F=b.dot(l[P])<0?-1:1;a.setXYZW(P,v.x,v.y,v.z,F)}for(let P=0,y=E.length;P<y;++P){const M=E[P],F=M.start,L=M.count;for(let C=F,U=F+L;C<U;C+=3)A(e.getX(C+0)),A(e.getX(C+1)),A(e.getX(C+2))}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let n=this.getAttribute("normal");if(n===void 0)n=new Et(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let h=0,f=n.count;h<f;h++)n.setXYZ(h,0,0,0);const r=new I,s=new I,a=new I,o=new I,l=new I,c=new I,u=new I,d=new I;if(e)for(let h=0,f=e.count;h<f;h+=3){const g=e.getX(h+0),_=e.getX(h+1),m=e.getX(h+2);r.fromBufferAttribute(t,g),s.fromBufferAttribute(t,_),a.fromBufferAttribute(t,m),u.subVectors(a,s),d.subVectors(r,s),u.cross(d),o.fromBufferAttribute(n,g),l.fromBufferAttribute(n,_),c.fromBufferAttribute(n,m),o.add(u),l.add(u),c.add(u),n.setXYZ(g,o.x,o.y,o.z),n.setXYZ(_,l.x,l.y,l.z),n.setXYZ(m,c.x,c.y,c.z)}else for(let h=0,f=t.count;h<f;h+=3)r.fromBufferAttribute(t,h+0),s.fromBufferAttribute(t,h+1),a.fromBufferAttribute(t,h+2),u.subVectors(a,s),d.subVectors(r,s),u.cross(d),n.setXYZ(h+0,u.x,u.y,u.z),n.setXYZ(h+1,u.x,u.y,u.z),n.setXYZ(h+2,u.x,u.y,u.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)ut.fromBufferAttribute(e,t),ut.normalize(),e.setXYZ(t,ut.x,ut.y,ut.z)}toNonIndexed(){function e(o,l){const c=o.array,u=o.itemSize,d=o.normalized,h=new c.constructor(l.length*u);let f=0,g=0;for(let _=0,m=l.length;_<m;_++){o.isInterleavedBufferAttribute?f=l[_]*o.data.stride+o.offset:f=l[_]*u;for(let p=0;p<u;p++)h[g++]=c[f++]}return new Et(h,u,d)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new _t,n=this.index.array,r=this.attributes;for(const o in r){const l=r[o],c=e(l,n);t.setAttribute(o,c)}const s=this.morphAttributes;for(const o in s){const l=[],c=s[o];for(let u=0,d=c.length;u<d;u++){const h=c[u],f=e(h,n);l.push(f)}t.morphAttributes[o]=l}t.morphTargetsRelative=this.morphTargetsRelative;const a=this.groups;for(let o=0,l=a.length;o<l;o++){const c=a[o];t.addGroup(c.start,c.count,c.materialIndex)}return t}toJSON(){const e={metadata:{version:4.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const l in n){const c=n[l];e.data.attributes[l]=c.toJSON(e.data)}const r={};let s=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],u=[];for(let d=0,h=c.length;d<h;d++){const f=c[d];u.push(f.toJSON(e.data))}u.length>0&&(r[l]=u,s=!0)}s&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));const o=this.boundingSphere;return o!==null&&(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;const t={};this.name=e.name;const n=e.index;n!==null&&this.setIndex(n.clone(t));const r=e.attributes;for(const c in r){const u=r[c];this.setAttribute(c,u.clone(t))}const s=e.morphAttributes;for(const c in s){const u=[],d=s[c];for(let h=0,f=d.length;h<f;h++)u.push(d[h].clone(t));this.morphAttributes[c]=u}this.morphTargetsRelative=e.morphTargetsRelative;const a=e.groups;for(let c=0,u=a.length;c<u;c++){const d=a[c];this.addGroup(d.start,d.count,d.materialIndex)}const o=e.boundingBox;o!==null&&(this.boundingBox=o.clone());const l=e.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const xo=new et,En=new Br,rr=new Hi,vo=new I,ei=new I,ti=new I,ni=new I,ms=new I,sr=new I,ar=new ue,or=new ue,lr=new ue,Mo=new I,So=new I,yo=new I,cr=new I,ur=new I;let bt=class extends yt{constructor(e=new _t,t=new Vi){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){const o=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}getVertexPosition(e,t){const n=this.geometry,r=n.attributes.position,s=n.morphAttributes.position,a=n.morphTargetsRelative;t.fromBufferAttribute(r,e);const o=this.morphTargetInfluences;if(s&&o){sr.set(0,0,0);for(let l=0,c=s.length;l<c;l++){const u=o[l],d=s[l];u!==0&&(ms.fromBufferAttribute(d,e),a?sr.addScaledVector(ms,u):sr.addScaledVector(ms.sub(t),u))}t.add(sr)}return t}raycast(e,t){const n=this.geometry,r=this.material,s=this.matrixWorld;r!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),rr.copy(n.boundingSphere),rr.applyMatrix4(s),En.copy(e.ray).recast(e.near),!(rr.containsPoint(En.origin)===!1&&(En.intersectSphere(rr,vo)===null||En.origin.distanceToSquared(vo)>(e.far-e.near)**2))&&(xo.copy(s).invert(),En.copy(e.ray).applyMatrix4(xo),!(n.boundingBox!==null&&En.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,En)))}_computeIntersections(e,t,n){let r;const s=this.geometry,a=this.material,o=s.index,l=s.attributes.position,c=s.attributes.uv,u=s.attributes.uv1,d=s.attributes.normal,h=s.groups,f=s.drawRange;if(o!==null)if(Array.isArray(a))for(let g=0,_=h.length;g<_;g++){const m=h[g],p=a[m.materialIndex],E=Math.max(m.start,f.start),v=Math.min(o.count,Math.min(m.start+m.count,f.start+f.count));for(let b=E,R=v;b<R;b+=3){const T=o.getX(b),A=o.getX(b+1),P=o.getX(b+2);r=hr(this,p,e,n,c,u,d,T,A,P),r&&(r.faceIndex=Math.floor(b/3),r.face.materialIndex=m.materialIndex,t.push(r))}}else{const g=Math.max(0,f.start),_=Math.min(o.count,f.start+f.count);for(let m=g,p=_;m<p;m+=3){const E=o.getX(m),v=o.getX(m+1),b=o.getX(m+2);r=hr(this,a,e,n,c,u,d,E,v,b),r&&(r.faceIndex=Math.floor(m/3),t.push(r))}}else if(l!==void 0)if(Array.isArray(a))for(let g=0,_=h.length;g<_;g++){const m=h[g],p=a[m.materialIndex],E=Math.max(m.start,f.start),v=Math.min(l.count,Math.min(m.start+m.count,f.start+f.count));for(let b=E,R=v;b<R;b+=3){const T=b,A=b+1,P=b+2;r=hr(this,p,e,n,c,u,d,T,A,P),r&&(r.faceIndex=Math.floor(b/3),r.face.materialIndex=m.materialIndex,t.push(r))}}else{const g=Math.max(0,f.start),_=Math.min(l.count,f.start+f.count);for(let m=g,p=_;m<p;m+=3){const E=m,v=m+1,b=m+2;r=hr(this,a,e,n,c,u,d,E,v,b),r&&(r.faceIndex=Math.floor(m/3),t.push(r))}}}};function Hh(i,e,t,n,r,s,a,o){let l;if(e.side===St?l=n.intersectTriangle(a,s,r,!0,o):l=n.intersectTriangle(r,s,a,e.side===_n,o),l===null)return null;ur.copy(o),ur.applyMatrix4(i.matrixWorld);const c=t.ray.origin.distanceTo(ur);return c<t.near||c>t.far?null:{distance:c,point:ur.clone(),object:i}}function hr(i,e,t,n,r,s,a,o,l,c){i.getVertexPosition(o,ei),i.getVertexPosition(l,ti),i.getVertexPosition(c,ni);const u=Hh(i,e,t,n,ei,ti,ni,cr);if(u){r&&(ar.fromBufferAttribute(r,o),or.fromBufferAttribute(r,l),lr.fromBufferAttribute(r,c),u.uv=Ci.getInterpolation(cr,ei,ti,ni,ar,or,lr,new ue)),s&&(ar.fromBufferAttribute(s,o),or.fromBufferAttribute(s,l),lr.fromBufferAttribute(s,c),u.uv1=Ci.getInterpolation(cr,ei,ti,ni,ar,or,lr,new ue)),a&&(Mo.fromBufferAttribute(a,o),So.fromBufferAttribute(a,l),yo.fromBufferAttribute(a,c),u.normal=Ci.getInterpolation(cr,ei,ti,ni,Mo,So,yo,new I),u.normal.dot(n.direction)>0&&u.normal.multiplyScalar(-1));const d={a:o,b:l,c,normal:new I,materialIndex:0};Ci.getNormal(ei,ti,ni,d.normal),u.face=d}return u}class Gi extends _t{constructor(e=1,t=1,n=1,r=1,s=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:s,depthSegments:a};const o=this;r=Math.floor(r),s=Math.floor(s),a=Math.floor(a);const l=[],c=[],u=[],d=[];let h=0,f=0;g("z","y","x",-1,-1,n,t,e,a,s,0),g("z","y","x",1,-1,n,t,-e,a,s,1),g("x","z","y",1,1,e,n,t,r,a,2),g("x","z","y",1,-1,e,n,-t,r,a,3),g("x","y","z",1,-1,e,t,n,r,s,4),g("x","y","z",-1,-1,e,t,-n,r,s,5),this.setIndex(l),this.setAttribute("position",new nt(c,3)),this.setAttribute("normal",new nt(u,3)),this.setAttribute("uv",new nt(d,2));function g(_,m,p,E,v,b,R,T,A,P,y){const M=b/A,F=R/P,L=b/2,C=R/2,U=T/2,H=A+1,Y=P+1;let J=0,z=0;const j=new I;for(let $=0;$<Y;$++){const N=$*F-C;for(let ee=0;ee<H;ee++){const me=ee*M-L;j[_]=me*E,j[m]=N*v,j[p]=U,c.push(j.x,j.y,j.z),j[_]=0,j[m]=0,j[p]=T>0?1:-1,u.push(j.x,j.y,j.z),d.push(ee/A),d.push(1-$/P),J+=1}}for(let $=0;$<P;$++)for(let N=0;N<A;N++){const ee=h+N+H*$,me=h+N+H*($+1),O=h+(N+1)+H*($+1),Q=h+(N+1)+H*$;l.push(ee,me,Q),l.push(me,O,Q),z+=6}o.addGroup(f,z,y),f+=z,h+=J}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Gi(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function _i(i){const e={};for(const t in i){e[t]={};for(const n in i[t]){const r=i[t][n];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?r.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][n]=null):e[t][n]=r.clone():Array.isArray(r)?e[t][n]=r.slice():e[t][n]=r}}return e}function vt(i){const e={};for(let t=0;t<i.length;t++){const n=_i(i[t]);for(const r in n)e[r]=n[r]}return e}function Vh(i){const e=[];for(let t=0;t<i.length;t++)e.push(i[t].clone());return e}function Jl(i){const e=i.getRenderTarget();return e===null?i.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:je.workingColorSpace}const Fr={clone:_i,merge:vt};var Gh=`void main() {
6
+ <%s key={someKey} {...props} />`,O,ne,ve,ne),$[ne+O]=!0)}if(ne=null,me!==void 0&&(t(me),ne=""+me),a(ee)&&(t(ee.key),ne=""+ee.key),"key"in ee){me={};for(var Te in ee)Te!=="key"&&(me[Te]=ee[Te])}else me=ee;return ne&&o(me,typeof U=="function"?U.displayName||U.name||"Unknown":U),c(U,ne,me,r(),Q,ce)}function d(U){h(U)?U._store&&(U._store.validated=1):typeof U=="object"&&U!==null&&U.$$typeof===S&&(U._payload.status==="fulfilled"?h(U._payload.value)&&U._payload.value._store&&(U._payload.value._store.validated=1):U._store&&(U._store.validated=1))}function h(U){return typeof U=="object"&&U!==null&&U.$$typeof===g}var f=de,g=Symbol.for("react.transitional.element"),_=Symbol.for("react.portal"),m=Symbol.for("react.fragment"),p=Symbol.for("react.strict_mode"),E=Symbol.for("react.profiler"),v=Symbol.for("react.consumer"),b=Symbol.for("react.context"),R=Symbol.for("react.forward_ref"),T=Symbol.for("react.suspense"),A=Symbol.for("react.suspense_list"),P=Symbol.for("react.memo"),S=Symbol.for("react.lazy"),M=Symbol.for("react.activity"),F=Symbol.for("react.client.reference"),L=f.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,C=Object.prototype.hasOwnProperty,N=Array.isArray,V=console.createTask?console.createTask:function(){return null};f={react_stack_bottom_frame:function(U){return U()}};var j,J={},z=f.react_stack_bottom_frame.bind(f,s)(),Y=V(n(s)),$={};Ei.Fragment=m,Ei.jsx=function(U,ee,me){var O=1e4>L.recentlyCreatedOwnerStacks++;return u(U,ee,me,!1,O?Error("react-stack-top-frame"):z,O?V(n(U)):Y)},Ei.jsxs=function(U,ee,me){var O=1e4>L.recentlyCreatedOwnerStacks++;return u(U,ee,me,!0,O?Error("react-stack-top-frame"):z,O?V(n(U)):Y)}})()),Ei}var ma;function kc(){return ma||(ma=1,process.env.NODE_ENV==="production"?qi.exports=Bc():qi.exports=zc()),qi.exports}var se=kc();const Vc=(i,e)=>{const t=new Set([...Object.keys(i),...e.flatMap(r=>Object.keys(r))]),n={};return t.forEach(r=>{n[r]=[i[r],...e.map(s=>s[r])]}),n},Hc=({text:i="",delay:e=200,className:t="",animateBy:n="words",direction:r="top",threshold:s=.1,rootMargin:a="0px",animationFrom:o,animationTo:l,easing:c=_=>_,onAnimationComplete:u,stepDuration:d=.35,fontSize:h,fontFamily:f,color:g})=>{const _=n==="words"?i.split(" "):i.split(""),[m,p]=de.useState(!1),E=de.useRef(null);de.useEffect(()=>{if(!E.current)return;const F=new IntersectionObserver(([L])=>{L.isIntersecting&&(p(!0),F.unobserve(E.current))},{threshold:s,rootMargin:a});return F.observe(E.current),()=>F.disconnect()},[s,a]);const v=de.useMemo(()=>r==="top"?{filter:"blur(10px)",opacity:0,y:-50}:{filter:"blur(10px)",opacity:0,y:50},[r]),b=de.useMemo(()=>[{filter:"blur(5px)",opacity:.5,y:r==="top"?5:-5},{filter:"blur(0px)",opacity:1,y:0}],[r]),R=o??v,T=l??b,A=T.length+1,P=d*(A-1),S=Array.from({length:A},(F,L)=>A===1?0:L/(A-1)),M={...h&&{fontSize:h},...f&&{fontFamily:f},...g&&{color:g}};return se.jsx("p",{ref:E,className:`blur-text ${t} flex flex-wrap`,style:M,children:_.map((F,L)=>{const C=Vc(R,T),N={duration:P,times:S,delay:L*e/1e3};return N.ease=c,se.jsxs(Mt.motion.span,{className:"inline-block will-change-[transform,filter,opacity]",initial:R,animate:m?C:R,transition:N,onAnimationComplete:L===_.length-1?u:void 0,children:[F===" "?" ":F,n==="words"&&L<_.length-1&&" "]},L)})})},Gc=(i,e,t=!0)=>({from:e,to:e+360,ease:"linear",duration:i,type:"tween",repeat:t?1/0:0}),Bn=(i,e)=>({rotate:Gc(i,e),scale:{type:"spring",damping:20,stiffness:300}}),Wc=({text:i,spinDuration:e=20,onHover:t="speedUp",className:n="",fontSize:r,fontFamily:s,color:a})=>{const o=Array.from(i),l=Mt.useAnimation(),c=Mt.useMotionValue(0);de.useEffect(()=>{const f=c.get();l.start({rotate:f+360,scale:1,transition:Bn(e,f)})},[e,i,t,l,c]);const u=()=>{const f=c.get();if(!t)return;let g,_=1;switch(t){case"slowDown":g=Bn(e*2,f);break;case"speedUp":g=Bn(e/4,f);break;case"pause":g={rotate:{type:"spring",damping:20,stiffness:300},scale:{type:"spring",damping:20,stiffness:300}},_=1;break;case"goBonkers":g=Bn(e/20,f),_=.8;break;default:g=Bn(e,f)}l.start({rotate:f+360,scale:_,transition:g})},d=()=>{const f=c.get();l.start({rotate:f+360,scale:1,transition:Bn(e,f)})},h={...r&&{fontSize:r},...s&&{fontFamily:s},...a&&{color:a}};return se.jsx(Mt.motion.div,{className:`m-0 mx-auto rounded-full w-[200px] h-[200px] relative text-white font-black text-center cursor-pointer origin-center ${n}`,style:{rotate:c,...h},initial:{rotate:0},animate:l,onMouseEnter:u,onMouseLeave:d,children:o.map((f,g)=>{const _=360/o.length*g,m=Math.PI/o.length,p=m*g,E=m*g,v=`rotateZ(${_}deg) translate3d(${p}px, ${E}px, 0)`;return se.jsx("span",{className:"absolute inline-block inset-0 text-2xl transition-all duration-500 ease-[cubic-bezier(0,0,0,1)]",style:{transform:v,WebkitTransform:v,...h},children:f},g)})})};let bi,zn,ga=typeof Symbol=="function"?Symbol():"_split",Us,Xc=()=>Us||Zs.register(window.gsap),_a=typeof Intl<"u"&&"Segmenter"in Intl?new Intl.Segmenter:0,Ni=i=>typeof i=="string"?Ni(document.querySelectorAll(i)):"length"in i?Array.from(i).reduce((e,t)=>(typeof t=="string"?e.push(...Ni(t)):e.push(t),e),[]):[i],xa=i=>Ni(i).filter(e=>e instanceof HTMLElement),Os=[],jr=function(){},qc={add:i=>i()},jc=/\s+/g,va=new RegExp("\\p{RI}\\p{RI}|\\p{Emoji}(\\p{EMod}|\\u{FE0F}\\u{20E3}?|[\\u{E0020}-\\u{E007E}]+\\u{E007F})?(\\u{200D}\\p{Emoji}(\\p{EMod}|\\u{FE0F}\\u{20E3}?|[\\u{E0020}-\\u{E007E}]+\\u{E007F})?)*|.","gu"),Dr={left:0,top:0,width:0,height:0},$c=(i,e)=>{for(;++e<i.length&&i[e]===Dr;);return i[e]||Dr},Ma=({element:i,html:e,ariaL:t,ariaH:n})=>{i.innerHTML=e,t?i.setAttribute("aria-label",t):i.removeAttribute("aria-label"),n?i.setAttribute("aria-hidden",n):i.removeAttribute("aria-hidden")},ya=(i,e)=>{if(e){let t=new Set(i.join("").match(e)||Os),n=i.length,r,s,a,o;if(t.size)for(;--n>-1;){s=i[n];for(a of t)if(a.startsWith(s)&&a.length>s.length){for(r=0,o=s;a.startsWith(o+=i[n+ ++r])&&o.length<a.length;);if(r&&o.length===a.length){i[n]=a,i.splice(n+1,r);break}}}}return i},Sa=i=>window.getComputedStyle(i).display==="inline"&&(i.style.display="inline-block"),kn=(i,e,t)=>e.insertBefore(typeof i=="string"?document.createTextNode(i):i,t),Bs=(i,e,t)=>{let n=e[i+"sClass"]||"",{tag:r="div",aria:s="auto",propIndex:a=!1}=e,o=i==="line"?"block":"inline-block",l=n.indexOf("++")>-1,c=u=>{let d=document.createElement(r),h=t.length+1;return n&&(d.className=n+(l?" "+n+h:"")),a&&d.style.setProperty("--"+i,h+""),s!=="none"&&d.setAttribute("aria-hidden","true"),r!=="span"&&(d.style.position="relative",d.style.display=o),d.textContent=u,t.push(d),d};return l&&(n=n.replace("++","")),c.collection=t,c},Yc=(i,e,t,n)=>{let r=Bs("line",t,n),s=window.getComputedStyle(i).textAlign||"left";return(a,o)=>{let l=r("");for(l.style.textAlign=s,i.insertBefore(l,e[a]);a<o;a++)l.appendChild(e[a]);l.normalize()}},Dl=(i,e,t,n,r,s,a,o,l,c)=>{var u;let d=Array.from(i.childNodes),h=0,{wordDelimiter:f,reduceWhiteSpace:g=!0,prepareText:_}=e,m=i.getBoundingClientRect(),p=m,E=!g&&window.getComputedStyle(i).whiteSpace.substring(0,3)==="pre",v=0,b=t.collection,R,T,A,P,S,M,F,L,C,N,V,j,J,z,Y,$,U,ee;for(typeof f=="object"?(A=f.delimiter||f,T=f.replaceWith||""):T=f===""?"":f||" ",R=T!==" ";h<d.length;h++)if(P=d[h],P.nodeType===3){for(Y=P.textContent||"",g?Y=Y.replace(jc," "):E&&(Y=Y.replace(/\n/g,T+`
7
+ `)),_&&(Y=_(Y,i)),P.textContent=Y,S=T||A?Y.split(A||T):Y.match(o)||Os,U=S[S.length-1],L=R?U.slice(-1)===" ":!U,U||S.pop(),p=m,F=R?S[0].charAt(0)===" ":!S[0],F&&kn(" ",i,P),S[0]||S.shift(),ya(S,l),s&&c||(P.textContent=""),C=1;C<=S.length;C++)if($=S[C-1],!g&&E&&$.charAt(0)===`
8
+ `&&((u=P.previousSibling)==null||u.remove(),kn(document.createElement("br"),i,P),$=$.slice(1)),!g&&$==="")kn(T,i,P);else if($===" ")i.insertBefore(document.createTextNode(" "),P);else{if(R&&$.charAt(0)===" "&&kn(" ",i,P),v&&C===1&&!F&&b.indexOf(v.parentNode)>-1?(M=b[b.length-1],M.appendChild(document.createTextNode(n?"":$))):(M=t(n?"":$),kn(M,i,P),v&&C===1&&!F&&M.insertBefore(v,M.firstChild)),n)for(V=_a?ya([..._a.segment($)].map(me=>me.segment),l):$.match(o)||Os,ee=0;ee<V.length;ee++)M.appendChild(V[ee]===" "?document.createTextNode(" "):n(V[ee]));if(s&&c){if(Y=P.textContent=Y.substring($.length+1,Y.length),N=M.getBoundingClientRect(),N.top>p.top&&N.left<=p.left){for(j=i.cloneNode(),J=i.childNodes[0];J&&J!==M;)z=J,J=J.nextSibling,j.appendChild(z);i.parentNode.insertBefore(j,i),r&&Sa(j)}p=N}(C<S.length||L)&&kn(C>=S.length?" ":R&&$.slice(-1)===" "?" "+T:T,i,P)}i.removeChild(P),v=0}else P.nodeType===1&&(a&&a.indexOf(P)>-1?(b.indexOf(P.previousSibling)>-1&&b[b.length-1].appendChild(P),v=P):(Dl(P,e,t,n,r,s,a,o,l,!0),v=0),r&&Sa(P))};const Al=class wl{constructor(e,t){this.isSplit=!1,Xc(),this.elements=xa(e),this.chars=[],this.words=[],this.lines=[],this.masks=[],this.vars=t,this.elements.forEach(a=>{var o;t.overwrite!==!1&&((o=a[ga])==null||o._data.orig.filter(({element:l})=>l===a).forEach(Ma)),a[ga]=this}),this._split=()=>this.isSplit&&this.split(this.vars);let n=[],r,s=()=>{let a=n.length,o;for(;a--;){o=n[a];let l=o.element.offsetWidth;if(l!==o.width){o.width=l,this._split();return}}};this._data={orig:n,obs:typeof ResizeObserver<"u"&&new ResizeObserver(()=>{clearTimeout(r),r=setTimeout(s,200)})},jr(this),this.split(t)}split(e){return(this._ctx||qc).add(()=>{this.isSplit&&this.revert(),this.vars=e=e||this.vars||{};let{type:t="chars,words,lines",aria:n="auto",deepSlice:r=!0,smartWrap:s,onSplit:a,autoSplit:o=!1,specialChars:l,mask:c}=this.vars,u=t.indexOf("lines")>-1,d=t.indexOf("chars")>-1,h=t.indexOf("words")>-1,f=d&&!h&&!u,g=l&&("push"in l?new RegExp("(?:"+l.join("|")+")","gu"):l),_=g?new RegExp(g.source+"|"+va.source,"gu"):va,m=!!e.ignore&&xa(e.ignore),{orig:p,animTime:E,obs:v}=this._data,b;(d||h||u)&&(this.elements.forEach((R,T)=>{p[T]={element:R,html:R.innerHTML,ariaL:R.getAttribute("aria-label"),ariaH:R.getAttribute("aria-hidden")},n==="auto"?R.setAttribute("aria-label",(R.textContent||"").trim()):n==="hidden"&&R.setAttribute("aria-hidden","true");let A=[],P=[],S=[],M=d?Bs("char",e,A):null,F=Bs("word",e,P),L,C,N,V;if(Dl(R,e,F,M,f,r&&(u||f),m,_,g,!1),u){let j=Ni(R.childNodes),J=Yc(R,j,e,S),z,Y=[],$=0,U=j.map(O=>O.nodeType===1?O.getBoundingClientRect():Dr),ee=Dr,me;for(L=0;L<j.length;L++)z=j[L],z.nodeType===1&&(z.nodeName==="BR"?((!L||j[L-1].nodeName!=="BR")&&(Y.push(z),J($,L+1)),$=L+1,ee=$c(U,L)):(me=U[L],L&&me.top>ee.top&&me.left<ee.left+ee.width-1&&(J($,L),$=L),ee=me));$<L&&J($,L),Y.forEach(O=>{var Q;return(Q=O.parentNode)==null?void 0:Q.removeChild(O)})}if(!h){for(L=0;L<P.length;L++)if(C=P[L],d||!C.nextSibling||C.nextSibling.nodeType!==3)if(s&&!u){for(N=document.createElement("span"),N.style.whiteSpace="nowrap";C.firstChild;)N.appendChild(C.firstChild);C.replaceWith(N)}else C.replaceWith(...C.childNodes);else V=C.nextSibling,V&&V.nodeType===3&&(V.textContent=(C.textContent||"")+(V.textContent||""),C.remove());P.length=0,R.normalize()}this.lines.push(...S),this.words.push(...P),this.chars.push(...A)}),c&&this[c]&&this.masks.push(...this[c].map(R=>{let T=R.cloneNode();return R.replaceWith(T),T.appendChild(R),R.className&&(T.className=R.className.trim()+"-mask"),T.style.overflow="clip",T}))),this.isSplit=!0,zn&&u&&(o?zn.addEventListener("loadingdone",this._split):zn.status==="loading"&&console.warn("SplitText called before fonts loaded")),(b=a&&a(this))&&b.totalTime&&(this._data.anim=E?b.totalTime(E):b),u&&o&&this.elements.forEach((R,T)=>{p[T].width=R.offsetWidth,v&&v.observe(R)})}),this}kill(){let{obs:e}=this._data;e&&e.disconnect(),zn?.removeEventListener("loadingdone",this._split)}revert(){var e,t;if(this.isSplit){let{orig:n,anim:r}=this._data;this.kill(),n.forEach(Ma),this.chars.length=this.words.length=this.lines.length=n.length=this.masks.length=0,this.isSplit=!1,r&&(this._data.animTime=r.totalTime(),r.revert()),(t=(e=this.vars).onRevert)==null||t.call(e,this)}return this}static create(e,t){return new wl(e,t)}static register(e){bi=bi||e||window.gsap,bi&&(Ni=bi.utils.toArray,jr=bi.core.context||jr),!Us&&window.innerWidth>0&&(zn=document.fonts,Us=!0)}};Al.version="3.14.2";let Zs=Al;var Kc=/(?:^\s+|\s+$)/g,Zc=/([\uD800-\uDBFF][\uDC00-\uDFFF](?:[\u200D\uFE0F][\uD800-\uDBFF][\uDC00-\uDFFF]){2,}|\uD83D\uDC69(?:\u200D(?:(?:\uD83D\uDC69\u200D)?\uD83D\uDC67|(?:\uD83D\uDC69\u200D)?\uD83D\uDC66)|\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D(?:\uD83D\uDC69\u200D)?\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D(?:\uD83D\uDC69\u200D)?\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2642\u2640]\uFE0F|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDD27\uDCBC\uDD2C\uDE80\uDE92])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC6F\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3C-\uDD3E\uDDD6-\uDDDF])\u200D[\u2640\u2642]\uFE0F|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|(?:\u26F9|\uD83C[\uDFCC\uDFCB]|\uD83D\uDD75)(?:\uFE0F\u200D[\u2640\u2642]|(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642])\uFE0F|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2695\u2696\u2708]|\uD83D\uDC69\u200D[\u2695\u2696\u2708]|\uD83D\uDC68(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708]))\uFE0F|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83D\uDC69\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|\uD83D\uDC68(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:(?:\uD83D[\uDC68\uDC69])\u200D)?\uD83D\uDC66\u200D\uD83D\uDC66|(?:(?:\uD83D[\uDC68\uDC69])\u200D)?\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92])|(?:\uD83C[\uDFFB-\uDFFF])\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]))|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDD1-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\u200D(?:(?:(?:\uD83D[\uDC68\uDC69])\u200D)?\uD83D\uDC67|(?:(?:\uD83D[\uDC68\uDC69])\u200D)?\uD83D\uDC66)|\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC69\uDC6E\uDC70-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD18-\uDD1C\uDD1E\uDD1F\uDD26\uDD30-\uDD39\uDD3D\uDD3E\uDDD1-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])?|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDEEB\uDEEC\uDEF4-\uDEF8]|\uD83E[\uDD10-\uDD3A\uDD3C-\uDD3E\uDD40-\uDD45\uDD47-\uDD4C\uDD50-\uDD6B\uDD80-\uDD97\uDDC0\uDDD0-\uDDE6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u2660\u2663\u2665\u2666\u2668\u267B\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEF8]|\uD83E[\uDD10-\uDD3A\uDD3C-\uDD3E\uDD40-\uDD45\uDD47-\uDD4C\uDD50-\uDD6B\uDD80-\uDD97\uDDC0\uDDD0-\uDDE6])\uFE0F)/;function Js(i){var e=i.nodeType,t="";if(e===1||e===9||e===11){if(typeof i.textContent=="string")return i.textContent;for(i=i.firstChild;i;i=i.nextSibling)t+=Js(i)}else if(e===3||e===4)return i.nodeValue;return t}function Ht(i,e,t,n,r){if(i+="",t&&(i=i.trim?i.trim():i.replace(Kc,"")),e&&e!=="")return i.replace(/>/g,"&gt;").replace(/</g,"&lt;").split(e);for(var s=[],a=i.length,o=0,l,c;o<a;o++)c=i.charAt(o),(c.charCodeAt(0)>=55296&&c.charCodeAt(0)<=56319||i.charCodeAt(o+1)>=65024&&i.charCodeAt(o+1)<=65039)&&(l=((i.substr(o,12).split(Zc)||[])[1]||"").length||2,c=i.substr(o,l),s.emoji=1,o+=l-1),s.push(r?c:c===">"?"&gt;":c==="<"?"&lt;":n&&c===" "&&(i.charAt(o-1)===" "||i.charAt(o+1)===" ")?"&nbsp;":c);return s}var br=(function(){function i(t){this.chars=Ht(t),this.sets=[],this.length=50;for(var n=0;n<20;n++)this.sets[n]=ba(80,this.chars)}var e=i.prototype;return e.grow=function(n){for(var r=0;r<20;r++)this.sets[r]+=ba(n-this.length,this.chars);this.length=n},i})(),Rn,Cl,Rl=function(){return Rn||typeof window<"u"&&(Rn=window.gsap)&&Rn.registerPlugin&&Rn},Jc=1,Ea=/\s+/g,ba=function(e,t){for(var n=t.length,r="";--e>-1;)r+=t[~~(Math.random()*n)];return r},zs="ABCDEFGHIJKLMNOPQRSTUVWXYZ",Ta=zs.toLowerCase(),Qc={upperCase:new br(zs),lowerCase:new br(Ta),upperAndLowerCase:new br(zs+Ta)},Da=function(){Cl=Rn=Rl()},Nr={version:"3.14.2",name:"scrambleText",register:function(e,t,n){Rn=e,Da()},init:function(e,t,n,r,s){if(Cl||Da(),this.prop="innerHTML"in e?"innerHTML":"textContent"in e?"textContent":0,!!this.prop){this.target=e,typeof t!="object"&&(t={text:t});var a=t.text||t.value||"",o=t.trim!==!1,l=this,c,u,d,h;return l.delimiter=c=t.delimiter||"",l.original=Ht(Js(e).replace(Ea," ").split("&nbsp;").join(""),c,o),(a==="{original}"||a===!0||a==null)&&(a=l.original.join(c)),l.text=Ht((a||"").replace(Ea," "),c,o),l.hasClass=!!(t.newClass||t.oldClass),l.newClass=t.newClass,l.oldClass=t.oldClass,h=c==="",l.textHasEmoji=h&&!!l.text.emoji,l.charsHaveEmoji=!!t.chars&&!!Ht(t.chars).emoji,l.length=h?l.original.length:l.original.join(c).length,l.lengthDif=(h?l.text.length:l.text.join(c).length)-l.length,l.fillChar=t.fillChar||t.chars&&~t.chars.indexOf(" ")?"&nbsp;":"",l.charSet=d=Qc[t.chars||"upperCase"]||new br(t.chars),l.speed=.05/(t.speed||1),l.prevScrambleTime=0,l.setIndex=Math.random()*20|0,u=l.length+Math.max(l.lengthDif,0),u>d.length&&d.grow(u),l.chars=d.sets[l.setIndex],l.revealDelay=t.revealDelay||0,l.tweenLength=t.tweenLength!==!1,l.tween=n,l.rightToLeft=!!t.rightToLeft,l._props.push("scrambleText","text"),Jc}},render:function(e,t){var n=t.target,r=t.prop,s=t.text,a=t.delimiter,o=t.tween,l=t.prevScrambleTime,c=t.revealDelay,u=t.setIndex,d=t.chars,h=t.charSet,f=t.length,g=t.textHasEmoji,_=t.charsHaveEmoji,m=t.lengthDif,p=t.tweenLength,E=t.oldClass,v=t.newClass,b=t.rightToLeft,R=t.fillChar,T=t.speed,A=t.original,P=t.hasClass,S=s.length,M=o._time,F=M-l,L,C,N,V,j,J,z,Y,$,U,ee;c&&(o._from&&(M=o._dur-M),e=M===0?0:M<c?1e-6:M===o._dur?1:o._ease((M-c)/(o._dur-c))),e<0?e=0:e>1&&(e=1),b&&(e=1-e),L=~~(e*S+.5),e?((F>T||F<-T)&&(t.setIndex=u=(u+(Math.random()*19|0))%20,t.chars=h.sets[u],t.prevScrambleTime+=F),V=d):V=A.join(a),ee=o._from?e:1-e,U=f+(p?o._from?ee*ee*ee:1-ee*ee*ee:1)*m,b?e===1&&(o._from||o.data==="isFromStart")?(N="",V=A.join(a)):(z=s.slice(L).join(a),_?N=Ht(V).slice(0,U-(g?Ht(z):z).length+.5|0).join(""):N=V.substr(0,U-(g?Ht(z):z).length+.5|0),V=z):(N=s.slice(0,L).join(a),C=(g?Ht(N):N).length,_?V=Ht(V).slice(C,U+.5|0).join(""):V=V.substr(C,U-C+.5|0)),P?(Y=b?E:v,$=b?v:E,j=Y&&L!==0,J=$&&L!==S,z=(j?"<span class='"+Y+"'>":"")+N+(j?"</span>":"")+(J?"<span class='"+$+"'>":"")+a+V+(J?"</span>":"")):z=N+a+V,n[r]=R==="&nbsp;"&&~z.indexOf(" ")?z.split(" ").join("&nbsp;&nbsp;"):z}};Nr.emojiSafeSplit=Ht;Nr.getText=Js;Rl()&&Rn.registerPlugin(Nr);Ns.gsap.registerPlugin(Zs,Nr);const eu=({radius:i=100,duration:e=1.2,speed:t=.5,scrambleChars:n=".:",className:r="",style:s={},children:a,fontSize:o,fontFamily:l,color:c})=>{const u=de.useRef(null);de.useEffect(()=>{if(!u.current)return;const h=Zs.create(u.current.querySelector("p"),{type:"chars",charsClass:"inline-block will-change-transform"});h.chars.forEach(_=>{const m=_;Ns.gsap.set(m,{attr:{"data-content":m.innerHTML}})});const f=_=>{h.chars.forEach(m=>{const p=m,{left:E,top:v,width:b,height:R}=p.getBoundingClientRect(),T=_.clientX-(E+b/2),A=_.clientY-(v+R/2),P=Math.hypot(T,A);P<i&&Ns.gsap.to(p,{overwrite:!0,duration:e*(1-P/i),scrambleText:{text:p.dataset.content||"",chars:n,speed:t},ease:"none"})})},g=u.current;return g.addEventListener("pointermove",f),()=>{g.removeEventListener("pointermove",f),h.revert()}},[i,e,t,n]);const d={...s,...o&&{fontSize:o},...l&&{fontFamily:l},...c&&{color:c}};return se.jsx("div",{ref:u,className:`m-[7vw] max-w-[800px] font-mono text-[clamp(14px,4vw,32px)] text-white ${r}`,style:d,children:se.jsx("p",{children:a})})},tu=({direction:i="clockwise",speed:e=.5,color:t="#71717a",dashLength:n=10,gapLength:r=5,width:s=300,height:a=200,strokeWidth:o=1,borderRadius:l=0})=>{const c=de.useRef(null);return de.useEffect(()=>{if(!c.current)return;const u=c.current,d=u.getTotalLength();u.style.strokeDasharray=`${n} ${r}`,u.style.strokeDashoffset=i==="clockwise"?d:0;let h,f=i==="clockwise"?d:0;const g=i==="clockwise"?-e:e,_=()=>{f+=g,i==="clockwise"?f<=-(n+r)&&(f=0):f>=n+r&&(f=0),u.style.strokeDashoffset=f,h=requestAnimationFrame(_)};return h=requestAnimationFrame(_),()=>{h&&cancelAnimationFrame(h)}},[i,e,n,r]),se.jsx("svg",{width:s+o*2,height:a+o*2,className:"overflow-visible",children:se.jsx(Mt.motion.rect,{ref:c,x:o,y:o,width:s,height:a,rx:l,ry:l,fill:"transparent",stroke:t,strokeWidth:o,strokeLinecap:"round",initial:{opacity:0},animate:{opacity:1},transition:{duration:.5}})})},nu=({color:i="var(--primary)",backgroundColor:e="var(--background)",duration:t=150,blurIntensity:n="1em",density:r=1,className:s})=>{const a=()=>[`radial-gradient(4px 100px at 0px 235px, ${i}, transparent)`,`radial-gradient(4px 100px at 300px 235px, ${i}, transparent)`,`radial-gradient(1.5px 1.5px at 150px 117.5px, ${i} 100%, transparent 150%)`,`radial-gradient(4px 100px at 0px 252px, ${i}, transparent)`,`radial-gradient(4px 100px at 300px 252px, ${i}, transparent)`,`radial-gradient(1.5px 1.5px at 150px 126px, ${i} 100%, transparent 150%)`,`radial-gradient(4px 100px at 0px 150px, ${i}, transparent)`,`radial-gradient(4px 100px at 300px 150px, ${i}, transparent)`,`radial-gradient(1.5px 1.5px at 150px 75px, ${i} 100%, transparent 150%)`,`radial-gradient(4px 100px at 0px 253px, ${i}, transparent)`,`radial-gradient(4px 100px at 300px 253px, ${i}, transparent)`,`radial-gradient(1.5px 1.5px at 150px 126.5px, ${i} 100%, transparent 150%)`,`radial-gradient(4px 100px at 0px 204px, ${i}, transparent)`,`radial-gradient(4px 100px at 300px 204px, ${i}, transparent)`,`radial-gradient(1.5px 1.5px at 150px 102px, ${i} 100%, transparent 150%)`,`radial-gradient(4px 100px at 0px 134px, ${i}, transparent)`,`radial-gradient(4px 100px at 300px 134px, ${i}, transparent)`,`radial-gradient(1.5px 1.5px at 150px 67px, ${i} 100%, transparent 150%)`,`radial-gradient(4px 100px at 0px 179px, ${i}, transparent)`,`radial-gradient(4px 100px at 300px 179px, ${i}, transparent)`,`radial-gradient(1.5px 1.5px at 150px 89.5px, ${i} 100%, transparent 150%)`,`radial-gradient(4px 100px at 0px 299px, ${i}, transparent)`,`radial-gradient(4px 100px at 300px 299px, ${i}, transparent)`,`radial-gradient(1.5px 1.5px at 150px 149.5px, ${i} 100%, transparent 150%)`,`radial-gradient(4px 100px at 0px 215px, ${i}, transparent)`,`radial-gradient(4px 100px at 300px 215px, ${i}, transparent)`,`radial-gradient(1.5px 1.5px at 150px 107.5px, ${i} 100%, transparent 150%)`,`radial-gradient(4px 100px at 0px 281px, ${i}, transparent)`,`radial-gradient(4px 100px at 300px 281px, ${i}, transparent)`,`radial-gradient(1.5px 1.5px at 150px 140.5px, ${i} 100%, transparent 150%)`,`radial-gradient(4px 100px at 0px 158px, ${i}, transparent)`,`radial-gradient(4px 100px at 300px 158px, ${i}, transparent)`,`radial-gradient(1.5px 1.5px at 150px 79px, ${i} 100%, transparent 150%)`,`radial-gradient(4px 100px at 0px 210px, ${i}, transparent)`,`radial-gradient(4px 100px at 300px 210px, ${i}, transparent)`,`radial-gradient(1.5px 1.5px at 150px 105px, ${i} 100%, transparent 150%)`].join(", "),o=["300px 235px","300px 235px","300px 235px","300px 252px","300px 252px","300px 252px","300px 150px","300px 150px","300px 150px","300px 253px","300px 253px","300px 253px","300px 204px","300px 204px","300px 204px","300px 134px","300px 134px","300px 134px","300px 179px","300px 179px","300px 179px","300px 299px","300px 299px","300px 299px","300px 215px","300px 215px","300px 215px","300px 281px","300px 281px","300px 281px","300px 158px","300px 158px","300px 158px","300px 210px","300px 210px"].join(", "),l="0px 220px, 3px 220px, 151.5px 337.5px, 25px 24px, 28px 24px, 176.5px 150px, 50px 16px, 53px 16px, 201.5px 91px, 75px 224px, 78px 224px, 226.5px 230.5px, 100px 19px, 103px 19px, 251.5px 121px, 125px 120px, 128px 120px, 276.5px 187px, 150px 31px, 153px 31px, 301.5px 120.5px, 175px 235px, 178px 235px, 326.5px 384.5px, 200px 121px, 203px 121px, 351.5px 228.5px, 225px 224px, 228px 224px, 376.5px 364.5px, 250px 26px, 253px 26px, 401.5px 105px, 275px 75px, 278px 75px, 426.5px 180px";return se.jsxs("div",{className:Hr("relative h-full w-full p-1",s),children:[se.jsx(Mt.motion.div,{initial:{opacity:0},animate:{opacity:1},transition:{duration:.2},className:"size-full",children:se.jsx(Mt.motion.div,{className:"relative size-full z-0",style:{backgroundColor:e,backgroundImage:a(),backgroundSize:o},variants:{initial:{backgroundPosition:l},animate:{backgroundPosition:[l,"0px 6800px, 3px 6800px, 151.5px 6917.5px, 25px 13632px, 28px 13632px, 176.5px 13758px, 50px 5416px, 53px 5416px, 201.5px 5491px, 75px 17175px, 78px 17175px, 226.5px 17301.5px, 100px 5119px, 103px 5119px, 251.5px 5221px, 125px 8428px, 128px 8428px, 276.5px 8495px, 150px 9876px, 153px 9876px, 301.5px 9965.5px, 175px 13391px, 178px 13391px, 326.5px 13540.5px, 200px 14741px, 203px 14741px, 351.5px 14848.5px, 225px 18770px, 228px 18770px, 376.5px 18910.5px, 250px 5082px, 253px 5082px, 401.5px 5161px, 275px 6375px, 278px 6375px, 426.5px 6480px"],transition:{duration:t,ease:"linear",repeat:Number.POSITIVE_INFINITY}}},initial:"initial",animate:"animate"})}),se.jsx("div",{className:"absolute inset-0 z-1 dark:brightness-600",style:{backdropFilter:`blur(${n})`,backgroundImage:`radial-gradient(circle at 50% 50%, transparent 0, transparent 2px, ${e} 2px)`,backgroundSize:`${8*r}px ${8*r}px`}})]})},iu=({text:i,disabled:e=!1,speed:t=2,className:n="",color:r="#b5b5b5",shineColor:s="#ffffff",spread:a=120,yoyo:o=!1,pauseOnHover:l=!1,direction:c="left",delay:u=0,fontSize:d,fontFamily:h})=>{const[f,g]=de.useState(!1),_=Mt.useMotionValue(0),m=de.useRef(0),p=de.useRef(null),E=de.useRef(c==="left"?1:-1),v=t*1e3,b=u*1e3;Mt.useAnimationFrame(M=>{if(e||f){p.current=null;return}if(p.current===null){p.current=M;return}const F=M-p.current;if(p.current=M,m.current+=F,o){const L=v+b,C=L*2,N=m.current%C;if(N<v){const V=N/v*100;_.set(E.current===1?V:100-V)}else if(N<L)_.set(E.current===1?100:0);else if(N<L+v){const j=100-(N-L)/v*100;_.set(E.current===1?j:100-j)}else _.set(E.current===1?0:100)}else{const L=v+b,C=m.current%L;if(C<v){const N=C/v*100;_.set(E.current===1?N:100-N)}else _.set(E.current===1?100:0)}}),de.useEffect(()=>{E.current=c==="left"?1:-1,m.current=0,_.set(0)},[c]);const R=Mt.useTransform(_,M=>`${150-M*2}% center`),T=de.useCallback(()=>{l&&g(!0)},[l]),A=de.useCallback(()=>{l&&g(!1)},[l]),S={...{backgroundImage:`linear-gradient(${a}deg, ${r} 0%, ${r} 35%, ${s} 50%, ${r} 65%, ${r} 100%)`,backgroundSize:"200% auto",WebkitBackgroundClip:"text",backgroundClip:"text",WebkitTextFillColor:"transparent"},backgroundPosition:R,...d&&{fontSize:d},...h&&{fontFamily:h}};return se.jsx(Mt.motion.span,{className:`inline-block ${n}`,style:S,onMouseEnter:T,onMouseLeave:A,children:i})};const Qs="163",Vn={ROTATE:0,DOLLY:1,PAN:2},Hn={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},ru=0,Aa=1,su=2,Pl=1,au=2,Jt=3,_n=0,yt=1,Wt=2,en=0,ci=1,ui=2,wa=3,Ca=4,ou=5,wn=100,lu=101,cu=102,uu=103,hu=104,du=200,fu=201,pu=202,mu=203,ks=204,Vs=205,gu=206,_u=207,xu=208,vu=209,Mu=210,yu=211,Su=212,Eu=213,bu=214,Tu=0,Du=1,Au=2,Ar=3,wu=4,Cu=5,Ru=6,Pu=7,Ll=0,Lu=1,Fu=2,pn=0,Iu=1,Nu=2,Uu=3,ea=4,Ou=5,Bu=6,zu=7,Fl=300,pi=301,mi=302,Hs=303,Gs=304,Ur=306,Ws=1e3,Pn=1001,Xs=1002,Nt=1003,ku=1004,ji=1005,zt=1006,$r=1007,Ln=1008,mn=1009,Vu=1010,Hu=1011,Il=1012,Nl=1013,gi=1014,fn=1015,gn=1016,Ul=1017,Ol=1018,zi=1020,Gu=35902,Wu=1021,Xu=1022,Xt=1023,qu=1024,ju=1025,hi=1026,Ui=1027,$u=1028,Bl=1029,Yu=1030,zl=1031,kl=1033,Yr=33776,Kr=33777,Zr=33778,Jr=33779,Ra=35840,Pa=35841,La=35842,Fa=35843,Vl=36196,Ia=37492,Na=37496,Ua=37808,Oa=37809,Ba=37810,za=37811,ka=37812,Va=37813,Ha=37814,Ga=37815,Wa=37816,Xa=37817,qa=37818,ja=37819,$a=37820,Ya=37821,Qr=36492,Ka=36494,Za=36495,Ku=36283,Ja=36284,Qa=36285,eo=36286,Zu=3200,Ju=3201,Qu=0,eh=1,dn="",It="srgb",xn="srgb-linear",ta="display-p3",Or="display-p3-linear",wr="linear",Ke="srgb",Cr="rec709",Rr="p3",Gn=7680,to=519,th=512,nh=513,ih=514,Hl=515,rh=516,sh=517,ah=518,oh=519,no=35044,io="300 es",Qt=2e3,Pr=2001;class Un{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const n=this._listeners;return n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const r=this._listeners[e];if(r!==void 0){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const n=this._listeners[e.type];if(n!==void 0){e.target=this;const r=n.slice(0);for(let s=0,a=r.length;s<a;s++)r[s].call(this,e);e.target=null}}}const mt=["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"];let ro=1234567;const di=Math.PI/180,Oi=180/Math.PI;function xi(){const i=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(mt[i&255]+mt[i>>8&255]+mt[i>>16&255]+mt[i>>24&255]+"-"+mt[e&255]+mt[e>>8&255]+"-"+mt[e>>16&15|64]+mt[e>>24&255]+"-"+mt[t&63|128]+mt[t>>8&255]+"-"+mt[t>>16&255]+mt[t>>24&255]+mt[n&255]+mt[n>>8&255]+mt[n>>16&255]+mt[n>>24&255]).toLowerCase()}function ht(i,e,t){return Math.max(e,Math.min(t,i))}function na(i,e){return(i%e+e)%e}function lh(i,e,t,n,r){return n+(i-e)*(r-n)/(t-e)}function ch(i,e,t){return i!==e?(t-i)/(e-i):0}function Pi(i,e,t){return(1-t)*i+t*e}function uh(i,e,t,n){return Pi(i,e,1-Math.exp(-t*n))}function hh(i,e=1){return e-Math.abs(na(i,e*2)-e)}function dh(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*(3-2*i))}function fh(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*i*(i*(i*6-15)+10))}function ph(i,e){return i+Math.floor(Math.random()*(e-i+1))}function mh(i,e){return i+Math.random()*(e-i)}function gh(i){return i*(.5-Math.random())}function _h(i){i!==void 0&&(ro=i);let e=ro+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function xh(i){return i*di}function vh(i){return i*Oi}function Mh(i){return(i&i-1)===0&&i!==0}function yh(i){return Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))}function Sh(i){return Math.pow(2,Math.floor(Math.log(i)/Math.LN2))}function Eh(i,e,t,n,r){const s=Math.cos,a=Math.sin,o=s(t/2),l=a(t/2),c=s((e+n)/2),u=a((e+n)/2),d=s((e-n)/2),h=a((e-n)/2),f=s((n-e)/2),g=a((n-e)/2);switch(r){case"XYX":i.set(o*u,l*d,l*h,o*c);break;case"YZY":i.set(l*h,o*u,l*d,o*c);break;case"ZXZ":i.set(l*d,l*h,o*u,o*c);break;case"XZX":i.set(o*u,l*g,l*f,o*c);break;case"YXY":i.set(l*f,o*u,l*g,o*c);break;case"ZYZ":i.set(l*g,l*f,o*u,o*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function ai(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return i/4294967295;case Uint16Array:return i/65535;case Uint8Array:return i/255;case Int32Array:return Math.max(i/2147483647,-1);case Int16Array:return Math.max(i/32767,-1);case Int8Array:return Math.max(i/127,-1);default:throw new Error("Invalid component type.")}}function xt(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return Math.round(i*4294967295);case Uint16Array:return Math.round(i*65535);case Uint8Array:return Math.round(i*255);case Int32Array:return Math.round(i*2147483647);case Int16Array:return Math.round(i*32767);case Int8Array:return Math.round(i*127);default:throw new Error("Invalid component type.")}}const Gl={DEG2RAD:di,RAD2DEG:Oi,generateUUID:xi,clamp:ht,euclideanModulo:na,mapLinear:lh,inverseLerp:ch,lerp:Pi,damp:uh,pingpong:hh,smoothstep:dh,smootherstep:fh,randInt:ph,randFloat:mh,randFloatSpread:gh,seededRandom:_h,degToRad:xh,radToDeg:vh,isPowerOfTwo:Mh,ceilPowerOfTwo:yh,floorPowerOfTwo:Sh,setQuaternionFromProperEuler:Eh,normalize:xt,denormalize:ai};class ue{constructor(e=0,t=0){ue.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(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){const t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+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){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(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}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(ht(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}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,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,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){const n=Math.cos(t),r=Math.sin(t),s=this.x-e.x,a=this.y-e.y;return this.x=s*n-a*r+e.x,this.y=s*r+a*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Be{constructor(e,t,n,r,s,a,o,l,c){Be.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,r,s,a,o,l,c)}set(e,t,n,r,s,a,o,l,c){const u=this.elements;return u[0]=e,u[1]=r,u[2]=o,u[3]=t,u[4]=s,u[5]=l,u[6]=n,u[7]=a,u[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const 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){const n=e.elements,r=t.elements,s=this.elements,a=n[0],o=n[3],l=n[6],c=n[1],u=n[4],d=n[7],h=n[2],f=n[5],g=n[8],_=r[0],m=r[3],p=r[6],E=r[1],v=r[4],b=r[7],R=r[2],T=r[5],A=r[8];return s[0]=a*_+o*E+l*R,s[3]=a*m+o*v+l*T,s[6]=a*p+o*b+l*A,s[1]=c*_+u*E+d*R,s[4]=c*m+u*v+d*T,s[7]=c*p+u*b+d*A,s[2]=h*_+f*E+g*R,s[5]=h*m+f*v+g*T,s[8]=h*p+f*b+g*A,this}multiplyScalar(e){const 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(){const e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],u=e[8];return t*a*u-t*o*c-n*s*u+n*o*l+r*s*c-r*a*l}invert(){const e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],u=e[8],d=u*a-o*c,h=o*l-u*s,f=c*s-a*l,g=t*d+n*h+r*f;if(g===0)return this.set(0,0,0,0,0,0,0,0,0);const _=1/g;return e[0]=d*_,e[1]=(r*c-u*n)*_,e[2]=(o*n-r*a)*_,e[3]=h*_,e[4]=(u*t-r*l)*_,e[5]=(r*s-o*t)*_,e[6]=f*_,e[7]=(n*l-c*t)*_,e[8]=(a*t-n*s)*_,this}transpose(){let e;const 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){const 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,n,r,s,a,o){const l=Math.cos(s),c=Math.sin(s);return this.set(n*l,n*c,-n*(l*a+c*o)+a+e,-r*c,r*l,-r*(-c*a+l*o)+o+t,0,0,1),this}scale(e,t){return this.premultiply(es.makeScale(e,t)),this}rotate(e){return this.premultiply(es.makeRotation(-e)),this}translate(e,t){return this.premultiply(es.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,n=e.elements;for(let r=0;r<9;r++)if(t[r]!==n[r])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const es=new Be;function Wl(i){for(let e=i.length-1;e>=0;--e)if(i[e]>=65535)return!0;return!1}function Lr(i){return document.createElementNS("http://www.w3.org/1999/xhtml",i)}function bh(){const i=Lr("canvas");return i.style.display="block",i}const so={};function Th(i){i in so||(so[i]=!0,console.warn(i))}const ao=new Be().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),oo=new Be().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),$i={[xn]:{transfer:wr,primaries:Cr,toReference:i=>i,fromReference:i=>i},[It]:{transfer:Ke,primaries:Cr,toReference:i=>i.convertSRGBToLinear(),fromReference:i=>i.convertLinearToSRGB()},[Or]:{transfer:wr,primaries:Rr,toReference:i=>i.applyMatrix3(oo),fromReference:i=>i.applyMatrix3(ao)},[ta]:{transfer:Ke,primaries:Rr,toReference:i=>i.convertSRGBToLinear().applyMatrix3(oo),fromReference:i=>i.applyMatrix3(ao).convertLinearToSRGB()}},Dh=new Set([xn,Or]),Ye={enabled:!0,_workingColorSpace:xn,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(i){if(!Dh.has(i))throw new Error(`Unsupported working color space, "${i}".`);this._workingColorSpace=i},convert:function(i,e,t){if(this.enabled===!1||e===t||!e||!t)return i;const n=$i[e].toReference,r=$i[t].fromReference;return r(n(i))},fromWorkingColorSpace:function(i,e){return this.convert(i,this._workingColorSpace,e)},toWorkingColorSpace:function(i,e){return this.convert(i,e,this._workingColorSpace)},getPrimaries:function(i){return $i[i].primaries},getTransfer:function(i){return i===dn?wr:$i[i].transfer}};function fi(i){return i<.04045?i*.0773993808:Math.pow(i*.9478672986+.0521327014,2.4)}function ts(i){return i<.0031308?i*12.92:1.055*Math.pow(i,.41666)-.055}let Wn;class Ah{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{Wn===void 0&&(Wn=Lr("canvas")),Wn.width=e.width,Wn.height=e.height;const n=Wn.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=Wn}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=Lr("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const r=n.getImageData(0,0,e.width,e.height),s=r.data;for(let a=0;a<s.length;a++)s[a]=fi(s[a]/255)*255;return n.putImageData(r,0,0),t}else if(e.data){const t=e.data.slice(0);for(let n=0;n<t.length;n++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[n]=Math.floor(fi(t[n]/255)*255):t[n]=fi(t[n]);return{data:t,width:e.width,height:e.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let wh=0;class Xl{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:wh++}),this.uuid=xi(),this.data=e,this.dataReady=!0,this.version=0}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const n={uuid:this.uuid,url:""},r=this.data;if(r!==null){let s;if(Array.isArray(r)){s=[];for(let a=0,o=r.length;a<o;a++)r[a].isDataTexture?s.push(ns(r[a].image)):s.push(ns(r[a]))}else s=ns(r);n.url=s}return t||(e.images[this.uuid]=n),n}}function ns(i){return typeof HTMLImageElement<"u"&&i instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&i instanceof ImageBitmap?Ah.getDataURL(i):i.data?{data:Array.from(i.data),width:i.width,height:i.height,type:i.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let Ch=0;class Tt extends Un{constructor(e=Tt.DEFAULT_IMAGE,t=Tt.DEFAULT_MAPPING,n=Pn,r=Pn,s=zt,a=Ln,o=Xt,l=mn,c=Tt.DEFAULT_ANISOTROPY,u=dn){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Ch++}),this.uuid=xi(),this.name="",this.source=new Xl(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=r,this.magFilter=s,this.minFilter=a,this.anisotropy=c,this.format=o,this.internalFormat=null,this.type=l,this.offset=new ue(0,0),this.repeat=new ue(1,1),this.center=new ue(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Be,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=u,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.pmremVersion=0}get image(){return this.source.data}set image(e=null){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.channel=e.channel,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.colorSpace=e.colorSpace,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const n={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==Fl)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Ws:e.x=e.x-Math.floor(e.x);break;case Pn:e.x=e.x<0?0:1;break;case Xs:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case Ws:e.y=e.y-Math.floor(e.y);break;case Pn:e.y=e.y<0?0:1;break;case Xs:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}Tt.DEFAULT_IMAGE=null;Tt.DEFAULT_MAPPING=Fl;Tt.DEFAULT_ANISOTROPY=1;class dt{constructor(e=0,t=0,n=0,r=1){dt.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,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,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,n=this.y,r=this.z,s=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*r+a[12]*s,this.y=a[1]*t+a[5]*n+a[9]*r+a[13]*s,this.z=a[2]*t+a[6]*n+a[10]*r+a[14]*s,this.w=a[3]*t+a[7]*n+a[11]*r+a[15]*s,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const 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,n,r,s;const l=e.elements,c=l[0],u=l[4],d=l[8],h=l[1],f=l[5],g=l[9],_=l[2],m=l[6],p=l[10];if(Math.abs(u-h)<.01&&Math.abs(d-_)<.01&&Math.abs(g-m)<.01){if(Math.abs(u+h)<.1&&Math.abs(d+_)<.1&&Math.abs(g+m)<.1&&Math.abs(c+f+p-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const v=(c+1)/2,b=(f+1)/2,R=(p+1)/2,T=(u+h)/4,A=(d+_)/4,P=(g+m)/4;return v>b&&v>R?v<.01?(n=0,r=.707106781,s=.707106781):(n=Math.sqrt(v),r=T/n,s=A/n):b>R?b<.01?(n=.707106781,r=0,s=.707106781):(r=Math.sqrt(b),n=T/r,s=P/r):R<.01?(n=.707106781,r=.707106781,s=0):(s=Math.sqrt(R),n=A/s,r=P/s),this.set(n,r,s,t),this}let E=Math.sqrt((m-g)*(m-g)+(d-_)*(d-_)+(h-u)*(h-u));return Math.abs(E)<.001&&(E=1),this.x=(m-g)/E,this.y=(d-_)/E,this.z=(h-u)/E,this.w=Math.acos((c+f+p-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){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(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,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,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}}class Rh extends Un{constructor(e=1,t=1,n={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new dt(0,0,e,t),this.scissorTest=!1,this.viewport=new dt(0,0,e,t);const r={width:e,height:t,depth:1};n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:zt,depthBuffer:!0,stencilBuffer:!1,depthTexture:null,samples:0,count:1},n);const s=new Tt(r,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.colorSpace);s.flipY=!1,s.generateMipmaps=n.generateMipmaps,s.internalFormat=n.internalFormat,this.textures=[];const a=n.count;for(let o=0;o<a;o++)this.textures[o]=s.clone(),this.textures[o].isRenderTargetTexture=!0;this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.depthTexture=n.depthTexture,this.samples=n.samples}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let r=0,s=this.textures.length;r<s;r++)this.textures[r].image.width=e,this.textures[r].image.height=t,this.textures[r].image.depth=n;this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let n=0,r=e.textures.length;n<r;n++)this.textures[n]=e.textures[n].clone(),this.textures[n].isRenderTargetTexture=!0;const t=Object.assign({},e.texture.image);return this.texture.source=new Xl(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class Vt extends Rh{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}}class ql extends Tt{constructor(e=null,t=1,n=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=Nt,this.minFilter=Nt,this.wrapR=Pn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Ph extends Tt{constructor(e=null,t=1,n=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=Nt,this.minFilter=Nt,this.wrapR=Pn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Fn{constructor(e=0,t=0,n=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=r}static slerpFlat(e,t,n,r,s,a,o){let l=n[r+0],c=n[r+1],u=n[r+2],d=n[r+3];const h=s[a+0],f=s[a+1],g=s[a+2],_=s[a+3];if(o===0){e[t+0]=l,e[t+1]=c,e[t+2]=u,e[t+3]=d;return}if(o===1){e[t+0]=h,e[t+1]=f,e[t+2]=g,e[t+3]=_;return}if(d!==_||l!==h||c!==f||u!==g){let m=1-o;const p=l*h+c*f+u*g+d*_,E=p>=0?1:-1,v=1-p*p;if(v>Number.EPSILON){const R=Math.sqrt(v),T=Math.atan2(R,p*E);m=Math.sin(m*T)/R,o=Math.sin(o*T)/R}const b=o*E;if(l=l*m+h*b,c=c*m+f*b,u=u*m+g*b,d=d*m+_*b,m===1-o){const R=1/Math.sqrt(l*l+c*c+u*u+d*d);l*=R,c*=R,u*=R,d*=R}}e[t]=l,e[t+1]=c,e[t+2]=u,e[t+3]=d}static multiplyQuaternionsFlat(e,t,n,r,s,a){const o=n[r],l=n[r+1],c=n[r+2],u=n[r+3],d=s[a],h=s[a+1],f=s[a+2],g=s[a+3];return e[t]=o*g+u*d+l*f-c*h,e[t+1]=l*g+u*h+c*d-o*f,e[t+2]=c*g+u*f+o*h-l*d,e[t+3]=u*g-o*d-l*h-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,n,r){return this._x=e,this._y=t,this._z=n,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=!0){const n=e._x,r=e._y,s=e._z,a=e._order,o=Math.cos,l=Math.sin,c=o(n/2),u=o(r/2),d=o(s/2),h=l(n/2),f=l(r/2),g=l(s/2);switch(a){case"XYZ":this._x=h*u*d+c*f*g,this._y=c*f*d-h*u*g,this._z=c*u*g+h*f*d,this._w=c*u*d-h*f*g;break;case"YXZ":this._x=h*u*d+c*f*g,this._y=c*f*d-h*u*g,this._z=c*u*g-h*f*d,this._w=c*u*d+h*f*g;break;case"ZXY":this._x=h*u*d-c*f*g,this._y=c*f*d+h*u*g,this._z=c*u*g+h*f*d,this._w=c*u*d-h*f*g;break;case"ZYX":this._x=h*u*d-c*f*g,this._y=c*f*d+h*u*g,this._z=c*u*g-h*f*d,this._w=c*u*d+h*f*g;break;case"YZX":this._x=h*u*d+c*f*g,this._y=c*f*d+h*u*g,this._z=c*u*g-h*f*d,this._w=c*u*d-h*f*g;break;case"XZY":this._x=h*u*d-c*f*g,this._y=c*f*d-h*u*g,this._z=c*u*g+h*f*d,this._w=c*u*d+h*f*g;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],r=t[4],s=t[8],a=t[1],o=t[5],l=t[9],c=t[2],u=t[6],d=t[10],h=n+o+d;if(h>0){const f=.5/Math.sqrt(h+1);this._w=.25/f,this._x=(u-l)*f,this._y=(s-c)*f,this._z=(a-r)*f}else if(n>o&&n>d){const f=2*Math.sqrt(1+n-o-d);this._w=(u-l)/f,this._x=.25*f,this._y=(r+a)/f,this._z=(s+c)/f}else if(o>d){const f=2*Math.sqrt(1+o-n-d);this._w=(s-c)/f,this._x=(r+a)/f,this._y=.25*f,this._z=(l+u)/f}else{const f=2*Math.sqrt(1+d-n-o);this._w=(a-r)/f,this._x=(s+c)/f,this._y=(l+u)/f,this._z=.25*f}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<Number.EPSILON?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(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=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(ht(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(n===0)return this;const r=Math.min(1,t/n);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,r=e._y,s=e._z,a=e._w,o=t._x,l=t._y,c=t._z,u=t._w;return this._x=n*u+a*o+r*c-s*l,this._y=r*u+a*l+s*o-n*c,this._z=s*u+a*c+n*l-r*o,this._w=a*u-n*o-r*l-s*c,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const n=this._x,r=this._y,s=this._z,a=this._w;let o=a*e._w+n*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=n,this._y=r,this._z=s,this;const l=1-o*o;if(l<=Number.EPSILON){const f=1-t;return this._w=f*a+t*this._w,this._x=f*n+t*this._x,this._y=f*r+t*this._y,this._z=f*s+t*this._z,this.normalize(),this}const c=Math.sqrt(l),u=Math.atan2(c,o),d=Math.sin((1-t)*u)/c,h=Math.sin(t*u)/c;return this._w=a*d+this._w*h,this._x=n*d+this._x*h,this._y=r*d+this._y*h,this._z=s*d+this._z*h,this._onChangeCallback(),this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),r=Math.sqrt(1-n),s=Math.sqrt(n);return this.set(r*Math.sin(e),r*Math.cos(e),s*Math.sin(t),s*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class I{constructor(e=0,t=0,n=0){I.prototype.isVector3=!0,this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(lo.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(lo.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[3]*n+s[6]*r,this.y=s[1]*t+s[4]*n+s[7]*r,this.z=s[2]*t+s[5]*n+s[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,r=this.z,s=e.elements,a=1/(s[3]*t+s[7]*n+s[11]*r+s[15]);return this.x=(s[0]*t+s[4]*n+s[8]*r+s[12])*a,this.y=(s[1]*t+s[5]*n+s[9]*r+s[13])*a,this.z=(s[2]*t+s[6]*n+s[10]*r+s[14])*a,this}applyQuaternion(e){const t=this.x,n=this.y,r=this.z,s=e.x,a=e.y,o=e.z,l=e.w,c=2*(a*r-o*n),u=2*(o*t-s*r),d=2*(s*n-a*t);return this.x=t+l*c+a*d-o*u,this.y=n+l*u+o*c-s*d,this.z=r+l*d+s*u-a*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,n=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*r,this.y=s[1]*t+s[5]*n+s[9]*r,this.z=s[2]*t+s[6]*n+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){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(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,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,r=e.y,s=e.z,a=t.x,o=t.y,l=t.z;return this.x=r*l-s*o,this.y=s*a-n*l,this.z=n*o-r*a,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return is.copy(this).projectOnVector(e),this.sub(is)}reflect(e){return this.sub(is.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(ht(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+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,n){const r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,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(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const is=new I,lo=new Fn;class ki{constructor(e=new I(1/0,1/0,1/0),t=new I(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t+=3)this.expandByPoint(Ut.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(Ut.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=Ut.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),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);const n=e.geometry;if(n!==void 0){const s=n.getAttribute("position");if(t===!0&&s!==void 0&&e.isInstancedMesh!==!0)for(let a=0,o=s.count;a<o;a++)e.isMesh===!0?e.getVertexPosition(a,Ut):Ut.fromBufferAttribute(s,a),Ut.applyMatrix4(e.matrixWorld),this.expandByPoint(Ut);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),Yi.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),Yi.copy(n.boundingBox)),Yi.applyMatrix4(e.matrixWorld),this.union(Yi)}const r=e.children;for(let s=0,a=r.length;s<a;s++)this.expandByObject(r[s],t);return this}containsPoint(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y||e.z<this.min.z||e.z>this.max.z)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y||e.max.z<this.min.z||e.min.z>this.max.z)}intersectsSphere(e){return this.clampPoint(e.center,Ut),Ut.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Ti),Ki.subVectors(this.max,Ti),Xn.subVectors(e.a,Ti),qn.subVectors(e.b,Ti),jn.subVectors(e.c,Ti),sn.subVectors(qn,Xn),an.subVectors(jn,qn),yn.subVectors(Xn,jn);let t=[0,-sn.z,sn.y,0,-an.z,an.y,0,-yn.z,yn.y,sn.z,0,-sn.x,an.z,0,-an.x,yn.z,0,-yn.x,-sn.y,sn.x,0,-an.y,an.x,0,-yn.y,yn.x,0];return!rs(t,Xn,qn,jn,Ki)||(t=[1,0,0,0,1,0,0,0,1],!rs(t,Xn,qn,jn,Ki))?!1:(Zi.crossVectors(sn,an),t=[Zi.x,Zi.y,Zi.z],rs(t,Xn,qn,jn,Ki))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Ut).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Ut).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(jt[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),jt[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),jt[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),jt[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),jt[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),jt[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),jt[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),jt[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(jt),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)}}const jt=[new I,new I,new I,new I,new I,new I,new I,new I],Ut=new I,Yi=new ki,Xn=new I,qn=new I,jn=new I,sn=new I,an=new I,yn=new I,Ti=new I,Ki=new I,Zi=new I,Sn=new I;function rs(i,e,t,n,r){for(let s=0,a=i.length-3;s<=a;s+=3){Sn.fromArray(i,s);const o=r.x*Math.abs(Sn.x)+r.y*Math.abs(Sn.y)+r.z*Math.abs(Sn.z),l=e.dot(Sn),c=t.dot(Sn),u=n.dot(Sn);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>o)return!1}return!0}const Lh=new ki,Di=new I,ss=new I;class Vi{constructor(e=new I,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const n=this.center;t!==void 0?n.copy(t):Lh.setFromPoints(e).getCenter(n);let r=0;for(let s=0,a=e.length;s<a;s++)r=Math.max(r,n.distanceToSquared(e[s]));return this.radius=Math.sqrt(r),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const 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){const n=this.center.distanceToSquared(e);return t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;Di.subVectors(e,this.center);const t=Di.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),r=(n-this.radius)*.5;this.center.addScaledVector(Di,r/n),this.radius+=r}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(ss.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Di.copy(e.center).add(ss)),this.expandByPoint(Di.copy(e.center).sub(ss))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const $t=new I,as=new I,Ji=new I,on=new I,os=new I,Qi=new I,ls=new I;class Br{constructor(e=new I,t=new I(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,$t)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=$t.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):($t.copy(this.origin).addScaledVector(this.direction,t),$t.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){as.copy(e).add(t).multiplyScalar(.5),Ji.copy(t).sub(e).normalize(),on.copy(this.origin).sub(as);const s=e.distanceTo(t)*.5,a=-this.direction.dot(Ji),o=on.dot(this.direction),l=-on.dot(Ji),c=on.lengthSq(),u=Math.abs(1-a*a);let d,h,f,g;if(u>0)if(d=a*l-o,h=a*o-l,g=s*u,d>=0)if(h>=-g)if(h<=g){const _=1/u;d*=_,h*=_,f=d*(d+a*h+2*o)+h*(a*d+h+2*l)+c}else h=s,d=Math.max(0,-(a*h+o)),f=-d*d+h*(h+2*l)+c;else h=-s,d=Math.max(0,-(a*h+o)),f=-d*d+h*(h+2*l)+c;else h<=-g?(d=Math.max(0,-(-a*s+o)),h=d>0?-s:Math.min(Math.max(-s,-l),s),f=-d*d+h*(h+2*l)+c):h<=g?(d=0,h=Math.min(Math.max(-s,-l),s),f=h*(h+2*l)+c):(d=Math.max(0,-(a*s+o)),h=d>0?s:Math.min(Math.max(-s,-l),s),f=-d*d+h*(h+2*l)+c);else h=a>0?-s:s,d=Math.max(0,-(a*h+o)),f=-d*d+h*(h+2*l)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,d),r&&r.copy(as).addScaledVector(Ji,h),f}intersectSphere(e,t){$t.subVectors(e.center,this.origin);const n=$t.dot(this.direction),r=$t.dot($t)-n*n,s=e.radius*e.radius;if(r>s)return null;const a=Math.sqrt(s-r),o=n-a,l=n+a;return l<0?null:o<0?this.at(l,t):this.at(o,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,r,s,a,o,l;const c=1/this.direction.x,u=1/this.direction.y,d=1/this.direction.z,h=this.origin;return c>=0?(n=(e.min.x-h.x)*c,r=(e.max.x-h.x)*c):(n=(e.max.x-h.x)*c,r=(e.min.x-h.x)*c),u>=0?(s=(e.min.y-h.y)*u,a=(e.max.y-h.y)*u):(s=(e.max.y-h.y)*u,a=(e.min.y-h.y)*u),n>a||s>r||((s>n||isNaN(n))&&(n=s),(a<r||isNaN(r))&&(r=a),d>=0?(o=(e.min.z-h.z)*d,l=(e.max.z-h.z)*d):(o=(e.max.z-h.z)*d,l=(e.min.z-h.z)*d),n>l||o>r)||((o>n||n!==n)&&(n=o),(l<r||r!==r)&&(r=l),r<0)?null:this.at(n>=0?n:r,t)}intersectsBox(e){return this.intersectBox(e,$t)!==null}intersectTriangle(e,t,n,r,s){os.subVectors(t,e),Qi.subVectors(n,e),ls.crossVectors(os,Qi);let a=this.direction.dot(ls),o;if(a>0){if(r)return null;o=1}else if(a<0)o=-1,a=-a;else return null;on.subVectors(this.origin,e);const l=o*this.direction.dot(Qi.crossVectors(on,Qi));if(l<0)return null;const c=o*this.direction.dot(os.cross(on));if(c<0||l+c>a)return null;const u=-o*on.dot(ls);return u<0?null:this.at(u/a,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class et{constructor(e,t,n,r,s,a,o,l,c,u,d,h,f,g,_,m){et.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,n,r,s,a,o,l,c,u,d,h,f,g,_,m)}set(e,t,n,r,s,a,o,l,c,u,d,h,f,g,_,m){const p=this.elements;return p[0]=e,p[4]=t,p[8]=n,p[12]=r,p[1]=s,p[5]=a,p[9]=o,p[13]=l,p[2]=c,p[6]=u,p[10]=d,p[14]=h,p[3]=f,p[7]=g,p[11]=_,p[15]=m,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new et().fromArray(this.elements)}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){const t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){const 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,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,n=e.elements,r=1/$n.setFromMatrixColumn(e,0).length(),s=1/$n.setFromMatrixColumn(e,1).length(),a=1/$n.setFromMatrixColumn(e,2).length();return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=0,t[4]=n[4]*s,t[5]=n[5]*s,t[6]=n[6]*s,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,n=e.x,r=e.y,s=e.z,a=Math.cos(n),o=Math.sin(n),l=Math.cos(r),c=Math.sin(r),u=Math.cos(s),d=Math.sin(s);if(e.order==="XYZ"){const h=a*u,f=a*d,g=o*u,_=o*d;t[0]=l*u,t[4]=-l*d,t[8]=c,t[1]=f+g*c,t[5]=h-_*c,t[9]=-o*l,t[2]=_-h*c,t[6]=g+f*c,t[10]=a*l}else if(e.order==="YXZ"){const h=l*u,f=l*d,g=c*u,_=c*d;t[0]=h+_*o,t[4]=g*o-f,t[8]=a*c,t[1]=a*d,t[5]=a*u,t[9]=-o,t[2]=f*o-g,t[6]=_+h*o,t[10]=a*l}else if(e.order==="ZXY"){const h=l*u,f=l*d,g=c*u,_=c*d;t[0]=h-_*o,t[4]=-a*d,t[8]=g+f*o,t[1]=f+g*o,t[5]=a*u,t[9]=_-h*o,t[2]=-a*c,t[6]=o,t[10]=a*l}else if(e.order==="ZYX"){const h=a*u,f=a*d,g=o*u,_=o*d;t[0]=l*u,t[4]=g*c-f,t[8]=h*c+_,t[1]=l*d,t[5]=_*c+h,t[9]=f*c-g,t[2]=-c,t[6]=o*l,t[10]=a*l}else if(e.order==="YZX"){const h=a*l,f=a*c,g=o*l,_=o*c;t[0]=l*u,t[4]=_-h*d,t[8]=g*d+f,t[1]=d,t[5]=a*u,t[9]=-o*u,t[2]=-c*u,t[6]=f*d+g,t[10]=h-_*d}else if(e.order==="XZY"){const h=a*l,f=a*c,g=o*l,_=o*c;t[0]=l*u,t[4]=-d,t[8]=c*u,t[1]=h*d+_,t[5]=a*u,t[9]=f*d-g,t[2]=g*d-f,t[6]=o*u,t[10]=_*d+h}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(Fh,e,Ih)}lookAt(e,t,n){const r=this.elements;return wt.subVectors(e,t),wt.lengthSq()===0&&(wt.z=1),wt.normalize(),ln.crossVectors(n,wt),ln.lengthSq()===0&&(Math.abs(n.z)===1?wt.x+=1e-4:wt.z+=1e-4,wt.normalize(),ln.crossVectors(n,wt)),ln.normalize(),er.crossVectors(wt,ln),r[0]=ln.x,r[4]=er.x,r[8]=wt.x,r[1]=ln.y,r[5]=er.y,r[9]=wt.y,r[2]=ln.z,r[6]=er.z,r[10]=wt.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,r=t.elements,s=this.elements,a=n[0],o=n[4],l=n[8],c=n[12],u=n[1],d=n[5],h=n[9],f=n[13],g=n[2],_=n[6],m=n[10],p=n[14],E=n[3],v=n[7],b=n[11],R=n[15],T=r[0],A=r[4],P=r[8],S=r[12],M=r[1],F=r[5],L=r[9],C=r[13],N=r[2],V=r[6],j=r[10],J=r[14],z=r[3],Y=r[7],$=r[11],U=r[15];return s[0]=a*T+o*M+l*N+c*z,s[4]=a*A+o*F+l*V+c*Y,s[8]=a*P+o*L+l*j+c*$,s[12]=a*S+o*C+l*J+c*U,s[1]=u*T+d*M+h*N+f*z,s[5]=u*A+d*F+h*V+f*Y,s[9]=u*P+d*L+h*j+f*$,s[13]=u*S+d*C+h*J+f*U,s[2]=g*T+_*M+m*N+p*z,s[6]=g*A+_*F+m*V+p*Y,s[10]=g*P+_*L+m*j+p*$,s[14]=g*S+_*C+m*J+p*U,s[3]=E*T+v*M+b*N+R*z,s[7]=E*A+v*F+b*V+R*Y,s[11]=E*P+v*L+b*j+R*$,s[15]=E*S+v*C+b*J+R*U,this}multiplyScalar(e){const 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(){const e=this.elements,t=e[0],n=e[4],r=e[8],s=e[12],a=e[1],o=e[5],l=e[9],c=e[13],u=e[2],d=e[6],h=e[10],f=e[14],g=e[3],_=e[7],m=e[11],p=e[15];return g*(+s*l*d-r*c*d-s*o*h+n*c*h+r*o*f-n*l*f)+_*(+t*l*f-t*c*h+s*a*h-r*a*f+r*c*u-s*l*u)+m*(+t*c*d-t*o*f-s*a*d+n*a*f+s*o*u-n*c*u)+p*(-r*o*u-t*l*d+t*o*h+r*a*d-n*a*h+n*l*u)}transpose(){const e=this.elements;let 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,n){const 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]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],u=e[8],d=e[9],h=e[10],f=e[11],g=e[12],_=e[13],m=e[14],p=e[15],E=d*m*c-_*h*c+_*l*f-o*m*f-d*l*p+o*h*p,v=g*h*c-u*m*c-g*l*f+a*m*f+u*l*p-a*h*p,b=u*_*c-g*d*c+g*o*f-a*_*f-u*o*p+a*d*p,R=g*d*l-u*_*l-g*o*h+a*_*h+u*o*m-a*d*m,T=t*E+n*v+r*b+s*R;if(T===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const A=1/T;return e[0]=E*A,e[1]=(_*h*s-d*m*s-_*r*f+n*m*f+d*r*p-n*h*p)*A,e[2]=(o*m*s-_*l*s+_*r*c-n*m*c-o*r*p+n*l*p)*A,e[3]=(d*l*s-o*h*s-d*r*c+n*h*c+o*r*f-n*l*f)*A,e[4]=v*A,e[5]=(u*m*s-g*h*s+g*r*f-t*m*f-u*r*p+t*h*p)*A,e[6]=(g*l*s-a*m*s-g*r*c+t*m*c+a*r*p-t*l*p)*A,e[7]=(a*h*s-u*l*s+u*r*c-t*h*c-a*r*f+t*l*f)*A,e[8]=b*A,e[9]=(g*d*s-u*_*s-g*n*f+t*_*f+u*n*p-t*d*p)*A,e[10]=(a*_*s-g*o*s+g*n*c-t*_*c-a*n*p+t*o*p)*A,e[11]=(u*o*s-a*d*s-u*n*c+t*d*c+a*n*f-t*o*f)*A,e[12]=R*A,e[13]=(u*_*r-g*d*r+g*n*h-t*_*h-u*n*m+t*d*m)*A,e[14]=(g*o*r-a*_*r-g*n*l+t*_*l+a*n*m-t*o*m)*A,e[15]=(a*d*r-u*o*r+u*n*l-t*d*l-a*n*h+t*o*h)*A,this}scale(e){const t=this.elements,n=e.x,r=e.y,s=e.z;return t[0]*=n,t[4]*=r,t[8]*=s,t[1]*=n,t[5]*=r,t[9]*=s,t[2]*=n,t[6]*=r,t[10]*=s,t[3]*=n,t[7]*=r,t[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,r))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const n=Math.cos(t),r=Math.sin(t),s=1-n,a=e.x,o=e.y,l=e.z,c=s*a,u=s*o;return this.set(c*a+n,c*o-r*l,c*l+r*o,0,c*o+r*l,u*o+n,u*l-r*a,0,c*l-r*o,u*l+r*a,s*l*l+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,r,s,a){return this.set(1,n,s,0,e,1,a,0,t,r,1,0,0,0,0,1),this}compose(e,t,n){const r=this.elements,s=t._x,a=t._y,o=t._z,l=t._w,c=s+s,u=a+a,d=o+o,h=s*c,f=s*u,g=s*d,_=a*u,m=a*d,p=o*d,E=l*c,v=l*u,b=l*d,R=n.x,T=n.y,A=n.z;return r[0]=(1-(_+p))*R,r[1]=(f+b)*R,r[2]=(g-v)*R,r[3]=0,r[4]=(f-b)*T,r[5]=(1-(h+p))*T,r[6]=(m+E)*T,r[7]=0,r[8]=(g+v)*A,r[9]=(m-E)*A,r[10]=(1-(h+_))*A,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,n){const r=this.elements;let s=$n.set(r[0],r[1],r[2]).length();const a=$n.set(r[4],r[5],r[6]).length(),o=$n.set(r[8],r[9],r[10]).length();this.determinant()<0&&(s=-s),e.x=r[12],e.y=r[13],e.z=r[14],Ot.copy(this);const c=1/s,u=1/a,d=1/o;return Ot.elements[0]*=c,Ot.elements[1]*=c,Ot.elements[2]*=c,Ot.elements[4]*=u,Ot.elements[5]*=u,Ot.elements[6]*=u,Ot.elements[8]*=d,Ot.elements[9]*=d,Ot.elements[10]*=d,t.setFromRotationMatrix(Ot),n.x=s,n.y=a,n.z=o,this}makePerspective(e,t,n,r,s,a,o=Qt){const l=this.elements,c=2*s/(t-e),u=2*s/(n-r),d=(t+e)/(t-e),h=(n+r)/(n-r);let f,g;if(o===Qt)f=-(a+s)/(a-s),g=-2*a*s/(a-s);else if(o===Pr)f=-a/(a-s),g=-a*s/(a-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return l[0]=c,l[4]=0,l[8]=d,l[12]=0,l[1]=0,l[5]=u,l[9]=h,l[13]=0,l[2]=0,l[6]=0,l[10]=f,l[14]=g,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,n,r,s,a,o=Qt){const l=this.elements,c=1/(t-e),u=1/(n-r),d=1/(a-s),h=(t+e)*c,f=(n+r)*u;let g,_;if(o===Qt)g=(a+s)*d,_=-2*d;else if(o===Pr)g=s*d,_=-1*d;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return l[0]=2*c,l[4]=0,l[8]=0,l[12]=-h,l[1]=0,l[5]=2*u,l[9]=0,l[13]=-f,l[2]=0,l[6]=0,l[10]=_,l[14]=-g,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){const t=this.elements,n=e.elements;for(let r=0;r<16;r++)if(t[r]!==n[r])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}const $n=new I,Ot=new et,Fh=new I(0,0,0),Ih=new I(1,1,1),ln=new I,er=new I,wt=new I,co=new et,uo=new Fn;let In=class jl{constructor(e=0,t=0,n=0,r=jl.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,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,n,r=this._order){return this._x=e,this._y=t,this._z=n,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,n=!0){const r=e.elements,s=r[0],a=r[4],o=r[8],l=r[1],c=r[5],u=r[9],d=r[2],h=r[6],f=r[10];switch(t){case"XYZ":this._y=Math.asin(ht(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-u,f),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(h,c),this._z=0);break;case"YXZ":this._x=Math.asin(-ht(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(o,f),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-d,s),this._z=0);break;case"ZXY":this._x=Math.asin(ht(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(-d,f),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-ht(d,-1,1)),Math.abs(d)<.9999999?(this._x=Math.atan2(h,f),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-a,c));break;case"YZX":this._z=Math.asin(ht(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-d,s)):(this._x=0,this._y=Math.atan2(o,f));break;case"XZY":this._z=Math.asin(-ht(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(h,c),this._y=Math.atan2(o,s)):(this._x=Math.atan2(-u,f),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return co.makeRotationFromQuaternion(e),this.setFromRotationMatrix(co,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return uo.setFromEuler(this),this.setFromQuaternion(uo,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}};In.DEFAULT_ORDER="XYZ";class $l{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}}let Nh=0;const ho=new I,Yn=new Fn,Yt=new et,tr=new I,Ai=new I,Uh=new I,Oh=new Fn,fo=new I(1,0,0),po=new I(0,1,0),mo=new I(0,0,1),go={type:"added"},Bh={type:"removed"},Kn={type:"childadded",child:null},cs={type:"childremoved",child:null};class St extends Un{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Nh++}),this.uuid=xi(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=St.DEFAULT_UP.clone();const e=new I,t=new In,n=new Fn,r=new I(1,1,1);function s(){n.setFromEuler(t,!1)}function a(){t.setFromQuaternion(n,void 0,!1)}t._onChange(s),n._onChange(a),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new et},normalMatrix:{value:new Be}}),this.matrix=new et,this.matrixWorld=new et,this.matrixAutoUpdate=St.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=St.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new $l,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return Yn.setFromAxisAngle(e,t),this.quaternion.multiply(Yn),this}rotateOnWorldAxis(e,t){return Yn.setFromAxisAngle(e,t),this.quaternion.premultiply(Yn),this}rotateX(e){return this.rotateOnAxis(fo,e)}rotateY(e){return this.rotateOnAxis(po,e)}rotateZ(e){return this.rotateOnAxis(mo,e)}translateOnAxis(e,t){return ho.copy(e).applyQuaternion(this.quaternion),this.position.add(ho.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(fo,e)}translateY(e){return this.translateOnAxis(po,e)}translateZ(e){return this.translateOnAxis(mo,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(Yt.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?tr.copy(e):tr.set(e,t,n);const r=this.parent;this.updateWorldMatrix(!0,!1),Ai.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Yt.lookAt(Ai,tr,this.up):Yt.lookAt(tr,Ai,this.up),this.quaternion.setFromRotationMatrix(Yt),r&&(Yt.extractRotation(r.matrixWorld),Yn.setFromRotationMatrix(Yt),this.quaternion.premultiply(Yn.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(go),Kn.child=e,this.dispatchEvent(Kn),Kn.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}const t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(Bh),cs.child=e,this.dispatchEvent(cs),cs.child=null),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),Yt.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),Yt.multiply(e.parent.matrixWorld)),e.applyMatrix4(Yt),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(go),Kn.child=e,this.dispatchEvent(Kn),Kn.child=null,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 n=0,r=this.children.length;n<r;n++){const a=this.children[n].getObjectByProperty(e,t);if(a!==void 0)return a}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);const r=this.children;for(let s=0,a=r.length;s<a;s++)r[s].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Ai,e,Uh),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Ai,Oh,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverseVisible(e)}traverseAncestors(e){const t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let n=0,r=t.length;n<r;n++){const s=t[n];(s.matrixWorldAutoUpdate===!0||e===!0)&&s.updateMatrixWorld(e)}}updateWorldMatrix(e,t){const n=this.parent;if(e===!0&&n!==null&&n.matrixWorldAutoUpdate===!0&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),t===!0){const r=this.children;for(let s=0,a=r.length;s<a;s++){const o=r[s];o.matrixWorldAutoUpdate===!0&&o.updateWorldMatrix(!1,!0)}}}toJSON(e){const t=e===void 0||typeof e=="string",n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});const r={};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.castShadow===!0&&(r.castShadow=!0),this.receiveShadow===!0&&(r.receiveShadow=!0),this.visible===!1&&(r.visible=!1),this.frustumCulled===!1&&(r.frustumCulled=!1),this.renderOrder!==0&&(r.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type="BatchedMesh",r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.visibility=this._visibility,r.active=this._active,r.bounds=this._bounds.map(o=>({boxInitialized:o.boxInitialized,boxMin:o.box.min.toArray(),boxMax:o.box.max.toArray(),sphereInitialized:o.sphereInitialized,sphereRadius:o.sphere.radius,sphereCenter:o.sphere.center.toArray()})),r.maxGeometryCount=this._maxGeometryCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.geometryCount=this._geometryCount,r.matricesTexture=this._matricesTexture.toJSON(e),this.boundingSphere!==null&&(r.boundingSphere={center:r.boundingSphere.center.toArray(),radius:r.boundingSphere.radius}),this.boundingBox!==null&&(r.boundingBox={min:r.boundingBox.min.toArray(),max:r.boundingBox.max.toArray()}));function s(o,l){return o[l.uuid]===void 0&&(o[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=s(e.geometries,this.geometry);const o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){const l=o.shapes;if(Array.isArray(l))for(let c=0,u=l.length;c<u;c++){const d=l[c];s(e.shapes,d)}else s(e.shapes,l)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const o=[];for(let l=0,c=this.material.length;l<c;l++)o.push(s(e.materials,this.material[l]));r.material=o}else r.material=s(e.materials,this.material);if(this.children.length>0){r.children=[];for(let o=0;o<this.children.length;o++)r.children.push(this.children[o].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let o=0;o<this.animations.length;o++){const l=this.animations[o];r.animations.push(s(e.animations,l))}}if(t){const o=a(e.geometries),l=a(e.materials),c=a(e.textures),u=a(e.images),d=a(e.shapes),h=a(e.skeletons),f=a(e.animations),g=a(e.nodes);o.length>0&&(n.geometries=o),l.length>0&&(n.materials=l),c.length>0&&(n.textures=c),u.length>0&&(n.images=u),d.length>0&&(n.shapes=d),h.length>0&&(n.skeletons=h),f.length>0&&(n.animations=f),g.length>0&&(n.nodes=g)}return n.object=r,n;function a(o){const l=[];for(const c in o){const u=o[c];delete u.metadata,l.push(u)}return l}}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.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,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.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n<e.children.length;n++){const r=e.children[n];this.add(r.clone())}return this}}St.DEFAULT_UP=new I(0,1,0);St.DEFAULT_MATRIX_AUTO_UPDATE=!0;St.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const Bt=new I,Kt=new I,us=new I,Zt=new I,Zn=new I,Jn=new I,_o=new I,hs=new I,ds=new I,fs=new I;let Ci=class oi{constructor(e=new I,t=new I,n=new I){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,r){r.subVectors(n,t),Bt.subVectors(e,t),r.cross(Bt);const s=r.lengthSq();return s>0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(e,t,n,r,s){Bt.subVectors(r,t),Kt.subVectors(n,t),us.subVectors(e,t);const a=Bt.dot(Bt),o=Bt.dot(Kt),l=Bt.dot(us),c=Kt.dot(Kt),u=Kt.dot(us),d=a*c-o*o;if(d===0)return s.set(0,0,0),null;const h=1/d,f=(c*l-o*u)*h,g=(a*u-o*l)*h;return s.set(1-f-g,g,f)}static containsPoint(e,t,n,r){return this.getBarycoord(e,t,n,r,Zt)===null?!1:Zt.x>=0&&Zt.y>=0&&Zt.x+Zt.y<=1}static getInterpolation(e,t,n,r,s,a,o,l){return this.getBarycoord(e,t,n,r,Zt)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(s,Zt.x),l.addScaledVector(a,Zt.y),l.addScaledVector(o,Zt.z),l)}static isFrontFacing(e,t,n,r){return Bt.subVectors(n,t),Kt.subVectors(e,t),Bt.cross(Kt).dot(r)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,n,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),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 Bt.subVectors(this.c,this.b),Kt.subVectors(this.a,this.b),Bt.cross(Kt).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return oi.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return oi.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,r,s){return oi.getInterpolation(e,this.a,this.b,this.c,t,n,r,s)}containsPoint(e){return oi.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return oi.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,r=this.b,s=this.c;let a,o;Zn.subVectors(r,n),Jn.subVectors(s,n),hs.subVectors(e,n);const l=Zn.dot(hs),c=Jn.dot(hs);if(l<=0&&c<=0)return t.copy(n);ds.subVectors(e,r);const u=Zn.dot(ds),d=Jn.dot(ds);if(u>=0&&d<=u)return t.copy(r);const h=l*d-u*c;if(h<=0&&l>=0&&u<=0)return a=l/(l-u),t.copy(n).addScaledVector(Zn,a);fs.subVectors(e,s);const f=Zn.dot(fs),g=Jn.dot(fs);if(g>=0&&f<=g)return t.copy(s);const _=f*c-l*g;if(_<=0&&c>=0&&g<=0)return o=c/(c-g),t.copy(n).addScaledVector(Jn,o);const m=u*g-f*d;if(m<=0&&d-u>=0&&f-g>=0)return _o.subVectors(s,r),o=(d-u)/(d-u+(f-g)),t.copy(r).addScaledVector(_o,o);const p=1/(m+_+h);return a=_*p,o=h*p,t.copy(n).addScaledVector(Zn,a).addScaledVector(Jn,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}};const Yl={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},cn={h:0,s:0,l:0},nr={h:0,s:0,l:0};function ps(i,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?i+(e-i)*6*t:t<1/2?e:t<2/3?i+(e-i)*6*(2/3-t):i}let be=class{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){const r=e;r&&r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&&this.setStyle(r)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=It){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Ye.toWorkingColorSpace(this,t),this}setRGB(e,t,n,r=Ye.workingColorSpace){return this.r=e,this.g=t,this.b=n,Ye.toWorkingColorSpace(this,r),this}setHSL(e,t,n,r=Ye.workingColorSpace){if(e=na(e,1),t=ht(t,0,1),n=ht(n,0,1),t===0)this.r=this.g=this.b=n;else{const s=n<=.5?n*(1+t):n+t-n*t,a=2*n-s;this.r=ps(a,s,e+1/3),this.g=ps(a,s,e),this.b=ps(a,s,e-1/3)}return Ye.toWorkingColorSpace(this,r),this}setStyle(e,t=It){function n(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const a=r[1],o=r[2];switch(a){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,t);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=r[1],a=s.length;if(a===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(a===6)return this.setHex(parseInt(s,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=It){const n=Yl[e.toLowerCase()];return n!==void 0?this.setHex(n,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=fi(e.r),this.g=fi(e.g),this.b=fi(e.b),this}copyLinearToSRGB(e){return this.r=ts(e.r),this.g=ts(e.g),this.b=ts(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=It){return Ye.fromWorkingColorSpace(gt.copy(this),e),Math.round(ht(gt.r*255,0,255))*65536+Math.round(ht(gt.g*255,0,255))*256+Math.round(ht(gt.b*255,0,255))}getHexString(e=It){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Ye.workingColorSpace){Ye.fromWorkingColorSpace(gt.copy(this),t);const n=gt.r,r=gt.g,s=gt.b,a=Math.max(n,r,s),o=Math.min(n,r,s);let l,c;const u=(o+a)/2;if(o===a)l=0,c=0;else{const d=a-o;switch(c=u<=.5?d/(a+o):d/(2-a-o),a){case n:l=(r-s)/d+(r<s?6:0);break;case r:l=(s-n)/d+2;break;case s:l=(n-r)/d+4;break}l/=6}return e.h=l,e.s=c,e.l=u,e}getRGB(e,t=Ye.workingColorSpace){return Ye.fromWorkingColorSpace(gt.copy(this),t),e.r=gt.r,e.g=gt.g,e.b=gt.b,e}getStyle(e=It){Ye.fromWorkingColorSpace(gt.copy(this),e);const t=gt.r,n=gt.g,r=gt.b;return e!==It?`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${r.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(n*255)},${Math.round(r*255)})`}offsetHSL(e,t,n){return this.getHSL(cn),this.setHSL(cn.h+e,cn.s+t,cn.l+n)}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,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(cn),e.getHSL(nr);const n=Pi(cn.h,nr.h,t),r=Pi(cn.s,nr.s,t),s=Pi(cn.l,nr.l,t);return this.setHSL(n,r,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,n=this.g,r=this.b,s=e.elements;return this.r=s[0]*t+s[3]*n+s[6]*r,this.g=s[1]*t+s[4]*n+s[7]*r,this.b=s[2]*t+s[5]*n+s[8]*r,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}};const gt=new be;be.NAMES=Yl;let zh=0;class vi extends Un{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:zh++}),this.uuid=xi(),this.name="",this.type="Material",this.blending=ci,this.side=_n,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=ks,this.blendDst=Vs,this.blendEquation=wn,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new be(0,0,0),this.blendAlpha=0,this.depthFunc=Ar,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=to,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Gn,this.stencilZFail=Gn,this.stencilZPass=Gn,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const n=e[t];if(n===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const n={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==ci&&(n.blending=this.blending),this.side!==_n&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==ks&&(n.blendSrc=this.blendSrc),this.blendDst!==Vs&&(n.blendDst=this.blendDst),this.blendEquation!==wn&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==Ar&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==to&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Gn&&(n.stencilFail=this.stencilFail),this.stencilZFail!==Gn&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==Gn&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function r(s){const a=[];for(const o in s){const l=s[o];delete l.metadata,a.push(l)}return a}if(t){const s=r(e.textures),a=r(e.images);s.length>0&&(n.textures=s),a.length>0&&(n.images=a)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let n=null;if(t!==null){const r=t.length;n=new Array(r);for(let s=0;s!==r;++s)n[s]=t[s].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}class Hi extends vi{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new be(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new In,this.combine=Ll,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const st=new I,ir=new ue;class Et{constructor(e,t,n=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=no,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=fn,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}get updateRange(){return Th("THREE.BufferAttribute: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let r=0,s=this.itemSize;r<s;r++)this.array[e+r]=t.array[n+r];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)ir.fromBufferAttribute(this,t),ir.applyMatrix3(e),this.setXY(t,ir.x,ir.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)st.fromBufferAttribute(this,t),st.applyMatrix3(e),this.setXYZ(t,st.x,st.y,st.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)st.fromBufferAttribute(this,t),st.applyMatrix4(e),this.setXYZ(t,st.x,st.y,st.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)st.fromBufferAttribute(this,t),st.applyNormalMatrix(e),this.setXYZ(t,st.x,st.y,st.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)st.fromBufferAttribute(this,t),st.transformDirection(e),this.setXYZ(t,st.x,st.y,st.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let n=this.array[e*this.itemSize+t];return this.normalized&&(n=ai(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=xt(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=ai(t,this.array)),t}setX(e,t){return this.normalized&&(t=xt(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=ai(t,this.array)),t}setY(e,t){return this.normalized&&(t=xt(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=ai(t,this.array)),t}setZ(e,t){return this.normalized&&(t=xt(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=ai(t,this.array)),t}setW(e,t){return this.normalized&&(t=xt(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=xt(t,this.array),n=xt(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,r){return e*=this.itemSize,this.normalized&&(t=xt(t,this.array),n=xt(n,this.array),r=xt(r,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this}setXYZW(e,t,n,r,s){return e*=this.itemSize,this.normalized&&(t=xt(t,this.array),n=xt(n,this.array),r=xt(r,this.array),s=xt(s,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this.array[e+3]=s,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==no&&(e.usage=this.usage),e}}class Kl extends Et{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class Zl extends Et{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class nt extends Et{constructor(e,t,n){super(new Float32Array(e),t,n)}}let kh=0;const Ft=new et,ms=new St,Qn=new I,Ct=new ki,wi=new ki,ut=new I;class _t extends Un{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:kh++}),this.uuid=xi(),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(Wl(e)?Zl:Kl)(e,1):this.index=e,this}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const n=this.attributes.normal;if(n!==void 0){const s=new Be().getNormalMatrix(e);n.applyNormalMatrix(s),n.needsUpdate=!0}const r=this.attributes.tangent;return r!==void 0&&(r.transformDirection(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return Ft.makeRotationFromQuaternion(e),this.applyMatrix4(Ft),this}rotateX(e){return Ft.makeRotationX(e),this.applyMatrix4(Ft),this}rotateY(e){return Ft.makeRotationY(e),this.applyMatrix4(Ft),this}rotateZ(e){return Ft.makeRotationZ(e),this.applyMatrix4(Ft),this}translate(e,t,n){return Ft.makeTranslation(e,t,n),this.applyMatrix4(Ft),this}scale(e,t,n){return Ft.makeScale(e,t,n),this.applyMatrix4(Ft),this}lookAt(e){return ms.lookAt(e),ms.updateMatrix(),this.applyMatrix4(ms.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Qn).negate(),this.translate(Qn.x,Qn.y,Qn.z),this}setFromPoints(e){const t=[];for(let n=0,r=e.length;n<r;n++){const s=e[n];t.push(s.x,s.y,s.z||0)}return this.setAttribute("position",new nt(t,3)),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new ki);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new I(-1/0,-1/0,-1/0),new I(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,r=t.length;n<r;n++){const s=t[n];Ct.setFromBufferAttribute(s),this.morphTargetsRelative?(ut.addVectors(this.boundingBox.min,Ct.min),this.boundingBox.expandByPoint(ut),ut.addVectors(this.boundingBox.max,Ct.max),this.boundingBox.expandByPoint(ut)):(this.boundingBox.expandByPoint(Ct.min),this.boundingBox.expandByPoint(Ct.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Vi);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new I,1/0);return}if(e){const n=this.boundingSphere.center;if(Ct.setFromBufferAttribute(e),t)for(let s=0,a=t.length;s<a;s++){const o=t[s];wi.setFromBufferAttribute(o),this.morphTargetsRelative?(ut.addVectors(Ct.min,wi.min),Ct.expandByPoint(ut),ut.addVectors(Ct.max,wi.max),Ct.expandByPoint(ut)):(Ct.expandByPoint(wi.min),Ct.expandByPoint(wi.max))}Ct.getCenter(n);let r=0;for(let s=0,a=e.count;s<a;s++)ut.fromBufferAttribute(e,s),r=Math.max(r,n.distanceToSquared(ut));if(t)for(let s=0,a=t.length;s<a;s++){const o=t[s],l=this.morphTargetsRelative;for(let c=0,u=o.count;c<u;c++)ut.fromBufferAttribute(o,c),l&&(Qn.fromBufferAttribute(e,c),ut.add(Qn)),r=Math.max(r,n.distanceToSquared(ut))}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(){const e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const n=t.position,r=t.normal,s=t.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new Et(new Float32Array(4*n.count),4));const a=this.getAttribute("tangent"),o=[],l=[];for(let P=0;P<n.count;P++)o[P]=new I,l[P]=new I;const c=new I,u=new I,d=new I,h=new ue,f=new ue,g=new ue,_=new I,m=new I;function p(P,S,M){c.fromBufferAttribute(n,P),u.fromBufferAttribute(n,S),d.fromBufferAttribute(n,M),h.fromBufferAttribute(s,P),f.fromBufferAttribute(s,S),g.fromBufferAttribute(s,M),u.sub(c),d.sub(c),f.sub(h),g.sub(h);const F=1/(f.x*g.y-g.x*f.y);isFinite(F)&&(_.copy(u).multiplyScalar(g.y).addScaledVector(d,-f.y).multiplyScalar(F),m.copy(d).multiplyScalar(f.x).addScaledVector(u,-g.x).multiplyScalar(F),o[P].add(_),o[S].add(_),o[M].add(_),l[P].add(m),l[S].add(m),l[M].add(m))}let E=this.groups;E.length===0&&(E=[{start:0,count:e.count}]);for(let P=0,S=E.length;P<S;++P){const M=E[P],F=M.start,L=M.count;for(let C=F,N=F+L;C<N;C+=3)p(e.getX(C+0),e.getX(C+1),e.getX(C+2))}const v=new I,b=new I,R=new I,T=new I;function A(P){R.fromBufferAttribute(r,P),T.copy(R);const S=o[P];v.copy(S),v.sub(R.multiplyScalar(R.dot(S))).normalize(),b.crossVectors(T,S);const F=b.dot(l[P])<0?-1:1;a.setXYZW(P,v.x,v.y,v.z,F)}for(let P=0,S=E.length;P<S;++P){const M=E[P],F=M.start,L=M.count;for(let C=F,N=F+L;C<N;C+=3)A(e.getX(C+0)),A(e.getX(C+1)),A(e.getX(C+2))}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let n=this.getAttribute("normal");if(n===void 0)n=new Et(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let h=0,f=n.count;h<f;h++)n.setXYZ(h,0,0,0);const r=new I,s=new I,a=new I,o=new I,l=new I,c=new I,u=new I,d=new I;if(e)for(let h=0,f=e.count;h<f;h+=3){const g=e.getX(h+0),_=e.getX(h+1),m=e.getX(h+2);r.fromBufferAttribute(t,g),s.fromBufferAttribute(t,_),a.fromBufferAttribute(t,m),u.subVectors(a,s),d.subVectors(r,s),u.cross(d),o.fromBufferAttribute(n,g),l.fromBufferAttribute(n,_),c.fromBufferAttribute(n,m),o.add(u),l.add(u),c.add(u),n.setXYZ(g,o.x,o.y,o.z),n.setXYZ(_,l.x,l.y,l.z),n.setXYZ(m,c.x,c.y,c.z)}else for(let h=0,f=t.count;h<f;h+=3)r.fromBufferAttribute(t,h+0),s.fromBufferAttribute(t,h+1),a.fromBufferAttribute(t,h+2),u.subVectors(a,s),d.subVectors(r,s),u.cross(d),n.setXYZ(h+0,u.x,u.y,u.z),n.setXYZ(h+1,u.x,u.y,u.z),n.setXYZ(h+2,u.x,u.y,u.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)ut.fromBufferAttribute(e,t),ut.normalize(),e.setXYZ(t,ut.x,ut.y,ut.z)}toNonIndexed(){function e(o,l){const c=o.array,u=o.itemSize,d=o.normalized,h=new c.constructor(l.length*u);let f=0,g=0;for(let _=0,m=l.length;_<m;_++){o.isInterleavedBufferAttribute?f=l[_]*o.data.stride+o.offset:f=l[_]*u;for(let p=0;p<u;p++)h[g++]=c[f++]}return new Et(h,u,d)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new _t,n=this.index.array,r=this.attributes;for(const o in r){const l=r[o],c=e(l,n);t.setAttribute(o,c)}const s=this.morphAttributes;for(const o in s){const l=[],c=s[o];for(let u=0,d=c.length;u<d;u++){const h=c[u],f=e(h,n);l.push(f)}t.morphAttributes[o]=l}t.morphTargetsRelative=this.morphTargetsRelative;const a=this.groups;for(let o=0,l=a.length;o<l;o++){const c=a[o];t.addGroup(c.start,c.count,c.materialIndex)}return t}toJSON(){const e={metadata:{version:4.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const l in n){const c=n[l];e.data.attributes[l]=c.toJSON(e.data)}const r={};let s=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],u=[];for(let d=0,h=c.length;d<h;d++){const f=c[d];u.push(f.toJSON(e.data))}u.length>0&&(r[l]=u,s=!0)}s&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));const o=this.boundingSphere;return o!==null&&(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;const t={};this.name=e.name;const n=e.index;n!==null&&this.setIndex(n.clone(t));const r=e.attributes;for(const c in r){const u=r[c];this.setAttribute(c,u.clone(t))}const s=e.morphAttributes;for(const c in s){const u=[],d=s[c];for(let h=0,f=d.length;h<f;h++)u.push(d[h].clone(t));this.morphAttributes[c]=u}this.morphTargetsRelative=e.morphTargetsRelative;const a=e.groups;for(let c=0,u=a.length;c<u;c++){const d=a[c];this.addGroup(d.start,d.count,d.materialIndex)}const o=e.boundingBox;o!==null&&(this.boundingBox=o.clone());const l=e.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const xo=new et,En=new Br,rr=new Vi,vo=new I,ei=new I,ti=new I,ni=new I,gs=new I,sr=new I,ar=new ue,or=new ue,lr=new ue,Mo=new I,yo=new I,So=new I,cr=new I,ur=new I;let bt=class extends St{constructor(e=new _t,t=new Hi){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){const o=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}getVertexPosition(e,t){const n=this.geometry,r=n.attributes.position,s=n.morphAttributes.position,a=n.morphTargetsRelative;t.fromBufferAttribute(r,e);const o=this.morphTargetInfluences;if(s&&o){sr.set(0,0,0);for(let l=0,c=s.length;l<c;l++){const u=o[l],d=s[l];u!==0&&(gs.fromBufferAttribute(d,e),a?sr.addScaledVector(gs,u):sr.addScaledVector(gs.sub(t),u))}t.add(sr)}return t}raycast(e,t){const n=this.geometry,r=this.material,s=this.matrixWorld;r!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),rr.copy(n.boundingSphere),rr.applyMatrix4(s),En.copy(e.ray).recast(e.near),!(rr.containsPoint(En.origin)===!1&&(En.intersectSphere(rr,vo)===null||En.origin.distanceToSquared(vo)>(e.far-e.near)**2))&&(xo.copy(s).invert(),En.copy(e.ray).applyMatrix4(xo),!(n.boundingBox!==null&&En.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,En)))}_computeIntersections(e,t,n){let r;const s=this.geometry,a=this.material,o=s.index,l=s.attributes.position,c=s.attributes.uv,u=s.attributes.uv1,d=s.attributes.normal,h=s.groups,f=s.drawRange;if(o!==null)if(Array.isArray(a))for(let g=0,_=h.length;g<_;g++){const m=h[g],p=a[m.materialIndex],E=Math.max(m.start,f.start),v=Math.min(o.count,Math.min(m.start+m.count,f.start+f.count));for(let b=E,R=v;b<R;b+=3){const T=o.getX(b),A=o.getX(b+1),P=o.getX(b+2);r=hr(this,p,e,n,c,u,d,T,A,P),r&&(r.faceIndex=Math.floor(b/3),r.face.materialIndex=m.materialIndex,t.push(r))}}else{const g=Math.max(0,f.start),_=Math.min(o.count,f.start+f.count);for(let m=g,p=_;m<p;m+=3){const E=o.getX(m),v=o.getX(m+1),b=o.getX(m+2);r=hr(this,a,e,n,c,u,d,E,v,b),r&&(r.faceIndex=Math.floor(m/3),t.push(r))}}else if(l!==void 0)if(Array.isArray(a))for(let g=0,_=h.length;g<_;g++){const m=h[g],p=a[m.materialIndex],E=Math.max(m.start,f.start),v=Math.min(l.count,Math.min(m.start+m.count,f.start+f.count));for(let b=E,R=v;b<R;b+=3){const T=b,A=b+1,P=b+2;r=hr(this,p,e,n,c,u,d,T,A,P),r&&(r.faceIndex=Math.floor(b/3),r.face.materialIndex=m.materialIndex,t.push(r))}}else{const g=Math.max(0,f.start),_=Math.min(l.count,f.start+f.count);for(let m=g,p=_;m<p;m+=3){const E=m,v=m+1,b=m+2;r=hr(this,a,e,n,c,u,d,E,v,b),r&&(r.faceIndex=Math.floor(m/3),t.push(r))}}}};function Vh(i,e,t,n,r,s,a,o){let l;if(e.side===yt?l=n.intersectTriangle(a,s,r,!0,o):l=n.intersectTriangle(r,s,a,e.side===_n,o),l===null)return null;ur.copy(o),ur.applyMatrix4(i.matrixWorld);const c=t.ray.origin.distanceTo(ur);return c<t.near||c>t.far?null:{distance:c,point:ur.clone(),object:i}}function hr(i,e,t,n,r,s,a,o,l,c){i.getVertexPosition(o,ei),i.getVertexPosition(l,ti),i.getVertexPosition(c,ni);const u=Vh(i,e,t,n,ei,ti,ni,cr);if(u){r&&(ar.fromBufferAttribute(r,o),or.fromBufferAttribute(r,l),lr.fromBufferAttribute(r,c),u.uv=Ci.getInterpolation(cr,ei,ti,ni,ar,or,lr,new ue)),s&&(ar.fromBufferAttribute(s,o),or.fromBufferAttribute(s,l),lr.fromBufferAttribute(s,c),u.uv1=Ci.getInterpolation(cr,ei,ti,ni,ar,or,lr,new ue)),a&&(Mo.fromBufferAttribute(a,o),yo.fromBufferAttribute(a,l),So.fromBufferAttribute(a,c),u.normal=Ci.getInterpolation(cr,ei,ti,ni,Mo,yo,So,new I),u.normal.dot(n.direction)>0&&u.normal.multiplyScalar(-1));const d={a:o,b:l,c,normal:new I,materialIndex:0};Ci.getNormal(ei,ti,ni,d.normal),u.face=d}return u}class Gi extends _t{constructor(e=1,t=1,n=1,r=1,s=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:s,depthSegments:a};const o=this;r=Math.floor(r),s=Math.floor(s),a=Math.floor(a);const l=[],c=[],u=[],d=[];let h=0,f=0;g("z","y","x",-1,-1,n,t,e,a,s,0),g("z","y","x",1,-1,n,t,-e,a,s,1),g("x","z","y",1,1,e,n,t,r,a,2),g("x","z","y",1,-1,e,n,-t,r,a,3),g("x","y","z",1,-1,e,t,n,r,s,4),g("x","y","z",-1,-1,e,t,-n,r,s,5),this.setIndex(l),this.setAttribute("position",new nt(c,3)),this.setAttribute("normal",new nt(u,3)),this.setAttribute("uv",new nt(d,2));function g(_,m,p,E,v,b,R,T,A,P,S){const M=b/A,F=R/P,L=b/2,C=R/2,N=T/2,V=A+1,j=P+1;let J=0,z=0;const Y=new I;for(let $=0;$<j;$++){const U=$*F-C;for(let ee=0;ee<V;ee++){const me=ee*M-L;Y[_]=me*E,Y[m]=U*v,Y[p]=N,c.push(Y.x,Y.y,Y.z),Y[_]=0,Y[m]=0,Y[p]=T>0?1:-1,u.push(Y.x,Y.y,Y.z),d.push(ee/A),d.push(1-$/P),J+=1}}for(let $=0;$<P;$++)for(let U=0;U<A;U++){const ee=h+U+V*$,me=h+U+V*($+1),O=h+(U+1)+V*($+1),Q=h+(U+1)+V*$;l.push(ee,me,Q),l.push(me,O,Q),z+=6}o.addGroup(f,z,S),f+=z,h+=J}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Gi(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function _i(i){const e={};for(const t in i){e[t]={};for(const n in i[t]){const r=i[t][n];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?r.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][n]=null):e[t][n]=r.clone():Array.isArray(r)?e[t][n]=r.slice():e[t][n]=r}}return e}function vt(i){const e={};for(let t=0;t<i.length;t++){const n=_i(i[t]);for(const r in n)e[r]=n[r]}return e}function Hh(i){const e=[];for(let t=0;t<i.length;t++)e.push(i[t].clone());return e}function Jl(i){const e=i.getRenderTarget();return e===null?i.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:Ye.workingColorSpace}const Fr={clone:_i,merge:vt};var Gh=`void main() {
9
9
  gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
10
10
  }`,Wh=`void main() {
11
11
  gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
12
- }`;class ft extends vi{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=Gh,this.fragmentShader=Wh,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=_i(e.uniforms),this.uniformsGroups=Vh(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){const t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const r in this.uniforms){const a=this.uniforms[r].value;a&&a.isTexture?t.uniforms[r]={type:"t",value:a.toJSON(e).uuid}:a&&a.isColor?t.uniforms[r]={type:"c",value:a.getHex()}:a&&a.isVector2?t.uniforms[r]={type:"v2",value:a.toArray()}:a&&a.isVector3?t.uniforms[r]={type:"v3",value:a.toArray()}:a&&a.isVector4?t.uniforms[r]={type:"v4",value:a.toArray()}:a&&a.isMatrix3?t.uniforms[r]={type:"m3",value:a.toArray()}:a&&a.isMatrix4?t.uniforms[r]={type:"m4",value:a.toArray()}:t.uniforms[r]={value:a}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const n={};for(const r in this.extensions)this.extensions[r]===!0&&(n[r]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}class Ql extends yt{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new et,this.projectionMatrix=new et,this.projectionMatrixInverse=new et,this.coordinateSystem=Qt}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.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)}}const un=new I,Eo=new ue,bo=new ue;class Rt extends Ql{constructor(e=50,t=1,n=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=r,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=Oi*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(di*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Oi*2*Math.atan(Math.tan(di*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,n){un.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(un.x,un.y).multiplyScalar(-e/un.z),un.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(un.x,un.y).multiplyScalar(-e/un.z)}getViewSize(e,t){return this.getViewBounds(e,Eo,bo),t.subVectors(bo,Eo)}setViewOffset(e,t,n,r,s,a){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(di*.5*this.fov)/this.zoom,n=2*t,r=this.aspect*n,s=-.5*r;const a=this.view;if(this.view!==null&&this.view.enabled){const l=a.fullWidth,c=a.fullHeight;s+=a.offsetX*r/l,t-=a.offsetY*n/c,r*=a.width/l,n*=a.height/c}const o=this.filmOffset;o!==0&&(s+=e*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+r,t,t-n,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}const ii=-90,ri=1;class Xh extends yt{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const r=new Rt(ii,ri,e,t);r.layers=this.layers,this.add(r);const s=new Rt(ii,ri,e,t);s.layers=this.layers,this.add(s);const a=new Rt(ii,ri,e,t);a.layers=this.layers,this.add(a);const o=new Rt(ii,ri,e,t);o.layers=this.layers,this.add(o);const l=new Rt(ii,ri,e,t);l.layers=this.layers,this.add(l);const c=new Rt(ii,ri,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[n,r,s,a,o,l]=t;for(const c of t)this.remove(c);if(e===Qt)n.up.set(0,1,0),n.lookAt(1,0,0),r.up.set(0,1,0),r.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),a.up.set(0,0,1),a.lookAt(0,-1,0),o.up.set(0,1,0),o.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===Pr)n.up.set(0,-1,0),n.lookAt(-1,0,0),r.up.set(0,-1,0),r.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),a.up.set(0,0,-1),a.lookAt(0,-1,0),o.up.set(0,-1,0),o.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const c of t)this.add(c),c.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:n,activeMipmapLevel:r}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[s,a,o,l,c,u]=this.children,d=e.getRenderTarget(),h=e.getActiveCubeFace(),f=e.getActiveMipmapLevel(),g=e.xr.enabled;e.xr.enabled=!1;const _=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0,r),e.render(t,s),e.setRenderTarget(n,1,r),e.render(t,a),e.setRenderTarget(n,2,r),e.render(t,o),e.setRenderTarget(n,3,r),e.render(t,l),e.setRenderTarget(n,4,r),e.render(t,c),n.texture.generateMipmaps=_,e.setRenderTarget(n,5,r),e.render(t,u),e.setRenderTarget(d,h,f),e.xr.enabled=g,n.texture.needsPMREMUpdate=!0}}class ec extends Tt{constructor(e,t,n,r,s,a,o,l,c,u){e=e!==void 0?e:[],t=t!==void 0?t:pi,super(e,t,n,r,s,a,o,l,c,u),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class qh extends Ht{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1},r=[n,n,n,n,n,n];this.texture=new ec(r,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=t.generateMipmaps!==void 0?t.generateMipmaps:!1,this.texture.minFilter=t.minFilter!==void 0?t.minFilter:zt}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:`
12
+ }`;class ft extends vi{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=Gh,this.fragmentShader=Wh,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=_i(e.uniforms),this.uniformsGroups=Hh(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){const t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const r in this.uniforms){const a=this.uniforms[r].value;a&&a.isTexture?t.uniforms[r]={type:"t",value:a.toJSON(e).uuid}:a&&a.isColor?t.uniforms[r]={type:"c",value:a.getHex()}:a&&a.isVector2?t.uniforms[r]={type:"v2",value:a.toArray()}:a&&a.isVector3?t.uniforms[r]={type:"v3",value:a.toArray()}:a&&a.isVector4?t.uniforms[r]={type:"v4",value:a.toArray()}:a&&a.isMatrix3?t.uniforms[r]={type:"m3",value:a.toArray()}:a&&a.isMatrix4?t.uniforms[r]={type:"m4",value:a.toArray()}:t.uniforms[r]={value:a}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const n={};for(const r in this.extensions)this.extensions[r]===!0&&(n[r]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}class Ql extends St{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new et,this.projectionMatrix=new et,this.projectionMatrixInverse=new et,this.coordinateSystem=Qt}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.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)}}const un=new I,Eo=new ue,bo=new ue;class Rt extends Ql{constructor(e=50,t=1,n=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=r,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=Oi*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(di*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Oi*2*Math.atan(Math.tan(di*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,n){un.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(un.x,un.y).multiplyScalar(-e/un.z),un.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(un.x,un.y).multiplyScalar(-e/un.z)}getViewSize(e,t){return this.getViewBounds(e,Eo,bo),t.subVectors(bo,Eo)}setViewOffset(e,t,n,r,s,a){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(di*.5*this.fov)/this.zoom,n=2*t,r=this.aspect*n,s=-.5*r;const a=this.view;if(this.view!==null&&this.view.enabled){const l=a.fullWidth,c=a.fullHeight;s+=a.offsetX*r/l,t-=a.offsetY*n/c,r*=a.width/l,n*=a.height/c}const o=this.filmOffset;o!==0&&(s+=e*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+r,t,t-n,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}const ii=-90,ri=1;class Xh extends St{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const r=new Rt(ii,ri,e,t);r.layers=this.layers,this.add(r);const s=new Rt(ii,ri,e,t);s.layers=this.layers,this.add(s);const a=new Rt(ii,ri,e,t);a.layers=this.layers,this.add(a);const o=new Rt(ii,ri,e,t);o.layers=this.layers,this.add(o);const l=new Rt(ii,ri,e,t);l.layers=this.layers,this.add(l);const c=new Rt(ii,ri,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[n,r,s,a,o,l]=t;for(const c of t)this.remove(c);if(e===Qt)n.up.set(0,1,0),n.lookAt(1,0,0),r.up.set(0,1,0),r.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),a.up.set(0,0,1),a.lookAt(0,-1,0),o.up.set(0,1,0),o.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===Pr)n.up.set(0,-1,0),n.lookAt(-1,0,0),r.up.set(0,-1,0),r.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),a.up.set(0,0,-1),a.lookAt(0,-1,0),o.up.set(0,-1,0),o.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const c of t)this.add(c),c.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:n,activeMipmapLevel:r}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[s,a,o,l,c,u]=this.children,d=e.getRenderTarget(),h=e.getActiveCubeFace(),f=e.getActiveMipmapLevel(),g=e.xr.enabled;e.xr.enabled=!1;const _=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0,r),e.render(t,s),e.setRenderTarget(n,1,r),e.render(t,a),e.setRenderTarget(n,2,r),e.render(t,o),e.setRenderTarget(n,3,r),e.render(t,l),e.setRenderTarget(n,4,r),e.render(t,c),n.texture.generateMipmaps=_,e.setRenderTarget(n,5,r),e.render(t,u),e.setRenderTarget(d,h,f),e.xr.enabled=g,n.texture.needsPMREMUpdate=!0}}class ec extends Tt{constructor(e,t,n,r,s,a,o,l,c,u){e=e!==void 0?e:[],t=t!==void 0?t:pi,super(e,t,n,r,s,a,o,l,c,u),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class qh extends Vt{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1},r=[n,n,n,n,n,n];this.texture=new ec(r,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=t.generateMipmaps!==void 0?t.generateMipmaps:!1,this.texture.minFilter=t.minFilter!==void 0?t.minFilter:zt}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:`
13
13
 
14
14
  varying vec3 vWorldDirection;
15
15
 
@@ -44,7 +44,7 @@ React keys must be passed directly to JSX without using spread:
44
44
  gl_FragColor = texture2D( tEquirect, sampleUV );
45
45
 
46
46
  }
47
- `},r=new Gi(5,5,5),s=new ft({name:"CubemapFromEquirect",uniforms:_i(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:St,blending:en});s.uniforms.tEquirect.value=t;const a=new bt(r,s),o=t.minFilter;return t.minFilter===Ln&&(t.minFilter=zt),new Xh(1,10,this).update(e,a),t.minFilter=o,a.geometry.dispose(),a.material.dispose(),this}clear(e,t,n,r){const s=e.getRenderTarget();for(let a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(t,n,r);e.setRenderTarget(s)}}const gs=new I,Yh=new I,$h=new Be;class hn{constructor(e=new I(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,n,r){return this.normal.set(e,t,n),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){const r=gs.subVectors(n,t).cross(Yh.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){const n=e.delta(gs),r=this.normal.dot(n);if(r===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const s=-(e.start.dot(this.normal)+this.constant)/r;return s<0||s>1?null:t.copy(e.start).addScaledVector(n,s)}intersectsLine(e){const t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<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){const n=t||$h.getNormalMatrix(e),r=this.coplanarPoint(gs).applyMatrix4(e),s=this.normal.applyMatrix3(n).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)}}const bn=new Hi,dr=new I;class tc{constructor(e=new hn,t=new hn,n=new hn,r=new hn,s=new hn,a=new hn){this.planes=[e,t,n,r,s,a]}set(e,t,n,r,s,a){const o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(r),o[4].copy(s),o[5].copy(a),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=Qt){const n=this.planes,r=e.elements,s=r[0],a=r[1],o=r[2],l=r[3],c=r[4],u=r[5],d=r[6],h=r[7],f=r[8],g=r[9],_=r[10],m=r[11],p=r[12],E=r[13],v=r[14],b=r[15];if(n[0].setComponents(l-s,h-c,m-f,b-p).normalize(),n[1].setComponents(l+s,h+c,m+f,b+p).normalize(),n[2].setComponents(l+a,h+u,m+g,b+E).normalize(),n[3].setComponents(l-a,h-u,m-g,b-E).normalize(),n[4].setComponents(l-o,h-d,m-_,b-v).normalize(),t===Qt)n[5].setComponents(l+o,h+d,m+_,b+v).normalize();else if(t===Pr)n[5].setComponents(o,d,_,v).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),bn.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),bn.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(bn)}intersectsSprite(e){return bn.center.set(0,0,0),bn.radius=.7071067811865476,bn.applyMatrix4(e.matrixWorld),this.intersectsSphere(bn)}intersectsSphere(e){const t=this.planes,n=e.center,r=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(n)<r)return!1;return!0}intersectsBox(e){const t=this.planes;for(let n=0;n<6;n++){const r=t[n];if(dr.x=r.normal.x>0?e.max.x:e.min.x,dr.y=r.normal.y>0?e.max.y:e.min.y,dr.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(dr)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}function nc(){let i=null,e=!1,t=null,n=null;function r(s,a){t(s,a),n=i.requestAnimationFrame(r)}return{start:function(){e!==!0&&t!==null&&(n=i.requestAnimationFrame(r),e=!0)},stop:function(){i.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){i=s}}}function jh(i){const e=new WeakMap;function t(o,l){const c=o.array,u=o.usage,d=c.byteLength,h=i.createBuffer();i.bindBuffer(l,h),i.bufferData(l,c,u),o.onUploadCallback();let f;if(c instanceof Float32Array)f=i.FLOAT;else if(c instanceof Uint16Array)o.isFloat16BufferAttribute?f=i.HALF_FLOAT:f=i.UNSIGNED_SHORT;else if(c instanceof Int16Array)f=i.SHORT;else if(c instanceof Uint32Array)f=i.UNSIGNED_INT;else if(c instanceof Int32Array)f=i.INT;else if(c instanceof Int8Array)f=i.BYTE;else if(c instanceof Uint8Array)f=i.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)f=i.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:h,type:f,bytesPerElement:c.BYTES_PER_ELEMENT,version:o.version,size:d}}function n(o,l,c){const u=l.array,d=l._updateRange,h=l.updateRanges;if(i.bindBuffer(c,o),d.count===-1&&h.length===0&&i.bufferSubData(c,0,u),h.length!==0){for(let f=0,g=h.length;f<g;f++){const _=h[f];i.bufferSubData(c,_.start*u.BYTES_PER_ELEMENT,u,_.start,_.count)}l.clearUpdateRanges()}d.count!==-1&&(i.bufferSubData(c,d.offset*u.BYTES_PER_ELEMENT,u,d.offset,d.count),d.count=-1),l.onUploadCallback()}function r(o){return o.isInterleavedBufferAttribute&&(o=o.data),e.get(o)}function s(o){o.isInterleavedBufferAttribute&&(o=o.data);const l=e.get(o);l&&(i.deleteBuffer(l.buffer),e.delete(o))}function a(o,l){if(o.isGLBufferAttribute){const u=e.get(o);(!u||u.version<o.version)&&e.set(o,{buffer:o.buffer,type:o.type,bytesPerElement:o.elementSize,version:o.version});return}o.isInterleavedBufferAttribute&&(o=o.data);const c=e.get(o);if(c===void 0)e.set(o,t(o,l));else if(c.version<o.version){if(c.size!==o.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");n(c.buffer,o,l),c.version=o.version}}return{get:r,remove:s,update:a}}class zr extends _t{constructor(e=1,t=1,n=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:r};const s=e/2,a=t/2,o=Math.floor(n),l=Math.floor(r),c=o+1,u=l+1,d=e/o,h=t/l,f=[],g=[],_=[],m=[];for(let p=0;p<u;p++){const E=p*h-a;for(let v=0;v<c;v++){const b=v*d-s;g.push(b,-E,0),_.push(0,0,1),m.push(v/o),m.push(1-p/l)}}for(let p=0;p<l;p++)for(let E=0;E<o;E++){const v=E+c*p,b=E+c*(p+1),R=E+1+c*(p+1),T=E+1+c*p;f.push(v,b,T),f.push(b,R,T)}this.setIndex(f),this.setAttribute("position",new nt(g,3)),this.setAttribute("normal",new nt(_,3)),this.setAttribute("uv",new nt(m,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new zr(e.width,e.height,e.widthSegments,e.heightSegments)}}var Kh=`#ifdef USE_ALPHAHASH
47
+ `},r=new Gi(5,5,5),s=new ft({name:"CubemapFromEquirect",uniforms:_i(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:yt,blending:en});s.uniforms.tEquirect.value=t;const a=new bt(r,s),o=t.minFilter;return t.minFilter===Ln&&(t.minFilter=zt),new Xh(1,10,this).update(e,a),t.minFilter=o,a.geometry.dispose(),a.material.dispose(),this}clear(e,t,n,r){const s=e.getRenderTarget();for(let a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(t,n,r);e.setRenderTarget(s)}}const _s=new I,jh=new I,$h=new Be;class hn{constructor(e=new I(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,n,r){return this.normal.set(e,t,n),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){const r=_s.subVectors(n,t).cross(jh.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){const n=e.delta(_s),r=this.normal.dot(n);if(r===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const s=-(e.start.dot(this.normal)+this.constant)/r;return s<0||s>1?null:t.copy(e.start).addScaledVector(n,s)}intersectsLine(e){const t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<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){const n=t||$h.getNormalMatrix(e),r=this.coplanarPoint(_s).applyMatrix4(e),s=this.normal.applyMatrix3(n).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)}}const bn=new Vi,dr=new I;class tc{constructor(e=new hn,t=new hn,n=new hn,r=new hn,s=new hn,a=new hn){this.planes=[e,t,n,r,s,a]}set(e,t,n,r,s,a){const o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(r),o[4].copy(s),o[5].copy(a),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=Qt){const n=this.planes,r=e.elements,s=r[0],a=r[1],o=r[2],l=r[3],c=r[4],u=r[5],d=r[6],h=r[7],f=r[8],g=r[9],_=r[10],m=r[11],p=r[12],E=r[13],v=r[14],b=r[15];if(n[0].setComponents(l-s,h-c,m-f,b-p).normalize(),n[1].setComponents(l+s,h+c,m+f,b+p).normalize(),n[2].setComponents(l+a,h+u,m+g,b+E).normalize(),n[3].setComponents(l-a,h-u,m-g,b-E).normalize(),n[4].setComponents(l-o,h-d,m-_,b-v).normalize(),t===Qt)n[5].setComponents(l+o,h+d,m+_,b+v).normalize();else if(t===Pr)n[5].setComponents(o,d,_,v).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),bn.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),bn.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(bn)}intersectsSprite(e){return bn.center.set(0,0,0),bn.radius=.7071067811865476,bn.applyMatrix4(e.matrixWorld),this.intersectsSphere(bn)}intersectsSphere(e){const t=this.planes,n=e.center,r=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(n)<r)return!1;return!0}intersectsBox(e){const t=this.planes;for(let n=0;n<6;n++){const r=t[n];if(dr.x=r.normal.x>0?e.max.x:e.min.x,dr.y=r.normal.y>0?e.max.y:e.min.y,dr.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(dr)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}function nc(){let i=null,e=!1,t=null,n=null;function r(s,a){t(s,a),n=i.requestAnimationFrame(r)}return{start:function(){e!==!0&&t!==null&&(n=i.requestAnimationFrame(r),e=!0)},stop:function(){i.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){i=s}}}function Yh(i){const e=new WeakMap;function t(o,l){const c=o.array,u=o.usage,d=c.byteLength,h=i.createBuffer();i.bindBuffer(l,h),i.bufferData(l,c,u),o.onUploadCallback();let f;if(c instanceof Float32Array)f=i.FLOAT;else if(c instanceof Uint16Array)o.isFloat16BufferAttribute?f=i.HALF_FLOAT:f=i.UNSIGNED_SHORT;else if(c instanceof Int16Array)f=i.SHORT;else if(c instanceof Uint32Array)f=i.UNSIGNED_INT;else if(c instanceof Int32Array)f=i.INT;else if(c instanceof Int8Array)f=i.BYTE;else if(c instanceof Uint8Array)f=i.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)f=i.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:h,type:f,bytesPerElement:c.BYTES_PER_ELEMENT,version:o.version,size:d}}function n(o,l,c){const u=l.array,d=l._updateRange,h=l.updateRanges;if(i.bindBuffer(c,o),d.count===-1&&h.length===0&&i.bufferSubData(c,0,u),h.length!==0){for(let f=0,g=h.length;f<g;f++){const _=h[f];i.bufferSubData(c,_.start*u.BYTES_PER_ELEMENT,u,_.start,_.count)}l.clearUpdateRanges()}d.count!==-1&&(i.bufferSubData(c,d.offset*u.BYTES_PER_ELEMENT,u,d.offset,d.count),d.count=-1),l.onUploadCallback()}function r(o){return o.isInterleavedBufferAttribute&&(o=o.data),e.get(o)}function s(o){o.isInterleavedBufferAttribute&&(o=o.data);const l=e.get(o);l&&(i.deleteBuffer(l.buffer),e.delete(o))}function a(o,l){if(o.isGLBufferAttribute){const u=e.get(o);(!u||u.version<o.version)&&e.set(o,{buffer:o.buffer,type:o.type,bytesPerElement:o.elementSize,version:o.version});return}o.isInterleavedBufferAttribute&&(o=o.data);const c=e.get(o);if(c===void 0)e.set(o,t(o,l));else if(c.version<o.version){if(c.size!==o.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");n(c.buffer,o,l),c.version=o.version}}return{get:r,remove:s,update:a}}class zr extends _t{constructor(e=1,t=1,n=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:r};const s=e/2,a=t/2,o=Math.floor(n),l=Math.floor(r),c=o+1,u=l+1,d=e/o,h=t/l,f=[],g=[],_=[],m=[];for(let p=0;p<u;p++){const E=p*h-a;for(let v=0;v<c;v++){const b=v*d-s;g.push(b,-E,0),_.push(0,0,1),m.push(v/o),m.push(1-p/l)}}for(let p=0;p<l;p++)for(let E=0;E<o;E++){const v=E+c*p,b=E+c*(p+1),R=E+1+c*(p+1),T=E+1+c*p;f.push(v,b,T),f.push(b,R,T)}this.setIndex(f),this.setAttribute("position",new nt(g,3)),this.setAttribute("normal",new nt(_,3)),this.setAttribute("uv",new nt(m,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new zr(e.width,e.height,e.widthSegments,e.heightSegments)}}var Kh=`#ifdef USE_ALPHAHASH
48
48
  if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
49
49
  #endif`,Zh=`#ifdef USE_ALPHAHASH
50
50
  const float ALPHA_HASH_SCALE = 0.05;
@@ -476,7 +476,7 @@ float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
476
476
  return vec4( mix( color0, color1, mipF ), 1.0 );
477
477
  }
478
478
  }
479
- #endif`,Sd=`vec3 transformedNormal = objectNormal;
479
+ #endif`,yd=`vec3 transformedNormal = objectNormal;
480
480
  #ifdef USE_TANGENT
481
481
  vec3 transformedTangent = objectTangent;
482
482
  #endif
@@ -505,7 +505,7 @@ transformedNormal = normalMatrix * transformedNormal;
505
505
  #ifdef FLIP_SIDED
506
506
  transformedTangent = - transformedTangent;
507
507
  #endif
508
- #endif`,yd=`#ifdef USE_DISPLACEMENTMAP
508
+ #endif`,Sd=`#ifdef USE_DISPLACEMENTMAP
509
509
  uniform sampler2D displacementMap;
510
510
  uniform float displacementScale;
511
511
  uniform float displacementBias;
@@ -626,14 +626,14 @@ vec4 LinearTosRGB( in vec4 value ) {
626
626
  vFogDepth = - mvPosition.z;
627
627
  #endif`,Id=`#ifdef USE_FOG
628
628
  varying float vFogDepth;
629
- #endif`,Ud=`#ifdef USE_FOG
629
+ #endif`,Nd=`#ifdef USE_FOG
630
630
  #ifdef FOG_EXP2
631
631
  float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
632
632
  #else
633
633
  float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
634
634
  #endif
635
635
  gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
636
- #endif`,Nd=`#ifdef USE_FOG
636
+ #endif`,Ud=`#ifdef USE_FOG
637
637
  uniform vec3 fogColor;
638
638
  varying float vFogDepth;
639
639
  #ifdef FOG_EXP2
@@ -663,7 +663,7 @@ vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
663
663
  uniform float lightMapIntensity;
664
664
  #endif`,kd=`LambertMaterial material;
665
665
  material.diffuseColor = diffuseColor.rgb;
666
- material.specularStrength = specularStrength;`,Hd=`varying vec3 vViewPosition;
666
+ material.specularStrength = specularStrength;`,Vd=`varying vec3 vViewPosition;
667
667
  struct LambertMaterial {
668
668
  vec3 diffuseColor;
669
669
  float specularStrength;
@@ -677,7 +677,7 @@ void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometr
677
677
  reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
678
678
  }
679
679
  #define RE_Direct RE_Direct_Lambert
680
- #define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,Vd=`uniform bool receiveShadow;
680
+ #define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,Hd=`uniform bool receiveShadow;
681
681
  uniform vec3 ambientLightColor;
682
682
  #if defined( USE_LIGHT_PROBES )
683
683
  uniform vec3 lightProbe[ 9 ];
@@ -850,7 +850,7 @@ void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPo
850
850
  material.diffuseColor = diffuseColor.rgb;
851
851
  material.specularColor = specular;
852
852
  material.specularShininess = shininess;
853
- material.specularStrength = specularStrength;`,Yd=`varying vec3 vViewPosition;
853
+ material.specularStrength = specularStrength;`,jd=`varying vec3 vViewPosition;
854
854
  struct BlinnPhongMaterial {
855
855
  vec3 diffuseColor;
856
856
  vec3 specularColor;
@@ -950,7 +950,7 @@ material.roughness = min( material.roughness, 1.0 );
950
950
  material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
951
951
  material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;
952
952
  material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;
953
- #endif`,jd=`struct PhysicalMaterial {
953
+ #endif`,Yd=`struct PhysicalMaterial {
954
954
  vec3 diffuseColor;
955
955
  float roughness;
956
956
  vec3 specularColor;
@@ -1605,9 +1605,9 @@ vec3 nonPerturbedNormal = normal;`,gf=`#ifdef USE_NORMALMAP_OBJECTSPACE
1605
1605
  float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );
1606
1606
  return mat3( T * scale, B * scale, N );
1607
1607
  }
1608
- #endif`,Sf=`#ifdef USE_CLEARCOAT
1608
+ #endif`,yf=`#ifdef USE_CLEARCOAT
1609
1609
  vec3 clearcoatNormal = nonPerturbedNormal;
1610
- #endif`,yf=`#ifdef USE_CLEARCOAT_NORMALMAP
1610
+ #endif`,Sf=`#ifdef USE_CLEARCOAT_NORMALMAP
1611
1611
  vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
1612
1612
  clearcoatMapN.xy *= clearcoatNormalScale;
1613
1613
  clearcoatNormal = normalize( tbn2 * clearcoatMapN );
@@ -1918,7 +1918,7 @@ gl_Position = projectionMatrix * mvPosition;`,Cf=`#ifdef DITHERING
1918
1918
  };
1919
1919
  uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
1920
1920
  #endif
1921
- #endif`,Uf=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
1921
+ #endif`,Nf=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
1922
1922
  vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
1923
1923
  vec4 shadowWorldPosition;
1924
1924
  #endif
@@ -1950,7 +1950,7 @@ gl_Position = projectionMatrix * mvPosition;`,Cf=`#ifdef DITHERING
1950
1950
  vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
1951
1951
  }
1952
1952
  #pragma unroll_loop_end
1953
- #endif`,Nf=`float getShadowMask() {
1953
+ #endif`,Uf=`float getShadowMask() {
1954
1954
  float shadow = 1.0;
1955
1955
  #ifdef USE_SHADOWMAP
1956
1956
  #if NUM_DIR_LIGHT_SHADOWS > 0
@@ -2021,13 +2021,13 @@ gl_Position = projectionMatrix * mvPosition;`,Cf=`#ifdef DITHERING
2021
2021
  #ifdef USE_TANGENT
2022
2022
  objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
2023
2023
  #endif
2024
- #endif`,Hf=`float specularStrength;
2024
+ #endif`,Vf=`float specularStrength;
2025
2025
  #ifdef USE_SPECULARMAP
2026
2026
  vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
2027
2027
  specularStrength = texelSpecular.r;
2028
2028
  #else
2029
2029
  specularStrength = 1.0;
2030
- #endif`,Vf=`#ifdef USE_SPECULARMAP
2030
+ #endif`,Hf=`#ifdef USE_SPECULARMAP
2031
2031
  uniform sampler2D specularMap;
2032
2032
  #endif`,Gf=`#if defined( TONE_MAPPING )
2033
2033
  gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
@@ -2255,7 +2255,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,Xf=`#ifdef USE_TRANSMISS
2255
2255
  float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;
2256
2256
  return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );
2257
2257
  }
2258
- #endif`,Yf=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2258
+ #endif`,jf=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2259
2259
  varying vec2 vUv;
2260
2260
  #endif
2261
2261
  #ifdef USE_MAP
@@ -2419,7 +2419,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,Xf=`#ifdef USE_TRANSMISS
2419
2419
  #ifdef USE_THICKNESSMAP
2420
2420
  uniform mat3 thicknessMapTransform;
2421
2421
  varying vec2 vThicknessMapUv;
2422
- #endif`,jf=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2422
+ #endif`,Yf=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2423
2423
  vUv = vec3( uv, 1 ).xy;
2424
2424
  #endif
2425
2425
  #ifdef USE_MAP
@@ -3145,7 +3145,7 @@ void main() {
3145
3145
  #include <fog_fragment>
3146
3146
  #include <premultiplied_alpha_fragment>
3147
3147
  #include <dithering_fragment>
3148
- }`,Sp=`#define STANDARD
3148
+ }`,yp=`#define STANDARD
3149
3149
  varying vec3 vViewPosition;
3150
3150
  #ifdef USE_TRANSMISSION
3151
3151
  varying vec3 vWorldPosition;
@@ -3188,7 +3188,7 @@ void main() {
3188
3188
  #ifdef USE_TRANSMISSION
3189
3189
  vWorldPosition = worldPosition.xyz;
3190
3190
  #endif
3191
- }`,yp=`#define STANDARD
3191
+ }`,Sp=`#define STANDARD
3192
3192
  #ifdef PHYSICAL
3193
3193
  #define IOR
3194
3194
  #define USE_SPECULAR
@@ -3546,7 +3546,7 @@ void main() {
3546
3546
  #include <tonemapping_fragment>
3547
3547
  #include <colorspace_fragment>
3548
3548
  #include <fog_fragment>
3549
- }`,Oe={alphahash_fragment:Kh,alphahash_pars_fragment:Zh,alphamap_fragment:Jh,alphamap_pars_fragment:Qh,alphatest_fragment:ed,alphatest_pars_fragment:td,aomap_fragment:nd,aomap_pars_fragment:id,batching_pars_vertex:rd,batching_vertex:sd,begin_vertex:ad,beginnormal_vertex:od,bsdfs:ld,iridescence_fragment:cd,bumpmap_pars_fragment:ud,clipping_planes_fragment:hd,clipping_planes_pars_fragment:dd,clipping_planes_pars_vertex:fd,clipping_planes_vertex:pd,color_fragment:md,color_pars_fragment:gd,color_pars_vertex:_d,color_vertex:xd,common:vd,cube_uv_reflection_fragment:Md,defaultnormal_vertex:Sd,displacementmap_pars_vertex:yd,displacementmap_vertex:Ed,emissivemap_fragment:bd,emissivemap_pars_fragment:Td,colorspace_fragment:Dd,colorspace_pars_fragment:Ad,envmap_fragment:wd,envmap_common_pars_fragment:Cd,envmap_pars_fragment:Rd,envmap_pars_vertex:Pd,envmap_physical_pars_fragment:Gd,envmap_vertex:Ld,fog_vertex:Fd,fog_pars_vertex:Id,fog_fragment:Ud,fog_pars_fragment:Nd,gradientmap_pars_fragment:Od,lightmap_fragment:Bd,lightmap_pars_fragment:zd,lights_lambert_fragment:kd,lights_lambert_pars_fragment:Hd,lights_pars_begin:Vd,lights_toon_fragment:Wd,lights_toon_pars_fragment:Xd,lights_phong_fragment:qd,lights_phong_pars_fragment:Yd,lights_physical_fragment:$d,lights_physical_pars_fragment:jd,lights_fragment_begin:Kd,lights_fragment_maps:Zd,lights_fragment_end:Jd,logdepthbuf_fragment:Qd,logdepthbuf_pars_fragment:ef,logdepthbuf_pars_vertex:tf,logdepthbuf_vertex:nf,map_fragment:rf,map_pars_fragment:sf,map_particle_fragment:af,map_particle_pars_fragment:of,metalnessmap_fragment:lf,metalnessmap_pars_fragment:cf,morphinstance_vertex:uf,morphcolor_vertex:hf,morphnormal_vertex:df,morphtarget_pars_vertex:ff,morphtarget_vertex:pf,normal_fragment_begin:mf,normal_fragment_maps:gf,normal_pars_fragment:_f,normal_pars_vertex:xf,normal_vertex:vf,normalmap_pars_fragment:Mf,clearcoat_normal_fragment_begin:Sf,clearcoat_normal_fragment_maps:yf,clearcoat_pars_fragment:Ef,iridescence_pars_fragment:bf,opaque_fragment:Tf,packing:Df,premultiplied_alpha_fragment:Af,project_vertex:wf,dithering_fragment:Cf,dithering_pars_fragment:Rf,roughnessmap_fragment:Pf,roughnessmap_pars_fragment:Lf,shadowmap_pars_fragment:Ff,shadowmap_pars_vertex:If,shadowmap_vertex:Uf,shadowmask_pars_fragment:Nf,skinbase_vertex:Of,skinning_pars_vertex:Bf,skinning_vertex:zf,skinnormal_vertex:kf,specularmap_fragment:Hf,specularmap_pars_fragment:Vf,tonemapping_fragment:Gf,tonemapping_pars_fragment:Wf,transmission_fragment:Xf,transmission_pars_fragment:qf,uv_pars_fragment:Yf,uv_pars_vertex:$f,uv_vertex:jf,worldpos_vertex:Kf,background_vert:Zf,background_frag:Jf,backgroundCube_vert:Qf,backgroundCube_frag:ep,cube_vert:tp,cube_frag:np,depth_vert:ip,depth_frag:rp,distanceRGBA_vert:sp,distanceRGBA_frag:ap,equirect_vert:op,equirect_frag:lp,linedashed_vert:cp,linedashed_frag:up,meshbasic_vert:hp,meshbasic_frag:dp,meshlambert_vert:fp,meshlambert_frag:pp,meshmatcap_vert:mp,meshmatcap_frag:gp,meshnormal_vert:_p,meshnormal_frag:xp,meshphong_vert:vp,meshphong_frag:Mp,meshphysical_vert:Sp,meshphysical_frag:yp,meshtoon_vert:Ep,meshtoon_frag:bp,points_vert:Tp,points_frag:Dp,shadow_vert:Ap,shadow_frag:wp,sprite_vert:Cp,sprite_frag:Rp},le={common:{diffuse:{value:new be(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Be},alphaMap:{value:null},alphaMapTransform:{value:new Be},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Be}},envmap:{envMap:{value:null},envMapRotation:{value:new Be},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Be}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Be}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Be},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Be},normalScale:{value:new ue(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Be},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Be}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Be}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Be}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new be(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new be(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Be},alphaTest:{value:0},uvTransform:{value:new Be}},sprite:{diffuse:{value:new be(16777215)},opacity:{value:1},center:{value:new ue(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Be},alphaMap:{value:null},alphaMapTransform:{value:new Be},alphaTest:{value:0}}},Gt={basic:{uniforms:vt([le.common,le.specularmap,le.envmap,le.aomap,le.lightmap,le.fog]),vertexShader:Oe.meshbasic_vert,fragmentShader:Oe.meshbasic_frag},lambert:{uniforms:vt([le.common,le.specularmap,le.envmap,le.aomap,le.lightmap,le.emissivemap,le.bumpmap,le.normalmap,le.displacementmap,le.fog,le.lights,{emissive:{value:new be(0)}}]),vertexShader:Oe.meshlambert_vert,fragmentShader:Oe.meshlambert_frag},phong:{uniforms:vt([le.common,le.specularmap,le.envmap,le.aomap,le.lightmap,le.emissivemap,le.bumpmap,le.normalmap,le.displacementmap,le.fog,le.lights,{emissive:{value:new be(0)},specular:{value:new be(1118481)},shininess:{value:30}}]),vertexShader:Oe.meshphong_vert,fragmentShader:Oe.meshphong_frag},standard:{uniforms:vt([le.common,le.envmap,le.aomap,le.lightmap,le.emissivemap,le.bumpmap,le.normalmap,le.displacementmap,le.roughnessmap,le.metalnessmap,le.fog,le.lights,{emissive:{value:new be(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Oe.meshphysical_vert,fragmentShader:Oe.meshphysical_frag},toon:{uniforms:vt([le.common,le.aomap,le.lightmap,le.emissivemap,le.bumpmap,le.normalmap,le.displacementmap,le.gradientmap,le.fog,le.lights,{emissive:{value:new be(0)}}]),vertexShader:Oe.meshtoon_vert,fragmentShader:Oe.meshtoon_frag},matcap:{uniforms:vt([le.common,le.bumpmap,le.normalmap,le.displacementmap,le.fog,{matcap:{value:null}}]),vertexShader:Oe.meshmatcap_vert,fragmentShader:Oe.meshmatcap_frag},points:{uniforms:vt([le.points,le.fog]),vertexShader:Oe.points_vert,fragmentShader:Oe.points_frag},dashed:{uniforms:vt([le.common,le.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Oe.linedashed_vert,fragmentShader:Oe.linedashed_frag},depth:{uniforms:vt([le.common,le.displacementmap]),vertexShader:Oe.depth_vert,fragmentShader:Oe.depth_frag},normal:{uniforms:vt([le.common,le.bumpmap,le.normalmap,le.displacementmap,{opacity:{value:1}}]),vertexShader:Oe.meshnormal_vert,fragmentShader:Oe.meshnormal_frag},sprite:{uniforms:vt([le.sprite,le.fog]),vertexShader:Oe.sprite_vert,fragmentShader:Oe.sprite_frag},background:{uniforms:{uvTransform:{value:new Be},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Oe.background_vert,fragmentShader:Oe.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Be}},vertexShader:Oe.backgroundCube_vert,fragmentShader:Oe.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Oe.cube_vert,fragmentShader:Oe.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Oe.equirect_vert,fragmentShader:Oe.equirect_frag},distanceRGBA:{uniforms:vt([le.common,le.displacementmap,{referencePosition:{value:new I},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Oe.distanceRGBA_vert,fragmentShader:Oe.distanceRGBA_frag},shadow:{uniforms:vt([le.lights,le.fog,{color:{value:new be(0)},opacity:{value:1}}]),vertexShader:Oe.shadow_vert,fragmentShader:Oe.shadow_frag}};Gt.physical={uniforms:vt([Gt.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Be},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Be},clearcoatNormalScale:{value:new ue(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Be},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Be},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Be},sheen:{value:0},sheenColor:{value:new be(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Be},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Be},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Be},transmissionSamplerSize:{value:new ue},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Be},attenuationDistance:{value:0},attenuationColor:{value:new be(0)},specularColor:{value:new be(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Be},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Be},anisotropyVector:{value:new ue},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Be}}]),vertexShader:Oe.meshphysical_vert,fragmentShader:Oe.meshphysical_frag};const fr={r:0,b:0,g:0},Tn=new In,Pp=new et;function Lp(i,e,t,n,r,s,a){const o=new be(0);let l=s===!0?0:1,c,u,d=null,h=0,f=null;function g(m,p){let E=!1,v=p.isScene===!0?p.background:null;v&&v.isTexture&&(v=(p.backgroundBlurriness>0?t:e).get(v)),v===null?_(o,l):v&&v.isColor&&(_(v,1),E=!0);const b=i.xr.getEnvironmentBlendMode();b==="additive"?n.buffers.color.setClear(0,0,0,1,a):b==="alpha-blend"&&n.buffers.color.setClear(0,0,0,0,a),(i.autoClear||E)&&i.clear(i.autoClearColor,i.autoClearDepth,i.autoClearStencil),v&&(v.isCubeTexture||v.mapping===Nr)?(u===void 0&&(u=new bt(new Gi(1,1,1),new ft({name:"BackgroundCubeMaterial",uniforms:_i(Gt.backgroundCube.uniforms),vertexShader:Gt.backgroundCube.vertexShader,fragmentShader:Gt.backgroundCube.fragmentShader,side:St,depthTest:!1,depthWrite:!1,fog:!1})),u.geometry.deleteAttribute("normal"),u.geometry.deleteAttribute("uv"),u.onBeforeRender=function(R,T,A){this.matrixWorld.copyPosition(A.matrixWorld)},Object.defineProperty(u.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(u)),Tn.copy(p.backgroundRotation),Tn.x*=-1,Tn.y*=-1,Tn.z*=-1,v.isCubeTexture&&v.isRenderTargetTexture===!1&&(Tn.y*=-1,Tn.z*=-1),u.material.uniforms.envMap.value=v,u.material.uniforms.flipEnvMap.value=v.isCubeTexture&&v.isRenderTargetTexture===!1?-1:1,u.material.uniforms.backgroundBlurriness.value=p.backgroundBlurriness,u.material.uniforms.backgroundIntensity.value=p.backgroundIntensity,u.material.uniforms.backgroundRotation.value.setFromMatrix4(Pp.makeRotationFromEuler(Tn)),u.material.toneMapped=je.getTransfer(v.colorSpace)!==Ke,(d!==v||h!==v.version||f!==i.toneMapping)&&(u.material.needsUpdate=!0,d=v,h=v.version,f=i.toneMapping),u.layers.enableAll(),m.unshift(u,u.geometry,u.material,0,0,null)):v&&v.isTexture&&(c===void 0&&(c=new bt(new zr(2,2),new ft({name:"BackgroundMaterial",uniforms:_i(Gt.background.uniforms),vertexShader:Gt.background.vertexShader,fragmentShader:Gt.background.fragmentShader,side:_n,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(c)),c.material.uniforms.t2D.value=v,c.material.uniforms.backgroundIntensity.value=p.backgroundIntensity,c.material.toneMapped=je.getTransfer(v.colorSpace)!==Ke,v.matrixAutoUpdate===!0&&v.updateMatrix(),c.material.uniforms.uvTransform.value.copy(v.matrix),(d!==v||h!==v.version||f!==i.toneMapping)&&(c.material.needsUpdate=!0,d=v,h=v.version,f=i.toneMapping),c.layers.enableAll(),m.unshift(c,c.geometry,c.material,0,0,null))}function _(m,p){m.getRGB(fr,Jl(i)),n.buffers.color.setClear(fr.r,fr.g,fr.b,p,a)}return{getClearColor:function(){return o},setClearColor:function(m,p=1){o.set(m),l=p,_(o,l)},getClearAlpha:function(){return l},setClearAlpha:function(m){l=m,_(o,l)},render:g}}function Fp(i,e){const t=i.getParameter(i.MAX_VERTEX_ATTRIBS),n={},r=h(null);let s=r,a=!1;function o(M,F,L,C,U){let H=!1;const Y=d(C,L,F);s!==Y&&(s=Y,c(s.object)),H=f(M,C,L,U),H&&g(M,C,L,U),U!==null&&e.update(U,i.ELEMENT_ARRAY_BUFFER),(H||a)&&(a=!1,b(M,F,L,C),U!==null&&i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.get(U).buffer))}function l(){return i.createVertexArray()}function c(M){return i.bindVertexArray(M)}function u(M){return i.deleteVertexArray(M)}function d(M,F,L){const C=L.wireframe===!0;let U=n[M.id];U===void 0&&(U={},n[M.id]=U);let H=U[F.id];H===void 0&&(H={},U[F.id]=H);let Y=H[C];return Y===void 0&&(Y=h(l()),H[C]=Y),Y}function h(M){const F=[],L=[],C=[];for(let U=0;U<t;U++)F[U]=0,L[U]=0,C[U]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:F,enabledAttributes:L,attributeDivisors:C,object:M,attributes:{},index:null}}function f(M,F,L,C){const U=s.attributes,H=F.attributes;let Y=0;const J=L.getAttributes();for(const z in J)if(J[z].location>=0){const $=U[z];let N=H[z];if(N===void 0&&(z==="instanceMatrix"&&M.instanceMatrix&&(N=M.instanceMatrix),z==="instanceColor"&&M.instanceColor&&(N=M.instanceColor)),$===void 0||$.attribute!==N||N&&$.data!==N.data)return!0;Y++}return s.attributesNum!==Y||s.index!==C}function g(M,F,L,C){const U={},H=F.attributes;let Y=0;const J=L.getAttributes();for(const z in J)if(J[z].location>=0){let $=H[z];$===void 0&&(z==="instanceMatrix"&&M.instanceMatrix&&($=M.instanceMatrix),z==="instanceColor"&&M.instanceColor&&($=M.instanceColor));const N={};N.attribute=$,$&&$.data&&(N.data=$.data),U[z]=N,Y++}s.attributes=U,s.attributesNum=Y,s.index=C}function _(){const M=s.newAttributes;for(let F=0,L=M.length;F<L;F++)M[F]=0}function m(M){p(M,0)}function p(M,F){const L=s.newAttributes,C=s.enabledAttributes,U=s.attributeDivisors;L[M]=1,C[M]===0&&(i.enableVertexAttribArray(M),C[M]=1),U[M]!==F&&(i.vertexAttribDivisor(M,F),U[M]=F)}function E(){const M=s.newAttributes,F=s.enabledAttributes;for(let L=0,C=F.length;L<C;L++)F[L]!==M[L]&&(i.disableVertexAttribArray(L),F[L]=0)}function v(M,F,L,C,U,H,Y){Y===!0?i.vertexAttribIPointer(M,F,L,U,H):i.vertexAttribPointer(M,F,L,C,U,H)}function b(M,F,L,C){_();const U=C.attributes,H=L.getAttributes(),Y=F.defaultAttributeValues;for(const J in H){const z=H[J];if(z.location>=0){let j=U[J];if(j===void 0&&(J==="instanceMatrix"&&M.instanceMatrix&&(j=M.instanceMatrix),J==="instanceColor"&&M.instanceColor&&(j=M.instanceColor)),j!==void 0){const $=j.normalized,N=j.itemSize,ee=e.get(j);if(ee===void 0)continue;const me=ee.buffer,O=ee.type,Q=ee.bytesPerElement,ce=O===i.INT||O===i.UNSIGNED_INT||j.gpuType===Ul;if(j.isInterleavedBufferAttribute){const ne=j.data,ve=ne.stride,Te=j.offset;if(ne.isInstancedInterleavedBuffer){for(let Ce=0;Ce<z.locationSize;Ce++)p(z.location+Ce,ne.meshPerAttribute);M.isInstancedMesh!==!0&&C._maxInstanceCount===void 0&&(C._maxInstanceCount=ne.meshPerAttribute*ne.count)}else for(let Ce=0;Ce<z.locationSize;Ce++)m(z.location+Ce);i.bindBuffer(i.ARRAY_BUFFER,me);for(let Ce=0;Ce<z.locationSize;Ce++)v(z.location+Ce,N/z.locationSize,O,$,ve*Q,(Te+N/z.locationSize*Ce)*Q,ce)}else{if(j.isInstancedBufferAttribute){for(let ne=0;ne<z.locationSize;ne++)p(z.location+ne,j.meshPerAttribute);M.isInstancedMesh!==!0&&C._maxInstanceCount===void 0&&(C._maxInstanceCount=j.meshPerAttribute*j.count)}else for(let ne=0;ne<z.locationSize;ne++)m(z.location+ne);i.bindBuffer(i.ARRAY_BUFFER,me);for(let ne=0;ne<z.locationSize;ne++)v(z.location+ne,N/z.locationSize,O,$,N*Q,N/z.locationSize*ne*Q,ce)}}else if(Y!==void 0){const $=Y[J];if($!==void 0)switch($.length){case 2:i.vertexAttrib2fv(z.location,$);break;case 3:i.vertexAttrib3fv(z.location,$);break;case 4:i.vertexAttrib4fv(z.location,$);break;default:i.vertexAttrib1fv(z.location,$)}}}}E()}function R(){P();for(const M in n){const F=n[M];for(const L in F){const C=F[L];for(const U in C)u(C[U].object),delete C[U];delete F[L]}delete n[M]}}function T(M){if(n[M.id]===void 0)return;const F=n[M.id];for(const L in F){const C=F[L];for(const U in C)u(C[U].object),delete C[U];delete F[L]}delete n[M.id]}function A(M){for(const F in n){const L=n[F];if(L[M.id]===void 0)continue;const C=L[M.id];for(const U in C)u(C[U].object),delete C[U];delete L[M.id]}}function P(){y(),a=!0,s!==r&&(s=r,c(s.object))}function y(){r.geometry=null,r.program=null,r.wireframe=!1}return{setup:o,reset:P,resetDefaultState:y,dispose:R,releaseStatesOfGeometry:T,releaseStatesOfProgram:A,initAttributes:_,enableAttribute:m,disableUnusedAttributes:E}}function Ip(i,e,t){let n;function r(l){n=l}function s(l,c){i.drawArrays(n,l,c),t.update(c,n,1)}function a(l,c,u){u!==0&&(i.drawArraysInstanced(n,l,c,u),t.update(c,n,u))}function o(l,c,u){if(u===0)return;const d=e.get("WEBGL_multi_draw");if(d===null)for(let h=0;h<u;h++)this.render(l[h],c[h]);else{d.multiDrawArraysWEBGL(n,l,0,c,0,u);let h=0;for(let f=0;f<u;f++)h+=c[f];t.update(h,n,1)}}this.setMode=r,this.render=s,this.renderInstances=a,this.renderMultiDraw=o}function Up(i,e,t){let n;function r(){if(n!==void 0)return n;if(e.has("EXT_texture_filter_anisotropic")===!0){const v=e.get("EXT_texture_filter_anisotropic");n=i.getParameter(v.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else n=0;return n}function s(v){if(v==="highp"){if(i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.HIGH_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision>0)return"highp";v="mediump"}return v==="mediump"&&i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.MEDIUM_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let a=t.precision!==void 0?t.precision:"highp";const o=s(a);o!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",o,"instead."),a=o);const l=t.logarithmicDepthBuffer===!0,c=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),u=i.getParameter(i.MAX_VERTEX_TEXTURE_IMAGE_UNITS),d=i.getParameter(i.MAX_TEXTURE_SIZE),h=i.getParameter(i.MAX_CUBE_MAP_TEXTURE_SIZE),f=i.getParameter(i.MAX_VERTEX_ATTRIBS),g=i.getParameter(i.MAX_VERTEX_UNIFORM_VECTORS),_=i.getParameter(i.MAX_VARYING_VECTORS),m=i.getParameter(i.MAX_FRAGMENT_UNIFORM_VECTORS),p=u>0,E=i.getParameter(i.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:r,getMaxPrecision:s,precision:a,logarithmicDepthBuffer:l,maxTextures:c,maxVertexTextures:u,maxTextureSize:d,maxCubemapSize:h,maxAttributes:f,maxVertexUniforms:g,maxVaryings:_,maxFragmentUniforms:m,vertexTextures:p,maxSamples:E}}function Np(i){const e=this;let t=null,n=0,r=!1,s=!1;const a=new hn,o=new Be,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(d,h){const f=d.length!==0||h||n!==0||r;return r=h,n=d.length,f},this.beginShadows=function(){s=!0,u(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(d,h){t=u(d,h,0)},this.setState=function(d,h,f){const g=d.clippingPlanes,_=d.clipIntersection,m=d.clipShadows,p=i.get(d);if(!r||g===null||g.length===0||s&&!m)s?u(null):c();else{const E=s?0:n,v=E*4;let b=p.clippingState||null;l.value=b,b=u(g,h,v,f);for(let R=0;R!==v;++R)b[R]=t[R];p.clippingState=b,this.numIntersection=_?this.numPlanes:0,this.numPlanes+=E}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function u(d,h,f,g){const _=d!==null?d.length:0;let m=null;if(_!==0){if(m=l.value,g!==!0||m===null){const p=f+_*4,E=h.matrixWorldInverse;o.getNormalMatrix(E),(m===null||m.length<p)&&(m=new Float32Array(p));for(let v=0,b=f;v!==_;++v,b+=4)a.copy(d[v]).applyMatrix4(E,o),a.normal.toArray(m,b),m[b+3]=a.constant}l.value=m,l.needsUpdate=!0}return e.numPlanes=_,e.numIntersection=0,m}}function Op(i){let e=new WeakMap;function t(a,o){return o===Hs?a.mapping=pi:o===Vs&&(a.mapping=mi),a}function n(a){if(a&&a.isTexture){const o=a.mapping;if(o===Hs||o===Vs)if(e.has(a)){const l=e.get(a).texture;return t(l,a.mapping)}else{const l=a.image;if(l&&l.height>0){const c=new qh(l.height);return c.fromEquirectangularTexture(i,a),e.set(a,c),a.addEventListener("dispose",r),t(c.texture,a.mapping)}else return null}}return a}function r(a){const o=a.target;o.removeEventListener("dispose",r);const l=e.get(o);l!==void 0&&(e.delete(o),l.dispose())}function s(){e=new WeakMap}return{get:n,dispose:s}}class ic extends Ql{constructor(e=-1,t=1,n=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=n,this.bottom=r,this.near=s,this.far=a,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,n,r,s,a){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,r=(this.top+this.bottom)/2;let s=n-e,a=n+e,o=r+t,l=r-t;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,u=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,a=s+c*this.view.width,o-=u*this.view.offsetY,l=o-u*this.view.height}this.projectionMatrix.makeOrthographic(s,a,o,l,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}const li=4,To=[.125,.215,.35,.446,.526,.582],Cn=20,_s=new ic,Do=new be;let xs=null,vs=0,Ms=0,Ss=!1;const An=(1+Math.sqrt(5))/2,si=1/An,Ao=[new I(1,1,1),new I(-1,1,1),new I(1,1,-1),new I(-1,1,-1),new I(0,An,si),new I(0,An,-si),new I(si,0,An),new I(-si,0,An),new I(An,si,0),new I(-An,si,0)];class wo{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,n=.1,r=100){xs=this._renderer.getRenderTarget(),vs=this._renderer.getActiveCubeFace(),Ms=this._renderer.getActiveMipmapLevel(),Ss=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,n,r,s),t>0&&this._blur(s,0,0,t),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=Po(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=Ro(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}_cleanup(e){this._renderer.setRenderTarget(xs,vs,Ms),this._renderer.xr.enabled=Ss,e.scissorTest=!1,pr(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===pi||e.mapping===mi?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),xs=this._renderer.getRenderTarget(),vs=this._renderer.getActiveCubeFace(),Ms=this._renderer.getActiveMipmapLevel(),Ss=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const n=t||this._allocateTargets();return this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,n={magFilter:zt,minFilter:zt,generateMipmaps:!1,type:gn,format:Xt,colorSpace:xn,depthBuffer:!1},r=Co(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=Co(e,t,n);const{_lodMax:s}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=Bp(s)),this._blurMaterial=zp(s,e,t)}return r}_compileMaterial(e){const t=new bt(this._lodPlanes[0],e);this._renderer.compile(t,_s)}_sceneToCubeUV(e,t,n,r){const o=new Rt(90,1,t,n),l=[1,-1,1,1,1,1],c=[1,1,1,-1,-1,-1],u=this._renderer,d=u.autoClear,h=u.toneMapping;u.getClearColor(Do),u.toneMapping=pn,u.autoClear=!1;const f=new Vi({name:"PMREM.Background",side:St,depthWrite:!1,depthTest:!1}),g=new bt(new Gi,f);let _=!1;const m=e.background;m?m.isColor&&(f.color.copy(m),e.background=null,_=!0):(f.color.copy(Do),_=!0);for(let p=0;p<6;p++){const E=p%3;E===0?(o.up.set(0,l[p],0),o.lookAt(c[p],0,0)):E===1?(o.up.set(0,0,l[p]),o.lookAt(0,c[p],0)):(o.up.set(0,l[p],0),o.lookAt(0,0,c[p]));const v=this._cubeSize;pr(r,E*v,p>2?v:0,v,v),u.setRenderTarget(r),_&&u.render(g,o),u.render(e,o)}g.geometry.dispose(),g.material.dispose(),u.toneMapping=h,u.autoClear=d,e.background=m}_textureToCubeUV(e,t){const n=this._renderer,r=e.mapping===pi||e.mapping===mi;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=Po()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=Ro());const s=r?this._cubemapMaterial:this._equirectMaterial,a=new bt(this._lodPlanes[0],s),o=s.uniforms;o.envMap.value=e;const l=this._cubeSize;pr(t,0,0,3*l,2*l),n.setRenderTarget(t),n.render(a,_s)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;for(let r=1;r<this._lodPlanes.length;r++){const s=Math.sqrt(this._sigmas[r]*this._sigmas[r]-this._sigmas[r-1]*this._sigmas[r-1]),a=Ao[(r-1)%Ao.length];this._blur(e,r-1,r,s,a)}t.autoClear=n}_blur(e,t,n,r,s){const a=this._pingPongRenderTarget;this._halfBlur(e,a,t,n,r,"latitudinal",s),this._halfBlur(a,e,n,n,r,"longitudinal",s)}_halfBlur(e,t,n,r,s,a,o){const l=this._renderer,c=this._blurMaterial;a!=="latitudinal"&&a!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");const u=3,d=new bt(this._lodPlanes[r],c),h=c.uniforms,f=this._sizeLods[n]-1,g=isFinite(s)?Math.PI/(2*f):2*Math.PI/(2*Cn-1),_=s/g,m=isFinite(s)?1+Math.floor(u*_):Cn;m>Cn&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${m} samples when the maximum is set to ${Cn}`);const p=[];let E=0;for(let A=0;A<Cn;++A){const P=A/_,y=Math.exp(-P*P/2);p.push(y),A===0?E+=y:A<m&&(E+=2*y)}for(let A=0;A<p.length;A++)p[A]=p[A]/E;h.envMap.value=e.texture,h.samples.value=m,h.weights.value=p,h.latitudinal.value=a==="latitudinal",o&&(h.poleAxis.value=o);const{_lodMax:v}=this;h.dTheta.value=g,h.mipInt.value=v-n;const b=this._sizeLods[r],R=3*b*(r>v-li?r-v+li:0),T=4*(this._cubeSize-b);pr(t,R,T,3*b,2*b),l.setRenderTarget(t),l.render(d,_s)}}function Bp(i){const e=[],t=[],n=[];let r=i;const s=i-li+1+To.length;for(let a=0;a<s;a++){const o=Math.pow(2,r);t.push(o);let l=1/o;a>i-li?l=To[a-i+li-1]:a===0&&(l=0),n.push(l);const c=1/(o-2),u=-c,d=1+c,h=[u,u,d,u,d,d,u,u,d,d,u,d],f=6,g=6,_=3,m=2,p=1,E=new Float32Array(_*g*f),v=new Float32Array(m*g*f),b=new Float32Array(p*g*f);for(let T=0;T<f;T++){const A=T%3*2/3-1,P=T>2?0:-1,y=[A,P,0,A+2/3,P,0,A+2/3,P+1,0,A,P,0,A+2/3,P+1,0,A,P+1,0];E.set(y,_*g*T),v.set(h,m*g*T);const M=[T,T,T,T,T,T];b.set(M,p*g*T)}const R=new _t;R.setAttribute("position",new Et(E,_)),R.setAttribute("uv",new Et(v,m)),R.setAttribute("faceIndex",new Et(b,p)),e.push(R),r>li&&r--}return{lodPlanes:e,sizeLods:t,sigmas:n}}function Co(i,e,t){const n=new Ht(i,e,t);return n.texture.mapping=Nr,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function pr(i,e,t,n,r){i.viewport.set(e,t,n,r),i.scissor.set(e,t,n,r)}function zp(i,e,t){const n=new Float32Array(Cn),r=new I(0,1,0);return new ft({name:"SphericalGaussianBlur",defines:{n:Cn,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${i}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:na(),fragmentShader:`
3549
+ }`,Oe={alphahash_fragment:Kh,alphahash_pars_fragment:Zh,alphamap_fragment:Jh,alphamap_pars_fragment:Qh,alphatest_fragment:ed,alphatest_pars_fragment:td,aomap_fragment:nd,aomap_pars_fragment:id,batching_pars_vertex:rd,batching_vertex:sd,begin_vertex:ad,beginnormal_vertex:od,bsdfs:ld,iridescence_fragment:cd,bumpmap_pars_fragment:ud,clipping_planes_fragment:hd,clipping_planes_pars_fragment:dd,clipping_planes_pars_vertex:fd,clipping_planes_vertex:pd,color_fragment:md,color_pars_fragment:gd,color_pars_vertex:_d,color_vertex:xd,common:vd,cube_uv_reflection_fragment:Md,defaultnormal_vertex:yd,displacementmap_pars_vertex:Sd,displacementmap_vertex:Ed,emissivemap_fragment:bd,emissivemap_pars_fragment:Td,colorspace_fragment:Dd,colorspace_pars_fragment:Ad,envmap_fragment:wd,envmap_common_pars_fragment:Cd,envmap_pars_fragment:Rd,envmap_pars_vertex:Pd,envmap_physical_pars_fragment:Gd,envmap_vertex:Ld,fog_vertex:Fd,fog_pars_vertex:Id,fog_fragment:Nd,fog_pars_fragment:Ud,gradientmap_pars_fragment:Od,lightmap_fragment:Bd,lightmap_pars_fragment:zd,lights_lambert_fragment:kd,lights_lambert_pars_fragment:Vd,lights_pars_begin:Hd,lights_toon_fragment:Wd,lights_toon_pars_fragment:Xd,lights_phong_fragment:qd,lights_phong_pars_fragment:jd,lights_physical_fragment:$d,lights_physical_pars_fragment:Yd,lights_fragment_begin:Kd,lights_fragment_maps:Zd,lights_fragment_end:Jd,logdepthbuf_fragment:Qd,logdepthbuf_pars_fragment:ef,logdepthbuf_pars_vertex:tf,logdepthbuf_vertex:nf,map_fragment:rf,map_pars_fragment:sf,map_particle_fragment:af,map_particle_pars_fragment:of,metalnessmap_fragment:lf,metalnessmap_pars_fragment:cf,morphinstance_vertex:uf,morphcolor_vertex:hf,morphnormal_vertex:df,morphtarget_pars_vertex:ff,morphtarget_vertex:pf,normal_fragment_begin:mf,normal_fragment_maps:gf,normal_pars_fragment:_f,normal_pars_vertex:xf,normal_vertex:vf,normalmap_pars_fragment:Mf,clearcoat_normal_fragment_begin:yf,clearcoat_normal_fragment_maps:Sf,clearcoat_pars_fragment:Ef,iridescence_pars_fragment:bf,opaque_fragment:Tf,packing:Df,premultiplied_alpha_fragment:Af,project_vertex:wf,dithering_fragment:Cf,dithering_pars_fragment:Rf,roughnessmap_fragment:Pf,roughnessmap_pars_fragment:Lf,shadowmap_pars_fragment:Ff,shadowmap_pars_vertex:If,shadowmap_vertex:Nf,shadowmask_pars_fragment:Uf,skinbase_vertex:Of,skinning_pars_vertex:Bf,skinning_vertex:zf,skinnormal_vertex:kf,specularmap_fragment:Vf,specularmap_pars_fragment:Hf,tonemapping_fragment:Gf,tonemapping_pars_fragment:Wf,transmission_fragment:Xf,transmission_pars_fragment:qf,uv_pars_fragment:jf,uv_pars_vertex:$f,uv_vertex:Yf,worldpos_vertex:Kf,background_vert:Zf,background_frag:Jf,backgroundCube_vert:Qf,backgroundCube_frag:ep,cube_vert:tp,cube_frag:np,depth_vert:ip,depth_frag:rp,distanceRGBA_vert:sp,distanceRGBA_frag:ap,equirect_vert:op,equirect_frag:lp,linedashed_vert:cp,linedashed_frag:up,meshbasic_vert:hp,meshbasic_frag:dp,meshlambert_vert:fp,meshlambert_frag:pp,meshmatcap_vert:mp,meshmatcap_frag:gp,meshnormal_vert:_p,meshnormal_frag:xp,meshphong_vert:vp,meshphong_frag:Mp,meshphysical_vert:yp,meshphysical_frag:Sp,meshtoon_vert:Ep,meshtoon_frag:bp,points_vert:Tp,points_frag:Dp,shadow_vert:Ap,shadow_frag:wp,sprite_vert:Cp,sprite_frag:Rp},le={common:{diffuse:{value:new be(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Be},alphaMap:{value:null},alphaMapTransform:{value:new Be},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Be}},envmap:{envMap:{value:null},envMapRotation:{value:new Be},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Be}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Be}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Be},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Be},normalScale:{value:new ue(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Be},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Be}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Be}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Be}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new be(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new be(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Be},alphaTest:{value:0},uvTransform:{value:new Be}},sprite:{diffuse:{value:new be(16777215)},opacity:{value:1},center:{value:new ue(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Be},alphaMap:{value:null},alphaMapTransform:{value:new Be},alphaTest:{value:0}}},Gt={basic:{uniforms:vt([le.common,le.specularmap,le.envmap,le.aomap,le.lightmap,le.fog]),vertexShader:Oe.meshbasic_vert,fragmentShader:Oe.meshbasic_frag},lambert:{uniforms:vt([le.common,le.specularmap,le.envmap,le.aomap,le.lightmap,le.emissivemap,le.bumpmap,le.normalmap,le.displacementmap,le.fog,le.lights,{emissive:{value:new be(0)}}]),vertexShader:Oe.meshlambert_vert,fragmentShader:Oe.meshlambert_frag},phong:{uniforms:vt([le.common,le.specularmap,le.envmap,le.aomap,le.lightmap,le.emissivemap,le.bumpmap,le.normalmap,le.displacementmap,le.fog,le.lights,{emissive:{value:new be(0)},specular:{value:new be(1118481)},shininess:{value:30}}]),vertexShader:Oe.meshphong_vert,fragmentShader:Oe.meshphong_frag},standard:{uniforms:vt([le.common,le.envmap,le.aomap,le.lightmap,le.emissivemap,le.bumpmap,le.normalmap,le.displacementmap,le.roughnessmap,le.metalnessmap,le.fog,le.lights,{emissive:{value:new be(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Oe.meshphysical_vert,fragmentShader:Oe.meshphysical_frag},toon:{uniforms:vt([le.common,le.aomap,le.lightmap,le.emissivemap,le.bumpmap,le.normalmap,le.displacementmap,le.gradientmap,le.fog,le.lights,{emissive:{value:new be(0)}}]),vertexShader:Oe.meshtoon_vert,fragmentShader:Oe.meshtoon_frag},matcap:{uniforms:vt([le.common,le.bumpmap,le.normalmap,le.displacementmap,le.fog,{matcap:{value:null}}]),vertexShader:Oe.meshmatcap_vert,fragmentShader:Oe.meshmatcap_frag},points:{uniforms:vt([le.points,le.fog]),vertexShader:Oe.points_vert,fragmentShader:Oe.points_frag},dashed:{uniforms:vt([le.common,le.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Oe.linedashed_vert,fragmentShader:Oe.linedashed_frag},depth:{uniforms:vt([le.common,le.displacementmap]),vertexShader:Oe.depth_vert,fragmentShader:Oe.depth_frag},normal:{uniforms:vt([le.common,le.bumpmap,le.normalmap,le.displacementmap,{opacity:{value:1}}]),vertexShader:Oe.meshnormal_vert,fragmentShader:Oe.meshnormal_frag},sprite:{uniforms:vt([le.sprite,le.fog]),vertexShader:Oe.sprite_vert,fragmentShader:Oe.sprite_frag},background:{uniforms:{uvTransform:{value:new Be},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Oe.background_vert,fragmentShader:Oe.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Be}},vertexShader:Oe.backgroundCube_vert,fragmentShader:Oe.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Oe.cube_vert,fragmentShader:Oe.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Oe.equirect_vert,fragmentShader:Oe.equirect_frag},distanceRGBA:{uniforms:vt([le.common,le.displacementmap,{referencePosition:{value:new I},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Oe.distanceRGBA_vert,fragmentShader:Oe.distanceRGBA_frag},shadow:{uniforms:vt([le.lights,le.fog,{color:{value:new be(0)},opacity:{value:1}}]),vertexShader:Oe.shadow_vert,fragmentShader:Oe.shadow_frag}};Gt.physical={uniforms:vt([Gt.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Be},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Be},clearcoatNormalScale:{value:new ue(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Be},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Be},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Be},sheen:{value:0},sheenColor:{value:new be(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Be},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Be},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Be},transmissionSamplerSize:{value:new ue},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Be},attenuationDistance:{value:0},attenuationColor:{value:new be(0)},specularColor:{value:new be(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Be},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Be},anisotropyVector:{value:new ue},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Be}}]),vertexShader:Oe.meshphysical_vert,fragmentShader:Oe.meshphysical_frag};const fr={r:0,b:0,g:0},Tn=new In,Pp=new et;function Lp(i,e,t,n,r,s,a){const o=new be(0);let l=s===!0?0:1,c,u,d=null,h=0,f=null;function g(m,p){let E=!1,v=p.isScene===!0?p.background:null;v&&v.isTexture&&(v=(p.backgroundBlurriness>0?t:e).get(v)),v===null?_(o,l):v&&v.isColor&&(_(v,1),E=!0);const b=i.xr.getEnvironmentBlendMode();b==="additive"?n.buffers.color.setClear(0,0,0,1,a):b==="alpha-blend"&&n.buffers.color.setClear(0,0,0,0,a),(i.autoClear||E)&&i.clear(i.autoClearColor,i.autoClearDepth,i.autoClearStencil),v&&(v.isCubeTexture||v.mapping===Ur)?(u===void 0&&(u=new bt(new Gi(1,1,1),new ft({name:"BackgroundCubeMaterial",uniforms:_i(Gt.backgroundCube.uniforms),vertexShader:Gt.backgroundCube.vertexShader,fragmentShader:Gt.backgroundCube.fragmentShader,side:yt,depthTest:!1,depthWrite:!1,fog:!1})),u.geometry.deleteAttribute("normal"),u.geometry.deleteAttribute("uv"),u.onBeforeRender=function(R,T,A){this.matrixWorld.copyPosition(A.matrixWorld)},Object.defineProperty(u.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(u)),Tn.copy(p.backgroundRotation),Tn.x*=-1,Tn.y*=-1,Tn.z*=-1,v.isCubeTexture&&v.isRenderTargetTexture===!1&&(Tn.y*=-1,Tn.z*=-1),u.material.uniforms.envMap.value=v,u.material.uniforms.flipEnvMap.value=v.isCubeTexture&&v.isRenderTargetTexture===!1?-1:1,u.material.uniforms.backgroundBlurriness.value=p.backgroundBlurriness,u.material.uniforms.backgroundIntensity.value=p.backgroundIntensity,u.material.uniforms.backgroundRotation.value.setFromMatrix4(Pp.makeRotationFromEuler(Tn)),u.material.toneMapped=Ye.getTransfer(v.colorSpace)!==Ke,(d!==v||h!==v.version||f!==i.toneMapping)&&(u.material.needsUpdate=!0,d=v,h=v.version,f=i.toneMapping),u.layers.enableAll(),m.unshift(u,u.geometry,u.material,0,0,null)):v&&v.isTexture&&(c===void 0&&(c=new bt(new zr(2,2),new ft({name:"BackgroundMaterial",uniforms:_i(Gt.background.uniforms),vertexShader:Gt.background.vertexShader,fragmentShader:Gt.background.fragmentShader,side:_n,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(c)),c.material.uniforms.t2D.value=v,c.material.uniforms.backgroundIntensity.value=p.backgroundIntensity,c.material.toneMapped=Ye.getTransfer(v.colorSpace)!==Ke,v.matrixAutoUpdate===!0&&v.updateMatrix(),c.material.uniforms.uvTransform.value.copy(v.matrix),(d!==v||h!==v.version||f!==i.toneMapping)&&(c.material.needsUpdate=!0,d=v,h=v.version,f=i.toneMapping),c.layers.enableAll(),m.unshift(c,c.geometry,c.material,0,0,null))}function _(m,p){m.getRGB(fr,Jl(i)),n.buffers.color.setClear(fr.r,fr.g,fr.b,p,a)}return{getClearColor:function(){return o},setClearColor:function(m,p=1){o.set(m),l=p,_(o,l)},getClearAlpha:function(){return l},setClearAlpha:function(m){l=m,_(o,l)},render:g}}function Fp(i,e){const t=i.getParameter(i.MAX_VERTEX_ATTRIBS),n={},r=h(null);let s=r,a=!1;function o(M,F,L,C,N){let V=!1;const j=d(C,L,F);s!==j&&(s=j,c(s.object)),V=f(M,C,L,N),V&&g(M,C,L,N),N!==null&&e.update(N,i.ELEMENT_ARRAY_BUFFER),(V||a)&&(a=!1,b(M,F,L,C),N!==null&&i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.get(N).buffer))}function l(){return i.createVertexArray()}function c(M){return i.bindVertexArray(M)}function u(M){return i.deleteVertexArray(M)}function d(M,F,L){const C=L.wireframe===!0;let N=n[M.id];N===void 0&&(N={},n[M.id]=N);let V=N[F.id];V===void 0&&(V={},N[F.id]=V);let j=V[C];return j===void 0&&(j=h(l()),V[C]=j),j}function h(M){const F=[],L=[],C=[];for(let N=0;N<t;N++)F[N]=0,L[N]=0,C[N]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:F,enabledAttributes:L,attributeDivisors:C,object:M,attributes:{},index:null}}function f(M,F,L,C){const N=s.attributes,V=F.attributes;let j=0;const J=L.getAttributes();for(const z in J)if(J[z].location>=0){const $=N[z];let U=V[z];if(U===void 0&&(z==="instanceMatrix"&&M.instanceMatrix&&(U=M.instanceMatrix),z==="instanceColor"&&M.instanceColor&&(U=M.instanceColor)),$===void 0||$.attribute!==U||U&&$.data!==U.data)return!0;j++}return s.attributesNum!==j||s.index!==C}function g(M,F,L,C){const N={},V=F.attributes;let j=0;const J=L.getAttributes();for(const z in J)if(J[z].location>=0){let $=V[z];$===void 0&&(z==="instanceMatrix"&&M.instanceMatrix&&($=M.instanceMatrix),z==="instanceColor"&&M.instanceColor&&($=M.instanceColor));const U={};U.attribute=$,$&&$.data&&(U.data=$.data),N[z]=U,j++}s.attributes=N,s.attributesNum=j,s.index=C}function _(){const M=s.newAttributes;for(let F=0,L=M.length;F<L;F++)M[F]=0}function m(M){p(M,0)}function p(M,F){const L=s.newAttributes,C=s.enabledAttributes,N=s.attributeDivisors;L[M]=1,C[M]===0&&(i.enableVertexAttribArray(M),C[M]=1),N[M]!==F&&(i.vertexAttribDivisor(M,F),N[M]=F)}function E(){const M=s.newAttributes,F=s.enabledAttributes;for(let L=0,C=F.length;L<C;L++)F[L]!==M[L]&&(i.disableVertexAttribArray(L),F[L]=0)}function v(M,F,L,C,N,V,j){j===!0?i.vertexAttribIPointer(M,F,L,N,V):i.vertexAttribPointer(M,F,L,C,N,V)}function b(M,F,L,C){_();const N=C.attributes,V=L.getAttributes(),j=F.defaultAttributeValues;for(const J in V){const z=V[J];if(z.location>=0){let Y=N[J];if(Y===void 0&&(J==="instanceMatrix"&&M.instanceMatrix&&(Y=M.instanceMatrix),J==="instanceColor"&&M.instanceColor&&(Y=M.instanceColor)),Y!==void 0){const $=Y.normalized,U=Y.itemSize,ee=e.get(Y);if(ee===void 0)continue;const me=ee.buffer,O=ee.type,Q=ee.bytesPerElement,ce=O===i.INT||O===i.UNSIGNED_INT||Y.gpuType===Nl;if(Y.isInterleavedBufferAttribute){const ne=Y.data,ve=ne.stride,Te=Y.offset;if(ne.isInstancedInterleavedBuffer){for(let Ce=0;Ce<z.locationSize;Ce++)p(z.location+Ce,ne.meshPerAttribute);M.isInstancedMesh!==!0&&C._maxInstanceCount===void 0&&(C._maxInstanceCount=ne.meshPerAttribute*ne.count)}else for(let Ce=0;Ce<z.locationSize;Ce++)m(z.location+Ce);i.bindBuffer(i.ARRAY_BUFFER,me);for(let Ce=0;Ce<z.locationSize;Ce++)v(z.location+Ce,U/z.locationSize,O,$,ve*Q,(Te+U/z.locationSize*Ce)*Q,ce)}else{if(Y.isInstancedBufferAttribute){for(let ne=0;ne<z.locationSize;ne++)p(z.location+ne,Y.meshPerAttribute);M.isInstancedMesh!==!0&&C._maxInstanceCount===void 0&&(C._maxInstanceCount=Y.meshPerAttribute*Y.count)}else for(let ne=0;ne<z.locationSize;ne++)m(z.location+ne);i.bindBuffer(i.ARRAY_BUFFER,me);for(let ne=0;ne<z.locationSize;ne++)v(z.location+ne,U/z.locationSize,O,$,U*Q,U/z.locationSize*ne*Q,ce)}}else if(j!==void 0){const $=j[J];if($!==void 0)switch($.length){case 2:i.vertexAttrib2fv(z.location,$);break;case 3:i.vertexAttrib3fv(z.location,$);break;case 4:i.vertexAttrib4fv(z.location,$);break;default:i.vertexAttrib1fv(z.location,$)}}}}E()}function R(){P();for(const M in n){const F=n[M];for(const L in F){const C=F[L];for(const N in C)u(C[N].object),delete C[N];delete F[L]}delete n[M]}}function T(M){if(n[M.id]===void 0)return;const F=n[M.id];for(const L in F){const C=F[L];for(const N in C)u(C[N].object),delete C[N];delete F[L]}delete n[M.id]}function A(M){for(const F in n){const L=n[F];if(L[M.id]===void 0)continue;const C=L[M.id];for(const N in C)u(C[N].object),delete C[N];delete L[M.id]}}function P(){S(),a=!0,s!==r&&(s=r,c(s.object))}function S(){r.geometry=null,r.program=null,r.wireframe=!1}return{setup:o,reset:P,resetDefaultState:S,dispose:R,releaseStatesOfGeometry:T,releaseStatesOfProgram:A,initAttributes:_,enableAttribute:m,disableUnusedAttributes:E}}function Ip(i,e,t){let n;function r(l){n=l}function s(l,c){i.drawArrays(n,l,c),t.update(c,n,1)}function a(l,c,u){u!==0&&(i.drawArraysInstanced(n,l,c,u),t.update(c,n,u))}function o(l,c,u){if(u===0)return;const d=e.get("WEBGL_multi_draw");if(d===null)for(let h=0;h<u;h++)this.render(l[h],c[h]);else{d.multiDrawArraysWEBGL(n,l,0,c,0,u);let h=0;for(let f=0;f<u;f++)h+=c[f];t.update(h,n,1)}}this.setMode=r,this.render=s,this.renderInstances=a,this.renderMultiDraw=o}function Np(i,e,t){let n;function r(){if(n!==void 0)return n;if(e.has("EXT_texture_filter_anisotropic")===!0){const v=e.get("EXT_texture_filter_anisotropic");n=i.getParameter(v.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else n=0;return n}function s(v){if(v==="highp"){if(i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.HIGH_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision>0)return"highp";v="mediump"}return v==="mediump"&&i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.MEDIUM_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let a=t.precision!==void 0?t.precision:"highp";const o=s(a);o!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",o,"instead."),a=o);const l=t.logarithmicDepthBuffer===!0,c=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),u=i.getParameter(i.MAX_VERTEX_TEXTURE_IMAGE_UNITS),d=i.getParameter(i.MAX_TEXTURE_SIZE),h=i.getParameter(i.MAX_CUBE_MAP_TEXTURE_SIZE),f=i.getParameter(i.MAX_VERTEX_ATTRIBS),g=i.getParameter(i.MAX_VERTEX_UNIFORM_VECTORS),_=i.getParameter(i.MAX_VARYING_VECTORS),m=i.getParameter(i.MAX_FRAGMENT_UNIFORM_VECTORS),p=u>0,E=i.getParameter(i.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:r,getMaxPrecision:s,precision:a,logarithmicDepthBuffer:l,maxTextures:c,maxVertexTextures:u,maxTextureSize:d,maxCubemapSize:h,maxAttributes:f,maxVertexUniforms:g,maxVaryings:_,maxFragmentUniforms:m,vertexTextures:p,maxSamples:E}}function Up(i){const e=this;let t=null,n=0,r=!1,s=!1;const a=new hn,o=new Be,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(d,h){const f=d.length!==0||h||n!==0||r;return r=h,n=d.length,f},this.beginShadows=function(){s=!0,u(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(d,h){t=u(d,h,0)},this.setState=function(d,h,f){const g=d.clippingPlanes,_=d.clipIntersection,m=d.clipShadows,p=i.get(d);if(!r||g===null||g.length===0||s&&!m)s?u(null):c();else{const E=s?0:n,v=E*4;let b=p.clippingState||null;l.value=b,b=u(g,h,v,f);for(let R=0;R!==v;++R)b[R]=t[R];p.clippingState=b,this.numIntersection=_?this.numPlanes:0,this.numPlanes+=E}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function u(d,h,f,g){const _=d!==null?d.length:0;let m=null;if(_!==0){if(m=l.value,g!==!0||m===null){const p=f+_*4,E=h.matrixWorldInverse;o.getNormalMatrix(E),(m===null||m.length<p)&&(m=new Float32Array(p));for(let v=0,b=f;v!==_;++v,b+=4)a.copy(d[v]).applyMatrix4(E,o),a.normal.toArray(m,b),m[b+3]=a.constant}l.value=m,l.needsUpdate=!0}return e.numPlanes=_,e.numIntersection=0,m}}function Op(i){let e=new WeakMap;function t(a,o){return o===Hs?a.mapping=pi:o===Gs&&(a.mapping=mi),a}function n(a){if(a&&a.isTexture){const o=a.mapping;if(o===Hs||o===Gs)if(e.has(a)){const l=e.get(a).texture;return t(l,a.mapping)}else{const l=a.image;if(l&&l.height>0){const c=new qh(l.height);return c.fromEquirectangularTexture(i,a),e.set(a,c),a.addEventListener("dispose",r),t(c.texture,a.mapping)}else return null}}return a}function r(a){const o=a.target;o.removeEventListener("dispose",r);const l=e.get(o);l!==void 0&&(e.delete(o),l.dispose())}function s(){e=new WeakMap}return{get:n,dispose:s}}class ic extends Ql{constructor(e=-1,t=1,n=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=n,this.bottom=r,this.near=s,this.far=a,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,n,r,s,a){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,r=(this.top+this.bottom)/2;let s=n-e,a=n+e,o=r+t,l=r-t;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,u=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,a=s+c*this.view.width,o-=u*this.view.offsetY,l=o-u*this.view.height}this.projectionMatrix.makeOrthographic(s,a,o,l,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}const li=4,To=[.125,.215,.35,.446,.526,.582],Cn=20,xs=new ic,Do=new be;let vs=null,Ms=0,ys=0,Ss=!1;const An=(1+Math.sqrt(5))/2,si=1/An,Ao=[new I(1,1,1),new I(-1,1,1),new I(1,1,-1),new I(-1,1,-1),new I(0,An,si),new I(0,An,-si),new I(si,0,An),new I(-si,0,An),new I(An,si,0),new I(-An,si,0)];class wo{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,n=.1,r=100){vs=this._renderer.getRenderTarget(),Ms=this._renderer.getActiveCubeFace(),ys=this._renderer.getActiveMipmapLevel(),Ss=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,n,r,s),t>0&&this._blur(s,0,0,t),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=Po(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=Ro(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}_cleanup(e){this._renderer.setRenderTarget(vs,Ms,ys),this._renderer.xr.enabled=Ss,e.scissorTest=!1,pr(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===pi||e.mapping===mi?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),vs=this._renderer.getRenderTarget(),Ms=this._renderer.getActiveCubeFace(),ys=this._renderer.getActiveMipmapLevel(),Ss=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const n=t||this._allocateTargets();return this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,n={magFilter:zt,minFilter:zt,generateMipmaps:!1,type:gn,format:Xt,colorSpace:xn,depthBuffer:!1},r=Co(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=Co(e,t,n);const{_lodMax:s}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=Bp(s)),this._blurMaterial=zp(s,e,t)}return r}_compileMaterial(e){const t=new bt(this._lodPlanes[0],e);this._renderer.compile(t,xs)}_sceneToCubeUV(e,t,n,r){const o=new Rt(90,1,t,n),l=[1,-1,1,1,1,1],c=[1,1,1,-1,-1,-1],u=this._renderer,d=u.autoClear,h=u.toneMapping;u.getClearColor(Do),u.toneMapping=pn,u.autoClear=!1;const f=new Hi({name:"PMREM.Background",side:yt,depthWrite:!1,depthTest:!1}),g=new bt(new Gi,f);let _=!1;const m=e.background;m?m.isColor&&(f.color.copy(m),e.background=null,_=!0):(f.color.copy(Do),_=!0);for(let p=0;p<6;p++){const E=p%3;E===0?(o.up.set(0,l[p],0),o.lookAt(c[p],0,0)):E===1?(o.up.set(0,0,l[p]),o.lookAt(0,c[p],0)):(o.up.set(0,l[p],0),o.lookAt(0,0,c[p]));const v=this._cubeSize;pr(r,E*v,p>2?v:0,v,v),u.setRenderTarget(r),_&&u.render(g,o),u.render(e,o)}g.geometry.dispose(),g.material.dispose(),u.toneMapping=h,u.autoClear=d,e.background=m}_textureToCubeUV(e,t){const n=this._renderer,r=e.mapping===pi||e.mapping===mi;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=Po()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=Ro());const s=r?this._cubemapMaterial:this._equirectMaterial,a=new bt(this._lodPlanes[0],s),o=s.uniforms;o.envMap.value=e;const l=this._cubeSize;pr(t,0,0,3*l,2*l),n.setRenderTarget(t),n.render(a,xs)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;for(let r=1;r<this._lodPlanes.length;r++){const s=Math.sqrt(this._sigmas[r]*this._sigmas[r]-this._sigmas[r-1]*this._sigmas[r-1]),a=Ao[(r-1)%Ao.length];this._blur(e,r-1,r,s,a)}t.autoClear=n}_blur(e,t,n,r,s){const a=this._pingPongRenderTarget;this._halfBlur(e,a,t,n,r,"latitudinal",s),this._halfBlur(a,e,n,n,r,"longitudinal",s)}_halfBlur(e,t,n,r,s,a,o){const l=this._renderer,c=this._blurMaterial;a!=="latitudinal"&&a!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");const u=3,d=new bt(this._lodPlanes[r],c),h=c.uniforms,f=this._sizeLods[n]-1,g=isFinite(s)?Math.PI/(2*f):2*Math.PI/(2*Cn-1),_=s/g,m=isFinite(s)?1+Math.floor(u*_):Cn;m>Cn&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${m} samples when the maximum is set to ${Cn}`);const p=[];let E=0;for(let A=0;A<Cn;++A){const P=A/_,S=Math.exp(-P*P/2);p.push(S),A===0?E+=S:A<m&&(E+=2*S)}for(let A=0;A<p.length;A++)p[A]=p[A]/E;h.envMap.value=e.texture,h.samples.value=m,h.weights.value=p,h.latitudinal.value=a==="latitudinal",o&&(h.poleAxis.value=o);const{_lodMax:v}=this;h.dTheta.value=g,h.mipInt.value=v-n;const b=this._sizeLods[r],R=3*b*(r>v-li?r-v+li:0),T=4*(this._cubeSize-b);pr(t,R,T,3*b,2*b),l.setRenderTarget(t),l.render(d,xs)}}function Bp(i){const e=[],t=[],n=[];let r=i;const s=i-li+1+To.length;for(let a=0;a<s;a++){const o=Math.pow(2,r);t.push(o);let l=1/o;a>i-li?l=To[a-i+li-1]:a===0&&(l=0),n.push(l);const c=1/(o-2),u=-c,d=1+c,h=[u,u,d,u,d,d,u,u,d,d,u,d],f=6,g=6,_=3,m=2,p=1,E=new Float32Array(_*g*f),v=new Float32Array(m*g*f),b=new Float32Array(p*g*f);for(let T=0;T<f;T++){const A=T%3*2/3-1,P=T>2?0:-1,S=[A,P,0,A+2/3,P,0,A+2/3,P+1,0,A,P,0,A+2/3,P+1,0,A,P+1,0];E.set(S,_*g*T),v.set(h,m*g*T);const M=[T,T,T,T,T,T];b.set(M,p*g*T)}const R=new _t;R.setAttribute("position",new Et(E,_)),R.setAttribute("uv",new Et(v,m)),R.setAttribute("faceIndex",new Et(b,p)),e.push(R),r>li&&r--}return{lodPlanes:e,sizeLods:t,sigmas:n}}function Co(i,e,t){const n=new Vt(i,e,t);return n.texture.mapping=Ur,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function pr(i,e,t,n,r){i.viewport.set(e,t,n,r),i.scissor.set(e,t,n,r)}function zp(i,e,t){const n=new Float32Array(Cn),r=new I(0,1,0);return new ft({name:"SphericalGaussianBlur",defines:{n:Cn,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${i}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:ia(),fragmentShader:`
3550
3550
 
3551
3551
  precision mediump float;
3552
3552
  precision mediump int;
@@ -3606,7 +3606,7 @@ void main() {
3606
3606
  }
3607
3607
 
3608
3608
  }
3609
- `,blending:en,depthTest:!1,depthWrite:!1})}function Ro(){return new ft({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:na(),fragmentShader:`
3609
+ `,blending:en,depthTest:!1,depthWrite:!1})}function Ro(){return new ft({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:ia(),fragmentShader:`
3610
3610
 
3611
3611
  precision mediump float;
3612
3612
  precision mediump int;
@@ -3625,7 +3625,7 @@ void main() {
3625
3625
  gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
3626
3626
 
3627
3627
  }
3628
- `,blending:en,depthTest:!1,depthWrite:!1})}function Po(){return new ft({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:na(),fragmentShader:`
3628
+ `,blending:en,depthTest:!1,depthWrite:!1})}function Po(){return new ft({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:ia(),fragmentShader:`
3629
3629
 
3630
3630
  precision mediump float;
3631
3631
  precision mediump int;
@@ -3641,7 +3641,7 @@ void main() {
3641
3641
  gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
3642
3642
 
3643
3643
  }
3644
- `,blending:en,depthTest:!1,depthWrite:!1})}function na(){return`
3644
+ `,blending:en,depthTest:!1,depthWrite:!1})}function ia(){return`
3645
3645
 
3646
3646
  precision mediump float;
3647
3647
  precision mediump int;
@@ -3696,15 +3696,15 @@ void main() {
3696
3696
  gl_Position = vec4( position, 1.0 );
3697
3697
 
3698
3698
  }
3699
- `}function kp(i){let e=new WeakMap,t=null;function n(o){if(o&&o.isTexture){const l=o.mapping,c=l===Hs||l===Vs,u=l===pi||l===mi;if(c||u){let d=e.get(o);const h=d!==void 0?d.texture.pmremVersion:0;if(o.isRenderTargetTexture&&o.pmremVersion!==h)return t===null&&(t=new wo(i)),d=c?t.fromEquirectangular(o,d):t.fromCubemap(o,d),d.texture.pmremVersion=o.pmremVersion,e.set(o,d),d.texture;if(d!==void 0)return d.texture;{const f=o.image;return c&&f&&f.height>0||u&&f&&r(f)?(t===null&&(t=new wo(i)),d=c?t.fromEquirectangular(o):t.fromCubemap(o),d.texture.pmremVersion=o.pmremVersion,e.set(o,d),o.addEventListener("dispose",s),d.texture):null}}}return o}function r(o){let l=0;const c=6;for(let u=0;u<c;u++)o[u]!==void 0&&l++;return l===c}function s(o){const l=o.target;l.removeEventListener("dispose",s);const c=e.get(l);c!==void 0&&(e.delete(l),c.dispose())}function a(){e=new WeakMap,t!==null&&(t.dispose(),t=null)}return{get:n,dispose:a}}function Hp(i){const e={};function t(n){if(e[n]!==void 0)return e[n];let r;switch(n){case"WEBGL_depth_texture":r=i.getExtension("WEBGL_depth_texture")||i.getExtension("MOZ_WEBGL_depth_texture")||i.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":r=i.getExtension("EXT_texture_filter_anisotropic")||i.getExtension("MOZ_EXT_texture_filter_anisotropic")||i.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":r=i.getExtension("WEBGL_compressed_texture_s3tc")||i.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||i.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":r=i.getExtension("WEBGL_compressed_texture_pvrtc")||i.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:r=i.getExtension(n)}return e[n]=r,r}return{has:function(n){return t(n)!==null},init:function(){t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance"),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture"),t("WEBGL_render_shared_exponent")},get:function(n){const r=t(n);return r===null&&console.warn("THREE.WebGLRenderer: "+n+" extension not supported."),r}}}function Vp(i,e,t,n){const r={},s=new WeakMap;function a(d){const h=d.target;h.index!==null&&e.remove(h.index);for(const g in h.attributes)e.remove(h.attributes[g]);for(const g in h.morphAttributes){const _=h.morphAttributes[g];for(let m=0,p=_.length;m<p;m++)e.remove(_[m])}h.removeEventListener("dispose",a),delete r[h.id];const f=s.get(h);f&&(e.remove(f),s.delete(h)),n.releaseStatesOfGeometry(h),h.isInstancedBufferGeometry===!0&&delete h._maxInstanceCount,t.memory.geometries--}function o(d,h){return r[h.id]===!0||(h.addEventListener("dispose",a),r[h.id]=!0,t.memory.geometries++),h}function l(d){const h=d.attributes;for(const g in h)e.update(h[g],i.ARRAY_BUFFER);const f=d.morphAttributes;for(const g in f){const _=f[g];for(let m=0,p=_.length;m<p;m++)e.update(_[m],i.ARRAY_BUFFER)}}function c(d){const h=[],f=d.index,g=d.attributes.position;let _=0;if(f!==null){const E=f.array;_=f.version;for(let v=0,b=E.length;v<b;v+=3){const R=E[v+0],T=E[v+1],A=E[v+2];h.push(R,T,T,A,A,R)}}else if(g!==void 0){const E=g.array;_=g.version;for(let v=0,b=E.length/3-1;v<b;v+=3){const R=v+0,T=v+1,A=v+2;h.push(R,T,T,A,A,R)}}else return;const m=new(Wl(h)?Zl:Kl)(h,1);m.version=_;const p=s.get(d);p&&e.remove(p),s.set(d,m)}function u(d){const h=s.get(d);if(h){const f=d.index;f!==null&&h.version<f.version&&c(d)}else c(d);return s.get(d)}return{get:o,update:l,getWireframeAttribute:u}}function Gp(i,e,t){let n;function r(d){n=d}let s,a;function o(d){s=d.type,a=d.bytesPerElement}function l(d,h){i.drawElements(n,h,s,d*a),t.update(h,n,1)}function c(d,h,f){f!==0&&(i.drawElementsInstanced(n,h,s,d*a,f),t.update(h,n,f))}function u(d,h,f){if(f===0)return;const g=e.get("WEBGL_multi_draw");if(g===null)for(let _=0;_<f;_++)this.render(d[_]/a,h[_]);else{g.multiDrawElementsWEBGL(n,h,0,s,d,0,f);let _=0;for(let m=0;m<f;m++)_+=h[m];t.update(_,n,1)}}this.setMode=r,this.setIndex=o,this.render=l,this.renderInstances=c,this.renderMultiDraw=u}function Wp(i){const e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function n(s,a,o){switch(t.calls++,a){case i.TRIANGLES:t.triangles+=o*(s/3);break;case i.LINES:t.lines+=o*(s/2);break;case i.LINE_STRIP:t.lines+=o*(s-1);break;case i.LINE_LOOP:t.lines+=o*s;break;case i.POINTS:t.points+=o*s;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",a);break}}function r(){t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:r,update:n}}function Xp(i,e,t){const n=new WeakMap,r=new dt;function s(a,o,l){const c=a.morphTargetInfluences,u=o.morphAttributes.position||o.morphAttributes.normal||o.morphAttributes.color,d=u!==void 0?u.length:0;let h=n.get(o);if(h===void 0||h.count!==d){let y=function(){A.dispose(),n.delete(o),o.removeEventListener("dispose",y)};h!==void 0&&h.texture.dispose();const f=o.morphAttributes.position!==void 0,g=o.morphAttributes.normal!==void 0,_=o.morphAttributes.color!==void 0,m=o.morphAttributes.position||[],p=o.morphAttributes.normal||[],E=o.morphAttributes.color||[];let v=0;f===!0&&(v=1),g===!0&&(v=2),_===!0&&(v=3);let b=o.attributes.position.count*v,R=1;b>e.maxTextureSize&&(R=Math.ceil(b/e.maxTextureSize),b=e.maxTextureSize);const T=new Float32Array(b*R*4*d),A=new ql(T,b,R,d);A.type=fn,A.needsUpdate=!0;const P=v*4;for(let M=0;M<d;M++){const F=m[M],L=p[M],C=E[M],U=b*R*4*M;for(let H=0;H<F.count;H++){const Y=H*P;f===!0&&(r.fromBufferAttribute(F,H),T[U+Y+0]=r.x,T[U+Y+1]=r.y,T[U+Y+2]=r.z,T[U+Y+3]=0),g===!0&&(r.fromBufferAttribute(L,H),T[U+Y+4]=r.x,T[U+Y+5]=r.y,T[U+Y+6]=r.z,T[U+Y+7]=0),_===!0&&(r.fromBufferAttribute(C,H),T[U+Y+8]=r.x,T[U+Y+9]=r.y,T[U+Y+10]=r.z,T[U+Y+11]=C.itemSize===4?r.w:1)}}h={count:d,texture:A,size:new ue(b,R)},n.set(o,h),o.addEventListener("dispose",y)}if(a.isInstancedMesh===!0&&a.morphTexture!==null)l.getUniforms().setValue(i,"morphTexture",a.morphTexture,t);else{let f=0;for(let _=0;_<c.length;_++)f+=c[_];const g=o.morphTargetsRelative?1:1-f;l.getUniforms().setValue(i,"morphTargetBaseInfluence",g),l.getUniforms().setValue(i,"morphTargetInfluences",c)}l.getUniforms().setValue(i,"morphTargetsTexture",h.texture,t),l.getUniforms().setValue(i,"morphTargetsTextureSize",h.size)}return{update:s}}function qp(i,e,t,n){let r=new WeakMap;function s(l){const c=n.render.frame,u=l.geometry,d=e.get(l,u);if(r.get(d)!==c&&(e.update(d),r.set(d,c)),l.isInstancedMesh&&(l.hasEventListener("dispose",o)===!1&&l.addEventListener("dispose",o),r.get(l)!==c&&(t.update(l.instanceMatrix,i.ARRAY_BUFFER),l.instanceColor!==null&&t.update(l.instanceColor,i.ARRAY_BUFFER),r.set(l,c))),l.isSkinnedMesh){const h=l.skeleton;r.get(h)!==c&&(h.update(),r.set(h,c))}return d}function a(){r=new WeakMap}function o(l){const c=l.target;c.removeEventListener("dispose",o),t.remove(c.instanceMatrix),c.instanceColor!==null&&t.remove(c.instanceColor)}return{update:s,dispose:a}}class rc extends Tt{constructor(e,t,n,r,s,a,o,l,c,u){if(u=u!==void 0?u:hi,u!==hi&&u!==Ni)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");n===void 0&&u===hi&&(n=gi),n===void 0&&u===Ni&&(n=zi),super(null,r,s,a,o,l,u,n,c),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=o!==void 0?o:Ut,this.minFilter=l!==void 0?l:Ut,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}const sc=new Tt,ac=new rc(1,1);ac.compareFunction=Vl;const oc=new ql,lc=new Ph,cc=new ec,Lo=[],Fo=[],Io=new Float32Array(16),Uo=new Float32Array(9),No=new Float32Array(4);function Mi(i,e,t){const n=i[0];if(n<=0||n>0)return i;const r=e*t;let s=Lo[r];if(s===void 0&&(s=new Float32Array(r),Lo[r]=s),e!==0){n.toArray(s,0);for(let a=1,o=0;a!==e;++a)o+=t,i[a].toArray(s,o)}return s}function at(i,e){if(i.length!==e.length)return!1;for(let t=0,n=i.length;t<n;t++)if(i[t]!==e[t])return!1;return!0}function ot(i,e){for(let t=0,n=e.length;t<n;t++)i[t]=e[t]}function kr(i,e){let t=Fo[e];t===void 0&&(t=new Int32Array(e),Fo[e]=t);for(let n=0;n!==e;++n)t[n]=i.allocateTextureUnit();return t}function Yp(i,e){const t=this.cache;t[0]!==e&&(i.uniform1f(this.addr,e),t[0]=e)}function $p(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(at(t,e))return;i.uniform2fv(this.addr,e),ot(t,e)}}function jp(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3f(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else if(e.r!==void 0)(t[0]!==e.r||t[1]!==e.g||t[2]!==e.b)&&(i.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(at(t,e))return;i.uniform3fv(this.addr,e),ot(t,e)}}function Kp(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(i.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(at(t,e))return;i.uniform4fv(this.addr,e),ot(t,e)}}function Zp(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(at(t,e))return;i.uniformMatrix2fv(this.addr,!1,e),ot(t,e)}else{if(at(t,n))return;No.set(n),i.uniformMatrix2fv(this.addr,!1,No),ot(t,n)}}function Jp(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(at(t,e))return;i.uniformMatrix3fv(this.addr,!1,e),ot(t,e)}else{if(at(t,n))return;Uo.set(n),i.uniformMatrix3fv(this.addr,!1,Uo),ot(t,n)}}function Qp(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(at(t,e))return;i.uniformMatrix4fv(this.addr,!1,e),ot(t,e)}else{if(at(t,n))return;Io.set(n),i.uniformMatrix4fv(this.addr,!1,Io),ot(t,n)}}function em(i,e){const t=this.cache;t[0]!==e&&(i.uniform1i(this.addr,e),t[0]=e)}function tm(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(at(t,e))return;i.uniform2iv(this.addr,e),ot(t,e)}}function nm(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(at(t,e))return;i.uniform3iv(this.addr,e),ot(t,e)}}function im(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(i.uniform4i(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(at(t,e))return;i.uniform4iv(this.addr,e),ot(t,e)}}function rm(i,e){const t=this.cache;t[0]!==e&&(i.uniform1ui(this.addr,e),t[0]=e)}function sm(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(at(t,e))return;i.uniform2uiv(this.addr,e),ot(t,e)}}function am(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(at(t,e))return;i.uniform3uiv(this.addr,e),ot(t,e)}}function om(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(i.uniform4ui(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(at(t,e))return;i.uniform4uiv(this.addr,e),ot(t,e)}}function lm(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r);const s=this.type===i.SAMPLER_2D_SHADOW?ac:sc;t.setTexture2D(e||s,r)}function cm(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTexture3D(e||lc,r)}function um(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTextureCube(e||cc,r)}function hm(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTexture2DArray(e||oc,r)}function dm(i){switch(i){case 5126:return Yp;case 35664:return $p;case 35665:return jp;case 35666:return Kp;case 35674:return Zp;case 35675:return Jp;case 35676:return Qp;case 5124:case 35670:return em;case 35667:case 35671:return tm;case 35668:case 35672:return nm;case 35669:case 35673:return im;case 5125:return rm;case 36294:return sm;case 36295:return am;case 36296:return om;case 35678:case 36198:case 36298:case 36306:case 35682:return lm;case 35679:case 36299:case 36307:return cm;case 35680:case 36300:case 36308:case 36293:return um;case 36289:case 36303:case 36311:case 36292:return hm}}function fm(i,e){i.uniform1fv(this.addr,e)}function pm(i,e){const t=Mi(e,this.size,2);i.uniform2fv(this.addr,t)}function mm(i,e){const t=Mi(e,this.size,3);i.uniform3fv(this.addr,t)}function gm(i,e){const t=Mi(e,this.size,4);i.uniform4fv(this.addr,t)}function _m(i,e){const t=Mi(e,this.size,4);i.uniformMatrix2fv(this.addr,!1,t)}function xm(i,e){const t=Mi(e,this.size,9);i.uniformMatrix3fv(this.addr,!1,t)}function vm(i,e){const t=Mi(e,this.size,16);i.uniformMatrix4fv(this.addr,!1,t)}function Mm(i,e){i.uniform1iv(this.addr,e)}function Sm(i,e){i.uniform2iv(this.addr,e)}function ym(i,e){i.uniform3iv(this.addr,e)}function Em(i,e){i.uniform4iv(this.addr,e)}function bm(i,e){i.uniform1uiv(this.addr,e)}function Tm(i,e){i.uniform2uiv(this.addr,e)}function Dm(i,e){i.uniform3uiv(this.addr,e)}function Am(i,e){i.uniform4uiv(this.addr,e)}function wm(i,e,t){const n=this.cache,r=e.length,s=kr(t,r);at(n,s)||(i.uniform1iv(this.addr,s),ot(n,s));for(let a=0;a!==r;++a)t.setTexture2D(e[a]||sc,s[a])}function Cm(i,e,t){const n=this.cache,r=e.length,s=kr(t,r);at(n,s)||(i.uniform1iv(this.addr,s),ot(n,s));for(let a=0;a!==r;++a)t.setTexture3D(e[a]||lc,s[a])}function Rm(i,e,t){const n=this.cache,r=e.length,s=kr(t,r);at(n,s)||(i.uniform1iv(this.addr,s),ot(n,s));for(let a=0;a!==r;++a)t.setTextureCube(e[a]||cc,s[a])}function Pm(i,e,t){const n=this.cache,r=e.length,s=kr(t,r);at(n,s)||(i.uniform1iv(this.addr,s),ot(n,s));for(let a=0;a!==r;++a)t.setTexture2DArray(e[a]||oc,s[a])}function Lm(i){switch(i){case 5126:return fm;case 35664:return pm;case 35665:return mm;case 35666:return gm;case 35674:return _m;case 35675:return xm;case 35676:return vm;case 5124:case 35670:return Mm;case 35667:case 35671:return Sm;case 35668:case 35672:return ym;case 35669:case 35673:return Em;case 5125:return bm;case 36294:return Tm;case 36295:return Dm;case 36296:return Am;case 35678:case 36198:case 36298:case 36306:case 35682:return wm;case 35679:case 36299:case 36307:return Cm;case 35680:case 36300:case 36308:case 36293:return Rm;case 36289:case 36303:case 36311:case 36292:return Pm}}class Fm{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=dm(t.type)}}class Im{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=Lm(t.type)}}class Um{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,n){const r=this.seq;for(let s=0,a=r.length;s!==a;++s){const o=r[s];o.setValue(e,t[o.id],n)}}}const ys=/(\w+)(\])?(\[|\.)?/g;function Oo(i,e){i.seq.push(e),i.map[e.id]=e}function Nm(i,e,t){const n=i.name,r=n.length;for(ys.lastIndex=0;;){const s=ys.exec(n),a=ys.lastIndex;let o=s[1];const l=s[2]==="]",c=s[3];if(l&&(o=o|0),c===void 0||c==="["&&a+2===r){Oo(t,c===void 0?new Fm(o,i,e):new Im(o,i,e));break}else{let d=t.map[o];d===void 0&&(d=new Um(o),Oo(t,d)),t=d}}}class Tr{constructor(e,t){this.seq=[],this.map={};const n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let r=0;r<n;++r){const s=e.getActiveUniform(t,r),a=e.getUniformLocation(t,s.name);Nm(s,a,this)}}setValue(e,t,n,r){const s=this.map[t];s!==void 0&&s.setValue(e,n,r)}setOptional(e,t,n){const r=t[n];r!==void 0&&this.setValue(e,n,r)}static upload(e,t,n,r){for(let s=0,a=t.length;s!==a;++s){const o=t[s],l=n[o.id];l.needsUpdate!==!1&&o.setValue(e,l.value,r)}}static seqWithValue(e,t){const n=[];for(let r=0,s=e.length;r!==s;++r){const a=e[r];a.id in t&&n.push(a)}return n}}function Bo(i,e,t){const n=i.createShader(e);return i.shaderSource(n,t),i.compileShader(n),n}const Om=37297;let Bm=0;function zm(i,e){const t=i.split(`
3699
+ `}function kp(i){let e=new WeakMap,t=null;function n(o){if(o&&o.isTexture){const l=o.mapping,c=l===Hs||l===Gs,u=l===pi||l===mi;if(c||u){let d=e.get(o);const h=d!==void 0?d.texture.pmremVersion:0;if(o.isRenderTargetTexture&&o.pmremVersion!==h)return t===null&&(t=new wo(i)),d=c?t.fromEquirectangular(o,d):t.fromCubemap(o,d),d.texture.pmremVersion=o.pmremVersion,e.set(o,d),d.texture;if(d!==void 0)return d.texture;{const f=o.image;return c&&f&&f.height>0||u&&f&&r(f)?(t===null&&(t=new wo(i)),d=c?t.fromEquirectangular(o):t.fromCubemap(o),d.texture.pmremVersion=o.pmremVersion,e.set(o,d),o.addEventListener("dispose",s),d.texture):null}}}return o}function r(o){let l=0;const c=6;for(let u=0;u<c;u++)o[u]!==void 0&&l++;return l===c}function s(o){const l=o.target;l.removeEventListener("dispose",s);const c=e.get(l);c!==void 0&&(e.delete(l),c.dispose())}function a(){e=new WeakMap,t!==null&&(t.dispose(),t=null)}return{get:n,dispose:a}}function Vp(i){const e={};function t(n){if(e[n]!==void 0)return e[n];let r;switch(n){case"WEBGL_depth_texture":r=i.getExtension("WEBGL_depth_texture")||i.getExtension("MOZ_WEBGL_depth_texture")||i.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":r=i.getExtension("EXT_texture_filter_anisotropic")||i.getExtension("MOZ_EXT_texture_filter_anisotropic")||i.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":r=i.getExtension("WEBGL_compressed_texture_s3tc")||i.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||i.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":r=i.getExtension("WEBGL_compressed_texture_pvrtc")||i.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:r=i.getExtension(n)}return e[n]=r,r}return{has:function(n){return t(n)!==null},init:function(){t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance"),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture"),t("WEBGL_render_shared_exponent")},get:function(n){const r=t(n);return r===null&&console.warn("THREE.WebGLRenderer: "+n+" extension not supported."),r}}}function Hp(i,e,t,n){const r={},s=new WeakMap;function a(d){const h=d.target;h.index!==null&&e.remove(h.index);for(const g in h.attributes)e.remove(h.attributes[g]);for(const g in h.morphAttributes){const _=h.morphAttributes[g];for(let m=0,p=_.length;m<p;m++)e.remove(_[m])}h.removeEventListener("dispose",a),delete r[h.id];const f=s.get(h);f&&(e.remove(f),s.delete(h)),n.releaseStatesOfGeometry(h),h.isInstancedBufferGeometry===!0&&delete h._maxInstanceCount,t.memory.geometries--}function o(d,h){return r[h.id]===!0||(h.addEventListener("dispose",a),r[h.id]=!0,t.memory.geometries++),h}function l(d){const h=d.attributes;for(const g in h)e.update(h[g],i.ARRAY_BUFFER);const f=d.morphAttributes;for(const g in f){const _=f[g];for(let m=0,p=_.length;m<p;m++)e.update(_[m],i.ARRAY_BUFFER)}}function c(d){const h=[],f=d.index,g=d.attributes.position;let _=0;if(f!==null){const E=f.array;_=f.version;for(let v=0,b=E.length;v<b;v+=3){const R=E[v+0],T=E[v+1],A=E[v+2];h.push(R,T,T,A,A,R)}}else if(g!==void 0){const E=g.array;_=g.version;for(let v=0,b=E.length/3-1;v<b;v+=3){const R=v+0,T=v+1,A=v+2;h.push(R,T,T,A,A,R)}}else return;const m=new(Wl(h)?Zl:Kl)(h,1);m.version=_;const p=s.get(d);p&&e.remove(p),s.set(d,m)}function u(d){const h=s.get(d);if(h){const f=d.index;f!==null&&h.version<f.version&&c(d)}else c(d);return s.get(d)}return{get:o,update:l,getWireframeAttribute:u}}function Gp(i,e,t){let n;function r(d){n=d}let s,a;function o(d){s=d.type,a=d.bytesPerElement}function l(d,h){i.drawElements(n,h,s,d*a),t.update(h,n,1)}function c(d,h,f){f!==0&&(i.drawElementsInstanced(n,h,s,d*a,f),t.update(h,n,f))}function u(d,h,f){if(f===0)return;const g=e.get("WEBGL_multi_draw");if(g===null)for(let _=0;_<f;_++)this.render(d[_]/a,h[_]);else{g.multiDrawElementsWEBGL(n,h,0,s,d,0,f);let _=0;for(let m=0;m<f;m++)_+=h[m];t.update(_,n,1)}}this.setMode=r,this.setIndex=o,this.render=l,this.renderInstances=c,this.renderMultiDraw=u}function Wp(i){const e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function n(s,a,o){switch(t.calls++,a){case i.TRIANGLES:t.triangles+=o*(s/3);break;case i.LINES:t.lines+=o*(s/2);break;case i.LINE_STRIP:t.lines+=o*(s-1);break;case i.LINE_LOOP:t.lines+=o*s;break;case i.POINTS:t.points+=o*s;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",a);break}}function r(){t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:r,update:n}}function Xp(i,e,t){const n=new WeakMap,r=new dt;function s(a,o,l){const c=a.morphTargetInfluences,u=o.morphAttributes.position||o.morphAttributes.normal||o.morphAttributes.color,d=u!==void 0?u.length:0;let h=n.get(o);if(h===void 0||h.count!==d){let S=function(){A.dispose(),n.delete(o),o.removeEventListener("dispose",S)};h!==void 0&&h.texture.dispose();const f=o.morphAttributes.position!==void 0,g=o.morphAttributes.normal!==void 0,_=o.morphAttributes.color!==void 0,m=o.morphAttributes.position||[],p=o.morphAttributes.normal||[],E=o.morphAttributes.color||[];let v=0;f===!0&&(v=1),g===!0&&(v=2),_===!0&&(v=3);let b=o.attributes.position.count*v,R=1;b>e.maxTextureSize&&(R=Math.ceil(b/e.maxTextureSize),b=e.maxTextureSize);const T=new Float32Array(b*R*4*d),A=new ql(T,b,R,d);A.type=fn,A.needsUpdate=!0;const P=v*4;for(let M=0;M<d;M++){const F=m[M],L=p[M],C=E[M],N=b*R*4*M;for(let V=0;V<F.count;V++){const j=V*P;f===!0&&(r.fromBufferAttribute(F,V),T[N+j+0]=r.x,T[N+j+1]=r.y,T[N+j+2]=r.z,T[N+j+3]=0),g===!0&&(r.fromBufferAttribute(L,V),T[N+j+4]=r.x,T[N+j+5]=r.y,T[N+j+6]=r.z,T[N+j+7]=0),_===!0&&(r.fromBufferAttribute(C,V),T[N+j+8]=r.x,T[N+j+9]=r.y,T[N+j+10]=r.z,T[N+j+11]=C.itemSize===4?r.w:1)}}h={count:d,texture:A,size:new ue(b,R)},n.set(o,h),o.addEventListener("dispose",S)}if(a.isInstancedMesh===!0&&a.morphTexture!==null)l.getUniforms().setValue(i,"morphTexture",a.morphTexture,t);else{let f=0;for(let _=0;_<c.length;_++)f+=c[_];const g=o.morphTargetsRelative?1:1-f;l.getUniforms().setValue(i,"morphTargetBaseInfluence",g),l.getUniforms().setValue(i,"morphTargetInfluences",c)}l.getUniforms().setValue(i,"morphTargetsTexture",h.texture,t),l.getUniforms().setValue(i,"morphTargetsTextureSize",h.size)}return{update:s}}function qp(i,e,t,n){let r=new WeakMap;function s(l){const c=n.render.frame,u=l.geometry,d=e.get(l,u);if(r.get(d)!==c&&(e.update(d),r.set(d,c)),l.isInstancedMesh&&(l.hasEventListener("dispose",o)===!1&&l.addEventListener("dispose",o),r.get(l)!==c&&(t.update(l.instanceMatrix,i.ARRAY_BUFFER),l.instanceColor!==null&&t.update(l.instanceColor,i.ARRAY_BUFFER),r.set(l,c))),l.isSkinnedMesh){const h=l.skeleton;r.get(h)!==c&&(h.update(),r.set(h,c))}return d}function a(){r=new WeakMap}function o(l){const c=l.target;c.removeEventListener("dispose",o),t.remove(c.instanceMatrix),c.instanceColor!==null&&t.remove(c.instanceColor)}return{update:s,dispose:a}}class rc extends Tt{constructor(e,t,n,r,s,a,o,l,c,u){if(u=u!==void 0?u:hi,u!==hi&&u!==Ui)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");n===void 0&&u===hi&&(n=gi),n===void 0&&u===Ui&&(n=zi),super(null,r,s,a,o,l,u,n,c),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=o!==void 0?o:Nt,this.minFilter=l!==void 0?l:Nt,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}const sc=new Tt,ac=new rc(1,1);ac.compareFunction=Hl;const oc=new ql,lc=new Ph,cc=new ec,Lo=[],Fo=[],Io=new Float32Array(16),No=new Float32Array(9),Uo=new Float32Array(4);function Mi(i,e,t){const n=i[0];if(n<=0||n>0)return i;const r=e*t;let s=Lo[r];if(s===void 0&&(s=new Float32Array(r),Lo[r]=s),e!==0){n.toArray(s,0);for(let a=1,o=0;a!==e;++a)o+=t,i[a].toArray(s,o)}return s}function at(i,e){if(i.length!==e.length)return!1;for(let t=0,n=i.length;t<n;t++)if(i[t]!==e[t])return!1;return!0}function ot(i,e){for(let t=0,n=e.length;t<n;t++)i[t]=e[t]}function kr(i,e){let t=Fo[e];t===void 0&&(t=new Int32Array(e),Fo[e]=t);for(let n=0;n!==e;++n)t[n]=i.allocateTextureUnit();return t}function jp(i,e){const t=this.cache;t[0]!==e&&(i.uniform1f(this.addr,e),t[0]=e)}function $p(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(at(t,e))return;i.uniform2fv(this.addr,e),ot(t,e)}}function Yp(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3f(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else if(e.r!==void 0)(t[0]!==e.r||t[1]!==e.g||t[2]!==e.b)&&(i.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(at(t,e))return;i.uniform3fv(this.addr,e),ot(t,e)}}function Kp(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(i.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(at(t,e))return;i.uniform4fv(this.addr,e),ot(t,e)}}function Zp(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(at(t,e))return;i.uniformMatrix2fv(this.addr,!1,e),ot(t,e)}else{if(at(t,n))return;Uo.set(n),i.uniformMatrix2fv(this.addr,!1,Uo),ot(t,n)}}function Jp(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(at(t,e))return;i.uniformMatrix3fv(this.addr,!1,e),ot(t,e)}else{if(at(t,n))return;No.set(n),i.uniformMatrix3fv(this.addr,!1,No),ot(t,n)}}function Qp(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(at(t,e))return;i.uniformMatrix4fv(this.addr,!1,e),ot(t,e)}else{if(at(t,n))return;Io.set(n),i.uniformMatrix4fv(this.addr,!1,Io),ot(t,n)}}function em(i,e){const t=this.cache;t[0]!==e&&(i.uniform1i(this.addr,e),t[0]=e)}function tm(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(at(t,e))return;i.uniform2iv(this.addr,e),ot(t,e)}}function nm(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(at(t,e))return;i.uniform3iv(this.addr,e),ot(t,e)}}function im(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(i.uniform4i(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(at(t,e))return;i.uniform4iv(this.addr,e),ot(t,e)}}function rm(i,e){const t=this.cache;t[0]!==e&&(i.uniform1ui(this.addr,e),t[0]=e)}function sm(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(at(t,e))return;i.uniform2uiv(this.addr,e),ot(t,e)}}function am(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(at(t,e))return;i.uniform3uiv(this.addr,e),ot(t,e)}}function om(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(i.uniform4ui(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(at(t,e))return;i.uniform4uiv(this.addr,e),ot(t,e)}}function lm(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r);const s=this.type===i.SAMPLER_2D_SHADOW?ac:sc;t.setTexture2D(e||s,r)}function cm(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTexture3D(e||lc,r)}function um(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTextureCube(e||cc,r)}function hm(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTexture2DArray(e||oc,r)}function dm(i){switch(i){case 5126:return jp;case 35664:return $p;case 35665:return Yp;case 35666:return Kp;case 35674:return Zp;case 35675:return Jp;case 35676:return Qp;case 5124:case 35670:return em;case 35667:case 35671:return tm;case 35668:case 35672:return nm;case 35669:case 35673:return im;case 5125:return rm;case 36294:return sm;case 36295:return am;case 36296:return om;case 35678:case 36198:case 36298:case 36306:case 35682:return lm;case 35679:case 36299:case 36307:return cm;case 35680:case 36300:case 36308:case 36293:return um;case 36289:case 36303:case 36311:case 36292:return hm}}function fm(i,e){i.uniform1fv(this.addr,e)}function pm(i,e){const t=Mi(e,this.size,2);i.uniform2fv(this.addr,t)}function mm(i,e){const t=Mi(e,this.size,3);i.uniform3fv(this.addr,t)}function gm(i,e){const t=Mi(e,this.size,4);i.uniform4fv(this.addr,t)}function _m(i,e){const t=Mi(e,this.size,4);i.uniformMatrix2fv(this.addr,!1,t)}function xm(i,e){const t=Mi(e,this.size,9);i.uniformMatrix3fv(this.addr,!1,t)}function vm(i,e){const t=Mi(e,this.size,16);i.uniformMatrix4fv(this.addr,!1,t)}function Mm(i,e){i.uniform1iv(this.addr,e)}function ym(i,e){i.uniform2iv(this.addr,e)}function Sm(i,e){i.uniform3iv(this.addr,e)}function Em(i,e){i.uniform4iv(this.addr,e)}function bm(i,e){i.uniform1uiv(this.addr,e)}function Tm(i,e){i.uniform2uiv(this.addr,e)}function Dm(i,e){i.uniform3uiv(this.addr,e)}function Am(i,e){i.uniform4uiv(this.addr,e)}function wm(i,e,t){const n=this.cache,r=e.length,s=kr(t,r);at(n,s)||(i.uniform1iv(this.addr,s),ot(n,s));for(let a=0;a!==r;++a)t.setTexture2D(e[a]||sc,s[a])}function Cm(i,e,t){const n=this.cache,r=e.length,s=kr(t,r);at(n,s)||(i.uniform1iv(this.addr,s),ot(n,s));for(let a=0;a!==r;++a)t.setTexture3D(e[a]||lc,s[a])}function Rm(i,e,t){const n=this.cache,r=e.length,s=kr(t,r);at(n,s)||(i.uniform1iv(this.addr,s),ot(n,s));for(let a=0;a!==r;++a)t.setTextureCube(e[a]||cc,s[a])}function Pm(i,e,t){const n=this.cache,r=e.length,s=kr(t,r);at(n,s)||(i.uniform1iv(this.addr,s),ot(n,s));for(let a=0;a!==r;++a)t.setTexture2DArray(e[a]||oc,s[a])}function Lm(i){switch(i){case 5126:return fm;case 35664:return pm;case 35665:return mm;case 35666:return gm;case 35674:return _m;case 35675:return xm;case 35676:return vm;case 5124:case 35670:return Mm;case 35667:case 35671:return ym;case 35668:case 35672:return Sm;case 35669:case 35673:return Em;case 5125:return bm;case 36294:return Tm;case 36295:return Dm;case 36296:return Am;case 35678:case 36198:case 36298:case 36306:case 35682:return wm;case 35679:case 36299:case 36307:return Cm;case 35680:case 36300:case 36308:case 36293:return Rm;case 36289:case 36303:case 36311:case 36292:return Pm}}class Fm{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=dm(t.type)}}class Im{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=Lm(t.type)}}class Nm{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,n){const r=this.seq;for(let s=0,a=r.length;s!==a;++s){const o=r[s];o.setValue(e,t[o.id],n)}}}const Es=/(\w+)(\])?(\[|\.)?/g;function Oo(i,e){i.seq.push(e),i.map[e.id]=e}function Um(i,e,t){const n=i.name,r=n.length;for(Es.lastIndex=0;;){const s=Es.exec(n),a=Es.lastIndex;let o=s[1];const l=s[2]==="]",c=s[3];if(l&&(o=o|0),c===void 0||c==="["&&a+2===r){Oo(t,c===void 0?new Fm(o,i,e):new Im(o,i,e));break}else{let d=t.map[o];d===void 0&&(d=new Nm(o),Oo(t,d)),t=d}}}class Tr{constructor(e,t){this.seq=[],this.map={};const n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let r=0;r<n;++r){const s=e.getActiveUniform(t,r),a=e.getUniformLocation(t,s.name);Um(s,a,this)}}setValue(e,t,n,r){const s=this.map[t];s!==void 0&&s.setValue(e,n,r)}setOptional(e,t,n){const r=t[n];r!==void 0&&this.setValue(e,n,r)}static upload(e,t,n,r){for(let s=0,a=t.length;s!==a;++s){const o=t[s],l=n[o.id];l.needsUpdate!==!1&&o.setValue(e,l.value,r)}}static seqWithValue(e,t){const n=[];for(let r=0,s=e.length;r!==s;++r){const a=e[r];a.id in t&&n.push(a)}return n}}function Bo(i,e,t){const n=i.createShader(e);return i.shaderSource(n,t),i.compileShader(n),n}const Om=37297;let Bm=0;function zm(i,e){const t=i.split(`
3700
3700
  `),n=[],r=Math.max(e-6,0),s=Math.min(e+6,t.length);for(let a=r;a<s;a++){const o=a+1;n.push(`${o===e?">":" "} ${o}: ${t[a]}`)}return n.join(`
3701
- `)}function km(i){const e=je.getPrimaries(je.workingColorSpace),t=je.getPrimaries(i);let n;switch(e===t?n="":e===Rr&&t===Cr?n="LinearDisplayP3ToLinearSRGB":e===Cr&&t===Rr&&(n="LinearSRGBToLinearDisplayP3"),i){case xn:case Or:return[n,"LinearTransferOETF"];case It:case ea:return[n,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",i),[n,"LinearTransferOETF"]}}function zo(i,e,t){const n=i.getShaderParameter(e,i.COMPILE_STATUS),r=i.getShaderInfoLog(e).trim();if(n&&r==="")return"";const s=/ERROR: 0:(\d+)/.exec(r);if(s){const a=parseInt(s[1]);return t.toUpperCase()+`
3701
+ `)}function km(i){const e=Ye.getPrimaries(Ye.workingColorSpace),t=Ye.getPrimaries(i);let n;switch(e===t?n="":e===Rr&&t===Cr?n="LinearDisplayP3ToLinearSRGB":e===Cr&&t===Rr&&(n="LinearSRGBToLinearDisplayP3"),i){case xn:case Or:return[n,"LinearTransferOETF"];case It:case ta:return[n,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",i),[n,"LinearTransferOETF"]}}function zo(i,e,t){const n=i.getShaderParameter(e,i.COMPILE_STATUS),r=i.getShaderInfoLog(e).trim();if(n&&r==="")return"";const s=/ERROR: 0:(\d+)/.exec(r);if(s){const a=parseInt(s[1]);return t.toUpperCase()+`
3702
3702
 
3703
3703
  `+r+`
3704
3704
 
3705
- `+zm(i.getShaderSource(e),a)}else return r}function Hm(i,e){const t=km(e);return`vec4 ${i}( vec4 value ) { return ${t[0]}( ${t[1]}( value ) ); }`}function Vm(i,e){let t;switch(e){case Iu:t="Linear";break;case Uu:t="Reinhard";break;case Nu:t="OptimizedCineon";break;case Qs:t="ACESFilmic";break;case Bu:t="AgX";break;case zu:t="Neutral";break;case Ou:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+i+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}function Gm(i){return[i.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",i.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Ri).join(`
3705
+ `+zm(i.getShaderSource(e),a)}else return r}function Vm(i,e){const t=km(e);return`vec4 ${i}( vec4 value ) { return ${t[0]}( ${t[1]}( value ) ); }`}function Hm(i,e){let t;switch(e){case Iu:t="Linear";break;case Nu:t="Reinhard";break;case Uu:t="OptimizedCineon";break;case ea:t="ACESFilmic";break;case Bu:t="AgX";break;case zu:t="Neutral";break;case Ou:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+i+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}function Gm(i){return[i.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",i.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Ri).join(`
3706
3706
  `)}function Wm(i){const e=[];for(const t in i){const n=i[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(`
3707
- `)}function Xm(i,e){const t={},n=i.getProgramParameter(e,i.ACTIVE_ATTRIBUTES);for(let r=0;r<n;r++){const s=i.getActiveAttrib(e,r),a=s.name;let o=1;s.type===i.FLOAT_MAT2&&(o=2),s.type===i.FLOAT_MAT3&&(o=3),s.type===i.FLOAT_MAT4&&(o=4),t[a]={type:s.type,location:i.getAttribLocation(e,a),locationSize:o}}return t}function Ri(i){return i!==""}function ko(i,e){const t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return i.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,t).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function Ho(i,e){return i.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const qm=/^[ \t]*#include +<([\w\d./]+)>/gm;function Xs(i){return i.replace(qm,$m)}const Ym=new Map([["encodings_fragment","colorspace_fragment"],["encodings_pars_fragment","colorspace_pars_fragment"],["output_fragment","opaque_fragment"]]);function $m(i,e){let t=Oe[e];if(t===void 0){const n=Ym.get(e);if(n!==void 0)t=Oe[n],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,n);else throw new Error("Can not resolve #include <"+e+">")}return Xs(t)}const jm=/#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 Vo(i){return i.replace(jm,Km)}function Km(i,e,t,n){let r="";for(let s=parseInt(e);s<parseInt(t);s++)r+=n.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return r}function Go(i){let e=`precision ${i.precision} float;
3707
+ `)}function Xm(i,e){const t={},n=i.getProgramParameter(e,i.ACTIVE_ATTRIBUTES);for(let r=0;r<n;r++){const s=i.getActiveAttrib(e,r),a=s.name;let o=1;s.type===i.FLOAT_MAT2&&(o=2),s.type===i.FLOAT_MAT3&&(o=3),s.type===i.FLOAT_MAT4&&(o=4),t[a]={type:s.type,location:i.getAttribLocation(e,a),locationSize:o}}return t}function Ri(i){return i!==""}function ko(i,e){const t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return i.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,t).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function Vo(i,e){return i.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const qm=/^[ \t]*#include +<([\w\d./]+)>/gm;function qs(i){return i.replace(qm,$m)}const jm=new Map([["encodings_fragment","colorspace_fragment"],["encodings_pars_fragment","colorspace_pars_fragment"],["output_fragment","opaque_fragment"]]);function $m(i,e){let t=Oe[e];if(t===void 0){const n=jm.get(e);if(n!==void 0)t=Oe[n],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,n);else throw new Error("Can not resolve #include <"+e+">")}return qs(t)}const Ym=/#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 Ho(i){return i.replace(Ym,Km)}function Km(i,e,t,n){let r="";for(let s=parseInt(e);s<parseInt(t);s++)r+=n.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return r}function Go(i){let e=`precision ${i.precision} float;
3708
3708
  precision ${i.precision} int;
3709
3709
  precision ${i.precision} sampler2D;
3710
3710
  precision ${i.precision} samplerCube;
@@ -3724,28 +3724,28 @@ void main() {
3724
3724
  `;return i.precision==="highp"?e+=`
3725
3725
  #define HIGH_PRECISION`:i.precision==="mediump"?e+=`
3726
3726
  #define MEDIUM_PRECISION`:i.precision==="lowp"&&(e+=`
3727
- #define LOW_PRECISION`),e}function Zm(i){let e="SHADOWMAP_TYPE_BASIC";return i.shadowMapType===Pl?e="SHADOWMAP_TYPE_PCF":i.shadowMapType===au?e="SHADOWMAP_TYPE_PCF_SOFT":i.shadowMapType===Jt&&(e="SHADOWMAP_TYPE_VSM"),e}function Jm(i){let e="ENVMAP_TYPE_CUBE";if(i.envMap)switch(i.envMapMode){case pi:case mi:e="ENVMAP_TYPE_CUBE";break;case Nr:e="ENVMAP_TYPE_CUBE_UV";break}return e}function Qm(i){let e="ENVMAP_MODE_REFLECTION";return i.envMap&&i.envMapMode===mi&&(e="ENVMAP_MODE_REFRACTION"),e}function e0(i){let e="ENVMAP_BLENDING_NONE";if(i.envMap)switch(i.combine){case Ll:e="ENVMAP_BLENDING_MULTIPLY";break;case Lu:e="ENVMAP_BLENDING_MIX";break;case Fu:e="ENVMAP_BLENDING_ADD";break}return e}function t0(i){const e=i.envMapCubeUVHeight;if(e===null)return null;const t=Math.log2(e)-2,n=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),112)),texelHeight:n,maxMip:t}}function n0(i,e,t,n){const r=i.getContext(),s=t.defines;let a=t.vertexShader,o=t.fragmentShader;const l=Zm(t),c=Jm(t),u=Qm(t),d=e0(t),h=t0(t),f=Gm(t),g=Wm(s),_=r.createProgram();let m,p,E=t.glslVersion?"#version "+t.glslVersion+`
3727
+ #define LOW_PRECISION`),e}function Zm(i){let e="SHADOWMAP_TYPE_BASIC";return i.shadowMapType===Pl?e="SHADOWMAP_TYPE_PCF":i.shadowMapType===au?e="SHADOWMAP_TYPE_PCF_SOFT":i.shadowMapType===Jt&&(e="SHADOWMAP_TYPE_VSM"),e}function Jm(i){let e="ENVMAP_TYPE_CUBE";if(i.envMap)switch(i.envMapMode){case pi:case mi:e="ENVMAP_TYPE_CUBE";break;case Ur:e="ENVMAP_TYPE_CUBE_UV";break}return e}function Qm(i){let e="ENVMAP_MODE_REFLECTION";return i.envMap&&i.envMapMode===mi&&(e="ENVMAP_MODE_REFRACTION"),e}function e0(i){let e="ENVMAP_BLENDING_NONE";if(i.envMap)switch(i.combine){case Ll:e="ENVMAP_BLENDING_MULTIPLY";break;case Lu:e="ENVMAP_BLENDING_MIX";break;case Fu:e="ENVMAP_BLENDING_ADD";break}return e}function t0(i){const e=i.envMapCubeUVHeight;if(e===null)return null;const t=Math.log2(e)-2,n=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),112)),texelHeight:n,maxMip:t}}function n0(i,e,t,n){const r=i.getContext(),s=t.defines;let a=t.vertexShader,o=t.fragmentShader;const l=Zm(t),c=Jm(t),u=Qm(t),d=e0(t),h=t0(t),f=Gm(t),g=Wm(s),_=r.createProgram();let m,p,E=t.glslVersion?"#version "+t.glslVersion+`
3728
3728
  `:"";t.isRawShaderMaterial?(m=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g].filter(Ri).join(`
3729
3729
  `),m.length>0&&(m+=`
3730
3730
  `),p=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g].filter(Ri).join(`
3731
3731
  `),p.length>0&&(p+=`
3732
3732
  `)):(m=[Go(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g,t.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+u:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.useLegacyLights?"#define LEGACY_LIGHTS":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","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","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#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",`
3733
3733
  `].filter(Ri).join(`
3734
- `),p=[Go(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+c:"",t.envMap?"#define "+u:"",t.envMap?"#define "+d:"",h?"#define CUBEUV_TEXEL_WIDTH "+h.texelWidth:"",h?"#define CUBEUV_TEXEL_HEIGHT "+h.texelHeight:"",h?"#define CUBEUV_MAX_MIP "+h.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.useLegacyLights?"#define LEGACY_LIGHTS":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==pn?"#define TONE_MAPPING":"",t.toneMapping!==pn?Oe.tonemapping_pars_fragment:"",t.toneMapping!==pn?Vm("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",Oe.colorspace_pars_fragment,Hm("linearToOutputTexel",t.outputColorSpace),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`
3734
+ `),p=[Go(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+c:"",t.envMap?"#define "+u:"",t.envMap?"#define "+d:"",h?"#define CUBEUV_TEXEL_WIDTH "+h.texelWidth:"",h?"#define CUBEUV_TEXEL_HEIGHT "+h.texelHeight:"",h?"#define CUBEUV_MAX_MIP "+h.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.useLegacyLights?"#define LEGACY_LIGHTS":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==pn?"#define TONE_MAPPING":"",t.toneMapping!==pn?Oe.tonemapping_pars_fragment:"",t.toneMapping!==pn?Hm("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",Oe.colorspace_pars_fragment,Vm("linearToOutputTexel",t.outputColorSpace),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`
3735
3735
  `].filter(Ri).join(`
3736
- `)),a=Xs(a),a=ko(a,t),a=Ho(a,t),o=Xs(o),o=ko(o,t),o=Ho(o,t),a=Vo(a),o=Vo(o),t.isRawShaderMaterial!==!0&&(E=`#version 300 es
3736
+ `)),a=qs(a),a=ko(a,t),a=Vo(a,t),o=qs(o),o=ko(o,t),o=Vo(o,t),a=Ho(a),o=Ho(o),t.isRawShaderMaterial!==!0&&(E=`#version 300 es
3737
3737
  `,m=[f,"#define attribute in","#define varying out","#define texture2D texture"].join(`
3738
3738
  `)+`
3739
3739
  `+m,p=["#define varying in",t.glslVersion===io?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===io?"":"#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(`
3740
3740
  `)+`
3741
- `+p);const v=E+m+a,b=E+p+o,R=Bo(r,r.VERTEX_SHADER,v),T=Bo(r,r.FRAGMENT_SHADER,b);r.attachShader(_,R),r.attachShader(_,T),t.index0AttributeName!==void 0?r.bindAttribLocation(_,0,t.index0AttributeName):t.morphTargets===!0&&r.bindAttribLocation(_,0,"position"),r.linkProgram(_);function A(F){if(i.debug.checkShaderErrors){const L=r.getProgramInfoLog(_).trim(),C=r.getShaderInfoLog(R).trim(),U=r.getShaderInfoLog(T).trim();let H=!0,Y=!0;if(r.getProgramParameter(_,r.LINK_STATUS)===!1)if(H=!1,typeof i.debug.onShaderError=="function")i.debug.onShaderError(r,_,R,T);else{const J=zo(r,R,"vertex"),z=zo(r,T,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(_,r.VALIDATE_STATUS)+`
3741
+ `+p);const v=E+m+a,b=E+p+o,R=Bo(r,r.VERTEX_SHADER,v),T=Bo(r,r.FRAGMENT_SHADER,b);r.attachShader(_,R),r.attachShader(_,T),t.index0AttributeName!==void 0?r.bindAttribLocation(_,0,t.index0AttributeName):t.morphTargets===!0&&r.bindAttribLocation(_,0,"position"),r.linkProgram(_);function A(F){if(i.debug.checkShaderErrors){const L=r.getProgramInfoLog(_).trim(),C=r.getShaderInfoLog(R).trim(),N=r.getShaderInfoLog(T).trim();let V=!0,j=!0;if(r.getProgramParameter(_,r.LINK_STATUS)===!1)if(V=!1,typeof i.debug.onShaderError=="function")i.debug.onShaderError(r,_,R,T);else{const J=zo(r,R,"vertex"),z=zo(r,T,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(_,r.VALIDATE_STATUS)+`
3742
3742
 
3743
3743
  Material Name: `+F.name+`
3744
3744
  Material Type: `+F.type+`
3745
3745
 
3746
3746
  Program Info Log: `+L+`
3747
3747
  `+J+`
3748
- `+z)}else L!==""?console.warn("THREE.WebGLProgram: Program Info Log:",L):(C===""||U==="")&&(Y=!1);Y&&(F.diagnostics={runnable:H,programLog:L,vertexShader:{log:C,prefix:m},fragmentShader:{log:U,prefix:p}})}r.deleteShader(R),r.deleteShader(T),P=new Tr(r,_),y=Xm(r,_)}let P;this.getUniforms=function(){return P===void 0&&A(this),P};let y;this.getAttributes=function(){return y===void 0&&A(this),y};let M=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return M===!1&&(M=r.getProgramParameter(_,Om)),M},this.destroy=function(){n.releaseStatesOfProgram(this),r.deleteProgram(_),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=Bm++,this.cacheKey=e,this.usedTimes=1,this.program=_,this.vertexShader=R,this.fragmentShader=T,this}let i0=0;class r0{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,r=this._getShaderStage(t),s=this._getShaderStage(n),a=this._getShaderCacheForMaterial(e);return a.has(r)===!1&&(a.add(r),r.usedTimes++),a.has(s)===!1&&(a.add(s),s.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.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){const t=this.materialCache;let n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){const t=this.shaderCache;let n=t.get(e);return n===void 0&&(n=new s0(e),t.set(e,n)),n}}class s0{constructor(e){this.id=i0++,this.code=e,this.usedTimes=0}}function a0(i,e,t,n,r,s,a){const o=new $l,l=new r0,c=new Set,u=[],d=r.logarithmicDepthBuffer,h=r.vertexTextures;let f=r.precision;const 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"};function _(y){return c.add(y),y===0?"uv":`uv${y}`}function m(y,M,F,L,C){const U=L.fog,H=C.geometry,Y=y.isMeshStandardMaterial?L.environment:null,J=(y.isMeshStandardMaterial?t:e).get(y.envMap||Y),z=J&&J.mapping===Nr?J.image.height:null,j=g[y.type];y.precision!==null&&(f=r.getMaxPrecision(y.precision),f!==y.precision&&console.warn("THREE.WebGLProgram.getParameters:",y.precision,"not supported, using",f,"instead."));const $=H.morphAttributes.position||H.morphAttributes.normal||H.morphAttributes.color,N=$!==void 0?$.length:0;let ee=0;H.morphAttributes.position!==void 0&&(ee=1),H.morphAttributes.normal!==void 0&&(ee=2),H.morphAttributes.color!==void 0&&(ee=3);let me,O,Q,ce;if(j){const lt=Gt[j];me=lt.vertexShader,O=lt.fragmentShader}else me=y.vertexShader,O=y.fragmentShader,l.update(y),Q=l.getVertexShaderID(y),ce=l.getFragmentShaderID(y);const ne=i.getRenderTarget(),ve=C.isInstancedMesh===!0,Te=C.isBatchedMesh===!0,Ce=!!y.map,k=!!y.matcap,Fe=!!J,xe=!!y.aoMap,Ge=!!y.lightMap,Ee=!!y.bumpMap,We=!!y.normalMap,w=!!y.displacementMap,S=!!y.emissiveMap,q=!!y.metalnessMap,Z=!!y.roughnessMap,te=y.anisotropy>0,ie=y.clearcoat>0,De=y.iridescence>0,re=y.sheen>0,ye=y.transmission>0,Ae=te&&!!y.anisotropyMap,ae=ie&&!!y.clearcoatMap,fe=ie&&!!y.clearcoatNormalMap,Re=ie&&!!y.clearcoatRoughnessMap,ge=De&&!!y.iridescenceMap,_e=De&&!!y.iridescenceThicknessMap,ke=re&&!!y.sheenColorMap,He=re&&!!y.sheenRoughnessMap,qe=!!y.specularMap,Xe=!!y.specularColorMap,Ye=!!y.specularIntensityMap,Me=ye&&!!y.transmissionMap,x=ye&&!!y.thicknessMap,V=!!y.gradientMap,K=!!y.alphaMap,se=y.alphaTest>0,pe=!!y.alphaHash,Ve=!!y.extensions;let ze=pn;y.toneMapped&&(ne===null||ne.isXRRenderTarget===!0)&&(ze=i.toneMapping);const Ze={shaderID:j,shaderType:y.type,shaderName:y.name,vertexShader:me,fragmentShader:O,defines:y.defines,customVertexShaderID:Q,customFragmentShaderID:ce,isRawShaderMaterial:y.isRawShaderMaterial===!0,glslVersion:y.glslVersion,precision:f,batching:Te,instancing:ve,instancingColor:ve&&C.instanceColor!==null,instancingMorph:ve&&C.morphTexture!==null,supportsVertexTextures:h,outputColorSpace:ne===null?i.outputColorSpace:ne.isXRRenderTarget===!0?ne.texture.colorSpace:xn,alphaToCoverage:!!y.alphaToCoverage,map:Ce,matcap:k,envMap:Fe,envMapMode:Fe&&J.mapping,envMapCubeUVHeight:z,aoMap:xe,lightMap:Ge,bumpMap:Ee,normalMap:We,displacementMap:h&&w,emissiveMap:S,normalMapObjectSpace:We&&y.normalMapType===eh,normalMapTangentSpace:We&&y.normalMapType===Qu,metalnessMap:q,roughnessMap:Z,anisotropy:te,anisotropyMap:Ae,clearcoat:ie,clearcoatMap:ae,clearcoatNormalMap:fe,clearcoatRoughnessMap:Re,iridescence:De,iridescenceMap:ge,iridescenceThicknessMap:_e,sheen:re,sheenColorMap:ke,sheenRoughnessMap:He,specularMap:qe,specularColorMap:Xe,specularIntensityMap:Ye,transmission:ye,transmissionMap:Me,thicknessMap:x,gradientMap:V,opaque:y.transparent===!1&&y.blending===ci&&y.alphaToCoverage===!1,alphaMap:K,alphaTest:se,alphaHash:pe,combine:y.combine,mapUv:Ce&&_(y.map.channel),aoMapUv:xe&&_(y.aoMap.channel),lightMapUv:Ge&&_(y.lightMap.channel),bumpMapUv:Ee&&_(y.bumpMap.channel),normalMapUv:We&&_(y.normalMap.channel),displacementMapUv:w&&_(y.displacementMap.channel),emissiveMapUv:S&&_(y.emissiveMap.channel),metalnessMapUv:q&&_(y.metalnessMap.channel),roughnessMapUv:Z&&_(y.roughnessMap.channel),anisotropyMapUv:Ae&&_(y.anisotropyMap.channel),clearcoatMapUv:ae&&_(y.clearcoatMap.channel),clearcoatNormalMapUv:fe&&_(y.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Re&&_(y.clearcoatRoughnessMap.channel),iridescenceMapUv:ge&&_(y.iridescenceMap.channel),iridescenceThicknessMapUv:_e&&_(y.iridescenceThicknessMap.channel),sheenColorMapUv:ke&&_(y.sheenColorMap.channel),sheenRoughnessMapUv:He&&_(y.sheenRoughnessMap.channel),specularMapUv:qe&&_(y.specularMap.channel),specularColorMapUv:Xe&&_(y.specularColorMap.channel),specularIntensityMapUv:Ye&&_(y.specularIntensityMap.channel),transmissionMapUv:Me&&_(y.transmissionMap.channel),thicknessMapUv:x&&_(y.thicknessMap.channel),alphaMapUv:K&&_(y.alphaMap.channel),vertexTangents:!!H.attributes.tangent&&(We||te),vertexColors:y.vertexColors,vertexAlphas:y.vertexColors===!0&&!!H.attributes.color&&H.attributes.color.itemSize===4,pointsUvs:C.isPoints===!0&&!!H.attributes.uv&&(Ce||K),fog:!!U,useFog:y.fog===!0,fogExp2:!!U&&U.isFogExp2,flatShading:y.flatShading===!0,sizeAttenuation:y.sizeAttenuation===!0,logarithmicDepthBuffer:d,skinning:C.isSkinnedMesh===!0,morphTargets:H.morphAttributes.position!==void 0,morphNormals:H.morphAttributes.normal!==void 0,morphColors:H.morphAttributes.color!==void 0,morphTargetsCount:N,morphTextureStride:ee,numDirLights:M.directional.length,numPointLights:M.point.length,numSpotLights:M.spot.length,numSpotLightMaps:M.spotLightMap.length,numRectAreaLights:M.rectArea.length,numHemiLights:M.hemi.length,numDirLightShadows:M.directionalShadowMap.length,numPointLightShadows:M.pointShadowMap.length,numSpotLightShadows:M.spotShadowMap.length,numSpotLightShadowsWithMaps:M.numSpotLightShadowsWithMaps,numLightProbes:M.numLightProbes,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:y.dithering,shadowMapEnabled:i.shadowMap.enabled&&F.length>0,shadowMapType:i.shadowMap.type,toneMapping:ze,useLegacyLights:i._useLegacyLights,decodeVideoTexture:Ce&&y.map.isVideoTexture===!0&&je.getTransfer(y.map.colorSpace)===Ke,premultipliedAlpha:y.premultipliedAlpha,doubleSided:y.side===Wt,flipSided:y.side===St,useDepthPacking:y.depthPacking>=0,depthPacking:y.depthPacking||0,index0AttributeName:y.index0AttributeName,extensionClipCullDistance:Ve&&y.extensions.clipCullDistance===!0&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:Ve&&y.extensions.multiDraw===!0&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:y.customProgramCacheKey()};return Ze.vertexUv1s=c.has(1),Ze.vertexUv2s=c.has(2),Ze.vertexUv3s=c.has(3),c.clear(),Ze}function p(y){const M=[];if(y.shaderID?M.push(y.shaderID):(M.push(y.customVertexShaderID),M.push(y.customFragmentShaderID)),y.defines!==void 0)for(const F in y.defines)M.push(F),M.push(y.defines[F]);return y.isRawShaderMaterial===!1&&(E(M,y),v(M,y),M.push(i.outputColorSpace)),M.push(y.customProgramCacheKey),M.join()}function E(y,M){y.push(M.precision),y.push(M.outputColorSpace),y.push(M.envMapMode),y.push(M.envMapCubeUVHeight),y.push(M.mapUv),y.push(M.alphaMapUv),y.push(M.lightMapUv),y.push(M.aoMapUv),y.push(M.bumpMapUv),y.push(M.normalMapUv),y.push(M.displacementMapUv),y.push(M.emissiveMapUv),y.push(M.metalnessMapUv),y.push(M.roughnessMapUv),y.push(M.anisotropyMapUv),y.push(M.clearcoatMapUv),y.push(M.clearcoatNormalMapUv),y.push(M.clearcoatRoughnessMapUv),y.push(M.iridescenceMapUv),y.push(M.iridescenceThicknessMapUv),y.push(M.sheenColorMapUv),y.push(M.sheenRoughnessMapUv),y.push(M.specularMapUv),y.push(M.specularColorMapUv),y.push(M.specularIntensityMapUv),y.push(M.transmissionMapUv),y.push(M.thicknessMapUv),y.push(M.combine),y.push(M.fogExp2),y.push(M.sizeAttenuation),y.push(M.morphTargetsCount),y.push(M.morphAttributeCount),y.push(M.numDirLights),y.push(M.numPointLights),y.push(M.numSpotLights),y.push(M.numSpotLightMaps),y.push(M.numHemiLights),y.push(M.numRectAreaLights),y.push(M.numDirLightShadows),y.push(M.numPointLightShadows),y.push(M.numSpotLightShadows),y.push(M.numSpotLightShadowsWithMaps),y.push(M.numLightProbes),y.push(M.shadowMapType),y.push(M.toneMapping),y.push(M.numClippingPlanes),y.push(M.numClipIntersection),y.push(M.depthPacking)}function v(y,M){o.disableAll(),M.supportsVertexTextures&&o.enable(0),M.instancing&&o.enable(1),M.instancingColor&&o.enable(2),M.instancingMorph&&o.enable(3),M.matcap&&o.enable(4),M.envMap&&o.enable(5),M.normalMapObjectSpace&&o.enable(6),M.normalMapTangentSpace&&o.enable(7),M.clearcoat&&o.enable(8),M.iridescence&&o.enable(9),M.alphaTest&&o.enable(10),M.vertexColors&&o.enable(11),M.vertexAlphas&&o.enable(12),M.vertexUv1s&&o.enable(13),M.vertexUv2s&&o.enable(14),M.vertexUv3s&&o.enable(15),M.vertexTangents&&o.enable(16),M.anisotropy&&o.enable(17),M.alphaHash&&o.enable(18),M.batching&&o.enable(19),y.push(o.mask),o.disableAll(),M.fog&&o.enable(0),M.useFog&&o.enable(1),M.flatShading&&o.enable(2),M.logarithmicDepthBuffer&&o.enable(3),M.skinning&&o.enable(4),M.morphTargets&&o.enable(5),M.morphNormals&&o.enable(6),M.morphColors&&o.enable(7),M.premultipliedAlpha&&o.enable(8),M.shadowMapEnabled&&o.enable(9),M.useLegacyLights&&o.enable(10),M.doubleSided&&o.enable(11),M.flipSided&&o.enable(12),M.useDepthPacking&&o.enable(13),M.dithering&&o.enable(14),M.transmission&&o.enable(15),M.sheen&&o.enable(16),M.opaque&&o.enable(17),M.pointsUvs&&o.enable(18),M.decodeVideoTexture&&o.enable(19),M.alphaToCoverage&&o.enable(20),y.push(o.mask)}function b(y){const M=g[y.type];let F;if(M){const L=Gt[M];F=Fr.clone(L.uniforms)}else F=y.uniforms;return F}function R(y,M){let F;for(let L=0,C=u.length;L<C;L++){const U=u[L];if(U.cacheKey===M){F=U,++F.usedTimes;break}}return F===void 0&&(F=new n0(i,M,y,s),u.push(F)),F}function T(y){if(--y.usedTimes===0){const M=u.indexOf(y);u[M]=u[u.length-1],u.pop(),y.destroy()}}function A(y){l.remove(y)}function P(){l.dispose()}return{getParameters:m,getProgramCacheKey:p,getUniforms:b,acquireProgram:R,releaseProgram:T,releaseShaderCache:A,programs:u,dispose:P}}function o0(){let i=new WeakMap;function e(s){let a=i.get(s);return a===void 0&&(a={},i.set(s,a)),a}function t(s){i.delete(s)}function n(s,a,o){i.get(s)[a]=o}function r(){i=new WeakMap}return{get:e,remove:t,update:n,dispose:r}}function l0(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.material.id!==e.material.id?i.material.id-e.material.id:i.z!==e.z?i.z-e.z:i.id-e.id}function Wo(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.z!==e.z?e.z-i.z:i.id-e.id}function Xo(){const i=[];let e=0;const t=[],n=[],r=[];function s(){e=0,t.length=0,n.length=0,r.length=0}function a(d,h,f,g,_,m){let p=i[e];return p===void 0?(p={id:d.id,object:d,geometry:h,material:f,groupOrder:g,renderOrder:d.renderOrder,z:_,group:m},i[e]=p):(p.id=d.id,p.object=d,p.geometry=h,p.material=f,p.groupOrder=g,p.renderOrder=d.renderOrder,p.z=_,p.group=m),e++,p}function o(d,h,f,g,_,m){const p=a(d,h,f,g,_,m);f.transmission>0?n.push(p):f.transparent===!0?r.push(p):t.push(p)}function l(d,h,f,g,_,m){const p=a(d,h,f,g,_,m);f.transmission>0?n.unshift(p):f.transparent===!0?r.unshift(p):t.unshift(p)}function c(d,h){t.length>1&&t.sort(d||l0),n.length>1&&n.sort(h||Wo),r.length>1&&r.sort(h||Wo)}function u(){for(let d=e,h=i.length;d<h;d++){const f=i[d];if(f.id===null)break;f.id=null,f.object=null,f.geometry=null,f.material=null,f.group=null}}return{opaque:t,transmissive:n,transparent:r,init:s,push:o,unshift:l,finish:u,sort:c}}function c0(){let i=new WeakMap;function e(n,r){const s=i.get(n);let a;return s===void 0?(a=new Xo,i.set(n,[a])):r>=s.length?(a=new Xo,s.push(a)):a=s[r],a}function t(){i=new WeakMap}return{get:e,dispose:t}}function u0(){const i={};return{get:function(e){if(i[e.id]!==void 0)return i[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new I,color:new be};break;case"SpotLight":t={position:new I,direction:new I,color:new be,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new I,color:new be,distance:0,decay:0};break;case"HemisphereLight":t={direction:new I,skyColor:new be,groundColor:new be};break;case"RectAreaLight":t={color:new be,position:new I,halfWidth:new I,halfHeight:new I};break}return i[e.id]=t,t}}}function h0(){const i={};return{get:function(e){if(i[e.id]!==void 0)return i[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ue};break;case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ue};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ue,shadowCameraNear:1,shadowCameraFar:1e3};break}return i[e.id]=t,t}}}let d0=0;function f0(i,e){return(e.castShadow?2:0)-(i.castShadow?2:0)+(e.map?1:0)-(i.map?1:0)}function p0(i){const e=new u0,t=h0(),n={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-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,numLightProbes:0};for(let c=0;c<9;c++)n.probe.push(new I);const r=new I,s=new et,a=new et;function o(c,u){let d=0,h=0,f=0;for(let F=0;F<9;F++)n.probe[F].set(0,0,0);let g=0,_=0,m=0,p=0,E=0,v=0,b=0,R=0,T=0,A=0,P=0;c.sort(f0);const y=u===!0?Math.PI:1;for(let F=0,L=c.length;F<L;F++){const C=c[F],U=C.color,H=C.intensity,Y=C.distance,J=C.shadow&&C.shadow.map?C.shadow.map.texture:null;if(C.isAmbientLight)d+=U.r*H*y,h+=U.g*H*y,f+=U.b*H*y;else if(C.isLightProbe){for(let z=0;z<9;z++)n.probe[z].addScaledVector(C.sh.coefficients[z],H);P++}else if(C.isDirectionalLight){const z=e.get(C);if(z.color.copy(C.color).multiplyScalar(C.intensity*y),C.castShadow){const j=C.shadow,$=t.get(C);$.shadowBias=j.bias,$.shadowNormalBias=j.normalBias,$.shadowRadius=j.radius,$.shadowMapSize=j.mapSize,n.directionalShadow[g]=$,n.directionalShadowMap[g]=J,n.directionalShadowMatrix[g]=C.shadow.matrix,v++}n.directional[g]=z,g++}else if(C.isSpotLight){const z=e.get(C);z.position.setFromMatrixPosition(C.matrixWorld),z.color.copy(U).multiplyScalar(H*y),z.distance=Y,z.coneCos=Math.cos(C.angle),z.penumbraCos=Math.cos(C.angle*(1-C.penumbra)),z.decay=C.decay,n.spot[m]=z;const j=C.shadow;if(C.map&&(n.spotLightMap[T]=C.map,T++,j.updateMatrices(C),C.castShadow&&A++),n.spotLightMatrix[m]=j.matrix,C.castShadow){const $=t.get(C);$.shadowBias=j.bias,$.shadowNormalBias=j.normalBias,$.shadowRadius=j.radius,$.shadowMapSize=j.mapSize,n.spotShadow[m]=$,n.spotShadowMap[m]=J,R++}m++}else if(C.isRectAreaLight){const z=e.get(C);z.color.copy(U).multiplyScalar(H),z.halfWidth.set(C.width*.5,0,0),z.halfHeight.set(0,C.height*.5,0),n.rectArea[p]=z,p++}else if(C.isPointLight){const z=e.get(C);if(z.color.copy(C.color).multiplyScalar(C.intensity*y),z.distance=C.distance,z.decay=C.decay,C.castShadow){const j=C.shadow,$=t.get(C);$.shadowBias=j.bias,$.shadowNormalBias=j.normalBias,$.shadowRadius=j.radius,$.shadowMapSize=j.mapSize,$.shadowCameraNear=j.camera.near,$.shadowCameraFar=j.camera.far,n.pointShadow[_]=$,n.pointShadowMap[_]=J,n.pointShadowMatrix[_]=C.shadow.matrix,b++}n.point[_]=z,_++}else if(C.isHemisphereLight){const z=e.get(C);z.skyColor.copy(C.color).multiplyScalar(H*y),z.groundColor.copy(C.groundColor).multiplyScalar(H*y),n.hemi[E]=z,E++}}p>0&&(i.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=le.LTC_FLOAT_1,n.rectAreaLTC2=le.LTC_FLOAT_2):(n.rectAreaLTC1=le.LTC_HALF_1,n.rectAreaLTC2=le.LTC_HALF_2)),n.ambient[0]=d,n.ambient[1]=h,n.ambient[2]=f;const M=n.hash;(M.directionalLength!==g||M.pointLength!==_||M.spotLength!==m||M.rectAreaLength!==p||M.hemiLength!==E||M.numDirectionalShadows!==v||M.numPointShadows!==b||M.numSpotShadows!==R||M.numSpotMaps!==T||M.numLightProbes!==P)&&(n.directional.length=g,n.spot.length=m,n.rectArea.length=p,n.point.length=_,n.hemi.length=E,n.directionalShadow.length=v,n.directionalShadowMap.length=v,n.pointShadow.length=b,n.pointShadowMap.length=b,n.spotShadow.length=R,n.spotShadowMap.length=R,n.directionalShadowMatrix.length=v,n.pointShadowMatrix.length=b,n.spotLightMatrix.length=R+T-A,n.spotLightMap.length=T,n.numSpotLightShadowsWithMaps=A,n.numLightProbes=P,M.directionalLength=g,M.pointLength=_,M.spotLength=m,M.rectAreaLength=p,M.hemiLength=E,M.numDirectionalShadows=v,M.numPointShadows=b,M.numSpotShadows=R,M.numSpotMaps=T,M.numLightProbes=P,n.version=d0++)}function l(c,u){let d=0,h=0,f=0,g=0,_=0;const m=u.matrixWorldInverse;for(let p=0,E=c.length;p<E;p++){const v=c[p];if(v.isDirectionalLight){const b=n.directional[d];b.direction.setFromMatrixPosition(v.matrixWorld),r.setFromMatrixPosition(v.target.matrixWorld),b.direction.sub(r),b.direction.transformDirection(m),d++}else if(v.isSpotLight){const b=n.spot[f];b.position.setFromMatrixPosition(v.matrixWorld),b.position.applyMatrix4(m),b.direction.setFromMatrixPosition(v.matrixWorld),r.setFromMatrixPosition(v.target.matrixWorld),b.direction.sub(r),b.direction.transformDirection(m),f++}else if(v.isRectAreaLight){const b=n.rectArea[g];b.position.setFromMatrixPosition(v.matrixWorld),b.position.applyMatrix4(m),a.identity(),s.copy(v.matrixWorld),s.premultiply(m),a.extractRotation(s),b.halfWidth.set(v.width*.5,0,0),b.halfHeight.set(0,v.height*.5,0),b.halfWidth.applyMatrix4(a),b.halfHeight.applyMatrix4(a),g++}else if(v.isPointLight){const b=n.point[h];b.position.setFromMatrixPosition(v.matrixWorld),b.position.applyMatrix4(m),h++}else if(v.isHemisphereLight){const b=n.hemi[_];b.direction.setFromMatrixPosition(v.matrixWorld),b.direction.transformDirection(m),_++}}}return{setup:o,setupView:l,state:n}}function qo(i){const e=new p0(i),t=[],n=[];function r(){t.length=0,n.length=0}function s(u){t.push(u)}function a(u){n.push(u)}function o(u){e.setup(t,u)}function l(u){e.setupView(t,u)}return{init:r,state:{lightsArray:t,shadowsArray:n,lights:e,transmissionRenderTarget:null},setupLights:o,setupLightsView:l,pushLight:s,pushShadow:a}}function m0(i){let e=new WeakMap;function t(r,s=0){const a=e.get(r);let o;return a===void 0?(o=new qo(i),e.set(r,[o])):s>=a.length?(o=new qo(i),a.push(o)):o=a[s],o}function n(){e=new WeakMap}return{get:t,dispose:n}}class g0 extends vi{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=Zu,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}}class _0 extends vi{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",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.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}const x0=`void main() {
3748
+ `+z)}else L!==""?console.warn("THREE.WebGLProgram: Program Info Log:",L):(C===""||N==="")&&(j=!1);j&&(F.diagnostics={runnable:V,programLog:L,vertexShader:{log:C,prefix:m},fragmentShader:{log:N,prefix:p}})}r.deleteShader(R),r.deleteShader(T),P=new Tr(r,_),S=Xm(r,_)}let P;this.getUniforms=function(){return P===void 0&&A(this),P};let S;this.getAttributes=function(){return S===void 0&&A(this),S};let M=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return M===!1&&(M=r.getProgramParameter(_,Om)),M},this.destroy=function(){n.releaseStatesOfProgram(this),r.deleteProgram(_),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=Bm++,this.cacheKey=e,this.usedTimes=1,this.program=_,this.vertexShader=R,this.fragmentShader=T,this}let i0=0;class r0{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,r=this._getShaderStage(t),s=this._getShaderStage(n),a=this._getShaderCacheForMaterial(e);return a.has(r)===!1&&(a.add(r),r.usedTimes++),a.has(s)===!1&&(a.add(s),s.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.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){const t=this.materialCache;let n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){const t=this.shaderCache;let n=t.get(e);return n===void 0&&(n=new s0(e),t.set(e,n)),n}}class s0{constructor(e){this.id=i0++,this.code=e,this.usedTimes=0}}function a0(i,e,t,n,r,s,a){const o=new $l,l=new r0,c=new Set,u=[],d=r.logarithmicDepthBuffer,h=r.vertexTextures;let f=r.precision;const 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"};function _(S){return c.add(S),S===0?"uv":`uv${S}`}function m(S,M,F,L,C){const N=L.fog,V=C.geometry,j=S.isMeshStandardMaterial?L.environment:null,J=(S.isMeshStandardMaterial?t:e).get(S.envMap||j),z=J&&J.mapping===Ur?J.image.height:null,Y=g[S.type];S.precision!==null&&(f=r.getMaxPrecision(S.precision),f!==S.precision&&console.warn("THREE.WebGLProgram.getParameters:",S.precision,"not supported, using",f,"instead."));const $=V.morphAttributes.position||V.morphAttributes.normal||V.morphAttributes.color,U=$!==void 0?$.length:0;let ee=0;V.morphAttributes.position!==void 0&&(ee=1),V.morphAttributes.normal!==void 0&&(ee=2),V.morphAttributes.color!==void 0&&(ee=3);let me,O,Q,ce;if(Y){const lt=Gt[Y];me=lt.vertexShader,O=lt.fragmentShader}else me=S.vertexShader,O=S.fragmentShader,l.update(S),Q=l.getVertexShaderID(S),ce=l.getFragmentShaderID(S);const ne=i.getRenderTarget(),ve=C.isInstancedMesh===!0,Te=C.isBatchedMesh===!0,Ce=!!S.map,k=!!S.matcap,Fe=!!J,xe=!!S.aoMap,Ge=!!S.lightMap,Ee=!!S.bumpMap,We=!!S.normalMap,w=!!S.displacementMap,y=!!S.emissiveMap,q=!!S.metalnessMap,Z=!!S.roughnessMap,te=S.anisotropy>0,ie=S.clearcoat>0,De=S.iridescence>0,re=S.sheen>0,Se=S.transmission>0,Ae=te&&!!S.anisotropyMap,oe=ie&&!!S.clearcoatMap,fe=ie&&!!S.clearcoatNormalMap,Re=ie&&!!S.clearcoatRoughnessMap,ge=De&&!!S.iridescenceMap,_e=De&&!!S.iridescenceThicknessMap,ke=re&&!!S.sheenColorMap,Ve=re&&!!S.sheenRoughnessMap,qe=!!S.specularMap,Xe=!!S.specularColorMap,je=!!S.specularIntensityMap,Me=Se&&!!S.transmissionMap,x=Se&&!!S.thicknessMap,H=!!S.gradientMap,K=!!S.alphaMap,ae=S.alphaTest>0,pe=!!S.alphaHash,He=!!S.extensions;let ze=pn;S.toneMapped&&(ne===null||ne.isXRRenderTarget===!0)&&(ze=i.toneMapping);const Ze={shaderID:Y,shaderType:S.type,shaderName:S.name,vertexShader:me,fragmentShader:O,defines:S.defines,customVertexShaderID:Q,customFragmentShaderID:ce,isRawShaderMaterial:S.isRawShaderMaterial===!0,glslVersion:S.glslVersion,precision:f,batching:Te,instancing:ve,instancingColor:ve&&C.instanceColor!==null,instancingMorph:ve&&C.morphTexture!==null,supportsVertexTextures:h,outputColorSpace:ne===null?i.outputColorSpace:ne.isXRRenderTarget===!0?ne.texture.colorSpace:xn,alphaToCoverage:!!S.alphaToCoverage,map:Ce,matcap:k,envMap:Fe,envMapMode:Fe&&J.mapping,envMapCubeUVHeight:z,aoMap:xe,lightMap:Ge,bumpMap:Ee,normalMap:We,displacementMap:h&&w,emissiveMap:y,normalMapObjectSpace:We&&S.normalMapType===eh,normalMapTangentSpace:We&&S.normalMapType===Qu,metalnessMap:q,roughnessMap:Z,anisotropy:te,anisotropyMap:Ae,clearcoat:ie,clearcoatMap:oe,clearcoatNormalMap:fe,clearcoatRoughnessMap:Re,iridescence:De,iridescenceMap:ge,iridescenceThicknessMap:_e,sheen:re,sheenColorMap:ke,sheenRoughnessMap:Ve,specularMap:qe,specularColorMap:Xe,specularIntensityMap:je,transmission:Se,transmissionMap:Me,thicknessMap:x,gradientMap:H,opaque:S.transparent===!1&&S.blending===ci&&S.alphaToCoverage===!1,alphaMap:K,alphaTest:ae,alphaHash:pe,combine:S.combine,mapUv:Ce&&_(S.map.channel),aoMapUv:xe&&_(S.aoMap.channel),lightMapUv:Ge&&_(S.lightMap.channel),bumpMapUv:Ee&&_(S.bumpMap.channel),normalMapUv:We&&_(S.normalMap.channel),displacementMapUv:w&&_(S.displacementMap.channel),emissiveMapUv:y&&_(S.emissiveMap.channel),metalnessMapUv:q&&_(S.metalnessMap.channel),roughnessMapUv:Z&&_(S.roughnessMap.channel),anisotropyMapUv:Ae&&_(S.anisotropyMap.channel),clearcoatMapUv:oe&&_(S.clearcoatMap.channel),clearcoatNormalMapUv:fe&&_(S.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Re&&_(S.clearcoatRoughnessMap.channel),iridescenceMapUv:ge&&_(S.iridescenceMap.channel),iridescenceThicknessMapUv:_e&&_(S.iridescenceThicknessMap.channel),sheenColorMapUv:ke&&_(S.sheenColorMap.channel),sheenRoughnessMapUv:Ve&&_(S.sheenRoughnessMap.channel),specularMapUv:qe&&_(S.specularMap.channel),specularColorMapUv:Xe&&_(S.specularColorMap.channel),specularIntensityMapUv:je&&_(S.specularIntensityMap.channel),transmissionMapUv:Me&&_(S.transmissionMap.channel),thicknessMapUv:x&&_(S.thicknessMap.channel),alphaMapUv:K&&_(S.alphaMap.channel),vertexTangents:!!V.attributes.tangent&&(We||te),vertexColors:S.vertexColors,vertexAlphas:S.vertexColors===!0&&!!V.attributes.color&&V.attributes.color.itemSize===4,pointsUvs:C.isPoints===!0&&!!V.attributes.uv&&(Ce||K),fog:!!N,useFog:S.fog===!0,fogExp2:!!N&&N.isFogExp2,flatShading:S.flatShading===!0,sizeAttenuation:S.sizeAttenuation===!0,logarithmicDepthBuffer:d,skinning:C.isSkinnedMesh===!0,morphTargets:V.morphAttributes.position!==void 0,morphNormals:V.morphAttributes.normal!==void 0,morphColors:V.morphAttributes.color!==void 0,morphTargetsCount:U,morphTextureStride:ee,numDirLights:M.directional.length,numPointLights:M.point.length,numSpotLights:M.spot.length,numSpotLightMaps:M.spotLightMap.length,numRectAreaLights:M.rectArea.length,numHemiLights:M.hemi.length,numDirLightShadows:M.directionalShadowMap.length,numPointLightShadows:M.pointShadowMap.length,numSpotLightShadows:M.spotShadowMap.length,numSpotLightShadowsWithMaps:M.numSpotLightShadowsWithMaps,numLightProbes:M.numLightProbes,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:S.dithering,shadowMapEnabled:i.shadowMap.enabled&&F.length>0,shadowMapType:i.shadowMap.type,toneMapping:ze,useLegacyLights:i._useLegacyLights,decodeVideoTexture:Ce&&S.map.isVideoTexture===!0&&Ye.getTransfer(S.map.colorSpace)===Ke,premultipliedAlpha:S.premultipliedAlpha,doubleSided:S.side===Wt,flipSided:S.side===yt,useDepthPacking:S.depthPacking>=0,depthPacking:S.depthPacking||0,index0AttributeName:S.index0AttributeName,extensionClipCullDistance:He&&S.extensions.clipCullDistance===!0&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:He&&S.extensions.multiDraw===!0&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:S.customProgramCacheKey()};return Ze.vertexUv1s=c.has(1),Ze.vertexUv2s=c.has(2),Ze.vertexUv3s=c.has(3),c.clear(),Ze}function p(S){const M=[];if(S.shaderID?M.push(S.shaderID):(M.push(S.customVertexShaderID),M.push(S.customFragmentShaderID)),S.defines!==void 0)for(const F in S.defines)M.push(F),M.push(S.defines[F]);return S.isRawShaderMaterial===!1&&(E(M,S),v(M,S),M.push(i.outputColorSpace)),M.push(S.customProgramCacheKey),M.join()}function E(S,M){S.push(M.precision),S.push(M.outputColorSpace),S.push(M.envMapMode),S.push(M.envMapCubeUVHeight),S.push(M.mapUv),S.push(M.alphaMapUv),S.push(M.lightMapUv),S.push(M.aoMapUv),S.push(M.bumpMapUv),S.push(M.normalMapUv),S.push(M.displacementMapUv),S.push(M.emissiveMapUv),S.push(M.metalnessMapUv),S.push(M.roughnessMapUv),S.push(M.anisotropyMapUv),S.push(M.clearcoatMapUv),S.push(M.clearcoatNormalMapUv),S.push(M.clearcoatRoughnessMapUv),S.push(M.iridescenceMapUv),S.push(M.iridescenceThicknessMapUv),S.push(M.sheenColorMapUv),S.push(M.sheenRoughnessMapUv),S.push(M.specularMapUv),S.push(M.specularColorMapUv),S.push(M.specularIntensityMapUv),S.push(M.transmissionMapUv),S.push(M.thicknessMapUv),S.push(M.combine),S.push(M.fogExp2),S.push(M.sizeAttenuation),S.push(M.morphTargetsCount),S.push(M.morphAttributeCount),S.push(M.numDirLights),S.push(M.numPointLights),S.push(M.numSpotLights),S.push(M.numSpotLightMaps),S.push(M.numHemiLights),S.push(M.numRectAreaLights),S.push(M.numDirLightShadows),S.push(M.numPointLightShadows),S.push(M.numSpotLightShadows),S.push(M.numSpotLightShadowsWithMaps),S.push(M.numLightProbes),S.push(M.shadowMapType),S.push(M.toneMapping),S.push(M.numClippingPlanes),S.push(M.numClipIntersection),S.push(M.depthPacking)}function v(S,M){o.disableAll(),M.supportsVertexTextures&&o.enable(0),M.instancing&&o.enable(1),M.instancingColor&&o.enable(2),M.instancingMorph&&o.enable(3),M.matcap&&o.enable(4),M.envMap&&o.enable(5),M.normalMapObjectSpace&&o.enable(6),M.normalMapTangentSpace&&o.enable(7),M.clearcoat&&o.enable(8),M.iridescence&&o.enable(9),M.alphaTest&&o.enable(10),M.vertexColors&&o.enable(11),M.vertexAlphas&&o.enable(12),M.vertexUv1s&&o.enable(13),M.vertexUv2s&&o.enable(14),M.vertexUv3s&&o.enable(15),M.vertexTangents&&o.enable(16),M.anisotropy&&o.enable(17),M.alphaHash&&o.enable(18),M.batching&&o.enable(19),S.push(o.mask),o.disableAll(),M.fog&&o.enable(0),M.useFog&&o.enable(1),M.flatShading&&o.enable(2),M.logarithmicDepthBuffer&&o.enable(3),M.skinning&&o.enable(4),M.morphTargets&&o.enable(5),M.morphNormals&&o.enable(6),M.morphColors&&o.enable(7),M.premultipliedAlpha&&o.enable(8),M.shadowMapEnabled&&o.enable(9),M.useLegacyLights&&o.enable(10),M.doubleSided&&o.enable(11),M.flipSided&&o.enable(12),M.useDepthPacking&&o.enable(13),M.dithering&&o.enable(14),M.transmission&&o.enable(15),M.sheen&&o.enable(16),M.opaque&&o.enable(17),M.pointsUvs&&o.enable(18),M.decodeVideoTexture&&o.enable(19),M.alphaToCoverage&&o.enable(20),S.push(o.mask)}function b(S){const M=g[S.type];let F;if(M){const L=Gt[M];F=Fr.clone(L.uniforms)}else F=S.uniforms;return F}function R(S,M){let F;for(let L=0,C=u.length;L<C;L++){const N=u[L];if(N.cacheKey===M){F=N,++F.usedTimes;break}}return F===void 0&&(F=new n0(i,M,S,s),u.push(F)),F}function T(S){if(--S.usedTimes===0){const M=u.indexOf(S);u[M]=u[u.length-1],u.pop(),S.destroy()}}function A(S){l.remove(S)}function P(){l.dispose()}return{getParameters:m,getProgramCacheKey:p,getUniforms:b,acquireProgram:R,releaseProgram:T,releaseShaderCache:A,programs:u,dispose:P}}function o0(){let i=new WeakMap;function e(s){let a=i.get(s);return a===void 0&&(a={},i.set(s,a)),a}function t(s){i.delete(s)}function n(s,a,o){i.get(s)[a]=o}function r(){i=new WeakMap}return{get:e,remove:t,update:n,dispose:r}}function l0(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.material.id!==e.material.id?i.material.id-e.material.id:i.z!==e.z?i.z-e.z:i.id-e.id}function Wo(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.z!==e.z?e.z-i.z:i.id-e.id}function Xo(){const i=[];let e=0;const t=[],n=[],r=[];function s(){e=0,t.length=0,n.length=0,r.length=0}function a(d,h,f,g,_,m){let p=i[e];return p===void 0?(p={id:d.id,object:d,geometry:h,material:f,groupOrder:g,renderOrder:d.renderOrder,z:_,group:m},i[e]=p):(p.id=d.id,p.object=d,p.geometry=h,p.material=f,p.groupOrder=g,p.renderOrder=d.renderOrder,p.z=_,p.group=m),e++,p}function o(d,h,f,g,_,m){const p=a(d,h,f,g,_,m);f.transmission>0?n.push(p):f.transparent===!0?r.push(p):t.push(p)}function l(d,h,f,g,_,m){const p=a(d,h,f,g,_,m);f.transmission>0?n.unshift(p):f.transparent===!0?r.unshift(p):t.unshift(p)}function c(d,h){t.length>1&&t.sort(d||l0),n.length>1&&n.sort(h||Wo),r.length>1&&r.sort(h||Wo)}function u(){for(let d=e,h=i.length;d<h;d++){const f=i[d];if(f.id===null)break;f.id=null,f.object=null,f.geometry=null,f.material=null,f.group=null}}return{opaque:t,transmissive:n,transparent:r,init:s,push:o,unshift:l,finish:u,sort:c}}function c0(){let i=new WeakMap;function e(n,r){const s=i.get(n);let a;return s===void 0?(a=new Xo,i.set(n,[a])):r>=s.length?(a=new Xo,s.push(a)):a=s[r],a}function t(){i=new WeakMap}return{get:e,dispose:t}}function u0(){const i={};return{get:function(e){if(i[e.id]!==void 0)return i[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new I,color:new be};break;case"SpotLight":t={position:new I,direction:new I,color:new be,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new I,color:new be,distance:0,decay:0};break;case"HemisphereLight":t={direction:new I,skyColor:new be,groundColor:new be};break;case"RectAreaLight":t={color:new be,position:new I,halfWidth:new I,halfHeight:new I};break}return i[e.id]=t,t}}}function h0(){const i={};return{get:function(e){if(i[e.id]!==void 0)return i[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ue};break;case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ue};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ue,shadowCameraNear:1,shadowCameraFar:1e3};break}return i[e.id]=t,t}}}let d0=0;function f0(i,e){return(e.castShadow?2:0)-(i.castShadow?2:0)+(e.map?1:0)-(i.map?1:0)}function p0(i){const e=new u0,t=h0(),n={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-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,numLightProbes:0};for(let c=0;c<9;c++)n.probe.push(new I);const r=new I,s=new et,a=new et;function o(c,u){let d=0,h=0,f=0;for(let F=0;F<9;F++)n.probe[F].set(0,0,0);let g=0,_=0,m=0,p=0,E=0,v=0,b=0,R=0,T=0,A=0,P=0;c.sort(f0);const S=u===!0?Math.PI:1;for(let F=0,L=c.length;F<L;F++){const C=c[F],N=C.color,V=C.intensity,j=C.distance,J=C.shadow&&C.shadow.map?C.shadow.map.texture:null;if(C.isAmbientLight)d+=N.r*V*S,h+=N.g*V*S,f+=N.b*V*S;else if(C.isLightProbe){for(let z=0;z<9;z++)n.probe[z].addScaledVector(C.sh.coefficients[z],V);P++}else if(C.isDirectionalLight){const z=e.get(C);if(z.color.copy(C.color).multiplyScalar(C.intensity*S),C.castShadow){const Y=C.shadow,$=t.get(C);$.shadowBias=Y.bias,$.shadowNormalBias=Y.normalBias,$.shadowRadius=Y.radius,$.shadowMapSize=Y.mapSize,n.directionalShadow[g]=$,n.directionalShadowMap[g]=J,n.directionalShadowMatrix[g]=C.shadow.matrix,v++}n.directional[g]=z,g++}else if(C.isSpotLight){const z=e.get(C);z.position.setFromMatrixPosition(C.matrixWorld),z.color.copy(N).multiplyScalar(V*S),z.distance=j,z.coneCos=Math.cos(C.angle),z.penumbraCos=Math.cos(C.angle*(1-C.penumbra)),z.decay=C.decay,n.spot[m]=z;const Y=C.shadow;if(C.map&&(n.spotLightMap[T]=C.map,T++,Y.updateMatrices(C),C.castShadow&&A++),n.spotLightMatrix[m]=Y.matrix,C.castShadow){const $=t.get(C);$.shadowBias=Y.bias,$.shadowNormalBias=Y.normalBias,$.shadowRadius=Y.radius,$.shadowMapSize=Y.mapSize,n.spotShadow[m]=$,n.spotShadowMap[m]=J,R++}m++}else if(C.isRectAreaLight){const z=e.get(C);z.color.copy(N).multiplyScalar(V),z.halfWidth.set(C.width*.5,0,0),z.halfHeight.set(0,C.height*.5,0),n.rectArea[p]=z,p++}else if(C.isPointLight){const z=e.get(C);if(z.color.copy(C.color).multiplyScalar(C.intensity*S),z.distance=C.distance,z.decay=C.decay,C.castShadow){const Y=C.shadow,$=t.get(C);$.shadowBias=Y.bias,$.shadowNormalBias=Y.normalBias,$.shadowRadius=Y.radius,$.shadowMapSize=Y.mapSize,$.shadowCameraNear=Y.camera.near,$.shadowCameraFar=Y.camera.far,n.pointShadow[_]=$,n.pointShadowMap[_]=J,n.pointShadowMatrix[_]=C.shadow.matrix,b++}n.point[_]=z,_++}else if(C.isHemisphereLight){const z=e.get(C);z.skyColor.copy(C.color).multiplyScalar(V*S),z.groundColor.copy(C.groundColor).multiplyScalar(V*S),n.hemi[E]=z,E++}}p>0&&(i.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=le.LTC_FLOAT_1,n.rectAreaLTC2=le.LTC_FLOAT_2):(n.rectAreaLTC1=le.LTC_HALF_1,n.rectAreaLTC2=le.LTC_HALF_2)),n.ambient[0]=d,n.ambient[1]=h,n.ambient[2]=f;const M=n.hash;(M.directionalLength!==g||M.pointLength!==_||M.spotLength!==m||M.rectAreaLength!==p||M.hemiLength!==E||M.numDirectionalShadows!==v||M.numPointShadows!==b||M.numSpotShadows!==R||M.numSpotMaps!==T||M.numLightProbes!==P)&&(n.directional.length=g,n.spot.length=m,n.rectArea.length=p,n.point.length=_,n.hemi.length=E,n.directionalShadow.length=v,n.directionalShadowMap.length=v,n.pointShadow.length=b,n.pointShadowMap.length=b,n.spotShadow.length=R,n.spotShadowMap.length=R,n.directionalShadowMatrix.length=v,n.pointShadowMatrix.length=b,n.spotLightMatrix.length=R+T-A,n.spotLightMap.length=T,n.numSpotLightShadowsWithMaps=A,n.numLightProbes=P,M.directionalLength=g,M.pointLength=_,M.spotLength=m,M.rectAreaLength=p,M.hemiLength=E,M.numDirectionalShadows=v,M.numPointShadows=b,M.numSpotShadows=R,M.numSpotMaps=T,M.numLightProbes=P,n.version=d0++)}function l(c,u){let d=0,h=0,f=0,g=0,_=0;const m=u.matrixWorldInverse;for(let p=0,E=c.length;p<E;p++){const v=c[p];if(v.isDirectionalLight){const b=n.directional[d];b.direction.setFromMatrixPosition(v.matrixWorld),r.setFromMatrixPosition(v.target.matrixWorld),b.direction.sub(r),b.direction.transformDirection(m),d++}else if(v.isSpotLight){const b=n.spot[f];b.position.setFromMatrixPosition(v.matrixWorld),b.position.applyMatrix4(m),b.direction.setFromMatrixPosition(v.matrixWorld),r.setFromMatrixPosition(v.target.matrixWorld),b.direction.sub(r),b.direction.transformDirection(m),f++}else if(v.isRectAreaLight){const b=n.rectArea[g];b.position.setFromMatrixPosition(v.matrixWorld),b.position.applyMatrix4(m),a.identity(),s.copy(v.matrixWorld),s.premultiply(m),a.extractRotation(s),b.halfWidth.set(v.width*.5,0,0),b.halfHeight.set(0,v.height*.5,0),b.halfWidth.applyMatrix4(a),b.halfHeight.applyMatrix4(a),g++}else if(v.isPointLight){const b=n.point[h];b.position.setFromMatrixPosition(v.matrixWorld),b.position.applyMatrix4(m),h++}else if(v.isHemisphereLight){const b=n.hemi[_];b.direction.setFromMatrixPosition(v.matrixWorld),b.direction.transformDirection(m),_++}}}return{setup:o,setupView:l,state:n}}function qo(i){const e=new p0(i),t=[],n=[];function r(){t.length=0,n.length=0}function s(u){t.push(u)}function a(u){n.push(u)}function o(u){e.setup(t,u)}function l(u){e.setupView(t,u)}return{init:r,state:{lightsArray:t,shadowsArray:n,lights:e,transmissionRenderTarget:null},setupLights:o,setupLightsView:l,pushLight:s,pushShadow:a}}function m0(i){let e=new WeakMap;function t(r,s=0){const a=e.get(r);let o;return a===void 0?(o=new qo(i),e.set(r,[o])):s>=a.length?(o=new qo(i),a.push(o)):o=a[s],o}function n(){e=new WeakMap}return{get:t,dispose:n}}class g0 extends vi{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=Zu,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}}class _0 extends vi{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",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.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}const x0=`void main() {
3749
3749
  gl_Position = vec4( position, 1.0 );
3750
3750
  }`,v0=`uniform sampler2D shadow_pass;
3751
3751
  uniform vec2 resolution;
@@ -3773,7 +3773,7 @@ void main() {
3773
3773
  squared_mean = squared_mean / samples;
3774
3774
  float std_dev = sqrt( squared_mean - mean * mean );
3775
3775
  gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
3776
- }`;function M0(i,e,t){let n=new tc;const r=new ue,s=new ue,a=new dt,o=new g0({depthPacking:Ju}),l=new _0,c={},u=t.maxTextureSize,d={[_n]:St,[St]:_n,[Wt]:Wt},h=new ft({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new ue},radius:{value:4}},vertexShader:x0,fragmentShader:v0}),f=h.clone();f.defines.HORIZONTAL_PASS=1;const g=new _t;g.setAttribute("position",new Et(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const _=new bt(g,h),m=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Pl;let p=this.type;this.render=function(T,A,P){if(m.enabled===!1||m.autoUpdate===!1&&m.needsUpdate===!1||T.length===0)return;const y=i.getRenderTarget(),M=i.getActiveCubeFace(),F=i.getActiveMipmapLevel(),L=i.state;L.setBlending(en),L.buffers.color.setClear(1,1,1,1),L.buffers.depth.setTest(!0),L.setScissorTest(!1);const C=p!==Jt&&this.type===Jt,U=p===Jt&&this.type!==Jt;for(let H=0,Y=T.length;H<Y;H++){const J=T[H],z=J.shadow;if(z===void 0){console.warn("THREE.WebGLShadowMap:",J,"has no shadow.");continue}if(z.autoUpdate===!1&&z.needsUpdate===!1)continue;r.copy(z.mapSize);const j=z.getFrameExtents();if(r.multiply(j),s.copy(z.mapSize),(r.x>u||r.y>u)&&(r.x>u&&(s.x=Math.floor(u/j.x),r.x=s.x*j.x,z.mapSize.x=s.x),r.y>u&&(s.y=Math.floor(u/j.y),r.y=s.y*j.y,z.mapSize.y=s.y)),z.map===null||C===!0||U===!0){const N=this.type!==Jt?{minFilter:Ut,magFilter:Ut}:{};z.map!==null&&z.map.dispose(),z.map=new Ht(r.x,r.y,N),z.map.texture.name=J.name+".shadowMap",z.camera.updateProjectionMatrix()}i.setRenderTarget(z.map),i.clear();const $=z.getViewportCount();for(let N=0;N<$;N++){const ee=z.getViewport(N);a.set(s.x*ee.x,s.y*ee.y,s.x*ee.z,s.y*ee.w),L.viewport(a),z.updateMatrices(J,N),n=z.getFrustum(),b(A,P,z.camera,J,this.type)}z.isPointLightShadow!==!0&&this.type===Jt&&E(z,P),z.needsUpdate=!1}p=this.type,m.needsUpdate=!1,i.setRenderTarget(y,M,F)};function E(T,A){const P=e.update(_);h.defines.VSM_SAMPLES!==T.blurSamples&&(h.defines.VSM_SAMPLES=T.blurSamples,f.defines.VSM_SAMPLES=T.blurSamples,h.needsUpdate=!0,f.needsUpdate=!0),T.mapPass===null&&(T.mapPass=new Ht(r.x,r.y)),h.uniforms.shadow_pass.value=T.map.texture,h.uniforms.resolution.value=T.mapSize,h.uniforms.radius.value=T.radius,i.setRenderTarget(T.mapPass),i.clear(),i.renderBufferDirect(A,null,P,h,_,null),f.uniforms.shadow_pass.value=T.mapPass.texture,f.uniforms.resolution.value=T.mapSize,f.uniforms.radius.value=T.radius,i.setRenderTarget(T.map),i.clear(),i.renderBufferDirect(A,null,P,f,_,null)}function v(T,A,P,y){let M=null;const F=P.isPointLight===!0?T.customDistanceMaterial:T.customDepthMaterial;if(F!==void 0)M=F;else if(M=P.isPointLight===!0?l:o,i.localClippingEnabled&&A.clipShadows===!0&&Array.isArray(A.clippingPlanes)&&A.clippingPlanes.length!==0||A.displacementMap&&A.displacementScale!==0||A.alphaMap&&A.alphaTest>0||A.map&&A.alphaTest>0){const L=M.uuid,C=A.uuid;let U=c[L];U===void 0&&(U={},c[L]=U);let H=U[C];H===void 0&&(H=M.clone(),U[C]=H,A.addEventListener("dispose",R)),M=H}if(M.visible=A.visible,M.wireframe=A.wireframe,y===Jt?M.side=A.shadowSide!==null?A.shadowSide:A.side:M.side=A.shadowSide!==null?A.shadowSide:d[A.side],M.alphaMap=A.alphaMap,M.alphaTest=A.alphaTest,M.map=A.map,M.clipShadows=A.clipShadows,M.clippingPlanes=A.clippingPlanes,M.clipIntersection=A.clipIntersection,M.displacementMap=A.displacementMap,M.displacementScale=A.displacementScale,M.displacementBias=A.displacementBias,M.wireframeLinewidth=A.wireframeLinewidth,M.linewidth=A.linewidth,P.isPointLight===!0&&M.isMeshDistanceMaterial===!0){const L=i.properties.get(M);L.light=P}return M}function b(T,A,P,y,M){if(T.visible===!1)return;if(T.layers.test(A.layers)&&(T.isMesh||T.isLine||T.isPoints)&&(T.castShadow||T.receiveShadow&&M===Jt)&&(!T.frustumCulled||n.intersectsObject(T))){T.modelViewMatrix.multiplyMatrices(P.matrixWorldInverse,T.matrixWorld);const C=e.update(T),U=T.material;if(Array.isArray(U)){const H=C.groups;for(let Y=0,J=H.length;Y<J;Y++){const z=H[Y],j=U[z.materialIndex];if(j&&j.visible){const $=v(T,j,y,M);T.onBeforeShadow(i,T,A,P,C,$,z),i.renderBufferDirect(P,null,C,$,T,z),T.onAfterShadow(i,T,A,P,C,$,z)}}}else if(U.visible){const H=v(T,U,y,M);T.onBeforeShadow(i,T,A,P,C,H,null),i.renderBufferDirect(P,null,C,H,T,null),T.onAfterShadow(i,T,A,P,C,H,null)}}const L=T.children;for(let C=0,U=L.length;C<U;C++)b(L[C],A,P,y,M)}function R(T){T.target.removeEventListener("dispose",R);for(const P in c){const y=c[P],M=T.target.uuid;M in y&&(y[M].dispose(),delete y[M])}}}function S0(i){function e(){let x=!1;const V=new dt;let K=null;const se=new dt(0,0,0,0);return{setMask:function(pe){K!==pe&&!x&&(i.colorMask(pe,pe,pe,pe),K=pe)},setLocked:function(pe){x=pe},setClear:function(pe,Ve,ze,Ze,lt){lt===!0&&(pe*=Ze,Ve*=Ze,ze*=Ze),V.set(pe,Ve,ze,Ze),se.equals(V)===!1&&(i.clearColor(pe,Ve,ze,Ze),se.copy(V))},reset:function(){x=!1,K=null,se.set(-1,0,0,0)}}}function t(){let x=!1,V=null,K=null,se=null;return{setTest:function(pe){pe?ce(i.DEPTH_TEST):ne(i.DEPTH_TEST)},setMask:function(pe){V!==pe&&!x&&(i.depthMask(pe),V=pe)},setFunc:function(pe){if(K!==pe){switch(pe){case Tu:i.depthFunc(i.NEVER);break;case Du:i.depthFunc(i.ALWAYS);break;case Au:i.depthFunc(i.LESS);break;case Ar:i.depthFunc(i.LEQUAL);break;case wu:i.depthFunc(i.EQUAL);break;case Cu:i.depthFunc(i.GEQUAL);break;case Ru:i.depthFunc(i.GREATER);break;case Pu:i.depthFunc(i.NOTEQUAL);break;default:i.depthFunc(i.LEQUAL)}K=pe}},setLocked:function(pe){x=pe},setClear:function(pe){se!==pe&&(i.clearDepth(pe),se=pe)},reset:function(){x=!1,V=null,K=null,se=null}}}function n(){let x=!1,V=null,K=null,se=null,pe=null,Ve=null,ze=null,Ze=null,lt=null;return{setTest:function($e){x||($e?ce(i.STENCIL_TEST):ne(i.STENCIL_TEST))},setMask:function($e){V!==$e&&!x&&(i.stencilMask($e),V=$e)},setFunc:function($e,it,rt){(K!==$e||se!==it||pe!==rt)&&(i.stencilFunc($e,it,rt),K=$e,se=it,pe=rt)},setOp:function($e,it,rt){(Ve!==$e||ze!==it||Ze!==rt)&&(i.stencilOp($e,it,rt),Ve=$e,ze=it,Ze=rt)},setLocked:function($e){x=$e},setClear:function($e){lt!==$e&&(i.clearStencil($e),lt=$e)},reset:function(){x=!1,V=null,K=null,se=null,pe=null,Ve=null,ze=null,Ze=null,lt=null}}}const r=new e,s=new t,a=new n,o=new WeakMap,l=new WeakMap;let c={},u={},d=new WeakMap,h=[],f=null,g=!1,_=null,m=null,p=null,E=null,v=null,b=null,R=null,T=new be(0,0,0),A=0,P=!1,y=null,M=null,F=null,L=null,C=null;const U=i.getParameter(i.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let H=!1,Y=0;const J=i.getParameter(i.VERSION);J.indexOf("WebGL")!==-1?(Y=parseFloat(/^WebGL (\d)/.exec(J)[1]),H=Y>=1):J.indexOf("OpenGL ES")!==-1&&(Y=parseFloat(/^OpenGL ES (\d)/.exec(J)[1]),H=Y>=2);let z=null,j={};const $=i.getParameter(i.SCISSOR_BOX),N=i.getParameter(i.VIEWPORT),ee=new dt().fromArray($),me=new dt().fromArray(N);function O(x,V,K,se){const pe=new Uint8Array(4),Ve=i.createTexture();i.bindTexture(x,Ve),i.texParameteri(x,i.TEXTURE_MIN_FILTER,i.NEAREST),i.texParameteri(x,i.TEXTURE_MAG_FILTER,i.NEAREST);for(let ze=0;ze<K;ze++)x===i.TEXTURE_3D||x===i.TEXTURE_2D_ARRAY?i.texImage3D(V,0,i.RGBA,1,1,se,0,i.RGBA,i.UNSIGNED_BYTE,pe):i.texImage2D(V+ze,0,i.RGBA,1,1,0,i.RGBA,i.UNSIGNED_BYTE,pe);return Ve}const Q={};Q[i.TEXTURE_2D]=O(i.TEXTURE_2D,i.TEXTURE_2D,1),Q[i.TEXTURE_CUBE_MAP]=O(i.TEXTURE_CUBE_MAP,i.TEXTURE_CUBE_MAP_POSITIVE_X,6),Q[i.TEXTURE_2D_ARRAY]=O(i.TEXTURE_2D_ARRAY,i.TEXTURE_2D_ARRAY,1,1),Q[i.TEXTURE_3D]=O(i.TEXTURE_3D,i.TEXTURE_3D,1,1),r.setClear(0,0,0,1),s.setClear(1),a.setClear(0),ce(i.DEPTH_TEST),s.setFunc(Ar),Ee(!1),We(Aa),ce(i.CULL_FACE),xe(en);function ce(x){c[x]!==!0&&(i.enable(x),c[x]=!0)}function ne(x){c[x]!==!1&&(i.disable(x),c[x]=!1)}function ve(x,V){return u[x]!==V?(i.bindFramebuffer(x,V),u[x]=V,x===i.DRAW_FRAMEBUFFER&&(u[i.FRAMEBUFFER]=V),x===i.FRAMEBUFFER&&(u[i.DRAW_FRAMEBUFFER]=V),!0):!1}function Te(x,V){let K=h,se=!1;if(x){K=d.get(V),K===void 0&&(K=[],d.set(V,K));const pe=x.textures;if(K.length!==pe.length||K[0]!==i.COLOR_ATTACHMENT0){for(let Ve=0,ze=pe.length;Ve<ze;Ve++)K[Ve]=i.COLOR_ATTACHMENT0+Ve;K.length=pe.length,se=!0}}else K[0]!==i.BACK&&(K[0]=i.BACK,se=!0);se&&i.drawBuffers(K)}function Ce(x){return f!==x?(i.useProgram(x),f=x,!0):!1}const k={[wn]:i.FUNC_ADD,[lu]:i.FUNC_SUBTRACT,[cu]:i.FUNC_REVERSE_SUBTRACT};k[uu]=i.MIN,k[hu]=i.MAX;const Fe={[du]:i.ZERO,[fu]:i.ONE,[pu]:i.SRC_COLOR,[zs]:i.SRC_ALPHA,[Mu]:i.SRC_ALPHA_SATURATE,[xu]:i.DST_COLOR,[gu]:i.DST_ALPHA,[mu]:i.ONE_MINUS_SRC_COLOR,[ks]:i.ONE_MINUS_SRC_ALPHA,[vu]:i.ONE_MINUS_DST_COLOR,[_u]:i.ONE_MINUS_DST_ALPHA,[Su]:i.CONSTANT_COLOR,[yu]:i.ONE_MINUS_CONSTANT_COLOR,[Eu]:i.CONSTANT_ALPHA,[bu]:i.ONE_MINUS_CONSTANT_ALPHA};function xe(x,V,K,se,pe,Ve,ze,Ze,lt,$e){if(x===en){g===!0&&(ne(i.BLEND),g=!1);return}if(g===!1&&(ce(i.BLEND),g=!0),x!==ou){if(x!==_||$e!==P){if((m!==wn||v!==wn)&&(i.blendEquation(i.FUNC_ADD),m=wn,v=wn),$e)switch(x){case ci:i.blendFuncSeparate(i.ONE,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case ui:i.blendFunc(i.ONE,i.ONE);break;case wa:i.blendFuncSeparate(i.ZERO,i.ONE_MINUS_SRC_COLOR,i.ZERO,i.ONE);break;case Ca:i.blendFuncSeparate(i.ZERO,i.SRC_COLOR,i.ZERO,i.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",x);break}else switch(x){case ci:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case ui:i.blendFunc(i.SRC_ALPHA,i.ONE);break;case wa:i.blendFuncSeparate(i.ZERO,i.ONE_MINUS_SRC_COLOR,i.ZERO,i.ONE);break;case Ca:i.blendFunc(i.ZERO,i.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",x);break}p=null,E=null,b=null,R=null,T.set(0,0,0),A=0,_=x,P=$e}return}pe=pe||V,Ve=Ve||K,ze=ze||se,(V!==m||pe!==v)&&(i.blendEquationSeparate(k[V],k[pe]),m=V,v=pe),(K!==p||se!==E||Ve!==b||ze!==R)&&(i.blendFuncSeparate(Fe[K],Fe[se],Fe[Ve],Fe[ze]),p=K,E=se,b=Ve,R=ze),(Ze.equals(T)===!1||lt!==A)&&(i.blendColor(Ze.r,Ze.g,Ze.b,lt),T.copy(Ze),A=lt),_=x,P=!1}function Ge(x,V){x.side===Wt?ne(i.CULL_FACE):ce(i.CULL_FACE);let K=x.side===St;V&&(K=!K),Ee(K),x.blending===ci&&x.transparent===!1?xe(en):xe(x.blending,x.blendEquation,x.blendSrc,x.blendDst,x.blendEquationAlpha,x.blendSrcAlpha,x.blendDstAlpha,x.blendColor,x.blendAlpha,x.premultipliedAlpha),s.setFunc(x.depthFunc),s.setTest(x.depthTest),s.setMask(x.depthWrite),r.setMask(x.colorWrite);const se=x.stencilWrite;a.setTest(se),se&&(a.setMask(x.stencilWriteMask),a.setFunc(x.stencilFunc,x.stencilRef,x.stencilFuncMask),a.setOp(x.stencilFail,x.stencilZFail,x.stencilZPass)),S(x.polygonOffset,x.polygonOffsetFactor,x.polygonOffsetUnits),x.alphaToCoverage===!0?ce(i.SAMPLE_ALPHA_TO_COVERAGE):ne(i.SAMPLE_ALPHA_TO_COVERAGE)}function Ee(x){y!==x&&(x?i.frontFace(i.CW):i.frontFace(i.CCW),y=x)}function We(x){x!==ru?(ce(i.CULL_FACE),x!==M&&(x===Aa?i.cullFace(i.BACK):x===su?i.cullFace(i.FRONT):i.cullFace(i.FRONT_AND_BACK))):ne(i.CULL_FACE),M=x}function w(x){x!==F&&(H&&i.lineWidth(x),F=x)}function S(x,V,K){x?(ce(i.POLYGON_OFFSET_FILL),(L!==V||C!==K)&&(i.polygonOffset(V,K),L=V,C=K)):ne(i.POLYGON_OFFSET_FILL)}function q(x){x?ce(i.SCISSOR_TEST):ne(i.SCISSOR_TEST)}function Z(x){x===void 0&&(x=i.TEXTURE0+U-1),z!==x&&(i.activeTexture(x),z=x)}function te(x,V,K){K===void 0&&(z===null?K=i.TEXTURE0+U-1:K=z);let se=j[K];se===void 0&&(se={type:void 0,texture:void 0},j[K]=se),(se.type!==x||se.texture!==V)&&(z!==K&&(i.activeTexture(K),z=K),i.bindTexture(x,V||Q[x]),se.type=x,se.texture=V)}function ie(){const x=j[z];x!==void 0&&x.type!==void 0&&(i.bindTexture(x.type,null),x.type=void 0,x.texture=void 0)}function De(){try{i.compressedTexImage2D.apply(i,arguments)}catch(x){console.error("THREE.WebGLState:",x)}}function re(){try{i.compressedTexImage3D.apply(i,arguments)}catch(x){console.error("THREE.WebGLState:",x)}}function ye(){try{i.texSubImage2D.apply(i,arguments)}catch(x){console.error("THREE.WebGLState:",x)}}function Ae(){try{i.texSubImage3D.apply(i,arguments)}catch(x){console.error("THREE.WebGLState:",x)}}function ae(){try{i.compressedTexSubImage2D.apply(i,arguments)}catch(x){console.error("THREE.WebGLState:",x)}}function fe(){try{i.compressedTexSubImage3D.apply(i,arguments)}catch(x){console.error("THREE.WebGLState:",x)}}function Re(){try{i.texStorage2D.apply(i,arguments)}catch(x){console.error("THREE.WebGLState:",x)}}function ge(){try{i.texStorage3D.apply(i,arguments)}catch(x){console.error("THREE.WebGLState:",x)}}function _e(){try{i.texImage2D.apply(i,arguments)}catch(x){console.error("THREE.WebGLState:",x)}}function ke(){try{i.texImage3D.apply(i,arguments)}catch(x){console.error("THREE.WebGLState:",x)}}function He(x){ee.equals(x)===!1&&(i.scissor(x.x,x.y,x.z,x.w),ee.copy(x))}function qe(x){me.equals(x)===!1&&(i.viewport(x.x,x.y,x.z,x.w),me.copy(x))}function Xe(x,V){let K=l.get(V);K===void 0&&(K=new WeakMap,l.set(V,K));let se=K.get(x);se===void 0&&(se=i.getUniformBlockIndex(V,x.name),K.set(x,se))}function Ye(x,V){const se=l.get(V).get(x);o.get(V)!==se&&(i.uniformBlockBinding(V,se,x.__bindingPointIndex),o.set(V,se))}function Me(){i.disable(i.BLEND),i.disable(i.CULL_FACE),i.disable(i.DEPTH_TEST),i.disable(i.POLYGON_OFFSET_FILL),i.disable(i.SCISSOR_TEST),i.disable(i.STENCIL_TEST),i.disable(i.SAMPLE_ALPHA_TO_COVERAGE),i.blendEquation(i.FUNC_ADD),i.blendFunc(i.ONE,i.ZERO),i.blendFuncSeparate(i.ONE,i.ZERO,i.ONE,i.ZERO),i.blendColor(0,0,0,0),i.colorMask(!0,!0,!0,!0),i.clearColor(0,0,0,0),i.depthMask(!0),i.depthFunc(i.LESS),i.clearDepth(1),i.stencilMask(4294967295),i.stencilFunc(i.ALWAYS,0,4294967295),i.stencilOp(i.KEEP,i.KEEP,i.KEEP),i.clearStencil(0),i.cullFace(i.BACK),i.frontFace(i.CCW),i.polygonOffset(0,0),i.activeTexture(i.TEXTURE0),i.bindFramebuffer(i.FRAMEBUFFER,null),i.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),i.bindFramebuffer(i.READ_FRAMEBUFFER,null),i.useProgram(null),i.lineWidth(1),i.scissor(0,0,i.canvas.width,i.canvas.height),i.viewport(0,0,i.canvas.width,i.canvas.height),c={},z=null,j={},u={},d=new WeakMap,h=[],f=null,g=!1,_=null,m=null,p=null,E=null,v=null,b=null,R=null,T=new be(0,0,0),A=0,P=!1,y=null,M=null,F=null,L=null,C=null,ee.set(0,0,i.canvas.width,i.canvas.height),me.set(0,0,i.canvas.width,i.canvas.height),r.reset(),s.reset(),a.reset()}return{buffers:{color:r,depth:s,stencil:a},enable:ce,disable:ne,bindFramebuffer:ve,drawBuffers:Te,useProgram:Ce,setBlending:xe,setMaterial:Ge,setFlipSided:Ee,setCullFace:We,setLineWidth:w,setPolygonOffset:S,setScissorTest:q,activeTexture:Z,bindTexture:te,unbindTexture:ie,compressedTexImage2D:De,compressedTexImage3D:re,texImage2D:_e,texImage3D:ke,updateUBOMapping:Xe,uniformBlockBinding:Ye,texStorage2D:Re,texStorage3D:ge,texSubImage2D:ye,texSubImage3D:Ae,compressedTexSubImage2D:ae,compressedTexSubImage3D:fe,scissor:He,viewport:qe,reset:Me}}function y0(i,e,t,n,r,s,a){const o=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,l=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new ue,u=new WeakMap;let d;const h=new WeakMap;let f=!1;try{f=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function g(w,S){return f?new OffscreenCanvas(w,S):Lr("canvas")}function _(w,S,q){let Z=1;const te=We(w);if((te.width>q||te.height>q)&&(Z=q/Math.max(te.width,te.height)),Z<1)if(typeof HTMLImageElement<"u"&&w instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&w instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&w instanceof ImageBitmap||typeof VideoFrame<"u"&&w instanceof VideoFrame){const ie=Math.floor(Z*te.width),De=Math.floor(Z*te.height);d===void 0&&(d=g(ie,De));const re=S?g(ie,De):d;return re.width=ie,re.height=De,re.getContext("2d").drawImage(w,0,0,ie,De),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+te.width+"x"+te.height+") to ("+ie+"x"+De+")."),re}else return"data"in w&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+te.width+"x"+te.height+")."),w;return w}function m(w){return w.generateMipmaps&&w.minFilter!==Ut&&w.minFilter!==zt}function p(w){i.generateMipmap(w)}function E(w,S,q,Z,te=!1){if(w!==null){if(i[w]!==void 0)return i[w];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+w+"'")}let ie=S;if(S===i.RED&&(q===i.FLOAT&&(ie=i.R32F),q===i.HALF_FLOAT&&(ie=i.R16F),q===i.UNSIGNED_BYTE&&(ie=i.R8)),S===i.RED_INTEGER&&(q===i.UNSIGNED_BYTE&&(ie=i.R8UI),q===i.UNSIGNED_SHORT&&(ie=i.R16UI),q===i.UNSIGNED_INT&&(ie=i.R32UI),q===i.BYTE&&(ie=i.R8I),q===i.SHORT&&(ie=i.R16I),q===i.INT&&(ie=i.R32I)),S===i.RG&&(q===i.FLOAT&&(ie=i.RG32F),q===i.HALF_FLOAT&&(ie=i.RG16F),q===i.UNSIGNED_BYTE&&(ie=i.RG8)),S===i.RG_INTEGER&&(q===i.UNSIGNED_BYTE&&(ie=i.RG8UI),q===i.UNSIGNED_SHORT&&(ie=i.RG16UI),q===i.UNSIGNED_INT&&(ie=i.RG32UI),q===i.BYTE&&(ie=i.RG8I),q===i.SHORT&&(ie=i.RG16I),q===i.INT&&(ie=i.RG32I)),S===i.RGB&&q===i.UNSIGNED_INT_5_9_9_9_REV&&(ie=i.RGB9_E5),S===i.RGBA){const De=te?wr:je.getTransfer(Z);q===i.FLOAT&&(ie=i.RGBA32F),q===i.HALF_FLOAT&&(ie=i.RGBA16F),q===i.UNSIGNED_BYTE&&(ie=De===Ke?i.SRGB8_ALPHA8:i.RGBA8),q===i.UNSIGNED_SHORT_4_4_4_4&&(ie=i.RGBA4),q===i.UNSIGNED_SHORT_5_5_5_1&&(ie=i.RGB5_A1)}return(ie===i.R16F||ie===i.R32F||ie===i.RG16F||ie===i.RG32F||ie===i.RGBA16F||ie===i.RGBA32F)&&e.get("EXT_color_buffer_float"),ie}function v(w,S){return m(w)===!0||w.isFramebufferTexture&&w.minFilter!==Ut&&w.minFilter!==zt?Math.log2(Math.max(S.width,S.height))+1:w.mipmaps!==void 0&&w.mipmaps.length>0?w.mipmaps.length:w.isCompressedTexture&&Array.isArray(w.image)?S.mipmaps.length:1}function b(w){const S=w.target;S.removeEventListener("dispose",b),T(S),S.isVideoTexture&&u.delete(S)}function R(w){const S=w.target;S.removeEventListener("dispose",R),P(S)}function T(w){const S=n.get(w);if(S.__webglInit===void 0)return;const q=w.source,Z=h.get(q);if(Z){const te=Z[S.__cacheKey];te.usedTimes--,te.usedTimes===0&&A(w),Object.keys(Z).length===0&&h.delete(q)}n.remove(w)}function A(w){const S=n.get(w);i.deleteTexture(S.__webglTexture);const q=w.source,Z=h.get(q);delete Z[S.__cacheKey],a.memory.textures--}function P(w){const S=n.get(w);if(w.depthTexture&&w.depthTexture.dispose(),w.isWebGLCubeRenderTarget)for(let Z=0;Z<6;Z++){if(Array.isArray(S.__webglFramebuffer[Z]))for(let te=0;te<S.__webglFramebuffer[Z].length;te++)i.deleteFramebuffer(S.__webglFramebuffer[Z][te]);else i.deleteFramebuffer(S.__webglFramebuffer[Z]);S.__webglDepthbuffer&&i.deleteRenderbuffer(S.__webglDepthbuffer[Z])}else{if(Array.isArray(S.__webglFramebuffer))for(let Z=0;Z<S.__webglFramebuffer.length;Z++)i.deleteFramebuffer(S.__webglFramebuffer[Z]);else i.deleteFramebuffer(S.__webglFramebuffer);if(S.__webglDepthbuffer&&i.deleteRenderbuffer(S.__webglDepthbuffer),S.__webglMultisampledFramebuffer&&i.deleteFramebuffer(S.__webglMultisampledFramebuffer),S.__webglColorRenderbuffer)for(let Z=0;Z<S.__webglColorRenderbuffer.length;Z++)S.__webglColorRenderbuffer[Z]&&i.deleteRenderbuffer(S.__webglColorRenderbuffer[Z]);S.__webglDepthRenderbuffer&&i.deleteRenderbuffer(S.__webglDepthRenderbuffer)}const q=w.textures;for(let Z=0,te=q.length;Z<te;Z++){const ie=n.get(q[Z]);ie.__webglTexture&&(i.deleteTexture(ie.__webglTexture),a.memory.textures--),n.remove(q[Z])}n.remove(w)}let y=0;function M(){y=0}function F(){const w=y;return w>=r.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+w+" texture units while this GPU supports only "+r.maxTextures),y+=1,w}function L(w){const S=[];return S.push(w.wrapS),S.push(w.wrapT),S.push(w.wrapR||0),S.push(w.magFilter),S.push(w.minFilter),S.push(w.anisotropy),S.push(w.internalFormat),S.push(w.format),S.push(w.type),S.push(w.generateMipmaps),S.push(w.premultiplyAlpha),S.push(w.flipY),S.push(w.unpackAlignment),S.push(w.colorSpace),S.join()}function C(w,S){const q=n.get(w);if(w.isVideoTexture&&Ge(w),w.isRenderTargetTexture===!1&&w.version>0&&q.__version!==w.version){const Z=w.image;if(Z===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(Z.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{ee(q,w,S);return}}t.bindTexture(i.TEXTURE_2D,q.__webglTexture,i.TEXTURE0+S)}function U(w,S){const q=n.get(w);if(w.version>0&&q.__version!==w.version){ee(q,w,S);return}t.bindTexture(i.TEXTURE_2D_ARRAY,q.__webglTexture,i.TEXTURE0+S)}function H(w,S){const q=n.get(w);if(w.version>0&&q.__version!==w.version){ee(q,w,S);return}t.bindTexture(i.TEXTURE_3D,q.__webglTexture,i.TEXTURE0+S)}function Y(w,S){const q=n.get(w);if(w.version>0&&q.__version!==w.version){me(q,w,S);return}t.bindTexture(i.TEXTURE_CUBE_MAP,q.__webglTexture,i.TEXTURE0+S)}const J={[Gs]:i.REPEAT,[Pn]:i.CLAMP_TO_EDGE,[Ws]:i.MIRRORED_REPEAT},z={[Ut]:i.NEAREST,[ku]:i.NEAREST_MIPMAP_NEAREST,[Yi]:i.NEAREST_MIPMAP_LINEAR,[zt]:i.LINEAR,[Yr]:i.LINEAR_MIPMAP_NEAREST,[Ln]:i.LINEAR_MIPMAP_LINEAR},j={[th]:i.NEVER,[oh]:i.ALWAYS,[nh]:i.LESS,[Vl]:i.LEQUAL,[ih]:i.EQUAL,[ah]:i.GEQUAL,[rh]:i.GREATER,[sh]:i.NOTEQUAL};function $(w,S){if(S.type===fn&&e.has("OES_texture_float_linear")===!1&&(S.magFilter===zt||S.magFilter===Yr||S.magFilter===Yi||S.magFilter===Ln||S.minFilter===zt||S.minFilter===Yr||S.minFilter===Yi||S.minFilter===Ln)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),i.texParameteri(w,i.TEXTURE_WRAP_S,J[S.wrapS]),i.texParameteri(w,i.TEXTURE_WRAP_T,J[S.wrapT]),(w===i.TEXTURE_3D||w===i.TEXTURE_2D_ARRAY)&&i.texParameteri(w,i.TEXTURE_WRAP_R,J[S.wrapR]),i.texParameteri(w,i.TEXTURE_MAG_FILTER,z[S.magFilter]),i.texParameteri(w,i.TEXTURE_MIN_FILTER,z[S.minFilter]),S.compareFunction&&(i.texParameteri(w,i.TEXTURE_COMPARE_MODE,i.COMPARE_REF_TO_TEXTURE),i.texParameteri(w,i.TEXTURE_COMPARE_FUNC,j[S.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(S.magFilter===Ut||S.minFilter!==Yi&&S.minFilter!==Ln||S.type===fn&&e.has("OES_texture_float_linear")===!1)return;if(S.anisotropy>1||n.get(S).__currentAnisotropy){const q=e.get("EXT_texture_filter_anisotropic");i.texParameterf(w,q.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(S.anisotropy,r.getMaxAnisotropy())),n.get(S).__currentAnisotropy=S.anisotropy}}}function N(w,S){let q=!1;w.__webglInit===void 0&&(w.__webglInit=!0,S.addEventListener("dispose",b));const Z=S.source;let te=h.get(Z);te===void 0&&(te={},h.set(Z,te));const ie=L(S);if(ie!==w.__cacheKey){te[ie]===void 0&&(te[ie]={texture:i.createTexture(),usedTimes:0},a.memory.textures++,q=!0),te[ie].usedTimes++;const De=te[w.__cacheKey];De!==void 0&&(te[w.__cacheKey].usedTimes--,De.usedTimes===0&&A(S)),w.__cacheKey=ie,w.__webglTexture=te[ie].texture}return q}function ee(w,S,q){let Z=i.TEXTURE_2D;(S.isDataArrayTexture||S.isCompressedArrayTexture)&&(Z=i.TEXTURE_2D_ARRAY),S.isData3DTexture&&(Z=i.TEXTURE_3D);const te=N(w,S),ie=S.source;t.bindTexture(Z,w.__webglTexture,i.TEXTURE0+q);const De=n.get(ie);if(ie.version!==De.__version||te===!0){t.activeTexture(i.TEXTURE0+q);const re=je.getPrimaries(je.workingColorSpace),ye=S.colorSpace===dn?null:je.getPrimaries(S.colorSpace),Ae=S.colorSpace===dn||re===ye?i.NONE:i.BROWSER_DEFAULT_WEBGL;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,S.flipY),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,S.premultiplyAlpha),i.pixelStorei(i.UNPACK_ALIGNMENT,S.unpackAlignment),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,Ae);let ae=_(S.image,!1,r.maxTextureSize);ae=Ee(S,ae);const fe=s.convert(S.format,S.colorSpace),Re=s.convert(S.type);let ge=E(S.internalFormat,fe,Re,S.colorSpace,S.isVideoTexture);$(Z,S);let _e;const ke=S.mipmaps,He=S.isVideoTexture!==!0&&ge!==Hl,qe=De.__version===void 0||te===!0,Xe=ie.dataReady,Ye=v(S,ae);if(S.isDepthTexture)ge=i.DEPTH_COMPONENT16,S.type===fn?ge=i.DEPTH_COMPONENT32F:S.type===gi?ge=i.DEPTH_COMPONENT24:S.type===zi&&(ge=i.DEPTH24_STENCIL8),qe&&(He?t.texStorage2D(i.TEXTURE_2D,1,ge,ae.width,ae.height):t.texImage2D(i.TEXTURE_2D,0,ge,ae.width,ae.height,0,fe,Re,null));else if(S.isDataTexture)if(ke.length>0){He&&qe&&t.texStorage2D(i.TEXTURE_2D,Ye,ge,ke[0].width,ke[0].height);for(let Me=0,x=ke.length;Me<x;Me++)_e=ke[Me],He?Xe&&t.texSubImage2D(i.TEXTURE_2D,Me,0,0,_e.width,_e.height,fe,Re,_e.data):t.texImage2D(i.TEXTURE_2D,Me,ge,_e.width,_e.height,0,fe,Re,_e.data);S.generateMipmaps=!1}else He?(qe&&t.texStorage2D(i.TEXTURE_2D,Ye,ge,ae.width,ae.height),Xe&&t.texSubImage2D(i.TEXTURE_2D,0,0,0,ae.width,ae.height,fe,Re,ae.data)):t.texImage2D(i.TEXTURE_2D,0,ge,ae.width,ae.height,0,fe,Re,ae.data);else if(S.isCompressedTexture)if(S.isCompressedArrayTexture){He&&qe&&t.texStorage3D(i.TEXTURE_2D_ARRAY,Ye,ge,ke[0].width,ke[0].height,ae.depth);for(let Me=0,x=ke.length;Me<x;Me++)_e=ke[Me],S.format!==Xt?fe!==null?He?Xe&&t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,Me,0,0,0,_e.width,_e.height,ae.depth,fe,_e.data,0,0):t.compressedTexImage3D(i.TEXTURE_2D_ARRAY,Me,ge,_e.width,_e.height,ae.depth,0,_e.data,0,0):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):He?Xe&&t.texSubImage3D(i.TEXTURE_2D_ARRAY,Me,0,0,0,_e.width,_e.height,ae.depth,fe,Re,_e.data):t.texImage3D(i.TEXTURE_2D_ARRAY,Me,ge,_e.width,_e.height,ae.depth,0,fe,Re,_e.data)}else{He&&qe&&t.texStorage2D(i.TEXTURE_2D,Ye,ge,ke[0].width,ke[0].height);for(let Me=0,x=ke.length;Me<x;Me++)_e=ke[Me],S.format!==Xt?fe!==null?He?Xe&&t.compressedTexSubImage2D(i.TEXTURE_2D,Me,0,0,_e.width,_e.height,fe,_e.data):t.compressedTexImage2D(i.TEXTURE_2D,Me,ge,_e.width,_e.height,0,_e.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):He?Xe&&t.texSubImage2D(i.TEXTURE_2D,Me,0,0,_e.width,_e.height,fe,Re,_e.data):t.texImage2D(i.TEXTURE_2D,Me,ge,_e.width,_e.height,0,fe,Re,_e.data)}else if(S.isDataArrayTexture)He?(qe&&t.texStorage3D(i.TEXTURE_2D_ARRAY,Ye,ge,ae.width,ae.height,ae.depth),Xe&&t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,0,ae.width,ae.height,ae.depth,fe,Re,ae.data)):t.texImage3D(i.TEXTURE_2D_ARRAY,0,ge,ae.width,ae.height,ae.depth,0,fe,Re,ae.data);else if(S.isData3DTexture)He?(qe&&t.texStorage3D(i.TEXTURE_3D,Ye,ge,ae.width,ae.height,ae.depth),Xe&&t.texSubImage3D(i.TEXTURE_3D,0,0,0,0,ae.width,ae.height,ae.depth,fe,Re,ae.data)):t.texImage3D(i.TEXTURE_3D,0,ge,ae.width,ae.height,ae.depth,0,fe,Re,ae.data);else if(S.isFramebufferTexture){if(qe)if(He)t.texStorage2D(i.TEXTURE_2D,Ye,ge,ae.width,ae.height);else{let Me=ae.width,x=ae.height;for(let V=0;V<Ye;V++)t.texImage2D(i.TEXTURE_2D,V,ge,Me,x,0,fe,Re,null),Me>>=1,x>>=1}}else if(ke.length>0){if(He&&qe){const Me=We(ke[0]);t.texStorage2D(i.TEXTURE_2D,Ye,ge,Me.width,Me.height)}for(let Me=0,x=ke.length;Me<x;Me++)_e=ke[Me],He?Xe&&t.texSubImage2D(i.TEXTURE_2D,Me,0,0,fe,Re,_e):t.texImage2D(i.TEXTURE_2D,Me,ge,fe,Re,_e);S.generateMipmaps=!1}else if(He){if(qe){const Me=We(ae);t.texStorage2D(i.TEXTURE_2D,Ye,ge,Me.width,Me.height)}Xe&&t.texSubImage2D(i.TEXTURE_2D,0,0,0,fe,Re,ae)}else t.texImage2D(i.TEXTURE_2D,0,ge,fe,Re,ae);m(S)&&p(Z),De.__version=ie.version,S.onUpdate&&S.onUpdate(S)}w.__version=S.version}function me(w,S,q){if(S.image.length!==6)return;const Z=N(w,S),te=S.source;t.bindTexture(i.TEXTURE_CUBE_MAP,w.__webglTexture,i.TEXTURE0+q);const ie=n.get(te);if(te.version!==ie.__version||Z===!0){t.activeTexture(i.TEXTURE0+q);const De=je.getPrimaries(je.workingColorSpace),re=S.colorSpace===dn?null:je.getPrimaries(S.colorSpace),ye=S.colorSpace===dn||De===re?i.NONE:i.BROWSER_DEFAULT_WEBGL;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,S.flipY),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,S.premultiplyAlpha),i.pixelStorei(i.UNPACK_ALIGNMENT,S.unpackAlignment),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,ye);const Ae=S.isCompressedTexture||S.image[0].isCompressedTexture,ae=S.image[0]&&S.image[0].isDataTexture,fe=[];for(let x=0;x<6;x++)!Ae&&!ae?fe[x]=_(S.image[x],!0,r.maxCubemapSize):fe[x]=ae?S.image[x].image:S.image[x],fe[x]=Ee(S,fe[x]);const Re=fe[0],ge=s.convert(S.format,S.colorSpace),_e=s.convert(S.type),ke=E(S.internalFormat,ge,_e,S.colorSpace),He=S.isVideoTexture!==!0,qe=ie.__version===void 0||Z===!0,Xe=te.dataReady;let Ye=v(S,Re);$(i.TEXTURE_CUBE_MAP,S);let Me;if(Ae){He&&qe&&t.texStorage2D(i.TEXTURE_CUBE_MAP,Ye,ke,Re.width,Re.height);for(let x=0;x<6;x++){Me=fe[x].mipmaps;for(let V=0;V<Me.length;V++){const K=Me[V];S.format!==Xt?ge!==null?He?Xe&&t.compressedTexSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+x,V,0,0,K.width,K.height,ge,K.data):t.compressedTexImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+x,V,ke,K.width,K.height,0,K.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):He?Xe&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+x,V,0,0,K.width,K.height,ge,_e,K.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+x,V,ke,K.width,K.height,0,ge,_e,K.data)}}}else{if(Me=S.mipmaps,He&&qe){Me.length>0&&Ye++;const x=We(fe[0]);t.texStorage2D(i.TEXTURE_CUBE_MAP,Ye,ke,x.width,x.height)}for(let x=0;x<6;x++)if(ae){He?Xe&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+x,0,0,0,fe[x].width,fe[x].height,ge,_e,fe[x].data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+x,0,ke,fe[x].width,fe[x].height,0,ge,_e,fe[x].data);for(let V=0;V<Me.length;V++){const se=Me[V].image[x].image;He?Xe&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+x,V+1,0,0,se.width,se.height,ge,_e,se.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+x,V+1,ke,se.width,se.height,0,ge,_e,se.data)}}else{He?Xe&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+x,0,0,0,ge,_e,fe[x]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+x,0,ke,ge,_e,fe[x]);for(let V=0;V<Me.length;V++){const K=Me[V];He?Xe&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+x,V+1,0,0,ge,_e,K.image[x]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+x,V+1,ke,ge,_e,K.image[x])}}}m(S)&&p(i.TEXTURE_CUBE_MAP),ie.__version=te.version,S.onUpdate&&S.onUpdate(S)}w.__version=S.version}function O(w,S,q,Z,te,ie){const De=s.convert(q.format,q.colorSpace),re=s.convert(q.type),ye=E(q.internalFormat,De,re,q.colorSpace);if(!n.get(S).__hasExternalTextures){const ae=Math.max(1,S.width>>ie),fe=Math.max(1,S.height>>ie);te===i.TEXTURE_3D||te===i.TEXTURE_2D_ARRAY?t.texImage3D(te,ie,ye,ae,fe,S.depth,0,De,re,null):t.texImage2D(te,ie,ye,ae,fe,0,De,re,null)}t.bindFramebuffer(i.FRAMEBUFFER,w),xe(S)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,Z,te,n.get(q).__webglTexture,0,Fe(S)):(te===i.TEXTURE_2D||te>=i.TEXTURE_CUBE_MAP_POSITIVE_X&&te<=i.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&i.framebufferTexture2D(i.FRAMEBUFFER,Z,te,n.get(q).__webglTexture,ie),t.bindFramebuffer(i.FRAMEBUFFER,null)}function Q(w,S,q){if(i.bindRenderbuffer(i.RENDERBUFFER,w),S.depthBuffer&&!S.stencilBuffer){let Z=i.DEPTH_COMPONENT24;if(q||xe(S)){const te=S.depthTexture;te&&te.isDepthTexture&&(te.type===fn?Z=i.DEPTH_COMPONENT32F:te.type===gi&&(Z=i.DEPTH_COMPONENT24));const ie=Fe(S);xe(S)?o.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,ie,Z,S.width,S.height):i.renderbufferStorageMultisample(i.RENDERBUFFER,ie,Z,S.width,S.height)}else i.renderbufferStorage(i.RENDERBUFFER,Z,S.width,S.height);i.framebufferRenderbuffer(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.RENDERBUFFER,w)}else if(S.depthBuffer&&S.stencilBuffer){const Z=Fe(S);q&&xe(S)===!1?i.renderbufferStorageMultisample(i.RENDERBUFFER,Z,i.DEPTH24_STENCIL8,S.width,S.height):xe(S)?o.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,Z,i.DEPTH24_STENCIL8,S.width,S.height):i.renderbufferStorage(i.RENDERBUFFER,i.DEPTH_STENCIL,S.width,S.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.RENDERBUFFER,w)}else{const Z=S.textures;for(let te=0;te<Z.length;te++){const ie=Z[te],De=s.convert(ie.format,ie.colorSpace),re=s.convert(ie.type),ye=E(ie.internalFormat,De,re,ie.colorSpace),Ae=Fe(S);q&&xe(S)===!1?i.renderbufferStorageMultisample(i.RENDERBUFFER,Ae,ye,S.width,S.height):xe(S)?o.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,Ae,ye,S.width,S.height):i.renderbufferStorage(i.RENDERBUFFER,ye,S.width,S.height)}}i.bindRenderbuffer(i.RENDERBUFFER,null)}function ce(w,S){if(S&&S.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(i.FRAMEBUFFER,w),!(S.depthTexture&&S.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");(!n.get(S.depthTexture).__webglTexture||S.depthTexture.image.width!==S.width||S.depthTexture.image.height!==S.height)&&(S.depthTexture.image.width=S.width,S.depthTexture.image.height=S.height,S.depthTexture.needsUpdate=!0),C(S.depthTexture,0);const Z=n.get(S.depthTexture).__webglTexture,te=Fe(S);if(S.depthTexture.format===hi)xe(S)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_2D,Z,0,te):i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_2D,Z,0);else if(S.depthTexture.format===Ni)xe(S)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.TEXTURE_2D,Z,0,te):i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.TEXTURE_2D,Z,0);else throw new Error("Unknown depthTexture format")}function ne(w){const S=n.get(w),q=w.isWebGLCubeRenderTarget===!0;if(w.depthTexture&&!S.__autoAllocateDepthBuffer){if(q)throw new Error("target.depthTexture not supported in Cube render targets");ce(S.__webglFramebuffer,w)}else if(q){S.__webglDepthbuffer=[];for(let Z=0;Z<6;Z++)t.bindFramebuffer(i.FRAMEBUFFER,S.__webglFramebuffer[Z]),S.__webglDepthbuffer[Z]=i.createRenderbuffer(),Q(S.__webglDepthbuffer[Z],w,!1)}else t.bindFramebuffer(i.FRAMEBUFFER,S.__webglFramebuffer),S.__webglDepthbuffer=i.createRenderbuffer(),Q(S.__webglDepthbuffer,w,!1);t.bindFramebuffer(i.FRAMEBUFFER,null)}function ve(w,S,q){const Z=n.get(w);S!==void 0&&O(Z.__webglFramebuffer,w,w.texture,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,0),q!==void 0&&ne(w)}function Te(w){const S=w.texture,q=n.get(w),Z=n.get(S);w.addEventListener("dispose",R);const te=w.textures,ie=w.isWebGLCubeRenderTarget===!0,De=te.length>1;if(De||(Z.__webglTexture===void 0&&(Z.__webglTexture=i.createTexture()),Z.__version=S.version,a.memory.textures++),ie){q.__webglFramebuffer=[];for(let re=0;re<6;re++)if(S.mipmaps&&S.mipmaps.length>0){q.__webglFramebuffer[re]=[];for(let ye=0;ye<S.mipmaps.length;ye++)q.__webglFramebuffer[re][ye]=i.createFramebuffer()}else q.__webglFramebuffer[re]=i.createFramebuffer()}else{if(S.mipmaps&&S.mipmaps.length>0){q.__webglFramebuffer=[];for(let re=0;re<S.mipmaps.length;re++)q.__webglFramebuffer[re]=i.createFramebuffer()}else q.__webglFramebuffer=i.createFramebuffer();if(De)for(let re=0,ye=te.length;re<ye;re++){const Ae=n.get(te[re]);Ae.__webglTexture===void 0&&(Ae.__webglTexture=i.createTexture(),a.memory.textures++)}if(w.samples>0&&xe(w)===!1){q.__webglMultisampledFramebuffer=i.createFramebuffer(),q.__webglColorRenderbuffer=[],t.bindFramebuffer(i.FRAMEBUFFER,q.__webglMultisampledFramebuffer);for(let re=0;re<te.length;re++){const ye=te[re];q.__webglColorRenderbuffer[re]=i.createRenderbuffer(),i.bindRenderbuffer(i.RENDERBUFFER,q.__webglColorRenderbuffer[re]);const Ae=s.convert(ye.format,ye.colorSpace),ae=s.convert(ye.type),fe=E(ye.internalFormat,Ae,ae,ye.colorSpace,w.isXRRenderTarget===!0),Re=Fe(w);i.renderbufferStorageMultisample(i.RENDERBUFFER,Re,fe,w.width,w.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+re,i.RENDERBUFFER,q.__webglColorRenderbuffer[re])}i.bindRenderbuffer(i.RENDERBUFFER,null),w.depthBuffer&&(q.__webglDepthRenderbuffer=i.createRenderbuffer(),Q(q.__webglDepthRenderbuffer,w,!0)),t.bindFramebuffer(i.FRAMEBUFFER,null)}}if(ie){t.bindTexture(i.TEXTURE_CUBE_MAP,Z.__webglTexture),$(i.TEXTURE_CUBE_MAP,S);for(let re=0;re<6;re++)if(S.mipmaps&&S.mipmaps.length>0)for(let ye=0;ye<S.mipmaps.length;ye++)O(q.__webglFramebuffer[re][ye],w,S,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+re,ye);else O(q.__webglFramebuffer[re],w,S,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+re,0);m(S)&&p(i.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(De){for(let re=0,ye=te.length;re<ye;re++){const Ae=te[re],ae=n.get(Ae);t.bindTexture(i.TEXTURE_2D,ae.__webglTexture),$(i.TEXTURE_2D,Ae),O(q.__webglFramebuffer,w,Ae,i.COLOR_ATTACHMENT0+re,i.TEXTURE_2D,0),m(Ae)&&p(i.TEXTURE_2D)}t.unbindTexture()}else{let re=i.TEXTURE_2D;if((w.isWebGL3DRenderTarget||w.isWebGLArrayRenderTarget)&&(re=w.isWebGL3DRenderTarget?i.TEXTURE_3D:i.TEXTURE_2D_ARRAY),t.bindTexture(re,Z.__webglTexture),$(re,S),S.mipmaps&&S.mipmaps.length>0)for(let ye=0;ye<S.mipmaps.length;ye++)O(q.__webglFramebuffer[ye],w,S,i.COLOR_ATTACHMENT0,re,ye);else O(q.__webglFramebuffer,w,S,i.COLOR_ATTACHMENT0,re,0);m(S)&&p(re),t.unbindTexture()}w.depthBuffer&&ne(w)}function Ce(w){const S=w.textures;for(let q=0,Z=S.length;q<Z;q++){const te=S[q];if(m(te)){const ie=w.isWebGLCubeRenderTarget?i.TEXTURE_CUBE_MAP:i.TEXTURE_2D,De=n.get(te).__webglTexture;t.bindTexture(ie,De),p(ie),t.unbindTexture()}}}function k(w){if(w.samples>0&&xe(w)===!1){const S=w.textures,q=w.width,Z=w.height;let te=i.COLOR_BUFFER_BIT;const ie=[],De=w.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,re=n.get(w),ye=S.length>1;if(ye)for(let Ae=0;Ae<S.length;Ae++)t.bindFramebuffer(i.FRAMEBUFFER,re.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+Ae,i.RENDERBUFFER,null),t.bindFramebuffer(i.FRAMEBUFFER,re.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+Ae,i.TEXTURE_2D,null,0);t.bindFramebuffer(i.READ_FRAMEBUFFER,re.__webglMultisampledFramebuffer),t.bindFramebuffer(i.DRAW_FRAMEBUFFER,re.__webglFramebuffer);for(let Ae=0;Ae<S.length;Ae++){ie.push(i.COLOR_ATTACHMENT0+Ae),w.depthBuffer&&ie.push(De);const ae=re.__ignoreDepthValues!==void 0?re.__ignoreDepthValues:!1;if(ae===!1&&(w.depthBuffer&&(te|=i.DEPTH_BUFFER_BIT),w.stencilBuffer&&re.__isTransmissionRenderTarget!==!0&&(te|=i.STENCIL_BUFFER_BIT)),ye&&i.framebufferRenderbuffer(i.READ_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.RENDERBUFFER,re.__webglColorRenderbuffer[Ae]),ae===!0&&(i.invalidateFramebuffer(i.READ_FRAMEBUFFER,[De]),i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,[De])),ye){const fe=n.get(S[Ae]).__webglTexture;i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,fe,0)}i.blitFramebuffer(0,0,q,Z,0,0,q,Z,te,i.NEAREST),l&&i.invalidateFramebuffer(i.READ_FRAMEBUFFER,ie)}if(t.bindFramebuffer(i.READ_FRAMEBUFFER,null),t.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),ye)for(let Ae=0;Ae<S.length;Ae++){t.bindFramebuffer(i.FRAMEBUFFER,re.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+Ae,i.RENDERBUFFER,re.__webglColorRenderbuffer[Ae]);const ae=n.get(S[Ae]).__webglTexture;t.bindFramebuffer(i.FRAMEBUFFER,re.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+Ae,i.TEXTURE_2D,ae,0)}t.bindFramebuffer(i.DRAW_FRAMEBUFFER,re.__webglMultisampledFramebuffer)}}function Fe(w){return Math.min(r.maxSamples,w.samples)}function xe(w){const S=n.get(w);return w.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&S.__useRenderToTexture!==!1}function Ge(w){const S=a.render.frame;u.get(w)!==S&&(u.set(w,S),w.update())}function Ee(w,S){const q=w.colorSpace,Z=w.format,te=w.type;return w.isCompressedTexture===!0||w.isVideoTexture===!0||q!==xn&&q!==dn&&(je.getTransfer(q)===Ke?(Z!==Xt||te!==mn)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",q)),S}function We(w){return typeof HTMLImageElement<"u"&&w instanceof HTMLImageElement?(c.width=w.naturalWidth||w.width,c.height=w.naturalHeight||w.height):typeof VideoFrame<"u"&&w instanceof VideoFrame?(c.width=w.displayWidth,c.height=w.displayHeight):(c.width=w.width,c.height=w.height),c}this.allocateTextureUnit=F,this.resetTextureUnits=M,this.setTexture2D=C,this.setTexture2DArray=U,this.setTexture3D=H,this.setTextureCube=Y,this.rebindTextures=ve,this.setupRenderTarget=Te,this.updateRenderTargetMipmap=Ce,this.updateMultisampleRenderTarget=k,this.setupDepthRenderbuffer=ne,this.setupFrameBufferTexture=O,this.useMultisampledRTT=xe}function E0(i,e){function t(n,r=dn){let s;const a=je.getTransfer(r);if(n===mn)return i.UNSIGNED_BYTE;if(n===Nl)return i.UNSIGNED_SHORT_4_4_4_4;if(n===Ol)return i.UNSIGNED_SHORT_5_5_5_1;if(n===Gu)return i.UNSIGNED_INT_5_9_9_9_REV;if(n===Hu)return i.BYTE;if(n===Vu)return i.SHORT;if(n===Il)return i.UNSIGNED_SHORT;if(n===Ul)return i.INT;if(n===gi)return i.UNSIGNED_INT;if(n===fn)return i.FLOAT;if(n===gn)return i.HALF_FLOAT;if(n===Wu)return i.ALPHA;if(n===Xu)return i.RGB;if(n===Xt)return i.RGBA;if(n===qu)return i.LUMINANCE;if(n===Yu)return i.LUMINANCE_ALPHA;if(n===hi)return i.DEPTH_COMPONENT;if(n===Ni)return i.DEPTH_STENCIL;if(n===$u)return i.RED;if(n===Bl)return i.RED_INTEGER;if(n===ju)return i.RG;if(n===zl)return i.RG_INTEGER;if(n===kl)return i.RGBA_INTEGER;if(n===$r||n===jr||n===Kr||n===Zr)if(a===Ke)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(n===$r)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===jr)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===Kr)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===Zr)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(n===$r)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===jr)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===Kr)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===Zr)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===Ra||n===Pa||n===La||n===Fa)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(n===Ra)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===Pa)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===La)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===Fa)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===Hl)return s=e.get("WEBGL_compressed_texture_etc1"),s!==null?s.COMPRESSED_RGB_ETC1_WEBGL:null;if(n===Ia||n===Ua)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(n===Ia)return a===Ke?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(n===Ua)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(n===Na||n===Oa||n===Ba||n===za||n===ka||n===Ha||n===Va||n===Ga||n===Wa||n===Xa||n===qa||n===Ya||n===$a||n===ja)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(n===Na)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===Oa)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===Ba)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===za)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===ka)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===Ha)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===Va)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===Ga)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===Wa)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===Xa)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===qa)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===Ya)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===$a)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===ja)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===Jr||n===Ka||n===Za)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(n===Jr)return a===Ke?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===Ka)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===Za)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===Ku||n===Ja||n===Qa||n===eo)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(n===Jr)return s.COMPRESSED_RED_RGTC1_EXT;if(n===Ja)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===Qa)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===eo)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===zi?i.UNSIGNED_INT_24_8:i[n]!==void 0?i[n]:null}return{convert:t}}class b0 extends Rt{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class mr extends yt{constructor(){super(),this.isGroup=!0,this.type="Group"}}const T0={type:"move"};class Es{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new mr,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new mr,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new I,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new I),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new mr,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new I,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new I),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,n){let r=null,s=null,a=null;const o=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){a=!0;for(const _ of e.hand.values()){const m=t.getJointPose(_,n),p=this._getHandJoint(c,_);m!==null&&(p.matrix.fromArray(m.transform.matrix),p.matrix.decompose(p.position,p.rotation,p.scale),p.matrixWorldNeedsUpdate=!0,p.jointRadius=m.radius),p.visible=m!==null}const u=c.joints["index-finger-tip"],d=c.joints["thumb-tip"],h=u.position.distanceTo(d.position),f=.02,g=.005;c.inputState.pinching&&h>f+g?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&h<=f-g&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,n),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1));o!==null&&(r=t.getPose(e.targetRaySpace,n),r===null&&s!==null&&(r=s),r!==null&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,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(T0)))}return o!==null&&(o.visible=r!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new mr;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}const D0=`
3776
+ }`;function M0(i,e,t){let n=new tc;const r=new ue,s=new ue,a=new dt,o=new g0({depthPacking:Ju}),l=new _0,c={},u=t.maxTextureSize,d={[_n]:yt,[yt]:_n,[Wt]:Wt},h=new ft({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new ue},radius:{value:4}},vertexShader:x0,fragmentShader:v0}),f=h.clone();f.defines.HORIZONTAL_PASS=1;const g=new _t;g.setAttribute("position",new Et(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const _=new bt(g,h),m=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Pl;let p=this.type;this.render=function(T,A,P){if(m.enabled===!1||m.autoUpdate===!1&&m.needsUpdate===!1||T.length===0)return;const S=i.getRenderTarget(),M=i.getActiveCubeFace(),F=i.getActiveMipmapLevel(),L=i.state;L.setBlending(en),L.buffers.color.setClear(1,1,1,1),L.buffers.depth.setTest(!0),L.setScissorTest(!1);const C=p!==Jt&&this.type===Jt,N=p===Jt&&this.type!==Jt;for(let V=0,j=T.length;V<j;V++){const J=T[V],z=J.shadow;if(z===void 0){console.warn("THREE.WebGLShadowMap:",J,"has no shadow.");continue}if(z.autoUpdate===!1&&z.needsUpdate===!1)continue;r.copy(z.mapSize);const Y=z.getFrameExtents();if(r.multiply(Y),s.copy(z.mapSize),(r.x>u||r.y>u)&&(r.x>u&&(s.x=Math.floor(u/Y.x),r.x=s.x*Y.x,z.mapSize.x=s.x),r.y>u&&(s.y=Math.floor(u/Y.y),r.y=s.y*Y.y,z.mapSize.y=s.y)),z.map===null||C===!0||N===!0){const U=this.type!==Jt?{minFilter:Nt,magFilter:Nt}:{};z.map!==null&&z.map.dispose(),z.map=new Vt(r.x,r.y,U),z.map.texture.name=J.name+".shadowMap",z.camera.updateProjectionMatrix()}i.setRenderTarget(z.map),i.clear();const $=z.getViewportCount();for(let U=0;U<$;U++){const ee=z.getViewport(U);a.set(s.x*ee.x,s.y*ee.y,s.x*ee.z,s.y*ee.w),L.viewport(a),z.updateMatrices(J,U),n=z.getFrustum(),b(A,P,z.camera,J,this.type)}z.isPointLightShadow!==!0&&this.type===Jt&&E(z,P),z.needsUpdate=!1}p=this.type,m.needsUpdate=!1,i.setRenderTarget(S,M,F)};function E(T,A){const P=e.update(_);h.defines.VSM_SAMPLES!==T.blurSamples&&(h.defines.VSM_SAMPLES=T.blurSamples,f.defines.VSM_SAMPLES=T.blurSamples,h.needsUpdate=!0,f.needsUpdate=!0),T.mapPass===null&&(T.mapPass=new Vt(r.x,r.y)),h.uniforms.shadow_pass.value=T.map.texture,h.uniforms.resolution.value=T.mapSize,h.uniforms.radius.value=T.radius,i.setRenderTarget(T.mapPass),i.clear(),i.renderBufferDirect(A,null,P,h,_,null),f.uniforms.shadow_pass.value=T.mapPass.texture,f.uniforms.resolution.value=T.mapSize,f.uniforms.radius.value=T.radius,i.setRenderTarget(T.map),i.clear(),i.renderBufferDirect(A,null,P,f,_,null)}function v(T,A,P,S){let M=null;const F=P.isPointLight===!0?T.customDistanceMaterial:T.customDepthMaterial;if(F!==void 0)M=F;else if(M=P.isPointLight===!0?l:o,i.localClippingEnabled&&A.clipShadows===!0&&Array.isArray(A.clippingPlanes)&&A.clippingPlanes.length!==0||A.displacementMap&&A.displacementScale!==0||A.alphaMap&&A.alphaTest>0||A.map&&A.alphaTest>0){const L=M.uuid,C=A.uuid;let N=c[L];N===void 0&&(N={},c[L]=N);let V=N[C];V===void 0&&(V=M.clone(),N[C]=V,A.addEventListener("dispose",R)),M=V}if(M.visible=A.visible,M.wireframe=A.wireframe,S===Jt?M.side=A.shadowSide!==null?A.shadowSide:A.side:M.side=A.shadowSide!==null?A.shadowSide:d[A.side],M.alphaMap=A.alphaMap,M.alphaTest=A.alphaTest,M.map=A.map,M.clipShadows=A.clipShadows,M.clippingPlanes=A.clippingPlanes,M.clipIntersection=A.clipIntersection,M.displacementMap=A.displacementMap,M.displacementScale=A.displacementScale,M.displacementBias=A.displacementBias,M.wireframeLinewidth=A.wireframeLinewidth,M.linewidth=A.linewidth,P.isPointLight===!0&&M.isMeshDistanceMaterial===!0){const L=i.properties.get(M);L.light=P}return M}function b(T,A,P,S,M){if(T.visible===!1)return;if(T.layers.test(A.layers)&&(T.isMesh||T.isLine||T.isPoints)&&(T.castShadow||T.receiveShadow&&M===Jt)&&(!T.frustumCulled||n.intersectsObject(T))){T.modelViewMatrix.multiplyMatrices(P.matrixWorldInverse,T.matrixWorld);const C=e.update(T),N=T.material;if(Array.isArray(N)){const V=C.groups;for(let j=0,J=V.length;j<J;j++){const z=V[j],Y=N[z.materialIndex];if(Y&&Y.visible){const $=v(T,Y,S,M);T.onBeforeShadow(i,T,A,P,C,$,z),i.renderBufferDirect(P,null,C,$,T,z),T.onAfterShadow(i,T,A,P,C,$,z)}}}else if(N.visible){const V=v(T,N,S,M);T.onBeforeShadow(i,T,A,P,C,V,null),i.renderBufferDirect(P,null,C,V,T,null),T.onAfterShadow(i,T,A,P,C,V,null)}}const L=T.children;for(let C=0,N=L.length;C<N;C++)b(L[C],A,P,S,M)}function R(T){T.target.removeEventListener("dispose",R);for(const P in c){const S=c[P],M=T.target.uuid;M in S&&(S[M].dispose(),delete S[M])}}}function y0(i){function e(){let x=!1;const H=new dt;let K=null;const ae=new dt(0,0,0,0);return{setMask:function(pe){K!==pe&&!x&&(i.colorMask(pe,pe,pe,pe),K=pe)},setLocked:function(pe){x=pe},setClear:function(pe,He,ze,Ze,lt){lt===!0&&(pe*=Ze,He*=Ze,ze*=Ze),H.set(pe,He,ze,Ze),ae.equals(H)===!1&&(i.clearColor(pe,He,ze,Ze),ae.copy(H))},reset:function(){x=!1,K=null,ae.set(-1,0,0,0)}}}function t(){let x=!1,H=null,K=null,ae=null;return{setTest:function(pe){pe?ce(i.DEPTH_TEST):ne(i.DEPTH_TEST)},setMask:function(pe){H!==pe&&!x&&(i.depthMask(pe),H=pe)},setFunc:function(pe){if(K!==pe){switch(pe){case Tu:i.depthFunc(i.NEVER);break;case Du:i.depthFunc(i.ALWAYS);break;case Au:i.depthFunc(i.LESS);break;case Ar:i.depthFunc(i.LEQUAL);break;case wu:i.depthFunc(i.EQUAL);break;case Cu:i.depthFunc(i.GEQUAL);break;case Ru:i.depthFunc(i.GREATER);break;case Pu:i.depthFunc(i.NOTEQUAL);break;default:i.depthFunc(i.LEQUAL)}K=pe}},setLocked:function(pe){x=pe},setClear:function(pe){ae!==pe&&(i.clearDepth(pe),ae=pe)},reset:function(){x=!1,H=null,K=null,ae=null}}}function n(){let x=!1,H=null,K=null,ae=null,pe=null,He=null,ze=null,Ze=null,lt=null;return{setTest:function($e){x||($e?ce(i.STENCIL_TEST):ne(i.STENCIL_TEST))},setMask:function($e){H!==$e&&!x&&(i.stencilMask($e),H=$e)},setFunc:function($e,it,rt){(K!==$e||ae!==it||pe!==rt)&&(i.stencilFunc($e,it,rt),K=$e,ae=it,pe=rt)},setOp:function($e,it,rt){(He!==$e||ze!==it||Ze!==rt)&&(i.stencilOp($e,it,rt),He=$e,ze=it,Ze=rt)},setLocked:function($e){x=$e},setClear:function($e){lt!==$e&&(i.clearStencil($e),lt=$e)},reset:function(){x=!1,H=null,K=null,ae=null,pe=null,He=null,ze=null,Ze=null,lt=null}}}const r=new e,s=new t,a=new n,o=new WeakMap,l=new WeakMap;let c={},u={},d=new WeakMap,h=[],f=null,g=!1,_=null,m=null,p=null,E=null,v=null,b=null,R=null,T=new be(0,0,0),A=0,P=!1,S=null,M=null,F=null,L=null,C=null;const N=i.getParameter(i.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let V=!1,j=0;const J=i.getParameter(i.VERSION);J.indexOf("WebGL")!==-1?(j=parseFloat(/^WebGL (\d)/.exec(J)[1]),V=j>=1):J.indexOf("OpenGL ES")!==-1&&(j=parseFloat(/^OpenGL ES (\d)/.exec(J)[1]),V=j>=2);let z=null,Y={};const $=i.getParameter(i.SCISSOR_BOX),U=i.getParameter(i.VIEWPORT),ee=new dt().fromArray($),me=new dt().fromArray(U);function O(x,H,K,ae){const pe=new Uint8Array(4),He=i.createTexture();i.bindTexture(x,He),i.texParameteri(x,i.TEXTURE_MIN_FILTER,i.NEAREST),i.texParameteri(x,i.TEXTURE_MAG_FILTER,i.NEAREST);for(let ze=0;ze<K;ze++)x===i.TEXTURE_3D||x===i.TEXTURE_2D_ARRAY?i.texImage3D(H,0,i.RGBA,1,1,ae,0,i.RGBA,i.UNSIGNED_BYTE,pe):i.texImage2D(H+ze,0,i.RGBA,1,1,0,i.RGBA,i.UNSIGNED_BYTE,pe);return He}const Q={};Q[i.TEXTURE_2D]=O(i.TEXTURE_2D,i.TEXTURE_2D,1),Q[i.TEXTURE_CUBE_MAP]=O(i.TEXTURE_CUBE_MAP,i.TEXTURE_CUBE_MAP_POSITIVE_X,6),Q[i.TEXTURE_2D_ARRAY]=O(i.TEXTURE_2D_ARRAY,i.TEXTURE_2D_ARRAY,1,1),Q[i.TEXTURE_3D]=O(i.TEXTURE_3D,i.TEXTURE_3D,1,1),r.setClear(0,0,0,1),s.setClear(1),a.setClear(0),ce(i.DEPTH_TEST),s.setFunc(Ar),Ee(!1),We(Aa),ce(i.CULL_FACE),xe(en);function ce(x){c[x]!==!0&&(i.enable(x),c[x]=!0)}function ne(x){c[x]!==!1&&(i.disable(x),c[x]=!1)}function ve(x,H){return u[x]!==H?(i.bindFramebuffer(x,H),u[x]=H,x===i.DRAW_FRAMEBUFFER&&(u[i.FRAMEBUFFER]=H),x===i.FRAMEBUFFER&&(u[i.DRAW_FRAMEBUFFER]=H),!0):!1}function Te(x,H){let K=h,ae=!1;if(x){K=d.get(H),K===void 0&&(K=[],d.set(H,K));const pe=x.textures;if(K.length!==pe.length||K[0]!==i.COLOR_ATTACHMENT0){for(let He=0,ze=pe.length;He<ze;He++)K[He]=i.COLOR_ATTACHMENT0+He;K.length=pe.length,ae=!0}}else K[0]!==i.BACK&&(K[0]=i.BACK,ae=!0);ae&&i.drawBuffers(K)}function Ce(x){return f!==x?(i.useProgram(x),f=x,!0):!1}const k={[wn]:i.FUNC_ADD,[lu]:i.FUNC_SUBTRACT,[cu]:i.FUNC_REVERSE_SUBTRACT};k[uu]=i.MIN,k[hu]=i.MAX;const Fe={[du]:i.ZERO,[fu]:i.ONE,[pu]:i.SRC_COLOR,[ks]:i.SRC_ALPHA,[Mu]:i.SRC_ALPHA_SATURATE,[xu]:i.DST_COLOR,[gu]:i.DST_ALPHA,[mu]:i.ONE_MINUS_SRC_COLOR,[Vs]:i.ONE_MINUS_SRC_ALPHA,[vu]:i.ONE_MINUS_DST_COLOR,[_u]:i.ONE_MINUS_DST_ALPHA,[yu]:i.CONSTANT_COLOR,[Su]:i.ONE_MINUS_CONSTANT_COLOR,[Eu]:i.CONSTANT_ALPHA,[bu]:i.ONE_MINUS_CONSTANT_ALPHA};function xe(x,H,K,ae,pe,He,ze,Ze,lt,$e){if(x===en){g===!0&&(ne(i.BLEND),g=!1);return}if(g===!1&&(ce(i.BLEND),g=!0),x!==ou){if(x!==_||$e!==P){if((m!==wn||v!==wn)&&(i.blendEquation(i.FUNC_ADD),m=wn,v=wn),$e)switch(x){case ci:i.blendFuncSeparate(i.ONE,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case ui:i.blendFunc(i.ONE,i.ONE);break;case wa:i.blendFuncSeparate(i.ZERO,i.ONE_MINUS_SRC_COLOR,i.ZERO,i.ONE);break;case Ca:i.blendFuncSeparate(i.ZERO,i.SRC_COLOR,i.ZERO,i.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",x);break}else switch(x){case ci:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case ui:i.blendFunc(i.SRC_ALPHA,i.ONE);break;case wa:i.blendFuncSeparate(i.ZERO,i.ONE_MINUS_SRC_COLOR,i.ZERO,i.ONE);break;case Ca:i.blendFunc(i.ZERO,i.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",x);break}p=null,E=null,b=null,R=null,T.set(0,0,0),A=0,_=x,P=$e}return}pe=pe||H,He=He||K,ze=ze||ae,(H!==m||pe!==v)&&(i.blendEquationSeparate(k[H],k[pe]),m=H,v=pe),(K!==p||ae!==E||He!==b||ze!==R)&&(i.blendFuncSeparate(Fe[K],Fe[ae],Fe[He],Fe[ze]),p=K,E=ae,b=He,R=ze),(Ze.equals(T)===!1||lt!==A)&&(i.blendColor(Ze.r,Ze.g,Ze.b,lt),T.copy(Ze),A=lt),_=x,P=!1}function Ge(x,H){x.side===Wt?ne(i.CULL_FACE):ce(i.CULL_FACE);let K=x.side===yt;H&&(K=!K),Ee(K),x.blending===ci&&x.transparent===!1?xe(en):xe(x.blending,x.blendEquation,x.blendSrc,x.blendDst,x.blendEquationAlpha,x.blendSrcAlpha,x.blendDstAlpha,x.blendColor,x.blendAlpha,x.premultipliedAlpha),s.setFunc(x.depthFunc),s.setTest(x.depthTest),s.setMask(x.depthWrite),r.setMask(x.colorWrite);const ae=x.stencilWrite;a.setTest(ae),ae&&(a.setMask(x.stencilWriteMask),a.setFunc(x.stencilFunc,x.stencilRef,x.stencilFuncMask),a.setOp(x.stencilFail,x.stencilZFail,x.stencilZPass)),y(x.polygonOffset,x.polygonOffsetFactor,x.polygonOffsetUnits),x.alphaToCoverage===!0?ce(i.SAMPLE_ALPHA_TO_COVERAGE):ne(i.SAMPLE_ALPHA_TO_COVERAGE)}function Ee(x){S!==x&&(x?i.frontFace(i.CW):i.frontFace(i.CCW),S=x)}function We(x){x!==ru?(ce(i.CULL_FACE),x!==M&&(x===Aa?i.cullFace(i.BACK):x===su?i.cullFace(i.FRONT):i.cullFace(i.FRONT_AND_BACK))):ne(i.CULL_FACE),M=x}function w(x){x!==F&&(V&&i.lineWidth(x),F=x)}function y(x,H,K){x?(ce(i.POLYGON_OFFSET_FILL),(L!==H||C!==K)&&(i.polygonOffset(H,K),L=H,C=K)):ne(i.POLYGON_OFFSET_FILL)}function q(x){x?ce(i.SCISSOR_TEST):ne(i.SCISSOR_TEST)}function Z(x){x===void 0&&(x=i.TEXTURE0+N-1),z!==x&&(i.activeTexture(x),z=x)}function te(x,H,K){K===void 0&&(z===null?K=i.TEXTURE0+N-1:K=z);let ae=Y[K];ae===void 0&&(ae={type:void 0,texture:void 0},Y[K]=ae),(ae.type!==x||ae.texture!==H)&&(z!==K&&(i.activeTexture(K),z=K),i.bindTexture(x,H||Q[x]),ae.type=x,ae.texture=H)}function ie(){const x=Y[z];x!==void 0&&x.type!==void 0&&(i.bindTexture(x.type,null),x.type=void 0,x.texture=void 0)}function De(){try{i.compressedTexImage2D.apply(i,arguments)}catch(x){console.error("THREE.WebGLState:",x)}}function re(){try{i.compressedTexImage3D.apply(i,arguments)}catch(x){console.error("THREE.WebGLState:",x)}}function Se(){try{i.texSubImage2D.apply(i,arguments)}catch(x){console.error("THREE.WebGLState:",x)}}function Ae(){try{i.texSubImage3D.apply(i,arguments)}catch(x){console.error("THREE.WebGLState:",x)}}function oe(){try{i.compressedTexSubImage2D.apply(i,arguments)}catch(x){console.error("THREE.WebGLState:",x)}}function fe(){try{i.compressedTexSubImage3D.apply(i,arguments)}catch(x){console.error("THREE.WebGLState:",x)}}function Re(){try{i.texStorage2D.apply(i,arguments)}catch(x){console.error("THREE.WebGLState:",x)}}function ge(){try{i.texStorage3D.apply(i,arguments)}catch(x){console.error("THREE.WebGLState:",x)}}function _e(){try{i.texImage2D.apply(i,arguments)}catch(x){console.error("THREE.WebGLState:",x)}}function ke(){try{i.texImage3D.apply(i,arguments)}catch(x){console.error("THREE.WebGLState:",x)}}function Ve(x){ee.equals(x)===!1&&(i.scissor(x.x,x.y,x.z,x.w),ee.copy(x))}function qe(x){me.equals(x)===!1&&(i.viewport(x.x,x.y,x.z,x.w),me.copy(x))}function Xe(x,H){let K=l.get(H);K===void 0&&(K=new WeakMap,l.set(H,K));let ae=K.get(x);ae===void 0&&(ae=i.getUniformBlockIndex(H,x.name),K.set(x,ae))}function je(x,H){const ae=l.get(H).get(x);o.get(H)!==ae&&(i.uniformBlockBinding(H,ae,x.__bindingPointIndex),o.set(H,ae))}function Me(){i.disable(i.BLEND),i.disable(i.CULL_FACE),i.disable(i.DEPTH_TEST),i.disable(i.POLYGON_OFFSET_FILL),i.disable(i.SCISSOR_TEST),i.disable(i.STENCIL_TEST),i.disable(i.SAMPLE_ALPHA_TO_COVERAGE),i.blendEquation(i.FUNC_ADD),i.blendFunc(i.ONE,i.ZERO),i.blendFuncSeparate(i.ONE,i.ZERO,i.ONE,i.ZERO),i.blendColor(0,0,0,0),i.colorMask(!0,!0,!0,!0),i.clearColor(0,0,0,0),i.depthMask(!0),i.depthFunc(i.LESS),i.clearDepth(1),i.stencilMask(4294967295),i.stencilFunc(i.ALWAYS,0,4294967295),i.stencilOp(i.KEEP,i.KEEP,i.KEEP),i.clearStencil(0),i.cullFace(i.BACK),i.frontFace(i.CCW),i.polygonOffset(0,0),i.activeTexture(i.TEXTURE0),i.bindFramebuffer(i.FRAMEBUFFER,null),i.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),i.bindFramebuffer(i.READ_FRAMEBUFFER,null),i.useProgram(null),i.lineWidth(1),i.scissor(0,0,i.canvas.width,i.canvas.height),i.viewport(0,0,i.canvas.width,i.canvas.height),c={},z=null,Y={},u={},d=new WeakMap,h=[],f=null,g=!1,_=null,m=null,p=null,E=null,v=null,b=null,R=null,T=new be(0,0,0),A=0,P=!1,S=null,M=null,F=null,L=null,C=null,ee.set(0,0,i.canvas.width,i.canvas.height),me.set(0,0,i.canvas.width,i.canvas.height),r.reset(),s.reset(),a.reset()}return{buffers:{color:r,depth:s,stencil:a},enable:ce,disable:ne,bindFramebuffer:ve,drawBuffers:Te,useProgram:Ce,setBlending:xe,setMaterial:Ge,setFlipSided:Ee,setCullFace:We,setLineWidth:w,setPolygonOffset:y,setScissorTest:q,activeTexture:Z,bindTexture:te,unbindTexture:ie,compressedTexImage2D:De,compressedTexImage3D:re,texImage2D:_e,texImage3D:ke,updateUBOMapping:Xe,uniformBlockBinding:je,texStorage2D:Re,texStorage3D:ge,texSubImage2D:Se,texSubImage3D:Ae,compressedTexSubImage2D:oe,compressedTexSubImage3D:fe,scissor:Ve,viewport:qe,reset:Me}}function S0(i,e,t,n,r,s,a){const o=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,l=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new ue,u=new WeakMap;let d;const h=new WeakMap;let f=!1;try{f=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function g(w,y){return f?new OffscreenCanvas(w,y):Lr("canvas")}function _(w,y,q){let Z=1;const te=We(w);if((te.width>q||te.height>q)&&(Z=q/Math.max(te.width,te.height)),Z<1)if(typeof HTMLImageElement<"u"&&w instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&w instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&w instanceof ImageBitmap||typeof VideoFrame<"u"&&w instanceof VideoFrame){const ie=Math.floor(Z*te.width),De=Math.floor(Z*te.height);d===void 0&&(d=g(ie,De));const re=y?g(ie,De):d;return re.width=ie,re.height=De,re.getContext("2d").drawImage(w,0,0,ie,De),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+te.width+"x"+te.height+") to ("+ie+"x"+De+")."),re}else return"data"in w&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+te.width+"x"+te.height+")."),w;return w}function m(w){return w.generateMipmaps&&w.minFilter!==Nt&&w.minFilter!==zt}function p(w){i.generateMipmap(w)}function E(w,y,q,Z,te=!1){if(w!==null){if(i[w]!==void 0)return i[w];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+w+"'")}let ie=y;if(y===i.RED&&(q===i.FLOAT&&(ie=i.R32F),q===i.HALF_FLOAT&&(ie=i.R16F),q===i.UNSIGNED_BYTE&&(ie=i.R8)),y===i.RED_INTEGER&&(q===i.UNSIGNED_BYTE&&(ie=i.R8UI),q===i.UNSIGNED_SHORT&&(ie=i.R16UI),q===i.UNSIGNED_INT&&(ie=i.R32UI),q===i.BYTE&&(ie=i.R8I),q===i.SHORT&&(ie=i.R16I),q===i.INT&&(ie=i.R32I)),y===i.RG&&(q===i.FLOAT&&(ie=i.RG32F),q===i.HALF_FLOAT&&(ie=i.RG16F),q===i.UNSIGNED_BYTE&&(ie=i.RG8)),y===i.RG_INTEGER&&(q===i.UNSIGNED_BYTE&&(ie=i.RG8UI),q===i.UNSIGNED_SHORT&&(ie=i.RG16UI),q===i.UNSIGNED_INT&&(ie=i.RG32UI),q===i.BYTE&&(ie=i.RG8I),q===i.SHORT&&(ie=i.RG16I),q===i.INT&&(ie=i.RG32I)),y===i.RGB&&q===i.UNSIGNED_INT_5_9_9_9_REV&&(ie=i.RGB9_E5),y===i.RGBA){const De=te?wr:Ye.getTransfer(Z);q===i.FLOAT&&(ie=i.RGBA32F),q===i.HALF_FLOAT&&(ie=i.RGBA16F),q===i.UNSIGNED_BYTE&&(ie=De===Ke?i.SRGB8_ALPHA8:i.RGBA8),q===i.UNSIGNED_SHORT_4_4_4_4&&(ie=i.RGBA4),q===i.UNSIGNED_SHORT_5_5_5_1&&(ie=i.RGB5_A1)}return(ie===i.R16F||ie===i.R32F||ie===i.RG16F||ie===i.RG32F||ie===i.RGBA16F||ie===i.RGBA32F)&&e.get("EXT_color_buffer_float"),ie}function v(w,y){return m(w)===!0||w.isFramebufferTexture&&w.minFilter!==Nt&&w.minFilter!==zt?Math.log2(Math.max(y.width,y.height))+1:w.mipmaps!==void 0&&w.mipmaps.length>0?w.mipmaps.length:w.isCompressedTexture&&Array.isArray(w.image)?y.mipmaps.length:1}function b(w){const y=w.target;y.removeEventListener("dispose",b),T(y),y.isVideoTexture&&u.delete(y)}function R(w){const y=w.target;y.removeEventListener("dispose",R),P(y)}function T(w){const y=n.get(w);if(y.__webglInit===void 0)return;const q=w.source,Z=h.get(q);if(Z){const te=Z[y.__cacheKey];te.usedTimes--,te.usedTimes===0&&A(w),Object.keys(Z).length===0&&h.delete(q)}n.remove(w)}function A(w){const y=n.get(w);i.deleteTexture(y.__webglTexture);const q=w.source,Z=h.get(q);delete Z[y.__cacheKey],a.memory.textures--}function P(w){const y=n.get(w);if(w.depthTexture&&w.depthTexture.dispose(),w.isWebGLCubeRenderTarget)for(let Z=0;Z<6;Z++){if(Array.isArray(y.__webglFramebuffer[Z]))for(let te=0;te<y.__webglFramebuffer[Z].length;te++)i.deleteFramebuffer(y.__webglFramebuffer[Z][te]);else i.deleteFramebuffer(y.__webglFramebuffer[Z]);y.__webglDepthbuffer&&i.deleteRenderbuffer(y.__webglDepthbuffer[Z])}else{if(Array.isArray(y.__webglFramebuffer))for(let Z=0;Z<y.__webglFramebuffer.length;Z++)i.deleteFramebuffer(y.__webglFramebuffer[Z]);else i.deleteFramebuffer(y.__webglFramebuffer);if(y.__webglDepthbuffer&&i.deleteRenderbuffer(y.__webglDepthbuffer),y.__webglMultisampledFramebuffer&&i.deleteFramebuffer(y.__webglMultisampledFramebuffer),y.__webglColorRenderbuffer)for(let Z=0;Z<y.__webglColorRenderbuffer.length;Z++)y.__webglColorRenderbuffer[Z]&&i.deleteRenderbuffer(y.__webglColorRenderbuffer[Z]);y.__webglDepthRenderbuffer&&i.deleteRenderbuffer(y.__webglDepthRenderbuffer)}const q=w.textures;for(let Z=0,te=q.length;Z<te;Z++){const ie=n.get(q[Z]);ie.__webglTexture&&(i.deleteTexture(ie.__webglTexture),a.memory.textures--),n.remove(q[Z])}n.remove(w)}let S=0;function M(){S=0}function F(){const w=S;return w>=r.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+w+" texture units while this GPU supports only "+r.maxTextures),S+=1,w}function L(w){const y=[];return y.push(w.wrapS),y.push(w.wrapT),y.push(w.wrapR||0),y.push(w.magFilter),y.push(w.minFilter),y.push(w.anisotropy),y.push(w.internalFormat),y.push(w.format),y.push(w.type),y.push(w.generateMipmaps),y.push(w.premultiplyAlpha),y.push(w.flipY),y.push(w.unpackAlignment),y.push(w.colorSpace),y.join()}function C(w,y){const q=n.get(w);if(w.isVideoTexture&&Ge(w),w.isRenderTargetTexture===!1&&w.version>0&&q.__version!==w.version){const Z=w.image;if(Z===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(Z.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{ee(q,w,y);return}}t.bindTexture(i.TEXTURE_2D,q.__webglTexture,i.TEXTURE0+y)}function N(w,y){const q=n.get(w);if(w.version>0&&q.__version!==w.version){ee(q,w,y);return}t.bindTexture(i.TEXTURE_2D_ARRAY,q.__webglTexture,i.TEXTURE0+y)}function V(w,y){const q=n.get(w);if(w.version>0&&q.__version!==w.version){ee(q,w,y);return}t.bindTexture(i.TEXTURE_3D,q.__webglTexture,i.TEXTURE0+y)}function j(w,y){const q=n.get(w);if(w.version>0&&q.__version!==w.version){me(q,w,y);return}t.bindTexture(i.TEXTURE_CUBE_MAP,q.__webglTexture,i.TEXTURE0+y)}const J={[Ws]:i.REPEAT,[Pn]:i.CLAMP_TO_EDGE,[Xs]:i.MIRRORED_REPEAT},z={[Nt]:i.NEAREST,[ku]:i.NEAREST_MIPMAP_NEAREST,[ji]:i.NEAREST_MIPMAP_LINEAR,[zt]:i.LINEAR,[$r]:i.LINEAR_MIPMAP_NEAREST,[Ln]:i.LINEAR_MIPMAP_LINEAR},Y={[th]:i.NEVER,[oh]:i.ALWAYS,[nh]:i.LESS,[Hl]:i.LEQUAL,[ih]:i.EQUAL,[ah]:i.GEQUAL,[rh]:i.GREATER,[sh]:i.NOTEQUAL};function $(w,y){if(y.type===fn&&e.has("OES_texture_float_linear")===!1&&(y.magFilter===zt||y.magFilter===$r||y.magFilter===ji||y.magFilter===Ln||y.minFilter===zt||y.minFilter===$r||y.minFilter===ji||y.minFilter===Ln)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),i.texParameteri(w,i.TEXTURE_WRAP_S,J[y.wrapS]),i.texParameteri(w,i.TEXTURE_WRAP_T,J[y.wrapT]),(w===i.TEXTURE_3D||w===i.TEXTURE_2D_ARRAY)&&i.texParameteri(w,i.TEXTURE_WRAP_R,J[y.wrapR]),i.texParameteri(w,i.TEXTURE_MAG_FILTER,z[y.magFilter]),i.texParameteri(w,i.TEXTURE_MIN_FILTER,z[y.minFilter]),y.compareFunction&&(i.texParameteri(w,i.TEXTURE_COMPARE_MODE,i.COMPARE_REF_TO_TEXTURE),i.texParameteri(w,i.TEXTURE_COMPARE_FUNC,Y[y.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(y.magFilter===Nt||y.minFilter!==ji&&y.minFilter!==Ln||y.type===fn&&e.has("OES_texture_float_linear")===!1)return;if(y.anisotropy>1||n.get(y).__currentAnisotropy){const q=e.get("EXT_texture_filter_anisotropic");i.texParameterf(w,q.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(y.anisotropy,r.getMaxAnisotropy())),n.get(y).__currentAnisotropy=y.anisotropy}}}function U(w,y){let q=!1;w.__webglInit===void 0&&(w.__webglInit=!0,y.addEventListener("dispose",b));const Z=y.source;let te=h.get(Z);te===void 0&&(te={},h.set(Z,te));const ie=L(y);if(ie!==w.__cacheKey){te[ie]===void 0&&(te[ie]={texture:i.createTexture(),usedTimes:0},a.memory.textures++,q=!0),te[ie].usedTimes++;const De=te[w.__cacheKey];De!==void 0&&(te[w.__cacheKey].usedTimes--,De.usedTimes===0&&A(y)),w.__cacheKey=ie,w.__webglTexture=te[ie].texture}return q}function ee(w,y,q){let Z=i.TEXTURE_2D;(y.isDataArrayTexture||y.isCompressedArrayTexture)&&(Z=i.TEXTURE_2D_ARRAY),y.isData3DTexture&&(Z=i.TEXTURE_3D);const te=U(w,y),ie=y.source;t.bindTexture(Z,w.__webglTexture,i.TEXTURE0+q);const De=n.get(ie);if(ie.version!==De.__version||te===!0){t.activeTexture(i.TEXTURE0+q);const re=Ye.getPrimaries(Ye.workingColorSpace),Se=y.colorSpace===dn?null:Ye.getPrimaries(y.colorSpace),Ae=y.colorSpace===dn||re===Se?i.NONE:i.BROWSER_DEFAULT_WEBGL;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,y.flipY),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,y.premultiplyAlpha),i.pixelStorei(i.UNPACK_ALIGNMENT,y.unpackAlignment),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,Ae);let oe=_(y.image,!1,r.maxTextureSize);oe=Ee(y,oe);const fe=s.convert(y.format,y.colorSpace),Re=s.convert(y.type);let ge=E(y.internalFormat,fe,Re,y.colorSpace,y.isVideoTexture);$(Z,y);let _e;const ke=y.mipmaps,Ve=y.isVideoTexture!==!0&&ge!==Vl,qe=De.__version===void 0||te===!0,Xe=ie.dataReady,je=v(y,oe);if(y.isDepthTexture)ge=i.DEPTH_COMPONENT16,y.type===fn?ge=i.DEPTH_COMPONENT32F:y.type===gi?ge=i.DEPTH_COMPONENT24:y.type===zi&&(ge=i.DEPTH24_STENCIL8),qe&&(Ve?t.texStorage2D(i.TEXTURE_2D,1,ge,oe.width,oe.height):t.texImage2D(i.TEXTURE_2D,0,ge,oe.width,oe.height,0,fe,Re,null));else if(y.isDataTexture)if(ke.length>0){Ve&&qe&&t.texStorage2D(i.TEXTURE_2D,je,ge,ke[0].width,ke[0].height);for(let Me=0,x=ke.length;Me<x;Me++)_e=ke[Me],Ve?Xe&&t.texSubImage2D(i.TEXTURE_2D,Me,0,0,_e.width,_e.height,fe,Re,_e.data):t.texImage2D(i.TEXTURE_2D,Me,ge,_e.width,_e.height,0,fe,Re,_e.data);y.generateMipmaps=!1}else Ve?(qe&&t.texStorage2D(i.TEXTURE_2D,je,ge,oe.width,oe.height),Xe&&t.texSubImage2D(i.TEXTURE_2D,0,0,0,oe.width,oe.height,fe,Re,oe.data)):t.texImage2D(i.TEXTURE_2D,0,ge,oe.width,oe.height,0,fe,Re,oe.data);else if(y.isCompressedTexture)if(y.isCompressedArrayTexture){Ve&&qe&&t.texStorage3D(i.TEXTURE_2D_ARRAY,je,ge,ke[0].width,ke[0].height,oe.depth);for(let Me=0,x=ke.length;Me<x;Me++)_e=ke[Me],y.format!==Xt?fe!==null?Ve?Xe&&t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,Me,0,0,0,_e.width,_e.height,oe.depth,fe,_e.data,0,0):t.compressedTexImage3D(i.TEXTURE_2D_ARRAY,Me,ge,_e.width,_e.height,oe.depth,0,_e.data,0,0):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Ve?Xe&&t.texSubImage3D(i.TEXTURE_2D_ARRAY,Me,0,0,0,_e.width,_e.height,oe.depth,fe,Re,_e.data):t.texImage3D(i.TEXTURE_2D_ARRAY,Me,ge,_e.width,_e.height,oe.depth,0,fe,Re,_e.data)}else{Ve&&qe&&t.texStorage2D(i.TEXTURE_2D,je,ge,ke[0].width,ke[0].height);for(let Me=0,x=ke.length;Me<x;Me++)_e=ke[Me],y.format!==Xt?fe!==null?Ve?Xe&&t.compressedTexSubImage2D(i.TEXTURE_2D,Me,0,0,_e.width,_e.height,fe,_e.data):t.compressedTexImage2D(i.TEXTURE_2D,Me,ge,_e.width,_e.height,0,_e.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Ve?Xe&&t.texSubImage2D(i.TEXTURE_2D,Me,0,0,_e.width,_e.height,fe,Re,_e.data):t.texImage2D(i.TEXTURE_2D,Me,ge,_e.width,_e.height,0,fe,Re,_e.data)}else if(y.isDataArrayTexture)Ve?(qe&&t.texStorage3D(i.TEXTURE_2D_ARRAY,je,ge,oe.width,oe.height,oe.depth),Xe&&t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,0,oe.width,oe.height,oe.depth,fe,Re,oe.data)):t.texImage3D(i.TEXTURE_2D_ARRAY,0,ge,oe.width,oe.height,oe.depth,0,fe,Re,oe.data);else if(y.isData3DTexture)Ve?(qe&&t.texStorage3D(i.TEXTURE_3D,je,ge,oe.width,oe.height,oe.depth),Xe&&t.texSubImage3D(i.TEXTURE_3D,0,0,0,0,oe.width,oe.height,oe.depth,fe,Re,oe.data)):t.texImage3D(i.TEXTURE_3D,0,ge,oe.width,oe.height,oe.depth,0,fe,Re,oe.data);else if(y.isFramebufferTexture){if(qe)if(Ve)t.texStorage2D(i.TEXTURE_2D,je,ge,oe.width,oe.height);else{let Me=oe.width,x=oe.height;for(let H=0;H<je;H++)t.texImage2D(i.TEXTURE_2D,H,ge,Me,x,0,fe,Re,null),Me>>=1,x>>=1}}else if(ke.length>0){if(Ve&&qe){const Me=We(ke[0]);t.texStorage2D(i.TEXTURE_2D,je,ge,Me.width,Me.height)}for(let Me=0,x=ke.length;Me<x;Me++)_e=ke[Me],Ve?Xe&&t.texSubImage2D(i.TEXTURE_2D,Me,0,0,fe,Re,_e):t.texImage2D(i.TEXTURE_2D,Me,ge,fe,Re,_e);y.generateMipmaps=!1}else if(Ve){if(qe){const Me=We(oe);t.texStorage2D(i.TEXTURE_2D,je,ge,Me.width,Me.height)}Xe&&t.texSubImage2D(i.TEXTURE_2D,0,0,0,fe,Re,oe)}else t.texImage2D(i.TEXTURE_2D,0,ge,fe,Re,oe);m(y)&&p(Z),De.__version=ie.version,y.onUpdate&&y.onUpdate(y)}w.__version=y.version}function me(w,y,q){if(y.image.length!==6)return;const Z=U(w,y),te=y.source;t.bindTexture(i.TEXTURE_CUBE_MAP,w.__webglTexture,i.TEXTURE0+q);const ie=n.get(te);if(te.version!==ie.__version||Z===!0){t.activeTexture(i.TEXTURE0+q);const De=Ye.getPrimaries(Ye.workingColorSpace),re=y.colorSpace===dn?null:Ye.getPrimaries(y.colorSpace),Se=y.colorSpace===dn||De===re?i.NONE:i.BROWSER_DEFAULT_WEBGL;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,y.flipY),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,y.premultiplyAlpha),i.pixelStorei(i.UNPACK_ALIGNMENT,y.unpackAlignment),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,Se);const Ae=y.isCompressedTexture||y.image[0].isCompressedTexture,oe=y.image[0]&&y.image[0].isDataTexture,fe=[];for(let x=0;x<6;x++)!Ae&&!oe?fe[x]=_(y.image[x],!0,r.maxCubemapSize):fe[x]=oe?y.image[x].image:y.image[x],fe[x]=Ee(y,fe[x]);const Re=fe[0],ge=s.convert(y.format,y.colorSpace),_e=s.convert(y.type),ke=E(y.internalFormat,ge,_e,y.colorSpace),Ve=y.isVideoTexture!==!0,qe=ie.__version===void 0||Z===!0,Xe=te.dataReady;let je=v(y,Re);$(i.TEXTURE_CUBE_MAP,y);let Me;if(Ae){Ve&&qe&&t.texStorage2D(i.TEXTURE_CUBE_MAP,je,ke,Re.width,Re.height);for(let x=0;x<6;x++){Me=fe[x].mipmaps;for(let H=0;H<Me.length;H++){const K=Me[H];y.format!==Xt?ge!==null?Ve?Xe&&t.compressedTexSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+x,H,0,0,K.width,K.height,ge,K.data):t.compressedTexImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+x,H,ke,K.width,K.height,0,K.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):Ve?Xe&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+x,H,0,0,K.width,K.height,ge,_e,K.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+x,H,ke,K.width,K.height,0,ge,_e,K.data)}}}else{if(Me=y.mipmaps,Ve&&qe){Me.length>0&&je++;const x=We(fe[0]);t.texStorage2D(i.TEXTURE_CUBE_MAP,je,ke,x.width,x.height)}for(let x=0;x<6;x++)if(oe){Ve?Xe&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+x,0,0,0,fe[x].width,fe[x].height,ge,_e,fe[x].data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+x,0,ke,fe[x].width,fe[x].height,0,ge,_e,fe[x].data);for(let H=0;H<Me.length;H++){const ae=Me[H].image[x].image;Ve?Xe&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+x,H+1,0,0,ae.width,ae.height,ge,_e,ae.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+x,H+1,ke,ae.width,ae.height,0,ge,_e,ae.data)}}else{Ve?Xe&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+x,0,0,0,ge,_e,fe[x]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+x,0,ke,ge,_e,fe[x]);for(let H=0;H<Me.length;H++){const K=Me[H];Ve?Xe&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+x,H+1,0,0,ge,_e,K.image[x]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+x,H+1,ke,ge,_e,K.image[x])}}}m(y)&&p(i.TEXTURE_CUBE_MAP),ie.__version=te.version,y.onUpdate&&y.onUpdate(y)}w.__version=y.version}function O(w,y,q,Z,te,ie){const De=s.convert(q.format,q.colorSpace),re=s.convert(q.type),Se=E(q.internalFormat,De,re,q.colorSpace);if(!n.get(y).__hasExternalTextures){const oe=Math.max(1,y.width>>ie),fe=Math.max(1,y.height>>ie);te===i.TEXTURE_3D||te===i.TEXTURE_2D_ARRAY?t.texImage3D(te,ie,Se,oe,fe,y.depth,0,De,re,null):t.texImage2D(te,ie,Se,oe,fe,0,De,re,null)}t.bindFramebuffer(i.FRAMEBUFFER,w),xe(y)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,Z,te,n.get(q).__webglTexture,0,Fe(y)):(te===i.TEXTURE_2D||te>=i.TEXTURE_CUBE_MAP_POSITIVE_X&&te<=i.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&i.framebufferTexture2D(i.FRAMEBUFFER,Z,te,n.get(q).__webglTexture,ie),t.bindFramebuffer(i.FRAMEBUFFER,null)}function Q(w,y,q){if(i.bindRenderbuffer(i.RENDERBUFFER,w),y.depthBuffer&&!y.stencilBuffer){let Z=i.DEPTH_COMPONENT24;if(q||xe(y)){const te=y.depthTexture;te&&te.isDepthTexture&&(te.type===fn?Z=i.DEPTH_COMPONENT32F:te.type===gi&&(Z=i.DEPTH_COMPONENT24));const ie=Fe(y);xe(y)?o.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,ie,Z,y.width,y.height):i.renderbufferStorageMultisample(i.RENDERBUFFER,ie,Z,y.width,y.height)}else i.renderbufferStorage(i.RENDERBUFFER,Z,y.width,y.height);i.framebufferRenderbuffer(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.RENDERBUFFER,w)}else if(y.depthBuffer&&y.stencilBuffer){const Z=Fe(y);q&&xe(y)===!1?i.renderbufferStorageMultisample(i.RENDERBUFFER,Z,i.DEPTH24_STENCIL8,y.width,y.height):xe(y)?o.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,Z,i.DEPTH24_STENCIL8,y.width,y.height):i.renderbufferStorage(i.RENDERBUFFER,i.DEPTH_STENCIL,y.width,y.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.RENDERBUFFER,w)}else{const Z=y.textures;for(let te=0;te<Z.length;te++){const ie=Z[te],De=s.convert(ie.format,ie.colorSpace),re=s.convert(ie.type),Se=E(ie.internalFormat,De,re,ie.colorSpace),Ae=Fe(y);q&&xe(y)===!1?i.renderbufferStorageMultisample(i.RENDERBUFFER,Ae,Se,y.width,y.height):xe(y)?o.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,Ae,Se,y.width,y.height):i.renderbufferStorage(i.RENDERBUFFER,Se,y.width,y.height)}}i.bindRenderbuffer(i.RENDERBUFFER,null)}function ce(w,y){if(y&&y.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(i.FRAMEBUFFER,w),!(y.depthTexture&&y.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");(!n.get(y.depthTexture).__webglTexture||y.depthTexture.image.width!==y.width||y.depthTexture.image.height!==y.height)&&(y.depthTexture.image.width=y.width,y.depthTexture.image.height=y.height,y.depthTexture.needsUpdate=!0),C(y.depthTexture,0);const Z=n.get(y.depthTexture).__webglTexture,te=Fe(y);if(y.depthTexture.format===hi)xe(y)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_2D,Z,0,te):i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_2D,Z,0);else if(y.depthTexture.format===Ui)xe(y)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.TEXTURE_2D,Z,0,te):i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.TEXTURE_2D,Z,0);else throw new Error("Unknown depthTexture format")}function ne(w){const y=n.get(w),q=w.isWebGLCubeRenderTarget===!0;if(w.depthTexture&&!y.__autoAllocateDepthBuffer){if(q)throw new Error("target.depthTexture not supported in Cube render targets");ce(y.__webglFramebuffer,w)}else if(q){y.__webglDepthbuffer=[];for(let Z=0;Z<6;Z++)t.bindFramebuffer(i.FRAMEBUFFER,y.__webglFramebuffer[Z]),y.__webglDepthbuffer[Z]=i.createRenderbuffer(),Q(y.__webglDepthbuffer[Z],w,!1)}else t.bindFramebuffer(i.FRAMEBUFFER,y.__webglFramebuffer),y.__webglDepthbuffer=i.createRenderbuffer(),Q(y.__webglDepthbuffer,w,!1);t.bindFramebuffer(i.FRAMEBUFFER,null)}function ve(w,y,q){const Z=n.get(w);y!==void 0&&O(Z.__webglFramebuffer,w,w.texture,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,0),q!==void 0&&ne(w)}function Te(w){const y=w.texture,q=n.get(w),Z=n.get(y);w.addEventListener("dispose",R);const te=w.textures,ie=w.isWebGLCubeRenderTarget===!0,De=te.length>1;if(De||(Z.__webglTexture===void 0&&(Z.__webglTexture=i.createTexture()),Z.__version=y.version,a.memory.textures++),ie){q.__webglFramebuffer=[];for(let re=0;re<6;re++)if(y.mipmaps&&y.mipmaps.length>0){q.__webglFramebuffer[re]=[];for(let Se=0;Se<y.mipmaps.length;Se++)q.__webglFramebuffer[re][Se]=i.createFramebuffer()}else q.__webglFramebuffer[re]=i.createFramebuffer()}else{if(y.mipmaps&&y.mipmaps.length>0){q.__webglFramebuffer=[];for(let re=0;re<y.mipmaps.length;re++)q.__webglFramebuffer[re]=i.createFramebuffer()}else q.__webglFramebuffer=i.createFramebuffer();if(De)for(let re=0,Se=te.length;re<Se;re++){const Ae=n.get(te[re]);Ae.__webglTexture===void 0&&(Ae.__webglTexture=i.createTexture(),a.memory.textures++)}if(w.samples>0&&xe(w)===!1){q.__webglMultisampledFramebuffer=i.createFramebuffer(),q.__webglColorRenderbuffer=[],t.bindFramebuffer(i.FRAMEBUFFER,q.__webglMultisampledFramebuffer);for(let re=0;re<te.length;re++){const Se=te[re];q.__webglColorRenderbuffer[re]=i.createRenderbuffer(),i.bindRenderbuffer(i.RENDERBUFFER,q.__webglColorRenderbuffer[re]);const Ae=s.convert(Se.format,Se.colorSpace),oe=s.convert(Se.type),fe=E(Se.internalFormat,Ae,oe,Se.colorSpace,w.isXRRenderTarget===!0),Re=Fe(w);i.renderbufferStorageMultisample(i.RENDERBUFFER,Re,fe,w.width,w.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+re,i.RENDERBUFFER,q.__webglColorRenderbuffer[re])}i.bindRenderbuffer(i.RENDERBUFFER,null),w.depthBuffer&&(q.__webglDepthRenderbuffer=i.createRenderbuffer(),Q(q.__webglDepthRenderbuffer,w,!0)),t.bindFramebuffer(i.FRAMEBUFFER,null)}}if(ie){t.bindTexture(i.TEXTURE_CUBE_MAP,Z.__webglTexture),$(i.TEXTURE_CUBE_MAP,y);for(let re=0;re<6;re++)if(y.mipmaps&&y.mipmaps.length>0)for(let Se=0;Se<y.mipmaps.length;Se++)O(q.__webglFramebuffer[re][Se],w,y,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+re,Se);else O(q.__webglFramebuffer[re],w,y,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+re,0);m(y)&&p(i.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(De){for(let re=0,Se=te.length;re<Se;re++){const Ae=te[re],oe=n.get(Ae);t.bindTexture(i.TEXTURE_2D,oe.__webglTexture),$(i.TEXTURE_2D,Ae),O(q.__webglFramebuffer,w,Ae,i.COLOR_ATTACHMENT0+re,i.TEXTURE_2D,0),m(Ae)&&p(i.TEXTURE_2D)}t.unbindTexture()}else{let re=i.TEXTURE_2D;if((w.isWebGL3DRenderTarget||w.isWebGLArrayRenderTarget)&&(re=w.isWebGL3DRenderTarget?i.TEXTURE_3D:i.TEXTURE_2D_ARRAY),t.bindTexture(re,Z.__webglTexture),$(re,y),y.mipmaps&&y.mipmaps.length>0)for(let Se=0;Se<y.mipmaps.length;Se++)O(q.__webglFramebuffer[Se],w,y,i.COLOR_ATTACHMENT0,re,Se);else O(q.__webglFramebuffer,w,y,i.COLOR_ATTACHMENT0,re,0);m(y)&&p(re),t.unbindTexture()}w.depthBuffer&&ne(w)}function Ce(w){const y=w.textures;for(let q=0,Z=y.length;q<Z;q++){const te=y[q];if(m(te)){const ie=w.isWebGLCubeRenderTarget?i.TEXTURE_CUBE_MAP:i.TEXTURE_2D,De=n.get(te).__webglTexture;t.bindTexture(ie,De),p(ie),t.unbindTexture()}}}function k(w){if(w.samples>0&&xe(w)===!1){const y=w.textures,q=w.width,Z=w.height;let te=i.COLOR_BUFFER_BIT;const ie=[],De=w.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,re=n.get(w),Se=y.length>1;if(Se)for(let Ae=0;Ae<y.length;Ae++)t.bindFramebuffer(i.FRAMEBUFFER,re.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+Ae,i.RENDERBUFFER,null),t.bindFramebuffer(i.FRAMEBUFFER,re.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+Ae,i.TEXTURE_2D,null,0);t.bindFramebuffer(i.READ_FRAMEBUFFER,re.__webglMultisampledFramebuffer),t.bindFramebuffer(i.DRAW_FRAMEBUFFER,re.__webglFramebuffer);for(let Ae=0;Ae<y.length;Ae++){ie.push(i.COLOR_ATTACHMENT0+Ae),w.depthBuffer&&ie.push(De);const oe=re.__ignoreDepthValues!==void 0?re.__ignoreDepthValues:!1;if(oe===!1&&(w.depthBuffer&&(te|=i.DEPTH_BUFFER_BIT),w.stencilBuffer&&re.__isTransmissionRenderTarget!==!0&&(te|=i.STENCIL_BUFFER_BIT)),Se&&i.framebufferRenderbuffer(i.READ_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.RENDERBUFFER,re.__webglColorRenderbuffer[Ae]),oe===!0&&(i.invalidateFramebuffer(i.READ_FRAMEBUFFER,[De]),i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,[De])),Se){const fe=n.get(y[Ae]).__webglTexture;i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,fe,0)}i.blitFramebuffer(0,0,q,Z,0,0,q,Z,te,i.NEAREST),l&&i.invalidateFramebuffer(i.READ_FRAMEBUFFER,ie)}if(t.bindFramebuffer(i.READ_FRAMEBUFFER,null),t.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),Se)for(let Ae=0;Ae<y.length;Ae++){t.bindFramebuffer(i.FRAMEBUFFER,re.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+Ae,i.RENDERBUFFER,re.__webglColorRenderbuffer[Ae]);const oe=n.get(y[Ae]).__webglTexture;t.bindFramebuffer(i.FRAMEBUFFER,re.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+Ae,i.TEXTURE_2D,oe,0)}t.bindFramebuffer(i.DRAW_FRAMEBUFFER,re.__webglMultisampledFramebuffer)}}function Fe(w){return Math.min(r.maxSamples,w.samples)}function xe(w){const y=n.get(w);return w.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&y.__useRenderToTexture!==!1}function Ge(w){const y=a.render.frame;u.get(w)!==y&&(u.set(w,y),w.update())}function Ee(w,y){const q=w.colorSpace,Z=w.format,te=w.type;return w.isCompressedTexture===!0||w.isVideoTexture===!0||q!==xn&&q!==dn&&(Ye.getTransfer(q)===Ke?(Z!==Xt||te!==mn)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",q)),y}function We(w){return typeof HTMLImageElement<"u"&&w instanceof HTMLImageElement?(c.width=w.naturalWidth||w.width,c.height=w.naturalHeight||w.height):typeof VideoFrame<"u"&&w instanceof VideoFrame?(c.width=w.displayWidth,c.height=w.displayHeight):(c.width=w.width,c.height=w.height),c}this.allocateTextureUnit=F,this.resetTextureUnits=M,this.setTexture2D=C,this.setTexture2DArray=N,this.setTexture3D=V,this.setTextureCube=j,this.rebindTextures=ve,this.setupRenderTarget=Te,this.updateRenderTargetMipmap=Ce,this.updateMultisampleRenderTarget=k,this.setupDepthRenderbuffer=ne,this.setupFrameBufferTexture=O,this.useMultisampledRTT=xe}function E0(i,e){function t(n,r=dn){let s;const a=Ye.getTransfer(r);if(n===mn)return i.UNSIGNED_BYTE;if(n===Ul)return i.UNSIGNED_SHORT_4_4_4_4;if(n===Ol)return i.UNSIGNED_SHORT_5_5_5_1;if(n===Gu)return i.UNSIGNED_INT_5_9_9_9_REV;if(n===Vu)return i.BYTE;if(n===Hu)return i.SHORT;if(n===Il)return i.UNSIGNED_SHORT;if(n===Nl)return i.INT;if(n===gi)return i.UNSIGNED_INT;if(n===fn)return i.FLOAT;if(n===gn)return i.HALF_FLOAT;if(n===Wu)return i.ALPHA;if(n===Xu)return i.RGB;if(n===Xt)return i.RGBA;if(n===qu)return i.LUMINANCE;if(n===ju)return i.LUMINANCE_ALPHA;if(n===hi)return i.DEPTH_COMPONENT;if(n===Ui)return i.DEPTH_STENCIL;if(n===$u)return i.RED;if(n===Bl)return i.RED_INTEGER;if(n===Yu)return i.RG;if(n===zl)return i.RG_INTEGER;if(n===kl)return i.RGBA_INTEGER;if(n===Yr||n===Kr||n===Zr||n===Jr)if(a===Ke)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(n===Yr)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Kr)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===Zr)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===Jr)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(n===Yr)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Kr)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===Zr)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===Jr)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===Ra||n===Pa||n===La||n===Fa)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(n===Ra)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===Pa)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===La)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===Fa)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===Vl)return s=e.get("WEBGL_compressed_texture_etc1"),s!==null?s.COMPRESSED_RGB_ETC1_WEBGL:null;if(n===Ia||n===Na)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(n===Ia)return a===Ke?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(n===Na)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(n===Ua||n===Oa||n===Ba||n===za||n===ka||n===Va||n===Ha||n===Ga||n===Wa||n===Xa||n===qa||n===ja||n===$a||n===Ya)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(n===Ua)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===Oa)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===Ba)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===za)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===ka)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===Va)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===Ha)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===Ga)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===Wa)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===Xa)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===qa)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===ja)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===$a)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===Ya)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===Qr||n===Ka||n===Za)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(n===Qr)return a===Ke?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===Ka)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===Za)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===Ku||n===Ja||n===Qa||n===eo)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(n===Qr)return s.COMPRESSED_RED_RGTC1_EXT;if(n===Ja)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===Qa)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===eo)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===zi?i.UNSIGNED_INT_24_8:i[n]!==void 0?i[n]:null}return{convert:t}}class b0 extends Rt{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class mr extends St{constructor(){super(),this.isGroup=!0,this.type="Group"}}const T0={type:"move"};class bs{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new mr,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new mr,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new I,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new I),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new mr,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new I,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new I),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,n){let r=null,s=null,a=null;const o=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){a=!0;for(const _ of e.hand.values()){const m=t.getJointPose(_,n),p=this._getHandJoint(c,_);m!==null&&(p.matrix.fromArray(m.transform.matrix),p.matrix.decompose(p.position,p.rotation,p.scale),p.matrixWorldNeedsUpdate=!0,p.jointRadius=m.radius),p.visible=m!==null}const u=c.joints["index-finger-tip"],d=c.joints["thumb-tip"],h=u.position.distanceTo(d.position),f=.02,g=.005;c.inputState.pinching&&h>f+g?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&h<=f-g&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,n),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1));o!==null&&(r=t.getPose(e.targetRaySpace,n),r===null&&s!==null&&(r=s),r!==null&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,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(T0)))}return o!==null&&(o.visible=r!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new mr;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}const D0=`
3777
3777
  void main() {
3778
3778
 
3779
3779
  gl_Position = vec4( position, 1.0 );
@@ -3797,7 +3797,7 @@ void main() {
3797
3797
 
3798
3798
  }
3799
3799
 
3800
- }`;class w0{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,n){if(this.texture===null){const r=new Tt,s=e.properties.get(r);s.__webglTexture=t.texture,(t.depthNear!=n.depthNear||t.depthFar!=n.depthFar)&&(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=r}}render(e,t){if(this.texture!==null){if(this.mesh===null){const n=t.cameras[0].viewport,r=new ft({vertexShader:D0,fragmentShader:A0,uniforms:{depthColor:{value:this.texture},depthWidth:{value:n.z},depthHeight:{value:n.w}}});this.mesh=new bt(new zr(20,20),r)}e.render(this.mesh,t)}}reset(){this.texture=null,this.mesh=null}}class C0 extends Nn{constructor(e,t){super();const n=this;let r=null,s=1,a=null,o="local-floor",l=1,c=null,u=null,d=null,h=null,f=null,g=null;const _=new w0,m=t.getContextAttributes();let p=null,E=null;const v=[],b=[],R=new ue;let T=null;const A=new Rt;A.layers.enable(1),A.viewport=new dt;const P=new Rt;P.layers.enable(2),P.viewport=new dt;const y=[A,P],M=new b0;M.layers.enable(1),M.layers.enable(2);let F=null,L=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(O){let Q=v[O];return Q===void 0&&(Q=new Es,v[O]=Q),Q.getTargetRaySpace()},this.getControllerGrip=function(O){let Q=v[O];return Q===void 0&&(Q=new Es,v[O]=Q),Q.getGripSpace()},this.getHand=function(O){let Q=v[O];return Q===void 0&&(Q=new Es,v[O]=Q),Q.getHandSpace()};function C(O){const Q=b.indexOf(O.inputSource);if(Q===-1)return;const ce=v[Q];ce!==void 0&&(ce.update(O.inputSource,O.frame,c||a),ce.dispatchEvent({type:O.type,data:O.inputSource}))}function U(){r.removeEventListener("select",C),r.removeEventListener("selectstart",C),r.removeEventListener("selectend",C),r.removeEventListener("squeeze",C),r.removeEventListener("squeezestart",C),r.removeEventListener("squeezeend",C),r.removeEventListener("end",U),r.removeEventListener("inputsourceschange",H);for(let O=0;O<v.length;O++){const Q=b[O];Q!==null&&(b[O]=null,v[O].disconnect(Q))}F=null,L=null,_.reset(),e.setRenderTarget(p),f=null,h=null,d=null,r=null,E=null,me.stop(),n.isPresenting=!1,e.setPixelRatio(T),e.setSize(R.width,R.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(O){s=O,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(O){o=O,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||a},this.setReferenceSpace=function(O){c=O},this.getBaseLayer=function(){return h!==null?h:f},this.getBinding=function(){return d},this.getFrame=function(){return g},this.getSession=function(){return r},this.setSession=async function(O){if(r=O,r!==null){if(p=e.getRenderTarget(),r.addEventListener("select",C),r.addEventListener("selectstart",C),r.addEventListener("selectend",C),r.addEventListener("squeeze",C),r.addEventListener("squeezestart",C),r.addEventListener("squeezeend",C),r.addEventListener("end",U),r.addEventListener("inputsourceschange",H),m.xrCompatible!==!0&&await t.makeXRCompatible(),T=e.getPixelRatio(),e.getSize(R),r.renderState.layers===void 0){const Q={antialias:m.antialias,alpha:!0,depth:m.depth,stencil:m.stencil,framebufferScaleFactor:s};f=new XRWebGLLayer(r,t,Q),r.updateRenderState({baseLayer:f}),e.setPixelRatio(1),e.setSize(f.framebufferWidth,f.framebufferHeight,!1),E=new Ht(f.framebufferWidth,f.framebufferHeight,{format:Xt,type:mn,colorSpace:e.outputColorSpace,stencilBuffer:m.stencil})}else{let Q=null,ce=null,ne=null;m.depth&&(ne=m.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,Q=m.stencil?Ni:hi,ce=m.stencil?zi:gi);const ve={colorFormat:t.RGBA8,depthFormat:ne,scaleFactor:s};d=new XRWebGLBinding(r,t),h=d.createProjectionLayer(ve),r.updateRenderState({layers:[h]}),e.setPixelRatio(1),e.setSize(h.textureWidth,h.textureHeight,!1),E=new Ht(h.textureWidth,h.textureHeight,{format:Xt,type:mn,depthTexture:new rc(h.textureWidth,h.textureHeight,ce,void 0,void 0,void 0,void 0,void 0,void 0,Q),stencilBuffer:m.stencil,colorSpace:e.outputColorSpace,samples:m.antialias?4:0});const Te=e.properties.get(E);Te.__ignoreDepthValues=h.ignoreDepthValues}E.isXRRenderTarget=!0,this.setFoveation(l),c=null,a=await r.requestReferenceSpace(o),me.setContext(r),me.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(r!==null)return r.environmentBlendMode};function H(O){for(let Q=0;Q<O.removed.length;Q++){const ce=O.removed[Q],ne=b.indexOf(ce);ne>=0&&(b[ne]=null,v[ne].disconnect(ce))}for(let Q=0;Q<O.added.length;Q++){const ce=O.added[Q];let ne=b.indexOf(ce);if(ne===-1){for(let Te=0;Te<v.length;Te++)if(Te>=b.length){b.push(ce),ne=Te;break}else if(b[Te]===null){b[Te]=ce,ne=Te;break}if(ne===-1)break}const ve=v[ne];ve&&ve.connect(ce)}}const Y=new I,J=new I;function z(O,Q,ce){Y.setFromMatrixPosition(Q.matrixWorld),J.setFromMatrixPosition(ce.matrixWorld);const ne=Y.distanceTo(J),ve=Q.projectionMatrix.elements,Te=ce.projectionMatrix.elements,Ce=ve[14]/(ve[10]-1),k=ve[14]/(ve[10]+1),Fe=(ve[9]+1)/ve[5],xe=(ve[9]-1)/ve[5],Ge=(ve[8]-1)/ve[0],Ee=(Te[8]+1)/Te[0],We=Ce*Ge,w=Ce*Ee,S=ne/(-Ge+Ee),q=S*-Ge;Q.matrixWorld.decompose(O.position,O.quaternion,O.scale),O.translateX(q),O.translateZ(S),O.matrixWorld.compose(O.position,O.quaternion,O.scale),O.matrixWorldInverse.copy(O.matrixWorld).invert();const Z=Ce+S,te=k+S,ie=We-q,De=w+(ne-q),re=Fe*k/te*Z,ye=xe*k/te*Z;O.projectionMatrix.makePerspective(ie,De,re,ye,Z,te),O.projectionMatrixInverse.copy(O.projectionMatrix).invert()}function j(O,Q){Q===null?O.matrixWorld.copy(O.matrix):O.matrixWorld.multiplyMatrices(Q.matrixWorld,O.matrix),O.matrixWorldInverse.copy(O.matrixWorld).invert()}this.updateCamera=function(O){if(r===null)return;_.texture!==null&&(O.near=_.depthNear,O.far=_.depthFar),M.near=P.near=A.near=O.near,M.far=P.far=A.far=O.far,(F!==M.near||L!==M.far)&&(r.updateRenderState({depthNear:M.near,depthFar:M.far}),F=M.near,L=M.far,A.near=F,A.far=L,P.near=F,P.far=L,A.updateProjectionMatrix(),P.updateProjectionMatrix(),O.updateProjectionMatrix());const Q=O.parent,ce=M.cameras;j(M,Q);for(let ne=0;ne<ce.length;ne++)j(ce[ne],Q);ce.length===2?z(M,A,P):M.projectionMatrix.copy(A.projectionMatrix),$(O,M,Q)};function $(O,Q,ce){ce===null?O.matrix.copy(Q.matrixWorld):(O.matrix.copy(ce.matrixWorld),O.matrix.invert(),O.matrix.multiply(Q.matrixWorld)),O.matrix.decompose(O.position,O.quaternion,O.scale),O.updateMatrixWorld(!0),O.projectionMatrix.copy(Q.projectionMatrix),O.projectionMatrixInverse.copy(Q.projectionMatrixInverse),O.isPerspectiveCamera&&(O.fov=Oi*2*Math.atan(1/O.projectionMatrix.elements[5]),O.zoom=1)}this.getCamera=function(){return M},this.getFoveation=function(){if(!(h===null&&f===null))return l},this.setFoveation=function(O){l=O,h!==null&&(h.fixedFoveation=O),f!==null&&f.fixedFoveation!==void 0&&(f.fixedFoveation=O)},this.hasDepthSensing=function(){return _.texture!==null};let N=null;function ee(O,Q){if(u=Q.getViewerPose(c||a),g=Q,u!==null){const ce=u.views;f!==null&&(e.setRenderTargetFramebuffer(E,f.framebuffer),e.setRenderTarget(E));let ne=!1;ce.length!==M.cameras.length&&(M.cameras.length=0,ne=!0);for(let Te=0;Te<ce.length;Te++){const Ce=ce[Te];let k=null;if(f!==null)k=f.getViewport(Ce);else{const xe=d.getViewSubImage(h,Ce);k=xe.viewport,Te===0&&(e.setRenderTargetTextures(E,xe.colorTexture,h.ignoreDepthValues?void 0:xe.depthStencilTexture),e.setRenderTarget(E))}let Fe=y[Te];Fe===void 0&&(Fe=new Rt,Fe.layers.enable(Te),Fe.viewport=new dt,y[Te]=Fe),Fe.matrix.fromArray(Ce.transform.matrix),Fe.matrix.decompose(Fe.position,Fe.quaternion,Fe.scale),Fe.projectionMatrix.fromArray(Ce.projectionMatrix),Fe.projectionMatrixInverse.copy(Fe.projectionMatrix).invert(),Fe.viewport.set(k.x,k.y,k.width,k.height),Te===0&&(M.matrix.copy(Fe.matrix),M.matrix.decompose(M.position,M.quaternion,M.scale)),ne===!0&&M.cameras.push(Fe)}const ve=r.enabledFeatures;if(ve&&ve.includes("depth-sensing")){const Te=d.getDepthInformation(ce[0]);Te&&Te.isValid&&Te.texture&&_.init(e,Te,r.renderState)}}for(let ce=0;ce<v.length;ce++){const ne=b[ce],ve=v[ce];ne!==null&&ve!==void 0&&ve.update(ne,Q,c||a)}_.render(e,M),N&&N(O,Q),Q.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:Q}),g=null}const me=new nc;me.setAnimationLoop(ee),this.setAnimationLoop=function(O){N=O},this.dispose=function(){}}}const Dn=new In,R0=new et;function P0(i,e){function t(m,p){m.matrixAutoUpdate===!0&&m.updateMatrix(),p.value.copy(m.matrix)}function n(m,p){p.color.getRGB(m.fogColor.value,Jl(i)),p.isFog?(m.fogNear.value=p.near,m.fogFar.value=p.far):p.isFogExp2&&(m.fogDensity.value=p.density)}function r(m,p,E,v,b){p.isMeshBasicMaterial||p.isMeshLambertMaterial?s(m,p):p.isMeshToonMaterial?(s(m,p),d(m,p)):p.isMeshPhongMaterial?(s(m,p),u(m,p)):p.isMeshStandardMaterial?(s(m,p),h(m,p),p.isMeshPhysicalMaterial&&f(m,p,b)):p.isMeshMatcapMaterial?(s(m,p),g(m,p)):p.isMeshDepthMaterial?s(m,p):p.isMeshDistanceMaterial?(s(m,p),_(m,p)):p.isMeshNormalMaterial?s(m,p):p.isLineBasicMaterial?(a(m,p),p.isLineDashedMaterial&&o(m,p)):p.isPointsMaterial?l(m,p,E,v):p.isSpriteMaterial?c(m,p):p.isShadowMaterial?(m.color.value.copy(p.color),m.opacity.value=p.opacity):p.isShaderMaterial&&(p.uniformsNeedUpdate=!1)}function s(m,p){m.opacity.value=p.opacity,p.color&&m.diffuse.value.copy(p.color),p.emissive&&m.emissive.value.copy(p.emissive).multiplyScalar(p.emissiveIntensity),p.map&&(m.map.value=p.map,t(p.map,m.mapTransform)),p.alphaMap&&(m.alphaMap.value=p.alphaMap,t(p.alphaMap,m.alphaMapTransform)),p.bumpMap&&(m.bumpMap.value=p.bumpMap,t(p.bumpMap,m.bumpMapTransform),m.bumpScale.value=p.bumpScale,p.side===St&&(m.bumpScale.value*=-1)),p.normalMap&&(m.normalMap.value=p.normalMap,t(p.normalMap,m.normalMapTransform),m.normalScale.value.copy(p.normalScale),p.side===St&&m.normalScale.value.negate()),p.displacementMap&&(m.displacementMap.value=p.displacementMap,t(p.displacementMap,m.displacementMapTransform),m.displacementScale.value=p.displacementScale,m.displacementBias.value=p.displacementBias),p.emissiveMap&&(m.emissiveMap.value=p.emissiveMap,t(p.emissiveMap,m.emissiveMapTransform)),p.specularMap&&(m.specularMap.value=p.specularMap,t(p.specularMap,m.specularMapTransform)),p.alphaTest>0&&(m.alphaTest.value=p.alphaTest);const E=e.get(p),v=E.envMap,b=E.envMapRotation;if(v&&(m.envMap.value=v,Dn.copy(b),Dn.x*=-1,Dn.y*=-1,Dn.z*=-1,v.isCubeTexture&&v.isRenderTargetTexture===!1&&(Dn.y*=-1,Dn.z*=-1),m.envMapRotation.value.setFromMatrix4(R0.makeRotationFromEuler(Dn)),m.flipEnvMap.value=v.isCubeTexture&&v.isRenderTargetTexture===!1?-1:1,m.reflectivity.value=p.reflectivity,m.ior.value=p.ior,m.refractionRatio.value=p.refractionRatio),p.lightMap){m.lightMap.value=p.lightMap;const R=i._useLegacyLights===!0?Math.PI:1;m.lightMapIntensity.value=p.lightMapIntensity*R,t(p.lightMap,m.lightMapTransform)}p.aoMap&&(m.aoMap.value=p.aoMap,m.aoMapIntensity.value=p.aoMapIntensity,t(p.aoMap,m.aoMapTransform))}function a(m,p){m.diffuse.value.copy(p.color),m.opacity.value=p.opacity,p.map&&(m.map.value=p.map,t(p.map,m.mapTransform))}function o(m,p){m.dashSize.value=p.dashSize,m.totalSize.value=p.dashSize+p.gapSize,m.scale.value=p.scale}function l(m,p,E,v){m.diffuse.value.copy(p.color),m.opacity.value=p.opacity,m.size.value=p.size*E,m.scale.value=v*.5,p.map&&(m.map.value=p.map,t(p.map,m.uvTransform)),p.alphaMap&&(m.alphaMap.value=p.alphaMap,t(p.alphaMap,m.alphaMapTransform)),p.alphaTest>0&&(m.alphaTest.value=p.alphaTest)}function c(m,p){m.diffuse.value.copy(p.color),m.opacity.value=p.opacity,m.rotation.value=p.rotation,p.map&&(m.map.value=p.map,t(p.map,m.mapTransform)),p.alphaMap&&(m.alphaMap.value=p.alphaMap,t(p.alphaMap,m.alphaMapTransform)),p.alphaTest>0&&(m.alphaTest.value=p.alphaTest)}function u(m,p){m.specular.value.copy(p.specular),m.shininess.value=Math.max(p.shininess,1e-4)}function d(m,p){p.gradientMap&&(m.gradientMap.value=p.gradientMap)}function h(m,p){m.metalness.value=p.metalness,p.metalnessMap&&(m.metalnessMap.value=p.metalnessMap,t(p.metalnessMap,m.metalnessMapTransform)),m.roughness.value=p.roughness,p.roughnessMap&&(m.roughnessMap.value=p.roughnessMap,t(p.roughnessMap,m.roughnessMapTransform)),p.envMap&&(m.envMapIntensity.value=p.envMapIntensity)}function f(m,p,E){m.ior.value=p.ior,p.sheen>0&&(m.sheenColor.value.copy(p.sheenColor).multiplyScalar(p.sheen),m.sheenRoughness.value=p.sheenRoughness,p.sheenColorMap&&(m.sheenColorMap.value=p.sheenColorMap,t(p.sheenColorMap,m.sheenColorMapTransform)),p.sheenRoughnessMap&&(m.sheenRoughnessMap.value=p.sheenRoughnessMap,t(p.sheenRoughnessMap,m.sheenRoughnessMapTransform))),p.clearcoat>0&&(m.clearcoat.value=p.clearcoat,m.clearcoatRoughness.value=p.clearcoatRoughness,p.clearcoatMap&&(m.clearcoatMap.value=p.clearcoatMap,t(p.clearcoatMap,m.clearcoatMapTransform)),p.clearcoatRoughnessMap&&(m.clearcoatRoughnessMap.value=p.clearcoatRoughnessMap,t(p.clearcoatRoughnessMap,m.clearcoatRoughnessMapTransform)),p.clearcoatNormalMap&&(m.clearcoatNormalMap.value=p.clearcoatNormalMap,t(p.clearcoatNormalMap,m.clearcoatNormalMapTransform),m.clearcoatNormalScale.value.copy(p.clearcoatNormalScale),p.side===St&&m.clearcoatNormalScale.value.negate())),p.iridescence>0&&(m.iridescence.value=p.iridescence,m.iridescenceIOR.value=p.iridescenceIOR,m.iridescenceThicknessMinimum.value=p.iridescenceThicknessRange[0],m.iridescenceThicknessMaximum.value=p.iridescenceThicknessRange[1],p.iridescenceMap&&(m.iridescenceMap.value=p.iridescenceMap,t(p.iridescenceMap,m.iridescenceMapTransform)),p.iridescenceThicknessMap&&(m.iridescenceThicknessMap.value=p.iridescenceThicknessMap,t(p.iridescenceThicknessMap,m.iridescenceThicknessMapTransform))),p.transmission>0&&(m.transmission.value=p.transmission,m.transmissionSamplerMap.value=E.texture,m.transmissionSamplerSize.value.set(E.width,E.height),p.transmissionMap&&(m.transmissionMap.value=p.transmissionMap,t(p.transmissionMap,m.transmissionMapTransform)),m.thickness.value=p.thickness,p.thicknessMap&&(m.thicknessMap.value=p.thicknessMap,t(p.thicknessMap,m.thicknessMapTransform)),m.attenuationDistance.value=p.attenuationDistance,m.attenuationColor.value.copy(p.attenuationColor)),p.anisotropy>0&&(m.anisotropyVector.value.set(p.anisotropy*Math.cos(p.anisotropyRotation),p.anisotropy*Math.sin(p.anisotropyRotation)),p.anisotropyMap&&(m.anisotropyMap.value=p.anisotropyMap,t(p.anisotropyMap,m.anisotropyMapTransform))),m.specularIntensity.value=p.specularIntensity,m.specularColor.value.copy(p.specularColor),p.specularColorMap&&(m.specularColorMap.value=p.specularColorMap,t(p.specularColorMap,m.specularColorMapTransform)),p.specularIntensityMap&&(m.specularIntensityMap.value=p.specularIntensityMap,t(p.specularIntensityMap,m.specularIntensityMapTransform))}function g(m,p){p.matcap&&(m.matcap.value=p.matcap)}function _(m,p){const E=e.get(p).light;m.referencePosition.value.setFromMatrixPosition(E.matrixWorld),m.nearDistance.value=E.shadow.camera.near,m.farDistance.value=E.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:r}}function L0(i,e,t,n){let r={},s={},a=[];const o=i.getParameter(i.MAX_UNIFORM_BUFFER_BINDINGS);function l(E,v){const b=v.program;n.uniformBlockBinding(E,b)}function c(E,v){let b=r[E.id];b===void 0&&(g(E),b=u(E),r[E.id]=b,E.addEventListener("dispose",m));const R=v.program;n.updateUBOMapping(E,R);const T=e.render.frame;s[E.id]!==T&&(h(E),s[E.id]=T)}function u(E){const v=d();E.__bindingPointIndex=v;const b=i.createBuffer(),R=E.__size,T=E.usage;return i.bindBuffer(i.UNIFORM_BUFFER,b),i.bufferData(i.UNIFORM_BUFFER,R,T),i.bindBuffer(i.UNIFORM_BUFFER,null),i.bindBufferBase(i.UNIFORM_BUFFER,v,b),b}function d(){for(let E=0;E<o;E++)if(a.indexOf(E)===-1)return a.push(E),E;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function h(E){const v=r[E.id],b=E.uniforms,R=E.__cache;i.bindBuffer(i.UNIFORM_BUFFER,v);for(let T=0,A=b.length;T<A;T++){const P=Array.isArray(b[T])?b[T]:[b[T]];for(let y=0,M=P.length;y<M;y++){const F=P[y];if(f(F,T,y,R)===!0){const L=F.__offset,C=Array.isArray(F.value)?F.value:[F.value];let U=0;for(let H=0;H<C.length;H++){const Y=C[H],J=_(Y);typeof Y=="number"||typeof Y=="boolean"?(F.__data[0]=Y,i.bufferSubData(i.UNIFORM_BUFFER,L+U,F.__data)):Y.isMatrix3?(F.__data[0]=Y.elements[0],F.__data[1]=Y.elements[1],F.__data[2]=Y.elements[2],F.__data[3]=0,F.__data[4]=Y.elements[3],F.__data[5]=Y.elements[4],F.__data[6]=Y.elements[5],F.__data[7]=0,F.__data[8]=Y.elements[6],F.__data[9]=Y.elements[7],F.__data[10]=Y.elements[8],F.__data[11]=0):(Y.toArray(F.__data,U),U+=J.storage/Float32Array.BYTES_PER_ELEMENT)}i.bufferSubData(i.UNIFORM_BUFFER,L,F.__data)}}}i.bindBuffer(i.UNIFORM_BUFFER,null)}function f(E,v,b,R){const T=E.value,A=v+"_"+b;if(R[A]===void 0)return typeof T=="number"||typeof T=="boolean"?R[A]=T:R[A]=T.clone(),!0;{const P=R[A];if(typeof T=="number"||typeof T=="boolean"){if(P!==T)return R[A]=T,!0}else if(P.equals(T)===!1)return P.copy(T),!0}return!1}function g(E){const v=E.uniforms;let b=0;const R=16;for(let A=0,P=v.length;A<P;A++){const y=Array.isArray(v[A])?v[A]:[v[A]];for(let M=0,F=y.length;M<F;M++){const L=y[M],C=Array.isArray(L.value)?L.value:[L.value];for(let U=0,H=C.length;U<H;U++){const Y=C[U],J=_(Y),z=b%R;z!==0&&R-z<J.boundary&&(b+=R-z),L.__data=new Float32Array(J.storage/Float32Array.BYTES_PER_ELEMENT),L.__offset=b,b+=J.storage}}}const T=b%R;return T>0&&(b+=R-T),E.__size=b,E.__cache={},this}function _(E){const v={boundary:0,storage:0};return typeof E=="number"||typeof E=="boolean"?(v.boundary=4,v.storage=4):E.isVector2?(v.boundary=8,v.storage=8):E.isVector3||E.isColor?(v.boundary=16,v.storage=12):E.isVector4?(v.boundary=16,v.storage=16):E.isMatrix3?(v.boundary=48,v.storage=48):E.isMatrix4?(v.boundary=64,v.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),v}function m(E){const v=E.target;v.removeEventListener("dispose",m);const b=a.indexOf(v.__bindingPointIndex);a.splice(b,1),i.deleteBuffer(r[v.id]),delete r[v.id],delete s[v.id]}function p(){for(const E in r)i.deleteBuffer(r[E]);a=[],r={},s={}}return{bind:l,update:c,dispose:p}}class uc{constructor(e={}){const{canvas:t=bh(),context:n=null,depth:r=!0,stencil:s=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:d=!1}=e;this.isWebGLRenderer=!0;let h;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");h=n.getContextAttributes().alpha}else h=a;const f=new Uint32Array(4),g=new Int32Array(4);let _=null,m=null;const p=[],E=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=It,this._useLegacyLights=!1,this.toneMapping=pn,this.toneMappingExposure=1;const v=this;let b=!1,R=0,T=0,A=null,P=-1,y=null;const M=new dt,F=new dt;let L=null;const C=new be(0);let U=0,H=t.width,Y=t.height,J=1,z=null,j=null;const $=new dt(0,0,H,Y),N=new dt(0,0,H,Y);let ee=!1;const me=new tc;let O=!1,Q=!1;const ce=new et,ne=new ue,ve=new I,Te={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function Ce(){return A===null?J:1}let k=n;function Fe(D,B){const W=t.getContext(D,B);return W!==null?W:null}try{const D={alpha:!0,depth:r,stencil:s,antialias:o,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:u,failIfMajorPerformanceCaveat:d};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${Js}`),t.addEventListener("webglcontextlost",V,!1),t.addEventListener("webglcontextrestored",K,!1),t.addEventListener("webglcontextcreationerror",se,!1),k===null){const B="webgl2";if(k=Fe(B,D),k===null)throw Fe(B)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(D){throw console.error("THREE.WebGLRenderer: "+D.message),D}let xe,Ge,Ee,We,w,S,q,Z,te,ie,De,re,ye,Ae,ae,fe,Re,ge,_e,ke,He,qe,Xe,Ye;function Me(){xe=new Hp(k),xe.init(),Ge=new Up(k,xe,e),qe=new E0(k,xe),Ee=new S0(k),We=new Wp(k),w=new o0,S=new y0(k,xe,Ee,w,Ge,qe,We),q=new Op(v),Z=new kp(v),te=new jh(k),Xe=new Fp(k,te),ie=new Vp(k,te,We,Xe),De=new qp(k,ie,te,We),_e=new Xp(k,Ge,S),fe=new Np(w),re=new a0(v,q,Z,xe,Ge,Xe,fe),ye=new P0(v,w),Ae=new c0,ae=new m0(xe),ge=new Lp(v,q,Z,Ee,De,h,l),Re=new M0(v,De,Ge),Ye=new L0(k,We,Ge,Ee),ke=new Ip(k,xe,We),He=new Gp(k,xe,We),We.programs=re.programs,v.capabilities=Ge,v.extensions=xe,v.properties=w,v.renderLists=Ae,v.shadowMap=Re,v.state=Ee,v.info=We}Me();const x=new C0(v,k);this.xr=x,this.getContext=function(){return k},this.getContextAttributes=function(){return k.getContextAttributes()},this.forceContextLoss=function(){const D=xe.get("WEBGL_lose_context");D&&D.loseContext()},this.forceContextRestore=function(){const D=xe.get("WEBGL_lose_context");D&&D.restoreContext()},this.getPixelRatio=function(){return J},this.setPixelRatio=function(D){D!==void 0&&(J=D,this.setSize(H,Y,!1))},this.getSize=function(D){return D.set(H,Y)},this.setSize=function(D,B,W=!0){if(x.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}H=D,Y=B,t.width=Math.floor(D*J),t.height=Math.floor(B*J),W===!0&&(t.style.width=D+"px",t.style.height=B+"px"),this.setViewport(0,0,D,B)},this.getDrawingBufferSize=function(D){return D.set(H*J,Y*J).floor()},this.setDrawingBufferSize=function(D,B,W){H=D,Y=B,J=W,t.width=Math.floor(D*W),t.height=Math.floor(B*W),this.setViewport(0,0,D,B)},this.getCurrentViewport=function(D){return D.copy(M)},this.getViewport=function(D){return D.copy($)},this.setViewport=function(D,B,W,X){D.isVector4?$.set(D.x,D.y,D.z,D.w):$.set(D,B,W,X),Ee.viewport(M.copy($).multiplyScalar(J).round())},this.getScissor=function(D){return D.copy(N)},this.setScissor=function(D,B,W,X){D.isVector4?N.set(D.x,D.y,D.z,D.w):N.set(D,B,W,X),Ee.scissor(F.copy(N).multiplyScalar(J).round())},this.getScissorTest=function(){return ee},this.setScissorTest=function(D){Ee.setScissorTest(ee=D)},this.setOpaqueSort=function(D){z=D},this.setTransparentSort=function(D){j=D},this.getClearColor=function(D){return D.copy(ge.getClearColor())},this.setClearColor=function(){ge.setClearColor.apply(ge,arguments)},this.getClearAlpha=function(){return ge.getClearAlpha()},this.setClearAlpha=function(){ge.setClearAlpha.apply(ge,arguments)},this.clear=function(D=!0,B=!0,W=!0){let X=0;if(D){let G=!1;if(A!==null){const he=A.texture.format;G=he===kl||he===zl||he===Bl}if(G){const he=A.texture.type,Se=he===mn||he===gi||he===Il||he===zi||he===Nl||he===Ol,we=ge.getClearColor(),Pe=ge.getClearAlpha(),Ie=we.r,Le=we.g,Ue=we.b;Se?(f[0]=Ie,f[1]=Le,f[2]=Ue,f[3]=Pe,k.clearBufferuiv(k.COLOR,0,f)):(g[0]=Ie,g[1]=Le,g[2]=Ue,g[3]=Pe,k.clearBufferiv(k.COLOR,0,g))}else X|=k.COLOR_BUFFER_BIT}B&&(X|=k.DEPTH_BUFFER_BIT),W&&(X|=k.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),k.clear(X)},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",V,!1),t.removeEventListener("webglcontextrestored",K,!1),t.removeEventListener("webglcontextcreationerror",se,!1),Ae.dispose(),ae.dispose(),w.dispose(),q.dispose(),Z.dispose(),De.dispose(),Xe.dispose(),Ye.dispose(),re.dispose(),x.dispose(),x.removeEventListener("sessionstart",it),x.removeEventListener("sessionend",rt),Dt.stop()};function V(D){D.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),b=!0}function K(){console.log("THREE.WebGLRenderer: Context Restored."),b=!1;const D=We.autoReset,B=Re.enabled,W=Re.autoUpdate,X=Re.needsUpdate,G=Re.type;Me(),We.autoReset=D,Re.enabled=B,Re.autoUpdate=W,Re.needsUpdate=X,Re.type=G}function se(D){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",D.statusMessage)}function pe(D){const B=D.target;B.removeEventListener("dispose",pe),Ve(B)}function Ve(D){ze(D),w.remove(D)}function ze(D){const B=w.get(D).programs;B!==void 0&&(B.forEach(function(W){re.releaseProgram(W)}),D.isShaderMaterial&&re.releaseShaderCache(D))}this.renderBufferDirect=function(D,B,W,X,G,he){B===null&&(B=Te);const Se=G.isMesh&&G.matrixWorld.determinant()<0,we=Ac(D,B,W,X,G);Ee.setMaterial(X,Se);let Pe=W.index,Ie=1;if(X.wireframe===!0){if(Pe=ie.getWireframeAttribute(W),Pe===void 0)return;Ie=2}const Le=W.drawRange,Ue=W.attributes.position;let tt=Le.start*Ie,At=(Le.start+Le.count)*Ie;he!==null&&(tt=Math.max(tt,he.start*Ie),At=Math.min(At,(he.start+he.count)*Ie)),Pe!==null?(tt=Math.max(tt,0),At=Math.min(At,Pe.count)):Ue!=null&&(tt=Math.max(tt,0),At=Math.min(At,Ue.count));const ct=At-tt;if(ct<0||ct===1/0)return;Xe.setup(G,X,we,W,Pe);let qt,Qe=ke;if(Pe!==null&&(qt=te.get(Pe),Qe=He,Qe.setIndex(qt)),G.isMesh)X.wireframe===!0?(Ee.setLineWidth(X.wireframeLinewidth*Ce()),Qe.setMode(k.LINES)):Qe.setMode(k.TRIANGLES);else if(G.isLine){let Ne=X.linewidth;Ne===void 0&&(Ne=1),Ee.setLineWidth(Ne*Ce()),G.isLineSegments?Qe.setMode(k.LINES):G.isLineLoop?Qe.setMode(k.LINE_LOOP):Qe.setMode(k.LINE_STRIP)}else G.isPoints?Qe.setMode(k.POINTS):G.isSprite&&Qe.setMode(k.TRIANGLES);if(G.isBatchedMesh)Qe.renderMultiDraw(G._multiDrawStarts,G._multiDrawCounts,G._multiDrawCount);else if(G.isInstancedMesh)Qe.renderInstances(tt,ct,G.count);else if(W.isInstancedBufferGeometry){const Ne=W._maxInstanceCount!==void 0?W._maxInstanceCount:1/0,Vr=Math.min(W.instanceCount,Ne);Qe.renderInstances(tt,ct,Vr)}else Qe.render(tt,ct)};function Ze(D,B,W){D.transparent===!0&&D.side===Wt&&D.forceSinglePass===!1?(D.side=St,D.needsUpdate=!0,Xi(D,B,W),D.side=_n,D.needsUpdate=!0,Xi(D,B,W),D.side=Wt):Xi(D,B,W)}this.compile=function(D,B,W=null){W===null&&(W=D),m=ae.get(W),m.init(),E.push(m),W.traverseVisible(function(G){G.isLight&&G.layers.test(B.layers)&&(m.pushLight(G),G.castShadow&&m.pushShadow(G))}),D!==W&&D.traverseVisible(function(G){G.isLight&&G.layers.test(B.layers)&&(m.pushLight(G),G.castShadow&&m.pushShadow(G))}),m.setupLights(v._useLegacyLights);const X=new Set;return D.traverse(function(G){const he=G.material;if(he)if(Array.isArray(he))for(let Se=0;Se<he.length;Se++){const we=he[Se];Ze(we,W,G),X.add(we)}else Ze(he,W,G),X.add(he)}),E.pop(),m=null,X},this.compileAsync=function(D,B,W=null){const X=this.compile(D,B,W);return new Promise(G=>{function he(){if(X.forEach(function(Se){w.get(Se).currentProgram.isReady()&&X.delete(Se)}),X.size===0){G(D);return}setTimeout(he,10)}xe.get("KHR_parallel_shader_compile")!==null?he():setTimeout(he,10)})};let lt=null;function $e(D){lt&&lt(D)}function it(){Dt.stop()}function rt(){Dt.start()}const Dt=new nc;Dt.setAnimationLoop($e),typeof self<"u"&&Dt.setContext(self),this.setAnimationLoop=function(D){lt=D,x.setAnimationLoop(D),D===null?Dt.stop():Dt.start()},x.addEventListener("sessionstart",it),x.addEventListener("sessionend",rt),this.render=function(D,B){if(B!==void 0&&B.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(b===!0)return;D.matrixWorldAutoUpdate===!0&&D.updateMatrixWorld(),B.parent===null&&B.matrixWorldAutoUpdate===!0&&B.updateMatrixWorld(),x.enabled===!0&&x.isPresenting===!0&&(x.cameraAutoUpdate===!0&&x.updateCamera(B),B=x.getCamera()),D.isScene===!0&&D.onBeforeRender(v,D,B,A),m=ae.get(D,E.length),m.init(),E.push(m),ce.multiplyMatrices(B.projectionMatrix,B.matrixWorldInverse),me.setFromProjectionMatrix(ce),Q=this.localClippingEnabled,O=fe.init(this.clippingPlanes,Q),_=Ae.get(D,p.length),_.init(),p.push(_),Pt(D,B,0,v.sortObjects),_.finish(),v.sortObjects===!0&&_.sort(z,j),this.info.render.frame++,O===!0&&fe.beginShadows();const W=m.state.shadowsArray;if(Re.render(W,D,B),O===!0&&fe.endShadows(),this.info.autoReset===!0&&this.info.reset(),(x.enabled===!1||x.isPresenting===!1||x.hasDepthSensing()===!1)&&ge.render(_,D),m.setupLights(v._useLegacyLights),B.isArrayCamera){const X=B.cameras;for(let G=0,he=X.length;G<he;G++){const Se=X[G];nn(_,D,Se,Se.viewport)}}else nn(_,D,B);A!==null&&(S.updateMultisampleRenderTarget(A),S.updateRenderTargetMipmap(A)),D.isScene===!0&&D.onAfterRender(v,D,B),Xe.resetDefaultState(),P=-1,y=null,E.pop(),E.length>0?m=E[E.length-1]:m=null,p.pop(),p.length>0?_=p[p.length-1]:_=null};function Pt(D,B,W,X){if(D.visible===!1)return;if(D.layers.test(B.layers)){if(D.isGroup)W=D.renderOrder;else if(D.isLOD)D.autoUpdate===!0&&D.update(B);else if(D.isLight)m.pushLight(D),D.castShadow&&m.pushShadow(D);else if(D.isSprite){if(!D.frustumCulled||me.intersectsSprite(D)){X&&ve.setFromMatrixPosition(D.matrixWorld).applyMatrix4(ce);const Se=De.update(D),we=D.material;we.visible&&_.push(D,Se,we,W,ve.z,null)}}else if((D.isMesh||D.isLine||D.isPoints)&&(!D.frustumCulled||me.intersectsObject(D))){const Se=De.update(D),we=D.material;if(X&&(D.boundingSphere!==void 0?(D.boundingSphere===null&&D.computeBoundingSphere(),ve.copy(D.boundingSphere.center)):(Se.boundingSphere===null&&Se.computeBoundingSphere(),ve.copy(Se.boundingSphere.center)),ve.applyMatrix4(D.matrixWorld).applyMatrix4(ce)),Array.isArray(we)){const Pe=Se.groups;for(let Ie=0,Le=Pe.length;Ie<Le;Ie++){const Ue=Pe[Ie],tt=we[Ue.materialIndex];tt&&tt.visible&&_.push(D,Se,tt,W,ve.z,Ue)}}else we.visible&&_.push(D,Se,we,W,ve.z,null)}}const he=D.children;for(let Se=0,we=he.length;Se<we;Se++)Pt(he[Se],B,W,X)}function nn(D,B,W,X){const G=D.opaque,he=D.transmissive,Se=D.transparent;m.setupLightsView(W),O===!0&&fe.setGlobalState(v.clippingPlanes,W),he.length>0&&On(G,he,B,W),X&&Ee.viewport(M.copy(X)),G.length>0&&vn(G,B,W),he.length>0&&vn(he,B,W),Se.length>0&&vn(Se,B,W),Ee.buffers.depth.setTest(!0),Ee.buffers.depth.setMask(!0),Ee.buffers.color.setMask(!0),Ee.setPolygonOffset(!1)}function On(D,B,W,X){if((W.isScene===!0?W.overrideMaterial:null)!==null)return;if(m.state.transmissionRenderTarget===null){m.state.transmissionRenderTarget=new Ht(1,1,{generateMipmaps:!0,type:xe.has("EXT_color_buffer_half_float")||xe.has("EXT_color_buffer_float")?gn:mn,minFilter:Ln,samples:4,stencilBuffer:s});const Ie=w.get(m.state.transmissionRenderTarget);Ie.__isTransmissionRenderTarget=!0}const he=m.state.transmissionRenderTarget;v.getDrawingBufferSize(ne),he.setSize(ne.x,ne.y);const Se=v.getRenderTarget();v.setRenderTarget(he),v.getClearColor(C),U=v.getClearAlpha(),U<1&&v.setClearColor(16777215,.5),v.clear();const we=v.toneMapping;v.toneMapping=pn,vn(D,W,X),S.updateMultisampleRenderTarget(he),S.updateRenderTargetMipmap(he);let Pe=!1;for(let Ie=0,Le=B.length;Ie<Le;Ie++){const Ue=B[Ie],tt=Ue.object,At=Ue.geometry,ct=Ue.material,qt=Ue.group;if(ct.side===Wt&&tt.layers.test(X.layers)){const Qe=ct.side;ct.side=St,ct.needsUpdate=!0,oa(tt,W,X,At,ct,qt),ct.side=Qe,ct.needsUpdate=!0,Pe=!0}}Pe===!0&&(S.updateMultisampleRenderTarget(he),S.updateRenderTargetMipmap(he)),v.setRenderTarget(Se),v.setClearColor(C,U),v.toneMapping=we}function vn(D,B,W){const X=B.isScene===!0?B.overrideMaterial:null;for(let G=0,he=D.length;G<he;G++){const Se=D[G],we=Se.object,Pe=Se.geometry,Ie=X===null?Se.material:X,Le=Se.group;we.layers.test(W.layers)&&oa(we,B,W,Pe,Ie,Le)}}function oa(D,B,W,X,G,he){D.onBeforeRender(v,B,W,X,G,he),D.modelViewMatrix.multiplyMatrices(W.matrixWorldInverse,D.matrixWorld),D.normalMatrix.getNormalMatrix(D.modelViewMatrix),G.onBeforeRender(v,B,W,X,D,he),G.transparent===!0&&G.side===Wt&&G.forceSinglePass===!1?(G.side=St,G.needsUpdate=!0,v.renderBufferDirect(W,B,X,G,D,he),G.side=_n,G.needsUpdate=!0,v.renderBufferDirect(W,B,X,G,D,he),G.side=Wt):v.renderBufferDirect(W,B,X,G,D,he),D.onAfterRender(v,B,W,X,G,he)}function Xi(D,B,W){B.isScene!==!0&&(B=Te);const X=w.get(D),G=m.state.lights,he=m.state.shadowsArray,Se=G.state.version,we=re.getParameters(D,G.state,he,B,W),Pe=re.getProgramCacheKey(we);let Ie=X.programs;X.environment=D.isMeshStandardMaterial?B.environment:null,X.fog=B.fog,X.envMap=(D.isMeshStandardMaterial?Z:q).get(D.envMap||X.environment),X.envMapRotation=X.environment!==null&&D.envMap===null?B.environmentRotation:D.envMapRotation,Ie===void 0&&(D.addEventListener("dispose",pe),Ie=new Map,X.programs=Ie);let Le=Ie.get(Pe);if(Le!==void 0){if(X.currentProgram===Le&&X.lightsStateVersion===Se)return ca(D,we),Le}else we.uniforms=re.getUniforms(D),D.onBuild(W,we,v),D.onBeforeCompile(we,v),Le=re.acquireProgram(we,Pe),Ie.set(Pe,Le),X.uniforms=we.uniforms;const Ue=X.uniforms;return(!D.isShaderMaterial&&!D.isRawShaderMaterial||D.clipping===!0)&&(Ue.clippingPlanes=fe.uniform),ca(D,we),X.needsLights=Cc(D),X.lightsStateVersion=Se,X.needsLights&&(Ue.ambientLightColor.value=G.state.ambient,Ue.lightProbe.value=G.state.probe,Ue.directionalLights.value=G.state.directional,Ue.directionalLightShadows.value=G.state.directionalShadow,Ue.spotLights.value=G.state.spot,Ue.spotLightShadows.value=G.state.spotShadow,Ue.rectAreaLights.value=G.state.rectArea,Ue.ltc_1.value=G.state.rectAreaLTC1,Ue.ltc_2.value=G.state.rectAreaLTC2,Ue.pointLights.value=G.state.point,Ue.pointLightShadows.value=G.state.pointShadow,Ue.hemisphereLights.value=G.state.hemi,Ue.directionalShadowMap.value=G.state.directionalShadowMap,Ue.directionalShadowMatrix.value=G.state.directionalShadowMatrix,Ue.spotShadowMap.value=G.state.spotShadowMap,Ue.spotLightMatrix.value=G.state.spotLightMatrix,Ue.spotLightMap.value=G.state.spotLightMap,Ue.pointShadowMap.value=G.state.pointShadowMap,Ue.pointShadowMatrix.value=G.state.pointShadowMatrix),X.currentProgram=Le,X.uniformsList=null,Le}function la(D){if(D.uniformsList===null){const B=D.currentProgram.getUniforms();D.uniformsList=Tr.seqWithValue(B.seq,D.uniforms)}return D.uniformsList}function ca(D,B){const W=w.get(D);W.outputColorSpace=B.outputColorSpace,W.batching=B.batching,W.instancing=B.instancing,W.instancingColor=B.instancingColor,W.instancingMorph=B.instancingMorph,W.skinning=B.skinning,W.morphTargets=B.morphTargets,W.morphNormals=B.morphNormals,W.morphColors=B.morphColors,W.morphTargetsCount=B.morphTargetsCount,W.numClippingPlanes=B.numClippingPlanes,W.numIntersection=B.numClipIntersection,W.vertexAlphas=B.vertexAlphas,W.vertexTangents=B.vertexTangents,W.toneMapping=B.toneMapping}function Ac(D,B,W,X,G){B.isScene!==!0&&(B=Te),S.resetTextureUnits();const he=B.fog,Se=X.isMeshStandardMaterial?B.environment:null,we=A===null?v.outputColorSpace:A.isXRRenderTarget===!0?A.texture.colorSpace:xn,Pe=(X.isMeshStandardMaterial?Z:q).get(X.envMap||Se),Ie=X.vertexColors===!0&&!!W.attributes.color&&W.attributes.color.itemSize===4,Le=!!W.attributes.tangent&&(!!X.normalMap||X.anisotropy>0),Ue=!!W.morphAttributes.position,tt=!!W.morphAttributes.normal,At=!!W.morphAttributes.color;let ct=pn;X.toneMapped&&(A===null||A.isXRRenderTarget===!0)&&(ct=v.toneMapping);const qt=W.morphAttributes.position||W.morphAttributes.normal||W.morphAttributes.color,Qe=qt!==void 0?qt.length:0,Ne=w.get(X),Vr=m.state.lights;if(O===!0&&(Q===!0||D!==y)){const Lt=D===y&&X.id===P;fe.setState(X,D,Lt)}let Je=!1;X.version===Ne.__version?(Ne.needsLights&&Ne.lightsStateVersion!==Vr.state.version||Ne.outputColorSpace!==we||G.isBatchedMesh&&Ne.batching===!1||!G.isBatchedMesh&&Ne.batching===!0||G.isInstancedMesh&&Ne.instancing===!1||!G.isInstancedMesh&&Ne.instancing===!0||G.isSkinnedMesh&&Ne.skinning===!1||!G.isSkinnedMesh&&Ne.skinning===!0||G.isInstancedMesh&&Ne.instancingColor===!0&&G.instanceColor===null||G.isInstancedMesh&&Ne.instancingColor===!1&&G.instanceColor!==null||G.isInstancedMesh&&Ne.instancingMorph===!0&&G.morphTexture===null||G.isInstancedMesh&&Ne.instancingMorph===!1&&G.morphTexture!==null||Ne.envMap!==Pe||X.fog===!0&&Ne.fog!==he||Ne.numClippingPlanes!==void 0&&(Ne.numClippingPlanes!==fe.numPlanes||Ne.numIntersection!==fe.numIntersection)||Ne.vertexAlphas!==Ie||Ne.vertexTangents!==Le||Ne.morphTargets!==Ue||Ne.morphNormals!==tt||Ne.morphColors!==At||Ne.toneMapping!==ct||Ne.morphTargetsCount!==Qe)&&(Je=!0):(Je=!0,Ne.__version=X.version);let Mn=Ne.currentProgram;Je===!0&&(Mn=Xi(X,B,G));let ua=!1,Si=!1,Gr=!1;const pt=Mn.getUniforms(),rn=Ne.uniforms;if(Ee.useProgram(Mn.program)&&(ua=!0,Si=!0,Gr=!0),X.id!==P&&(P=X.id,Si=!0),ua||y!==D){pt.setValue(k,"projectionMatrix",D.projectionMatrix),pt.setValue(k,"viewMatrix",D.matrixWorldInverse);const Lt=pt.map.cameraPosition;Lt!==void 0&&Lt.setValue(k,ve.setFromMatrixPosition(D.matrixWorld)),Ge.logarithmicDepthBuffer&&pt.setValue(k,"logDepthBufFC",2/(Math.log(D.far+1)/Math.LN2)),(X.isMeshPhongMaterial||X.isMeshToonMaterial||X.isMeshLambertMaterial||X.isMeshBasicMaterial||X.isMeshStandardMaterial||X.isShaderMaterial)&&pt.setValue(k,"isOrthographic",D.isOrthographicCamera===!0),y!==D&&(y=D,Si=!0,Gr=!0)}if(G.isSkinnedMesh){pt.setOptional(k,G,"bindMatrix"),pt.setOptional(k,G,"bindMatrixInverse");const Lt=G.skeleton;Lt&&(Lt.boneTexture===null&&Lt.computeBoneTexture(),pt.setValue(k,"boneTexture",Lt.boneTexture,S))}G.isBatchedMesh&&(pt.setOptional(k,G,"batchingTexture"),pt.setValue(k,"batchingTexture",G._matricesTexture,S));const Wr=W.morphAttributes;if((Wr.position!==void 0||Wr.normal!==void 0||Wr.color!==void 0)&&_e.update(G,W,Mn),(Si||Ne.receiveShadow!==G.receiveShadow)&&(Ne.receiveShadow=G.receiveShadow,pt.setValue(k,"receiveShadow",G.receiveShadow)),X.isMeshGouraudMaterial&&X.envMap!==null&&(rn.envMap.value=Pe,rn.flipEnvMap.value=Pe.isCubeTexture&&Pe.isRenderTargetTexture===!1?-1:1),X.isMeshStandardMaterial&&X.envMap===null&&B.environment!==null&&(rn.envMapIntensity.value=B.environmentIntensity),Si&&(pt.setValue(k,"toneMappingExposure",v.toneMappingExposure),Ne.needsLights&&wc(rn,Gr),he&&X.fog===!0&&ye.refreshFogUniforms(rn,he),ye.refreshMaterialUniforms(rn,X,J,Y,m.state.transmissionRenderTarget),Tr.upload(k,la(Ne),rn,S)),X.isShaderMaterial&&X.uniformsNeedUpdate===!0&&(Tr.upload(k,la(Ne),rn,S),X.uniformsNeedUpdate=!1),X.isSpriteMaterial&&pt.setValue(k,"center",G.center),pt.setValue(k,"modelViewMatrix",G.modelViewMatrix),pt.setValue(k,"normalMatrix",G.normalMatrix),pt.setValue(k,"modelMatrix",G.matrixWorld),X.isShaderMaterial||X.isRawShaderMaterial){const Lt=X.uniformsGroups;for(let Xr=0,Rc=Lt.length;Xr<Rc;Xr++){const ha=Lt[Xr];Ye.update(ha,Mn),Ye.bind(ha,Mn)}}return Mn}function wc(D,B){D.ambientLightColor.needsUpdate=B,D.lightProbe.needsUpdate=B,D.directionalLights.needsUpdate=B,D.directionalLightShadows.needsUpdate=B,D.pointLights.needsUpdate=B,D.pointLightShadows.needsUpdate=B,D.spotLights.needsUpdate=B,D.spotLightShadows.needsUpdate=B,D.rectAreaLights.needsUpdate=B,D.hemisphereLights.needsUpdate=B}function Cc(D){return D.isMeshLambertMaterial||D.isMeshToonMaterial||D.isMeshPhongMaterial||D.isMeshStandardMaterial||D.isShadowMaterial||D.isShaderMaterial&&D.lights===!0}this.getActiveCubeFace=function(){return R},this.getActiveMipmapLevel=function(){return T},this.getRenderTarget=function(){return A},this.setRenderTargetTextures=function(D,B,W){w.get(D.texture).__webglTexture=B,w.get(D.depthTexture).__webglTexture=W;const X=w.get(D);X.__hasExternalTextures=!0,X.__autoAllocateDepthBuffer=W===void 0,X.__autoAllocateDepthBuffer||xe.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),X.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(D,B){const W=w.get(D);W.__webglFramebuffer=B,W.__useDefaultFramebuffer=B===void 0},this.setRenderTarget=function(D,B=0,W=0){A=D,R=B,T=W;let X=!0,G=null,he=!1,Se=!1;if(D){const Pe=w.get(D);Pe.__useDefaultFramebuffer!==void 0?(Ee.bindFramebuffer(k.FRAMEBUFFER,null),X=!1):Pe.__webglFramebuffer===void 0?S.setupRenderTarget(D):Pe.__hasExternalTextures&&S.rebindTextures(D,w.get(D.texture).__webglTexture,w.get(D.depthTexture).__webglTexture);const Ie=D.texture;(Ie.isData3DTexture||Ie.isDataArrayTexture||Ie.isCompressedArrayTexture)&&(Se=!0);const Le=w.get(D).__webglFramebuffer;D.isWebGLCubeRenderTarget?(Array.isArray(Le[B])?G=Le[B][W]:G=Le[B],he=!0):D.samples>0&&S.useMultisampledRTT(D)===!1?G=w.get(D).__webglMultisampledFramebuffer:Array.isArray(Le)?G=Le[W]:G=Le,M.copy(D.viewport),F.copy(D.scissor),L=D.scissorTest}else M.copy($).multiplyScalar(J).floor(),F.copy(N).multiplyScalar(J).floor(),L=ee;if(Ee.bindFramebuffer(k.FRAMEBUFFER,G)&&X&&Ee.drawBuffers(D,G),Ee.viewport(M),Ee.scissor(F),Ee.setScissorTest(L),he){const Pe=w.get(D.texture);k.framebufferTexture2D(k.FRAMEBUFFER,k.COLOR_ATTACHMENT0,k.TEXTURE_CUBE_MAP_POSITIVE_X+B,Pe.__webglTexture,W)}else if(Se){const Pe=w.get(D.texture),Ie=B||0;k.framebufferTextureLayer(k.FRAMEBUFFER,k.COLOR_ATTACHMENT0,Pe.__webglTexture,W||0,Ie)}P=-1},this.readRenderTargetPixels=function(D,B,W,X,G,he,Se){if(!(D&&D.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let we=w.get(D).__webglFramebuffer;if(D.isWebGLCubeRenderTarget&&Se!==void 0&&(we=we[Se]),we){Ee.bindFramebuffer(k.FRAMEBUFFER,we);try{const Pe=D.texture,Ie=Pe.format,Le=Pe.type;if(Ie!==Xt&&qe.convert(Ie)!==k.getParameter(k.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const Ue=Le===gn&&(xe.has("EXT_color_buffer_half_float")||xe.has("EXT_color_buffer_float"));if(Le!==mn&&qe.convert(Le)!==k.getParameter(k.IMPLEMENTATION_COLOR_READ_TYPE)&&Le!==fn&&!Ue){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}B>=0&&B<=D.width-X&&W>=0&&W<=D.height-G&&k.readPixels(B,W,X,G,qe.convert(Ie),qe.convert(Le),he)}finally{const Pe=A!==null?w.get(A).__webglFramebuffer:null;Ee.bindFramebuffer(k.FRAMEBUFFER,Pe)}}},this.copyFramebufferToTexture=function(D,B,W=0){const X=Math.pow(2,-W),G=Math.floor(B.image.width*X),he=Math.floor(B.image.height*X);S.setTexture2D(B,0),k.copyTexSubImage2D(k.TEXTURE_2D,W,0,0,D.x,D.y,G,he),Ee.unbindTexture()},this.copyTextureToTexture=function(D,B,W,X=0){const G=B.image.width,he=B.image.height,Se=qe.convert(W.format),we=qe.convert(W.type);S.setTexture2D(W,0),k.pixelStorei(k.UNPACK_FLIP_Y_WEBGL,W.flipY),k.pixelStorei(k.UNPACK_PREMULTIPLY_ALPHA_WEBGL,W.premultiplyAlpha),k.pixelStorei(k.UNPACK_ALIGNMENT,W.unpackAlignment),B.isDataTexture?k.texSubImage2D(k.TEXTURE_2D,X,D.x,D.y,G,he,Se,we,B.image.data):B.isCompressedTexture?k.compressedTexSubImage2D(k.TEXTURE_2D,X,D.x,D.y,B.mipmaps[0].width,B.mipmaps[0].height,Se,B.mipmaps[0].data):k.texSubImage2D(k.TEXTURE_2D,X,D.x,D.y,Se,we,B.image),X===0&&W.generateMipmaps&&k.generateMipmap(k.TEXTURE_2D),Ee.unbindTexture()},this.copyTextureToTexture3D=function(D,B,W,X,G=0){const he=Math.round(D.max.x-D.min.x),Se=Math.round(D.max.y-D.min.y),we=D.max.z-D.min.z+1,Pe=qe.convert(X.format),Ie=qe.convert(X.type);let Le;if(X.isData3DTexture)S.setTexture3D(X,0),Le=k.TEXTURE_3D;else if(X.isDataArrayTexture||X.isCompressedArrayTexture)S.setTexture2DArray(X,0),Le=k.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}k.pixelStorei(k.UNPACK_FLIP_Y_WEBGL,X.flipY),k.pixelStorei(k.UNPACK_PREMULTIPLY_ALPHA_WEBGL,X.premultiplyAlpha),k.pixelStorei(k.UNPACK_ALIGNMENT,X.unpackAlignment);const Ue=k.getParameter(k.UNPACK_ROW_LENGTH),tt=k.getParameter(k.UNPACK_IMAGE_HEIGHT),At=k.getParameter(k.UNPACK_SKIP_PIXELS),ct=k.getParameter(k.UNPACK_SKIP_ROWS),qt=k.getParameter(k.UNPACK_SKIP_IMAGES),Qe=W.isCompressedTexture?W.mipmaps[G]:W.image;k.pixelStorei(k.UNPACK_ROW_LENGTH,Qe.width),k.pixelStorei(k.UNPACK_IMAGE_HEIGHT,Qe.height),k.pixelStorei(k.UNPACK_SKIP_PIXELS,D.min.x),k.pixelStorei(k.UNPACK_SKIP_ROWS,D.min.y),k.pixelStorei(k.UNPACK_SKIP_IMAGES,D.min.z),W.isDataTexture||W.isData3DTexture?k.texSubImage3D(Le,G,B.x,B.y,B.z,he,Se,we,Pe,Ie,Qe.data):X.isCompressedArrayTexture?k.compressedTexSubImage3D(Le,G,B.x,B.y,B.z,he,Se,we,Pe,Qe.data):k.texSubImage3D(Le,G,B.x,B.y,B.z,he,Se,we,Pe,Ie,Qe),k.pixelStorei(k.UNPACK_ROW_LENGTH,Ue),k.pixelStorei(k.UNPACK_IMAGE_HEIGHT,tt),k.pixelStorei(k.UNPACK_SKIP_PIXELS,At),k.pixelStorei(k.UNPACK_SKIP_ROWS,ct),k.pixelStorei(k.UNPACK_SKIP_IMAGES,qt),G===0&&X.generateMipmaps&&k.generateMipmap(Le),Ee.unbindTexture()},this.initTexture=function(D){D.isCubeTexture?S.setTextureCube(D,0):D.isData3DTexture?S.setTexture3D(D,0):D.isDataArrayTexture||D.isCompressedArrayTexture?S.setTexture2DArray(D,0):S.setTexture2D(D,0),Ee.unbindTexture()},this.resetState=function(){R=0,T=0,A=null,Ee.reset(),Xe.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Qt}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=e===ea?"display-p3":"srgb",t.unpackColorSpace=je.workingColorSpace===Or?"display-p3":"srgb"}get useLegacyLights(){return console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights}set useLegacyLights(e){console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights=e}}class Hr{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new be(e),this.density=t}clone(){return new Hr(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class hc extends yt{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new In,this.environmentIntensity=1,this.environmentRotation=new In,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}class qs extends vi{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new be(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}const Yo=new I,$o=new I,jo=new et,bs=new Br,gr=new Hi;class dc extends yt{constructor(e=new _t,t=new qs){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=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[0];for(let r=1,s=t.count;r<s;r++)Yo.fromBufferAttribute(t,r-1),$o.fromBufferAttribute(t,r),n[r]=n[r-1],n[r]+=Yo.distanceTo($o);e.setAttribute("lineDistance",new nt(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const n=this.geometry,r=this.matrixWorld,s=e.params.Line.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),gr.copy(n.boundingSphere),gr.applyMatrix4(r),gr.radius+=s,e.ray.intersectsSphere(gr)===!1)return;jo.copy(r).invert(),bs.copy(e.ray).applyMatrix4(jo);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=new I,u=new I,d=new I,h=new I,f=this.isLineSegments?2:1,g=n.index,m=n.attributes.position;if(g!==null){const p=Math.max(0,a.start),E=Math.min(g.count,a.start+a.count);for(let v=p,b=E-1;v<b;v+=f){const R=g.getX(v),T=g.getX(v+1);if(c.fromBufferAttribute(m,R),u.fromBufferAttribute(m,T),bs.distanceSqToSegment(c,u,h,d)>l)continue;h.applyMatrix4(this.matrixWorld);const P=e.ray.origin.distanceTo(h);P<e.near||P>e.far||t.push({distance:P,point:d.clone().applyMatrix4(this.matrixWorld),index:v,face:null,faceIndex:null,object:this})}}else{const p=Math.max(0,a.start),E=Math.min(m.count,a.start+a.count);for(let v=p,b=E-1;v<b;v+=f){if(c.fromBufferAttribute(m,v),u.fromBufferAttribute(m,v+1),bs.distanceSqToSegment(c,u,h,d)>l)continue;h.applyMatrix4(this.matrixWorld);const T=e.ray.origin.distanceTo(h);T<e.near||T>e.far||t.push({distance:T,point:d.clone().applyMatrix4(this.matrixWorld),index:v,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){const o=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}}const Ko=new I,Zo=new I;class F0 extends dc{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[];for(let r=0,s=t.count;r<s;r+=2)Ko.fromBufferAttribute(t,r),Zo.fromBufferAttribute(t,r+1),n[r]=r===0?0:n[r-1],n[r+1]=n[r]+Ko.distanceTo(Zo);e.setAttribute("lineDistance",new nt(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class I0 extends vi{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new be(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}const Jo=new et,Ys=new Br,_r=new Hi,xr=new I;class U0 extends yt{constructor(e=new _t,t=new I0){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){const n=this.geometry,r=this.matrixWorld,s=e.params.Points.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),_r.copy(n.boundingSphere),_r.applyMatrix4(r),_r.radius+=s,e.ray.intersectsSphere(_r)===!1)return;Jo.copy(r).invert(),Ys.copy(e.ray).applyMatrix4(Jo);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=n.index,d=n.attributes.position;if(c!==null){const h=Math.max(0,a.start),f=Math.min(c.count,a.start+a.count);for(let g=h,_=f;g<_;g++){const m=c.getX(g);xr.fromBufferAttribute(d,m),Qo(xr,m,l,r,e,t,this)}}else{const h=Math.max(0,a.start),f=Math.min(d.count,a.start+a.count);for(let g=h,_=f;g<_;g++)xr.fromBufferAttribute(d,g),Qo(xr,g,l,r,e,t,this)}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){const o=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}}function Qo(i,e,t,n,r,s,a){const o=Ys.distanceSqToPoint(i);if(o<t){const l=new I;Ys.closestPointToPoint(i,l),l.applyMatrix4(n);const c=r.ray.origin.distanceTo(l);if(c<r.near||c>r.far)return;s.push({distance:c,distanceToRay:Math.sqrt(o),point:l,index:e,face:null,object:a})}}class tn{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){const n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){const 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;const t=[];let n,r=this.getPoint(0),s=0;t.push(0);for(let a=1;a<=e;a++)n=this.getPoint(a/e),s+=n.distanceTo(r),t.push(s),r=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){const n=this.getLengths();let r=0;const s=n.length;let a;t?a=t:a=e*n[s-1];let o=0,l=s-1,c;for(;o<=l;)if(r=Math.floor(o+(l-o)/2),c=n[r]-a,c<0)o=r+1;else if(c>0)l=r-1;else{l=r;break}if(r=l,n[r]===a)return r/(s-1);const u=n[r],h=n[r+1]-u,f=(a-u)/h;return(r+f)/(s-1)}getTangent(e,t){let r=e-1e-4,s=e+1e-4;r<0&&(r=0),s>1&&(s=1);const a=this.getPoint(r),o=this.getPoint(s),l=t||(a.isVector2?new ue:new I);return l.copy(o).sub(a).normalize(),l}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t){const n=new I,r=[],s=[],a=[],o=new I,l=new et;for(let f=0;f<=e;f++){const g=f/e;r[f]=this.getTangentAt(g,new I)}s[0]=new I,a[0]=new I;let c=Number.MAX_VALUE;const u=Math.abs(r[0].x),d=Math.abs(r[0].y),h=Math.abs(r[0].z);u<=c&&(c=u,n.set(1,0,0)),d<=c&&(c=d,n.set(0,1,0)),h<=c&&n.set(0,0,1),o.crossVectors(r[0],n).normalize(),s[0].crossVectors(r[0],o),a[0].crossVectors(r[0],s[0]);for(let f=1;f<=e;f++){if(s[f]=s[f-1].clone(),a[f]=a[f-1].clone(),o.crossVectors(r[f-1],r[f]),o.length()>Number.EPSILON){o.normalize();const g=Math.acos(ht(r[f-1].dot(r[f]),-1,1));s[f].applyMatrix4(l.makeRotationAxis(o,g))}a[f].crossVectors(r[f],s[f])}if(t===!0){let f=Math.acos(ht(s[0].dot(s[e]),-1,1));f/=e,r[0].dot(o.crossVectors(s[0],s[e]))>0&&(f=-f);for(let g=1;g<=e;g++)s[g].applyMatrix4(l.makeRotationAxis(r[g],f*g)),a[g].crossVectors(r[g],s[g])}return{tangents:r,normals:s,binormals:a}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class fc extends tn{constructor(e=0,t=0,n=1,r=1,s=0,a=Math.PI*2,o=!1,l=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=r,this.aStartAngle=s,this.aEndAngle=a,this.aClockwise=o,this.aRotation=l}getPoint(e,t=new ue){const n=t,r=Math.PI*2;let s=this.aEndAngle-this.aStartAngle;const a=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=r;for(;s>r;)s-=r;s<Number.EPSILON&&(a?s=0:s=r),this.aClockwise===!0&&!a&&(s===r?s=-r:s=s-r);const o=this.aStartAngle+e*s;let l=this.aX+this.xRadius*Math.cos(o),c=this.aY+this.yRadius*Math.sin(o);if(this.aRotation!==0){const u=Math.cos(this.aRotation),d=Math.sin(this.aRotation),h=l-this.aX,f=c-this.aY;l=h*u-f*d+this.aX,c=h*d+f*u+this.aY}return n.set(l,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(){const 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}}class N0 extends fc{constructor(e,t,n,r,s,a){super(e,t,n,n,r,s,a),this.isArcCurve=!0,this.type="ArcCurve"}}function ia(){let i=0,e=0,t=0,n=0;function r(s,a,o,l){i=s,e=o,t=-3*s+3*a-2*o-l,n=2*s-2*a+o+l}return{initCatmullRom:function(s,a,o,l,c){r(a,o,c*(o-s),c*(l-a))},initNonuniformCatmullRom:function(s,a,o,l,c,u,d){let h=(a-s)/c-(o-s)/(c+u)+(o-a)/u,f=(o-a)/u-(l-a)/(u+d)+(l-o)/d;h*=u,f*=u,r(a,o,h,f)},calc:function(s){const a=s*s,o=a*s;return i+e*s+t*a+n*o}}}const vr=new I,Ts=new ia,Ds=new ia,As=new ia;class pc extends tn{constructor(e=[],t=!1,n="centripetal",r=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=n,this.tension=r}getPoint(e,t=new I){const n=t,r=this.points,s=r.length,a=(s-(this.closed?0:1))*e;let o=Math.floor(a),l=a-o;this.closed?o+=o>0?0:(Math.floor(Math.abs(o)/s)+1)*s:l===0&&o===s-1&&(o=s-2,l=1);let c,u;this.closed||o>0?c=r[(o-1)%s]:(vr.subVectors(r[0],r[1]).add(r[0]),c=vr);const d=r[o%s],h=r[(o+1)%s];if(this.closed||o+2<s?u=r[(o+2)%s]:(vr.subVectors(r[s-1],r[s-2]).add(r[s-1]),u=vr),this.curveType==="centripetal"||this.curveType==="chordal"){const f=this.curveType==="chordal"?.5:.25;let g=Math.pow(c.distanceToSquared(d),f),_=Math.pow(d.distanceToSquared(h),f),m=Math.pow(h.distanceToSquared(u),f);_<1e-4&&(_=1),g<1e-4&&(g=_),m<1e-4&&(m=_),Ts.initNonuniformCatmullRom(c.x,d.x,h.x,u.x,g,_,m),Ds.initNonuniformCatmullRom(c.y,d.y,h.y,u.y,g,_,m),As.initNonuniformCatmullRom(c.z,d.z,h.z,u.z,g,_,m)}else this.curveType==="catmullrom"&&(Ts.initCatmullRom(c.x,d.x,h.x,u.x,this.tension),Ds.initCatmullRom(c.y,d.y,h.y,u.y,this.tension),As.initCatmullRom(c.z,d.z,h.z,u.z,this.tension));return n.set(Ts.calc(l),Ds.calc(l),As.calc(l)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const r=e.points[t];this.points.push(r.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const r=this.points[t];e.points.push(r.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const r=e.points[t];this.points.push(new I().fromArray(r))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}function el(i,e,t,n,r){const s=(n-e)*.5,a=(r-t)*.5,o=i*i,l=i*o;return(2*t-2*n+s+a)*l+(-3*t+3*n-2*s-a)*o+s*i+t}function O0(i,e){const t=1-i;return t*t*e}function B0(i,e){return 2*(1-i)*i*e}function z0(i,e){return i*i*e}function Li(i,e,t,n){return O0(i,e)+B0(i,t)+z0(i,n)}function k0(i,e){const t=1-i;return t*t*t*e}function H0(i,e){const t=1-i;return 3*t*t*i*e}function V0(i,e){return 3*(1-i)*i*i*e}function G0(i,e){return i*i*i*e}function Fi(i,e,t,n,r){return k0(i,e)+H0(i,t)+V0(i,n)+G0(i,r)}class W0 extends tn{constructor(e=new ue,t=new ue,n=new ue,r=new ue){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=n,this.v3=r}getPoint(e,t=new ue){const n=t,r=this.v0,s=this.v1,a=this.v2,o=this.v3;return n.set(Fi(e,r.x,s.x,a.x,o.x),Fi(e,r.y,s.y,a.y,o.y)),n}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(){const 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}}class X0 extends tn{constructor(e=new I,t=new I,n=new I,r=new I){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=n,this.v3=r}getPoint(e,t=new I){const n=t,r=this.v0,s=this.v1,a=this.v2,o=this.v3;return n.set(Fi(e,r.x,s.x,a.x,o.x),Fi(e,r.y,s.y,a.y,o.y),Fi(e,r.z,s.z,a.z,o.z)),n}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(){const 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}}class q0 extends tn{constructor(e=new ue,t=new ue){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new ue){const n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new ue){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const 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}}class Y0 extends tn{constructor(e=new I,t=new I){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new I){const n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new I){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const 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}}class $0 extends tn{constructor(e=new ue,t=new ue,n=new ue){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new ue){const n=t,r=this.v0,s=this.v1,a=this.v2;return n.set(Li(e,r.x,s.x,a.x),Li(e,r.y,s.y,a.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const 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}}class mc extends tn{constructor(e=new I,t=new I,n=new I){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new I){const n=t,r=this.v0,s=this.v1,a=this.v2;return n.set(Li(e,r.x,s.x,a.x),Li(e,r.y,s.y,a.y),Li(e,r.z,s.z,a.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const 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}}class j0 extends tn{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new ue){const n=t,r=this.points,s=(r.length-1)*e,a=Math.floor(s),o=s-a,l=r[a===0?a:a-1],c=r[a],u=r[a>r.length-2?r.length-1:a+1],d=r[a>r.length-3?r.length-1:a+2];return n.set(el(o,l.x,c.x,u.x,d.x),el(o,l.y,c.y,u.y,d.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const r=e.points[t];this.points.push(r.clone())}return this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const r=this.points[t];e.points.push(r.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const r=e.points[t];this.points.push(new ue().fromArray(r))}return this}}var K0=Object.freeze({__proto__:null,ArcCurve:N0,CatmullRomCurve3:pc,CubicBezierCurve:W0,CubicBezierCurve3:X0,EllipseCurve:fc,LineCurve:q0,LineCurve3:Y0,QuadraticBezierCurve:$0,QuadraticBezierCurve3:mc,SplineCurve:j0});const Mr=new I,Sr=new I,ws=new I,yr=new Ci;class Z0 extends _t{constructor(e=null,t=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:e,thresholdAngle:t},e!==null){const r=Math.pow(10,4),s=Math.cos(di*t),a=e.getIndex(),o=e.getAttribute("position"),l=a?a.count:o.count,c=[0,0,0],u=["a","b","c"],d=new Array(3),h={},f=[];for(let g=0;g<l;g+=3){a?(c[0]=a.getX(g),c[1]=a.getX(g+1),c[2]=a.getX(g+2)):(c[0]=g,c[1]=g+1,c[2]=g+2);const{a:_,b:m,c:p}=yr;if(_.fromBufferAttribute(o,c[0]),m.fromBufferAttribute(o,c[1]),p.fromBufferAttribute(o,c[2]),yr.getNormal(ws),d[0]=`${Math.round(_.x*r)},${Math.round(_.y*r)},${Math.round(_.z*r)}`,d[1]=`${Math.round(m.x*r)},${Math.round(m.y*r)},${Math.round(m.z*r)}`,d[2]=`${Math.round(p.x*r)},${Math.round(p.y*r)},${Math.round(p.z*r)}`,!(d[0]===d[1]||d[1]===d[2]||d[2]===d[0]))for(let E=0;E<3;E++){const v=(E+1)%3,b=d[E],R=d[v],T=yr[u[E]],A=yr[u[v]],P=`${b}_${R}`,y=`${R}_${b}`;y in h&&h[y]?(ws.dot(h[y].normal)<=s&&(f.push(T.x,T.y,T.z),f.push(A.x,A.y,A.z)),h[y]=null):P in h||(h[P]={index0:c[E],index1:c[v],normal:ws.clone()})}}for(const g in h)if(h[g]){const{index0:_,index1:m}=h[g];Mr.fromBufferAttribute(o,_),Sr.fromBufferAttribute(o,m),f.push(Mr.x,Mr.y,Mr.z),f.push(Sr.x,Sr.y,Sr.z)}this.setAttribute("position",new nt(f,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}class ra extends _t{constructor(e=.5,t=1,n=32,r=1,s=0,a=Math.PI*2){super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:r,thetaStart:s,thetaLength:a},n=Math.max(3,n),r=Math.max(1,r);const o=[],l=[],c=[],u=[];let d=e;const h=(t-e)/r,f=new I,g=new ue;for(let _=0;_<=r;_++){for(let m=0;m<=n;m++){const p=s+m/n*a;f.x=d*Math.cos(p),f.y=d*Math.sin(p),l.push(f.x,f.y,f.z),c.push(0,0,1),g.x=(f.x/t+1)/2,g.y=(f.y/t+1)/2,u.push(g.x,g.y)}d+=h}for(let _=0;_<r;_++){const m=_*(n+1);for(let p=0;p<n;p++){const E=p+m,v=E,b=E+n+1,R=E+n+2,T=E+1;o.push(v,b,T),o.push(b,R,T)}}this.setIndex(o),this.setAttribute("position",new nt(l,3)),this.setAttribute("normal",new nt(c,3)),this.setAttribute("uv",new nt(u,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new ra(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}class Bi extends _t{constructor(e=1,t=32,n=16,r=0,s=Math.PI*2,a=0,o=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:r,phiLength:s,thetaStart:a,thetaLength:o},t=Math.max(3,Math.floor(t)),n=Math.max(2,Math.floor(n));const l=Math.min(a+o,Math.PI);let c=0;const u=[],d=new I,h=new I,f=[],g=[],_=[],m=[];for(let p=0;p<=n;p++){const E=[],v=p/n;let b=0;p===0&&a===0?b=.5/t:p===n&&l===Math.PI&&(b=-.5/t);for(let R=0;R<=t;R++){const T=R/t;d.x=-e*Math.cos(r+T*s)*Math.sin(a+v*o),d.y=e*Math.cos(a+v*o),d.z=e*Math.sin(r+T*s)*Math.sin(a+v*o),g.push(d.x,d.y,d.z),h.copy(d).normalize(),_.push(h.x,h.y,h.z),m.push(T+b,1-v),E.push(c++)}u.push(E)}for(let p=0;p<n;p++)for(let E=0;E<t;E++){const v=u[p][E+1],b=u[p][E],R=u[p+1][E],T=u[p+1][E+1];(p!==0||a>0)&&f.push(v,b,T),(p!==n-1||l<Math.PI)&&f.push(b,R,T)}this.setIndex(f),this.setAttribute("position",new nt(g,3)),this.setAttribute("normal",new nt(_,3)),this.setAttribute("uv",new nt(m,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Bi(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class sa extends _t{constructor(e=new mc(new I(-1,-1,0),new I(-1,1,0),new I(1,1,0)),t=64,n=1,r=8,s=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:r,closed:s};const a=e.computeFrenetFrames(t,s);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals;const o=new I,l=new I,c=new ue;let u=new I;const d=[],h=[],f=[],g=[];_(),this.setIndex(g),this.setAttribute("position",new nt(d,3)),this.setAttribute("normal",new nt(h,3)),this.setAttribute("uv",new nt(f,2));function _(){for(let v=0;v<t;v++)m(v);m(s===!1?t:0),E(),p()}function m(v){u=e.getPointAt(v/t,u);const b=a.normals[v],R=a.binormals[v];for(let T=0;T<=r;T++){const A=T/r*Math.PI*2,P=Math.sin(A),y=-Math.cos(A);l.x=y*b.x+P*R.x,l.y=y*b.y+P*R.y,l.z=y*b.z+P*R.z,l.normalize(),h.push(l.x,l.y,l.z),o.x=u.x+n*l.x,o.y=u.y+n*l.y,o.z=u.z+n*l.z,d.push(o.x,o.y,o.z)}}function p(){for(let v=1;v<=t;v++)for(let b=1;b<=r;b++){const R=(r+1)*(v-1)+(b-1),T=(r+1)*v+(b-1),A=(r+1)*v+b,P=(r+1)*(v-1)+b;g.push(R,T,P),g.push(T,A,P)}}function E(){for(let v=0;v<=t;v++)for(let b=0;b<=r;b++)c.x=v/t,c.y=b/r,f.push(c.x,c.y)}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON();return e.path=this.parameters.path.toJSON(),e}static fromJSON(e){return new sa(new K0[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}class gc{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=tl(),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){const t=tl();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function tl(){return(typeof performance>"u"?Date:performance).now()}class nl{constructor(e=1,t=0,n=0){return this.radius=e,this.phi=t,this.theta=n,this}set(e,t,n){return this.radius=e,this.phi=t,this.theta=n,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,n){return this.radius=Math.sqrt(e*e+t*t+n*n),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(ht(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Js}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Js);const il={type:"change"},Cs={type:"start"},rl={type:"end"},Er=new Br,sl=new hn,J0=Math.cos(70*Gl.DEG2RAD);class _c extends Nn{constructor(e,t){super(),this.object=e,this.domElement=t,this.domElement.style.touchAction="none",this.enabled=!0,this.target=new I,this.cursor=new I,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minTargetRadius=0,this.maxTargetRadius=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:Hn.ROTATE,MIDDLE:Hn.DOLLY,RIGHT:Hn.PAN},this.touches={ONE:Vn.ROTATE,TWO:Vn.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this.getPolarAngle=function(){return o.phi},this.getAzimuthalAngle=function(){return o.theta},this.getDistance=function(){return this.object.position.distanceTo(this.target)},this.listenToKeyEvents=function(x){x.addEventListener("keydown",fe),this._domElementKeyEvents=x},this.stopListenToKeyEvents=function(){this._domElementKeyEvents.removeEventListener("keydown",fe),this._domElementKeyEvents=null},this.saveState=function(){n.target0.copy(n.target),n.position0.copy(n.object.position),n.zoom0=n.object.zoom},this.reset=function(){n.target.copy(n.target0),n.object.position.copy(n.position0),n.object.zoom=n.zoom0,n.object.updateProjectionMatrix(),n.dispatchEvent(il),n.update(),s=r.NONE},this.update=(function(){const x=new I,V=new Fn().setFromUnitVectors(e.up,new I(0,1,0)),K=V.clone().invert(),se=new I,pe=new Fn,Ve=new I,ze=2*Math.PI;return function(lt=null){const $e=n.object.position;x.copy($e).sub(n.target),x.applyQuaternion(V),o.setFromVector3(x),n.autoRotate&&s===r.NONE&&L(M(lt)),n.enableDamping?(o.theta+=l.theta*n.dampingFactor,o.phi+=l.phi*n.dampingFactor):(o.theta+=l.theta,o.phi+=l.phi);let it=n.minAzimuthAngle,rt=n.maxAzimuthAngle;isFinite(it)&&isFinite(rt)&&(it<-Math.PI?it+=ze:it>Math.PI&&(it-=ze),rt<-Math.PI?rt+=ze:rt>Math.PI&&(rt-=ze),it<=rt?o.theta=Math.max(it,Math.min(rt,o.theta)):o.theta=o.theta>(it+rt)/2?Math.max(it,o.theta):Math.min(rt,o.theta)),o.phi=Math.max(n.minPolarAngle,Math.min(n.maxPolarAngle,o.phi)),o.makeSafe(),n.enableDamping===!0?n.target.addScaledVector(u,n.dampingFactor):n.target.add(u),n.target.sub(n.cursor),n.target.clampLength(n.minTargetRadius,n.maxTargetRadius),n.target.add(n.cursor);let Dt=!1;if(n.zoomToCursor&&T||n.object.isOrthographicCamera)o.radius=$(o.radius);else{const Pt=o.radius;o.radius=$(o.radius*c),Dt=Pt!=o.radius}if(x.setFromSpherical(o),x.applyQuaternion(K),$e.copy(n.target).add(x),n.object.lookAt(n.target),n.enableDamping===!0?(l.theta*=1-n.dampingFactor,l.phi*=1-n.dampingFactor,u.multiplyScalar(1-n.dampingFactor)):(l.set(0,0,0),u.set(0,0,0)),n.zoomToCursor&&T){let Pt=null;if(n.object.isPerspectiveCamera){const nn=x.length();Pt=$(nn*c);const On=nn-Pt;n.object.position.addScaledVector(b,On),n.object.updateMatrixWorld(),Dt=!!On}else if(n.object.isOrthographicCamera){const nn=new I(R.x,R.y,0);nn.unproject(n.object);const On=n.object.zoom;n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/c)),n.object.updateProjectionMatrix(),Dt=On!==n.object.zoom;const vn=new I(R.x,R.y,0);vn.unproject(n.object),n.object.position.sub(vn).add(nn),n.object.updateMatrixWorld(),Pt=x.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),n.zoomToCursor=!1;Pt!==null&&(this.screenSpacePanning?n.target.set(0,0,-1).transformDirection(n.object.matrix).multiplyScalar(Pt).add(n.object.position):(Er.origin.copy(n.object.position),Er.direction.set(0,0,-1).transformDirection(n.object.matrix),Math.abs(n.object.up.dot(Er.direction))<J0?e.lookAt(n.target):(sl.setFromNormalAndCoplanarPoint(n.object.up,n.target),Er.intersectPlane(sl,n.target))))}else if(n.object.isOrthographicCamera){const Pt=n.object.zoom;n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/c)),Pt!==n.object.zoom&&(n.object.updateProjectionMatrix(),Dt=!0)}return c=1,T=!1,Dt||se.distanceToSquared(n.object.position)>a||8*(1-pe.dot(n.object.quaternion))>a||Ve.distanceToSquared(n.target)>a?(n.dispatchEvent(il),se.copy(n.object.position),pe.copy(n.object.quaternion),Ve.copy(n.target),!0):!1}})(),this.dispose=function(){n.domElement.removeEventListener("contextmenu",_e),n.domElement.removeEventListener("pointerdown",q),n.domElement.removeEventListener("pointercancel",te),n.domElement.removeEventListener("wheel",re),n.domElement.removeEventListener("pointermove",Z),n.domElement.removeEventListener("pointerup",te),n.domElement.getRootNode().removeEventListener("keydown",Ae,{capture:!0}),n._domElementKeyEvents!==null&&(n._domElementKeyEvents.removeEventListener("keydown",fe),n._domElementKeyEvents=null)};const n=this,r={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let s=r.NONE;const a=1e-6,o=new nl,l=new nl;let c=1;const u=new I,d=new ue,h=new ue,f=new ue,g=new ue,_=new ue,m=new ue,p=new ue,E=new ue,v=new ue,b=new I,R=new ue;let T=!1;const A=[],P={};let y=!1;function M(x){return x!==null?2*Math.PI/60*n.autoRotateSpeed*x:2*Math.PI/60/60*n.autoRotateSpeed}function F(x){const V=Math.abs(x*.01);return Math.pow(.95,n.zoomSpeed*V)}function L(x){l.theta-=x}function C(x){l.phi-=x}const U=(function(){const x=new I;return function(K,se){x.setFromMatrixColumn(se,0),x.multiplyScalar(-K),u.add(x)}})(),H=(function(){const x=new I;return function(K,se){n.screenSpacePanning===!0?x.setFromMatrixColumn(se,1):(x.setFromMatrixColumn(se,0),x.crossVectors(n.object.up,x)),x.multiplyScalar(K),u.add(x)}})(),Y=(function(){const x=new I;return function(K,se){const pe=n.domElement;if(n.object.isPerspectiveCamera){const Ve=n.object.position;x.copy(Ve).sub(n.target);let ze=x.length();ze*=Math.tan(n.object.fov/2*Math.PI/180),U(2*K*ze/pe.clientHeight,n.object.matrix),H(2*se*ze/pe.clientHeight,n.object.matrix)}else n.object.isOrthographicCamera?(U(K*(n.object.right-n.object.left)/n.object.zoom/pe.clientWidth,n.object.matrix),H(se*(n.object.top-n.object.bottom)/n.object.zoom/pe.clientHeight,n.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),n.enablePan=!1)}})();function J(x){n.object.isPerspectiveCamera||n.object.isOrthographicCamera?c/=x:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function z(x){n.object.isPerspectiveCamera||n.object.isOrthographicCamera?c*=x:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function j(x,V){if(!n.zoomToCursor)return;T=!0;const K=n.domElement.getBoundingClientRect(),se=x-K.left,pe=V-K.top,Ve=K.width,ze=K.height;R.x=se/Ve*2-1,R.y=-(pe/ze)*2+1,b.set(R.x,R.y,1).unproject(n.object).sub(n.object.position).normalize()}function $(x){return Math.max(n.minDistance,Math.min(n.maxDistance,x))}function N(x){d.set(x.clientX,x.clientY)}function ee(x){j(x.clientX,x.clientX),p.set(x.clientX,x.clientY)}function me(x){g.set(x.clientX,x.clientY)}function O(x){h.set(x.clientX,x.clientY),f.subVectors(h,d).multiplyScalar(n.rotateSpeed);const V=n.domElement;L(2*Math.PI*f.x/V.clientHeight),C(2*Math.PI*f.y/V.clientHeight),d.copy(h),n.update()}function Q(x){E.set(x.clientX,x.clientY),v.subVectors(E,p),v.y>0?J(F(v.y)):v.y<0&&z(F(v.y)),p.copy(E),n.update()}function ce(x){_.set(x.clientX,x.clientY),m.subVectors(_,g).multiplyScalar(n.panSpeed),Y(m.x,m.y),g.copy(_),n.update()}function ne(x){j(x.clientX,x.clientY),x.deltaY<0?z(F(x.deltaY)):x.deltaY>0&&J(F(x.deltaY)),n.update()}function ve(x){let V=!1;switch(x.code){case n.keys.UP:x.ctrlKey||x.metaKey||x.shiftKey?C(2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):Y(0,n.keyPanSpeed),V=!0;break;case n.keys.BOTTOM:x.ctrlKey||x.metaKey||x.shiftKey?C(-2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):Y(0,-n.keyPanSpeed),V=!0;break;case n.keys.LEFT:x.ctrlKey||x.metaKey||x.shiftKey?L(2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):Y(n.keyPanSpeed,0),V=!0;break;case n.keys.RIGHT:x.ctrlKey||x.metaKey||x.shiftKey?L(-2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):Y(-n.keyPanSpeed,0),V=!0;break}V&&(x.preventDefault(),n.update())}function Te(x){if(A.length===1)d.set(x.pageX,x.pageY);else{const V=Ye(x),K=.5*(x.pageX+V.x),se=.5*(x.pageY+V.y);d.set(K,se)}}function Ce(x){if(A.length===1)g.set(x.pageX,x.pageY);else{const V=Ye(x),K=.5*(x.pageX+V.x),se=.5*(x.pageY+V.y);g.set(K,se)}}function k(x){const V=Ye(x),K=x.pageX-V.x,se=x.pageY-V.y,pe=Math.sqrt(K*K+se*se);p.set(0,pe)}function Fe(x){n.enableZoom&&k(x),n.enablePan&&Ce(x)}function xe(x){n.enableZoom&&k(x),n.enableRotate&&Te(x)}function Ge(x){if(A.length==1)h.set(x.pageX,x.pageY);else{const K=Ye(x),se=.5*(x.pageX+K.x),pe=.5*(x.pageY+K.y);h.set(se,pe)}f.subVectors(h,d).multiplyScalar(n.rotateSpeed);const V=n.domElement;L(2*Math.PI*f.x/V.clientHeight),C(2*Math.PI*f.y/V.clientHeight),d.copy(h)}function Ee(x){if(A.length===1)_.set(x.pageX,x.pageY);else{const V=Ye(x),K=.5*(x.pageX+V.x),se=.5*(x.pageY+V.y);_.set(K,se)}m.subVectors(_,g).multiplyScalar(n.panSpeed),Y(m.x,m.y),g.copy(_)}function We(x){const V=Ye(x),K=x.pageX-V.x,se=x.pageY-V.y,pe=Math.sqrt(K*K+se*se);E.set(0,pe),v.set(0,Math.pow(E.y/p.y,n.zoomSpeed)),J(v.y),p.copy(E);const Ve=(x.pageX+V.x)*.5,ze=(x.pageY+V.y)*.5;j(Ve,ze)}function w(x){n.enableZoom&&We(x),n.enablePan&&Ee(x)}function S(x){n.enableZoom&&We(x),n.enableRotate&&Ge(x)}function q(x){n.enabled!==!1&&(A.length===0&&(n.domElement.setPointerCapture(x.pointerId),n.domElement.addEventListener("pointermove",Z),n.domElement.addEventListener("pointerup",te)),!qe(x)&&(ke(x),x.pointerType==="touch"?Re(x):ie(x)))}function Z(x){n.enabled!==!1&&(x.pointerType==="touch"?ge(x):De(x))}function te(x){switch(He(x),A.length){case 0:n.domElement.releasePointerCapture(x.pointerId),n.domElement.removeEventListener("pointermove",Z),n.domElement.removeEventListener("pointerup",te),n.dispatchEvent(rl),s=r.NONE;break;case 1:const V=A[0],K=P[V];Re({pointerId:V,pageX:K.x,pageY:K.y});break}}function ie(x){let V;switch(x.button){case 0:V=n.mouseButtons.LEFT;break;case 1:V=n.mouseButtons.MIDDLE;break;case 2:V=n.mouseButtons.RIGHT;break;default:V=-1}switch(V){case Hn.DOLLY:if(n.enableZoom===!1)return;ee(x),s=r.DOLLY;break;case Hn.ROTATE:if(x.ctrlKey||x.metaKey||x.shiftKey){if(n.enablePan===!1)return;me(x),s=r.PAN}else{if(n.enableRotate===!1)return;N(x),s=r.ROTATE}break;case Hn.PAN:if(x.ctrlKey||x.metaKey||x.shiftKey){if(n.enableRotate===!1)return;N(x),s=r.ROTATE}else{if(n.enablePan===!1)return;me(x),s=r.PAN}break;default:s=r.NONE}s!==r.NONE&&n.dispatchEvent(Cs)}function De(x){switch(s){case r.ROTATE:if(n.enableRotate===!1)return;O(x);break;case r.DOLLY:if(n.enableZoom===!1)return;Q(x);break;case r.PAN:if(n.enablePan===!1)return;ce(x);break}}function re(x){n.enabled===!1||n.enableZoom===!1||s!==r.NONE||(x.preventDefault(),n.dispatchEvent(Cs),ne(ye(x)),n.dispatchEvent(rl))}function ye(x){const V=x.deltaMode,K={clientX:x.clientX,clientY:x.clientY,deltaY:x.deltaY};switch(V){case 1:K.deltaY*=16;break;case 2:K.deltaY*=100;break}return x.ctrlKey&&!y&&(K.deltaY*=10),K}function Ae(x){x.key==="Control"&&(y=!0,n.domElement.getRootNode().addEventListener("keyup",ae,{passive:!0,capture:!0}))}function ae(x){x.key==="Control"&&(y=!1,n.domElement.getRootNode().removeEventListener("keyup",ae,{passive:!0,capture:!0}))}function fe(x){n.enabled===!1||n.enablePan===!1||ve(x)}function Re(x){switch(Xe(x),A.length){case 1:switch(n.touches.ONE){case Vn.ROTATE:if(n.enableRotate===!1)return;Te(x),s=r.TOUCH_ROTATE;break;case Vn.PAN:if(n.enablePan===!1)return;Ce(x),s=r.TOUCH_PAN;break;default:s=r.NONE}break;case 2:switch(n.touches.TWO){case Vn.DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;Fe(x),s=r.TOUCH_DOLLY_PAN;break;case Vn.DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;xe(x),s=r.TOUCH_DOLLY_ROTATE;break;default:s=r.NONE}break;default:s=r.NONE}s!==r.NONE&&n.dispatchEvent(Cs)}function ge(x){switch(Xe(x),s){case r.TOUCH_ROTATE:if(n.enableRotate===!1)return;Ge(x),n.update();break;case r.TOUCH_PAN:if(n.enablePan===!1)return;Ee(x),n.update();break;case r.TOUCH_DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;w(x),n.update();break;case r.TOUCH_DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;S(x),n.update();break;default:s=r.NONE}}function _e(x){n.enabled!==!1&&x.preventDefault()}function ke(x){A.push(x.pointerId)}function He(x){delete P[x.pointerId];for(let V=0;V<A.length;V++)if(A[V]==x.pointerId){A.splice(V,1);return}}function qe(x){for(let V=0;V<A.length;V++)if(A[V]==x.pointerId)return!0;return!1}function Xe(x){let V=P[x.pointerId];V===void 0&&(V=new ue,P[x.pointerId]=V),V.set(x.pageX,x.pageY)}function Ye(x){const V=x.pointerId===A[0]?A[1]:A[0];return P[V]}n.domElement.addEventListener("contextmenu",_e),n.domElement.addEventListener("pointerdown",q),n.domElement.addEventListener("pointercancel",te),n.domElement.addEventListener("wheel",re,{passive:!1}),n.domElement.getRootNode().addEventListener("keydown",Ae,{passive:!0,capture:!0}),this.update()}}const xc={name:"CopyShader",uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:`
3800
+ }`;class w0{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,n){if(this.texture===null){const r=new Tt,s=e.properties.get(r);s.__webglTexture=t.texture,(t.depthNear!=n.depthNear||t.depthFar!=n.depthFar)&&(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=r}}render(e,t){if(this.texture!==null){if(this.mesh===null){const n=t.cameras[0].viewport,r=new ft({vertexShader:D0,fragmentShader:A0,uniforms:{depthColor:{value:this.texture},depthWidth:{value:n.z},depthHeight:{value:n.w}}});this.mesh=new bt(new zr(20,20),r)}e.render(this.mesh,t)}}reset(){this.texture=null,this.mesh=null}}class C0 extends Un{constructor(e,t){super();const n=this;let r=null,s=1,a=null,o="local-floor",l=1,c=null,u=null,d=null,h=null,f=null,g=null;const _=new w0,m=t.getContextAttributes();let p=null,E=null;const v=[],b=[],R=new ue;let T=null;const A=new Rt;A.layers.enable(1),A.viewport=new dt;const P=new Rt;P.layers.enable(2),P.viewport=new dt;const S=[A,P],M=new b0;M.layers.enable(1),M.layers.enable(2);let F=null,L=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(O){let Q=v[O];return Q===void 0&&(Q=new bs,v[O]=Q),Q.getTargetRaySpace()},this.getControllerGrip=function(O){let Q=v[O];return Q===void 0&&(Q=new bs,v[O]=Q),Q.getGripSpace()},this.getHand=function(O){let Q=v[O];return Q===void 0&&(Q=new bs,v[O]=Q),Q.getHandSpace()};function C(O){const Q=b.indexOf(O.inputSource);if(Q===-1)return;const ce=v[Q];ce!==void 0&&(ce.update(O.inputSource,O.frame,c||a),ce.dispatchEvent({type:O.type,data:O.inputSource}))}function N(){r.removeEventListener("select",C),r.removeEventListener("selectstart",C),r.removeEventListener("selectend",C),r.removeEventListener("squeeze",C),r.removeEventListener("squeezestart",C),r.removeEventListener("squeezeend",C),r.removeEventListener("end",N),r.removeEventListener("inputsourceschange",V);for(let O=0;O<v.length;O++){const Q=b[O];Q!==null&&(b[O]=null,v[O].disconnect(Q))}F=null,L=null,_.reset(),e.setRenderTarget(p),f=null,h=null,d=null,r=null,E=null,me.stop(),n.isPresenting=!1,e.setPixelRatio(T),e.setSize(R.width,R.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(O){s=O,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(O){o=O,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||a},this.setReferenceSpace=function(O){c=O},this.getBaseLayer=function(){return h!==null?h:f},this.getBinding=function(){return d},this.getFrame=function(){return g},this.getSession=function(){return r},this.setSession=async function(O){if(r=O,r!==null){if(p=e.getRenderTarget(),r.addEventListener("select",C),r.addEventListener("selectstart",C),r.addEventListener("selectend",C),r.addEventListener("squeeze",C),r.addEventListener("squeezestart",C),r.addEventListener("squeezeend",C),r.addEventListener("end",N),r.addEventListener("inputsourceschange",V),m.xrCompatible!==!0&&await t.makeXRCompatible(),T=e.getPixelRatio(),e.getSize(R),r.renderState.layers===void 0){const Q={antialias:m.antialias,alpha:!0,depth:m.depth,stencil:m.stencil,framebufferScaleFactor:s};f=new XRWebGLLayer(r,t,Q),r.updateRenderState({baseLayer:f}),e.setPixelRatio(1),e.setSize(f.framebufferWidth,f.framebufferHeight,!1),E=new Vt(f.framebufferWidth,f.framebufferHeight,{format:Xt,type:mn,colorSpace:e.outputColorSpace,stencilBuffer:m.stencil})}else{let Q=null,ce=null,ne=null;m.depth&&(ne=m.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,Q=m.stencil?Ui:hi,ce=m.stencil?zi:gi);const ve={colorFormat:t.RGBA8,depthFormat:ne,scaleFactor:s};d=new XRWebGLBinding(r,t),h=d.createProjectionLayer(ve),r.updateRenderState({layers:[h]}),e.setPixelRatio(1),e.setSize(h.textureWidth,h.textureHeight,!1),E=new Vt(h.textureWidth,h.textureHeight,{format:Xt,type:mn,depthTexture:new rc(h.textureWidth,h.textureHeight,ce,void 0,void 0,void 0,void 0,void 0,void 0,Q),stencilBuffer:m.stencil,colorSpace:e.outputColorSpace,samples:m.antialias?4:0});const Te=e.properties.get(E);Te.__ignoreDepthValues=h.ignoreDepthValues}E.isXRRenderTarget=!0,this.setFoveation(l),c=null,a=await r.requestReferenceSpace(o),me.setContext(r),me.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(r!==null)return r.environmentBlendMode};function V(O){for(let Q=0;Q<O.removed.length;Q++){const ce=O.removed[Q],ne=b.indexOf(ce);ne>=0&&(b[ne]=null,v[ne].disconnect(ce))}for(let Q=0;Q<O.added.length;Q++){const ce=O.added[Q];let ne=b.indexOf(ce);if(ne===-1){for(let Te=0;Te<v.length;Te++)if(Te>=b.length){b.push(ce),ne=Te;break}else if(b[Te]===null){b[Te]=ce,ne=Te;break}if(ne===-1)break}const ve=v[ne];ve&&ve.connect(ce)}}const j=new I,J=new I;function z(O,Q,ce){j.setFromMatrixPosition(Q.matrixWorld),J.setFromMatrixPosition(ce.matrixWorld);const ne=j.distanceTo(J),ve=Q.projectionMatrix.elements,Te=ce.projectionMatrix.elements,Ce=ve[14]/(ve[10]-1),k=ve[14]/(ve[10]+1),Fe=(ve[9]+1)/ve[5],xe=(ve[9]-1)/ve[5],Ge=(ve[8]-1)/ve[0],Ee=(Te[8]+1)/Te[0],We=Ce*Ge,w=Ce*Ee,y=ne/(-Ge+Ee),q=y*-Ge;Q.matrixWorld.decompose(O.position,O.quaternion,O.scale),O.translateX(q),O.translateZ(y),O.matrixWorld.compose(O.position,O.quaternion,O.scale),O.matrixWorldInverse.copy(O.matrixWorld).invert();const Z=Ce+y,te=k+y,ie=We-q,De=w+(ne-q),re=Fe*k/te*Z,Se=xe*k/te*Z;O.projectionMatrix.makePerspective(ie,De,re,Se,Z,te),O.projectionMatrixInverse.copy(O.projectionMatrix).invert()}function Y(O,Q){Q===null?O.matrixWorld.copy(O.matrix):O.matrixWorld.multiplyMatrices(Q.matrixWorld,O.matrix),O.matrixWorldInverse.copy(O.matrixWorld).invert()}this.updateCamera=function(O){if(r===null)return;_.texture!==null&&(O.near=_.depthNear,O.far=_.depthFar),M.near=P.near=A.near=O.near,M.far=P.far=A.far=O.far,(F!==M.near||L!==M.far)&&(r.updateRenderState({depthNear:M.near,depthFar:M.far}),F=M.near,L=M.far,A.near=F,A.far=L,P.near=F,P.far=L,A.updateProjectionMatrix(),P.updateProjectionMatrix(),O.updateProjectionMatrix());const Q=O.parent,ce=M.cameras;Y(M,Q);for(let ne=0;ne<ce.length;ne++)Y(ce[ne],Q);ce.length===2?z(M,A,P):M.projectionMatrix.copy(A.projectionMatrix),$(O,M,Q)};function $(O,Q,ce){ce===null?O.matrix.copy(Q.matrixWorld):(O.matrix.copy(ce.matrixWorld),O.matrix.invert(),O.matrix.multiply(Q.matrixWorld)),O.matrix.decompose(O.position,O.quaternion,O.scale),O.updateMatrixWorld(!0),O.projectionMatrix.copy(Q.projectionMatrix),O.projectionMatrixInverse.copy(Q.projectionMatrixInverse),O.isPerspectiveCamera&&(O.fov=Oi*2*Math.atan(1/O.projectionMatrix.elements[5]),O.zoom=1)}this.getCamera=function(){return M},this.getFoveation=function(){if(!(h===null&&f===null))return l},this.setFoveation=function(O){l=O,h!==null&&(h.fixedFoveation=O),f!==null&&f.fixedFoveation!==void 0&&(f.fixedFoveation=O)},this.hasDepthSensing=function(){return _.texture!==null};let U=null;function ee(O,Q){if(u=Q.getViewerPose(c||a),g=Q,u!==null){const ce=u.views;f!==null&&(e.setRenderTargetFramebuffer(E,f.framebuffer),e.setRenderTarget(E));let ne=!1;ce.length!==M.cameras.length&&(M.cameras.length=0,ne=!0);for(let Te=0;Te<ce.length;Te++){const Ce=ce[Te];let k=null;if(f!==null)k=f.getViewport(Ce);else{const xe=d.getViewSubImage(h,Ce);k=xe.viewport,Te===0&&(e.setRenderTargetTextures(E,xe.colorTexture,h.ignoreDepthValues?void 0:xe.depthStencilTexture),e.setRenderTarget(E))}let Fe=S[Te];Fe===void 0&&(Fe=new Rt,Fe.layers.enable(Te),Fe.viewport=new dt,S[Te]=Fe),Fe.matrix.fromArray(Ce.transform.matrix),Fe.matrix.decompose(Fe.position,Fe.quaternion,Fe.scale),Fe.projectionMatrix.fromArray(Ce.projectionMatrix),Fe.projectionMatrixInverse.copy(Fe.projectionMatrix).invert(),Fe.viewport.set(k.x,k.y,k.width,k.height),Te===0&&(M.matrix.copy(Fe.matrix),M.matrix.decompose(M.position,M.quaternion,M.scale)),ne===!0&&M.cameras.push(Fe)}const ve=r.enabledFeatures;if(ve&&ve.includes("depth-sensing")){const Te=d.getDepthInformation(ce[0]);Te&&Te.isValid&&Te.texture&&_.init(e,Te,r.renderState)}}for(let ce=0;ce<v.length;ce++){const ne=b[ce],ve=v[ce];ne!==null&&ve!==void 0&&ve.update(ne,Q,c||a)}_.render(e,M),U&&U(O,Q),Q.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:Q}),g=null}const me=new nc;me.setAnimationLoop(ee),this.setAnimationLoop=function(O){U=O},this.dispose=function(){}}}const Dn=new In,R0=new et;function P0(i,e){function t(m,p){m.matrixAutoUpdate===!0&&m.updateMatrix(),p.value.copy(m.matrix)}function n(m,p){p.color.getRGB(m.fogColor.value,Jl(i)),p.isFog?(m.fogNear.value=p.near,m.fogFar.value=p.far):p.isFogExp2&&(m.fogDensity.value=p.density)}function r(m,p,E,v,b){p.isMeshBasicMaterial||p.isMeshLambertMaterial?s(m,p):p.isMeshToonMaterial?(s(m,p),d(m,p)):p.isMeshPhongMaterial?(s(m,p),u(m,p)):p.isMeshStandardMaterial?(s(m,p),h(m,p),p.isMeshPhysicalMaterial&&f(m,p,b)):p.isMeshMatcapMaterial?(s(m,p),g(m,p)):p.isMeshDepthMaterial?s(m,p):p.isMeshDistanceMaterial?(s(m,p),_(m,p)):p.isMeshNormalMaterial?s(m,p):p.isLineBasicMaterial?(a(m,p),p.isLineDashedMaterial&&o(m,p)):p.isPointsMaterial?l(m,p,E,v):p.isSpriteMaterial?c(m,p):p.isShadowMaterial?(m.color.value.copy(p.color),m.opacity.value=p.opacity):p.isShaderMaterial&&(p.uniformsNeedUpdate=!1)}function s(m,p){m.opacity.value=p.opacity,p.color&&m.diffuse.value.copy(p.color),p.emissive&&m.emissive.value.copy(p.emissive).multiplyScalar(p.emissiveIntensity),p.map&&(m.map.value=p.map,t(p.map,m.mapTransform)),p.alphaMap&&(m.alphaMap.value=p.alphaMap,t(p.alphaMap,m.alphaMapTransform)),p.bumpMap&&(m.bumpMap.value=p.bumpMap,t(p.bumpMap,m.bumpMapTransform),m.bumpScale.value=p.bumpScale,p.side===yt&&(m.bumpScale.value*=-1)),p.normalMap&&(m.normalMap.value=p.normalMap,t(p.normalMap,m.normalMapTransform),m.normalScale.value.copy(p.normalScale),p.side===yt&&m.normalScale.value.negate()),p.displacementMap&&(m.displacementMap.value=p.displacementMap,t(p.displacementMap,m.displacementMapTransform),m.displacementScale.value=p.displacementScale,m.displacementBias.value=p.displacementBias),p.emissiveMap&&(m.emissiveMap.value=p.emissiveMap,t(p.emissiveMap,m.emissiveMapTransform)),p.specularMap&&(m.specularMap.value=p.specularMap,t(p.specularMap,m.specularMapTransform)),p.alphaTest>0&&(m.alphaTest.value=p.alphaTest);const E=e.get(p),v=E.envMap,b=E.envMapRotation;if(v&&(m.envMap.value=v,Dn.copy(b),Dn.x*=-1,Dn.y*=-1,Dn.z*=-1,v.isCubeTexture&&v.isRenderTargetTexture===!1&&(Dn.y*=-1,Dn.z*=-1),m.envMapRotation.value.setFromMatrix4(R0.makeRotationFromEuler(Dn)),m.flipEnvMap.value=v.isCubeTexture&&v.isRenderTargetTexture===!1?-1:1,m.reflectivity.value=p.reflectivity,m.ior.value=p.ior,m.refractionRatio.value=p.refractionRatio),p.lightMap){m.lightMap.value=p.lightMap;const R=i._useLegacyLights===!0?Math.PI:1;m.lightMapIntensity.value=p.lightMapIntensity*R,t(p.lightMap,m.lightMapTransform)}p.aoMap&&(m.aoMap.value=p.aoMap,m.aoMapIntensity.value=p.aoMapIntensity,t(p.aoMap,m.aoMapTransform))}function a(m,p){m.diffuse.value.copy(p.color),m.opacity.value=p.opacity,p.map&&(m.map.value=p.map,t(p.map,m.mapTransform))}function o(m,p){m.dashSize.value=p.dashSize,m.totalSize.value=p.dashSize+p.gapSize,m.scale.value=p.scale}function l(m,p,E,v){m.diffuse.value.copy(p.color),m.opacity.value=p.opacity,m.size.value=p.size*E,m.scale.value=v*.5,p.map&&(m.map.value=p.map,t(p.map,m.uvTransform)),p.alphaMap&&(m.alphaMap.value=p.alphaMap,t(p.alphaMap,m.alphaMapTransform)),p.alphaTest>0&&(m.alphaTest.value=p.alphaTest)}function c(m,p){m.diffuse.value.copy(p.color),m.opacity.value=p.opacity,m.rotation.value=p.rotation,p.map&&(m.map.value=p.map,t(p.map,m.mapTransform)),p.alphaMap&&(m.alphaMap.value=p.alphaMap,t(p.alphaMap,m.alphaMapTransform)),p.alphaTest>0&&(m.alphaTest.value=p.alphaTest)}function u(m,p){m.specular.value.copy(p.specular),m.shininess.value=Math.max(p.shininess,1e-4)}function d(m,p){p.gradientMap&&(m.gradientMap.value=p.gradientMap)}function h(m,p){m.metalness.value=p.metalness,p.metalnessMap&&(m.metalnessMap.value=p.metalnessMap,t(p.metalnessMap,m.metalnessMapTransform)),m.roughness.value=p.roughness,p.roughnessMap&&(m.roughnessMap.value=p.roughnessMap,t(p.roughnessMap,m.roughnessMapTransform)),p.envMap&&(m.envMapIntensity.value=p.envMapIntensity)}function f(m,p,E){m.ior.value=p.ior,p.sheen>0&&(m.sheenColor.value.copy(p.sheenColor).multiplyScalar(p.sheen),m.sheenRoughness.value=p.sheenRoughness,p.sheenColorMap&&(m.sheenColorMap.value=p.sheenColorMap,t(p.sheenColorMap,m.sheenColorMapTransform)),p.sheenRoughnessMap&&(m.sheenRoughnessMap.value=p.sheenRoughnessMap,t(p.sheenRoughnessMap,m.sheenRoughnessMapTransform))),p.clearcoat>0&&(m.clearcoat.value=p.clearcoat,m.clearcoatRoughness.value=p.clearcoatRoughness,p.clearcoatMap&&(m.clearcoatMap.value=p.clearcoatMap,t(p.clearcoatMap,m.clearcoatMapTransform)),p.clearcoatRoughnessMap&&(m.clearcoatRoughnessMap.value=p.clearcoatRoughnessMap,t(p.clearcoatRoughnessMap,m.clearcoatRoughnessMapTransform)),p.clearcoatNormalMap&&(m.clearcoatNormalMap.value=p.clearcoatNormalMap,t(p.clearcoatNormalMap,m.clearcoatNormalMapTransform),m.clearcoatNormalScale.value.copy(p.clearcoatNormalScale),p.side===yt&&m.clearcoatNormalScale.value.negate())),p.iridescence>0&&(m.iridescence.value=p.iridescence,m.iridescenceIOR.value=p.iridescenceIOR,m.iridescenceThicknessMinimum.value=p.iridescenceThicknessRange[0],m.iridescenceThicknessMaximum.value=p.iridescenceThicknessRange[1],p.iridescenceMap&&(m.iridescenceMap.value=p.iridescenceMap,t(p.iridescenceMap,m.iridescenceMapTransform)),p.iridescenceThicknessMap&&(m.iridescenceThicknessMap.value=p.iridescenceThicknessMap,t(p.iridescenceThicknessMap,m.iridescenceThicknessMapTransform))),p.transmission>0&&(m.transmission.value=p.transmission,m.transmissionSamplerMap.value=E.texture,m.transmissionSamplerSize.value.set(E.width,E.height),p.transmissionMap&&(m.transmissionMap.value=p.transmissionMap,t(p.transmissionMap,m.transmissionMapTransform)),m.thickness.value=p.thickness,p.thicknessMap&&(m.thicknessMap.value=p.thicknessMap,t(p.thicknessMap,m.thicknessMapTransform)),m.attenuationDistance.value=p.attenuationDistance,m.attenuationColor.value.copy(p.attenuationColor)),p.anisotropy>0&&(m.anisotropyVector.value.set(p.anisotropy*Math.cos(p.anisotropyRotation),p.anisotropy*Math.sin(p.anisotropyRotation)),p.anisotropyMap&&(m.anisotropyMap.value=p.anisotropyMap,t(p.anisotropyMap,m.anisotropyMapTransform))),m.specularIntensity.value=p.specularIntensity,m.specularColor.value.copy(p.specularColor),p.specularColorMap&&(m.specularColorMap.value=p.specularColorMap,t(p.specularColorMap,m.specularColorMapTransform)),p.specularIntensityMap&&(m.specularIntensityMap.value=p.specularIntensityMap,t(p.specularIntensityMap,m.specularIntensityMapTransform))}function g(m,p){p.matcap&&(m.matcap.value=p.matcap)}function _(m,p){const E=e.get(p).light;m.referencePosition.value.setFromMatrixPosition(E.matrixWorld),m.nearDistance.value=E.shadow.camera.near,m.farDistance.value=E.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:r}}function L0(i,e,t,n){let r={},s={},a=[];const o=i.getParameter(i.MAX_UNIFORM_BUFFER_BINDINGS);function l(E,v){const b=v.program;n.uniformBlockBinding(E,b)}function c(E,v){let b=r[E.id];b===void 0&&(g(E),b=u(E),r[E.id]=b,E.addEventListener("dispose",m));const R=v.program;n.updateUBOMapping(E,R);const T=e.render.frame;s[E.id]!==T&&(h(E),s[E.id]=T)}function u(E){const v=d();E.__bindingPointIndex=v;const b=i.createBuffer(),R=E.__size,T=E.usage;return i.bindBuffer(i.UNIFORM_BUFFER,b),i.bufferData(i.UNIFORM_BUFFER,R,T),i.bindBuffer(i.UNIFORM_BUFFER,null),i.bindBufferBase(i.UNIFORM_BUFFER,v,b),b}function d(){for(let E=0;E<o;E++)if(a.indexOf(E)===-1)return a.push(E),E;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function h(E){const v=r[E.id],b=E.uniforms,R=E.__cache;i.bindBuffer(i.UNIFORM_BUFFER,v);for(let T=0,A=b.length;T<A;T++){const P=Array.isArray(b[T])?b[T]:[b[T]];for(let S=0,M=P.length;S<M;S++){const F=P[S];if(f(F,T,S,R)===!0){const L=F.__offset,C=Array.isArray(F.value)?F.value:[F.value];let N=0;for(let V=0;V<C.length;V++){const j=C[V],J=_(j);typeof j=="number"||typeof j=="boolean"?(F.__data[0]=j,i.bufferSubData(i.UNIFORM_BUFFER,L+N,F.__data)):j.isMatrix3?(F.__data[0]=j.elements[0],F.__data[1]=j.elements[1],F.__data[2]=j.elements[2],F.__data[3]=0,F.__data[4]=j.elements[3],F.__data[5]=j.elements[4],F.__data[6]=j.elements[5],F.__data[7]=0,F.__data[8]=j.elements[6],F.__data[9]=j.elements[7],F.__data[10]=j.elements[8],F.__data[11]=0):(j.toArray(F.__data,N),N+=J.storage/Float32Array.BYTES_PER_ELEMENT)}i.bufferSubData(i.UNIFORM_BUFFER,L,F.__data)}}}i.bindBuffer(i.UNIFORM_BUFFER,null)}function f(E,v,b,R){const T=E.value,A=v+"_"+b;if(R[A]===void 0)return typeof T=="number"||typeof T=="boolean"?R[A]=T:R[A]=T.clone(),!0;{const P=R[A];if(typeof T=="number"||typeof T=="boolean"){if(P!==T)return R[A]=T,!0}else if(P.equals(T)===!1)return P.copy(T),!0}return!1}function g(E){const v=E.uniforms;let b=0;const R=16;for(let A=0,P=v.length;A<P;A++){const S=Array.isArray(v[A])?v[A]:[v[A]];for(let M=0,F=S.length;M<F;M++){const L=S[M],C=Array.isArray(L.value)?L.value:[L.value];for(let N=0,V=C.length;N<V;N++){const j=C[N],J=_(j),z=b%R;z!==0&&R-z<J.boundary&&(b+=R-z),L.__data=new Float32Array(J.storage/Float32Array.BYTES_PER_ELEMENT),L.__offset=b,b+=J.storage}}}const T=b%R;return T>0&&(b+=R-T),E.__size=b,E.__cache={},this}function _(E){const v={boundary:0,storage:0};return typeof E=="number"||typeof E=="boolean"?(v.boundary=4,v.storage=4):E.isVector2?(v.boundary=8,v.storage=8):E.isVector3||E.isColor?(v.boundary=16,v.storage=12):E.isVector4?(v.boundary=16,v.storage=16):E.isMatrix3?(v.boundary=48,v.storage=48):E.isMatrix4?(v.boundary=64,v.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),v}function m(E){const v=E.target;v.removeEventListener("dispose",m);const b=a.indexOf(v.__bindingPointIndex);a.splice(b,1),i.deleteBuffer(r[v.id]),delete r[v.id],delete s[v.id]}function p(){for(const E in r)i.deleteBuffer(r[E]);a=[],r={},s={}}return{bind:l,update:c,dispose:p}}class uc{constructor(e={}){const{canvas:t=bh(),context:n=null,depth:r=!0,stencil:s=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:d=!1}=e;this.isWebGLRenderer=!0;let h;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");h=n.getContextAttributes().alpha}else h=a;const f=new Uint32Array(4),g=new Int32Array(4);let _=null,m=null;const p=[],E=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=It,this._useLegacyLights=!1,this.toneMapping=pn,this.toneMappingExposure=1;const v=this;let b=!1,R=0,T=0,A=null,P=-1,S=null;const M=new dt,F=new dt;let L=null;const C=new be(0);let N=0,V=t.width,j=t.height,J=1,z=null,Y=null;const $=new dt(0,0,V,j),U=new dt(0,0,V,j);let ee=!1;const me=new tc;let O=!1,Q=!1;const ce=new et,ne=new ue,ve=new I,Te={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function Ce(){return A===null?J:1}let k=n;function Fe(D,B){const W=t.getContext(D,B);return W!==null?W:null}try{const D={alpha:!0,depth:r,stencil:s,antialias:o,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:u,failIfMajorPerformanceCaveat:d};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${Qs}`),t.addEventListener("webglcontextlost",H,!1),t.addEventListener("webglcontextrestored",K,!1),t.addEventListener("webglcontextcreationerror",ae,!1),k===null){const B="webgl2";if(k=Fe(B,D),k===null)throw Fe(B)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(D){throw console.error("THREE.WebGLRenderer: "+D.message),D}let xe,Ge,Ee,We,w,y,q,Z,te,ie,De,re,Se,Ae,oe,fe,Re,ge,_e,ke,Ve,qe,Xe,je;function Me(){xe=new Vp(k),xe.init(),Ge=new Np(k,xe,e),qe=new E0(k,xe),Ee=new y0(k),We=new Wp(k),w=new o0,y=new S0(k,xe,Ee,w,Ge,qe,We),q=new Op(v),Z=new kp(v),te=new Yh(k),Xe=new Fp(k,te),ie=new Hp(k,te,We,Xe),De=new qp(k,ie,te,We),_e=new Xp(k,Ge,y),fe=new Up(w),re=new a0(v,q,Z,xe,Ge,Xe,fe),Se=new P0(v,w),Ae=new c0,oe=new m0(xe),ge=new Lp(v,q,Z,Ee,De,h,l),Re=new M0(v,De,Ge),je=new L0(k,We,Ge,Ee),ke=new Ip(k,xe,We),Ve=new Gp(k,xe,We),We.programs=re.programs,v.capabilities=Ge,v.extensions=xe,v.properties=w,v.renderLists=Ae,v.shadowMap=Re,v.state=Ee,v.info=We}Me();const x=new C0(v,k);this.xr=x,this.getContext=function(){return k},this.getContextAttributes=function(){return k.getContextAttributes()},this.forceContextLoss=function(){const D=xe.get("WEBGL_lose_context");D&&D.loseContext()},this.forceContextRestore=function(){const D=xe.get("WEBGL_lose_context");D&&D.restoreContext()},this.getPixelRatio=function(){return J},this.setPixelRatio=function(D){D!==void 0&&(J=D,this.setSize(V,j,!1))},this.getSize=function(D){return D.set(V,j)},this.setSize=function(D,B,W=!0){if(x.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}V=D,j=B,t.width=Math.floor(D*J),t.height=Math.floor(B*J),W===!0&&(t.style.width=D+"px",t.style.height=B+"px"),this.setViewport(0,0,D,B)},this.getDrawingBufferSize=function(D){return D.set(V*J,j*J).floor()},this.setDrawingBufferSize=function(D,B,W){V=D,j=B,J=W,t.width=Math.floor(D*W),t.height=Math.floor(B*W),this.setViewport(0,0,D,B)},this.getCurrentViewport=function(D){return D.copy(M)},this.getViewport=function(D){return D.copy($)},this.setViewport=function(D,B,W,X){D.isVector4?$.set(D.x,D.y,D.z,D.w):$.set(D,B,W,X),Ee.viewport(M.copy($).multiplyScalar(J).round())},this.getScissor=function(D){return D.copy(U)},this.setScissor=function(D,B,W,X){D.isVector4?U.set(D.x,D.y,D.z,D.w):U.set(D,B,W,X),Ee.scissor(F.copy(U).multiplyScalar(J).round())},this.getScissorTest=function(){return ee},this.setScissorTest=function(D){Ee.setScissorTest(ee=D)},this.setOpaqueSort=function(D){z=D},this.setTransparentSort=function(D){Y=D},this.getClearColor=function(D){return D.copy(ge.getClearColor())},this.setClearColor=function(){ge.setClearColor.apply(ge,arguments)},this.getClearAlpha=function(){return ge.getClearAlpha()},this.setClearAlpha=function(){ge.setClearAlpha.apply(ge,arguments)},this.clear=function(D=!0,B=!0,W=!0){let X=0;if(D){let G=!1;if(A!==null){const he=A.texture.format;G=he===kl||he===zl||he===Bl}if(G){const he=A.texture.type,ye=he===mn||he===gi||he===Il||he===zi||he===Ul||he===Ol,we=ge.getClearColor(),Pe=ge.getClearAlpha(),Ie=we.r,Le=we.g,Ne=we.b;ye?(f[0]=Ie,f[1]=Le,f[2]=Ne,f[3]=Pe,k.clearBufferuiv(k.COLOR,0,f)):(g[0]=Ie,g[1]=Le,g[2]=Ne,g[3]=Pe,k.clearBufferiv(k.COLOR,0,g))}else X|=k.COLOR_BUFFER_BIT}B&&(X|=k.DEPTH_BUFFER_BIT),W&&(X|=k.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),k.clear(X)},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",H,!1),t.removeEventListener("webglcontextrestored",K,!1),t.removeEventListener("webglcontextcreationerror",ae,!1),Ae.dispose(),oe.dispose(),w.dispose(),q.dispose(),Z.dispose(),De.dispose(),Xe.dispose(),je.dispose(),re.dispose(),x.dispose(),x.removeEventListener("sessionstart",it),x.removeEventListener("sessionend",rt),Dt.stop()};function H(D){D.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),b=!0}function K(){console.log("THREE.WebGLRenderer: Context Restored."),b=!1;const D=We.autoReset,B=Re.enabled,W=Re.autoUpdate,X=Re.needsUpdate,G=Re.type;Me(),We.autoReset=D,Re.enabled=B,Re.autoUpdate=W,Re.needsUpdate=X,Re.type=G}function ae(D){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",D.statusMessage)}function pe(D){const B=D.target;B.removeEventListener("dispose",pe),He(B)}function He(D){ze(D),w.remove(D)}function ze(D){const B=w.get(D).programs;B!==void 0&&(B.forEach(function(W){re.releaseProgram(W)}),D.isShaderMaterial&&re.releaseShaderCache(D))}this.renderBufferDirect=function(D,B,W,X,G,he){B===null&&(B=Te);const ye=G.isMesh&&G.matrixWorld.determinant()<0,we=Ac(D,B,W,X,G);Ee.setMaterial(X,ye);let Pe=W.index,Ie=1;if(X.wireframe===!0){if(Pe=ie.getWireframeAttribute(W),Pe===void 0)return;Ie=2}const Le=W.drawRange,Ne=W.attributes.position;let tt=Le.start*Ie,At=(Le.start+Le.count)*Ie;he!==null&&(tt=Math.max(tt,he.start*Ie),At=Math.min(At,(he.start+he.count)*Ie)),Pe!==null?(tt=Math.max(tt,0),At=Math.min(At,Pe.count)):Ne!=null&&(tt=Math.max(tt,0),At=Math.min(At,Ne.count));const ct=At-tt;if(ct<0||ct===1/0)return;Xe.setup(G,X,we,W,Pe);let qt,Qe=ke;if(Pe!==null&&(qt=te.get(Pe),Qe=Ve,Qe.setIndex(qt)),G.isMesh)X.wireframe===!0?(Ee.setLineWidth(X.wireframeLinewidth*Ce()),Qe.setMode(k.LINES)):Qe.setMode(k.TRIANGLES);else if(G.isLine){let Ue=X.linewidth;Ue===void 0&&(Ue=1),Ee.setLineWidth(Ue*Ce()),G.isLineSegments?Qe.setMode(k.LINES):G.isLineLoop?Qe.setMode(k.LINE_LOOP):Qe.setMode(k.LINE_STRIP)}else G.isPoints?Qe.setMode(k.POINTS):G.isSprite&&Qe.setMode(k.TRIANGLES);if(G.isBatchedMesh)Qe.renderMultiDraw(G._multiDrawStarts,G._multiDrawCounts,G._multiDrawCount);else if(G.isInstancedMesh)Qe.renderInstances(tt,ct,G.count);else if(W.isInstancedBufferGeometry){const Ue=W._maxInstanceCount!==void 0?W._maxInstanceCount:1/0,Gr=Math.min(W.instanceCount,Ue);Qe.renderInstances(tt,ct,Gr)}else Qe.render(tt,ct)};function Ze(D,B,W){D.transparent===!0&&D.side===Wt&&D.forceSinglePass===!1?(D.side=yt,D.needsUpdate=!0,Xi(D,B,W),D.side=_n,D.needsUpdate=!0,Xi(D,B,W),D.side=Wt):Xi(D,B,W)}this.compile=function(D,B,W=null){W===null&&(W=D),m=oe.get(W),m.init(),E.push(m),W.traverseVisible(function(G){G.isLight&&G.layers.test(B.layers)&&(m.pushLight(G),G.castShadow&&m.pushShadow(G))}),D!==W&&D.traverseVisible(function(G){G.isLight&&G.layers.test(B.layers)&&(m.pushLight(G),G.castShadow&&m.pushShadow(G))}),m.setupLights(v._useLegacyLights);const X=new Set;return D.traverse(function(G){const he=G.material;if(he)if(Array.isArray(he))for(let ye=0;ye<he.length;ye++){const we=he[ye];Ze(we,W,G),X.add(we)}else Ze(he,W,G),X.add(he)}),E.pop(),m=null,X},this.compileAsync=function(D,B,W=null){const X=this.compile(D,B,W);return new Promise(G=>{function he(){if(X.forEach(function(ye){w.get(ye).currentProgram.isReady()&&X.delete(ye)}),X.size===0){G(D);return}setTimeout(he,10)}xe.get("KHR_parallel_shader_compile")!==null?he():setTimeout(he,10)})};let lt=null;function $e(D){lt&&lt(D)}function it(){Dt.stop()}function rt(){Dt.start()}const Dt=new nc;Dt.setAnimationLoop($e),typeof self<"u"&&Dt.setContext(self),this.setAnimationLoop=function(D){lt=D,x.setAnimationLoop(D),D===null?Dt.stop():Dt.start()},x.addEventListener("sessionstart",it),x.addEventListener("sessionend",rt),this.render=function(D,B){if(B!==void 0&&B.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(b===!0)return;D.matrixWorldAutoUpdate===!0&&D.updateMatrixWorld(),B.parent===null&&B.matrixWorldAutoUpdate===!0&&B.updateMatrixWorld(),x.enabled===!0&&x.isPresenting===!0&&(x.cameraAutoUpdate===!0&&x.updateCamera(B),B=x.getCamera()),D.isScene===!0&&D.onBeforeRender(v,D,B,A),m=oe.get(D,E.length),m.init(),E.push(m),ce.multiplyMatrices(B.projectionMatrix,B.matrixWorldInverse),me.setFromProjectionMatrix(ce),Q=this.localClippingEnabled,O=fe.init(this.clippingPlanes,Q),_=Ae.get(D,p.length),_.init(),p.push(_),Pt(D,B,0,v.sortObjects),_.finish(),v.sortObjects===!0&&_.sort(z,Y),this.info.render.frame++,O===!0&&fe.beginShadows();const W=m.state.shadowsArray;if(Re.render(W,D,B),O===!0&&fe.endShadows(),this.info.autoReset===!0&&this.info.reset(),(x.enabled===!1||x.isPresenting===!1||x.hasDepthSensing()===!1)&&ge.render(_,D),m.setupLights(v._useLegacyLights),B.isArrayCamera){const X=B.cameras;for(let G=0,he=X.length;G<he;G++){const ye=X[G];nn(_,D,ye,ye.viewport)}}else nn(_,D,B);A!==null&&(y.updateMultisampleRenderTarget(A),y.updateRenderTargetMipmap(A)),D.isScene===!0&&D.onAfterRender(v,D,B),Xe.resetDefaultState(),P=-1,S=null,E.pop(),E.length>0?m=E[E.length-1]:m=null,p.pop(),p.length>0?_=p[p.length-1]:_=null};function Pt(D,B,W,X){if(D.visible===!1)return;if(D.layers.test(B.layers)){if(D.isGroup)W=D.renderOrder;else if(D.isLOD)D.autoUpdate===!0&&D.update(B);else if(D.isLight)m.pushLight(D),D.castShadow&&m.pushShadow(D);else if(D.isSprite){if(!D.frustumCulled||me.intersectsSprite(D)){X&&ve.setFromMatrixPosition(D.matrixWorld).applyMatrix4(ce);const ye=De.update(D),we=D.material;we.visible&&_.push(D,ye,we,W,ve.z,null)}}else if((D.isMesh||D.isLine||D.isPoints)&&(!D.frustumCulled||me.intersectsObject(D))){const ye=De.update(D),we=D.material;if(X&&(D.boundingSphere!==void 0?(D.boundingSphere===null&&D.computeBoundingSphere(),ve.copy(D.boundingSphere.center)):(ye.boundingSphere===null&&ye.computeBoundingSphere(),ve.copy(ye.boundingSphere.center)),ve.applyMatrix4(D.matrixWorld).applyMatrix4(ce)),Array.isArray(we)){const Pe=ye.groups;for(let Ie=0,Le=Pe.length;Ie<Le;Ie++){const Ne=Pe[Ie],tt=we[Ne.materialIndex];tt&&tt.visible&&_.push(D,ye,tt,W,ve.z,Ne)}}else we.visible&&_.push(D,ye,we,W,ve.z,null)}}const he=D.children;for(let ye=0,we=he.length;ye<we;ye++)Pt(he[ye],B,W,X)}function nn(D,B,W,X){const G=D.opaque,he=D.transmissive,ye=D.transparent;m.setupLightsView(W),O===!0&&fe.setGlobalState(v.clippingPlanes,W),he.length>0&&On(G,he,B,W),X&&Ee.viewport(M.copy(X)),G.length>0&&vn(G,B,W),he.length>0&&vn(he,B,W),ye.length>0&&vn(ye,B,W),Ee.buffers.depth.setTest(!0),Ee.buffers.depth.setMask(!0),Ee.buffers.color.setMask(!0),Ee.setPolygonOffset(!1)}function On(D,B,W,X){if((W.isScene===!0?W.overrideMaterial:null)!==null)return;if(m.state.transmissionRenderTarget===null){m.state.transmissionRenderTarget=new Vt(1,1,{generateMipmaps:!0,type:xe.has("EXT_color_buffer_half_float")||xe.has("EXT_color_buffer_float")?gn:mn,minFilter:Ln,samples:4,stencilBuffer:s});const Ie=w.get(m.state.transmissionRenderTarget);Ie.__isTransmissionRenderTarget=!0}const he=m.state.transmissionRenderTarget;v.getDrawingBufferSize(ne),he.setSize(ne.x,ne.y);const ye=v.getRenderTarget();v.setRenderTarget(he),v.getClearColor(C),N=v.getClearAlpha(),N<1&&v.setClearColor(16777215,.5),v.clear();const we=v.toneMapping;v.toneMapping=pn,vn(D,W,X),y.updateMultisampleRenderTarget(he),y.updateRenderTargetMipmap(he);let Pe=!1;for(let Ie=0,Le=B.length;Ie<Le;Ie++){const Ne=B[Ie],tt=Ne.object,At=Ne.geometry,ct=Ne.material,qt=Ne.group;if(ct.side===Wt&&tt.layers.test(X.layers)){const Qe=ct.side;ct.side=yt,ct.needsUpdate=!0,oa(tt,W,X,At,ct,qt),ct.side=Qe,ct.needsUpdate=!0,Pe=!0}}Pe===!0&&(y.updateMultisampleRenderTarget(he),y.updateRenderTargetMipmap(he)),v.setRenderTarget(ye),v.setClearColor(C,N),v.toneMapping=we}function vn(D,B,W){const X=B.isScene===!0?B.overrideMaterial:null;for(let G=0,he=D.length;G<he;G++){const ye=D[G],we=ye.object,Pe=ye.geometry,Ie=X===null?ye.material:X,Le=ye.group;we.layers.test(W.layers)&&oa(we,B,W,Pe,Ie,Le)}}function oa(D,B,W,X,G,he){D.onBeforeRender(v,B,W,X,G,he),D.modelViewMatrix.multiplyMatrices(W.matrixWorldInverse,D.matrixWorld),D.normalMatrix.getNormalMatrix(D.modelViewMatrix),G.onBeforeRender(v,B,W,X,D,he),G.transparent===!0&&G.side===Wt&&G.forceSinglePass===!1?(G.side=yt,G.needsUpdate=!0,v.renderBufferDirect(W,B,X,G,D,he),G.side=_n,G.needsUpdate=!0,v.renderBufferDirect(W,B,X,G,D,he),G.side=Wt):v.renderBufferDirect(W,B,X,G,D,he),D.onAfterRender(v,B,W,X,G,he)}function Xi(D,B,W){B.isScene!==!0&&(B=Te);const X=w.get(D),G=m.state.lights,he=m.state.shadowsArray,ye=G.state.version,we=re.getParameters(D,G.state,he,B,W),Pe=re.getProgramCacheKey(we);let Ie=X.programs;X.environment=D.isMeshStandardMaterial?B.environment:null,X.fog=B.fog,X.envMap=(D.isMeshStandardMaterial?Z:q).get(D.envMap||X.environment),X.envMapRotation=X.environment!==null&&D.envMap===null?B.environmentRotation:D.envMapRotation,Ie===void 0&&(D.addEventListener("dispose",pe),Ie=new Map,X.programs=Ie);let Le=Ie.get(Pe);if(Le!==void 0){if(X.currentProgram===Le&&X.lightsStateVersion===ye)return ca(D,we),Le}else we.uniforms=re.getUniforms(D),D.onBuild(W,we,v),D.onBeforeCompile(we,v),Le=re.acquireProgram(we,Pe),Ie.set(Pe,Le),X.uniforms=we.uniforms;const Ne=X.uniforms;return(!D.isShaderMaterial&&!D.isRawShaderMaterial||D.clipping===!0)&&(Ne.clippingPlanes=fe.uniform),ca(D,we),X.needsLights=Cc(D),X.lightsStateVersion=ye,X.needsLights&&(Ne.ambientLightColor.value=G.state.ambient,Ne.lightProbe.value=G.state.probe,Ne.directionalLights.value=G.state.directional,Ne.directionalLightShadows.value=G.state.directionalShadow,Ne.spotLights.value=G.state.spot,Ne.spotLightShadows.value=G.state.spotShadow,Ne.rectAreaLights.value=G.state.rectArea,Ne.ltc_1.value=G.state.rectAreaLTC1,Ne.ltc_2.value=G.state.rectAreaLTC2,Ne.pointLights.value=G.state.point,Ne.pointLightShadows.value=G.state.pointShadow,Ne.hemisphereLights.value=G.state.hemi,Ne.directionalShadowMap.value=G.state.directionalShadowMap,Ne.directionalShadowMatrix.value=G.state.directionalShadowMatrix,Ne.spotShadowMap.value=G.state.spotShadowMap,Ne.spotLightMatrix.value=G.state.spotLightMatrix,Ne.spotLightMap.value=G.state.spotLightMap,Ne.pointShadowMap.value=G.state.pointShadowMap,Ne.pointShadowMatrix.value=G.state.pointShadowMatrix),X.currentProgram=Le,X.uniformsList=null,Le}function la(D){if(D.uniformsList===null){const B=D.currentProgram.getUniforms();D.uniformsList=Tr.seqWithValue(B.seq,D.uniforms)}return D.uniformsList}function ca(D,B){const W=w.get(D);W.outputColorSpace=B.outputColorSpace,W.batching=B.batching,W.instancing=B.instancing,W.instancingColor=B.instancingColor,W.instancingMorph=B.instancingMorph,W.skinning=B.skinning,W.morphTargets=B.morphTargets,W.morphNormals=B.morphNormals,W.morphColors=B.morphColors,W.morphTargetsCount=B.morphTargetsCount,W.numClippingPlanes=B.numClippingPlanes,W.numIntersection=B.numClipIntersection,W.vertexAlphas=B.vertexAlphas,W.vertexTangents=B.vertexTangents,W.toneMapping=B.toneMapping}function Ac(D,B,W,X,G){B.isScene!==!0&&(B=Te),y.resetTextureUnits();const he=B.fog,ye=X.isMeshStandardMaterial?B.environment:null,we=A===null?v.outputColorSpace:A.isXRRenderTarget===!0?A.texture.colorSpace:xn,Pe=(X.isMeshStandardMaterial?Z:q).get(X.envMap||ye),Ie=X.vertexColors===!0&&!!W.attributes.color&&W.attributes.color.itemSize===4,Le=!!W.attributes.tangent&&(!!X.normalMap||X.anisotropy>0),Ne=!!W.morphAttributes.position,tt=!!W.morphAttributes.normal,At=!!W.morphAttributes.color;let ct=pn;X.toneMapped&&(A===null||A.isXRRenderTarget===!0)&&(ct=v.toneMapping);const qt=W.morphAttributes.position||W.morphAttributes.normal||W.morphAttributes.color,Qe=qt!==void 0?qt.length:0,Ue=w.get(X),Gr=m.state.lights;if(O===!0&&(Q===!0||D!==S)){const Lt=D===S&&X.id===P;fe.setState(X,D,Lt)}let Je=!1;X.version===Ue.__version?(Ue.needsLights&&Ue.lightsStateVersion!==Gr.state.version||Ue.outputColorSpace!==we||G.isBatchedMesh&&Ue.batching===!1||!G.isBatchedMesh&&Ue.batching===!0||G.isInstancedMesh&&Ue.instancing===!1||!G.isInstancedMesh&&Ue.instancing===!0||G.isSkinnedMesh&&Ue.skinning===!1||!G.isSkinnedMesh&&Ue.skinning===!0||G.isInstancedMesh&&Ue.instancingColor===!0&&G.instanceColor===null||G.isInstancedMesh&&Ue.instancingColor===!1&&G.instanceColor!==null||G.isInstancedMesh&&Ue.instancingMorph===!0&&G.morphTexture===null||G.isInstancedMesh&&Ue.instancingMorph===!1&&G.morphTexture!==null||Ue.envMap!==Pe||X.fog===!0&&Ue.fog!==he||Ue.numClippingPlanes!==void 0&&(Ue.numClippingPlanes!==fe.numPlanes||Ue.numIntersection!==fe.numIntersection)||Ue.vertexAlphas!==Ie||Ue.vertexTangents!==Le||Ue.morphTargets!==Ne||Ue.morphNormals!==tt||Ue.morphColors!==At||Ue.toneMapping!==ct||Ue.morphTargetsCount!==Qe)&&(Je=!0):(Je=!0,Ue.__version=X.version);let Mn=Ue.currentProgram;Je===!0&&(Mn=Xi(X,B,G));let ua=!1,yi=!1,Wr=!1;const pt=Mn.getUniforms(),rn=Ue.uniforms;if(Ee.useProgram(Mn.program)&&(ua=!0,yi=!0,Wr=!0),X.id!==P&&(P=X.id,yi=!0),ua||S!==D){pt.setValue(k,"projectionMatrix",D.projectionMatrix),pt.setValue(k,"viewMatrix",D.matrixWorldInverse);const Lt=pt.map.cameraPosition;Lt!==void 0&&Lt.setValue(k,ve.setFromMatrixPosition(D.matrixWorld)),Ge.logarithmicDepthBuffer&&pt.setValue(k,"logDepthBufFC",2/(Math.log(D.far+1)/Math.LN2)),(X.isMeshPhongMaterial||X.isMeshToonMaterial||X.isMeshLambertMaterial||X.isMeshBasicMaterial||X.isMeshStandardMaterial||X.isShaderMaterial)&&pt.setValue(k,"isOrthographic",D.isOrthographicCamera===!0),S!==D&&(S=D,yi=!0,Wr=!0)}if(G.isSkinnedMesh){pt.setOptional(k,G,"bindMatrix"),pt.setOptional(k,G,"bindMatrixInverse");const Lt=G.skeleton;Lt&&(Lt.boneTexture===null&&Lt.computeBoneTexture(),pt.setValue(k,"boneTexture",Lt.boneTexture,y))}G.isBatchedMesh&&(pt.setOptional(k,G,"batchingTexture"),pt.setValue(k,"batchingTexture",G._matricesTexture,y));const Xr=W.morphAttributes;if((Xr.position!==void 0||Xr.normal!==void 0||Xr.color!==void 0)&&_e.update(G,W,Mn),(yi||Ue.receiveShadow!==G.receiveShadow)&&(Ue.receiveShadow=G.receiveShadow,pt.setValue(k,"receiveShadow",G.receiveShadow)),X.isMeshGouraudMaterial&&X.envMap!==null&&(rn.envMap.value=Pe,rn.flipEnvMap.value=Pe.isCubeTexture&&Pe.isRenderTargetTexture===!1?-1:1),X.isMeshStandardMaterial&&X.envMap===null&&B.environment!==null&&(rn.envMapIntensity.value=B.environmentIntensity),yi&&(pt.setValue(k,"toneMappingExposure",v.toneMappingExposure),Ue.needsLights&&wc(rn,Wr),he&&X.fog===!0&&Se.refreshFogUniforms(rn,he),Se.refreshMaterialUniforms(rn,X,J,j,m.state.transmissionRenderTarget),Tr.upload(k,la(Ue),rn,y)),X.isShaderMaterial&&X.uniformsNeedUpdate===!0&&(Tr.upload(k,la(Ue),rn,y),X.uniformsNeedUpdate=!1),X.isSpriteMaterial&&pt.setValue(k,"center",G.center),pt.setValue(k,"modelViewMatrix",G.modelViewMatrix),pt.setValue(k,"normalMatrix",G.normalMatrix),pt.setValue(k,"modelMatrix",G.matrixWorld),X.isShaderMaterial||X.isRawShaderMaterial){const Lt=X.uniformsGroups;for(let qr=0,Rc=Lt.length;qr<Rc;qr++){const ha=Lt[qr];je.update(ha,Mn),je.bind(ha,Mn)}}return Mn}function wc(D,B){D.ambientLightColor.needsUpdate=B,D.lightProbe.needsUpdate=B,D.directionalLights.needsUpdate=B,D.directionalLightShadows.needsUpdate=B,D.pointLights.needsUpdate=B,D.pointLightShadows.needsUpdate=B,D.spotLights.needsUpdate=B,D.spotLightShadows.needsUpdate=B,D.rectAreaLights.needsUpdate=B,D.hemisphereLights.needsUpdate=B}function Cc(D){return D.isMeshLambertMaterial||D.isMeshToonMaterial||D.isMeshPhongMaterial||D.isMeshStandardMaterial||D.isShadowMaterial||D.isShaderMaterial&&D.lights===!0}this.getActiveCubeFace=function(){return R},this.getActiveMipmapLevel=function(){return T},this.getRenderTarget=function(){return A},this.setRenderTargetTextures=function(D,B,W){w.get(D.texture).__webglTexture=B,w.get(D.depthTexture).__webglTexture=W;const X=w.get(D);X.__hasExternalTextures=!0,X.__autoAllocateDepthBuffer=W===void 0,X.__autoAllocateDepthBuffer||xe.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),X.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(D,B){const W=w.get(D);W.__webglFramebuffer=B,W.__useDefaultFramebuffer=B===void 0},this.setRenderTarget=function(D,B=0,W=0){A=D,R=B,T=W;let X=!0,G=null,he=!1,ye=!1;if(D){const Pe=w.get(D);Pe.__useDefaultFramebuffer!==void 0?(Ee.bindFramebuffer(k.FRAMEBUFFER,null),X=!1):Pe.__webglFramebuffer===void 0?y.setupRenderTarget(D):Pe.__hasExternalTextures&&y.rebindTextures(D,w.get(D.texture).__webglTexture,w.get(D.depthTexture).__webglTexture);const Ie=D.texture;(Ie.isData3DTexture||Ie.isDataArrayTexture||Ie.isCompressedArrayTexture)&&(ye=!0);const Le=w.get(D).__webglFramebuffer;D.isWebGLCubeRenderTarget?(Array.isArray(Le[B])?G=Le[B][W]:G=Le[B],he=!0):D.samples>0&&y.useMultisampledRTT(D)===!1?G=w.get(D).__webglMultisampledFramebuffer:Array.isArray(Le)?G=Le[W]:G=Le,M.copy(D.viewport),F.copy(D.scissor),L=D.scissorTest}else M.copy($).multiplyScalar(J).floor(),F.copy(U).multiplyScalar(J).floor(),L=ee;if(Ee.bindFramebuffer(k.FRAMEBUFFER,G)&&X&&Ee.drawBuffers(D,G),Ee.viewport(M),Ee.scissor(F),Ee.setScissorTest(L),he){const Pe=w.get(D.texture);k.framebufferTexture2D(k.FRAMEBUFFER,k.COLOR_ATTACHMENT0,k.TEXTURE_CUBE_MAP_POSITIVE_X+B,Pe.__webglTexture,W)}else if(ye){const Pe=w.get(D.texture),Ie=B||0;k.framebufferTextureLayer(k.FRAMEBUFFER,k.COLOR_ATTACHMENT0,Pe.__webglTexture,W||0,Ie)}P=-1},this.readRenderTargetPixels=function(D,B,W,X,G,he,ye){if(!(D&&D.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let we=w.get(D).__webglFramebuffer;if(D.isWebGLCubeRenderTarget&&ye!==void 0&&(we=we[ye]),we){Ee.bindFramebuffer(k.FRAMEBUFFER,we);try{const Pe=D.texture,Ie=Pe.format,Le=Pe.type;if(Ie!==Xt&&qe.convert(Ie)!==k.getParameter(k.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const Ne=Le===gn&&(xe.has("EXT_color_buffer_half_float")||xe.has("EXT_color_buffer_float"));if(Le!==mn&&qe.convert(Le)!==k.getParameter(k.IMPLEMENTATION_COLOR_READ_TYPE)&&Le!==fn&&!Ne){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}B>=0&&B<=D.width-X&&W>=0&&W<=D.height-G&&k.readPixels(B,W,X,G,qe.convert(Ie),qe.convert(Le),he)}finally{const Pe=A!==null?w.get(A).__webglFramebuffer:null;Ee.bindFramebuffer(k.FRAMEBUFFER,Pe)}}},this.copyFramebufferToTexture=function(D,B,W=0){const X=Math.pow(2,-W),G=Math.floor(B.image.width*X),he=Math.floor(B.image.height*X);y.setTexture2D(B,0),k.copyTexSubImage2D(k.TEXTURE_2D,W,0,0,D.x,D.y,G,he),Ee.unbindTexture()},this.copyTextureToTexture=function(D,B,W,X=0){const G=B.image.width,he=B.image.height,ye=qe.convert(W.format),we=qe.convert(W.type);y.setTexture2D(W,0),k.pixelStorei(k.UNPACK_FLIP_Y_WEBGL,W.flipY),k.pixelStorei(k.UNPACK_PREMULTIPLY_ALPHA_WEBGL,W.premultiplyAlpha),k.pixelStorei(k.UNPACK_ALIGNMENT,W.unpackAlignment),B.isDataTexture?k.texSubImage2D(k.TEXTURE_2D,X,D.x,D.y,G,he,ye,we,B.image.data):B.isCompressedTexture?k.compressedTexSubImage2D(k.TEXTURE_2D,X,D.x,D.y,B.mipmaps[0].width,B.mipmaps[0].height,ye,B.mipmaps[0].data):k.texSubImage2D(k.TEXTURE_2D,X,D.x,D.y,ye,we,B.image),X===0&&W.generateMipmaps&&k.generateMipmap(k.TEXTURE_2D),Ee.unbindTexture()},this.copyTextureToTexture3D=function(D,B,W,X,G=0){const he=Math.round(D.max.x-D.min.x),ye=Math.round(D.max.y-D.min.y),we=D.max.z-D.min.z+1,Pe=qe.convert(X.format),Ie=qe.convert(X.type);let Le;if(X.isData3DTexture)y.setTexture3D(X,0),Le=k.TEXTURE_3D;else if(X.isDataArrayTexture||X.isCompressedArrayTexture)y.setTexture2DArray(X,0),Le=k.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}k.pixelStorei(k.UNPACK_FLIP_Y_WEBGL,X.flipY),k.pixelStorei(k.UNPACK_PREMULTIPLY_ALPHA_WEBGL,X.premultiplyAlpha),k.pixelStorei(k.UNPACK_ALIGNMENT,X.unpackAlignment);const Ne=k.getParameter(k.UNPACK_ROW_LENGTH),tt=k.getParameter(k.UNPACK_IMAGE_HEIGHT),At=k.getParameter(k.UNPACK_SKIP_PIXELS),ct=k.getParameter(k.UNPACK_SKIP_ROWS),qt=k.getParameter(k.UNPACK_SKIP_IMAGES),Qe=W.isCompressedTexture?W.mipmaps[G]:W.image;k.pixelStorei(k.UNPACK_ROW_LENGTH,Qe.width),k.pixelStorei(k.UNPACK_IMAGE_HEIGHT,Qe.height),k.pixelStorei(k.UNPACK_SKIP_PIXELS,D.min.x),k.pixelStorei(k.UNPACK_SKIP_ROWS,D.min.y),k.pixelStorei(k.UNPACK_SKIP_IMAGES,D.min.z),W.isDataTexture||W.isData3DTexture?k.texSubImage3D(Le,G,B.x,B.y,B.z,he,ye,we,Pe,Ie,Qe.data):X.isCompressedArrayTexture?k.compressedTexSubImage3D(Le,G,B.x,B.y,B.z,he,ye,we,Pe,Qe.data):k.texSubImage3D(Le,G,B.x,B.y,B.z,he,ye,we,Pe,Ie,Qe),k.pixelStorei(k.UNPACK_ROW_LENGTH,Ne),k.pixelStorei(k.UNPACK_IMAGE_HEIGHT,tt),k.pixelStorei(k.UNPACK_SKIP_PIXELS,At),k.pixelStorei(k.UNPACK_SKIP_ROWS,ct),k.pixelStorei(k.UNPACK_SKIP_IMAGES,qt),G===0&&X.generateMipmaps&&k.generateMipmap(Le),Ee.unbindTexture()},this.initTexture=function(D){D.isCubeTexture?y.setTextureCube(D,0):D.isData3DTexture?y.setTexture3D(D,0):D.isDataArrayTexture||D.isCompressedArrayTexture?y.setTexture2DArray(D,0):y.setTexture2D(D,0),Ee.unbindTexture()},this.resetState=function(){R=0,T=0,A=null,Ee.reset(),Xe.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Qt}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=e===ta?"display-p3":"srgb",t.unpackColorSpace=Ye.workingColorSpace===Or?"display-p3":"srgb"}get useLegacyLights(){return console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights}set useLegacyLights(e){console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights=e}}class Vr{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new be(e),this.density=t}clone(){return new Vr(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class hc extends St{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new In,this.environmentIntensity=1,this.environmentRotation=new In,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}class js extends vi{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new be(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}const jo=new I,$o=new I,Yo=new et,Ts=new Br,gr=new Vi;class dc extends St{constructor(e=new _t,t=new js){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=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[0];for(let r=1,s=t.count;r<s;r++)jo.fromBufferAttribute(t,r-1),$o.fromBufferAttribute(t,r),n[r]=n[r-1],n[r]+=jo.distanceTo($o);e.setAttribute("lineDistance",new nt(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const n=this.geometry,r=this.matrixWorld,s=e.params.Line.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),gr.copy(n.boundingSphere),gr.applyMatrix4(r),gr.radius+=s,e.ray.intersectsSphere(gr)===!1)return;Yo.copy(r).invert(),Ts.copy(e.ray).applyMatrix4(Yo);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=new I,u=new I,d=new I,h=new I,f=this.isLineSegments?2:1,g=n.index,m=n.attributes.position;if(g!==null){const p=Math.max(0,a.start),E=Math.min(g.count,a.start+a.count);for(let v=p,b=E-1;v<b;v+=f){const R=g.getX(v),T=g.getX(v+1);if(c.fromBufferAttribute(m,R),u.fromBufferAttribute(m,T),Ts.distanceSqToSegment(c,u,h,d)>l)continue;h.applyMatrix4(this.matrixWorld);const P=e.ray.origin.distanceTo(h);P<e.near||P>e.far||t.push({distance:P,point:d.clone().applyMatrix4(this.matrixWorld),index:v,face:null,faceIndex:null,object:this})}}else{const p=Math.max(0,a.start),E=Math.min(m.count,a.start+a.count);for(let v=p,b=E-1;v<b;v+=f){if(c.fromBufferAttribute(m,v),u.fromBufferAttribute(m,v+1),Ts.distanceSqToSegment(c,u,h,d)>l)continue;h.applyMatrix4(this.matrixWorld);const T=e.ray.origin.distanceTo(h);T<e.near||T>e.far||t.push({distance:T,point:d.clone().applyMatrix4(this.matrixWorld),index:v,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){const o=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}}const Ko=new I,Zo=new I;class F0 extends dc{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[];for(let r=0,s=t.count;r<s;r+=2)Ko.fromBufferAttribute(t,r),Zo.fromBufferAttribute(t,r+1),n[r]=r===0?0:n[r-1],n[r+1]=n[r]+Ko.distanceTo(Zo);e.setAttribute("lineDistance",new nt(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class I0 extends vi{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new be(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}const Jo=new et,$s=new Br,_r=new Vi,xr=new I;class N0 extends St{constructor(e=new _t,t=new I0){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){const n=this.geometry,r=this.matrixWorld,s=e.params.Points.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),_r.copy(n.boundingSphere),_r.applyMatrix4(r),_r.radius+=s,e.ray.intersectsSphere(_r)===!1)return;Jo.copy(r).invert(),$s.copy(e.ray).applyMatrix4(Jo);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=n.index,d=n.attributes.position;if(c!==null){const h=Math.max(0,a.start),f=Math.min(c.count,a.start+a.count);for(let g=h,_=f;g<_;g++){const m=c.getX(g);xr.fromBufferAttribute(d,m),Qo(xr,m,l,r,e,t,this)}}else{const h=Math.max(0,a.start),f=Math.min(d.count,a.start+a.count);for(let g=h,_=f;g<_;g++)xr.fromBufferAttribute(d,g),Qo(xr,g,l,r,e,t,this)}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){const o=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}}function Qo(i,e,t,n,r,s,a){const o=$s.distanceSqToPoint(i);if(o<t){const l=new I;$s.closestPointToPoint(i,l),l.applyMatrix4(n);const c=r.ray.origin.distanceTo(l);if(c<r.near||c>r.far)return;s.push({distance:c,distanceToRay:Math.sqrt(o),point:l,index:e,face:null,object:a})}}class tn{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){const n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){const 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;const t=[];let n,r=this.getPoint(0),s=0;t.push(0);for(let a=1;a<=e;a++)n=this.getPoint(a/e),s+=n.distanceTo(r),t.push(s),r=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){const n=this.getLengths();let r=0;const s=n.length;let a;t?a=t:a=e*n[s-1];let o=0,l=s-1,c;for(;o<=l;)if(r=Math.floor(o+(l-o)/2),c=n[r]-a,c<0)o=r+1;else if(c>0)l=r-1;else{l=r;break}if(r=l,n[r]===a)return r/(s-1);const u=n[r],h=n[r+1]-u,f=(a-u)/h;return(r+f)/(s-1)}getTangent(e,t){let r=e-1e-4,s=e+1e-4;r<0&&(r=0),s>1&&(s=1);const a=this.getPoint(r),o=this.getPoint(s),l=t||(a.isVector2?new ue:new I);return l.copy(o).sub(a).normalize(),l}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t){const n=new I,r=[],s=[],a=[],o=new I,l=new et;for(let f=0;f<=e;f++){const g=f/e;r[f]=this.getTangentAt(g,new I)}s[0]=new I,a[0]=new I;let c=Number.MAX_VALUE;const u=Math.abs(r[0].x),d=Math.abs(r[0].y),h=Math.abs(r[0].z);u<=c&&(c=u,n.set(1,0,0)),d<=c&&(c=d,n.set(0,1,0)),h<=c&&n.set(0,0,1),o.crossVectors(r[0],n).normalize(),s[0].crossVectors(r[0],o),a[0].crossVectors(r[0],s[0]);for(let f=1;f<=e;f++){if(s[f]=s[f-1].clone(),a[f]=a[f-1].clone(),o.crossVectors(r[f-1],r[f]),o.length()>Number.EPSILON){o.normalize();const g=Math.acos(ht(r[f-1].dot(r[f]),-1,1));s[f].applyMatrix4(l.makeRotationAxis(o,g))}a[f].crossVectors(r[f],s[f])}if(t===!0){let f=Math.acos(ht(s[0].dot(s[e]),-1,1));f/=e,r[0].dot(o.crossVectors(s[0],s[e]))>0&&(f=-f);for(let g=1;g<=e;g++)s[g].applyMatrix4(l.makeRotationAxis(r[g],f*g)),a[g].crossVectors(r[g],s[g])}return{tangents:r,normals:s,binormals:a}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class fc extends tn{constructor(e=0,t=0,n=1,r=1,s=0,a=Math.PI*2,o=!1,l=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=r,this.aStartAngle=s,this.aEndAngle=a,this.aClockwise=o,this.aRotation=l}getPoint(e,t=new ue){const n=t,r=Math.PI*2;let s=this.aEndAngle-this.aStartAngle;const a=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=r;for(;s>r;)s-=r;s<Number.EPSILON&&(a?s=0:s=r),this.aClockwise===!0&&!a&&(s===r?s=-r:s=s-r);const o=this.aStartAngle+e*s;let l=this.aX+this.xRadius*Math.cos(o),c=this.aY+this.yRadius*Math.sin(o);if(this.aRotation!==0){const u=Math.cos(this.aRotation),d=Math.sin(this.aRotation),h=l-this.aX,f=c-this.aY;l=h*u-f*d+this.aX,c=h*d+f*u+this.aY}return n.set(l,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(){const 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}}class U0 extends fc{constructor(e,t,n,r,s,a){super(e,t,n,n,r,s,a),this.isArcCurve=!0,this.type="ArcCurve"}}function ra(){let i=0,e=0,t=0,n=0;function r(s,a,o,l){i=s,e=o,t=-3*s+3*a-2*o-l,n=2*s-2*a+o+l}return{initCatmullRom:function(s,a,o,l,c){r(a,o,c*(o-s),c*(l-a))},initNonuniformCatmullRom:function(s,a,o,l,c,u,d){let h=(a-s)/c-(o-s)/(c+u)+(o-a)/u,f=(o-a)/u-(l-a)/(u+d)+(l-o)/d;h*=u,f*=u,r(a,o,h,f)},calc:function(s){const a=s*s,o=a*s;return i+e*s+t*a+n*o}}}const vr=new I,Ds=new ra,As=new ra,ws=new ra;class pc extends tn{constructor(e=[],t=!1,n="centripetal",r=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=n,this.tension=r}getPoint(e,t=new I){const n=t,r=this.points,s=r.length,a=(s-(this.closed?0:1))*e;let o=Math.floor(a),l=a-o;this.closed?o+=o>0?0:(Math.floor(Math.abs(o)/s)+1)*s:l===0&&o===s-1&&(o=s-2,l=1);let c,u;this.closed||o>0?c=r[(o-1)%s]:(vr.subVectors(r[0],r[1]).add(r[0]),c=vr);const d=r[o%s],h=r[(o+1)%s];if(this.closed||o+2<s?u=r[(o+2)%s]:(vr.subVectors(r[s-1],r[s-2]).add(r[s-1]),u=vr),this.curveType==="centripetal"||this.curveType==="chordal"){const f=this.curveType==="chordal"?.5:.25;let g=Math.pow(c.distanceToSquared(d),f),_=Math.pow(d.distanceToSquared(h),f),m=Math.pow(h.distanceToSquared(u),f);_<1e-4&&(_=1),g<1e-4&&(g=_),m<1e-4&&(m=_),Ds.initNonuniformCatmullRom(c.x,d.x,h.x,u.x,g,_,m),As.initNonuniformCatmullRom(c.y,d.y,h.y,u.y,g,_,m),ws.initNonuniformCatmullRom(c.z,d.z,h.z,u.z,g,_,m)}else this.curveType==="catmullrom"&&(Ds.initCatmullRom(c.x,d.x,h.x,u.x,this.tension),As.initCatmullRom(c.y,d.y,h.y,u.y,this.tension),ws.initCatmullRom(c.z,d.z,h.z,u.z,this.tension));return n.set(Ds.calc(l),As.calc(l),ws.calc(l)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const r=e.points[t];this.points.push(r.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const r=this.points[t];e.points.push(r.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const r=e.points[t];this.points.push(new I().fromArray(r))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}function el(i,e,t,n,r){const s=(n-e)*.5,a=(r-t)*.5,o=i*i,l=i*o;return(2*t-2*n+s+a)*l+(-3*t+3*n-2*s-a)*o+s*i+t}function O0(i,e){const t=1-i;return t*t*e}function B0(i,e){return 2*(1-i)*i*e}function z0(i,e){return i*i*e}function Li(i,e,t,n){return O0(i,e)+B0(i,t)+z0(i,n)}function k0(i,e){const t=1-i;return t*t*t*e}function V0(i,e){const t=1-i;return 3*t*t*i*e}function H0(i,e){return 3*(1-i)*i*i*e}function G0(i,e){return i*i*i*e}function Fi(i,e,t,n,r){return k0(i,e)+V0(i,t)+H0(i,n)+G0(i,r)}class W0 extends tn{constructor(e=new ue,t=new ue,n=new ue,r=new ue){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=n,this.v3=r}getPoint(e,t=new ue){const n=t,r=this.v0,s=this.v1,a=this.v2,o=this.v3;return n.set(Fi(e,r.x,s.x,a.x,o.x),Fi(e,r.y,s.y,a.y,o.y)),n}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(){const 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}}class X0 extends tn{constructor(e=new I,t=new I,n=new I,r=new I){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=n,this.v3=r}getPoint(e,t=new I){const n=t,r=this.v0,s=this.v1,a=this.v2,o=this.v3;return n.set(Fi(e,r.x,s.x,a.x,o.x),Fi(e,r.y,s.y,a.y,o.y),Fi(e,r.z,s.z,a.z,o.z)),n}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(){const 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}}class q0 extends tn{constructor(e=new ue,t=new ue){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new ue){const n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new ue){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const 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}}class j0 extends tn{constructor(e=new I,t=new I){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new I){const n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new I){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const 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}}class $0 extends tn{constructor(e=new ue,t=new ue,n=new ue){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new ue){const n=t,r=this.v0,s=this.v1,a=this.v2;return n.set(Li(e,r.x,s.x,a.x),Li(e,r.y,s.y,a.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const 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}}class mc extends tn{constructor(e=new I,t=new I,n=new I){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new I){const n=t,r=this.v0,s=this.v1,a=this.v2;return n.set(Li(e,r.x,s.x,a.x),Li(e,r.y,s.y,a.y),Li(e,r.z,s.z,a.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const 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}}class Y0 extends tn{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new ue){const n=t,r=this.points,s=(r.length-1)*e,a=Math.floor(s),o=s-a,l=r[a===0?a:a-1],c=r[a],u=r[a>r.length-2?r.length-1:a+1],d=r[a>r.length-3?r.length-1:a+2];return n.set(el(o,l.x,c.x,u.x,d.x),el(o,l.y,c.y,u.y,d.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const r=e.points[t];this.points.push(r.clone())}return this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const r=this.points[t];e.points.push(r.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const r=e.points[t];this.points.push(new ue().fromArray(r))}return this}}var K0=Object.freeze({__proto__:null,ArcCurve:U0,CatmullRomCurve3:pc,CubicBezierCurve:W0,CubicBezierCurve3:X0,EllipseCurve:fc,LineCurve:q0,LineCurve3:j0,QuadraticBezierCurve:$0,QuadraticBezierCurve3:mc,SplineCurve:Y0});const Mr=new I,yr=new I,Cs=new I,Sr=new Ci;class Z0 extends _t{constructor(e=null,t=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:e,thresholdAngle:t},e!==null){const r=Math.pow(10,4),s=Math.cos(di*t),a=e.getIndex(),o=e.getAttribute("position"),l=a?a.count:o.count,c=[0,0,0],u=["a","b","c"],d=new Array(3),h={},f=[];for(let g=0;g<l;g+=3){a?(c[0]=a.getX(g),c[1]=a.getX(g+1),c[2]=a.getX(g+2)):(c[0]=g,c[1]=g+1,c[2]=g+2);const{a:_,b:m,c:p}=Sr;if(_.fromBufferAttribute(o,c[0]),m.fromBufferAttribute(o,c[1]),p.fromBufferAttribute(o,c[2]),Sr.getNormal(Cs),d[0]=`${Math.round(_.x*r)},${Math.round(_.y*r)},${Math.round(_.z*r)}`,d[1]=`${Math.round(m.x*r)},${Math.round(m.y*r)},${Math.round(m.z*r)}`,d[2]=`${Math.round(p.x*r)},${Math.round(p.y*r)},${Math.round(p.z*r)}`,!(d[0]===d[1]||d[1]===d[2]||d[2]===d[0]))for(let E=0;E<3;E++){const v=(E+1)%3,b=d[E],R=d[v],T=Sr[u[E]],A=Sr[u[v]],P=`${b}_${R}`,S=`${R}_${b}`;S in h&&h[S]?(Cs.dot(h[S].normal)<=s&&(f.push(T.x,T.y,T.z),f.push(A.x,A.y,A.z)),h[S]=null):P in h||(h[P]={index0:c[E],index1:c[v],normal:Cs.clone()})}}for(const g in h)if(h[g]){const{index0:_,index1:m}=h[g];Mr.fromBufferAttribute(o,_),yr.fromBufferAttribute(o,m),f.push(Mr.x,Mr.y,Mr.z),f.push(yr.x,yr.y,yr.z)}this.setAttribute("position",new nt(f,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}class sa extends _t{constructor(e=.5,t=1,n=32,r=1,s=0,a=Math.PI*2){super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:r,thetaStart:s,thetaLength:a},n=Math.max(3,n),r=Math.max(1,r);const o=[],l=[],c=[],u=[];let d=e;const h=(t-e)/r,f=new I,g=new ue;for(let _=0;_<=r;_++){for(let m=0;m<=n;m++){const p=s+m/n*a;f.x=d*Math.cos(p),f.y=d*Math.sin(p),l.push(f.x,f.y,f.z),c.push(0,0,1),g.x=(f.x/t+1)/2,g.y=(f.y/t+1)/2,u.push(g.x,g.y)}d+=h}for(let _=0;_<r;_++){const m=_*(n+1);for(let p=0;p<n;p++){const E=p+m,v=E,b=E+n+1,R=E+n+2,T=E+1;o.push(v,b,T),o.push(b,R,T)}}this.setIndex(o),this.setAttribute("position",new nt(l,3)),this.setAttribute("normal",new nt(c,3)),this.setAttribute("uv",new nt(u,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new sa(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}class Bi extends _t{constructor(e=1,t=32,n=16,r=0,s=Math.PI*2,a=0,o=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:r,phiLength:s,thetaStart:a,thetaLength:o},t=Math.max(3,Math.floor(t)),n=Math.max(2,Math.floor(n));const l=Math.min(a+o,Math.PI);let c=0;const u=[],d=new I,h=new I,f=[],g=[],_=[],m=[];for(let p=0;p<=n;p++){const E=[],v=p/n;let b=0;p===0&&a===0?b=.5/t:p===n&&l===Math.PI&&(b=-.5/t);for(let R=0;R<=t;R++){const T=R/t;d.x=-e*Math.cos(r+T*s)*Math.sin(a+v*o),d.y=e*Math.cos(a+v*o),d.z=e*Math.sin(r+T*s)*Math.sin(a+v*o),g.push(d.x,d.y,d.z),h.copy(d).normalize(),_.push(h.x,h.y,h.z),m.push(T+b,1-v),E.push(c++)}u.push(E)}for(let p=0;p<n;p++)for(let E=0;E<t;E++){const v=u[p][E+1],b=u[p][E],R=u[p+1][E],T=u[p+1][E+1];(p!==0||a>0)&&f.push(v,b,T),(p!==n-1||l<Math.PI)&&f.push(b,R,T)}this.setIndex(f),this.setAttribute("position",new nt(g,3)),this.setAttribute("normal",new nt(_,3)),this.setAttribute("uv",new nt(m,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Bi(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class aa extends _t{constructor(e=new mc(new I(-1,-1,0),new I(-1,1,0),new I(1,1,0)),t=64,n=1,r=8,s=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:r,closed:s};const a=e.computeFrenetFrames(t,s);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals;const o=new I,l=new I,c=new ue;let u=new I;const d=[],h=[],f=[],g=[];_(),this.setIndex(g),this.setAttribute("position",new nt(d,3)),this.setAttribute("normal",new nt(h,3)),this.setAttribute("uv",new nt(f,2));function _(){for(let v=0;v<t;v++)m(v);m(s===!1?t:0),E(),p()}function m(v){u=e.getPointAt(v/t,u);const b=a.normals[v],R=a.binormals[v];for(let T=0;T<=r;T++){const A=T/r*Math.PI*2,P=Math.sin(A),S=-Math.cos(A);l.x=S*b.x+P*R.x,l.y=S*b.y+P*R.y,l.z=S*b.z+P*R.z,l.normalize(),h.push(l.x,l.y,l.z),o.x=u.x+n*l.x,o.y=u.y+n*l.y,o.z=u.z+n*l.z,d.push(o.x,o.y,o.z)}}function p(){for(let v=1;v<=t;v++)for(let b=1;b<=r;b++){const R=(r+1)*(v-1)+(b-1),T=(r+1)*v+(b-1),A=(r+1)*v+b,P=(r+1)*(v-1)+b;g.push(R,T,P),g.push(T,A,P)}}function E(){for(let v=0;v<=t;v++)for(let b=0;b<=r;b++)c.x=v/t,c.y=b/r,f.push(c.x,c.y)}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON();return e.path=this.parameters.path.toJSON(),e}static fromJSON(e){return new aa(new K0[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}class gc{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=tl(),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){const t=tl();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function tl(){return(typeof performance>"u"?Date:performance).now()}class nl{constructor(e=1,t=0,n=0){return this.radius=e,this.phi=t,this.theta=n,this}set(e,t,n){return this.radius=e,this.phi=t,this.theta=n,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,n){return this.radius=Math.sqrt(e*e+t*t+n*n),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(ht(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Qs}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Qs);const il={type:"change"},Rs={type:"start"},rl={type:"end"},Er=new Br,sl=new hn,J0=Math.cos(70*Gl.DEG2RAD);class _c extends Un{constructor(e,t){super(),this.object=e,this.domElement=t,this.domElement.style.touchAction="none",this.enabled=!0,this.target=new I,this.cursor=new I,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minTargetRadius=0,this.maxTargetRadius=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:Vn.ROTATE,MIDDLE:Vn.DOLLY,RIGHT:Vn.PAN},this.touches={ONE:Hn.ROTATE,TWO:Hn.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this.getPolarAngle=function(){return o.phi},this.getAzimuthalAngle=function(){return o.theta},this.getDistance=function(){return this.object.position.distanceTo(this.target)},this.listenToKeyEvents=function(x){x.addEventListener("keydown",fe),this._domElementKeyEvents=x},this.stopListenToKeyEvents=function(){this._domElementKeyEvents.removeEventListener("keydown",fe),this._domElementKeyEvents=null},this.saveState=function(){n.target0.copy(n.target),n.position0.copy(n.object.position),n.zoom0=n.object.zoom},this.reset=function(){n.target.copy(n.target0),n.object.position.copy(n.position0),n.object.zoom=n.zoom0,n.object.updateProjectionMatrix(),n.dispatchEvent(il),n.update(),s=r.NONE},this.update=(function(){const x=new I,H=new Fn().setFromUnitVectors(e.up,new I(0,1,0)),K=H.clone().invert(),ae=new I,pe=new Fn,He=new I,ze=2*Math.PI;return function(lt=null){const $e=n.object.position;x.copy($e).sub(n.target),x.applyQuaternion(H),o.setFromVector3(x),n.autoRotate&&s===r.NONE&&L(M(lt)),n.enableDamping?(o.theta+=l.theta*n.dampingFactor,o.phi+=l.phi*n.dampingFactor):(o.theta+=l.theta,o.phi+=l.phi);let it=n.minAzimuthAngle,rt=n.maxAzimuthAngle;isFinite(it)&&isFinite(rt)&&(it<-Math.PI?it+=ze:it>Math.PI&&(it-=ze),rt<-Math.PI?rt+=ze:rt>Math.PI&&(rt-=ze),it<=rt?o.theta=Math.max(it,Math.min(rt,o.theta)):o.theta=o.theta>(it+rt)/2?Math.max(it,o.theta):Math.min(rt,o.theta)),o.phi=Math.max(n.minPolarAngle,Math.min(n.maxPolarAngle,o.phi)),o.makeSafe(),n.enableDamping===!0?n.target.addScaledVector(u,n.dampingFactor):n.target.add(u),n.target.sub(n.cursor),n.target.clampLength(n.minTargetRadius,n.maxTargetRadius),n.target.add(n.cursor);let Dt=!1;if(n.zoomToCursor&&T||n.object.isOrthographicCamera)o.radius=$(o.radius);else{const Pt=o.radius;o.radius=$(o.radius*c),Dt=Pt!=o.radius}if(x.setFromSpherical(o),x.applyQuaternion(K),$e.copy(n.target).add(x),n.object.lookAt(n.target),n.enableDamping===!0?(l.theta*=1-n.dampingFactor,l.phi*=1-n.dampingFactor,u.multiplyScalar(1-n.dampingFactor)):(l.set(0,0,0),u.set(0,0,0)),n.zoomToCursor&&T){let Pt=null;if(n.object.isPerspectiveCamera){const nn=x.length();Pt=$(nn*c);const On=nn-Pt;n.object.position.addScaledVector(b,On),n.object.updateMatrixWorld(),Dt=!!On}else if(n.object.isOrthographicCamera){const nn=new I(R.x,R.y,0);nn.unproject(n.object);const On=n.object.zoom;n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/c)),n.object.updateProjectionMatrix(),Dt=On!==n.object.zoom;const vn=new I(R.x,R.y,0);vn.unproject(n.object),n.object.position.sub(vn).add(nn),n.object.updateMatrixWorld(),Pt=x.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),n.zoomToCursor=!1;Pt!==null&&(this.screenSpacePanning?n.target.set(0,0,-1).transformDirection(n.object.matrix).multiplyScalar(Pt).add(n.object.position):(Er.origin.copy(n.object.position),Er.direction.set(0,0,-1).transformDirection(n.object.matrix),Math.abs(n.object.up.dot(Er.direction))<J0?e.lookAt(n.target):(sl.setFromNormalAndCoplanarPoint(n.object.up,n.target),Er.intersectPlane(sl,n.target))))}else if(n.object.isOrthographicCamera){const Pt=n.object.zoom;n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/c)),Pt!==n.object.zoom&&(n.object.updateProjectionMatrix(),Dt=!0)}return c=1,T=!1,Dt||ae.distanceToSquared(n.object.position)>a||8*(1-pe.dot(n.object.quaternion))>a||He.distanceToSquared(n.target)>a?(n.dispatchEvent(il),ae.copy(n.object.position),pe.copy(n.object.quaternion),He.copy(n.target),!0):!1}})(),this.dispose=function(){n.domElement.removeEventListener("contextmenu",_e),n.domElement.removeEventListener("pointerdown",q),n.domElement.removeEventListener("pointercancel",te),n.domElement.removeEventListener("wheel",re),n.domElement.removeEventListener("pointermove",Z),n.domElement.removeEventListener("pointerup",te),n.domElement.getRootNode().removeEventListener("keydown",Ae,{capture:!0}),n._domElementKeyEvents!==null&&(n._domElementKeyEvents.removeEventListener("keydown",fe),n._domElementKeyEvents=null)};const n=this,r={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let s=r.NONE;const a=1e-6,o=new nl,l=new nl;let c=1;const u=new I,d=new ue,h=new ue,f=new ue,g=new ue,_=new ue,m=new ue,p=new ue,E=new ue,v=new ue,b=new I,R=new ue;let T=!1;const A=[],P={};let S=!1;function M(x){return x!==null?2*Math.PI/60*n.autoRotateSpeed*x:2*Math.PI/60/60*n.autoRotateSpeed}function F(x){const H=Math.abs(x*.01);return Math.pow(.95,n.zoomSpeed*H)}function L(x){l.theta-=x}function C(x){l.phi-=x}const N=(function(){const x=new I;return function(K,ae){x.setFromMatrixColumn(ae,0),x.multiplyScalar(-K),u.add(x)}})(),V=(function(){const x=new I;return function(K,ae){n.screenSpacePanning===!0?x.setFromMatrixColumn(ae,1):(x.setFromMatrixColumn(ae,0),x.crossVectors(n.object.up,x)),x.multiplyScalar(K),u.add(x)}})(),j=(function(){const x=new I;return function(K,ae){const pe=n.domElement;if(n.object.isPerspectiveCamera){const He=n.object.position;x.copy(He).sub(n.target);let ze=x.length();ze*=Math.tan(n.object.fov/2*Math.PI/180),N(2*K*ze/pe.clientHeight,n.object.matrix),V(2*ae*ze/pe.clientHeight,n.object.matrix)}else n.object.isOrthographicCamera?(N(K*(n.object.right-n.object.left)/n.object.zoom/pe.clientWidth,n.object.matrix),V(ae*(n.object.top-n.object.bottom)/n.object.zoom/pe.clientHeight,n.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),n.enablePan=!1)}})();function J(x){n.object.isPerspectiveCamera||n.object.isOrthographicCamera?c/=x:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function z(x){n.object.isPerspectiveCamera||n.object.isOrthographicCamera?c*=x:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function Y(x,H){if(!n.zoomToCursor)return;T=!0;const K=n.domElement.getBoundingClientRect(),ae=x-K.left,pe=H-K.top,He=K.width,ze=K.height;R.x=ae/He*2-1,R.y=-(pe/ze)*2+1,b.set(R.x,R.y,1).unproject(n.object).sub(n.object.position).normalize()}function $(x){return Math.max(n.minDistance,Math.min(n.maxDistance,x))}function U(x){d.set(x.clientX,x.clientY)}function ee(x){Y(x.clientX,x.clientX),p.set(x.clientX,x.clientY)}function me(x){g.set(x.clientX,x.clientY)}function O(x){h.set(x.clientX,x.clientY),f.subVectors(h,d).multiplyScalar(n.rotateSpeed);const H=n.domElement;L(2*Math.PI*f.x/H.clientHeight),C(2*Math.PI*f.y/H.clientHeight),d.copy(h),n.update()}function Q(x){E.set(x.clientX,x.clientY),v.subVectors(E,p),v.y>0?J(F(v.y)):v.y<0&&z(F(v.y)),p.copy(E),n.update()}function ce(x){_.set(x.clientX,x.clientY),m.subVectors(_,g).multiplyScalar(n.panSpeed),j(m.x,m.y),g.copy(_),n.update()}function ne(x){Y(x.clientX,x.clientY),x.deltaY<0?z(F(x.deltaY)):x.deltaY>0&&J(F(x.deltaY)),n.update()}function ve(x){let H=!1;switch(x.code){case n.keys.UP:x.ctrlKey||x.metaKey||x.shiftKey?C(2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):j(0,n.keyPanSpeed),H=!0;break;case n.keys.BOTTOM:x.ctrlKey||x.metaKey||x.shiftKey?C(-2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):j(0,-n.keyPanSpeed),H=!0;break;case n.keys.LEFT:x.ctrlKey||x.metaKey||x.shiftKey?L(2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):j(n.keyPanSpeed,0),H=!0;break;case n.keys.RIGHT:x.ctrlKey||x.metaKey||x.shiftKey?L(-2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):j(-n.keyPanSpeed,0),H=!0;break}H&&(x.preventDefault(),n.update())}function Te(x){if(A.length===1)d.set(x.pageX,x.pageY);else{const H=je(x),K=.5*(x.pageX+H.x),ae=.5*(x.pageY+H.y);d.set(K,ae)}}function Ce(x){if(A.length===1)g.set(x.pageX,x.pageY);else{const H=je(x),K=.5*(x.pageX+H.x),ae=.5*(x.pageY+H.y);g.set(K,ae)}}function k(x){const H=je(x),K=x.pageX-H.x,ae=x.pageY-H.y,pe=Math.sqrt(K*K+ae*ae);p.set(0,pe)}function Fe(x){n.enableZoom&&k(x),n.enablePan&&Ce(x)}function xe(x){n.enableZoom&&k(x),n.enableRotate&&Te(x)}function Ge(x){if(A.length==1)h.set(x.pageX,x.pageY);else{const K=je(x),ae=.5*(x.pageX+K.x),pe=.5*(x.pageY+K.y);h.set(ae,pe)}f.subVectors(h,d).multiplyScalar(n.rotateSpeed);const H=n.domElement;L(2*Math.PI*f.x/H.clientHeight),C(2*Math.PI*f.y/H.clientHeight),d.copy(h)}function Ee(x){if(A.length===1)_.set(x.pageX,x.pageY);else{const H=je(x),K=.5*(x.pageX+H.x),ae=.5*(x.pageY+H.y);_.set(K,ae)}m.subVectors(_,g).multiplyScalar(n.panSpeed),j(m.x,m.y),g.copy(_)}function We(x){const H=je(x),K=x.pageX-H.x,ae=x.pageY-H.y,pe=Math.sqrt(K*K+ae*ae);E.set(0,pe),v.set(0,Math.pow(E.y/p.y,n.zoomSpeed)),J(v.y),p.copy(E);const He=(x.pageX+H.x)*.5,ze=(x.pageY+H.y)*.5;Y(He,ze)}function w(x){n.enableZoom&&We(x),n.enablePan&&Ee(x)}function y(x){n.enableZoom&&We(x),n.enableRotate&&Ge(x)}function q(x){n.enabled!==!1&&(A.length===0&&(n.domElement.setPointerCapture(x.pointerId),n.domElement.addEventListener("pointermove",Z),n.domElement.addEventListener("pointerup",te)),!qe(x)&&(ke(x),x.pointerType==="touch"?Re(x):ie(x)))}function Z(x){n.enabled!==!1&&(x.pointerType==="touch"?ge(x):De(x))}function te(x){switch(Ve(x),A.length){case 0:n.domElement.releasePointerCapture(x.pointerId),n.domElement.removeEventListener("pointermove",Z),n.domElement.removeEventListener("pointerup",te),n.dispatchEvent(rl),s=r.NONE;break;case 1:const H=A[0],K=P[H];Re({pointerId:H,pageX:K.x,pageY:K.y});break}}function ie(x){let H;switch(x.button){case 0:H=n.mouseButtons.LEFT;break;case 1:H=n.mouseButtons.MIDDLE;break;case 2:H=n.mouseButtons.RIGHT;break;default:H=-1}switch(H){case Vn.DOLLY:if(n.enableZoom===!1)return;ee(x),s=r.DOLLY;break;case Vn.ROTATE:if(x.ctrlKey||x.metaKey||x.shiftKey){if(n.enablePan===!1)return;me(x),s=r.PAN}else{if(n.enableRotate===!1)return;U(x),s=r.ROTATE}break;case Vn.PAN:if(x.ctrlKey||x.metaKey||x.shiftKey){if(n.enableRotate===!1)return;U(x),s=r.ROTATE}else{if(n.enablePan===!1)return;me(x),s=r.PAN}break;default:s=r.NONE}s!==r.NONE&&n.dispatchEvent(Rs)}function De(x){switch(s){case r.ROTATE:if(n.enableRotate===!1)return;O(x);break;case r.DOLLY:if(n.enableZoom===!1)return;Q(x);break;case r.PAN:if(n.enablePan===!1)return;ce(x);break}}function re(x){n.enabled===!1||n.enableZoom===!1||s!==r.NONE||(x.preventDefault(),n.dispatchEvent(Rs),ne(Se(x)),n.dispatchEvent(rl))}function Se(x){const H=x.deltaMode,K={clientX:x.clientX,clientY:x.clientY,deltaY:x.deltaY};switch(H){case 1:K.deltaY*=16;break;case 2:K.deltaY*=100;break}return x.ctrlKey&&!S&&(K.deltaY*=10),K}function Ae(x){x.key==="Control"&&(S=!0,n.domElement.getRootNode().addEventListener("keyup",oe,{passive:!0,capture:!0}))}function oe(x){x.key==="Control"&&(S=!1,n.domElement.getRootNode().removeEventListener("keyup",oe,{passive:!0,capture:!0}))}function fe(x){n.enabled===!1||n.enablePan===!1||ve(x)}function Re(x){switch(Xe(x),A.length){case 1:switch(n.touches.ONE){case Hn.ROTATE:if(n.enableRotate===!1)return;Te(x),s=r.TOUCH_ROTATE;break;case Hn.PAN:if(n.enablePan===!1)return;Ce(x),s=r.TOUCH_PAN;break;default:s=r.NONE}break;case 2:switch(n.touches.TWO){case Hn.DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;Fe(x),s=r.TOUCH_DOLLY_PAN;break;case Hn.DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;xe(x),s=r.TOUCH_DOLLY_ROTATE;break;default:s=r.NONE}break;default:s=r.NONE}s!==r.NONE&&n.dispatchEvent(Rs)}function ge(x){switch(Xe(x),s){case r.TOUCH_ROTATE:if(n.enableRotate===!1)return;Ge(x),n.update();break;case r.TOUCH_PAN:if(n.enablePan===!1)return;Ee(x),n.update();break;case r.TOUCH_DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;w(x),n.update();break;case r.TOUCH_DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;y(x),n.update();break;default:s=r.NONE}}function _e(x){n.enabled!==!1&&x.preventDefault()}function ke(x){A.push(x.pointerId)}function Ve(x){delete P[x.pointerId];for(let H=0;H<A.length;H++)if(A[H]==x.pointerId){A.splice(H,1);return}}function qe(x){for(let H=0;H<A.length;H++)if(A[H]==x.pointerId)return!0;return!1}function Xe(x){let H=P[x.pointerId];H===void 0&&(H=new ue,P[x.pointerId]=H),H.set(x.pageX,x.pageY)}function je(x){const H=x.pointerId===A[0]?A[1]:A[0];return P[H]}n.domElement.addEventListener("contextmenu",_e),n.domElement.addEventListener("pointerdown",q),n.domElement.addEventListener("pointercancel",te),n.domElement.addEventListener("wheel",re,{passive:!1}),n.domElement.getRootNode().addEventListener("keydown",Ae,{passive:!0,capture:!0}),this.update()}}const xc={name:"CopyShader",uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:`
3801
3801
 
3802
3802
  varying vec2 vUv;
3803
3803
 
@@ -3820,7 +3820,7 @@ void main() {
3820
3820
  gl_FragColor = opacity * texel;
3821
3821
 
3822
3822
 
3823
- }`};class Wi{constructor(){this.isPass=!0,this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.renderToScreen=!1}setSize(){}render(){console.error("THREE.Pass: .render() must be implemented in derived pass.")}dispose(){}}const Q0=new ic(-1,1,1,-1,0,1);class eg extends _t{constructor(){super(),this.setAttribute("position",new nt([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new nt([0,2,0,0,2,0],2))}}const tg=new eg;class vc{constructor(e){this._mesh=new bt(tg,e)}dispose(){this._mesh.geometry.dispose()}render(e){e.render(this._mesh,Q0)}get material(){return this._mesh.material}set material(e){this._mesh.material=e}}class Mc extends Wi{constructor(e,t){super(),this.textureID=t!==void 0?t:"tDiffuse",e instanceof ft?(this.uniforms=e.uniforms,this.material=e):e&&(this.uniforms=Fr.clone(e.uniforms),this.material=new ft({name:e.name!==void 0?e.name:"unspecified",defines:Object.assign({},e.defines),uniforms:this.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader})),this.fsQuad=new vc(this.material)}render(e,t,n){this.uniforms[this.textureID]&&(this.uniforms[this.textureID].value=n.texture),this.fsQuad.material=this.material,this.renderToScreen?(e.setRenderTarget(null),this.fsQuad.render(e)):(e.setRenderTarget(t),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),this.fsQuad.render(e))}dispose(){this.material.dispose(),this.fsQuad.dispose()}}class al extends Wi{constructor(e,t){super(),this.scene=e,this.camera=t,this.clear=!0,this.needsSwap=!1,this.inverse=!1}render(e,t,n){const r=e.getContext(),s=e.state;s.buffers.color.setMask(!1),s.buffers.depth.setMask(!1),s.buffers.color.setLocked(!0),s.buffers.depth.setLocked(!0);let a,o;this.inverse?(a=0,o=1):(a=1,o=0),s.buffers.stencil.setTest(!0),s.buffers.stencil.setOp(r.REPLACE,r.REPLACE,r.REPLACE),s.buffers.stencil.setFunc(r.ALWAYS,a,4294967295),s.buffers.stencil.setClear(o),s.buffers.stencil.setLocked(!0),e.setRenderTarget(n),this.clear&&e.clear(),e.render(this.scene,this.camera),e.setRenderTarget(t),this.clear&&e.clear(),e.render(this.scene,this.camera),s.buffers.color.setLocked(!1),s.buffers.depth.setLocked(!1),s.buffers.color.setMask(!0),s.buffers.depth.setMask(!0),s.buffers.stencil.setLocked(!1),s.buffers.stencil.setFunc(r.EQUAL,1,4294967295),s.buffers.stencil.setOp(r.KEEP,r.KEEP,r.KEEP),s.buffers.stencil.setLocked(!0)}}class ng extends Wi{constructor(){super(),this.needsSwap=!1}render(e){e.state.buffers.stencil.setLocked(!1),e.state.buffers.stencil.setTest(!1)}}class Sc{constructor(e,t){if(this.renderer=e,this._pixelRatio=e.getPixelRatio(),t===void 0){const n=e.getSize(new ue);this._width=n.width,this._height=n.height,t=new Ht(this._width*this._pixelRatio,this._height*this._pixelRatio,{type:gn}),t.texture.name="EffectComposer.rt1"}else this._width=t.width,this._height=t.height;this.renderTarget1=t,this.renderTarget2=t.clone(),this.renderTarget2.texture.name="EffectComposer.rt2",this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.renderToScreen=!0,this.passes=[],this.copyPass=new Mc(xc),this.copyPass.material.blending=en,this.clock=new gc}swapBuffers(){const e=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=e}addPass(e){this.passes.push(e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}insertPass(e,t){this.passes.splice(t,0,e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}removePass(e){const t=this.passes.indexOf(e);t!==-1&&this.passes.splice(t,1)}isLastEnabledPass(e){for(let t=e+1;t<this.passes.length;t++)if(this.passes[t].enabled)return!1;return!0}render(e){e===void 0&&(e=this.clock.getDelta());const t=this.renderer.getRenderTarget();let n=!1;for(let r=0,s=this.passes.length;r<s;r++){const a=this.passes[r];if(a.enabled!==!1){if(a.renderToScreen=this.renderToScreen&&this.isLastEnabledPass(r),a.render(this.renderer,this.writeBuffer,this.readBuffer,e,n),a.needsSwap){if(n){const o=this.renderer.getContext(),l=this.renderer.state.buffers.stencil;l.setFunc(o.NOTEQUAL,1,4294967295),this.copyPass.render(this.renderer,this.writeBuffer,this.readBuffer,e),l.setFunc(o.EQUAL,1,4294967295)}this.swapBuffers()}al!==void 0&&(a instanceof al?n=!0:a instanceof ng&&(n=!1))}}this.renderer.setRenderTarget(t)}reset(e){if(e===void 0){const t=this.renderer.getSize(new ue);this._pixelRatio=this.renderer.getPixelRatio(),this._width=t.width,this._height=t.height,e=this.renderTarget1.clone(),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.renderTarget1=e,this.renderTarget2=e.clone(),this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2}setSize(e,t){this._width=e,this._height=t;const n=this._width*this._pixelRatio,r=this._height*this._pixelRatio;this.renderTarget1.setSize(n,r),this.renderTarget2.setSize(n,r);for(let s=0;s<this.passes.length;s++)this.passes[s].setSize(n,r)}setPixelRatio(e){this._pixelRatio=e,this.setSize(this._width,this._height)}dispose(){this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.copyPass.dispose()}}class yc extends Wi{constructor(e,t,n=null,r=null,s=null){super(),this.scene=e,this.camera=t,this.overrideMaterial=n,this.clearColor=r,this.clearAlpha=s,this.clear=!0,this.clearDepth=!1,this.needsSwap=!1,this._oldClearColor=new be}render(e,t,n){const r=e.autoClear;e.autoClear=!1;let s,a;this.overrideMaterial!==null&&(a=this.scene.overrideMaterial,this.scene.overrideMaterial=this.overrideMaterial),this.clearColor!==null&&(e.getClearColor(this._oldClearColor),e.setClearColor(this.clearColor)),this.clearAlpha!==null&&(s=e.getClearAlpha(),e.setClearAlpha(this.clearAlpha)),this.clearDepth==!0&&e.clearDepth(),e.setRenderTarget(this.renderToScreen?null:n),this.clear===!0&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),e.render(this.scene,this.camera),this.clearColor!==null&&e.setClearColor(this._oldClearColor),this.clearAlpha!==null&&e.setClearAlpha(s),this.overrideMaterial!==null&&(this.scene.overrideMaterial=a),e.autoClear=r}}const ig={uniforms:{tDiffuse:{value:null},luminosityThreshold:{value:1},smoothWidth:{value:1},defaultColor:{value:new be(0)},defaultOpacity:{value:0}},vertexShader:`
3823
+ }`};class Wi{constructor(){this.isPass=!0,this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.renderToScreen=!1}setSize(){}render(){console.error("THREE.Pass: .render() must be implemented in derived pass.")}dispose(){}}const Q0=new ic(-1,1,1,-1,0,1);class eg extends _t{constructor(){super(),this.setAttribute("position",new nt([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new nt([0,2,0,0,2,0],2))}}const tg=new eg;class vc{constructor(e){this._mesh=new bt(tg,e)}dispose(){this._mesh.geometry.dispose()}render(e){e.render(this._mesh,Q0)}get material(){return this._mesh.material}set material(e){this._mesh.material=e}}class Mc extends Wi{constructor(e,t){super(),this.textureID=t!==void 0?t:"tDiffuse",e instanceof ft?(this.uniforms=e.uniforms,this.material=e):e&&(this.uniforms=Fr.clone(e.uniforms),this.material=new ft({name:e.name!==void 0?e.name:"unspecified",defines:Object.assign({},e.defines),uniforms:this.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader})),this.fsQuad=new vc(this.material)}render(e,t,n){this.uniforms[this.textureID]&&(this.uniforms[this.textureID].value=n.texture),this.fsQuad.material=this.material,this.renderToScreen?(e.setRenderTarget(null),this.fsQuad.render(e)):(e.setRenderTarget(t),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),this.fsQuad.render(e))}dispose(){this.material.dispose(),this.fsQuad.dispose()}}class al extends Wi{constructor(e,t){super(),this.scene=e,this.camera=t,this.clear=!0,this.needsSwap=!1,this.inverse=!1}render(e,t,n){const r=e.getContext(),s=e.state;s.buffers.color.setMask(!1),s.buffers.depth.setMask(!1),s.buffers.color.setLocked(!0),s.buffers.depth.setLocked(!0);let a,o;this.inverse?(a=0,o=1):(a=1,o=0),s.buffers.stencil.setTest(!0),s.buffers.stencil.setOp(r.REPLACE,r.REPLACE,r.REPLACE),s.buffers.stencil.setFunc(r.ALWAYS,a,4294967295),s.buffers.stencil.setClear(o),s.buffers.stencil.setLocked(!0),e.setRenderTarget(n),this.clear&&e.clear(),e.render(this.scene,this.camera),e.setRenderTarget(t),this.clear&&e.clear(),e.render(this.scene,this.camera),s.buffers.color.setLocked(!1),s.buffers.depth.setLocked(!1),s.buffers.color.setMask(!0),s.buffers.depth.setMask(!0),s.buffers.stencil.setLocked(!1),s.buffers.stencil.setFunc(r.EQUAL,1,4294967295),s.buffers.stencil.setOp(r.KEEP,r.KEEP,r.KEEP),s.buffers.stencil.setLocked(!0)}}class ng extends Wi{constructor(){super(),this.needsSwap=!1}render(e){e.state.buffers.stencil.setLocked(!1),e.state.buffers.stencil.setTest(!1)}}class yc{constructor(e,t){if(this.renderer=e,this._pixelRatio=e.getPixelRatio(),t===void 0){const n=e.getSize(new ue);this._width=n.width,this._height=n.height,t=new Vt(this._width*this._pixelRatio,this._height*this._pixelRatio,{type:gn}),t.texture.name="EffectComposer.rt1"}else this._width=t.width,this._height=t.height;this.renderTarget1=t,this.renderTarget2=t.clone(),this.renderTarget2.texture.name="EffectComposer.rt2",this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.renderToScreen=!0,this.passes=[],this.copyPass=new Mc(xc),this.copyPass.material.blending=en,this.clock=new gc}swapBuffers(){const e=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=e}addPass(e){this.passes.push(e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}insertPass(e,t){this.passes.splice(t,0,e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}removePass(e){const t=this.passes.indexOf(e);t!==-1&&this.passes.splice(t,1)}isLastEnabledPass(e){for(let t=e+1;t<this.passes.length;t++)if(this.passes[t].enabled)return!1;return!0}render(e){e===void 0&&(e=this.clock.getDelta());const t=this.renderer.getRenderTarget();let n=!1;for(let r=0,s=this.passes.length;r<s;r++){const a=this.passes[r];if(a.enabled!==!1){if(a.renderToScreen=this.renderToScreen&&this.isLastEnabledPass(r),a.render(this.renderer,this.writeBuffer,this.readBuffer,e,n),a.needsSwap){if(n){const o=this.renderer.getContext(),l=this.renderer.state.buffers.stencil;l.setFunc(o.NOTEQUAL,1,4294967295),this.copyPass.render(this.renderer,this.writeBuffer,this.readBuffer,e),l.setFunc(o.EQUAL,1,4294967295)}this.swapBuffers()}al!==void 0&&(a instanceof al?n=!0:a instanceof ng&&(n=!1))}}this.renderer.setRenderTarget(t)}reset(e){if(e===void 0){const t=this.renderer.getSize(new ue);this._pixelRatio=this.renderer.getPixelRatio(),this._width=t.width,this._height=t.height,e=this.renderTarget1.clone(),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.renderTarget1=e,this.renderTarget2=e.clone(),this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2}setSize(e,t){this._width=e,this._height=t;const n=this._width*this._pixelRatio,r=this._height*this._pixelRatio;this.renderTarget1.setSize(n,r),this.renderTarget2.setSize(n,r);for(let s=0;s<this.passes.length;s++)this.passes[s].setSize(n,r)}setPixelRatio(e){this._pixelRatio=e,this.setSize(this._width,this._height)}dispose(){this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.copyPass.dispose()}}class Sc extends Wi{constructor(e,t,n=null,r=null,s=null){super(),this.scene=e,this.camera=t,this.overrideMaterial=n,this.clearColor=r,this.clearAlpha=s,this.clear=!0,this.clearDepth=!1,this.needsSwap=!1,this._oldClearColor=new be}render(e,t,n){const r=e.autoClear;e.autoClear=!1;let s,a;this.overrideMaterial!==null&&(a=this.scene.overrideMaterial,this.scene.overrideMaterial=this.overrideMaterial),this.clearColor!==null&&(e.getClearColor(this._oldClearColor),e.setClearColor(this.clearColor)),this.clearAlpha!==null&&(s=e.getClearAlpha(),e.setClearAlpha(this.clearAlpha)),this.clearDepth==!0&&e.clearDepth(),e.setRenderTarget(this.renderToScreen?null:n),this.clear===!0&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),e.render(this.scene,this.camera),this.clearColor!==null&&e.setClearColor(this._oldClearColor),this.clearAlpha!==null&&e.setClearAlpha(s),this.overrideMaterial!==null&&(this.scene.overrideMaterial=a),e.autoClear=r}}const ig={uniforms:{tDiffuse:{value:null},luminosityThreshold:{value:1},smoothWidth:{value:1},defaultColor:{value:new be(0)},defaultOpacity:{value:0}},vertexShader:`
3824
3824
 
3825
3825
  varying vec2 vUv;
3826
3826
 
@@ -3854,7 +3854,7 @@ void main() {
3854
3854
 
3855
3855
  gl_FragColor = mix( outputColor, texel, alpha );
3856
3856
 
3857
- }`};class Un extends Wi{constructor(e,t,n,r){super(),this.strength=t!==void 0?t:1,this.radius=n,this.threshold=r,this.resolution=e!==void 0?new ue(e.x,e.y):new ue(256,256),this.clearColor=new be(0,0,0),this.renderTargetsHorizontal=[],this.renderTargetsVertical=[],this.nMips=5;let s=Math.round(this.resolution.x/2),a=Math.round(this.resolution.y/2);this.renderTargetBright=new Ht(s,a,{type:gn}),this.renderTargetBright.texture.name="UnrealBloomPass.bright",this.renderTargetBright.texture.generateMipmaps=!1;for(let d=0;d<this.nMips;d++){const h=new Ht(s,a,{type:gn});h.texture.name="UnrealBloomPass.h"+d,h.texture.generateMipmaps=!1,this.renderTargetsHorizontal.push(h);const f=new Ht(s,a,{type:gn});f.texture.name="UnrealBloomPass.v"+d,f.texture.generateMipmaps=!1,this.renderTargetsVertical.push(f),s=Math.round(s/2),a=Math.round(a/2)}const o=ig;this.highPassUniforms=Fr.clone(o.uniforms),this.highPassUniforms.luminosityThreshold.value=r,this.highPassUniforms.smoothWidth.value=.01,this.materialHighPassFilter=new ft({uniforms:this.highPassUniforms,vertexShader:o.vertexShader,fragmentShader:o.fragmentShader}),this.separableBlurMaterials=[];const l=[3,5,7,9,11];s=Math.round(this.resolution.x/2),a=Math.round(this.resolution.y/2);for(let d=0;d<this.nMips;d++)this.separableBlurMaterials.push(this.getSeperableBlurMaterial(l[d])),this.separableBlurMaterials[d].uniforms.invSize.value=new ue(1/s,1/a),s=Math.round(s/2),a=Math.round(a/2);this.compositeMaterial=this.getCompositeMaterial(this.nMips),this.compositeMaterial.uniforms.blurTexture1.value=this.renderTargetsVertical[0].texture,this.compositeMaterial.uniforms.blurTexture2.value=this.renderTargetsVertical[1].texture,this.compositeMaterial.uniforms.blurTexture3.value=this.renderTargetsVertical[2].texture,this.compositeMaterial.uniforms.blurTexture4.value=this.renderTargetsVertical[3].texture,this.compositeMaterial.uniforms.blurTexture5.value=this.renderTargetsVertical[4].texture,this.compositeMaterial.uniforms.bloomStrength.value=t,this.compositeMaterial.uniforms.bloomRadius.value=.1;const c=[1,.8,.6,.4,.2];this.compositeMaterial.uniforms.bloomFactors.value=c,this.bloomTintColors=[new I(1,1,1),new I(1,1,1),new I(1,1,1),new I(1,1,1),new I(1,1,1)],this.compositeMaterial.uniforms.bloomTintColors.value=this.bloomTintColors;const u=xc;this.copyUniforms=Fr.clone(u.uniforms),this.blendMaterial=new ft({uniforms:this.copyUniforms,vertexShader:u.vertexShader,fragmentShader:u.fragmentShader,blending:ui,depthTest:!1,depthWrite:!1,transparent:!0}),this.enabled=!0,this.needsSwap=!1,this._oldClearColor=new be,this.oldClearAlpha=1,this.basic=new Vi,this.fsQuad=new vc(null)}dispose(){for(let e=0;e<this.renderTargetsHorizontal.length;e++)this.renderTargetsHorizontal[e].dispose();for(let e=0;e<this.renderTargetsVertical.length;e++)this.renderTargetsVertical[e].dispose();this.renderTargetBright.dispose();for(let e=0;e<this.separableBlurMaterials.length;e++)this.separableBlurMaterials[e].dispose();this.compositeMaterial.dispose(),this.blendMaterial.dispose(),this.basic.dispose(),this.fsQuad.dispose()}setSize(e,t){let n=Math.round(e/2),r=Math.round(t/2);this.renderTargetBright.setSize(n,r);for(let s=0;s<this.nMips;s++)this.renderTargetsHorizontal[s].setSize(n,r),this.renderTargetsVertical[s].setSize(n,r),this.separableBlurMaterials[s].uniforms.invSize.value=new ue(1/n,1/r),n=Math.round(n/2),r=Math.round(r/2)}render(e,t,n,r,s){e.getClearColor(this._oldClearColor),this.oldClearAlpha=e.getClearAlpha();const a=e.autoClear;e.autoClear=!1,e.setClearColor(this.clearColor,0),s&&e.state.buffers.stencil.setTest(!1),this.renderToScreen&&(this.fsQuad.material=this.basic,this.basic.map=n.texture,e.setRenderTarget(null),e.clear(),this.fsQuad.render(e)),this.highPassUniforms.tDiffuse.value=n.texture,this.highPassUniforms.luminosityThreshold.value=this.threshold,this.fsQuad.material=this.materialHighPassFilter,e.setRenderTarget(this.renderTargetBright),e.clear(),this.fsQuad.render(e);let o=this.renderTargetBright;for(let l=0;l<this.nMips;l++)this.fsQuad.material=this.separableBlurMaterials[l],this.separableBlurMaterials[l].uniforms.colorTexture.value=o.texture,this.separableBlurMaterials[l].uniforms.direction.value=Un.BlurDirectionX,e.setRenderTarget(this.renderTargetsHorizontal[l]),e.clear(),this.fsQuad.render(e),this.separableBlurMaterials[l].uniforms.colorTexture.value=this.renderTargetsHorizontal[l].texture,this.separableBlurMaterials[l].uniforms.direction.value=Un.BlurDirectionY,e.setRenderTarget(this.renderTargetsVertical[l]),e.clear(),this.fsQuad.render(e),o=this.renderTargetsVertical[l];this.fsQuad.material=this.compositeMaterial,this.compositeMaterial.uniforms.bloomStrength.value=this.strength,this.compositeMaterial.uniforms.bloomRadius.value=this.radius,this.compositeMaterial.uniforms.bloomTintColors.value=this.bloomTintColors,e.setRenderTarget(this.renderTargetsHorizontal[0]),e.clear(),this.fsQuad.render(e),this.fsQuad.material=this.blendMaterial,this.copyUniforms.tDiffuse.value=this.renderTargetsHorizontal[0].texture,s&&e.state.buffers.stencil.setTest(!0),this.renderToScreen?(e.setRenderTarget(null),this.fsQuad.render(e)):(e.setRenderTarget(n),this.fsQuad.render(e)),e.setClearColor(this._oldClearColor,this.oldClearAlpha),e.autoClear=a}getSeperableBlurMaterial(e){const t=[];for(let n=0;n<e;n++)t.push(.39894*Math.exp(-.5*n*n/(e*e))/e);return new ft({defines:{KERNEL_RADIUS:e},uniforms:{colorTexture:{value:null},invSize:{value:new ue(.5,.5)},direction:{value:new ue(.5,.5)},gaussianCoefficients:{value:t}},vertexShader:`varying vec2 vUv;
3857
+ }`};class Nn extends Wi{constructor(e,t,n,r){super(),this.strength=t!==void 0?t:1,this.radius=n,this.threshold=r,this.resolution=e!==void 0?new ue(e.x,e.y):new ue(256,256),this.clearColor=new be(0,0,0),this.renderTargetsHorizontal=[],this.renderTargetsVertical=[],this.nMips=5;let s=Math.round(this.resolution.x/2),a=Math.round(this.resolution.y/2);this.renderTargetBright=new Vt(s,a,{type:gn}),this.renderTargetBright.texture.name="UnrealBloomPass.bright",this.renderTargetBright.texture.generateMipmaps=!1;for(let d=0;d<this.nMips;d++){const h=new Vt(s,a,{type:gn});h.texture.name="UnrealBloomPass.h"+d,h.texture.generateMipmaps=!1,this.renderTargetsHorizontal.push(h);const f=new Vt(s,a,{type:gn});f.texture.name="UnrealBloomPass.v"+d,f.texture.generateMipmaps=!1,this.renderTargetsVertical.push(f),s=Math.round(s/2),a=Math.round(a/2)}const o=ig;this.highPassUniforms=Fr.clone(o.uniforms),this.highPassUniforms.luminosityThreshold.value=r,this.highPassUniforms.smoothWidth.value=.01,this.materialHighPassFilter=new ft({uniforms:this.highPassUniforms,vertexShader:o.vertexShader,fragmentShader:o.fragmentShader}),this.separableBlurMaterials=[];const l=[3,5,7,9,11];s=Math.round(this.resolution.x/2),a=Math.round(this.resolution.y/2);for(let d=0;d<this.nMips;d++)this.separableBlurMaterials.push(this.getSeperableBlurMaterial(l[d])),this.separableBlurMaterials[d].uniforms.invSize.value=new ue(1/s,1/a),s=Math.round(s/2),a=Math.round(a/2);this.compositeMaterial=this.getCompositeMaterial(this.nMips),this.compositeMaterial.uniforms.blurTexture1.value=this.renderTargetsVertical[0].texture,this.compositeMaterial.uniforms.blurTexture2.value=this.renderTargetsVertical[1].texture,this.compositeMaterial.uniforms.blurTexture3.value=this.renderTargetsVertical[2].texture,this.compositeMaterial.uniforms.blurTexture4.value=this.renderTargetsVertical[3].texture,this.compositeMaterial.uniforms.blurTexture5.value=this.renderTargetsVertical[4].texture,this.compositeMaterial.uniforms.bloomStrength.value=t,this.compositeMaterial.uniforms.bloomRadius.value=.1;const c=[1,.8,.6,.4,.2];this.compositeMaterial.uniforms.bloomFactors.value=c,this.bloomTintColors=[new I(1,1,1),new I(1,1,1),new I(1,1,1),new I(1,1,1),new I(1,1,1)],this.compositeMaterial.uniforms.bloomTintColors.value=this.bloomTintColors;const u=xc;this.copyUniforms=Fr.clone(u.uniforms),this.blendMaterial=new ft({uniforms:this.copyUniforms,vertexShader:u.vertexShader,fragmentShader:u.fragmentShader,blending:ui,depthTest:!1,depthWrite:!1,transparent:!0}),this.enabled=!0,this.needsSwap=!1,this._oldClearColor=new be,this.oldClearAlpha=1,this.basic=new Hi,this.fsQuad=new vc(null)}dispose(){for(let e=0;e<this.renderTargetsHorizontal.length;e++)this.renderTargetsHorizontal[e].dispose();for(let e=0;e<this.renderTargetsVertical.length;e++)this.renderTargetsVertical[e].dispose();this.renderTargetBright.dispose();for(let e=0;e<this.separableBlurMaterials.length;e++)this.separableBlurMaterials[e].dispose();this.compositeMaterial.dispose(),this.blendMaterial.dispose(),this.basic.dispose(),this.fsQuad.dispose()}setSize(e,t){let n=Math.round(e/2),r=Math.round(t/2);this.renderTargetBright.setSize(n,r);for(let s=0;s<this.nMips;s++)this.renderTargetsHorizontal[s].setSize(n,r),this.renderTargetsVertical[s].setSize(n,r),this.separableBlurMaterials[s].uniforms.invSize.value=new ue(1/n,1/r),n=Math.round(n/2),r=Math.round(r/2)}render(e,t,n,r,s){e.getClearColor(this._oldClearColor),this.oldClearAlpha=e.getClearAlpha();const a=e.autoClear;e.autoClear=!1,e.setClearColor(this.clearColor,0),s&&e.state.buffers.stencil.setTest(!1),this.renderToScreen&&(this.fsQuad.material=this.basic,this.basic.map=n.texture,e.setRenderTarget(null),e.clear(),this.fsQuad.render(e)),this.highPassUniforms.tDiffuse.value=n.texture,this.highPassUniforms.luminosityThreshold.value=this.threshold,this.fsQuad.material=this.materialHighPassFilter,e.setRenderTarget(this.renderTargetBright),e.clear(),this.fsQuad.render(e);let o=this.renderTargetBright;for(let l=0;l<this.nMips;l++)this.fsQuad.material=this.separableBlurMaterials[l],this.separableBlurMaterials[l].uniforms.colorTexture.value=o.texture,this.separableBlurMaterials[l].uniforms.direction.value=Nn.BlurDirectionX,e.setRenderTarget(this.renderTargetsHorizontal[l]),e.clear(),this.fsQuad.render(e),this.separableBlurMaterials[l].uniforms.colorTexture.value=this.renderTargetsHorizontal[l].texture,this.separableBlurMaterials[l].uniforms.direction.value=Nn.BlurDirectionY,e.setRenderTarget(this.renderTargetsVertical[l]),e.clear(),this.fsQuad.render(e),o=this.renderTargetsVertical[l];this.fsQuad.material=this.compositeMaterial,this.compositeMaterial.uniforms.bloomStrength.value=this.strength,this.compositeMaterial.uniforms.bloomRadius.value=this.radius,this.compositeMaterial.uniforms.bloomTintColors.value=this.bloomTintColors,e.setRenderTarget(this.renderTargetsHorizontal[0]),e.clear(),this.fsQuad.render(e),this.fsQuad.material=this.blendMaterial,this.copyUniforms.tDiffuse.value=this.renderTargetsHorizontal[0].texture,s&&e.state.buffers.stencil.setTest(!0),this.renderToScreen?(e.setRenderTarget(null),this.fsQuad.render(e)):(e.setRenderTarget(n),this.fsQuad.render(e)),e.setClearColor(this._oldClearColor,this.oldClearAlpha),e.autoClear=a}getSeperableBlurMaterial(e){const t=[];for(let n=0;n<e;n++)t.push(.39894*Math.exp(-.5*n*n/(e*e))/e);return new ft({defines:{KERNEL_RADIUS:e},uniforms:{colorTexture:{value:null},invSize:{value:new ue(.5,.5)},direction:{value:new ue(.5,.5)},gaussianCoefficients:{value:t}},vertexShader:`varying vec2 vUv;
3858
3858
  void main() {
3859
3859
  vUv = uv;
3860
3860
  gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
@@ -3904,7 +3904,7 @@ void main() {
3904
3904
  lerpBloomFactor(bloomFactors[2]) * vec4(bloomTintColors[2], 1.0) * texture2D(blurTexture3, vUv) +
3905
3905
  lerpBloomFactor(bloomFactors[3]) * vec4(bloomTintColors[3], 1.0) * texture2D(blurTexture4, vUv) +
3906
3906
  lerpBloomFactor(bloomFactors[4]) * vec4(bloomTintColors[4], 1.0) * texture2D(blurTexture5, vUv) );
3907
- }`})}}Un.BlurDirectionX=new ue(1,0);Un.BlurDirectionY=new ue(0,1);const rg=({onParamsChange:i,diskColor:e,glowColor:t,autoRotate:n})=>{const r=de.useRef(null),[s,a]=de.useState(n!==void 0?n:!1),[o,l]=de.useState(e||"#ff7733"),[c,u]=de.useState(t||"#ff6600"),d=de.useRef(null);return de.useEffect(()=>{e!==void 0&&l(e),t!==void 0&&u(t),n!==void 0&&a(n)},[e,t,n]),de.useEffect(()=>{if(!r.current)return;const h=r.current.querySelector("canvas");h&&r.current.removeChild(h);const f=1.3,g=f+.2,_=8,m=Math.PI/3,p=new hc;p.fog=new Hr(131332,.025),d.current=p;const E=new Rt(60,r.current.clientWidth/r.current.clientHeight,.1,4e3);E.position.set(-6.5,5,6.5);const v=new uc({antialias:!0,powerPreference:"high-performance"});v.setSize(r.current.clientWidth,r.current.clientHeight),v.setPixelRatio(Math.min(window.devicePixelRatio,1.5)),v.outputColorSpace=It,v.toneMapping=Qs,v.toneMappingExposure=1.2,r.current.appendChild(v.domElement);const b=new Sc(v);b.addPass(new yc(p,E));const R=new Un(new ue(r.current.clientWidth,r.current.clientHeight),.8,.7,.8);b.addPass(R);const T={uniforms:{tDiffuse:{value:null},blackHoleScreenPos:{value:new ue(.5,.5)},lensingStrength:{value:.12},lensingRadius:{value:.3},aspectRatio:{value:r.current.clientWidth/r.current.clientHeight},chromaticAberration:{value:.005}},vertexShader:`
3907
+ }`})}}Nn.BlurDirectionX=new ue(1,0);Nn.BlurDirectionY=new ue(0,1);const rg=({onParamsChange:i,diskColor:e,glowColor:t,autoRotate:n})=>{const r=de.useRef(null),[s,a]=de.useState(n!==void 0?n:!1),[o,l]=de.useState(e||"#ff7733"),[c,u]=de.useState(t||"#ff6600"),d=de.useRef(null);return de.useEffect(()=>{e!==void 0&&l(e),t!==void 0&&u(t),n!==void 0&&a(n)},[e,t,n]),de.useEffect(()=>{if(!r.current)return;const h=r.current.querySelector("canvas");h&&r.current.removeChild(h);const f=1.3,g=f+.2,_=8,m=Math.PI/3,p=new hc;p.fog=new Vr(131332,.025),d.current=p;const E=new Rt(60,r.current.clientWidth/r.current.clientHeight,.1,4e3);E.position.set(-6.5,5,6.5);const v=new uc({antialias:!0,powerPreference:"high-performance"});v.setSize(r.current.clientWidth,r.current.clientHeight),v.setPixelRatio(Math.min(window.devicePixelRatio,1.5)),v.outputColorSpace=It,v.toneMapping=ea,v.toneMappingExposure=1.2,r.current.appendChild(v.domElement);const b=new yc(v);b.addPass(new Sc(p,E));const R=new Nn(new ue(r.current.clientWidth,r.current.clientHeight),.8,.7,.8);b.addPass(R);const T={uniforms:{tDiffuse:{value:null},blackHoleScreenPos:{value:new ue(.5,.5)},lensingStrength:{value:.12},lensingRadius:{value:.3},aspectRatio:{value:r.current.clientWidth/r.current.clientHeight},chromaticAberration:{value:.005}},vertexShader:`
3908
3908
  varying vec2 vUv;
3909
3909
  void main() {
3910
3910
  vUv = uv;
@@ -3943,7 +3943,7 @@ void main() {
3943
3943
 
3944
3944
  gl_FragColor = vec4(r, g, b, 1.0);
3945
3945
  }
3946
- `},A=new Mc(T);b.addPass(A);const P=new _c(E,v.domElement);P.enableDamping=!0,P.dampingFactor=.035,P.rotateSpeed=.4,P.autoRotate=s,P.autoRotateSpeed=.1,P.target.set(0,0,0),P.minDistance=2.5,P.maxDistance=100,P.enablePan=!1,P.update();const y=new _t,M=15e4,F=new Float32Array(M*3),L=new Float32Array(M*3),C=new Float32Array(M),U=new Float32Array(M),H=2e3,Y=[new be(8956671),new be(16755455),new be(11206655),new be(16768426),new be(16772812),new be(16777215),new be(16746632),new be(8978312),new be(16777096),new be(8978431)];for(let xe=0;xe<M;xe++){const Ge=xe*3,Ee=Math.acos(-1+2*xe/M),We=Math.sqrt(M*Math.PI)*Ee,w=Math.cbrt(Math.random())*H+100;F[Ge]=w*Math.sin(Ee)*Math.cos(We),F[Ge+1]=w*Math.sin(Ee)*Math.sin(We),F[Ge+2]=w*Math.cos(Ee);const S=Y[Math.floor(Math.random()*Y.length)].clone();S.multiplyScalar(Math.random()*.7+.3),L[Ge]=S.r,L[Ge+1]=S.g,L[Ge+2]=S.b,C[xe]=Gl.randFloat(.6,3),U[xe]=Math.random()*Math.PI*2}y.setAttribute("position",new Et(F,3)),y.setAttribute("color",new Et(L,3)),y.setAttribute("size",new Et(C,1)),y.setAttribute("twinkle",new Et(U,1));const J=new ft({uniforms:{uTime:{value:0},uPixelRatio:{value:v.getPixelRatio()}},vertexShader:`
3946
+ `},A=new Mc(T);b.addPass(A);const P=new _c(E,v.domElement);P.enableDamping=!0,P.dampingFactor=.035,P.rotateSpeed=.4,P.autoRotate=s,P.autoRotateSpeed=.1,P.target.set(0,0,0),P.minDistance=2.5,P.maxDistance=100,P.enablePan=!1,P.update();const S=new _t,M=15e4,F=new Float32Array(M*3),L=new Float32Array(M*3),C=new Float32Array(M),N=new Float32Array(M),V=2e3,j=[new be(8956671),new be(16755455),new be(11206655),new be(16768426),new be(16772812),new be(16777215),new be(16746632),new be(8978312),new be(16777096),new be(8978431)];for(let xe=0;xe<M;xe++){const Ge=xe*3,Ee=Math.acos(-1+2*xe/M),We=Math.sqrt(M*Math.PI)*Ee,w=Math.cbrt(Math.random())*V+100;F[Ge]=w*Math.sin(Ee)*Math.cos(We),F[Ge+1]=w*Math.sin(Ee)*Math.sin(We),F[Ge+2]=w*Math.cos(Ee);const y=j[Math.floor(Math.random()*j.length)].clone();y.multiplyScalar(Math.random()*.7+.3),L[Ge]=y.r,L[Ge+1]=y.g,L[Ge+2]=y.b,C[xe]=Gl.randFloat(.6,3),N[xe]=Math.random()*Math.PI*2}S.setAttribute("position",new Et(F,3)),S.setAttribute("color",new Et(L,3)),S.setAttribute("size",new Et(C,1)),S.setAttribute("twinkle",new Et(N,1));const J=new ft({uniforms:{uTime:{value:0},uPixelRatio:{value:v.getPixelRatio()}},vertexShader:`
3947
3947
  uniform float uTime;
3948
3948
  uniform float uPixelRatio;
3949
3949
  attribute float size;
@@ -3972,7 +3972,7 @@ void main() {
3972
3972
 
3973
3973
  gl_FragColor = vec4(vColor, alpha);
3974
3974
  }
3975
- `,transparent:!0,vertexColors:!0,blending:ui,depthWrite:!1}),z=new U0(y,J);p.add(z);const j=new Bi(f*1.05,128,64),$=new ft({uniforms:{uTime:{value:0},uCameraPosition:{value:E.position},uGlowColor:{value:new be(c)}},vertexShader:`
3975
+ `,transparent:!0,vertexColors:!0,blending:ui,depthWrite:!1}),z=new N0(S,J);p.add(z);const Y=new Bi(f*1.05,128,64),$=new ft({uniforms:{uTime:{value:0},uCameraPosition:{value:E.position},uGlowColor:{value:new be(c)}},vertexShader:`
3976
3976
  varying vec3 vNormal;
3977
3977
  varying vec3 vPosition;
3978
3978
  void main() {
@@ -3996,7 +3996,7 @@ void main() {
3996
3996
 
3997
3997
  gl_FragColor = vec4(uGlowColor * fresnel * pulse, fresnel * 0.4);
3998
3998
  }
3999
- `,transparent:!0,blending:ui,side:St}),N=new bt(j,$);p.add(N);const ee=new Bi(f,128,64),me=new Vi({color:0}),O=new bt(ee,me);O.renderOrder=0,p.add(O);const Q=new ra(g,_,256,128),ce=new be(o),ne=new ft({uniforms:{uTime:{value:0},uColorHot:{value:new be(16777215)},uColorMid1:{value:ce.clone()},uColorMid2:{value:ce.clone().multiplyScalar(.8)},uColorMid3:{value:ce.clone().multiplyScalar(.6)},uColorOuter:{value:ce.clone().multiplyScalar(.4)},uNoiseScale:{value:2.5},uFlowSpeed:{value:.22},uDensity:{value:1.3}},vertexShader:`
3999
+ `,transparent:!0,blending:ui,side:yt}),U=new bt(Y,$);p.add(U);const ee=new Bi(f,128,64),me=new Hi({color:0}),O=new bt(ee,me);O.renderOrder=0,p.add(O);const Q=new sa(g,_,256,128),ce=new be(o),ne=new ft({uniforms:{uTime:{value:0},uColorHot:{value:new be(16777215)},uColorMid1:{value:ce.clone()},uColorMid2:{value:ce.clone().multiplyScalar(.8)},uColorMid3:{value:ce.clone().multiplyScalar(.6)},uColorOuter:{value:ce.clone().multiplyScalar(.4)},uNoiseScale:{value:2.5},uFlowSpeed:{value:.22},uDensity:{value:1.3}},vertexShader:`
4000
4000
  varying vec2 vUv;
4001
4001
  varying float vRadius;
4002
4002
  varying float vAngle;
@@ -4101,7 +4101,7 @@ void main() {
4101
4101
 
4102
4102
  gl_FragColor = vec4(color * brightness, alpha);
4103
4103
  }
4104
- `,transparent:!0,side:Wt,depthWrite:!1,blending:ui}),ve=new bt(Q,ne);ve.rotation.x=m,ve.renderOrder=1,p.add(ve);const Te=new gc,Ce=new I,k=()=>{requestAnimationFrame(k);const xe=Te.getElapsedTime(),Ge=Te.getDelta();ne.uniforms.uTime.value=xe,J.uniforms.uTime.value=xe,$.uniforms.uTime.value=xe,$.uniforms.uCameraPosition.value.copy(E.position),$.uniforms.uGlowColor.value.set(c),Ce.copy(O.position).project(E),A.uniforms.blackHoleScreenPos.value.set((Ce.x+1)/2,(Ce.y+1)/2),P.update(),z.rotation.y+=Ge*.003,z.rotation.x+=Ge*.001,ve.rotation.z+=Ge*.005,b.render(Ge)};k();const Fe=()=>{r.current&&(E.aspect=r.current.clientWidth/r.current.clientHeight,E.updateProjectionMatrix(),v.setSize(r.current.clientWidth,r.current.clientHeight),b.setSize(r.current.clientWidth,r.current.clientHeight),R.resolution.set(r.current.clientWidth,r.current.clientHeight),A.uniforms.aspectRatio.value=r.current.clientWidth/r.current.clientHeight)};return window.addEventListener("resize",Fe),()=>{window.removeEventListener("resize",Fe),v.dispose(),y.dispose(),J.dispose(),j.dispose(),$.dispose(),ee.dispose(),me.dispose(),Q.dispose(),ne.dispose(),r.current&&v.domElement&&r.current.removeChild(v.domElement)}},[s,o,c]),de.useEffect(()=>{i&&i({diskColor:o,glowColor:c,autoRotate:s})},[o,c,s,i]),oe.jsx("div",{className:"relative w-full h-full",children:oe.jsx("div",{ref:r,className:"w-full h-full"})})},sg=({onClick:i,size:e=40,className:t="",children:n,icon:r,iconPath:s})=>{const a=e*.08,o=e*.25,c=(e-o*2)*.6*2,u=()=>r?de.isValidElement(r)?oe.jsx("div",{style:{width:`${c}px`,height:`${c}px`,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:de.cloneElement(r,{className:`text-zinc-50 ${r.props?.className||""}`,style:{color:"rgb(250 250 250 / 1.0)",width:"100%",height:"100%",display:"block",margin:0,padding:0,fontSize:`${c}px`,...r.props?.style}})}):r:s?oe.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:c,height:c,fill:"rgb(250 250 250 / 1.0)",viewBox:"0 0 24 24",children:oe.jsx("path",{d:s})}):n||oe.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:c,height:c,fill:"rgb(250 250 250 / 1.0)",viewBox:"0 0 32 32",children:oe.jsx("path",{d:"m26.71 10.29-10-10a1 1 0 0 0-1.41 0l-10 10 1.41 1.41L15 3.41V32h2V3.41l8.29 8.29z"})});return oe.jsxs(Mt.motion.button,{onClick:i,className:`relative cursor-pointer rounded-full ${t}`,style:{width:`${e}px`,height:`${e}px`,padding:`${o}px`,background:"linear-gradient(0deg, rgb(10 10 10 / 1.0) 10%, rgb(40 40 50 / 1.0)) padding-box",border:`${a}px solid transparent`,zIndex:0,boxSizing:"border-box"},whileHover:{scale:1.05},whileTap:{scale:.95},children:[oe.jsx(Mt.motion.div,{className:"absolute rounded-full",style:{top:`-${a}px`,left:`-${a}px`,width:`calc(100% + ${a*2}px)`,height:`calc(100% + ${a*2}px)`,zIndex:-1,border:"4px solid transparent",background:`
4104
+ `,transparent:!0,side:Wt,depthWrite:!1,blending:ui}),ve=new bt(Q,ne);ve.rotation.x=m,ve.renderOrder=1,p.add(ve);const Te=new gc,Ce=new I,k=()=>{requestAnimationFrame(k);const xe=Te.getElapsedTime(),Ge=Te.getDelta();ne.uniforms.uTime.value=xe,J.uniforms.uTime.value=xe,$.uniforms.uTime.value=xe,$.uniforms.uCameraPosition.value.copy(E.position),$.uniforms.uGlowColor.value.set(c),Ce.copy(O.position).project(E),A.uniforms.blackHoleScreenPos.value.set((Ce.x+1)/2,(Ce.y+1)/2),P.update(),z.rotation.y+=Ge*.003,z.rotation.x+=Ge*.001,ve.rotation.z+=Ge*.005,b.render(Ge)};k();const Fe=()=>{r.current&&(E.aspect=r.current.clientWidth/r.current.clientHeight,E.updateProjectionMatrix(),v.setSize(r.current.clientWidth,r.current.clientHeight),b.setSize(r.current.clientWidth,r.current.clientHeight),R.resolution.set(r.current.clientWidth,r.current.clientHeight),A.uniforms.aspectRatio.value=r.current.clientWidth/r.current.clientHeight)};return window.addEventListener("resize",Fe),()=>{window.removeEventListener("resize",Fe),v.dispose(),S.dispose(),J.dispose(),Y.dispose(),$.dispose(),ee.dispose(),me.dispose(),Q.dispose(),ne.dispose(),r.current&&v.domElement&&r.current.removeChild(v.domElement)}},[s,o,c]),de.useEffect(()=>{i&&i({diskColor:o,glowColor:c,autoRotate:s})},[o,c,s,i]),se.jsx("div",{className:"relative w-full h-full",children:se.jsx("div",{ref:r,className:"w-full h-full"})})},sg=({onClick:i,size:e=40,className:t="",children:n,icon:r,iconPath:s})=>{const a=e*.08,o=e*.25,c=(e-o*2)*.6*2,u=()=>r?de.isValidElement(r)?se.jsx("div",{style:{width:`${c}px`,height:`${c}px`,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:de.cloneElement(r,{className:`text-zinc-50 ${r.props?.className||""}`,style:{color:"rgb(250 250 250 / 1.0)",width:"100%",height:"100%",display:"block",margin:0,padding:0,fontSize:`${c}px`,...r.props?.style}})}):r:s?se.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:c,height:c,fill:"rgb(250 250 250 / 1.0)",viewBox:"0 0 24 24",children:se.jsx("path",{d:s})}):n||se.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:c,height:c,fill:"rgb(250 250 250 / 1.0)",viewBox:"0 0 32 32",children:se.jsx("path",{d:"m26.71 10.29-10-10a1 1 0 0 0-1.41 0l-10 10 1.41 1.41L15 3.41V32h2V3.41l8.29 8.29z"})});return se.jsxs(Mt.motion.button,{onClick:i,className:`relative cursor-pointer rounded-full ${t}`,style:{width:`${e}px`,height:`${e}px`,padding:`${o}px`,background:"linear-gradient(0deg, rgb(10 10 10 / 1.0) 10%, rgb(40 40 50 / 1.0)) padding-box",border:`${a}px solid transparent`,zIndex:0,boxSizing:"border-box"},whileHover:{scale:1.05},whileTap:{scale:.95},children:[se.jsx(Mt.motion.div,{className:"absolute rounded-full",style:{top:`-${a}px`,left:`-${a}px`,width:`calc(100% + ${a*2}px)`,height:`calc(100% + ${a*2}px)`,zIndex:-1,border:"4px solid transparent",background:`
4105
4105
  conic-gradient(from 0deg,
4106
4106
  rgb(200 200 220 / 1.0),
4107
4107
  rgb(160 160 180 / 1.0),
@@ -4120,7 +4120,7 @@ void main() {
4120
4120
  rgb(10 10 10 / 1.0),
4121
4121
  rgb(40 40 60 / 1.0),
4122
4122
  rgb(200 200 220 / 1.0)) border-box
4123
- `},animate:{rotate:[0,-360]},transition:{duration:8,repeat:1/0,ease:"linear"}}),oe.jsx(Mt.motion.div,{className:"absolute inset-0 rounded-full",style:{background:`conic-gradient(from 0deg,
4123
+ `},animate:{rotate:[0,-360]},transition:{duration:8,repeat:1/0,ease:"linear"}}),se.jsx(Mt.motion.div,{className:"absolute inset-0 rounded-full",style:{background:`conic-gradient(from 0deg,
4124
4124
  rgb(200 200 220 / 0.5),
4125
4125
  rgb(200 200 220 / 0.0),
4126
4126
  rgb(10 10 10 / 0.0),
@@ -4128,7 +4128,7 @@ void main() {
4128
4128
  rgb(80 80 100 / 0.5),
4129
4129
  rgb(80 80 100 / 0.0),
4130
4130
  rgb(80 80 100 / 1.0),
4131
- rgb(200 200 220 / 0.5)) border-box`},animate:{rotate:[0,360]},transition:{duration:12,repeat:1/0,ease:"linear"}}),oe.jsx("div",{className:"absolute inset-0 rounded-full flex items-center justify-center overflow-hidden",style:{background:"linear-gradient(0deg, rgb(10 10 10 / 1.0) 10%, rgb(40 40 50 / 1.0))"},children:u()})]})};class ag{constructor(e,t,n,r,s,a,o,l){this.width=e.width,this.height=e.height,this.ctx=t,this.x=n,this.y=r,this.color=s,this.speed=this.getRandomValue(.1,.9)*a,this.size=0,this.sizeStep=Math.random()*.4,this.minSize=.5,this.maxSizeInteger=l,this.maxSize=this.getRandomValue(this.minSize,this.maxSizeInteger),this.delay=o,this.counter=0,this.counterStep=Math.random()*4+(this.width+this.height)*.01,this.isIdle=!1,this.isReverse=!1,this.isShimmer=!1}getRandomValue(e,t){return Math.random()*(t-e)+e}draw(){const e=this.maxSizeInteger*.5-this.size*.5;this.ctx.fillStyle=this.color,this.ctx.fillRect(this.x+e,this.y+e,this.size,this.size)}appear(){if(this.isIdle=!1,this.counter<=this.delay){this.counter+=this.counterStep;return}this.size>=this.maxSize&&(this.isShimmer=!0),this.isShimmer?this.shimmer():this.size+=this.sizeStep,this.draw()}disappear(){if(this.isShimmer=!1,this.counter=0,this.size<=0){this.isIdle=!0;return}else this.size-=.1;this.draw()}shimmer(){this.size>=this.maxSize?this.isReverse=!0:this.size<=this.minSize&&(this.isReverse=!1),this.isReverse?this.size-=this.speed:this.size+=this.speed}}const og=({colors:i,gap:e,speed:t,pixelSize:n,isActive:r})=>{const s=de.useRef(null),a=de.useRef([]),o=de.useRef(null),l=de.useRef(0);return de.useEffect(()=>{l.current=performance.now()},[]),de.useEffect(()=>{const c=s.current;if(!c)return;const u=c.getContext("2d"),d=c.parentElement.getBoundingClientRect(),h=Math.floor(d.width),f=Math.floor(d.height);c.width=h,c.height=f,c.style.width=`${h}px`,c.style.height=`${f}px`,a.current=[];const g=(_,m)=>{const p=_-h/2,E=m-f/2;return Math.sqrt(p*p+E*E)};for(let _=0;_<h;_+=e)for(let m=0;m<f;m+=e){const p=i[Math.floor(Math.random()*i.length)],E=g(_,m);a.current.push(new ag(c,u,_,m,p,t,E,n))}},[i,e,t,n]),de.useEffect(()=>{const c=u=>{const d=s.current;if(!d)return;const h=d.getContext("2d"),f=1e3/60,g=()=>{o.current=requestAnimationFrame(g);const _=performance.now(),m=_-l.current;if(!(m<f)){l.current=_-m%f,h.clearRect(0,0,d.width,d.height);for(let p=0;p<a.current.length;p++)a.current[p][u]();a.current.every(p=>p.isIdle)&&cancelAnimationFrame(o.current)}};g()};if(o.current&&cancelAnimationFrame(o.current),a.current.length!==0)return c(r?"appear":"disappear"),()=>{o.current&&cancelAnimationFrame(o.current)}},[r]),oe.jsx("canvas",{ref:s,className:"absolute inset-0 w-full h-full"})},lg=({colors:i=["#e0f2fe","#7dd3fc","#0ea5e9"],gap:e=5,speed:t=.035,pixelSize:n=2,onParamsChange:r})=>{const[s,a]=de.useState(!1);return de.useEffect(()=>{r&&r({colors:i,gap:e,speed:t,pixelSize:n})},[i,e,t,n,r]),oe.jsxs("div",{className:"relative overflow-hidden aspect-[4/5] border border-gray-800 transition-all duration-200 hover:border-sky-400 focus-within:border-sky-400",onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),onFocus:()=>a(!0),onBlur:()=>a(!1),style:{isolation:"isolate"},children:[oe.jsx("div",{className:"absolute inset-0 pointer-events-none transition-opacity duration-700",style:{background:"radial-gradient(circle at bottom left, transparent 55%, #101012)",boxShadow:"#09090b -0.5cqi 0.5cqi 2.5cqi inset",opacity:s?0:1}}),oe.jsx("div",{className:"absolute inset-0 m-auto aspect-square transition-opacity duration-700",style:{background:"radial-gradient(circle, #09090b, transparent 65%)",opacity:s?1:0}}),oe.jsx(og,{colors:i,gap:e,speed:t,pixelSize:n,isActive:s}),oe.jsx("button",{className:"absolute inset-0 opacity-0 cursor-pointer","aria-label":"Code",children:"Code"})]})},cg=({images:i=[],title:e="GALLERY 3D",count:t=10,duration:n=16,className:r=""})=>{const s=de.useRef(null),a=de.useRef([]);de.useEffect(()=>{if(!s.current)return;a.current.forEach(c=>{if(c){const u=window.innerWidth*.5/16,d=-Math.random()*u+"rem",h=window.innerWidth*.5/16,f=-Math.random()*h+"rem";c.style.setProperty("--left",d),c.style.setProperty("--right",f)}})},[i,t]);const o=i.length>0?i.slice(0,t):Array.from({length:t},(l,c)=>({src:`https://images.pexels.com/photos/614117/pexels-photo-614117.jpeg?index=${c}`,alt:`Gallery image ${c+1}`}));return oe.jsxs(oe.Fragment,{children:[oe.jsx("style",{children:`
4131
+ rgb(200 200 220 / 0.5)) border-box`},animate:{rotate:[0,360]},transition:{duration:12,repeat:1/0,ease:"linear"}}),se.jsx("div",{className:"absolute inset-0 rounded-full flex items-center justify-center overflow-hidden",style:{background:"linear-gradient(0deg, rgb(10 10 10 / 1.0) 10%, rgb(40 40 50 / 1.0))"},children:u()})]})};class ag{constructor(e,t,n,r,s,a,o,l){this.width=e.width,this.height=e.height,this.ctx=t,this.x=n,this.y=r,this.color=s,this.speed=this.getRandomValue(.1,.9)*a,this.size=0,this.sizeStep=Math.random()*.4,this.minSize=.5,this.maxSizeInteger=l,this.maxSize=this.getRandomValue(this.minSize,this.maxSizeInteger),this.delay=o,this.counter=0,this.counterStep=Math.random()*4+(this.width+this.height)*.01,this.isIdle=!1,this.isReverse=!1,this.isShimmer=!1}getRandomValue(e,t){return Math.random()*(t-e)+e}draw(){const e=this.maxSizeInteger*.5-this.size*.5;this.ctx.fillStyle=this.color,this.ctx.fillRect(this.x+e,this.y+e,this.size,this.size)}appear(){if(this.isIdle=!1,this.counter<=this.delay){this.counter+=this.counterStep;return}this.size>=this.maxSize&&(this.isShimmer=!0),this.isShimmer?this.shimmer():this.size+=this.sizeStep,this.draw()}disappear(){if(this.isShimmer=!1,this.counter=0,this.size<=0){this.isIdle=!0;return}else this.size-=.1;this.draw()}shimmer(){this.size>=this.maxSize?this.isReverse=!0:this.size<=this.minSize&&(this.isReverse=!1),this.isReverse?this.size-=this.speed:this.size+=this.speed}}const og=({colors:i,gap:e,speed:t,pixelSize:n,isActive:r})=>{const s=de.useRef(null),a=de.useRef([]),o=de.useRef(null),l=de.useRef(0);return de.useEffect(()=>{l.current=performance.now()},[]),de.useEffect(()=>{const c=s.current;if(!c)return;const u=c.getContext("2d"),d=c.parentElement.getBoundingClientRect(),h=Math.floor(d.width),f=Math.floor(d.height);c.width=h,c.height=f,c.style.width=`${h}px`,c.style.height=`${f}px`,a.current=[];const g=(_,m)=>{const p=_-h/2,E=m-f/2;return Math.sqrt(p*p+E*E)};for(let _=0;_<h;_+=e)for(let m=0;m<f;m+=e){const p=i[Math.floor(Math.random()*i.length)],E=g(_,m);a.current.push(new ag(c,u,_,m,p,t,E,n))}},[i,e,t,n]),de.useEffect(()=>{const c=u=>{const d=s.current;if(!d)return;const h=d.getContext("2d"),f=1e3/60,g=()=>{o.current=requestAnimationFrame(g);const _=performance.now(),m=_-l.current;if(!(m<f)){l.current=_-m%f,h.clearRect(0,0,d.width,d.height);for(let p=0;p<a.current.length;p++)a.current[p][u]();a.current.every(p=>p.isIdle)&&cancelAnimationFrame(o.current)}};g()};if(o.current&&cancelAnimationFrame(o.current),a.current.length!==0)return c(r?"appear":"disappear"),()=>{o.current&&cancelAnimationFrame(o.current)}},[r]),se.jsx("canvas",{ref:s,className:"absolute inset-0 w-full h-full"})},lg=({colors:i=["#e0f2fe","#7dd3fc","#0ea5e9"],gap:e=5,speed:t=.035,pixelSize:n=2,onParamsChange:r})=>{const[s,a]=de.useState(!1);return de.useEffect(()=>{r&&r({colors:i,gap:e,speed:t,pixelSize:n})},[i,e,t,n,r]),se.jsxs("div",{className:"relative overflow-hidden aspect-[4/5] border border-gray-800 transition-all duration-200 hover:border-sky-400 focus-within:border-sky-400",onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),onFocus:()=>a(!0),onBlur:()=>a(!1),style:{isolation:"isolate"},children:[se.jsx("div",{className:"absolute inset-0 pointer-events-none transition-opacity duration-700",style:{background:"radial-gradient(circle at bottom left, transparent 55%, #101012)",boxShadow:"#09090b -0.5cqi 0.5cqi 2.5cqi inset",opacity:s?0:1}}),se.jsx("div",{className:"absolute inset-0 m-auto aspect-square transition-opacity duration-700",style:{background:"radial-gradient(circle, #09090b, transparent 65%)",opacity:s?1:0}}),se.jsx(og,{colors:i,gap:e,speed:t,pixelSize:n,isActive:s}),se.jsx("button",{className:"absolute inset-0 opacity-0 cursor-pointer","aria-label":"Code",children:"Code"})]})},cg=({images:i=[],title:e="GALLERY 3D",count:t=10,duration:n=16,className:r=""})=>{const s=de.useRef(null),a=de.useRef([]);de.useEffect(()=>{if(!s.current)return;a.current.forEach(c=>{if(c){const u=window.innerWidth*.5/16,d=-Math.random()*u+"rem",h=window.innerWidth*.5/16,f=-Math.random()*h+"rem";c.style.setProperty("--left",d),c.style.setProperty("--right",f)}})},[i,t]);const o=i.length>0?i.slice(0,t):Array.from({length:t},(l,c)=>({src:`https://images.pexels.com/photos/614117/pexels-photo-614117.jpeg?index=${c}`,alt:`Gallery image ${c+1}`}));return se.jsxs(se.Fragment,{children:[se.jsx("style",{children:`
4132
4132
  @import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&display=swap');
4133
4133
 
4134
4134
  @property --translate-z {
@@ -4227,7 +4227,7 @@ void main() {
4227
4227
  --translate-z: 2000px;
4228
4228
  }
4229
4229
  }
4230
- `}),oe.jsxs("section",{ref:s,className:`gallery3d-container ${r}`,style:{"--count":t,"--duration":`${n}s`},children:[oe.jsx("h1",{className:"gallery3d-title",children:e}),oe.jsx("div",{children:o.map((l,c)=>oe.jsx("img",{ref:u=>a.current[c]=u,src:typeof l=="string"?l:l.src,alt:typeof l=="string"?`Gallery image ${c+1}`:l.alt||`Gallery image ${c+1}`,className:"gallery3d-image",style:{"--i":c+1}},c))})]})]})},ug=({speed:i=.1,lineColor:e="#4499ff",pointColors:t=["#00ff00","#ffff00","#4499ff"],fogDensity:n=.7,bloomStrength:r=7,className:s=""})=>{const a=de.useRef(null),o=de.useRef(null),l=de.useRef(null);return de.useEffect(()=>{if(!a.current)return;const c=a.current.querySelector("canvas");c&&a.current.removeChild(c);const u=a.current.clientWidth,d=a.current.clientHeight,h=new hc;h.fog=new Hr(0,n),o.current=h;const f=new Rt(75,u/d,.1,1e3);f.position.z=5;const g=new uc({antialias:!0});g.setSize(u,d),g.toneMapping=Qs,g.outputColorSpace=It,a.current.appendChild(g.domElement);const _=new _c(f,g.domElement);_.enableDamping=!0,_.dampingFactor=.03;const m=new yc(h,f),p=new Un(new ue(u,d),1.5,.4,100);p.threshold=.002,p.strength=r,p.radius=0;const E=new Sc(g);E.addPass(m),E.addPass(p);const v=[-.15439987182617188,-4.138374328613281,-3.073897361755371,-.869240403175354,-5.335973739624023,-2.7324037551879883,-1.633371353149414,-5.862466812133789,-1.7560205459594727,-1.9328842163085938,-5.843876838684082,-1.1907804012298584,-2.15252685546875,-5.668161869049072,-.644770622253418,-2.159583568572998,-5.050915241241455,-.1310250163078308,-2.1433849334716797,-4.40407657623291,.3640003204345703,-2.451664924621582,-3.9286396503448486,1.3159711360931396,-2.7058067321777344,-3.404994487762451,2.207650661468506,-2.0846996307373047,-1.873553991317749,2.309267044067383,-1.2601451873779297,-.2743096351623535,2.092146873474121,-1.0130963325500488,.8422636985778809,2.544243574142456,-.7751436233520508,1.9591703414916992,3.013312339782715,.2966790795326233,4.3367791175842285,2.9735190868377686,1.3506059646606445,4.95012092590332,1.5352253913879395,.9760977625846863,3.2327873706817627,.8298614025115967,.2991504669189453,1.1627817153930664,.39388465881347656,.5221062898635864,.7404534816741943,-.3582862913608551,1.137399673461914,1.2396659851074219,-1.0834779739379883,2.7765538692474365,4.385804653167725,-1.5419139862060547,4.430294990539551,7.450641632080078,-2.0930042266845703,5.475499153137207,7.852602481842041,-3.6867828369140625,5.584137916564941,6.385196685791016,-5.076840400695801,4.807437419891357,3.7945828437805176,-5.751949310302734,3.6053285598754883,1.381692886352539,-5.501461982727051,2.6468048095703125,.4823716878890991,-4.470411777496338,1.65478515625,-.0785517692565918,-3.1033201217651367,.6955953240394592,-1.3061118125915527,-2.337378740310669,.034491539001464844,-2.9893672466278076,-2.4886598587036133,-.0851704403758049,-3.677823543548584,-2.8274037837982178,-.2470083236694336,-4.365466117858887,-3.0880308151245117],b=[],R=v.length;for(let O=0;O<R;O+=3)b.push(new I(v[O],v[O+1],v[O+2]));const T=new pc(b),A=T.getPoints(100),P=new _t().setFromPoints(A),y=new qs({color:new be(e)}),M=new dc(P,y);h.add(M);const F=new sa(T,222,.65,16,!0),L=F.attributes.position,C=new Bi(.01,.01,.01),U=t.map(O=>new be(O)),H=[];for(let O=0;O<L.count;O++){const Q=L.getX(O),ce=L.getY(O),ne=L.getZ(O),ve=O%U.length,Te=new Vi({color:U[ve]}),Ce=new bt(C,Te);Ce.position.set(Q,ce,ne),h.add(Ce),H.push(Ce)}const Y=new Z0(F,.35),J=new qs({color:new be(e)}),z=new F0(Y,J);h.add(z);let j=0;const $=20*400;function N(O){j=O*i;const Q=j%$/$,ce=T.getPointAt(Q),ne=T.getPointAt((Q+.01)%1);f.position.copy(ce),f.lookAt(ne)}function ee(O=0){l.current=requestAnimationFrame(ee),N(O),E.render(h,f),_.update()}ee();const me=()=>{if(!a.current)return;const O=a.current.clientWidth,Q=a.current.clientHeight;f.aspect=O/Q,f.updateProjectionMatrix(),g.setSize(O,Q),E.setSize(O,Q),p.resolution.set(O,Q)};return window.addEventListener("resize",me),()=>{window.removeEventListener("resize",me),l.current&&cancelAnimationFrame(l.current),g.dispose(),P.dispose(),y.dispose(),C.dispose(),H.forEach(O=>{O.material.dispose(),h.remove(O)}),Y.dispose(),J.dispose(),F.dispose(),a.current&&g.domElement&&a.current.removeChild(g.domElement)}},[i,e,t,n,r]),oe.jsx("div",{className:`relative w-full h-full ${s}`,children:oe.jsx("div",{ref:a,className:"w-full h-full"})})};class hg{constructor(e,t={}){this.canvas=e,this.ctx=e.getContext("2d"),this.width=t.width||354,this.height=t.height||504,this.octaves=t.octaves||10,this.lacunarity=t.lacunarity||1.6,this.gain=t.gain||.6,this.amplitude=t.amplitude||.2,this.frequency=t.frequency||5,this.baseFlatness=t.baseFlatness||.2,this.displacement=t.displacement||60,this.speed=t.speed||1,this.borderOffset=t.borderOffset||60,this.borderRadius=t.borderRadius||40,this.lineWidth=t.lineWidth||1,this.color=t.color||"#71717a",this.animationId=null,this.time=0,this.lastFrameTime=0,this.canvas.width=this.width,this.canvas.height=this.height}random(e){return Math.sin(e*12.9898)*43758.5453%1}noise2D(e,t){const n=Math.floor(e),r=Math.floor(t),s=e-n,a=t-r,o=this.random(n+r*57),l=this.random(n+1+r*57),c=this.random(n+(r+1)*57),u=this.random(n+1+(r+1)*57),d=s*s*(3-2*s),h=a*a*(3-2*a);return o*(1-d)*(1-h)+l*d*(1-h)+c*(1-d)*h+u*d*h}octavedNoise(e,t,n,r,s,a,o=0,l=0,c=1){let u=0,d=s,h=a;for(let f=0;f<t;f++){let g=d;f===0&&(g*=c),u+=g*this.noise2D(h*e+l*100,o*h*.3),h*=n,d*=r}return u}getRoundedRectPoint(e,t,n,r,s,a){const o=r-2*a,l=s-2*a,c=Math.PI*a/2,u=2*o+2*l+4*c,d=e*u;let h=0;if(d<=h+o){const g=(d-h)/o;return{x:t+a+g*o,y:n}}if(h+=o,d<=h+c){const g=(d-h)/c;return this.getCornerPoint(t+r-a,n+a,a,-Math.PI/2,Math.PI/2,g)}if(h+=c,d<=h+l){const g=(d-h)/l;return{x:t+r,y:n+a+g*l}}if(h+=l,d<=h+c){const g=(d-h)/c;return this.getCornerPoint(t+r-a,n+s-a,a,0,Math.PI/2,g)}if(h+=c,d<=h+o){const g=(d-h)/o;return{x:t+r-a-g*o,y:n+s}}if(h+=o,d<=h+c){const g=(d-h)/c;return this.getCornerPoint(t+a,n+s-a,a,Math.PI/2,Math.PI/2,g)}if(h+=c,d<=h+l){const g=(d-h)/l;return{x:t,y:n+s-a-g*l}}h+=l;const f=(d-h)/c;return this.getCornerPoint(t+a,n+a,a,Math.PI,Math.PI/2,f)}getCornerPoint(e,t,n,r,s,a){const o=r+a*s;return{x:e+n*Math.cos(o),y:t+n*Math.sin(o)}}drawElectricBorder(e=0){if(!this.canvas||!this.ctx)return;const t=(e-this.lastFrameTime)/1e3;this.time+=t*this.speed,this.lastFrameTime=e,this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.ctx.strokeStyle=this.color,this.ctx.lineWidth=this.lineWidth,this.ctx.lineCap="round",this.ctx.lineJoin="round";const n=this.displacement,r=this.borderOffset,s=this.borderOffset,a=this.canvas.width-2*this.borderOffset,o=this.canvas.height-2*this.borderOffset,l=Math.min(a,o)/2,c=Math.min(this.borderRadius,l),u=2*(a+o)+2*Math.PI*c,d=Math.floor(u/2);this.ctx.beginPath();for(let h=0;h<=d;h++){const f=h/d,g=this.getRoundedRectPoint(f,r,s,a,o,c),_=this.octavedNoise(f*8,this.octaves,this.lacunarity,this.gain,this.amplitude,this.frequency,this.time,0,this.baseFlatness),m=this.octavedNoise(f*8,this.octaves,this.lacunarity,this.gain,this.amplitude,this.frequency,this.time,1,this.baseFlatness),p=g.x+_*n,E=g.y+m*n;h===0?this.ctx.moveTo(p,E):this.ctx.lineTo(p,E)}this.ctx.closePath(),this.ctx.stroke(),this.animationId=requestAnimationFrame(h=>this.drawElectricBorder(h))}start(){this.lastFrameTime=performance.now(),this.animationId=requestAnimationFrame(e=>this.drawElectricBorder(e))}stop(){this.animationId&&(cancelAnimationFrame(this.animationId),this.animationId=null)}updateOptions(e){Object.assign(this,e)}}const dg=({width:i=354,height:e=504,color:t="#71717a",speed:n=1.5,title:r="SparkDesign",description:s="Alibaba Cloud SparkDesign motion component library, bringing vitality and creativity to your products.",buttonText:a="SparkDesign",className:o=""})=>{const l=de.useRef(null),c=de.useRef(null);de.useEffect(()=>{if(!l.current)return;const h=new hg(l.current,{width:475,height:625,octaves:10,lacunarity:1.6,gain:.7,amplitude:.075,frequency:10,baseFlatness:0,displacement:60,speed:n,borderOffset:60,borderRadius:24,lineWidth:1,color:t});return c.current=h,h.start(),()=>{h.stop()}},[]),de.useEffect(()=>{c.current&&c.current.updateOptions({color:t,speed:n})},[t,n]);const u=t,d=t+"66";return oe.jsxs(oe.Fragment,{children:[oe.jsx("style",{children:`
4230
+ `}),se.jsxs("section",{ref:s,className:`gallery3d-container ${r}`,style:{"--count":t,"--duration":`${n}s`},children:[se.jsx("h1",{className:"gallery3d-title",children:e}),se.jsx("div",{children:o.map((l,c)=>se.jsx("img",{ref:u=>a.current[c]=u,src:typeof l=="string"?l:l.src,alt:typeof l=="string"?`Gallery image ${c+1}`:l.alt||`Gallery image ${c+1}`,className:"gallery3d-image",style:{"--i":c+1}},c))})]})]})},ug=({speed:i=.1,lineColor:e="#4499ff",pointColors:t=["#00ff00","#ffff00","#4499ff"],fogDensity:n=.7,bloomStrength:r=7,className:s=""})=>{const a=de.useRef(null),o=de.useRef(null),l=de.useRef(null);return de.useEffect(()=>{if(!a.current)return;const c=a.current.querySelector("canvas");c&&a.current.removeChild(c);const u=a.current.clientWidth,d=a.current.clientHeight,h=new hc;h.fog=new Vr(0,n),o.current=h;const f=new Rt(75,u/d,.1,1e3);f.position.z=5;const g=new uc({antialias:!0});g.setSize(u,d),g.toneMapping=ea,g.outputColorSpace=It,a.current.appendChild(g.domElement);const _=new _c(f,g.domElement);_.enableDamping=!0,_.dampingFactor=.03;const m=new Sc(h,f),p=new Nn(new ue(u,d),1.5,.4,100);p.threshold=.002,p.strength=r,p.radius=0;const E=new yc(g);E.addPass(m),E.addPass(p);const v=[-.15439987182617188,-4.138374328613281,-3.073897361755371,-.869240403175354,-5.335973739624023,-2.7324037551879883,-1.633371353149414,-5.862466812133789,-1.7560205459594727,-1.9328842163085938,-5.843876838684082,-1.1907804012298584,-2.15252685546875,-5.668161869049072,-.644770622253418,-2.159583568572998,-5.050915241241455,-.1310250163078308,-2.1433849334716797,-4.40407657623291,.3640003204345703,-2.451664924621582,-3.9286396503448486,1.3159711360931396,-2.7058067321777344,-3.404994487762451,2.207650661468506,-2.0846996307373047,-1.873553991317749,2.309267044067383,-1.2601451873779297,-.2743096351623535,2.092146873474121,-1.0130963325500488,.8422636985778809,2.544243574142456,-.7751436233520508,1.9591703414916992,3.013312339782715,.2966790795326233,4.3367791175842285,2.9735190868377686,1.3506059646606445,4.95012092590332,1.5352253913879395,.9760977625846863,3.2327873706817627,.8298614025115967,.2991504669189453,1.1627817153930664,.39388465881347656,.5221062898635864,.7404534816741943,-.3582862913608551,1.137399673461914,1.2396659851074219,-1.0834779739379883,2.7765538692474365,4.385804653167725,-1.5419139862060547,4.430294990539551,7.450641632080078,-2.0930042266845703,5.475499153137207,7.852602481842041,-3.6867828369140625,5.584137916564941,6.385196685791016,-5.076840400695801,4.807437419891357,3.7945828437805176,-5.751949310302734,3.6053285598754883,1.381692886352539,-5.501461982727051,2.6468048095703125,.4823716878890991,-4.470411777496338,1.65478515625,-.0785517692565918,-3.1033201217651367,.6955953240394592,-1.3061118125915527,-2.337378740310669,.034491539001464844,-2.9893672466278076,-2.4886598587036133,-.0851704403758049,-3.677823543548584,-2.8274037837982178,-.2470083236694336,-4.365466117858887,-3.0880308151245117],b=[],R=v.length;for(let O=0;O<R;O+=3)b.push(new I(v[O],v[O+1],v[O+2]));const T=new pc(b),A=T.getPoints(100),P=new _t().setFromPoints(A),S=new js({color:new be(e)}),M=new dc(P,S);h.add(M);const F=new aa(T,222,.65,16,!0),L=F.attributes.position,C=new Bi(.01,.01,.01),N=t.map(O=>new be(O)),V=[];for(let O=0;O<L.count;O++){const Q=L.getX(O),ce=L.getY(O),ne=L.getZ(O),ve=O%N.length,Te=new Hi({color:N[ve]}),Ce=new bt(C,Te);Ce.position.set(Q,ce,ne),h.add(Ce),V.push(Ce)}const j=new Z0(F,.35),J=new js({color:new be(e)}),z=new F0(j,J);h.add(z);let Y=0;const $=20*400;function U(O){Y=O*i;const Q=Y%$/$,ce=T.getPointAt(Q),ne=T.getPointAt((Q+.01)%1);f.position.copy(ce),f.lookAt(ne)}function ee(O=0){l.current=requestAnimationFrame(ee),U(O),E.render(h,f),_.update()}ee();const me=()=>{if(!a.current)return;const O=a.current.clientWidth,Q=a.current.clientHeight;f.aspect=O/Q,f.updateProjectionMatrix(),g.setSize(O,Q),E.setSize(O,Q),p.resolution.set(O,Q)};return window.addEventListener("resize",me),()=>{window.removeEventListener("resize",me),l.current&&cancelAnimationFrame(l.current),g.dispose(),P.dispose(),S.dispose(),C.dispose(),V.forEach(O=>{O.material.dispose(),h.remove(O)}),j.dispose(),J.dispose(),F.dispose(),a.current&&g.domElement&&a.current.removeChild(g.domElement)}},[i,e,t,n,r]),se.jsx("div",{className:`relative w-full h-full ${s}`,children:se.jsx("div",{ref:a,className:"w-full h-full"})})};class hg{constructor(e,t={}){this.canvas=e,this.ctx=e.getContext("2d"),this.width=t.width||354,this.height=t.height||504,this.octaves=t.octaves||10,this.lacunarity=t.lacunarity||1.6,this.gain=t.gain||.6,this.amplitude=t.amplitude||.2,this.frequency=t.frequency||5,this.baseFlatness=t.baseFlatness||.2,this.displacement=t.displacement||60,this.speed=t.speed||1,this.borderOffset=t.borderOffset||60,this.borderRadius=t.borderRadius||40,this.lineWidth=t.lineWidth||1,this.color=t.color||"#71717a",this.animationId=null,this.time=0,this.lastFrameTime=0,this.canvas.width=this.width,this.canvas.height=this.height}random(e){return Math.sin(e*12.9898)*43758.5453%1}noise2D(e,t){const n=Math.floor(e),r=Math.floor(t),s=e-n,a=t-r,o=this.random(n+r*57),l=this.random(n+1+r*57),c=this.random(n+(r+1)*57),u=this.random(n+1+(r+1)*57),d=s*s*(3-2*s),h=a*a*(3-2*a);return o*(1-d)*(1-h)+l*d*(1-h)+c*(1-d)*h+u*d*h}octavedNoise(e,t,n,r,s,a,o=0,l=0,c=1){let u=0,d=s,h=a;for(let f=0;f<t;f++){let g=d;f===0&&(g*=c),u+=g*this.noise2D(h*e+l*100,o*h*.3),h*=n,d*=r}return u}getRoundedRectPoint(e,t,n,r,s,a){const o=r-2*a,l=s-2*a,c=Math.PI*a/2,u=2*o+2*l+4*c,d=e*u;let h=0;if(d<=h+o){const g=(d-h)/o;return{x:t+a+g*o,y:n}}if(h+=o,d<=h+c){const g=(d-h)/c;return this.getCornerPoint(t+r-a,n+a,a,-Math.PI/2,Math.PI/2,g)}if(h+=c,d<=h+l){const g=(d-h)/l;return{x:t+r,y:n+a+g*l}}if(h+=l,d<=h+c){const g=(d-h)/c;return this.getCornerPoint(t+r-a,n+s-a,a,0,Math.PI/2,g)}if(h+=c,d<=h+o){const g=(d-h)/o;return{x:t+r-a-g*o,y:n+s}}if(h+=o,d<=h+c){const g=(d-h)/c;return this.getCornerPoint(t+a,n+s-a,a,Math.PI/2,Math.PI/2,g)}if(h+=c,d<=h+l){const g=(d-h)/l;return{x:t,y:n+s-a-g*l}}h+=l;const f=(d-h)/c;return this.getCornerPoint(t+a,n+a,a,Math.PI,Math.PI/2,f)}getCornerPoint(e,t,n,r,s,a){const o=r+a*s;return{x:e+n*Math.cos(o),y:t+n*Math.sin(o)}}drawElectricBorder(e=0){if(!this.canvas||!this.ctx)return;const t=(e-this.lastFrameTime)/1e3;this.time+=t*this.speed,this.lastFrameTime=e,this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.ctx.strokeStyle=this.color,this.ctx.lineWidth=this.lineWidth,this.ctx.lineCap="round",this.ctx.lineJoin="round";const n=this.displacement,r=this.borderOffset,s=this.borderOffset,a=this.canvas.width-2*this.borderOffset,o=this.canvas.height-2*this.borderOffset,l=Math.min(a,o)/2,c=Math.min(this.borderRadius,l),u=2*(a+o)+2*Math.PI*c,d=Math.floor(u/2);this.ctx.beginPath();for(let h=0;h<=d;h++){const f=h/d,g=this.getRoundedRectPoint(f,r,s,a,o,c),_=this.octavedNoise(f*8,this.octaves,this.lacunarity,this.gain,this.amplitude,this.frequency,this.time,0,this.baseFlatness),m=this.octavedNoise(f*8,this.octaves,this.lacunarity,this.gain,this.amplitude,this.frequency,this.time,1,this.baseFlatness),p=g.x+_*n,E=g.y+m*n;h===0?this.ctx.moveTo(p,E):this.ctx.lineTo(p,E)}this.ctx.closePath(),this.ctx.stroke(),this.animationId=requestAnimationFrame(h=>this.drawElectricBorder(h))}start(){this.lastFrameTime=performance.now(),this.animationId=requestAnimationFrame(e=>this.drawElectricBorder(e))}stop(){this.animationId&&(cancelAnimationFrame(this.animationId),this.animationId=null)}updateOptions(e){Object.assign(this,e)}}const dg=({width:i=354,height:e=504,color:t="#71717a",speed:n=1.5,title:r="SparkDesign",description:s="Alibaba Cloud SparkDesign motion component library, bringing vitality and creativity to your products.",buttonText:a="SparkDesign",className:o=""})=>{const l=de.useRef(null),c=de.useRef(null);de.useEffect(()=>{if(!l.current)return;const h=new hg(l.current,{width:475,height:625,octaves:10,lacunarity:1.6,gain:.7,amplitude:.075,frequency:10,baseFlatness:0,displacement:60,speed:n,borderOffset:60,borderRadius:24,lineWidth:1,color:t});return c.current=h,h.start(),()=>{h.stop()}},[]),de.useEffect(()=>{c.current&&c.current.updateOptions({color:t,speed:n})},[t,n]);const u=t,d=t+"66";return se.jsxs(se.Fragment,{children:[se.jsx("style",{children:`
4231
4231
  .electric-border-card {
4232
4232
  --electric-border-color: ${t};
4233
4233
  --electric-light-color: ${u};
@@ -4470,11 +4470,11 @@ void main() {
4470
4470
  transparent
4471
4471
  );
4472
4472
  }
4473
- `}),oe.jsx("div",{className:`electric-border-card ${o}`,children:oe.jsxs("div",{className:"electric-border-card-container",children:[oe.jsxs("div",{className:"electric-border-inner-container",children:[oe.jsx("div",{className:"electric-border-canvas-container",children:oe.jsx("canvas",{ref:l,className:"electric-border-canvas",width:475,height:625})}),oe.jsx("div",{className:"electric-border-glow-layer-1"}),oe.jsx("div",{className:"electric-border-glow-layer-2"})]}),oe.jsx("div",{className:"electric-border-overlay-1"}),oe.jsx("div",{className:"electric-border-overlay-2"}),oe.jsx("div",{className:"electric-border-background-glow"}),oe.jsxs("div",{className:"electric-border-content-container",children:[oe.jsxs("div",{className:"electric-border-content-top",children:[oe.jsx("div",{className:"electric-border-button-glass",children:a}),oe.jsx("p",{className:"electric-border-title",children:r})]}),oe.jsx("hr",{className:"electric-border-divider"}),oe.jsx("div",{className:"electric-border-content-bottom",children:oe.jsx("p",{className:"electric-border-description",children:s})})]})]})})]})},fg=({cardCount:i=6,radius:e=500,curvature:t=10,images:n=[],cardWidth:r=200,cardHeight:s=300,className:a=""})=>{const o=de.useRef(null),l=de.useRef(null),c=de.useRef([]),u=["https://cdn.prod.website-files.com/679185b32f76eb227e8b2d64/690e228d4e47784421489090_e94dfb12e66c3ad5ce888a87139fb6e1.jpg","https://cdn.prod.website-files.com/679185b32f76eb227e8b2d64/68cc3546a30d418181506343_49154acfd6aa76f4bf21b4f4aac6d938.jpg","https://cdn.prod.website-files.com/679185b32f76eb227e8b2d64/690e21bca5a1e6afcad44a90_1661362d69d4f83dbb9635d50fe19695.jpg","https://cdn.prod.website-files.com/679185b32f76eb227e8b2d64/68cc3546430643d66ba5571a_c49ec3146d5ee88438a57615125aeb38.jpg","https://cdn.prod.website-files.com/679185b32f76eb227e8b2d64/68cc34c5e8f1a1601339ac88_78b4d0a1169a170c3d8efda43133bca0.jpg","https://cdn.prod.website-files.com/679185b32f76eb227e8b2d64/690e2269ff449135d95c027c_10cd22f7410c9c89996ef4459495caba.jpg"],d=n.length>0?n:u;return de.useEffect(()=>{if(!l.current||!c.current.length)return;const h=c.current,f=h.length;[...h].reverse().forEach((g,_)=>{if(!g)return;const m=_/f*Math.PI*2,p=Math.sin(m)*t;g.style.transform=`
4473
+ `}),se.jsx("div",{className:`electric-border-card ${o}`,children:se.jsxs("div",{className:"electric-border-card-container",children:[se.jsxs("div",{className:"electric-border-inner-container",children:[se.jsx("div",{className:"electric-border-canvas-container",children:se.jsx("canvas",{ref:l,className:"electric-border-canvas",width:475,height:625})}),se.jsx("div",{className:"electric-border-glow-layer-1"}),se.jsx("div",{className:"electric-border-glow-layer-2"})]}),se.jsx("div",{className:"electric-border-overlay-1"}),se.jsx("div",{className:"electric-border-overlay-2"}),se.jsx("div",{className:"electric-border-background-glow"}),se.jsxs("div",{className:"electric-border-content-container",children:[se.jsxs("div",{className:"electric-border-content-top",children:[se.jsx("div",{className:"electric-border-button-glass",children:a}),se.jsx("p",{className:"electric-border-title",children:r})]}),se.jsx("hr",{className:"electric-border-divider"}),se.jsx("div",{className:"electric-border-content-bottom",children:se.jsx("p",{className:"electric-border-description",children:s})})]})]})})]})},fg=({cardCount:i=6,radius:e=500,curvature:t=10,images:n=[],cardWidth:r=200,cardHeight:s=300,className:a=""})=>{const o=de.useRef(null),l=de.useRef(null),c=de.useRef([]),u=["https://cdn.prod.website-files.com/679185b32f76eb227e8b2d64/690e228d4e47784421489090_e94dfb12e66c3ad5ce888a87139fb6e1.jpg","https://cdn.prod.website-files.com/679185b32f76eb227e8b2d64/68cc3546a30d418181506343_49154acfd6aa76f4bf21b4f4aac6d938.jpg","https://cdn.prod.website-files.com/679185b32f76eb227e8b2d64/690e21bca5a1e6afcad44a90_1661362d69d4f83dbb9635d50fe19695.jpg","https://cdn.prod.website-files.com/679185b32f76eb227e8b2d64/68cc3546430643d66ba5571a_c49ec3146d5ee88438a57615125aeb38.jpg","https://cdn.prod.website-files.com/679185b32f76eb227e8b2d64/68cc34c5e8f1a1601339ac88_78b4d0a1169a170c3d8efda43133bca0.jpg","https://cdn.prod.website-files.com/679185b32f76eb227e8b2d64/690e2269ff449135d95c027c_10cd22f7410c9c89996ef4459495caba.jpg"],d=n.length>0?n:u;return de.useEffect(()=>{if(!l.current||!c.current.length)return;const h=c.current,f=h.length;[...h].reverse().forEach((g,_)=>{if(!g)return;const m=_/f*Math.PI*2,p=Math.sin(m)*t;g.style.transform=`
4474
4474
  rotateX(${m*180/Math.PI}deg)
4475
4475
  translateZ(${e}px)
4476
4476
  rotateY(${p}deg)
4477
- `})},[i,e,t]),de.useEffect(()=>{c.current.forEach((h,f)=>{if(!h)return;const g=d[f%d.length];g&&(h.style.background=`url(${g}) center/cover no-repeat`)})},[d,i]),de.useEffect(()=>{if(!l.current)return;const h=()=>{const f=document.body.scrollHeight-window.innerHeight,_=(f>0?window.scrollY/f:0)*360;l.current&&(l.current.style.transform=`rotateX(${_}deg)`)};return window.addEventListener("scroll",h),h(),()=>{window.removeEventListener("scroll",h)}},[]),oe.jsxs(oe.Fragment,{children:[oe.jsx("style",{children:`
4477
+ `})},[i,e,t]),de.useEffect(()=>{c.current.forEach((h,f)=>{if(!h)return;const g=d[f%d.length];g&&(h.style.background=`url(${g}) center/cover no-repeat`)})},[d,i]),de.useEffect(()=>{if(!l.current)return;const h=()=>{const f=document.body.scrollHeight-window.innerHeight,_=(f>0?window.scrollY/f:0)*360;l.current&&(l.current.style.transform=`rotateX(${_}deg)`)};return window.addEventListener("scroll",h),h(),()=>{window.removeEventListener("scroll",h)}},[]),se.jsxs(se.Fragment,{children:[se.jsx("style",{children:`
4478
4478
  .scroll-cards-3d-scene {
4479
4479
  position: sticky;
4480
4480
  top: 0;
@@ -4511,18 +4511,18 @@ void main() {
4511
4511
  backface-visibility: hidden;
4512
4512
  transform-origin: center center;
4513
4513
  }
4514
- `}),oe.jsx("div",{className:`scroll-cards-3d-scene ${a}`,ref:o,children:oe.jsx("div",{className:"scroll-cards-3d-container",ref:l,children:Array.from({length:i},(h,f)=>oe.jsx("div",{className:"scroll-cards-3d-card",ref:g=>{g&&(c.current[f]=g)}},f))})})]})},pg=({onClick:i,size:e=400,className:t="",icon:n,hoverGradient:r="linear-gradient(180deg, #3EF7A4 0%, rgba(62, 247, 164, 0) 100%)"})=>{const s=de.useRef(null),a=de.useRef(null),o=de.useRef(null),[l,c]=de.useState(!1),u=400,d=e/u;de.useEffect(()=>{let g=!0;return(async()=>{try{const{liquidMetalFragmentShader:m,ShaderMount:p}=await import("https://esm.sh/@paper-design/shaders");if(!g||!s.current)return;a.current&&(typeof a.current.destroy=="function"&&a.current.destroy(),a.current=null);const E=new p(s.current,m,{u_repetition:1.5,u_softness:.5,u_shiftRed:.3,u_shiftBlue:.3,u_distortion:0,u_contour:0,u_angle:100,u_scale:1.5,u_shape:1,u_offsetX:.1,u_offsetY:-.1},void 0,.6);a.current=E}catch(m){console.error("Failed to load shader:",m)}})(),()=>{g=!1,a.current&&(typeof a.current.destroy=="function"&&a.current.destroy(),a.current=null)}},[]);const h=u*.52,f=()=>n&&de.isValidElement(n)?oe.jsx("div",{style:{width:`${h}px`,height:`${h}px`,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,position:"relative",zIndex:1},children:de.cloneElement(n,{className:`text-zinc-400 ${n.props?.className||""}`,style:{color:l?"#ffffff":"rgb(161 161 170 / 1.0)",width:"100%",height:"100%",display:"block",margin:0,padding:0,fontSize:`${h}px`,transition:"color 0.3s ease",...n.props?.style}})}):null;return oe.jsx("div",{className:`relative ${t}`,style:{width:`${e}px`,height:`${e}px`,display:"flex",alignItems:"center",justifyContent:"center"},children:oe.jsxs("div",{style:{width:`${u}px`,height:`${u}px`,transform:`scale(${d})`,transformOrigin:"center center",borderRadius:"50%",position:"relative"},children:[oe.jsx("div",{ref:s,id:"liquid-metal-container",style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:`${u}px`,height:`${u}px`,borderRadius:"50%",overflow:"hidden"}}),oe.jsx("div",{style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:`${u*.91}px`,height:`${u*.91}px`,background:"linear-gradient(rgb(68 68 68 / 1.0), rgb(0 0 0 / 1.0))",borderRadius:"50%",boxShadow:"inset 0 0.2rem 0.2rem 0.2rem rgba(255, 255, 255, 0.3)",zIndex:0}}),oe.jsx("div",{className:"outline group",style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",display:"flex",alignItems:"center",justifyContent:"center",width:`${u*1.01}px`,height:`${u*1.01}px`,borderRadius:"50%",zIndex:1,pointerEvents:"none"},children:oe.jsx("div",{ref:o,className:"outline-border",style:{position:"absolute",inset:0,padding:"0.5rem",borderRadius:"inherit",background:r,filter:l?"grayscale(0)":"grayscale(1)",WebkitMask:"linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0)",WebkitMaskComposite:"xor",mask:"linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0)",maskComposite:"exclude",transition:"all 0.3s ease"}})}),oe.jsx("div",{style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:2,pointerEvents:"none"},children:f()}),oe.jsx("button",{onClick:i,className:"absolute inset-0 rounded-full cursor-pointer",style:{zIndex:3,background:"transparent",border:"none",padding:0,margin:0},"aria-label":"Liquid Metal Button",onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1)})]})})},mg=({color:i="#a5a5b0",size:e=40,count:t=9,className:n=""})=>{const r=t===9,s=r?[0,50,100,150,200,250,300,350,400]:[0,200,300,400,500,600],a=3,o=r?3:2;return oe.jsx("div",{className:aa(`grid grid-cols-${a} grid-rows-${o} gap-1.5`,n),style:{width:e,height:e,gridTemplateColumns:`repeat(${a}, 1fr)`,gridTemplateRows:`repeat(${o}, 1fr)`},children:s.map((l,c)=>{const u=r?2:1.2,d=r?[0,.05,.25,.5,.75,1]:[0,.2,.6,.8,1],h=r?[.5,1,1,1,.5,.5]:[.5,1,1,1,.5],f=r?[.3,1,1,1,.3,.3]:[.3,1,1,1,.3];return oe.jsx(Mt.motion.div,{style:{backgroundColor:i,aspectRatio:"1 / 1",width:"100%",height:"100%"},animate:{scale:h,opacity:f},transition:{duration:u,repeat:1/0,delay:l/1e3,ease:"easeInOut",times:d}},c)})})};function Ii(i){let e=i[0],t=i[1],n=i[2];return Math.sqrt(e*e+t*t+n*n)}function $s(i,e){return i[0]=e[0],i[1]=e[1],i[2]=e[2],i}function gg(i,e,t,n){return i[0]=e,i[1]=t,i[2]=n,i}function ol(i,e,t){return i[0]=e[0]+t[0],i[1]=e[1]+t[1],i[2]=e[2]+t[2],i}function ll(i,e,t){return i[0]=e[0]-t[0],i[1]=e[1]-t[1],i[2]=e[2]-t[2],i}function _g(i,e,t){return i[0]=e[0]*t[0],i[1]=e[1]*t[1],i[2]=e[2]*t[2],i}function xg(i,e,t){return i[0]=e[0]/t[0],i[1]=e[1]/t[1],i[2]=e[2]/t[2],i}function Rs(i,e,t){return i[0]=e[0]*t,i[1]=e[1]*t,i[2]=e[2]*t,i}function vg(i,e){let t=e[0]-i[0],n=e[1]-i[1],r=e[2]-i[2];return Math.sqrt(t*t+n*n+r*r)}function Mg(i,e){let t=e[0]-i[0],n=e[1]-i[1],r=e[2]-i[2];return t*t+n*n+r*r}function cl(i){let e=i[0],t=i[1],n=i[2];return e*e+t*t+n*n}function Sg(i,e){return i[0]=-e[0],i[1]=-e[1],i[2]=-e[2],i}function yg(i,e){return i[0]=1/e[0],i[1]=1/e[1],i[2]=1/e[2],i}function js(i,e){let t=e[0],n=e[1],r=e[2],s=t*t+n*n+r*r;return s>0&&(s=1/Math.sqrt(s)),i[0]=e[0]*s,i[1]=e[1]*s,i[2]=e[2]*s,i}function Ec(i,e){return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]}function ul(i,e,t){let n=e[0],r=e[1],s=e[2],a=t[0],o=t[1],l=t[2];return i[0]=r*l-s*o,i[1]=s*a-n*l,i[2]=n*o-r*a,i}function Eg(i,e,t,n){let r=e[0],s=e[1],a=e[2];return i[0]=r+n*(t[0]-r),i[1]=s+n*(t[1]-s),i[2]=a+n*(t[2]-a),i}function bg(i,e,t,n,r){const s=Math.exp(-n*r);let a=e[0],o=e[1],l=e[2];return i[0]=t[0]+(a-t[0])*s,i[1]=t[1]+(o-t[1])*s,i[2]=t[2]+(l-t[2])*s,i}function Tg(i,e,t){let n=e[0],r=e[1],s=e[2],a=t[3]*n+t[7]*r+t[11]*s+t[15];return a=a||1,i[0]=(t[0]*n+t[4]*r+t[8]*s+t[12])/a,i[1]=(t[1]*n+t[5]*r+t[9]*s+t[13])/a,i[2]=(t[2]*n+t[6]*r+t[10]*s+t[14])/a,i}function Dg(i,e,t){let n=e[0],r=e[1],s=e[2],a=t[3]*n+t[7]*r+t[11]*s+t[15];return a=a||1,i[0]=(t[0]*n+t[4]*r+t[8]*s)/a,i[1]=(t[1]*n+t[5]*r+t[9]*s)/a,i[2]=(t[2]*n+t[6]*r+t[10]*s)/a,i}function Ag(i,e,t){let n=e[0],r=e[1],s=e[2];return i[0]=n*t[0]+r*t[3]+s*t[6],i[1]=n*t[1]+r*t[4]+s*t[7],i[2]=n*t[2]+r*t[5]+s*t[8],i}function wg(i,e,t){let n=e[0],r=e[1],s=e[2],a=t[0],o=t[1],l=t[2],c=t[3],u=o*s-l*r,d=l*n-a*s,h=a*r-o*n,f=o*h-l*d,g=l*u-a*h,_=a*d-o*u,m=c*2;return u*=m,d*=m,h*=m,f*=2,g*=2,_*=2,i[0]=n+u+f,i[1]=r+d+g,i[2]=s+h+_,i}const Cg=(function(){const i=[0,0,0],e=[0,0,0];return function(t,n){$s(i,t),$s(e,n),js(i,i),js(e,e);let r=Ec(i,e);return r>1?0:r<-1?Math.PI:Math.acos(r)}})();function Rg(i,e){return i[0]===e[0]&&i[1]===e[1]&&i[2]===e[2]}class kt extends Array{constructor(e=0,t=e,n=e){return super(e,t,n),this}get x(){return this[0]}get y(){return this[1]}get z(){return this[2]}set x(e){this[0]=e}set y(e){this[1]=e}set z(e){this[2]=e}set(e,t=e,n=e){return e.length?this.copy(e):(gg(this,e,t,n),this)}copy(e){return $s(this,e),this}add(e,t){return t?ol(this,e,t):ol(this,this,e),this}sub(e,t){return t?ll(this,e,t):ll(this,this,e),this}multiply(e){return e.length?_g(this,this,e):Rs(this,this,e),this}divide(e){return e.length?xg(this,this,e):Rs(this,this,1/e),this}inverse(e=this){return yg(this,e),this}len(){return Ii(this)}distance(e){return e?vg(this,e):Ii(this)}squaredLen(){return cl(this)}squaredDistance(e){return e?Mg(this,e):cl(this)}negate(e=this){return Sg(this,e),this}cross(e,t){return t?ul(this,e,t):ul(this,this,e),this}scale(e){return Rs(this,this,e),this}normalize(){return js(this,this),this}dot(e){return Ec(this,e)}equals(e){return Rg(this,e)}applyMatrix3(e){return Ag(this,this,e),this}applyMatrix4(e){return Tg(this,this,e),this}scaleRotateMatrix4(e){return Dg(this,this,e),this}applyQuaternion(e){return wg(this,this,e),this}angle(e){return Cg(this,e)}lerp(e,t){return Eg(this,this,e,t),this}smoothLerp(e,t,n){return bg(this,this,e,t,n),this}clone(){return new kt(this[0],this[1],this[2])}fromArray(e,t=0){return this[0]=e[t],this[1]=e[t+1],this[2]=e[t+2],this}toArray(e=[],t=0){return e[t]=this[0],e[t+1]=this[1],e[t+2]=this[2],e}transformDirection(e){const t=this[0],n=this[1],r=this[2];return this[0]=e[0]*t+e[4]*n+e[8]*r,this[1]=e[1]*t+e[5]*n+e[9]*r,this[2]=e[2]*t+e[6]*n+e[10]*r,this.normalize()}}const hl=new kt;let Pg=1,Lg=1,dl=!1;class Fg{constructor(e,t={}){e.canvas||console.error("gl not passed as first argument to Geometry"),this.gl=e,this.attributes=t,this.id=Pg++,this.VAOs={},this.drawRange={start:0,count:0},this.instancedCount=0,this.gl.renderer.bindVertexArray(null),this.gl.renderer.currentGeometry=null,this.glState=this.gl.renderer.state;for(let n in t)this.addAttribute(n,t[n])}addAttribute(e,t){if(this.attributes[e]=t,t.id=Lg++,t.size=t.size||1,t.type=t.type||(t.data.constructor===Float32Array?this.gl.FLOAT:t.data.constructor===Uint16Array?this.gl.UNSIGNED_SHORT:this.gl.UNSIGNED_INT),t.target=e==="index"?this.gl.ELEMENT_ARRAY_BUFFER:this.gl.ARRAY_BUFFER,t.normalized=t.normalized||!1,t.stride=t.stride||0,t.offset=t.offset||0,t.count=t.count||(t.stride?t.data.byteLength/t.stride:t.data.length/t.size),t.divisor=t.instanced||0,t.needsUpdate=!1,t.usage=t.usage||this.gl.STATIC_DRAW,t.buffer||this.updateAttribute(t),t.divisor){if(this.isInstanced=!0,this.instancedCount&&this.instancedCount!==t.count*t.divisor)return console.warn("geometry has multiple instanced buffers of different length"),this.instancedCount=Math.min(this.instancedCount,t.count*t.divisor);this.instancedCount=t.count*t.divisor}else e==="index"?this.drawRange.count=t.count:this.attributes.index||(this.drawRange.count=Math.max(this.drawRange.count,t.count))}updateAttribute(e){const t=!e.buffer;t&&(e.buffer=this.gl.createBuffer()),this.glState.boundBuffer!==e.buffer&&(this.gl.bindBuffer(e.target,e.buffer),this.glState.boundBuffer=e.buffer),t?this.gl.bufferData(e.target,e.data,e.usage):this.gl.bufferSubData(e.target,0,e.data),e.needsUpdate=!1}setIndex(e){this.addAttribute("index",e)}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}setInstancedCount(e){this.instancedCount=e}createVAO(e){this.VAOs[e.attributeOrder]=this.gl.renderer.createVertexArray(),this.gl.renderer.bindVertexArray(this.VAOs[e.attributeOrder]),this.bindAttributes(e)}bindAttributes(e){e.attributeLocations.forEach((t,{name:n,type:r})=>{if(!this.attributes[n]){console.warn(`active attribute ${n} not being supplied`);return}const s=this.attributes[n];this.gl.bindBuffer(s.target,s.buffer),this.glState.boundBuffer=s.buffer;let a=1;r===35674&&(a=2),r===35675&&(a=3),r===35676&&(a=4);const o=s.size/a,l=a===1?0:a*a*4,c=a===1?0:a*4;for(let u=0;u<a;u++)this.gl.vertexAttribPointer(t+u,o,s.type,s.normalized,s.stride+l,s.offset+u*c),this.gl.enableVertexAttribArray(t+u),this.gl.renderer.vertexAttribDivisor(t+u,s.divisor)}),this.attributes.index&&this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER,this.attributes.index.buffer)}draw({program:e,mode:t=this.gl.TRIANGLES}){this.gl.renderer.currentGeometry!==`${this.id}_${e.attributeOrder}`&&(this.VAOs[e.attributeOrder]||this.createVAO(e),this.gl.renderer.bindVertexArray(this.VAOs[e.attributeOrder]),this.gl.renderer.currentGeometry=`${this.id}_${e.attributeOrder}`),e.attributeLocations.forEach((r,{name:s})=>{const a=this.attributes[s];a.needsUpdate&&this.updateAttribute(a)});let n=2;this.attributes.index?.type===this.gl.UNSIGNED_INT&&(n=4),this.isInstanced?this.attributes.index?this.gl.renderer.drawElementsInstanced(t,this.drawRange.count,this.attributes.index.type,this.attributes.index.offset+this.drawRange.start*n,this.instancedCount):this.gl.renderer.drawArraysInstanced(t,this.drawRange.start,this.drawRange.count,this.instancedCount):this.attributes.index?this.gl.drawElements(t,this.drawRange.count,this.attributes.index.type,this.attributes.index.offset+this.drawRange.start*n):this.gl.drawArrays(t,this.drawRange.start,this.drawRange.count)}getPosition(){const e=this.attributes.position;if(e.data)return e;if(!dl)return console.warn("No position buffer data found to compute bounds"),dl=!0}computeBoundingBox(e){e||(e=this.getPosition());const t=e.data,n=e.size;this.bounds||(this.bounds={min:new kt,max:new kt,center:new kt,scale:new kt,radius:1/0});const r=this.bounds.min,s=this.bounds.max,a=this.bounds.center,o=this.bounds.scale;r.set(1/0),s.set(-1/0);for(let l=0,c=t.length;l<c;l+=n){const u=t[l],d=t[l+1],h=t[l+2];r.x=Math.min(u,r.x),r.y=Math.min(d,r.y),r.z=Math.min(h,r.z),s.x=Math.max(u,s.x),s.y=Math.max(d,s.y),s.z=Math.max(h,s.z)}o.sub(s,r),a.add(r,s).divide(2)}computeBoundingSphere(e){e||(e=this.getPosition());const t=e.data,n=e.size;this.bounds||this.computeBoundingBox(e);let r=0;for(let s=0,a=t.length;s<a;s+=n)hl.fromArray(t,s),r=Math.max(r,this.bounds.center.squaredDistance(hl));this.bounds.radius=Math.sqrt(r)}remove(){for(let e in this.VAOs)this.gl.renderer.deleteVertexArray(this.VAOs[e]),delete this.VAOs[e];for(let e in this.attributes)this.gl.deleteBuffer(this.attributes[e].buffer),delete this.attributes[e]}}let Ig=1;const fl={};class Ug{constructor(e,{vertex:t,fragment:n,uniforms:r={},transparent:s=!1,cullFace:a=e.BACK,frontFace:o=e.CCW,depthTest:l=!0,depthWrite:c=!0,depthFunc:u=e.LEQUAL}={}){e.canvas||console.error("gl not passed as first argument to Program"),this.gl=e,this.uniforms=r,this.id=Ig++,t||console.warn("vertex shader not supplied"),n||console.warn("fragment shader not supplied"),this.transparent=s,this.cullFace=a,this.frontFace=o,this.depthTest=l,this.depthWrite=c,this.depthFunc=u,this.blendFunc={},this.blendEquation={},this.stencilFunc={},this.stencilOp={},this.transparent&&!this.blendFunc.src&&(this.gl.renderer.premultipliedAlpha?this.setBlendFunc(this.gl.ONE,this.gl.ONE_MINUS_SRC_ALPHA):this.setBlendFunc(this.gl.SRC_ALPHA,this.gl.ONE_MINUS_SRC_ALPHA)),this.vertexShader=e.createShader(e.VERTEX_SHADER),this.fragmentShader=e.createShader(e.FRAGMENT_SHADER),this.program=e.createProgram(),e.attachShader(this.program,this.vertexShader),e.attachShader(this.program,this.fragmentShader),this.setShaders({vertex:t,fragment:n})}setShaders({vertex:e,fragment:t}){if(e&&(this.gl.shaderSource(this.vertexShader,e),this.gl.compileShader(this.vertexShader),this.gl.getShaderInfoLog(this.vertexShader)!==""&&console.warn(`${this.gl.getShaderInfoLog(this.vertexShader)}
4514
+ `}),se.jsx("div",{className:`scroll-cards-3d-scene ${a}`,ref:o,children:se.jsx("div",{className:"scroll-cards-3d-container",ref:l,children:Array.from({length:i},(h,f)=>se.jsx("div",{className:"scroll-cards-3d-card",ref:g=>{g&&(c.current[f]=g)}},f))})})]})},pg=({onClick:i,size:e=400,className:t="",icon:n,hoverGradient:r="linear-gradient(180deg, #3EF7A4 0%, rgba(62, 247, 164, 0) 100%)"})=>{const s=de.useRef(null),a=de.useRef(null),o=de.useRef(null),[l,c]=de.useState(!1),u=400,d=e/u;de.useEffect(()=>{let g=!0;return(async()=>{try{const{liquidMetalFragmentShader:m,ShaderMount:p}=await import("https://esm.sh/@paper-design/shaders");if(!g||!s.current)return;a.current&&(typeof a.current.destroy=="function"&&a.current.destroy(),a.current=null);const E=new p(s.current,m,{u_repetition:1.5,u_softness:.5,u_shiftRed:.3,u_shiftBlue:.3,u_distortion:0,u_contour:0,u_angle:100,u_scale:1.5,u_shape:1,u_offsetX:.1,u_offsetY:-.1},void 0,.6);a.current=E}catch(m){console.error("Failed to load shader:",m)}})(),()=>{g=!1,a.current&&(typeof a.current.destroy=="function"&&a.current.destroy(),a.current=null)}},[]);const h=u*.52,f=()=>n&&de.isValidElement(n)?se.jsx("div",{style:{width:`${h}px`,height:`${h}px`,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,position:"relative",zIndex:1},children:de.cloneElement(n,{className:`text-zinc-400 ${n.props?.className||""}`,style:{color:l?"#ffffff":"rgb(161 161 170 / 1.0)",width:"100%",height:"100%",display:"block",margin:0,padding:0,fontSize:`${h}px`,transition:"color 0.3s ease",...n.props?.style}})}):null;return se.jsx("div",{className:`relative ${t}`,style:{width:`${e}px`,height:`${e}px`,display:"flex",alignItems:"center",justifyContent:"center"},children:se.jsxs("div",{style:{width:`${u}px`,height:`${u}px`,transform:`scale(${d})`,transformOrigin:"center center",borderRadius:"50%",position:"relative"},children:[se.jsx("div",{ref:s,id:"liquid-metal-container",style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:`${u}px`,height:`${u}px`,borderRadius:"50%",overflow:"hidden"}}),se.jsx("div",{style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:`${u*.91}px`,height:`${u*.91}px`,background:"linear-gradient(rgb(68 68 68 / 1.0), rgb(0 0 0 / 1.0))",borderRadius:"50%",boxShadow:"inset 0 0.2rem 0.2rem 0.2rem rgba(255, 255, 255, 0.3)",zIndex:0}}),se.jsx("div",{className:"outline group",style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",display:"flex",alignItems:"center",justifyContent:"center",width:`${u*1.01}px`,height:`${u*1.01}px`,borderRadius:"50%",zIndex:1,pointerEvents:"none"},children:se.jsx("div",{ref:o,className:"outline-border",style:{position:"absolute",inset:0,padding:"0.5rem",borderRadius:"inherit",background:r,filter:l?"grayscale(0)":"grayscale(1)",WebkitMask:"linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0)",WebkitMaskComposite:"xor",mask:"linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0)",maskComposite:"exclude",transition:"all 0.3s ease"}})}),se.jsx("div",{style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:2,pointerEvents:"none"},children:f()}),se.jsx("button",{onClick:i,className:"absolute inset-0 rounded-full cursor-pointer",style:{zIndex:3,background:"transparent",border:"none",padding:0,margin:0},"aria-label":"Liquid Metal Button",onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1)})]})})},mg=({color:i="#a5a5b0",size:e=40,count:t=9,className:n=""})=>{const r=t===9,s=r?[0,50,100,150,200,250,300,350,400]:[0,200,300,400,500,600],a=3,o=r?3:2;return se.jsx("div",{className:Hr(`grid grid-cols-${a} grid-rows-${o} gap-1.5`,n),style:{width:e,height:e,gridTemplateColumns:`repeat(${a}, 1fr)`,gridTemplateRows:`repeat(${o}, 1fr)`},children:s.map((l,c)=>{const u=r?2:1.2,d=r?[0,.05,.25,.5,.75,1]:[0,.2,.6,.8,1],h=r?[.5,1,1,1,.5,.5]:[.5,1,1,1,.5],f=r?[.3,1,1,1,.3,.3]:[.3,1,1,1,.3];return se.jsx(Mt.motion.div,{style:{backgroundColor:i,aspectRatio:"1 / 1",width:"100%",height:"100%"},animate:{scale:h,opacity:f},transition:{duration:u,repeat:1/0,delay:l/1e3,ease:"easeInOut",times:d}},c)})})};function Ii(i){let e=i[0],t=i[1],n=i[2];return Math.sqrt(e*e+t*t+n*n)}function Ys(i,e){return i[0]=e[0],i[1]=e[1],i[2]=e[2],i}function gg(i,e,t,n){return i[0]=e,i[1]=t,i[2]=n,i}function ol(i,e,t){return i[0]=e[0]+t[0],i[1]=e[1]+t[1],i[2]=e[2]+t[2],i}function ll(i,e,t){return i[0]=e[0]-t[0],i[1]=e[1]-t[1],i[2]=e[2]-t[2],i}function _g(i,e,t){return i[0]=e[0]*t[0],i[1]=e[1]*t[1],i[2]=e[2]*t[2],i}function xg(i,e,t){return i[0]=e[0]/t[0],i[1]=e[1]/t[1],i[2]=e[2]/t[2],i}function Ps(i,e,t){return i[0]=e[0]*t,i[1]=e[1]*t,i[2]=e[2]*t,i}function vg(i,e){let t=e[0]-i[0],n=e[1]-i[1],r=e[2]-i[2];return Math.sqrt(t*t+n*n+r*r)}function Mg(i,e){let t=e[0]-i[0],n=e[1]-i[1],r=e[2]-i[2];return t*t+n*n+r*r}function cl(i){let e=i[0],t=i[1],n=i[2];return e*e+t*t+n*n}function yg(i,e){return i[0]=-e[0],i[1]=-e[1],i[2]=-e[2],i}function Sg(i,e){return i[0]=1/e[0],i[1]=1/e[1],i[2]=1/e[2],i}function Ks(i,e){let t=e[0],n=e[1],r=e[2],s=t*t+n*n+r*r;return s>0&&(s=1/Math.sqrt(s)),i[0]=e[0]*s,i[1]=e[1]*s,i[2]=e[2]*s,i}function Ec(i,e){return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]}function ul(i,e,t){let n=e[0],r=e[1],s=e[2],a=t[0],o=t[1],l=t[2];return i[0]=r*l-s*o,i[1]=s*a-n*l,i[2]=n*o-r*a,i}function Eg(i,e,t,n){let r=e[0],s=e[1],a=e[2];return i[0]=r+n*(t[0]-r),i[1]=s+n*(t[1]-s),i[2]=a+n*(t[2]-a),i}function bg(i,e,t,n,r){const s=Math.exp(-n*r);let a=e[0],o=e[1],l=e[2];return i[0]=t[0]+(a-t[0])*s,i[1]=t[1]+(o-t[1])*s,i[2]=t[2]+(l-t[2])*s,i}function Tg(i,e,t){let n=e[0],r=e[1],s=e[2],a=t[3]*n+t[7]*r+t[11]*s+t[15];return a=a||1,i[0]=(t[0]*n+t[4]*r+t[8]*s+t[12])/a,i[1]=(t[1]*n+t[5]*r+t[9]*s+t[13])/a,i[2]=(t[2]*n+t[6]*r+t[10]*s+t[14])/a,i}function Dg(i,e,t){let n=e[0],r=e[1],s=e[2],a=t[3]*n+t[7]*r+t[11]*s+t[15];return a=a||1,i[0]=(t[0]*n+t[4]*r+t[8]*s)/a,i[1]=(t[1]*n+t[5]*r+t[9]*s)/a,i[2]=(t[2]*n+t[6]*r+t[10]*s)/a,i}function Ag(i,e,t){let n=e[0],r=e[1],s=e[2];return i[0]=n*t[0]+r*t[3]+s*t[6],i[1]=n*t[1]+r*t[4]+s*t[7],i[2]=n*t[2]+r*t[5]+s*t[8],i}function wg(i,e,t){let n=e[0],r=e[1],s=e[2],a=t[0],o=t[1],l=t[2],c=t[3],u=o*s-l*r,d=l*n-a*s,h=a*r-o*n,f=o*h-l*d,g=l*u-a*h,_=a*d-o*u,m=c*2;return u*=m,d*=m,h*=m,f*=2,g*=2,_*=2,i[0]=n+u+f,i[1]=r+d+g,i[2]=s+h+_,i}const Cg=(function(){const i=[0,0,0],e=[0,0,0];return function(t,n){Ys(i,t),Ys(e,n),Ks(i,i),Ks(e,e);let r=Ec(i,e);return r>1?0:r<-1?Math.PI:Math.acos(r)}})();function Rg(i,e){return i[0]===e[0]&&i[1]===e[1]&&i[2]===e[2]}class kt extends Array{constructor(e=0,t=e,n=e){return super(e,t,n),this}get x(){return this[0]}get y(){return this[1]}get z(){return this[2]}set x(e){this[0]=e}set y(e){this[1]=e}set z(e){this[2]=e}set(e,t=e,n=e){return e.length?this.copy(e):(gg(this,e,t,n),this)}copy(e){return Ys(this,e),this}add(e,t){return t?ol(this,e,t):ol(this,this,e),this}sub(e,t){return t?ll(this,e,t):ll(this,this,e),this}multiply(e){return e.length?_g(this,this,e):Ps(this,this,e),this}divide(e){return e.length?xg(this,this,e):Ps(this,this,1/e),this}inverse(e=this){return Sg(this,e),this}len(){return Ii(this)}distance(e){return e?vg(this,e):Ii(this)}squaredLen(){return cl(this)}squaredDistance(e){return e?Mg(this,e):cl(this)}negate(e=this){return yg(this,e),this}cross(e,t){return t?ul(this,e,t):ul(this,this,e),this}scale(e){return Ps(this,this,e),this}normalize(){return Ks(this,this),this}dot(e){return Ec(this,e)}equals(e){return Rg(this,e)}applyMatrix3(e){return Ag(this,this,e),this}applyMatrix4(e){return Tg(this,this,e),this}scaleRotateMatrix4(e){return Dg(this,this,e),this}applyQuaternion(e){return wg(this,this,e),this}angle(e){return Cg(this,e)}lerp(e,t){return Eg(this,this,e,t),this}smoothLerp(e,t,n){return bg(this,this,e,t,n),this}clone(){return new kt(this[0],this[1],this[2])}fromArray(e,t=0){return this[0]=e[t],this[1]=e[t+1],this[2]=e[t+2],this}toArray(e=[],t=0){return e[t]=this[0],e[t+1]=this[1],e[t+2]=this[2],e}transformDirection(e){const t=this[0],n=this[1],r=this[2];return this[0]=e[0]*t+e[4]*n+e[8]*r,this[1]=e[1]*t+e[5]*n+e[9]*r,this[2]=e[2]*t+e[6]*n+e[10]*r,this.normalize()}}const hl=new kt;let Pg=1,Lg=1,dl=!1;class Fg{constructor(e,t={}){e.canvas||console.error("gl not passed as first argument to Geometry"),this.gl=e,this.attributes=t,this.id=Pg++,this.VAOs={},this.drawRange={start:0,count:0},this.instancedCount=0,this.gl.renderer.bindVertexArray(null),this.gl.renderer.currentGeometry=null,this.glState=this.gl.renderer.state;for(let n in t)this.addAttribute(n,t[n])}addAttribute(e,t){if(this.attributes[e]=t,t.id=Lg++,t.size=t.size||1,t.type=t.type||(t.data.constructor===Float32Array?this.gl.FLOAT:t.data.constructor===Uint16Array?this.gl.UNSIGNED_SHORT:this.gl.UNSIGNED_INT),t.target=e==="index"?this.gl.ELEMENT_ARRAY_BUFFER:this.gl.ARRAY_BUFFER,t.normalized=t.normalized||!1,t.stride=t.stride||0,t.offset=t.offset||0,t.count=t.count||(t.stride?t.data.byteLength/t.stride:t.data.length/t.size),t.divisor=t.instanced||0,t.needsUpdate=!1,t.usage=t.usage||this.gl.STATIC_DRAW,t.buffer||this.updateAttribute(t),t.divisor){if(this.isInstanced=!0,this.instancedCount&&this.instancedCount!==t.count*t.divisor)return console.warn("geometry has multiple instanced buffers of different length"),this.instancedCount=Math.min(this.instancedCount,t.count*t.divisor);this.instancedCount=t.count*t.divisor}else e==="index"?this.drawRange.count=t.count:this.attributes.index||(this.drawRange.count=Math.max(this.drawRange.count,t.count))}updateAttribute(e){const t=!e.buffer;t&&(e.buffer=this.gl.createBuffer()),this.glState.boundBuffer!==e.buffer&&(this.gl.bindBuffer(e.target,e.buffer),this.glState.boundBuffer=e.buffer),t?this.gl.bufferData(e.target,e.data,e.usage):this.gl.bufferSubData(e.target,0,e.data),e.needsUpdate=!1}setIndex(e){this.addAttribute("index",e)}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}setInstancedCount(e){this.instancedCount=e}createVAO(e){this.VAOs[e.attributeOrder]=this.gl.renderer.createVertexArray(),this.gl.renderer.bindVertexArray(this.VAOs[e.attributeOrder]),this.bindAttributes(e)}bindAttributes(e){e.attributeLocations.forEach((t,{name:n,type:r})=>{if(!this.attributes[n]){console.warn(`active attribute ${n} not being supplied`);return}const s=this.attributes[n];this.gl.bindBuffer(s.target,s.buffer),this.glState.boundBuffer=s.buffer;let a=1;r===35674&&(a=2),r===35675&&(a=3),r===35676&&(a=4);const o=s.size/a,l=a===1?0:a*a*4,c=a===1?0:a*4;for(let u=0;u<a;u++)this.gl.vertexAttribPointer(t+u,o,s.type,s.normalized,s.stride+l,s.offset+u*c),this.gl.enableVertexAttribArray(t+u),this.gl.renderer.vertexAttribDivisor(t+u,s.divisor)}),this.attributes.index&&this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER,this.attributes.index.buffer)}draw({program:e,mode:t=this.gl.TRIANGLES}){this.gl.renderer.currentGeometry!==`${this.id}_${e.attributeOrder}`&&(this.VAOs[e.attributeOrder]||this.createVAO(e),this.gl.renderer.bindVertexArray(this.VAOs[e.attributeOrder]),this.gl.renderer.currentGeometry=`${this.id}_${e.attributeOrder}`),e.attributeLocations.forEach((r,{name:s})=>{const a=this.attributes[s];a.needsUpdate&&this.updateAttribute(a)});let n=2;this.attributes.index?.type===this.gl.UNSIGNED_INT&&(n=4),this.isInstanced?this.attributes.index?this.gl.renderer.drawElementsInstanced(t,this.drawRange.count,this.attributes.index.type,this.attributes.index.offset+this.drawRange.start*n,this.instancedCount):this.gl.renderer.drawArraysInstanced(t,this.drawRange.start,this.drawRange.count,this.instancedCount):this.attributes.index?this.gl.drawElements(t,this.drawRange.count,this.attributes.index.type,this.attributes.index.offset+this.drawRange.start*n):this.gl.drawArrays(t,this.drawRange.start,this.drawRange.count)}getPosition(){const e=this.attributes.position;if(e.data)return e;if(!dl)return console.warn("No position buffer data found to compute bounds"),dl=!0}computeBoundingBox(e){e||(e=this.getPosition());const t=e.data,n=e.size;this.bounds||(this.bounds={min:new kt,max:new kt,center:new kt,scale:new kt,radius:1/0});const r=this.bounds.min,s=this.bounds.max,a=this.bounds.center,o=this.bounds.scale;r.set(1/0),s.set(-1/0);for(let l=0,c=t.length;l<c;l+=n){const u=t[l],d=t[l+1],h=t[l+2];r.x=Math.min(u,r.x),r.y=Math.min(d,r.y),r.z=Math.min(h,r.z),s.x=Math.max(u,s.x),s.y=Math.max(d,s.y),s.z=Math.max(h,s.z)}o.sub(s,r),a.add(r,s).divide(2)}computeBoundingSphere(e){e||(e=this.getPosition());const t=e.data,n=e.size;this.bounds||this.computeBoundingBox(e);let r=0;for(let s=0,a=t.length;s<a;s+=n)hl.fromArray(t,s),r=Math.max(r,this.bounds.center.squaredDistance(hl));this.bounds.radius=Math.sqrt(r)}remove(){for(let e in this.VAOs)this.gl.renderer.deleteVertexArray(this.VAOs[e]),delete this.VAOs[e];for(let e in this.attributes)this.gl.deleteBuffer(this.attributes[e].buffer),delete this.attributes[e]}}let Ig=1;const fl={};class Ng{constructor(e,{vertex:t,fragment:n,uniforms:r={},transparent:s=!1,cullFace:a=e.BACK,frontFace:o=e.CCW,depthTest:l=!0,depthWrite:c=!0,depthFunc:u=e.LEQUAL}={}){e.canvas||console.error("gl not passed as first argument to Program"),this.gl=e,this.uniforms=r,this.id=Ig++,t||console.warn("vertex shader not supplied"),n||console.warn("fragment shader not supplied"),this.transparent=s,this.cullFace=a,this.frontFace=o,this.depthTest=l,this.depthWrite=c,this.depthFunc=u,this.blendFunc={},this.blendEquation={},this.stencilFunc={},this.stencilOp={},this.transparent&&!this.blendFunc.src&&(this.gl.renderer.premultipliedAlpha?this.setBlendFunc(this.gl.ONE,this.gl.ONE_MINUS_SRC_ALPHA):this.setBlendFunc(this.gl.SRC_ALPHA,this.gl.ONE_MINUS_SRC_ALPHA)),this.vertexShader=e.createShader(e.VERTEX_SHADER),this.fragmentShader=e.createShader(e.FRAGMENT_SHADER),this.program=e.createProgram(),e.attachShader(this.program,this.vertexShader),e.attachShader(this.program,this.fragmentShader),this.setShaders({vertex:t,fragment:n})}setShaders({vertex:e,fragment:t}){if(e&&(this.gl.shaderSource(this.vertexShader,e),this.gl.compileShader(this.vertexShader),this.gl.getShaderInfoLog(this.vertexShader)!==""&&console.warn(`${this.gl.getShaderInfoLog(this.vertexShader)}
4515
4515
  Vertex Shader
4516
4516
  ${pl(e)}`)),t&&(this.gl.shaderSource(this.fragmentShader,t),this.gl.compileShader(this.fragmentShader),this.gl.getShaderInfoLog(this.fragmentShader)!==""&&console.warn(`${this.gl.getShaderInfoLog(this.fragmentShader)}
4517
4517
  Fragment Shader
4518
- ${pl(t)}`)),this.gl.linkProgram(this.program),!this.gl.getProgramParameter(this.program,this.gl.LINK_STATUS))return console.warn(this.gl.getProgramInfoLog(this.program));this.uniformLocations=new Map;let n=this.gl.getProgramParameter(this.program,this.gl.ACTIVE_UNIFORMS);for(let a=0;a<n;a++){let o=this.gl.getActiveUniform(this.program,a);this.uniformLocations.set(o,this.gl.getUniformLocation(this.program,o.name));const l=o.name.match(/(\w+)/g);o.uniformName=l[0],o.nameComponents=l.slice(1)}this.attributeLocations=new Map;const r=[],s=this.gl.getProgramParameter(this.program,this.gl.ACTIVE_ATTRIBUTES);for(let a=0;a<s;a++){const o=this.gl.getActiveAttrib(this.program,a),l=this.gl.getAttribLocation(this.program,o.name);l!==-1&&(r[l]=o.name,this.attributeLocations.set(o,l))}this.attributeOrder=r.join("")}setBlendFunc(e,t,n,r){this.blendFunc.src=e,this.blendFunc.dst=t,this.blendFunc.srcAlpha=n,this.blendFunc.dstAlpha=r,e&&(this.transparent=!0)}setBlendEquation(e,t){this.blendEquation.modeRGB=e,this.blendEquation.modeAlpha=t}setStencilFunc(e,t,n){this.stencilRef=t,this.stencilFunc.func=e,this.stencilFunc.ref=t,this.stencilFunc.mask=n}setStencilOp(e,t,n){this.stencilOp.stencilFail=e,this.stencilOp.depthFail=t,this.stencilOp.depthPass=n}applyState(){this.depthTest?this.gl.renderer.enable(this.gl.DEPTH_TEST):this.gl.renderer.disable(this.gl.DEPTH_TEST),this.cullFace?this.gl.renderer.enable(this.gl.CULL_FACE):this.gl.renderer.disable(this.gl.CULL_FACE),this.blendFunc.src?this.gl.renderer.enable(this.gl.BLEND):this.gl.renderer.disable(this.gl.BLEND),this.cullFace&&this.gl.renderer.setCullFace(this.cullFace),this.gl.renderer.setFrontFace(this.frontFace),this.gl.renderer.setDepthMask(this.depthWrite),this.gl.renderer.setDepthFunc(this.depthFunc),this.blendFunc.src&&this.gl.renderer.setBlendFunc(this.blendFunc.src,this.blendFunc.dst,this.blendFunc.srcAlpha,this.blendFunc.dstAlpha),this.gl.renderer.setBlendEquation(this.blendEquation.modeRGB,this.blendEquation.modeAlpha),this.stencilFunc.func||this.stencilOp.stencilFail?this.gl.renderer.enable(this.gl.STENCIL_TEST):this.gl.renderer.disable(this.gl.STENCIL_TEST),this.gl.renderer.setStencilFunc(this.stencilFunc.func,this.stencilFunc.ref,this.stencilFunc.mask),this.gl.renderer.setStencilOp(this.stencilOp.stencilFail,this.stencilOp.depthFail,this.stencilOp.depthPass)}use({flipFaces:e=!1}={}){let t=-1;this.gl.renderer.state.currentProgram===this.id||(this.gl.useProgram(this.program),this.gl.renderer.state.currentProgram=this.id),this.uniformLocations.forEach((r,s)=>{let a=this.uniforms[s.uniformName];for(const o of s.nameComponents){if(!a)break;if(o in a)a=a[o];else{if(Array.isArray(a.value))break;a=void 0;break}}if(!a)return ml(`Active uniform ${s.name} has not been supplied`);if(a&&a.value===void 0)return ml(`${s.name} uniform is missing a value parameter`);if(a.value.texture)return t=t+1,a.value.update(t),Ps(this.gl,s.type,r,t);if(a.value.length&&a.value[0].texture){const o=[];return a.value.forEach(l=>{t=t+1,l.update(t),o.push(t)}),Ps(this.gl,s.type,r,o)}Ps(this.gl,s.type,r,a.value)}),this.applyState(),e&&this.gl.renderer.setFrontFace(this.frontFace===this.gl.CCW?this.gl.CW:this.gl.CCW)}remove(){this.gl.deleteProgram(this.program)}}function Ps(i,e,t,n){n=n.length?Ng(n):n;const r=i.renderer.state.uniformLocations.get(t);if(n.length)if(r===void 0||r.length!==n.length)i.renderer.state.uniformLocations.set(t,n.slice(0));else{if(Og(r,n))return;r.set?r.set(n):Bg(r,n),i.renderer.state.uniformLocations.set(t,r)}else{if(r===n)return;i.renderer.state.uniformLocations.set(t,n)}switch(e){case 5126:return n.length?i.uniform1fv(t,n):i.uniform1f(t,n);case 35664:return i.uniform2fv(t,n);case 35665:return i.uniform3fv(t,n);case 35666:return i.uniform4fv(t,n);case 35670:case 5124:case 35678:case 36306:case 35680:case 36289:return n.length?i.uniform1iv(t,n):i.uniform1i(t,n);case 35671:case 35667:return i.uniform2iv(t,n);case 35672:case 35668:return i.uniform3iv(t,n);case 35673:case 35669:return i.uniform4iv(t,n);case 35674:return i.uniformMatrix2fv(t,!1,n);case 35675:return i.uniformMatrix3fv(t,!1,n);case 35676:return i.uniformMatrix4fv(t,!1,n)}}function pl(i){let e=i.split(`
4518
+ ${pl(t)}`)),this.gl.linkProgram(this.program),!this.gl.getProgramParameter(this.program,this.gl.LINK_STATUS))return console.warn(this.gl.getProgramInfoLog(this.program));this.uniformLocations=new Map;let n=this.gl.getProgramParameter(this.program,this.gl.ACTIVE_UNIFORMS);for(let a=0;a<n;a++){let o=this.gl.getActiveUniform(this.program,a);this.uniformLocations.set(o,this.gl.getUniformLocation(this.program,o.name));const l=o.name.match(/(\w+)/g);o.uniformName=l[0],o.nameComponents=l.slice(1)}this.attributeLocations=new Map;const r=[],s=this.gl.getProgramParameter(this.program,this.gl.ACTIVE_ATTRIBUTES);for(let a=0;a<s;a++){const o=this.gl.getActiveAttrib(this.program,a),l=this.gl.getAttribLocation(this.program,o.name);l!==-1&&(r[l]=o.name,this.attributeLocations.set(o,l))}this.attributeOrder=r.join("")}setBlendFunc(e,t,n,r){this.blendFunc.src=e,this.blendFunc.dst=t,this.blendFunc.srcAlpha=n,this.blendFunc.dstAlpha=r,e&&(this.transparent=!0)}setBlendEquation(e,t){this.blendEquation.modeRGB=e,this.blendEquation.modeAlpha=t}setStencilFunc(e,t,n){this.stencilRef=t,this.stencilFunc.func=e,this.stencilFunc.ref=t,this.stencilFunc.mask=n}setStencilOp(e,t,n){this.stencilOp.stencilFail=e,this.stencilOp.depthFail=t,this.stencilOp.depthPass=n}applyState(){this.depthTest?this.gl.renderer.enable(this.gl.DEPTH_TEST):this.gl.renderer.disable(this.gl.DEPTH_TEST),this.cullFace?this.gl.renderer.enable(this.gl.CULL_FACE):this.gl.renderer.disable(this.gl.CULL_FACE),this.blendFunc.src?this.gl.renderer.enable(this.gl.BLEND):this.gl.renderer.disable(this.gl.BLEND),this.cullFace&&this.gl.renderer.setCullFace(this.cullFace),this.gl.renderer.setFrontFace(this.frontFace),this.gl.renderer.setDepthMask(this.depthWrite),this.gl.renderer.setDepthFunc(this.depthFunc),this.blendFunc.src&&this.gl.renderer.setBlendFunc(this.blendFunc.src,this.blendFunc.dst,this.blendFunc.srcAlpha,this.blendFunc.dstAlpha),this.gl.renderer.setBlendEquation(this.blendEquation.modeRGB,this.blendEquation.modeAlpha),this.stencilFunc.func||this.stencilOp.stencilFail?this.gl.renderer.enable(this.gl.STENCIL_TEST):this.gl.renderer.disable(this.gl.STENCIL_TEST),this.gl.renderer.setStencilFunc(this.stencilFunc.func,this.stencilFunc.ref,this.stencilFunc.mask),this.gl.renderer.setStencilOp(this.stencilOp.stencilFail,this.stencilOp.depthFail,this.stencilOp.depthPass)}use({flipFaces:e=!1}={}){let t=-1;this.gl.renderer.state.currentProgram===this.id||(this.gl.useProgram(this.program),this.gl.renderer.state.currentProgram=this.id),this.uniformLocations.forEach((r,s)=>{let a=this.uniforms[s.uniformName];for(const o of s.nameComponents){if(!a)break;if(o in a)a=a[o];else{if(Array.isArray(a.value))break;a=void 0;break}}if(!a)return ml(`Active uniform ${s.name} has not been supplied`);if(a&&a.value===void 0)return ml(`${s.name} uniform is missing a value parameter`);if(a.value.texture)return t=t+1,a.value.update(t),Ls(this.gl,s.type,r,t);if(a.value.length&&a.value[0].texture){const o=[];return a.value.forEach(l=>{t=t+1,l.update(t),o.push(t)}),Ls(this.gl,s.type,r,o)}Ls(this.gl,s.type,r,a.value)}),this.applyState(),e&&this.gl.renderer.setFrontFace(this.frontFace===this.gl.CCW?this.gl.CW:this.gl.CCW)}remove(){this.gl.deleteProgram(this.program)}}function Ls(i,e,t,n){n=n.length?Ug(n):n;const r=i.renderer.state.uniformLocations.get(t);if(n.length)if(r===void 0||r.length!==n.length)i.renderer.state.uniformLocations.set(t,n.slice(0));else{if(Og(r,n))return;r.set?r.set(n):Bg(r,n),i.renderer.state.uniformLocations.set(t,r)}else{if(r===n)return;i.renderer.state.uniformLocations.set(t,n)}switch(e){case 5126:return n.length?i.uniform1fv(t,n):i.uniform1f(t,n);case 35664:return i.uniform2fv(t,n);case 35665:return i.uniform3fv(t,n);case 35666:return i.uniform4fv(t,n);case 35670:case 5124:case 35678:case 36306:case 35680:case 36289:return n.length?i.uniform1iv(t,n):i.uniform1i(t,n);case 35671:case 35667:return i.uniform2iv(t,n);case 35672:case 35668:return i.uniform3iv(t,n);case 35673:case 35669:return i.uniform4iv(t,n);case 35674:return i.uniformMatrix2fv(t,!1,n);case 35675:return i.uniformMatrix3fv(t,!1,n);case 35676:return i.uniformMatrix4fv(t,!1,n)}}function pl(i){let e=i.split(`
4519
4519
  `);for(let t=0;t<e.length;t++)e[t]=t+1+": "+e[t];return e.join(`
4520
- `)}function Ng(i){const e=i.length,t=i[0].length;if(t===void 0)return i;const n=e*t;let r=fl[n];r||(fl[n]=r=new Float32Array(n));for(let s=0;s<e;s++)r.set(i[s],s*t);return r}function Og(i,e){if(i.length!==e.length)return!1;for(let t=0,n=i.length;t<n;t++)if(i[t]!==e[t])return!1;return!0}function Bg(i,e){for(let t=0,n=i.length;t<n;t++)i[t]=e[t]}let Ls=0;function ml(i){Ls>100||(console.warn(i),Ls++,Ls>100&&console.warn("More than 100 program warnings - stopping logs."))}const Fs=new kt;let zg=1;class kg{constructor({canvas:e=document.createElement("canvas"),width:t=300,height:n=150,dpr:r=1,alpha:s=!1,depth:a=!0,stencil:o=!1,antialias:l=!1,premultipliedAlpha:c=!1,preserveDrawingBuffer:u=!1,powerPreference:d="default",autoClear:h=!0,webgl:f=2}={}){const g={alpha:s,depth:a,stencil:o,antialias:l,premultipliedAlpha:c,preserveDrawingBuffer:u,powerPreference:d};this.dpr=r,this.alpha=s,this.color=!0,this.depth=a,this.stencil=o,this.premultipliedAlpha=c,this.autoClear=h,this.id=zg++,f===2&&(this.gl=e.getContext("webgl2",g)),this.isWebgl2=!!this.gl,this.gl||(this.gl=e.getContext("webgl",g)),this.gl||console.error("unable to create webgl context"),this.gl.renderer=this,this.setSize(t,n),this.state={},this.state.blendFunc={src:this.gl.ONE,dst:this.gl.ZERO},this.state.blendEquation={modeRGB:this.gl.FUNC_ADD},this.state.cullFace=!1,this.state.frontFace=this.gl.CCW,this.state.depthMask=!0,this.state.depthFunc=this.gl.LEQUAL,this.state.premultiplyAlpha=!1,this.state.flipY=!1,this.state.unpackAlignment=4,this.state.framebuffer=null,this.state.viewport={x:0,y:0,width:null,height:null},this.state.textureUnits=[],this.state.activeTextureUnit=0,this.state.boundBuffer=null,this.state.uniformLocations=new Map,this.state.currentProgram=null,this.extensions={},this.isWebgl2?(this.getExtension("EXT_color_buffer_float"),this.getExtension("OES_texture_float_linear")):(this.getExtension("OES_texture_float"),this.getExtension("OES_texture_float_linear"),this.getExtension("OES_texture_half_float"),this.getExtension("OES_texture_half_float_linear"),this.getExtension("OES_element_index_uint"),this.getExtension("OES_standard_derivatives"),this.getExtension("EXT_sRGB"),this.getExtension("WEBGL_depth_texture"),this.getExtension("WEBGL_draw_buffers")),this.getExtension("WEBGL_compressed_texture_astc"),this.getExtension("EXT_texture_compression_bptc"),this.getExtension("WEBGL_compressed_texture_s3tc"),this.getExtension("WEBGL_compressed_texture_etc1"),this.getExtension("WEBGL_compressed_texture_pvrtc"),this.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),this.vertexAttribDivisor=this.getExtension("ANGLE_instanced_arrays","vertexAttribDivisor","vertexAttribDivisorANGLE"),this.drawArraysInstanced=this.getExtension("ANGLE_instanced_arrays","drawArraysInstanced","drawArraysInstancedANGLE"),this.drawElementsInstanced=this.getExtension("ANGLE_instanced_arrays","drawElementsInstanced","drawElementsInstancedANGLE"),this.createVertexArray=this.getExtension("OES_vertex_array_object","createVertexArray","createVertexArrayOES"),this.bindVertexArray=this.getExtension("OES_vertex_array_object","bindVertexArray","bindVertexArrayOES"),this.deleteVertexArray=this.getExtension("OES_vertex_array_object","deleteVertexArray","deleteVertexArrayOES"),this.drawBuffers=this.getExtension("WEBGL_draw_buffers","drawBuffers","drawBuffersWEBGL"),this.parameters={},this.parameters.maxTextureUnits=this.gl.getParameter(this.gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS),this.parameters.maxAnisotropy=this.getExtension("EXT_texture_filter_anisotropic")?this.gl.getParameter(this.getExtension("EXT_texture_filter_anisotropic").MAX_TEXTURE_MAX_ANISOTROPY_EXT):0}setSize(e,t){this.width=e,this.height=t,this.gl.canvas.width=e*this.dpr,this.gl.canvas.height=t*this.dpr,this.gl.canvas.style&&Object.assign(this.gl.canvas.style,{width:e+"px",height:t+"px"})}setViewport(e,t,n=0,r=0){this.state.viewport.width===e&&this.state.viewport.height===t||(this.state.viewport.width=e,this.state.viewport.height=t,this.state.viewport.x=n,this.state.viewport.y=r,this.gl.viewport(n,r,e,t))}setScissor(e,t,n=0,r=0){this.gl.scissor(n,r,e,t)}enable(e){this.state[e]!==!0&&(this.gl.enable(e),this.state[e]=!0)}disable(e){this.state[e]!==!1&&(this.gl.disable(e),this.state[e]=!1)}setBlendFunc(e,t,n,r){this.state.blendFunc.src===e&&this.state.blendFunc.dst===t&&this.state.blendFunc.srcAlpha===n&&this.state.blendFunc.dstAlpha===r||(this.state.blendFunc.src=e,this.state.blendFunc.dst=t,this.state.blendFunc.srcAlpha=n,this.state.blendFunc.dstAlpha=r,n!==void 0?this.gl.blendFuncSeparate(e,t,n,r):this.gl.blendFunc(e,t))}setBlendEquation(e,t){e=e||this.gl.FUNC_ADD,!(this.state.blendEquation.modeRGB===e&&this.state.blendEquation.modeAlpha===t)&&(this.state.blendEquation.modeRGB=e,this.state.blendEquation.modeAlpha=t,t!==void 0?this.gl.blendEquationSeparate(e,t):this.gl.blendEquation(e))}setCullFace(e){this.state.cullFace!==e&&(this.state.cullFace=e,this.gl.cullFace(e))}setFrontFace(e){this.state.frontFace!==e&&(this.state.frontFace=e,this.gl.frontFace(e))}setDepthMask(e){this.state.depthMask!==e&&(this.state.depthMask=e,this.gl.depthMask(e))}setDepthFunc(e){this.state.depthFunc!==e&&(this.state.depthFunc=e,this.gl.depthFunc(e))}setStencilMask(e){this.state.stencilMask!==e&&(this.state.stencilMask=e,this.gl.stencilMask(e))}setStencilFunc(e,t,n){this.state.stencilFunc===e&&this.state.stencilRef===t&&this.state.stencilFuncMask===n||(this.state.stencilFunc=e||this.gl.ALWAYS,this.state.stencilRef=t||0,this.state.stencilFuncMask=n||0,this.gl.stencilFunc(e||this.gl.ALWAYS,t||0,n||0))}setStencilOp(e,t,n){this.state.stencilFail===e&&this.state.stencilDepthFail===t&&this.state.stencilDepthPass===n||(this.state.stencilFail=e,this.state.stencilDepthFail=t,this.state.stencilDepthPass=n,this.gl.stencilOp(e,t,n))}activeTexture(e){this.state.activeTextureUnit!==e&&(this.state.activeTextureUnit=e,this.gl.activeTexture(this.gl.TEXTURE0+e))}bindFramebuffer({target:e=this.gl.FRAMEBUFFER,buffer:t=null}={}){this.state.framebuffer!==t&&(this.state.framebuffer=t,this.gl.bindFramebuffer(e,t))}getExtension(e,t,n){return t&&this.gl[t]?this.gl[t].bind(this.gl):(this.extensions[e]||(this.extensions[e]=this.gl.getExtension(e)),t?this.extensions[e]?this.extensions[e][n].bind(this.extensions[e]):null:this.extensions[e])}sortOpaque(e,t){return e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.program.id!==t.program.id?e.program.id-t.program.id:e.zDepth!==t.zDepth?e.zDepth-t.zDepth:t.id-e.id}sortTransparent(e,t){return e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.zDepth!==t.zDepth?t.zDepth-e.zDepth:t.id-e.id}sortUI(e,t){return e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.program.id!==t.program.id?e.program.id-t.program.id:t.id-e.id}getRenderList({scene:e,camera:t,frustumCull:n,sort:r}){let s=[];if(t&&n&&t.updateFrustum(),e.traverse(a=>{if(!a.visible)return!0;a.draw&&(n&&a.frustumCulled&&t&&!t.frustumIntersectsMesh(a)||s.push(a))}),r){const a=[],o=[],l=[];s.forEach(c=>{c.program.transparent?c.program.depthTest?o.push(c):l.push(c):a.push(c),c.zDepth=0,!(c.renderOrder!==0||!c.program.depthTest||!t)&&(c.worldMatrix.getTranslation(Fs),Fs.applyMatrix4(t.projectionViewMatrix),c.zDepth=Fs.z)}),a.sort(this.sortOpaque),o.sort(this.sortTransparent),l.sort(this.sortUI),s=a.concat(o,l)}return s}render({scene:e,camera:t,target:n=null,update:r=!0,sort:s=!0,frustumCull:a=!0,clear:o}){n===null?(this.bindFramebuffer(),this.setViewport(this.width*this.dpr,this.height*this.dpr)):(this.bindFramebuffer(n),this.setViewport(n.width,n.height)),(o||this.autoClear&&o!==!1)&&(this.depth&&(!n||n.depth)&&(this.enable(this.gl.DEPTH_TEST),this.setDepthMask(!0)),(this.stencil||!n||n.stencil)&&(this.enable(this.gl.STENCIL_TEST),this.setStencilMask(255)),this.gl.clear((this.color?this.gl.COLOR_BUFFER_BIT:0)|(this.depth?this.gl.DEPTH_BUFFER_BIT:0)|(this.stencil?this.gl.STENCIL_BUFFER_BIT:0))),r&&e.updateMatrixWorld(),t&&t.updateMatrixWorld(),this.getRenderList({scene:e,camera:t,frustumCull:a,sort:s}).forEach(c=>{c.draw({camera:t})})}}function Hg(i,e){return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i}function Vg(i,e,t,n,r){return i[0]=e,i[1]=t,i[2]=n,i[3]=r,i}function Gg(i,e){let t=e[0],n=e[1],r=e[2],s=e[3],a=t*t+n*n+r*r+s*s;return a>0&&(a=1/Math.sqrt(a)),i[0]=t*a,i[1]=n*a,i[2]=r*a,i[3]=s*a,i}function Wg(i,e){return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]+i[3]*e[3]}function Xg(i){return i[0]=0,i[1]=0,i[2]=0,i[3]=1,i}function qg(i,e,t){t=t*.5;let n=Math.sin(t);return i[0]=n*e[0],i[1]=n*e[1],i[2]=n*e[2],i[3]=Math.cos(t),i}function gl(i,e,t){let n=e[0],r=e[1],s=e[2],a=e[3],o=t[0],l=t[1],c=t[2],u=t[3];return i[0]=n*u+a*o+r*c-s*l,i[1]=r*u+a*l+s*o-n*c,i[2]=s*u+a*c+n*l-r*o,i[3]=a*u-n*o-r*l-s*c,i}function Yg(i,e,t){t*=.5;let n=e[0],r=e[1],s=e[2],a=e[3],o=Math.sin(t),l=Math.cos(t);return i[0]=n*l+a*o,i[1]=r*l+s*o,i[2]=s*l-r*o,i[3]=a*l-n*o,i}function $g(i,e,t){t*=.5;let n=e[0],r=e[1],s=e[2],a=e[3],o=Math.sin(t),l=Math.cos(t);return i[0]=n*l-s*o,i[1]=r*l+a*o,i[2]=s*l+n*o,i[3]=a*l-r*o,i}function jg(i,e,t){t*=.5;let n=e[0],r=e[1],s=e[2],a=e[3],o=Math.sin(t),l=Math.cos(t);return i[0]=n*l+r*o,i[1]=r*l-n*o,i[2]=s*l+a*o,i[3]=a*l-s*o,i}function Kg(i,e,t,n){let r=e[0],s=e[1],a=e[2],o=e[3],l=t[0],c=t[1],u=t[2],d=t[3],h,f,g,_,m;return f=r*l+s*c+a*u+o*d,f<0&&(f=-f,l=-l,c=-c,u=-u,d=-d),1-f>1e-6?(h=Math.acos(f),g=Math.sin(h),_=Math.sin((1-n)*h)/g,m=Math.sin(n*h)/g):(_=1-n,m=n),i[0]=_*r+m*l,i[1]=_*s+m*c,i[2]=_*a+m*u,i[3]=_*o+m*d,i}function Zg(i,e){let t=e[0],n=e[1],r=e[2],s=e[3],a=t*t+n*n+r*r+s*s,o=a?1/a:0;return i[0]=-t*o,i[1]=-n*o,i[2]=-r*o,i[3]=s*o,i}function Jg(i,e){return i[0]=-e[0],i[1]=-e[1],i[2]=-e[2],i[3]=e[3],i}function Qg(i,e){let t=e[0]+e[4]+e[8],n;if(t>0)n=Math.sqrt(t+1),i[3]=.5*n,n=.5/n,i[0]=(e[5]-e[7])*n,i[1]=(e[6]-e[2])*n,i[2]=(e[1]-e[3])*n;else{let r=0;e[4]>e[0]&&(r=1),e[8]>e[r*3+r]&&(r=2);let s=(r+1)%3,a=(r+2)%3;n=Math.sqrt(e[r*3+r]-e[s*3+s]-e[a*3+a]+1),i[r]=.5*n,n=.5/n,i[3]=(e[s*3+a]-e[a*3+s])*n,i[s]=(e[s*3+r]+e[r*3+s])*n,i[a]=(e[a*3+r]+e[r*3+a])*n}return i}function e_(i,e,t="YXZ"){let n=Math.sin(e[0]*.5),r=Math.cos(e[0]*.5),s=Math.sin(e[1]*.5),a=Math.cos(e[1]*.5),o=Math.sin(e[2]*.5),l=Math.cos(e[2]*.5);return t==="XYZ"?(i[0]=n*a*l+r*s*o,i[1]=r*s*l-n*a*o,i[2]=r*a*o+n*s*l,i[3]=r*a*l-n*s*o):t==="YXZ"?(i[0]=n*a*l+r*s*o,i[1]=r*s*l-n*a*o,i[2]=r*a*o-n*s*l,i[3]=r*a*l+n*s*o):t==="ZXY"?(i[0]=n*a*l-r*s*o,i[1]=r*s*l+n*a*o,i[2]=r*a*o+n*s*l,i[3]=r*a*l-n*s*o):t==="ZYX"?(i[0]=n*a*l-r*s*o,i[1]=r*s*l+n*a*o,i[2]=r*a*o-n*s*l,i[3]=r*a*l+n*s*o):t==="YZX"?(i[0]=n*a*l+r*s*o,i[1]=r*s*l+n*a*o,i[2]=r*a*o-n*s*l,i[3]=r*a*l-n*s*o):t==="XZY"&&(i[0]=n*a*l-r*s*o,i[1]=r*s*l-n*a*o,i[2]=r*a*o+n*s*l,i[3]=r*a*l+n*s*o),i}const t_=Hg,n_=Vg,i_=Wg,r_=Gg;class s_ extends Array{constructor(e=0,t=0,n=0,r=1){super(e,t,n,r),this.onChange=()=>{},this._target=this;const s=["0","1","2","3"];return new Proxy(this,{set(a,o){const l=Reflect.set(...arguments);return l&&s.includes(o)&&a.onChange(),l}})}get x(){return this[0]}get y(){return this[1]}get z(){return this[2]}get w(){return this[3]}set x(e){this._target[0]=e,this.onChange()}set y(e){this._target[1]=e,this.onChange()}set z(e){this._target[2]=e,this.onChange()}set w(e){this._target[3]=e,this.onChange()}identity(){return Xg(this._target),this.onChange(),this}set(e,t,n,r){return e.length?this.copy(e):(n_(this._target,e,t,n,r),this.onChange(),this)}rotateX(e){return Yg(this._target,this._target,e),this.onChange(),this}rotateY(e){return $g(this._target,this._target,e),this.onChange(),this}rotateZ(e){return jg(this._target,this._target,e),this.onChange(),this}inverse(e=this._target){return Zg(this._target,e),this.onChange(),this}conjugate(e=this._target){return Jg(this._target,e),this.onChange(),this}copy(e){return t_(this._target,e),this.onChange(),this}normalize(e=this._target){return r_(this._target,e),this.onChange(),this}multiply(e,t){return t?gl(this._target,e,t):gl(this._target,this._target,e),this.onChange(),this}dot(e){return i_(this._target,e)}fromMatrix3(e){return Qg(this._target,e),this.onChange(),this}fromEuler(e,t){return e_(this._target,e,e.order),t||this.onChange(),this}fromAxisAngle(e,t){return qg(this._target,e,t),this.onChange(),this}slerp(e,t){return Kg(this._target,this._target,e,t),this.onChange(),this}fromArray(e,t=0){return this._target[0]=e[t],this._target[1]=e[t+1],this._target[2]=e[t+2],this._target[3]=e[t+3],this.onChange(),this}toArray(e=[],t=0){return e[t]=this[0],e[t+1]=this[1],e[t+2]=this[2],e[t+3]=this[3],e}}const a_=1e-6;function o_(i,e){return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[4]=e[4],i[5]=e[5],i[6]=e[6],i[7]=e[7],i[8]=e[8],i[9]=e[9],i[10]=e[10],i[11]=e[11],i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15],i}function l_(i,e,t,n,r,s,a,o,l,c,u,d,h,f,g,_,m){return i[0]=e,i[1]=t,i[2]=n,i[3]=r,i[4]=s,i[5]=a,i[6]=o,i[7]=l,i[8]=c,i[9]=u,i[10]=d,i[11]=h,i[12]=f,i[13]=g,i[14]=_,i[15]=m,i}function c_(i){return i[0]=1,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=1,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=1,i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i}function u_(i,e){let t=e[0],n=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],u=e[8],d=e[9],h=e[10],f=e[11],g=e[12],_=e[13],m=e[14],p=e[15],E=t*o-n*a,v=t*l-r*a,b=t*c-s*a,R=n*l-r*o,T=n*c-s*o,A=r*c-s*l,P=u*_-d*g,y=u*m-h*g,M=u*p-f*g,F=d*m-h*_,L=d*p-f*_,C=h*p-f*m,U=E*C-v*L+b*F+R*M-T*y+A*P;return U?(U=1/U,i[0]=(o*C-l*L+c*F)*U,i[1]=(r*L-n*C-s*F)*U,i[2]=(_*A-m*T+p*R)*U,i[3]=(h*T-d*A-f*R)*U,i[4]=(l*M-a*C-c*y)*U,i[5]=(t*C-r*M+s*y)*U,i[6]=(m*b-g*A-p*v)*U,i[7]=(u*A-h*b+f*v)*U,i[8]=(a*L-o*M+c*P)*U,i[9]=(n*M-t*L-s*P)*U,i[10]=(g*T-_*b+p*E)*U,i[11]=(d*b-u*T-f*E)*U,i[12]=(o*y-a*F-l*P)*U,i[13]=(t*F-n*y+r*P)*U,i[14]=(_*v-g*R-m*E)*U,i[15]=(u*R-d*v+h*E)*U,i):null}function bc(i){let e=i[0],t=i[1],n=i[2],r=i[3],s=i[4],a=i[5],o=i[6],l=i[7],c=i[8],u=i[9],d=i[10],h=i[11],f=i[12],g=i[13],_=i[14],m=i[15],p=e*a-t*s,E=e*o-n*s,v=e*l-r*s,b=t*o-n*a,R=t*l-r*a,T=n*l-r*o,A=c*g-u*f,P=c*_-d*f,y=c*m-h*f,M=u*_-d*g,F=u*m-h*g,L=d*m-h*_;return p*L-E*F+v*M+b*y-R*P+T*A}function _l(i,e,t){let n=e[0],r=e[1],s=e[2],a=e[3],o=e[4],l=e[5],c=e[6],u=e[7],d=e[8],h=e[9],f=e[10],g=e[11],_=e[12],m=e[13],p=e[14],E=e[15],v=t[0],b=t[1],R=t[2],T=t[3];return i[0]=v*n+b*o+R*d+T*_,i[1]=v*r+b*l+R*h+T*m,i[2]=v*s+b*c+R*f+T*p,i[3]=v*a+b*u+R*g+T*E,v=t[4],b=t[5],R=t[6],T=t[7],i[4]=v*n+b*o+R*d+T*_,i[5]=v*r+b*l+R*h+T*m,i[6]=v*s+b*c+R*f+T*p,i[7]=v*a+b*u+R*g+T*E,v=t[8],b=t[9],R=t[10],T=t[11],i[8]=v*n+b*o+R*d+T*_,i[9]=v*r+b*l+R*h+T*m,i[10]=v*s+b*c+R*f+T*p,i[11]=v*a+b*u+R*g+T*E,v=t[12],b=t[13],R=t[14],T=t[15],i[12]=v*n+b*o+R*d+T*_,i[13]=v*r+b*l+R*h+T*m,i[14]=v*s+b*c+R*f+T*p,i[15]=v*a+b*u+R*g+T*E,i}function h_(i,e,t){let n=t[0],r=t[1],s=t[2],a,o,l,c,u,d,h,f,g,_,m,p;return e===i?(i[12]=e[0]*n+e[4]*r+e[8]*s+e[12],i[13]=e[1]*n+e[5]*r+e[9]*s+e[13],i[14]=e[2]*n+e[6]*r+e[10]*s+e[14],i[15]=e[3]*n+e[7]*r+e[11]*s+e[15]):(a=e[0],o=e[1],l=e[2],c=e[3],u=e[4],d=e[5],h=e[6],f=e[7],g=e[8],_=e[9],m=e[10],p=e[11],i[0]=a,i[1]=o,i[2]=l,i[3]=c,i[4]=u,i[5]=d,i[6]=h,i[7]=f,i[8]=g,i[9]=_,i[10]=m,i[11]=p,i[12]=a*n+u*r+g*s+e[12],i[13]=o*n+d*r+_*s+e[13],i[14]=l*n+h*r+m*s+e[14],i[15]=c*n+f*r+p*s+e[15]),i}function d_(i,e,t){let n=t[0],r=t[1],s=t[2];return i[0]=e[0]*n,i[1]=e[1]*n,i[2]=e[2]*n,i[3]=e[3]*n,i[4]=e[4]*r,i[5]=e[5]*r,i[6]=e[6]*r,i[7]=e[7]*r,i[8]=e[8]*s,i[9]=e[9]*s,i[10]=e[10]*s,i[11]=e[11]*s,i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15],i}function f_(i,e,t,n){let r=n[0],s=n[1],a=n[2],o=Math.hypot(r,s,a),l,c,u,d,h,f,g,_,m,p,E,v,b,R,T,A,P,y,M,F,L,C,U,H;return Math.abs(o)<a_?null:(o=1/o,r*=o,s*=o,a*=o,l=Math.sin(t),c=Math.cos(t),u=1-c,d=e[0],h=e[1],f=e[2],g=e[3],_=e[4],m=e[5],p=e[6],E=e[7],v=e[8],b=e[9],R=e[10],T=e[11],A=r*r*u+c,P=s*r*u+a*l,y=a*r*u-s*l,M=r*s*u-a*l,F=s*s*u+c,L=a*s*u+r*l,C=r*a*u+s*l,U=s*a*u-r*l,H=a*a*u+c,i[0]=d*A+_*P+v*y,i[1]=h*A+m*P+b*y,i[2]=f*A+p*P+R*y,i[3]=g*A+E*P+T*y,i[4]=d*M+_*F+v*L,i[5]=h*M+m*F+b*L,i[6]=f*M+p*F+R*L,i[7]=g*M+E*F+T*L,i[8]=d*C+_*U+v*H,i[9]=h*C+m*U+b*H,i[10]=f*C+p*U+R*H,i[11]=g*C+E*U+T*H,e!==i&&(i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15]),i)}function p_(i,e){return i[0]=e[12],i[1]=e[13],i[2]=e[14],i}function Tc(i,e){let t=e[0],n=e[1],r=e[2],s=e[4],a=e[5],o=e[6],l=e[8],c=e[9],u=e[10];return i[0]=Math.hypot(t,n,r),i[1]=Math.hypot(s,a,o),i[2]=Math.hypot(l,c,u),i}function m_(i){let e=i[0],t=i[1],n=i[2],r=i[4],s=i[5],a=i[6],o=i[8],l=i[9],c=i[10];const u=e*e+t*t+n*n,d=r*r+s*s+a*a,h=o*o+l*l+c*c;return Math.sqrt(Math.max(u,d,h))}const Dc=(function(){const i=[1,1,1];return function(e,t){let n=i;Tc(n,t);let r=1/n[0],s=1/n[1],a=1/n[2],o=t[0]*r,l=t[1]*s,c=t[2]*a,u=t[4]*r,d=t[5]*s,h=t[6]*a,f=t[8]*r,g=t[9]*s,_=t[10]*a,m=o+d+_,p=0;return m>0?(p=Math.sqrt(m+1)*2,e[3]=.25*p,e[0]=(h-g)/p,e[1]=(f-c)/p,e[2]=(l-u)/p):o>d&&o>_?(p=Math.sqrt(1+o-d-_)*2,e[3]=(h-g)/p,e[0]=.25*p,e[1]=(l+u)/p,e[2]=(f+c)/p):d>_?(p=Math.sqrt(1+d-o-_)*2,e[3]=(f-c)/p,e[0]=(l+u)/p,e[1]=.25*p,e[2]=(h+g)/p):(p=Math.sqrt(1+_-o-d)*2,e[3]=(l-u)/p,e[0]=(f+c)/p,e[1]=(h+g)/p,e[2]=.25*p),e}})();function g_(i,e,t,n){let r=Ii([i[0],i[1],i[2]]);const s=Ii([i[4],i[5],i[6]]),a=Ii([i[8],i[9],i[10]]);bc(i)<0&&(r=-r),t[0]=i[12],t[1]=i[13],t[2]=i[14];const l=i.slice(),c=1/r,u=1/s,d=1/a;l[0]*=c,l[1]*=c,l[2]*=c,l[4]*=u,l[5]*=u,l[6]*=u,l[8]*=d,l[9]*=d,l[10]*=d,Dc(e,l),n[0]=r,n[1]=s,n[2]=a}function __(i,e,t,n){const r=i,s=e[0],a=e[1],o=e[2],l=e[3],c=s+s,u=a+a,d=o+o,h=s*c,f=s*u,g=s*d,_=a*u,m=a*d,p=o*d,E=l*c,v=l*u,b=l*d,R=n[0],T=n[1],A=n[2];return r[0]=(1-(_+p))*R,r[1]=(f+b)*R,r[2]=(g-v)*R,r[3]=0,r[4]=(f-b)*T,r[5]=(1-(h+p))*T,r[6]=(m+E)*T,r[7]=0,r[8]=(g+v)*A,r[9]=(m-E)*A,r[10]=(1-(h+_))*A,r[11]=0,r[12]=t[0],r[13]=t[1],r[14]=t[2],r[15]=1,r}function x_(i,e){let t=e[0],n=e[1],r=e[2],s=e[3],a=t+t,o=n+n,l=r+r,c=t*a,u=n*a,d=n*o,h=r*a,f=r*o,g=r*l,_=s*a,m=s*o,p=s*l;return i[0]=1-d-g,i[1]=u+p,i[2]=h-m,i[3]=0,i[4]=u-p,i[5]=1-c-g,i[6]=f+_,i[7]=0,i[8]=h+m,i[9]=f-_,i[10]=1-c-d,i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i}function v_(i,e,t,n,r){let s=1/Math.tan(e/2),a=1/(n-r);return i[0]=s/t,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=s,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=(r+n)*a,i[11]=-1,i[12]=0,i[13]=0,i[14]=2*r*n*a,i[15]=0,i}function M_(i,e,t,n,r,s,a){let o=1/(e-t),l=1/(n-r),c=1/(s-a);return i[0]=-2*o,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=-2*l,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=2*c,i[11]=0,i[12]=(e+t)*o,i[13]=(r+n)*l,i[14]=(a+s)*c,i[15]=1,i}function S_(i,e,t,n){let r=e[0],s=e[1],a=e[2],o=n[0],l=n[1],c=n[2],u=r-t[0],d=s-t[1],h=a-t[2],f=u*u+d*d+h*h;f===0?h=1:(f=1/Math.sqrt(f),u*=f,d*=f,h*=f);let g=l*h-c*d,_=c*u-o*h,m=o*d-l*u;return f=g*g+_*_+m*m,f===0&&(c?o+=1e-6:l?c+=1e-6:l+=1e-6,g=l*h-c*d,_=c*u-o*h,m=o*d-l*u,f=g*g+_*_+m*m),f=1/Math.sqrt(f),g*=f,_*=f,m*=f,i[0]=g,i[1]=_,i[2]=m,i[3]=0,i[4]=d*m-h*_,i[5]=h*g-u*m,i[6]=u*_-d*g,i[7]=0,i[8]=u,i[9]=d,i[10]=h,i[11]=0,i[12]=r,i[13]=s,i[14]=a,i[15]=1,i}function xl(i,e,t){return i[0]=e[0]+t[0],i[1]=e[1]+t[1],i[2]=e[2]+t[2],i[3]=e[3]+t[3],i[4]=e[4]+t[4],i[5]=e[5]+t[5],i[6]=e[6]+t[6],i[7]=e[7]+t[7],i[8]=e[8]+t[8],i[9]=e[9]+t[9],i[10]=e[10]+t[10],i[11]=e[11]+t[11],i[12]=e[12]+t[12],i[13]=e[13]+t[13],i[14]=e[14]+t[14],i[15]=e[15]+t[15],i}function vl(i,e,t){return i[0]=e[0]-t[0],i[1]=e[1]-t[1],i[2]=e[2]-t[2],i[3]=e[3]-t[3],i[4]=e[4]-t[4],i[5]=e[5]-t[5],i[6]=e[6]-t[6],i[7]=e[7]-t[7],i[8]=e[8]-t[8],i[9]=e[9]-t[9],i[10]=e[10]-t[10],i[11]=e[11]-t[11],i[12]=e[12]-t[12],i[13]=e[13]-t[13],i[14]=e[14]-t[14],i[15]=e[15]-t[15],i}function y_(i,e,t){return i[0]=e[0]*t,i[1]=e[1]*t,i[2]=e[2]*t,i[3]=e[3]*t,i[4]=e[4]*t,i[5]=e[5]*t,i[6]=e[6]*t,i[7]=e[7]*t,i[8]=e[8]*t,i[9]=e[9]*t,i[10]=e[10]*t,i[11]=e[11]*t,i[12]=e[12]*t,i[13]=e[13]*t,i[14]=e[14]*t,i[15]=e[15]*t,i}class Ir extends Array{constructor(e=1,t=0,n=0,r=0,s=0,a=1,o=0,l=0,c=0,u=0,d=1,h=0,f=0,g=0,_=0,m=1){return super(e,t,n,r,s,a,o,l,c,u,d,h,f,g,_,m),this}get x(){return this[12]}get y(){return this[13]}get z(){return this[14]}get w(){return this[15]}set x(e){this[12]=e}set y(e){this[13]=e}set z(e){this[14]=e}set w(e){this[15]=e}set(e,t,n,r,s,a,o,l,c,u,d,h,f,g,_,m){return e.length?this.copy(e):(l_(this,e,t,n,r,s,a,o,l,c,u,d,h,f,g,_,m),this)}translate(e,t=this){return h_(this,t,e),this}rotate(e,t,n=this){return f_(this,n,e,t),this}scale(e,t=this){return d_(this,t,typeof e=="number"?[e,e,e]:e),this}add(e,t){return t?xl(this,e,t):xl(this,this,e),this}sub(e,t){return t?vl(this,e,t):vl(this,this,e),this}multiply(e,t){return e.length?t?_l(this,e,t):_l(this,this,e):y_(this,this,e),this}identity(){return c_(this),this}copy(e){return o_(this,e),this}fromPerspective({fov:e,aspect:t,near:n,far:r}={}){return v_(this,e,t,n,r),this}fromOrthogonal({left:e,right:t,bottom:n,top:r,near:s,far:a}){return M_(this,e,t,n,r,s,a),this}fromQuaternion(e){return x_(this,e),this}setPosition(e){return this.x=e[0],this.y=e[1],this.z=e[2],this}inverse(e=this){return u_(this,e),this}compose(e,t,n){return __(this,e,t,n),this}decompose(e,t,n){return g_(this,e,t,n),this}getRotation(e){return Dc(e,this),this}getTranslation(e){return p_(e,this),this}getScaling(e){return Tc(e,this),this}getMaxScaleOnAxis(){return m_(this)}lookAt(e,t,n){return S_(this,e,t,n),this}determinant(){return bc(this)}fromArray(e,t=0){return this[0]=e[t],this[1]=e[t+1],this[2]=e[t+2],this[3]=e[t+3],this[4]=e[t+4],this[5]=e[t+5],this[6]=e[t+6],this[7]=e[t+7],this[8]=e[t+8],this[9]=e[t+9],this[10]=e[t+10],this[11]=e[t+11],this[12]=e[t+12],this[13]=e[t+13],this[14]=e[t+14],this[15]=e[t+15],this}toArray(e=[],t=0){return e[t]=this[0],e[t+1]=this[1],e[t+2]=this[2],e[t+3]=this[3],e[t+4]=this[4],e[t+5]=this[5],e[t+6]=this[6],e[t+7]=this[7],e[t+8]=this[8],e[t+9]=this[9],e[t+10]=this[10],e[t+11]=this[11],e[t+12]=this[12],e[t+13]=this[13],e[t+14]=this[14],e[t+15]=this[15],e}}function E_(i,e,t="YXZ"){return t==="XYZ"?(i[1]=Math.asin(Math.min(Math.max(e[8],-1),1)),Math.abs(e[8])<.99999?(i[0]=Math.atan2(-e[9],e[10]),i[2]=Math.atan2(-e[4],e[0])):(i[0]=Math.atan2(e[6],e[5]),i[2]=0)):t==="YXZ"?(i[0]=Math.asin(-Math.min(Math.max(e[9],-1),1)),Math.abs(e[9])<.99999?(i[1]=Math.atan2(e[8],e[10]),i[2]=Math.atan2(e[1],e[5])):(i[1]=Math.atan2(-e[2],e[0]),i[2]=0)):t==="ZXY"?(i[0]=Math.asin(Math.min(Math.max(e[6],-1),1)),Math.abs(e[6])<.99999?(i[1]=Math.atan2(-e[2],e[10]),i[2]=Math.atan2(-e[4],e[5])):(i[1]=0,i[2]=Math.atan2(e[1],e[0]))):t==="ZYX"?(i[1]=Math.asin(-Math.min(Math.max(e[2],-1),1)),Math.abs(e[2])<.99999?(i[0]=Math.atan2(e[6],e[10]),i[2]=Math.atan2(e[1],e[0])):(i[0]=0,i[2]=Math.atan2(-e[4],e[5]))):t==="YZX"?(i[2]=Math.asin(Math.min(Math.max(e[1],-1),1)),Math.abs(e[1])<.99999?(i[0]=Math.atan2(-e[9],e[5]),i[1]=Math.atan2(-e[2],e[0])):(i[0]=0,i[1]=Math.atan2(e[8],e[10]))):t==="XZY"&&(i[2]=Math.asin(-Math.min(Math.max(e[4],-1),1)),Math.abs(e[4])<.99999?(i[0]=Math.atan2(e[6],e[5]),i[1]=Math.atan2(e[8],e[0])):(i[0]=Math.atan2(-e[9],e[10]),i[1]=0)),i}const Ml=new Ir;class b_ extends Array{constructor(e=0,t=e,n=e,r="YXZ"){super(e,t,n),this.order=r,this.onChange=()=>{},this._target=this;const s=["0","1","2"];return new Proxy(this,{set(a,o){const l=Reflect.set(...arguments);return l&&s.includes(o)&&a.onChange(),l}})}get x(){return this[0]}get y(){return this[1]}get z(){return this[2]}set x(e){this._target[0]=e,this.onChange()}set y(e){this._target[1]=e,this.onChange()}set z(e){this._target[2]=e,this.onChange()}set(e,t=e,n=e){return e.length?this.copy(e):(this._target[0]=e,this._target[1]=t,this._target[2]=n,this.onChange(),this)}copy(e){return this._target[0]=e[0],this._target[1]=e[1],this._target[2]=e[2],this.onChange(),this}reorder(e){return this._target.order=e,this.onChange(),this}fromRotationMatrix(e,t=this.order){return E_(this._target,e,t),this.onChange(),this}fromQuaternion(e,t=this.order,n){return Ml.fromQuaternion(e),this._target.fromRotationMatrix(Ml,t),n||this.onChange(),this}fromArray(e,t=0){return this._target[0]=e[t],this._target[1]=e[t+1],this._target[2]=e[t+2],this}toArray(e=[],t=0){return e[t]=this[0],e[t+1]=this[1],e[t+2]=this[2],e}}class T_{constructor(){this.parent=null,this.children=[],this.visible=!0,this.matrix=new Ir,this.worldMatrix=new Ir,this.matrixAutoUpdate=!0,this.worldMatrixNeedsUpdate=!1,this.position=new kt,this.quaternion=new s_,this.scale=new kt(1),this.rotation=new b_,this.up=new kt(0,1,0),this.rotation._target.onChange=()=>this.quaternion.fromEuler(this.rotation,!0),this.quaternion._target.onChange=()=>this.rotation.fromQuaternion(this.quaternion,void 0,!0)}setParent(e,t=!0){this.parent&&e!==this.parent&&this.parent.removeChild(this,!1),this.parent=e,t&&e&&e.addChild(this,!1)}addChild(e,t=!0){~this.children.indexOf(e)||this.children.push(e),t&&e.setParent(this,!1)}removeChild(e,t=!0){~this.children.indexOf(e)&&this.children.splice(this.children.indexOf(e),1),t&&e.setParent(null,!1)}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.worldMatrixNeedsUpdate||e)&&(this.parent===null?this.worldMatrix.copy(this.matrix):this.worldMatrix.multiply(this.parent.worldMatrix,this.matrix),this.worldMatrixNeedsUpdate=!1,e=!0);for(let t=0,n=this.children.length;t<n;t++)this.children[t].updateMatrixWorld(e)}updateMatrix(){this.matrix.compose(this.quaternion,this.position,this.scale),this.worldMatrixNeedsUpdate=!0}traverse(e){if(!e(this))for(let t=0,n=this.children.length;t<n;t++)this.children[t].traverse(e)}decompose(){this.matrix.decompose(this.quaternion._target,this.position,this.scale),this.rotation.fromQuaternion(this.quaternion)}lookAt(e,t=!1){t?this.matrix.lookAt(this.position,e,this.up):this.matrix.lookAt(e,this.position,this.up),this.matrix.getRotation(this.quaternion._target),this.rotation.fromQuaternion(this.quaternion)}}function D_(i,e){return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[4],i[4]=e[5],i[5]=e[6],i[6]=e[8],i[7]=e[9],i[8]=e[10],i}function A_(i,e){let t=e[0],n=e[1],r=e[2],s=e[3],a=t+t,o=n+n,l=r+r,c=t*a,u=n*a,d=n*o,h=r*a,f=r*o,g=r*l,_=s*a,m=s*o,p=s*l;return i[0]=1-d-g,i[3]=u-p,i[6]=h+m,i[1]=u+p,i[4]=1-c-g,i[7]=f-_,i[2]=h-m,i[5]=f+_,i[8]=1-c-d,i}function w_(i,e){return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[4]=e[4],i[5]=e[5],i[6]=e[6],i[7]=e[7],i[8]=e[8],i}function C_(i,e,t,n,r,s,a,o,l,c){return i[0]=e,i[1]=t,i[2]=n,i[3]=r,i[4]=s,i[5]=a,i[6]=o,i[7]=l,i[8]=c,i}function R_(i){return i[0]=1,i[1]=0,i[2]=0,i[3]=0,i[4]=1,i[5]=0,i[6]=0,i[7]=0,i[8]=1,i}function P_(i,e){let t=e[0],n=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],u=e[8],d=u*a-o*c,h=-u*s+o*l,f=c*s-a*l,g=t*d+n*h+r*f;return g?(g=1/g,i[0]=d*g,i[1]=(-u*n+r*c)*g,i[2]=(o*n-r*a)*g,i[3]=h*g,i[4]=(u*t-r*l)*g,i[5]=(-o*t+r*s)*g,i[6]=f*g,i[7]=(-c*t+n*l)*g,i[8]=(a*t-n*s)*g,i):null}function Sl(i,e,t){let n=e[0],r=e[1],s=e[2],a=e[3],o=e[4],l=e[5],c=e[6],u=e[7],d=e[8],h=t[0],f=t[1],g=t[2],_=t[3],m=t[4],p=t[5],E=t[6],v=t[7],b=t[8];return i[0]=h*n+f*a+g*c,i[1]=h*r+f*o+g*u,i[2]=h*s+f*l+g*d,i[3]=_*n+m*a+p*c,i[4]=_*r+m*o+p*u,i[5]=_*s+m*l+p*d,i[6]=E*n+v*a+b*c,i[7]=E*r+v*o+b*u,i[8]=E*s+v*l+b*d,i}function L_(i,e,t){let n=e[0],r=e[1],s=e[2],a=e[3],o=e[4],l=e[5],c=e[6],u=e[7],d=e[8],h=t[0],f=t[1];return i[0]=n,i[1]=r,i[2]=s,i[3]=a,i[4]=o,i[5]=l,i[6]=h*n+f*a+c,i[7]=h*r+f*o+u,i[8]=h*s+f*l+d,i}function F_(i,e,t){let n=e[0],r=e[1],s=e[2],a=e[3],o=e[4],l=e[5],c=e[6],u=e[7],d=e[8],h=Math.sin(t),f=Math.cos(t);return i[0]=f*n+h*a,i[1]=f*r+h*o,i[2]=f*s+h*l,i[3]=f*a-h*n,i[4]=f*o-h*r,i[5]=f*l-h*s,i[6]=c,i[7]=u,i[8]=d,i}function I_(i,e,t){let n=t[0],r=t[1];return i[0]=n*e[0],i[1]=n*e[1],i[2]=n*e[2],i[3]=r*e[3],i[4]=r*e[4],i[5]=r*e[5],i[6]=e[6],i[7]=e[7],i[8]=e[8],i}function U_(i,e){let t=e[0],n=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],u=e[8],d=e[9],h=e[10],f=e[11],g=e[12],_=e[13],m=e[14],p=e[15],E=t*o-n*a,v=t*l-r*a,b=t*c-s*a,R=n*l-r*o,T=n*c-s*o,A=r*c-s*l,P=u*_-d*g,y=u*m-h*g,M=u*p-f*g,F=d*m-h*_,L=d*p-f*_,C=h*p-f*m,U=E*C-v*L+b*F+R*M-T*y+A*P;return U?(U=1/U,i[0]=(o*C-l*L+c*F)*U,i[1]=(l*M-a*C-c*y)*U,i[2]=(a*L-o*M+c*P)*U,i[3]=(r*L-n*C-s*F)*U,i[4]=(t*C-r*M+s*y)*U,i[5]=(n*M-t*L-s*P)*U,i[6]=(_*A-m*T+p*R)*U,i[7]=(m*b-g*A-p*v)*U,i[8]=(g*T-_*b+p*E)*U,i):null}class N_ extends Array{constructor(e=1,t=0,n=0,r=0,s=1,a=0,o=0,l=0,c=1){return super(e,t,n,r,s,a,o,l,c),this}set(e,t,n,r,s,a,o,l,c){return e.length?this.copy(e):(C_(this,e,t,n,r,s,a,o,l,c),this)}translate(e,t=this){return L_(this,t,e),this}rotate(e,t=this){return F_(this,t,e),this}scale(e,t=this){return I_(this,t,e),this}multiply(e,t){return t?Sl(this,e,t):Sl(this,this,e),this}identity(){return R_(this),this}copy(e){return w_(this,e),this}fromMatrix4(e){return D_(this,e),this}fromQuaternion(e){return A_(this,e),this}fromBasis(e,t,n){return this.set(e[0],e[1],e[2],t[0],t[1],t[2],n[0],n[1],n[2]),this}inverse(e=this){return P_(this,e),this}getNormalMatrix(e){return U_(this,e),this}}let O_=0;class B_ extends T_{constructor(e,{geometry:t,program:n,mode:r=e.TRIANGLES,frustumCulled:s=!0,renderOrder:a=0}={}){super(),e.canvas||console.error("gl not passed as first argument to Mesh"),this.gl=e,this.id=O_++,this.geometry=t,this.program=n,this.mode=r,this.frustumCulled=s,this.renderOrder=a,this.modelViewMatrix=new Ir,this.normalMatrix=new N_,this.beforeRenderCallbacks=[],this.afterRenderCallbacks=[]}onBeforeRender(e){return this.beforeRenderCallbacks.push(e),this}onAfterRender(e){return this.afterRenderCallbacks.push(e),this}draw({camera:e}={}){e&&(this.program.uniforms.modelMatrix||Object.assign(this.program.uniforms,{modelMatrix:{value:null},viewMatrix:{value:null},modelViewMatrix:{value:null},normalMatrix:{value:null},projectionMatrix:{value:null},cameraPosition:{value:null}}),this.program.uniforms.projectionMatrix.value=e.projectionMatrix,this.program.uniforms.cameraPosition.value=e.worldPosition,this.program.uniforms.viewMatrix.value=e.viewMatrix,this.modelViewMatrix.multiply(e.viewMatrix,this.worldMatrix),this.normalMatrix.getNormalMatrix(this.modelViewMatrix),this.program.uniforms.modelMatrix.value=this.worldMatrix,this.program.uniforms.modelViewMatrix.value=this.modelViewMatrix,this.program.uniforms.normalMatrix.value=this.normalMatrix),this.beforeRenderCallbacks.forEach(n=>n&&n({mesh:this,camera:e}));let t=this.program.cullFace&&this.worldMatrix.determinant()<0;this.program.use({flipFaces:t}),this.geometry.draw({mode:this.mode,program:this.program}),this.afterRenderCallbacks.forEach(n=>n&&n({mesh:this,camera:e}))}}const yl={black:"#000000",white:"#ffffff",red:"#ff0000",green:"#00ff00",blue:"#0000ff",fuchsia:"#ff00ff",cyan:"#00ffff",yellow:"#ffff00",orange:"#ff8000"};function El(i){i.length===4&&(i=i[0]+i[1]+i[1]+i[2]+i[2]+i[3]+i[3]);const e=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(i);return e||console.warn(`Unable to convert hex string ${i} to rgb values`),[parseInt(e[1],16)/255,parseInt(e[2],16)/255,parseInt(e[3],16)/255]}function z_(i){return i=parseInt(i),[(i>>16&255)/255,(i>>8&255)/255,(i&255)/255]}function bl(i){return i===void 0?[0,0,0]:arguments.length===3?arguments:isNaN(i)?i[0]==="#"?El(i):yl[i.toLowerCase()]?El(yl[i.toLowerCase()]):(console.warn("Color format not recognised"),[0,0,0]):z_(i)}class Tl extends Array{constructor(e){return Array.isArray(e)?super(...e):super(...bl(...arguments))}get r(){return this[0]}get g(){return this[1]}get b(){return this[2]}set r(e){this[0]=e}set g(e){this[1]=e}set b(e){this[2]=e}set(e){return Array.isArray(e)?this.copy(e):this.copy(bl(...arguments))}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this}}class k_ extends Fg{constructor(e,{attributes:t={}}={}){Object.assign(t,{position:{size:2,data:new Float32Array([-1,-1,3,-1,-1,3])},uv:{size:2,data:new Float32Array([0,0,2,0,0,2])}}),super(e,t)}}const H_=`#version 300 es
4520
+ `)}function Ug(i){const e=i.length,t=i[0].length;if(t===void 0)return i;const n=e*t;let r=fl[n];r||(fl[n]=r=new Float32Array(n));for(let s=0;s<e;s++)r.set(i[s],s*t);return r}function Og(i,e){if(i.length!==e.length)return!1;for(let t=0,n=i.length;t<n;t++)if(i[t]!==e[t])return!1;return!0}function Bg(i,e){for(let t=0,n=i.length;t<n;t++)i[t]=e[t]}let Fs=0;function ml(i){Fs>100||(console.warn(i),Fs++,Fs>100&&console.warn("More than 100 program warnings - stopping logs."))}const Is=new kt;let zg=1;class kg{constructor({canvas:e=document.createElement("canvas"),width:t=300,height:n=150,dpr:r=1,alpha:s=!1,depth:a=!0,stencil:o=!1,antialias:l=!1,premultipliedAlpha:c=!1,preserveDrawingBuffer:u=!1,powerPreference:d="default",autoClear:h=!0,webgl:f=2}={}){const g={alpha:s,depth:a,stencil:o,antialias:l,premultipliedAlpha:c,preserveDrawingBuffer:u,powerPreference:d};this.dpr=r,this.alpha=s,this.color=!0,this.depth=a,this.stencil=o,this.premultipliedAlpha=c,this.autoClear=h,this.id=zg++,f===2&&(this.gl=e.getContext("webgl2",g)),this.isWebgl2=!!this.gl,this.gl||(this.gl=e.getContext("webgl",g)),this.gl||console.error("unable to create webgl context"),this.gl.renderer=this,this.setSize(t,n),this.state={},this.state.blendFunc={src:this.gl.ONE,dst:this.gl.ZERO},this.state.blendEquation={modeRGB:this.gl.FUNC_ADD},this.state.cullFace=!1,this.state.frontFace=this.gl.CCW,this.state.depthMask=!0,this.state.depthFunc=this.gl.LEQUAL,this.state.premultiplyAlpha=!1,this.state.flipY=!1,this.state.unpackAlignment=4,this.state.framebuffer=null,this.state.viewport={x:0,y:0,width:null,height:null},this.state.textureUnits=[],this.state.activeTextureUnit=0,this.state.boundBuffer=null,this.state.uniformLocations=new Map,this.state.currentProgram=null,this.extensions={},this.isWebgl2?(this.getExtension("EXT_color_buffer_float"),this.getExtension("OES_texture_float_linear")):(this.getExtension("OES_texture_float"),this.getExtension("OES_texture_float_linear"),this.getExtension("OES_texture_half_float"),this.getExtension("OES_texture_half_float_linear"),this.getExtension("OES_element_index_uint"),this.getExtension("OES_standard_derivatives"),this.getExtension("EXT_sRGB"),this.getExtension("WEBGL_depth_texture"),this.getExtension("WEBGL_draw_buffers")),this.getExtension("WEBGL_compressed_texture_astc"),this.getExtension("EXT_texture_compression_bptc"),this.getExtension("WEBGL_compressed_texture_s3tc"),this.getExtension("WEBGL_compressed_texture_etc1"),this.getExtension("WEBGL_compressed_texture_pvrtc"),this.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),this.vertexAttribDivisor=this.getExtension("ANGLE_instanced_arrays","vertexAttribDivisor","vertexAttribDivisorANGLE"),this.drawArraysInstanced=this.getExtension("ANGLE_instanced_arrays","drawArraysInstanced","drawArraysInstancedANGLE"),this.drawElementsInstanced=this.getExtension("ANGLE_instanced_arrays","drawElementsInstanced","drawElementsInstancedANGLE"),this.createVertexArray=this.getExtension("OES_vertex_array_object","createVertexArray","createVertexArrayOES"),this.bindVertexArray=this.getExtension("OES_vertex_array_object","bindVertexArray","bindVertexArrayOES"),this.deleteVertexArray=this.getExtension("OES_vertex_array_object","deleteVertexArray","deleteVertexArrayOES"),this.drawBuffers=this.getExtension("WEBGL_draw_buffers","drawBuffers","drawBuffersWEBGL"),this.parameters={},this.parameters.maxTextureUnits=this.gl.getParameter(this.gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS),this.parameters.maxAnisotropy=this.getExtension("EXT_texture_filter_anisotropic")?this.gl.getParameter(this.getExtension("EXT_texture_filter_anisotropic").MAX_TEXTURE_MAX_ANISOTROPY_EXT):0}setSize(e,t){this.width=e,this.height=t,this.gl.canvas.width=e*this.dpr,this.gl.canvas.height=t*this.dpr,this.gl.canvas.style&&Object.assign(this.gl.canvas.style,{width:e+"px",height:t+"px"})}setViewport(e,t,n=0,r=0){this.state.viewport.width===e&&this.state.viewport.height===t||(this.state.viewport.width=e,this.state.viewport.height=t,this.state.viewport.x=n,this.state.viewport.y=r,this.gl.viewport(n,r,e,t))}setScissor(e,t,n=0,r=0){this.gl.scissor(n,r,e,t)}enable(e){this.state[e]!==!0&&(this.gl.enable(e),this.state[e]=!0)}disable(e){this.state[e]!==!1&&(this.gl.disable(e),this.state[e]=!1)}setBlendFunc(e,t,n,r){this.state.blendFunc.src===e&&this.state.blendFunc.dst===t&&this.state.blendFunc.srcAlpha===n&&this.state.blendFunc.dstAlpha===r||(this.state.blendFunc.src=e,this.state.blendFunc.dst=t,this.state.blendFunc.srcAlpha=n,this.state.blendFunc.dstAlpha=r,n!==void 0?this.gl.blendFuncSeparate(e,t,n,r):this.gl.blendFunc(e,t))}setBlendEquation(e,t){e=e||this.gl.FUNC_ADD,!(this.state.blendEquation.modeRGB===e&&this.state.blendEquation.modeAlpha===t)&&(this.state.blendEquation.modeRGB=e,this.state.blendEquation.modeAlpha=t,t!==void 0?this.gl.blendEquationSeparate(e,t):this.gl.blendEquation(e))}setCullFace(e){this.state.cullFace!==e&&(this.state.cullFace=e,this.gl.cullFace(e))}setFrontFace(e){this.state.frontFace!==e&&(this.state.frontFace=e,this.gl.frontFace(e))}setDepthMask(e){this.state.depthMask!==e&&(this.state.depthMask=e,this.gl.depthMask(e))}setDepthFunc(e){this.state.depthFunc!==e&&(this.state.depthFunc=e,this.gl.depthFunc(e))}setStencilMask(e){this.state.stencilMask!==e&&(this.state.stencilMask=e,this.gl.stencilMask(e))}setStencilFunc(e,t,n){this.state.stencilFunc===e&&this.state.stencilRef===t&&this.state.stencilFuncMask===n||(this.state.stencilFunc=e||this.gl.ALWAYS,this.state.stencilRef=t||0,this.state.stencilFuncMask=n||0,this.gl.stencilFunc(e||this.gl.ALWAYS,t||0,n||0))}setStencilOp(e,t,n){this.state.stencilFail===e&&this.state.stencilDepthFail===t&&this.state.stencilDepthPass===n||(this.state.stencilFail=e,this.state.stencilDepthFail=t,this.state.stencilDepthPass=n,this.gl.stencilOp(e,t,n))}activeTexture(e){this.state.activeTextureUnit!==e&&(this.state.activeTextureUnit=e,this.gl.activeTexture(this.gl.TEXTURE0+e))}bindFramebuffer({target:e=this.gl.FRAMEBUFFER,buffer:t=null}={}){this.state.framebuffer!==t&&(this.state.framebuffer=t,this.gl.bindFramebuffer(e,t))}getExtension(e,t,n){return t&&this.gl[t]?this.gl[t].bind(this.gl):(this.extensions[e]||(this.extensions[e]=this.gl.getExtension(e)),t?this.extensions[e]?this.extensions[e][n].bind(this.extensions[e]):null:this.extensions[e])}sortOpaque(e,t){return e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.program.id!==t.program.id?e.program.id-t.program.id:e.zDepth!==t.zDepth?e.zDepth-t.zDepth:t.id-e.id}sortTransparent(e,t){return e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.zDepth!==t.zDepth?t.zDepth-e.zDepth:t.id-e.id}sortUI(e,t){return e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.program.id!==t.program.id?e.program.id-t.program.id:t.id-e.id}getRenderList({scene:e,camera:t,frustumCull:n,sort:r}){let s=[];if(t&&n&&t.updateFrustum(),e.traverse(a=>{if(!a.visible)return!0;a.draw&&(n&&a.frustumCulled&&t&&!t.frustumIntersectsMesh(a)||s.push(a))}),r){const a=[],o=[],l=[];s.forEach(c=>{c.program.transparent?c.program.depthTest?o.push(c):l.push(c):a.push(c),c.zDepth=0,!(c.renderOrder!==0||!c.program.depthTest||!t)&&(c.worldMatrix.getTranslation(Is),Is.applyMatrix4(t.projectionViewMatrix),c.zDepth=Is.z)}),a.sort(this.sortOpaque),o.sort(this.sortTransparent),l.sort(this.sortUI),s=a.concat(o,l)}return s}render({scene:e,camera:t,target:n=null,update:r=!0,sort:s=!0,frustumCull:a=!0,clear:o}){n===null?(this.bindFramebuffer(),this.setViewport(this.width*this.dpr,this.height*this.dpr)):(this.bindFramebuffer(n),this.setViewport(n.width,n.height)),(o||this.autoClear&&o!==!1)&&(this.depth&&(!n||n.depth)&&(this.enable(this.gl.DEPTH_TEST),this.setDepthMask(!0)),(this.stencil||!n||n.stencil)&&(this.enable(this.gl.STENCIL_TEST),this.setStencilMask(255)),this.gl.clear((this.color?this.gl.COLOR_BUFFER_BIT:0)|(this.depth?this.gl.DEPTH_BUFFER_BIT:0)|(this.stencil?this.gl.STENCIL_BUFFER_BIT:0))),r&&e.updateMatrixWorld(),t&&t.updateMatrixWorld(),this.getRenderList({scene:e,camera:t,frustumCull:a,sort:s}).forEach(c=>{c.draw({camera:t})})}}function Vg(i,e){return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i}function Hg(i,e,t,n,r){return i[0]=e,i[1]=t,i[2]=n,i[3]=r,i}function Gg(i,e){let t=e[0],n=e[1],r=e[2],s=e[3],a=t*t+n*n+r*r+s*s;return a>0&&(a=1/Math.sqrt(a)),i[0]=t*a,i[1]=n*a,i[2]=r*a,i[3]=s*a,i}function Wg(i,e){return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]+i[3]*e[3]}function Xg(i){return i[0]=0,i[1]=0,i[2]=0,i[3]=1,i}function qg(i,e,t){t=t*.5;let n=Math.sin(t);return i[0]=n*e[0],i[1]=n*e[1],i[2]=n*e[2],i[3]=Math.cos(t),i}function gl(i,e,t){let n=e[0],r=e[1],s=e[2],a=e[3],o=t[0],l=t[1],c=t[2],u=t[3];return i[0]=n*u+a*o+r*c-s*l,i[1]=r*u+a*l+s*o-n*c,i[2]=s*u+a*c+n*l-r*o,i[3]=a*u-n*o-r*l-s*c,i}function jg(i,e,t){t*=.5;let n=e[0],r=e[1],s=e[2],a=e[3],o=Math.sin(t),l=Math.cos(t);return i[0]=n*l+a*o,i[1]=r*l+s*o,i[2]=s*l-r*o,i[3]=a*l-n*o,i}function $g(i,e,t){t*=.5;let n=e[0],r=e[1],s=e[2],a=e[3],o=Math.sin(t),l=Math.cos(t);return i[0]=n*l-s*o,i[1]=r*l+a*o,i[2]=s*l+n*o,i[3]=a*l-r*o,i}function Yg(i,e,t){t*=.5;let n=e[0],r=e[1],s=e[2],a=e[3],o=Math.sin(t),l=Math.cos(t);return i[0]=n*l+r*o,i[1]=r*l-n*o,i[2]=s*l+a*o,i[3]=a*l-s*o,i}function Kg(i,e,t,n){let r=e[0],s=e[1],a=e[2],o=e[3],l=t[0],c=t[1],u=t[2],d=t[3],h,f,g,_,m;return f=r*l+s*c+a*u+o*d,f<0&&(f=-f,l=-l,c=-c,u=-u,d=-d),1-f>1e-6?(h=Math.acos(f),g=Math.sin(h),_=Math.sin((1-n)*h)/g,m=Math.sin(n*h)/g):(_=1-n,m=n),i[0]=_*r+m*l,i[1]=_*s+m*c,i[2]=_*a+m*u,i[3]=_*o+m*d,i}function Zg(i,e){let t=e[0],n=e[1],r=e[2],s=e[3],a=t*t+n*n+r*r+s*s,o=a?1/a:0;return i[0]=-t*o,i[1]=-n*o,i[2]=-r*o,i[3]=s*o,i}function Jg(i,e){return i[0]=-e[0],i[1]=-e[1],i[2]=-e[2],i[3]=e[3],i}function Qg(i,e){let t=e[0]+e[4]+e[8],n;if(t>0)n=Math.sqrt(t+1),i[3]=.5*n,n=.5/n,i[0]=(e[5]-e[7])*n,i[1]=(e[6]-e[2])*n,i[2]=(e[1]-e[3])*n;else{let r=0;e[4]>e[0]&&(r=1),e[8]>e[r*3+r]&&(r=2);let s=(r+1)%3,a=(r+2)%3;n=Math.sqrt(e[r*3+r]-e[s*3+s]-e[a*3+a]+1),i[r]=.5*n,n=.5/n,i[3]=(e[s*3+a]-e[a*3+s])*n,i[s]=(e[s*3+r]+e[r*3+s])*n,i[a]=(e[a*3+r]+e[r*3+a])*n}return i}function e_(i,e,t="YXZ"){let n=Math.sin(e[0]*.5),r=Math.cos(e[0]*.5),s=Math.sin(e[1]*.5),a=Math.cos(e[1]*.5),o=Math.sin(e[2]*.5),l=Math.cos(e[2]*.5);return t==="XYZ"?(i[0]=n*a*l+r*s*o,i[1]=r*s*l-n*a*o,i[2]=r*a*o+n*s*l,i[3]=r*a*l-n*s*o):t==="YXZ"?(i[0]=n*a*l+r*s*o,i[1]=r*s*l-n*a*o,i[2]=r*a*o-n*s*l,i[3]=r*a*l+n*s*o):t==="ZXY"?(i[0]=n*a*l-r*s*o,i[1]=r*s*l+n*a*o,i[2]=r*a*o+n*s*l,i[3]=r*a*l-n*s*o):t==="ZYX"?(i[0]=n*a*l-r*s*o,i[1]=r*s*l+n*a*o,i[2]=r*a*o-n*s*l,i[3]=r*a*l+n*s*o):t==="YZX"?(i[0]=n*a*l+r*s*o,i[1]=r*s*l+n*a*o,i[2]=r*a*o-n*s*l,i[3]=r*a*l-n*s*o):t==="XZY"&&(i[0]=n*a*l-r*s*o,i[1]=r*s*l-n*a*o,i[2]=r*a*o+n*s*l,i[3]=r*a*l+n*s*o),i}const t_=Vg,n_=Hg,i_=Wg,r_=Gg;class s_ extends Array{constructor(e=0,t=0,n=0,r=1){super(e,t,n,r),this.onChange=()=>{},this._target=this;const s=["0","1","2","3"];return new Proxy(this,{set(a,o){const l=Reflect.set(...arguments);return l&&s.includes(o)&&a.onChange(),l}})}get x(){return this[0]}get y(){return this[1]}get z(){return this[2]}get w(){return this[3]}set x(e){this._target[0]=e,this.onChange()}set y(e){this._target[1]=e,this.onChange()}set z(e){this._target[2]=e,this.onChange()}set w(e){this._target[3]=e,this.onChange()}identity(){return Xg(this._target),this.onChange(),this}set(e,t,n,r){return e.length?this.copy(e):(n_(this._target,e,t,n,r),this.onChange(),this)}rotateX(e){return jg(this._target,this._target,e),this.onChange(),this}rotateY(e){return $g(this._target,this._target,e),this.onChange(),this}rotateZ(e){return Yg(this._target,this._target,e),this.onChange(),this}inverse(e=this._target){return Zg(this._target,e),this.onChange(),this}conjugate(e=this._target){return Jg(this._target,e),this.onChange(),this}copy(e){return t_(this._target,e),this.onChange(),this}normalize(e=this._target){return r_(this._target,e),this.onChange(),this}multiply(e,t){return t?gl(this._target,e,t):gl(this._target,this._target,e),this.onChange(),this}dot(e){return i_(this._target,e)}fromMatrix3(e){return Qg(this._target,e),this.onChange(),this}fromEuler(e,t){return e_(this._target,e,e.order),t||this.onChange(),this}fromAxisAngle(e,t){return qg(this._target,e,t),this.onChange(),this}slerp(e,t){return Kg(this._target,this._target,e,t),this.onChange(),this}fromArray(e,t=0){return this._target[0]=e[t],this._target[1]=e[t+1],this._target[2]=e[t+2],this._target[3]=e[t+3],this.onChange(),this}toArray(e=[],t=0){return e[t]=this[0],e[t+1]=this[1],e[t+2]=this[2],e[t+3]=this[3],e}}const a_=1e-6;function o_(i,e){return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[4]=e[4],i[5]=e[5],i[6]=e[6],i[7]=e[7],i[8]=e[8],i[9]=e[9],i[10]=e[10],i[11]=e[11],i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15],i}function l_(i,e,t,n,r,s,a,o,l,c,u,d,h,f,g,_,m){return i[0]=e,i[1]=t,i[2]=n,i[3]=r,i[4]=s,i[5]=a,i[6]=o,i[7]=l,i[8]=c,i[9]=u,i[10]=d,i[11]=h,i[12]=f,i[13]=g,i[14]=_,i[15]=m,i}function c_(i){return i[0]=1,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=1,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=1,i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i}function u_(i,e){let t=e[0],n=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],u=e[8],d=e[9],h=e[10],f=e[11],g=e[12],_=e[13],m=e[14],p=e[15],E=t*o-n*a,v=t*l-r*a,b=t*c-s*a,R=n*l-r*o,T=n*c-s*o,A=r*c-s*l,P=u*_-d*g,S=u*m-h*g,M=u*p-f*g,F=d*m-h*_,L=d*p-f*_,C=h*p-f*m,N=E*C-v*L+b*F+R*M-T*S+A*P;return N?(N=1/N,i[0]=(o*C-l*L+c*F)*N,i[1]=(r*L-n*C-s*F)*N,i[2]=(_*A-m*T+p*R)*N,i[3]=(h*T-d*A-f*R)*N,i[4]=(l*M-a*C-c*S)*N,i[5]=(t*C-r*M+s*S)*N,i[6]=(m*b-g*A-p*v)*N,i[7]=(u*A-h*b+f*v)*N,i[8]=(a*L-o*M+c*P)*N,i[9]=(n*M-t*L-s*P)*N,i[10]=(g*T-_*b+p*E)*N,i[11]=(d*b-u*T-f*E)*N,i[12]=(o*S-a*F-l*P)*N,i[13]=(t*F-n*S+r*P)*N,i[14]=(_*v-g*R-m*E)*N,i[15]=(u*R-d*v+h*E)*N,i):null}function bc(i){let e=i[0],t=i[1],n=i[2],r=i[3],s=i[4],a=i[5],o=i[6],l=i[7],c=i[8],u=i[9],d=i[10],h=i[11],f=i[12],g=i[13],_=i[14],m=i[15],p=e*a-t*s,E=e*o-n*s,v=e*l-r*s,b=t*o-n*a,R=t*l-r*a,T=n*l-r*o,A=c*g-u*f,P=c*_-d*f,S=c*m-h*f,M=u*_-d*g,F=u*m-h*g,L=d*m-h*_;return p*L-E*F+v*M+b*S-R*P+T*A}function _l(i,e,t){let n=e[0],r=e[1],s=e[2],a=e[3],o=e[4],l=e[5],c=e[6],u=e[7],d=e[8],h=e[9],f=e[10],g=e[11],_=e[12],m=e[13],p=e[14],E=e[15],v=t[0],b=t[1],R=t[2],T=t[3];return i[0]=v*n+b*o+R*d+T*_,i[1]=v*r+b*l+R*h+T*m,i[2]=v*s+b*c+R*f+T*p,i[3]=v*a+b*u+R*g+T*E,v=t[4],b=t[5],R=t[6],T=t[7],i[4]=v*n+b*o+R*d+T*_,i[5]=v*r+b*l+R*h+T*m,i[6]=v*s+b*c+R*f+T*p,i[7]=v*a+b*u+R*g+T*E,v=t[8],b=t[9],R=t[10],T=t[11],i[8]=v*n+b*o+R*d+T*_,i[9]=v*r+b*l+R*h+T*m,i[10]=v*s+b*c+R*f+T*p,i[11]=v*a+b*u+R*g+T*E,v=t[12],b=t[13],R=t[14],T=t[15],i[12]=v*n+b*o+R*d+T*_,i[13]=v*r+b*l+R*h+T*m,i[14]=v*s+b*c+R*f+T*p,i[15]=v*a+b*u+R*g+T*E,i}function h_(i,e,t){let n=t[0],r=t[1],s=t[2],a,o,l,c,u,d,h,f,g,_,m,p;return e===i?(i[12]=e[0]*n+e[4]*r+e[8]*s+e[12],i[13]=e[1]*n+e[5]*r+e[9]*s+e[13],i[14]=e[2]*n+e[6]*r+e[10]*s+e[14],i[15]=e[3]*n+e[7]*r+e[11]*s+e[15]):(a=e[0],o=e[1],l=e[2],c=e[3],u=e[4],d=e[5],h=e[6],f=e[7],g=e[8],_=e[9],m=e[10],p=e[11],i[0]=a,i[1]=o,i[2]=l,i[3]=c,i[4]=u,i[5]=d,i[6]=h,i[7]=f,i[8]=g,i[9]=_,i[10]=m,i[11]=p,i[12]=a*n+u*r+g*s+e[12],i[13]=o*n+d*r+_*s+e[13],i[14]=l*n+h*r+m*s+e[14],i[15]=c*n+f*r+p*s+e[15]),i}function d_(i,e,t){let n=t[0],r=t[1],s=t[2];return i[0]=e[0]*n,i[1]=e[1]*n,i[2]=e[2]*n,i[3]=e[3]*n,i[4]=e[4]*r,i[5]=e[5]*r,i[6]=e[6]*r,i[7]=e[7]*r,i[8]=e[8]*s,i[9]=e[9]*s,i[10]=e[10]*s,i[11]=e[11]*s,i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15],i}function f_(i,e,t,n){let r=n[0],s=n[1],a=n[2],o=Math.hypot(r,s,a),l,c,u,d,h,f,g,_,m,p,E,v,b,R,T,A,P,S,M,F,L,C,N,V;return Math.abs(o)<a_?null:(o=1/o,r*=o,s*=o,a*=o,l=Math.sin(t),c=Math.cos(t),u=1-c,d=e[0],h=e[1],f=e[2],g=e[3],_=e[4],m=e[5],p=e[6],E=e[7],v=e[8],b=e[9],R=e[10],T=e[11],A=r*r*u+c,P=s*r*u+a*l,S=a*r*u-s*l,M=r*s*u-a*l,F=s*s*u+c,L=a*s*u+r*l,C=r*a*u+s*l,N=s*a*u-r*l,V=a*a*u+c,i[0]=d*A+_*P+v*S,i[1]=h*A+m*P+b*S,i[2]=f*A+p*P+R*S,i[3]=g*A+E*P+T*S,i[4]=d*M+_*F+v*L,i[5]=h*M+m*F+b*L,i[6]=f*M+p*F+R*L,i[7]=g*M+E*F+T*L,i[8]=d*C+_*N+v*V,i[9]=h*C+m*N+b*V,i[10]=f*C+p*N+R*V,i[11]=g*C+E*N+T*V,e!==i&&(i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15]),i)}function p_(i,e){return i[0]=e[12],i[1]=e[13],i[2]=e[14],i}function Tc(i,e){let t=e[0],n=e[1],r=e[2],s=e[4],a=e[5],o=e[6],l=e[8],c=e[9],u=e[10];return i[0]=Math.hypot(t,n,r),i[1]=Math.hypot(s,a,o),i[2]=Math.hypot(l,c,u),i}function m_(i){let e=i[0],t=i[1],n=i[2],r=i[4],s=i[5],a=i[6],o=i[8],l=i[9],c=i[10];const u=e*e+t*t+n*n,d=r*r+s*s+a*a,h=o*o+l*l+c*c;return Math.sqrt(Math.max(u,d,h))}const Dc=(function(){const i=[1,1,1];return function(e,t){let n=i;Tc(n,t);let r=1/n[0],s=1/n[1],a=1/n[2],o=t[0]*r,l=t[1]*s,c=t[2]*a,u=t[4]*r,d=t[5]*s,h=t[6]*a,f=t[8]*r,g=t[9]*s,_=t[10]*a,m=o+d+_,p=0;return m>0?(p=Math.sqrt(m+1)*2,e[3]=.25*p,e[0]=(h-g)/p,e[1]=(f-c)/p,e[2]=(l-u)/p):o>d&&o>_?(p=Math.sqrt(1+o-d-_)*2,e[3]=(h-g)/p,e[0]=.25*p,e[1]=(l+u)/p,e[2]=(f+c)/p):d>_?(p=Math.sqrt(1+d-o-_)*2,e[3]=(f-c)/p,e[0]=(l+u)/p,e[1]=.25*p,e[2]=(h+g)/p):(p=Math.sqrt(1+_-o-d)*2,e[3]=(l-u)/p,e[0]=(f+c)/p,e[1]=(h+g)/p,e[2]=.25*p),e}})();function g_(i,e,t,n){let r=Ii([i[0],i[1],i[2]]);const s=Ii([i[4],i[5],i[6]]),a=Ii([i[8],i[9],i[10]]);bc(i)<0&&(r=-r),t[0]=i[12],t[1]=i[13],t[2]=i[14];const l=i.slice(),c=1/r,u=1/s,d=1/a;l[0]*=c,l[1]*=c,l[2]*=c,l[4]*=u,l[5]*=u,l[6]*=u,l[8]*=d,l[9]*=d,l[10]*=d,Dc(e,l),n[0]=r,n[1]=s,n[2]=a}function __(i,e,t,n){const r=i,s=e[0],a=e[1],o=e[2],l=e[3],c=s+s,u=a+a,d=o+o,h=s*c,f=s*u,g=s*d,_=a*u,m=a*d,p=o*d,E=l*c,v=l*u,b=l*d,R=n[0],T=n[1],A=n[2];return r[0]=(1-(_+p))*R,r[1]=(f+b)*R,r[2]=(g-v)*R,r[3]=0,r[4]=(f-b)*T,r[5]=(1-(h+p))*T,r[6]=(m+E)*T,r[7]=0,r[8]=(g+v)*A,r[9]=(m-E)*A,r[10]=(1-(h+_))*A,r[11]=0,r[12]=t[0],r[13]=t[1],r[14]=t[2],r[15]=1,r}function x_(i,e){let t=e[0],n=e[1],r=e[2],s=e[3],a=t+t,o=n+n,l=r+r,c=t*a,u=n*a,d=n*o,h=r*a,f=r*o,g=r*l,_=s*a,m=s*o,p=s*l;return i[0]=1-d-g,i[1]=u+p,i[2]=h-m,i[3]=0,i[4]=u-p,i[5]=1-c-g,i[6]=f+_,i[7]=0,i[8]=h+m,i[9]=f-_,i[10]=1-c-d,i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i}function v_(i,e,t,n,r){let s=1/Math.tan(e/2),a=1/(n-r);return i[0]=s/t,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=s,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=(r+n)*a,i[11]=-1,i[12]=0,i[13]=0,i[14]=2*r*n*a,i[15]=0,i}function M_(i,e,t,n,r,s,a){let o=1/(e-t),l=1/(n-r),c=1/(s-a);return i[0]=-2*o,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=-2*l,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=2*c,i[11]=0,i[12]=(e+t)*o,i[13]=(r+n)*l,i[14]=(a+s)*c,i[15]=1,i}function y_(i,e,t,n){let r=e[0],s=e[1],a=e[2],o=n[0],l=n[1],c=n[2],u=r-t[0],d=s-t[1],h=a-t[2],f=u*u+d*d+h*h;f===0?h=1:(f=1/Math.sqrt(f),u*=f,d*=f,h*=f);let g=l*h-c*d,_=c*u-o*h,m=o*d-l*u;return f=g*g+_*_+m*m,f===0&&(c?o+=1e-6:l?c+=1e-6:l+=1e-6,g=l*h-c*d,_=c*u-o*h,m=o*d-l*u,f=g*g+_*_+m*m),f=1/Math.sqrt(f),g*=f,_*=f,m*=f,i[0]=g,i[1]=_,i[2]=m,i[3]=0,i[4]=d*m-h*_,i[5]=h*g-u*m,i[6]=u*_-d*g,i[7]=0,i[8]=u,i[9]=d,i[10]=h,i[11]=0,i[12]=r,i[13]=s,i[14]=a,i[15]=1,i}function xl(i,e,t){return i[0]=e[0]+t[0],i[1]=e[1]+t[1],i[2]=e[2]+t[2],i[3]=e[3]+t[3],i[4]=e[4]+t[4],i[5]=e[5]+t[5],i[6]=e[6]+t[6],i[7]=e[7]+t[7],i[8]=e[8]+t[8],i[9]=e[9]+t[9],i[10]=e[10]+t[10],i[11]=e[11]+t[11],i[12]=e[12]+t[12],i[13]=e[13]+t[13],i[14]=e[14]+t[14],i[15]=e[15]+t[15],i}function vl(i,e,t){return i[0]=e[0]-t[0],i[1]=e[1]-t[1],i[2]=e[2]-t[2],i[3]=e[3]-t[3],i[4]=e[4]-t[4],i[5]=e[5]-t[5],i[6]=e[6]-t[6],i[7]=e[7]-t[7],i[8]=e[8]-t[8],i[9]=e[9]-t[9],i[10]=e[10]-t[10],i[11]=e[11]-t[11],i[12]=e[12]-t[12],i[13]=e[13]-t[13],i[14]=e[14]-t[14],i[15]=e[15]-t[15],i}function S_(i,e,t){return i[0]=e[0]*t,i[1]=e[1]*t,i[2]=e[2]*t,i[3]=e[3]*t,i[4]=e[4]*t,i[5]=e[5]*t,i[6]=e[6]*t,i[7]=e[7]*t,i[8]=e[8]*t,i[9]=e[9]*t,i[10]=e[10]*t,i[11]=e[11]*t,i[12]=e[12]*t,i[13]=e[13]*t,i[14]=e[14]*t,i[15]=e[15]*t,i}class Ir extends Array{constructor(e=1,t=0,n=0,r=0,s=0,a=1,o=0,l=0,c=0,u=0,d=1,h=0,f=0,g=0,_=0,m=1){return super(e,t,n,r,s,a,o,l,c,u,d,h,f,g,_,m),this}get x(){return this[12]}get y(){return this[13]}get z(){return this[14]}get w(){return this[15]}set x(e){this[12]=e}set y(e){this[13]=e}set z(e){this[14]=e}set w(e){this[15]=e}set(e,t,n,r,s,a,o,l,c,u,d,h,f,g,_,m){return e.length?this.copy(e):(l_(this,e,t,n,r,s,a,o,l,c,u,d,h,f,g,_,m),this)}translate(e,t=this){return h_(this,t,e),this}rotate(e,t,n=this){return f_(this,n,e,t),this}scale(e,t=this){return d_(this,t,typeof e=="number"?[e,e,e]:e),this}add(e,t){return t?xl(this,e,t):xl(this,this,e),this}sub(e,t){return t?vl(this,e,t):vl(this,this,e),this}multiply(e,t){return e.length?t?_l(this,e,t):_l(this,this,e):S_(this,this,e),this}identity(){return c_(this),this}copy(e){return o_(this,e),this}fromPerspective({fov:e,aspect:t,near:n,far:r}={}){return v_(this,e,t,n,r),this}fromOrthogonal({left:e,right:t,bottom:n,top:r,near:s,far:a}){return M_(this,e,t,n,r,s,a),this}fromQuaternion(e){return x_(this,e),this}setPosition(e){return this.x=e[0],this.y=e[1],this.z=e[2],this}inverse(e=this){return u_(this,e),this}compose(e,t,n){return __(this,e,t,n),this}decompose(e,t,n){return g_(this,e,t,n),this}getRotation(e){return Dc(e,this),this}getTranslation(e){return p_(e,this),this}getScaling(e){return Tc(e,this),this}getMaxScaleOnAxis(){return m_(this)}lookAt(e,t,n){return y_(this,e,t,n),this}determinant(){return bc(this)}fromArray(e,t=0){return this[0]=e[t],this[1]=e[t+1],this[2]=e[t+2],this[3]=e[t+3],this[4]=e[t+4],this[5]=e[t+5],this[6]=e[t+6],this[7]=e[t+7],this[8]=e[t+8],this[9]=e[t+9],this[10]=e[t+10],this[11]=e[t+11],this[12]=e[t+12],this[13]=e[t+13],this[14]=e[t+14],this[15]=e[t+15],this}toArray(e=[],t=0){return e[t]=this[0],e[t+1]=this[1],e[t+2]=this[2],e[t+3]=this[3],e[t+4]=this[4],e[t+5]=this[5],e[t+6]=this[6],e[t+7]=this[7],e[t+8]=this[8],e[t+9]=this[9],e[t+10]=this[10],e[t+11]=this[11],e[t+12]=this[12],e[t+13]=this[13],e[t+14]=this[14],e[t+15]=this[15],e}}function E_(i,e,t="YXZ"){return t==="XYZ"?(i[1]=Math.asin(Math.min(Math.max(e[8],-1),1)),Math.abs(e[8])<.99999?(i[0]=Math.atan2(-e[9],e[10]),i[2]=Math.atan2(-e[4],e[0])):(i[0]=Math.atan2(e[6],e[5]),i[2]=0)):t==="YXZ"?(i[0]=Math.asin(-Math.min(Math.max(e[9],-1),1)),Math.abs(e[9])<.99999?(i[1]=Math.atan2(e[8],e[10]),i[2]=Math.atan2(e[1],e[5])):(i[1]=Math.atan2(-e[2],e[0]),i[2]=0)):t==="ZXY"?(i[0]=Math.asin(Math.min(Math.max(e[6],-1),1)),Math.abs(e[6])<.99999?(i[1]=Math.atan2(-e[2],e[10]),i[2]=Math.atan2(-e[4],e[5])):(i[1]=0,i[2]=Math.atan2(e[1],e[0]))):t==="ZYX"?(i[1]=Math.asin(-Math.min(Math.max(e[2],-1),1)),Math.abs(e[2])<.99999?(i[0]=Math.atan2(e[6],e[10]),i[2]=Math.atan2(e[1],e[0])):(i[0]=0,i[2]=Math.atan2(-e[4],e[5]))):t==="YZX"?(i[2]=Math.asin(Math.min(Math.max(e[1],-1),1)),Math.abs(e[1])<.99999?(i[0]=Math.atan2(-e[9],e[5]),i[1]=Math.atan2(-e[2],e[0])):(i[0]=0,i[1]=Math.atan2(e[8],e[10]))):t==="XZY"&&(i[2]=Math.asin(-Math.min(Math.max(e[4],-1),1)),Math.abs(e[4])<.99999?(i[0]=Math.atan2(e[6],e[5]),i[1]=Math.atan2(e[8],e[0])):(i[0]=Math.atan2(-e[9],e[10]),i[1]=0)),i}const Ml=new Ir;class b_ extends Array{constructor(e=0,t=e,n=e,r="YXZ"){super(e,t,n),this.order=r,this.onChange=()=>{},this._target=this;const s=["0","1","2"];return new Proxy(this,{set(a,o){const l=Reflect.set(...arguments);return l&&s.includes(o)&&a.onChange(),l}})}get x(){return this[0]}get y(){return this[1]}get z(){return this[2]}set x(e){this._target[0]=e,this.onChange()}set y(e){this._target[1]=e,this.onChange()}set z(e){this._target[2]=e,this.onChange()}set(e,t=e,n=e){return e.length?this.copy(e):(this._target[0]=e,this._target[1]=t,this._target[2]=n,this.onChange(),this)}copy(e){return this._target[0]=e[0],this._target[1]=e[1],this._target[2]=e[2],this.onChange(),this}reorder(e){return this._target.order=e,this.onChange(),this}fromRotationMatrix(e,t=this.order){return E_(this._target,e,t),this.onChange(),this}fromQuaternion(e,t=this.order,n){return Ml.fromQuaternion(e),this._target.fromRotationMatrix(Ml,t),n||this.onChange(),this}fromArray(e,t=0){return this._target[0]=e[t],this._target[1]=e[t+1],this._target[2]=e[t+2],this}toArray(e=[],t=0){return e[t]=this[0],e[t+1]=this[1],e[t+2]=this[2],e}}class T_{constructor(){this.parent=null,this.children=[],this.visible=!0,this.matrix=new Ir,this.worldMatrix=new Ir,this.matrixAutoUpdate=!0,this.worldMatrixNeedsUpdate=!1,this.position=new kt,this.quaternion=new s_,this.scale=new kt(1),this.rotation=new b_,this.up=new kt(0,1,0),this.rotation._target.onChange=()=>this.quaternion.fromEuler(this.rotation,!0),this.quaternion._target.onChange=()=>this.rotation.fromQuaternion(this.quaternion,void 0,!0)}setParent(e,t=!0){this.parent&&e!==this.parent&&this.parent.removeChild(this,!1),this.parent=e,t&&e&&e.addChild(this,!1)}addChild(e,t=!0){~this.children.indexOf(e)||this.children.push(e),t&&e.setParent(this,!1)}removeChild(e,t=!0){~this.children.indexOf(e)&&this.children.splice(this.children.indexOf(e),1),t&&e.setParent(null,!1)}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.worldMatrixNeedsUpdate||e)&&(this.parent===null?this.worldMatrix.copy(this.matrix):this.worldMatrix.multiply(this.parent.worldMatrix,this.matrix),this.worldMatrixNeedsUpdate=!1,e=!0);for(let t=0,n=this.children.length;t<n;t++)this.children[t].updateMatrixWorld(e)}updateMatrix(){this.matrix.compose(this.quaternion,this.position,this.scale),this.worldMatrixNeedsUpdate=!0}traverse(e){if(!e(this))for(let t=0,n=this.children.length;t<n;t++)this.children[t].traverse(e)}decompose(){this.matrix.decompose(this.quaternion._target,this.position,this.scale),this.rotation.fromQuaternion(this.quaternion)}lookAt(e,t=!1){t?this.matrix.lookAt(this.position,e,this.up):this.matrix.lookAt(e,this.position,this.up),this.matrix.getRotation(this.quaternion._target),this.rotation.fromQuaternion(this.quaternion)}}function D_(i,e){return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[4],i[4]=e[5],i[5]=e[6],i[6]=e[8],i[7]=e[9],i[8]=e[10],i}function A_(i,e){let t=e[0],n=e[1],r=e[2],s=e[3],a=t+t,o=n+n,l=r+r,c=t*a,u=n*a,d=n*o,h=r*a,f=r*o,g=r*l,_=s*a,m=s*o,p=s*l;return i[0]=1-d-g,i[3]=u-p,i[6]=h+m,i[1]=u+p,i[4]=1-c-g,i[7]=f-_,i[2]=h-m,i[5]=f+_,i[8]=1-c-d,i}function w_(i,e){return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[4]=e[4],i[5]=e[5],i[6]=e[6],i[7]=e[7],i[8]=e[8],i}function C_(i,e,t,n,r,s,a,o,l,c){return i[0]=e,i[1]=t,i[2]=n,i[3]=r,i[4]=s,i[5]=a,i[6]=o,i[7]=l,i[8]=c,i}function R_(i){return i[0]=1,i[1]=0,i[2]=0,i[3]=0,i[4]=1,i[5]=0,i[6]=0,i[7]=0,i[8]=1,i}function P_(i,e){let t=e[0],n=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],u=e[8],d=u*a-o*c,h=-u*s+o*l,f=c*s-a*l,g=t*d+n*h+r*f;return g?(g=1/g,i[0]=d*g,i[1]=(-u*n+r*c)*g,i[2]=(o*n-r*a)*g,i[3]=h*g,i[4]=(u*t-r*l)*g,i[5]=(-o*t+r*s)*g,i[6]=f*g,i[7]=(-c*t+n*l)*g,i[8]=(a*t-n*s)*g,i):null}function yl(i,e,t){let n=e[0],r=e[1],s=e[2],a=e[3],o=e[4],l=e[5],c=e[6],u=e[7],d=e[8],h=t[0],f=t[1],g=t[2],_=t[3],m=t[4],p=t[5],E=t[6],v=t[7],b=t[8];return i[0]=h*n+f*a+g*c,i[1]=h*r+f*o+g*u,i[2]=h*s+f*l+g*d,i[3]=_*n+m*a+p*c,i[4]=_*r+m*o+p*u,i[5]=_*s+m*l+p*d,i[6]=E*n+v*a+b*c,i[7]=E*r+v*o+b*u,i[8]=E*s+v*l+b*d,i}function L_(i,e,t){let n=e[0],r=e[1],s=e[2],a=e[3],o=e[4],l=e[5],c=e[6],u=e[7],d=e[8],h=t[0],f=t[1];return i[0]=n,i[1]=r,i[2]=s,i[3]=a,i[4]=o,i[5]=l,i[6]=h*n+f*a+c,i[7]=h*r+f*o+u,i[8]=h*s+f*l+d,i}function F_(i,e,t){let n=e[0],r=e[1],s=e[2],a=e[3],o=e[4],l=e[5],c=e[6],u=e[7],d=e[8],h=Math.sin(t),f=Math.cos(t);return i[0]=f*n+h*a,i[1]=f*r+h*o,i[2]=f*s+h*l,i[3]=f*a-h*n,i[4]=f*o-h*r,i[5]=f*l-h*s,i[6]=c,i[7]=u,i[8]=d,i}function I_(i,e,t){let n=t[0],r=t[1];return i[0]=n*e[0],i[1]=n*e[1],i[2]=n*e[2],i[3]=r*e[3],i[4]=r*e[4],i[5]=r*e[5],i[6]=e[6],i[7]=e[7],i[8]=e[8],i}function N_(i,e){let t=e[0],n=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],u=e[8],d=e[9],h=e[10],f=e[11],g=e[12],_=e[13],m=e[14],p=e[15],E=t*o-n*a,v=t*l-r*a,b=t*c-s*a,R=n*l-r*o,T=n*c-s*o,A=r*c-s*l,P=u*_-d*g,S=u*m-h*g,M=u*p-f*g,F=d*m-h*_,L=d*p-f*_,C=h*p-f*m,N=E*C-v*L+b*F+R*M-T*S+A*P;return N?(N=1/N,i[0]=(o*C-l*L+c*F)*N,i[1]=(l*M-a*C-c*S)*N,i[2]=(a*L-o*M+c*P)*N,i[3]=(r*L-n*C-s*F)*N,i[4]=(t*C-r*M+s*S)*N,i[5]=(n*M-t*L-s*P)*N,i[6]=(_*A-m*T+p*R)*N,i[7]=(m*b-g*A-p*v)*N,i[8]=(g*T-_*b+p*E)*N,i):null}class U_ extends Array{constructor(e=1,t=0,n=0,r=0,s=1,a=0,o=0,l=0,c=1){return super(e,t,n,r,s,a,o,l,c),this}set(e,t,n,r,s,a,o,l,c){return e.length?this.copy(e):(C_(this,e,t,n,r,s,a,o,l,c),this)}translate(e,t=this){return L_(this,t,e),this}rotate(e,t=this){return F_(this,t,e),this}scale(e,t=this){return I_(this,t,e),this}multiply(e,t){return t?yl(this,e,t):yl(this,this,e),this}identity(){return R_(this),this}copy(e){return w_(this,e),this}fromMatrix4(e){return D_(this,e),this}fromQuaternion(e){return A_(this,e),this}fromBasis(e,t,n){return this.set(e[0],e[1],e[2],t[0],t[1],t[2],n[0],n[1],n[2]),this}inverse(e=this){return P_(this,e),this}getNormalMatrix(e){return N_(this,e),this}}let O_=0;class B_ extends T_{constructor(e,{geometry:t,program:n,mode:r=e.TRIANGLES,frustumCulled:s=!0,renderOrder:a=0}={}){super(),e.canvas||console.error("gl not passed as first argument to Mesh"),this.gl=e,this.id=O_++,this.geometry=t,this.program=n,this.mode=r,this.frustumCulled=s,this.renderOrder=a,this.modelViewMatrix=new Ir,this.normalMatrix=new U_,this.beforeRenderCallbacks=[],this.afterRenderCallbacks=[]}onBeforeRender(e){return this.beforeRenderCallbacks.push(e),this}onAfterRender(e){return this.afterRenderCallbacks.push(e),this}draw({camera:e}={}){e&&(this.program.uniforms.modelMatrix||Object.assign(this.program.uniforms,{modelMatrix:{value:null},viewMatrix:{value:null},modelViewMatrix:{value:null},normalMatrix:{value:null},projectionMatrix:{value:null},cameraPosition:{value:null}}),this.program.uniforms.projectionMatrix.value=e.projectionMatrix,this.program.uniforms.cameraPosition.value=e.worldPosition,this.program.uniforms.viewMatrix.value=e.viewMatrix,this.modelViewMatrix.multiply(e.viewMatrix,this.worldMatrix),this.normalMatrix.getNormalMatrix(this.modelViewMatrix),this.program.uniforms.modelMatrix.value=this.worldMatrix,this.program.uniforms.modelViewMatrix.value=this.modelViewMatrix,this.program.uniforms.normalMatrix.value=this.normalMatrix),this.beforeRenderCallbacks.forEach(n=>n&&n({mesh:this,camera:e}));let t=this.program.cullFace&&this.worldMatrix.determinant()<0;this.program.use({flipFaces:t}),this.geometry.draw({mode:this.mode,program:this.program}),this.afterRenderCallbacks.forEach(n=>n&&n({mesh:this,camera:e}))}}const Sl={black:"#000000",white:"#ffffff",red:"#ff0000",green:"#00ff00",blue:"#0000ff",fuchsia:"#ff00ff",cyan:"#00ffff",yellow:"#ffff00",orange:"#ff8000"};function El(i){i.length===4&&(i=i[0]+i[1]+i[1]+i[2]+i[2]+i[3]+i[3]);const e=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(i);return e||console.warn(`Unable to convert hex string ${i} to rgb values`),[parseInt(e[1],16)/255,parseInt(e[2],16)/255,parseInt(e[3],16)/255]}function z_(i){return i=parseInt(i),[(i>>16&255)/255,(i>>8&255)/255,(i&255)/255]}function bl(i){return i===void 0?[0,0,0]:arguments.length===3?arguments:isNaN(i)?i[0]==="#"?El(i):Sl[i.toLowerCase()]?El(Sl[i.toLowerCase()]):(console.warn("Color format not recognised"),[0,0,0]):z_(i)}class Tl extends Array{constructor(e){return Array.isArray(e)?super(...e):super(...bl(...arguments))}get r(){return this[0]}get g(){return this[1]}get b(){return this[2]}set r(e){this[0]=e}set g(e){this[1]=e}set b(e){this[2]=e}set(e){return Array.isArray(e)?this.copy(e):this.copy(bl(...arguments))}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this}}class k_ extends Fg{constructor(e,{attributes:t={}}={}){Object.assign(t,{position:{size:2,data:new Float32Array([-1,-1,3,-1,-1,3])},uv:{size:2,data:new Float32Array([0,0,2,0,0,2])}}),super(e,t)}}const V_=`#version 300 es
4521
4521
  in vec2 position;
4522
4522
  void main() {
4523
4523
  gl_Position = vec4(position, 0.0, 1.0);
4524
4524
  }
4525
- `,V_=`#version 300 es
4525
+ `,H_=`#version 300 es
4526
4526
  precision highp float;
4527
4527
 
4528
4528
  uniform float uTime;
@@ -4607,7 +4607,7 @@ void main() {
4607
4607
 
4608
4608
  fragColor = vec4(auroraColor * auroraAlpha, auroraAlpha);
4609
4609
  }
4610
- `,G_=({colorStops:i=["#5227FF","#7cff67","#5227FF"],amplitude:e=1,blend:t=.5,speed:n=1,className:r=""})=>{const s=de.useRef({colorStops:i,amplitude:e,blend:t,speed:n});s.current={colorStops:i,amplitude:e,blend:t,speed:n};const a=de.useRef(null);return de.useEffect(()=>{const o=a.current;if(!o)return;const l=new kg({alpha:!0,premultipliedAlpha:!0,antialias:!0}),c=l.gl;c.clearColor(0,0,0,0),c.enable(c.BLEND),c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA),c.canvas.style.backgroundColor="transparent";let u;function d(){if(!o)return;const p=o.offsetWidth,E=o.offsetHeight;l.setSize(p,E),u&&(u.uniforms.uResolution.value=[p,E])}window.addEventListener("resize",d);const h=new k_(c);h.attributes.uv&&delete h.attributes.uv;const f=i.map(p=>{const E=new Tl(p);return[E.r,E.g,E.b]});u=new Ug(c,{vertex:H_,fragment:V_,uniforms:{uTime:{value:0},uAmplitude:{value:e},uColorStops:{value:f},uResolution:{value:[o.offsetWidth,o.offsetHeight]},uBlend:{value:t}}});const g=new B_(c,{geometry:h,program:u});o.appendChild(c.canvas);let _=0;const m=p=>{_=requestAnimationFrame(m);const{speed:E=1,amplitude:v,blend:b,colorStops:R}=s.current;u.uniforms.uTime.value=p*.001*E*.1,u.uniforms.uAmplitude.value=v??1,u.uniforms.uBlend.value=b??.5;const T=R??i;u.uniforms.uColorStops.value=T.map(A=>{const P=new Tl(A);return[P.r,P.g,P.b]}),l.render({scene:g})};return _=requestAnimationFrame(m),d(),()=>{cancelAnimationFrame(_),window.removeEventListener("resize",d),o&&c.canvas.parentNode===o&&o.removeChild(c.canvas),c.getExtension("WEBGL_lose_context")?.loseContext()}},[]),oe.jsx("div",{ref:a,className:`w-full h-full ${r}`})},W_=`
4610
+ `,G_=({colorStops:i=["#5227FF","#7cff67","#5227FF"],amplitude:e=1,blend:t=.5,speed:n=1,className:r=""})=>{const s=de.useRef({colorStops:i,amplitude:e,blend:t,speed:n});s.current={colorStops:i,amplitude:e,blend:t,speed:n};const a=de.useRef(null);return de.useEffect(()=>{const o=a.current;if(!o)return;const l=new kg({alpha:!0,premultipliedAlpha:!0,antialias:!0}),c=l.gl;c.clearColor(0,0,0,0),c.enable(c.BLEND),c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA),c.canvas.style.backgroundColor="transparent";let u;function d(){if(!o)return;const p=o.offsetWidth,E=o.offsetHeight;l.setSize(p,E),u&&(u.uniforms.uResolution.value=[p,E])}window.addEventListener("resize",d);const h=new k_(c);h.attributes.uv&&delete h.attributes.uv;const f=i.map(p=>{const E=new Tl(p);return[E.r,E.g,E.b]});u=new Ng(c,{vertex:V_,fragment:H_,uniforms:{uTime:{value:0},uAmplitude:{value:e},uColorStops:{value:f},uResolution:{value:[o.offsetWidth,o.offsetHeight]},uBlend:{value:t}}});const g=new B_(c,{geometry:h,program:u});o.appendChild(c.canvas);let _=0;const m=p=>{_=requestAnimationFrame(m);const{speed:E=1,amplitude:v,blend:b,colorStops:R}=s.current;u.uniforms.uTime.value=p*.001*E*.1,u.uniforms.uAmplitude.value=v??1,u.uniforms.uBlend.value=b??.5;const T=R??i;u.uniforms.uColorStops.value=T.map(A=>{const P=new Tl(A);return[P.r,P.g,P.b]}),l.render({scene:g})};return _=requestAnimationFrame(m),d(),()=>{cancelAnimationFrame(_),window.removeEventListener("resize",d),o&&c.canvas.parentNode===o&&o.removeChild(c.canvas),c.getExtension("WEBGL_lose_context")?.loseContext()}},[]),se.jsx("div",{ref:a,className:`w-full h-full ${r}`})},W_=`
4611
4611
  attribute vec2 position;
4612
4612
  void main() {
4613
4613
  gl_Position = vec4(position, 0.0, 1.0);
@@ -4622,34 +4622,90 @@ uniform int uColorCount;
4622
4622
  uniform float uSpeed;
4623
4623
  uniform bool uWireframe;
4624
4624
 
4625
- // Hash function for pseudo-random
4626
- float hash(vec2 p) {
4627
- return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453123);
4625
+ // 经典 Perlin 噪声
4626
+ vec3 mod289(vec3 x) {
4627
+ return x - floor(x * (1.0 / 289.0)) * 289.0;
4628
4628
  }
4629
4629
 
4630
- // Smooth noise
4631
- float noise(vec2 p) {
4632
- vec2 i = floor(p);
4633
- vec2 f = fract(p);
4634
- f = f * f * (3.0 - 2.0 * f);
4635
-
4636
- float a = hash(i);
4637
- float b = hash(i + vec2(1.0, 0.0));
4638
- float c = hash(i + vec2(0.0, 1.0));
4639
- float d = hash(i + vec2(1.0, 1.0));
4640
-
4641
- return mix(mix(a, b, f.x), mix(c, d, f.x), f.y);
4630
+ vec4 mod289(vec4 x) {
4631
+ return x - floor(x * (1.0 / 289.0)) * 289.0;
4632
+ }
4633
+
4634
+ vec4 permute(vec4 x) {
4635
+ return mod289(((x*34.0)+1.0)*x);
4642
4636
  }
4643
4637
 
4644
- // Fractal Brownian Motion
4645
- float fbm(vec2 p) {
4638
+ vec4 taylorInvSqrt(vec4 r) {
4639
+ return 1.79284291400159 - 0.85373472095314 * r;
4640
+ }
4641
+
4642
+ float snoise(vec3 v) {
4643
+ const vec2 C = vec2(1.0/6.0, 1.0/3.0);
4644
+ const vec4 D = vec4(0.0, 0.5, 1.0, 2.0);
4645
+
4646
+ vec3 i = floor(v + dot(v, C.yyy));
4647
+ vec3 x0 = v - i + dot(i, C.xxx);
4648
+
4649
+ vec3 g = step(x0.yzx, x0.xyz);
4650
+ vec3 l = 1.0 - g;
4651
+ vec3 i1 = min(g.xyz, l.zxy);
4652
+ vec3 i2 = max(g.xyz, l.zxy);
4653
+
4654
+ vec3 x1 = x0 - i1 + C.xxx;
4655
+ vec3 x2 = x0 - i2 + C.yyy;
4656
+ vec3 x3 = x0 - D.yyy;
4657
+
4658
+ i = mod289(i);
4659
+ vec4 p = permute(permute(permute(
4660
+ i.z + vec4(0.0, i1.z, i2.z, 1.0))
4661
+ + i.y + vec4(0.0, i1.y, i2.y, 1.0))
4662
+ + i.x + vec4(0.0, i1.x, i2.x, 1.0));
4663
+
4664
+ float n_ = 0.142857142857;
4665
+ vec3 ns = n_ * D.wyz - D.xzx;
4666
+
4667
+ vec4 j = p - 49.0 * floor(p * ns.z * ns.z);
4668
+
4669
+ vec4 x_ = floor(j * ns.z);
4670
+ vec4 y_ = floor(j - 7.0 * x_);
4671
+
4672
+ vec4 x = x_ *ns.x + ns.yyyy;
4673
+ vec4 y = y_ *ns.x + ns.yyyy;
4674
+ vec4 h = 1.0 - abs(x) - abs(y);
4675
+
4676
+ vec4 b0 = vec4(x.xy, y.xy);
4677
+ vec4 b1 = vec4(x.zw, y.zw);
4678
+
4679
+ vec4 s0 = floor(b0)*2.0 + 1.0;
4680
+ vec4 s1 = floor(b1)*2.0 + 1.0;
4681
+ vec4 sh = -step(h, vec4(0.0));
4682
+
4683
+ vec4 a0 = b0.xzyw + s0.xzyw*sh.xxyy;
4684
+ vec4 a1 = b1.xzyw + s1.xzyw*sh.zzww;
4685
+
4686
+ vec3 p0 = vec3(a0.xy,h.x);
4687
+ vec3 p1 = vec3(a0.zw,h.y);
4688
+ vec3 p2 = vec3(a1.xy,h.z);
4689
+ vec3 p3 = vec3(a1.zw,h.w);
4690
+
4691
+ vec4 norm = taylorInvSqrt(vec4(dot(p0,p0), dot(p1,p1), dot(p2, p2), dot(p3,p3)));
4692
+ p0 *= norm.x;
4693
+ p1 *= norm.y;
4694
+ p2 *= norm.z;
4695
+ p3 *= norm.w;
4696
+
4697
+ vec4 m = max(0.6 - vec4(dot(x0,x0), dot(x1,x1), dot(x2,x2), dot(x3,x3)), 0.0);
4698
+ m = m * m;
4699
+ return 42.0 * dot(m*m, vec4(dot(p0,x0), dot(p1,x1), dot(p2,x2), dot(p3,x3)));
4700
+ }
4701
+
4702
+ // FBM 分形布朗运动
4703
+ float fbm(vec3 p) {
4646
4704
  float value = 0.0;
4647
4705
  float amplitude = 0.5;
4648
- float frequency = 1.0;
4649
-
4650
- for(int i = 0; i < 3; i++) {
4651
- value += amplitude * noise(p * frequency);
4652
- frequency *= 1.8;
4706
+ for(int i = 0; i < 4; i++) {
4707
+ value += amplitude * snoise(p);
4708
+ p *= 2.0;
4653
4709
  amplitude *= 0.5;
4654
4710
  }
4655
4711
  return value;
@@ -4657,51 +4713,236 @@ float fbm(vec2 p) {
4657
4713
 
4658
4714
  void main() {
4659
4715
  vec2 uv = gl_FragCoord.xy / uResolution;
4716
+ float t = uTime * uSpeed;
4660
4717
 
4661
- // Animate the noise - 降低缩放让渐变更大
4662
- vec2 p = uv * 1.5;
4663
- float t = uTime * uSpeed * 0.1;
4664
-
4665
- p += vec2(fbm(p + t), fbm(p - t)) * 0.5;
4718
+ // 创建流动的网格渐变
4719
+ vec3 p = vec3(uv * 3.0, t * 0.1);
4720
+ float n = fbm(p);
4721
+ n = n * 0.5 + 0.5;
4666
4722
 
4667
- // Multiple noise layers for complexity - 调整频率让过渡更平滑
4668
- float n1 = fbm(p + t * 0.5);
4669
- float n2 = fbm(p * 1.2 - t * 0.3);
4670
- float n3 = fbm(p * 0.9 + t * 0.7);
4671
-
4672
- // Combine noise layers
4673
- float pattern = (n1 + n2 + n3) / 3.0;
4674
-
4675
- // Map pattern to color gradient
4723
+ // 颜色插值
4676
4724
  vec3 color = vec3(0.0);
4677
4725
 
4678
4726
  if (uColorCount >= 2) {
4679
- float step = 1.0 / float(uColorCount - 1);
4680
- for(int i = 0; i < 4; i++) {
4681
- if (i >= uColorCount - 1) break;
4682
-
4683
- float pos1 = float(i) * step;
4684
- float pos2 = float(i + 1) * step;
4685
-
4686
- if (pattern >= pos1 && pattern <= pos2) {
4687
- float t = (pattern - pos1) / (pos2 - pos1);
4688
- color = mix(uColors[i], uColors[i + 1], t);
4689
- break;
4690
- }
4727
+ float normalized = n * float(uColorCount - 1);
4728
+ float indexFloat = floor(normalized);
4729
+ float blend = fract(normalized);
4730
+ indexFloat = min(indexFloat, float(uColorCount - 2));
4731
+
4732
+ vec3 c1, c2;
4733
+ if (indexFloat < 0.5) {
4734
+ c1 = uColors[0]; c2 = uColors[1];
4735
+ } else if (indexFloat < 1.5) {
4736
+ c1 = uColors[1]; c2 = uColors[2];
4737
+ } else if (indexFloat < 2.5) {
4738
+ c1 = uColors[2]; c2 = uColors[3];
4739
+ } else if (indexFloat < 3.5) {
4740
+ c1 = uColors[3]; c2 = uColors[4];
4741
+ } else {
4742
+ c1 = uColors[0]; c2 = uColors[1];
4691
4743
  }
4744
+
4745
+ blend = blend * blend * (3.0 - 2.0 * blend);
4746
+ color = mix(c1, c2, blend);
4692
4747
  } else if (uColorCount == 1) {
4693
4748
  color = uColors[0];
4694
4749
  }
4695
4750
 
4696
- // Wireframe effect - 降低网格密度
4751
+ // 线框模式
4697
4752
  if (uWireframe) {
4698
- float grid = 0.5 + 0.5 * sin(uv.x * 30.0 + t) * sin(uv.y * 30.0 + t);
4699
- vec2 gridPos = fract(uv * 12.0 + vec2(t * 0.1, t * 0.05));
4700
- float gridLine = step(0.92, max(gridPos.x, gridPos.y)) * grid;
4753
+ vec2 grid = abs(fract(uv * 12.0 - 0.5) - 0.5);
4754
+ float gridLine = 1.0 - min(min(grid.x, grid.y) * 15.0, 1.0);
4755
+ gridLine *= 0.4;
4701
4756
  color = mix(color * 0.3, color, gridLine);
4702
4757
  }
4703
4758
 
4704
4759
  gl_FragColor = vec4(color, 1.0);
4705
4760
  }
4706
- `,q_=({colors:i=["#e0d7ff","#bae6fd","#7dd3fc","#f5d0fe","#e879f9"],speed:e=.3,backgroundColor:t="#f8f9ff",wireframe:n=!1,className:r=""})=>{const s=de.useRef(null),a=de.useRef({colors:i,speed:e,wireframe:n});return a.current={colors:i,speed:e,wireframe:n},de.useEffect(()=>{const o=s.current;if(!o)return;const l=o.getContext("webgl",{alpha:!0,premultipliedAlpha:!1,antialias:!0});if(!l){console.error("WebGL not supported");return}function c(F,L){const C=l.createShader(F);return l.shaderSource(C,L),l.compileShader(C),l.getShaderParameter(C,l.COMPILE_STATUS)?C:(console.error("Shader compile error:",l.getShaderInfoLog(C)),l.deleteShader(C),null)}const u=c(l.VERTEX_SHADER,W_),d=c(l.FRAGMENT_SHADER,X_),h=l.createProgram();if(l.attachShader(h,u),l.attachShader(h,d),l.linkProgram(h),!l.getProgramParameter(h,l.LINK_STATUS)){console.error("Program link error:",l.getProgramInfoLog(h));return}l.useProgram(h);const f=new Float32Array([-1,-1,1,-1,-1,1,1,1]),g=l.createBuffer();l.bindBuffer(l.ARRAY_BUFFER,g),l.bufferData(l.ARRAY_BUFFER,f,l.STATIC_DRAW);const _=l.getAttribLocation(h,"position");l.enableVertexAttribArray(_),l.vertexAttribPointer(_,2,l.FLOAT,!1,0,0);const m=l.getUniformLocation(h,"uTime"),p=l.getUniformLocation(h,"uResolution"),E=l.getUniformLocation(h,"uColors"),v=l.getUniformLocation(h,"uColorCount"),b=l.getUniformLocation(h,"uSpeed"),R=l.getUniformLocation(h,"uWireframe");function T(F){const L=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(F);return L?[parseInt(L[1],16)/255,parseInt(L[2],16)/255,parseInt(L[3],16)/255]:[0,0,0]}function A(){const F=o.clientWidth,L=o.clientHeight;(o.width!==F||o.height!==L)&&(o.width=F,o.height=L,l.viewport(0,0,F,L))}let P;function y(F){P=requestAnimationFrame(y),A();const{colors:L,speed:C,wireframe:U}=a.current,H=[],Y=Math.min(L.length,5);for(let J=0;J<5;J++)if(J<L.length){const z=T(L[J]);H.push(...z)}else H.push(0,0,0);l.uniform1f(m,F*.001),l.uniform2f(p,o.width,o.height),l.uniform3fv(E,H),l.uniform1i(v,Y),l.uniform1f(b,C),l.uniform1i(R,U?1:0),l.drawArrays(l.TRIANGLE_STRIP,0,4)}A(),P=requestAnimationFrame(y);const M=new ResizeObserver(()=>{A()});return M.observe(o),()=>{cancelAnimationFrame(P),M.disconnect(),l.deleteProgram(h),l.deleteShader(u),l.deleteShader(d),l.deleteBuffer(g)}},[]),oe.jsx("canvas",{ref:s,className:`w-full h-full ${r}`,style:{backgroundColor:t}})};function aa(...i){return i.filter(Boolean).join(" ")}exports.Aurora=G_;exports.BlackHole=rg;exports.BlurText=Vc;exports.CircularText=Wc;exports.ElectricBorder=dg;exports.FallingPattern=nu;exports.FlowingDashedBox=tu;exports.Gallery3D=cg;exports.LiquidMetalButton=pg;exports.MeshGradient=q_;exports.MetalButton=sg;exports.PixelCard=lg;exports.ScrambledText=eu;exports.ScrollCards3D=fg;exports.ShinyText=iu;exports.SquareLoader=mg;exports.Tunnel3D=ug;exports.cn=aa;
4761
+ `,q_=({colors:i=["#e0d7ff","#bae6fd","#7dd3fc","#f5d0fe","#e879f9"],speed:e=.3,backgroundColor:t="#f8f9ff",wireframe:n=!1,className:r=""})=>{const s=de.useRef(null),a=de.useRef({colors:i,speed:e,wireframe:n});return a.current={colors:i,speed:e,wireframe:n},de.useEffect(()=>{const o=s.current;if(!o)return;const l=o.getContext("webgl",{alpha:!0,premultipliedAlpha:!1,antialias:!0});if(!l){console.error("WebGL not supported");return}function c(F,L){const C=l.createShader(F);return l.shaderSource(C,L),l.compileShader(C),l.getShaderParameter(C,l.COMPILE_STATUS)?C:(console.error("Shader compile error:",l.getShaderInfoLog(C)),l.deleteShader(C),null)}const u=c(l.VERTEX_SHADER,W_),d=c(l.FRAGMENT_SHADER,X_),h=l.createProgram();if(l.attachShader(h,u),l.attachShader(h,d),l.linkProgram(h),!l.getProgramParameter(h,l.LINK_STATUS)){console.error("Program link error:",l.getProgramInfoLog(h));return}l.useProgram(h);const f=new Float32Array([-1,-1,1,-1,-1,1,1,1]),g=l.createBuffer();l.bindBuffer(l.ARRAY_BUFFER,g),l.bufferData(l.ARRAY_BUFFER,f,l.STATIC_DRAW);const _=l.getAttribLocation(h,"position");l.enableVertexAttribArray(_),l.vertexAttribPointer(_,2,l.FLOAT,!1,0,0);const m=l.getUniformLocation(h,"uTime"),p=l.getUniformLocation(h,"uResolution"),E=l.getUniformLocation(h,"uColors"),v=l.getUniformLocation(h,"uColorCount"),b=l.getUniformLocation(h,"uSpeed"),R=l.getUniformLocation(h,"uWireframe");function T(F){const L=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(F);return L?[parseInt(L[1],16)/255,parseInt(L[2],16)/255,parseInt(L[3],16)/255]:[0,0,0]}function A(){const F=o.clientWidth,L=o.clientHeight;(o.width!==F||o.height!==L)&&(o.width=F,o.height=L,l.viewport(0,0,F,L))}let P;function S(F){P=requestAnimationFrame(S),A();const{colors:L,speed:C,wireframe:N}=a.current,V=[],j=Math.min(L.length,5);for(let J=0;J<5;J++)if(J<L.length){const z=T(L[J]);V.push(...z)}else V.push(0,0,0);l.uniform1f(m,F*.001),l.uniform2f(p,o.width,o.height),l.uniform3fv(E,V),l.uniform1i(v,j),l.uniform1f(b,C),l.uniform1i(R,N?1:0),l.drawArrays(l.TRIANGLE_STRIP,0,4)}A(),P=requestAnimationFrame(S);const M=new ResizeObserver(()=>{A()});return M.observe(o),()=>{cancelAnimationFrame(P),M.disconnect(),l.deleteProgram(h),l.deleteShader(u),l.deleteShader(d),l.deleteBuffer(g)}},[]),se.jsx("canvas",{ref:s,className:`w-full h-full ${r}`,style:{backgroundColor:t}})},j_=({width:i="400px",height:e="400px",speed:t=1,backgroundColor:n="#b6a9f8",colors:r=["#c979ee","#ef788c","#eb7fc6","#6d67c8"],ringColors:s=["white","blue","magenta","violet","lightyellow"],className:a=""})=>{const o=de.useRef(null);return de.useEffect(()=>{if(CSS&&CSS.registerProperty)try{CSS.registerProperty({name:"--a",syntax:"<angle>",inherits:!0,initialValue:"0deg"}),CSS.registerProperty({name:"--l",syntax:"<number>",inherits:!0,initialValue:"0"}),CSS.registerProperty({name:"--x",syntax:"<length>",inherits:!1,initialValue:"0"}),CSS.registerProperty({name:"--y",syntax:"<length>",inherits:!1,initialValue:"0"}),CSS.registerProperty({name:"--o",syntax:"<number>",inherits:!1,initialValue:"0"}),CSS.registerProperty({name:"--value",syntax:"<angle>",inherits:!0,initialValue:"0deg"}),CSS.registerProperty({name:"--width-ratio",syntax:"<number>",inherits:!0,initialValue:"0"}),CSS.registerProperty({name:"--scale",syntax:"<number>",inherits:!0,initialValue:"0"})}catch{}},[]),de.useEffect(()=>{const l=o.current;if(!l)return;const c=()=>{const d=l.getBoundingClientRect(),h=Math.min(d.width,d.height);l.style.setProperty("--actual-size",`${h}px`)};c();const u=new ResizeObserver(c);return u.observe(l),()=>{u.disconnect()}},[i,e]),se.jsxs(se.Fragment,{children:[se.jsx("style",{children:`
4762
+ @keyframes ai {
4763
+ from {
4764
+ --a: 360deg;
4765
+ --l: 0.35;
4766
+ --o: 1;
4767
+ }
4768
+ 30% {
4769
+ --l: 1.5;
4770
+ }
4771
+ 70% {
4772
+ --o: 0.4;
4773
+ --l: 0.05;
4774
+ }
4775
+ 98% {
4776
+ --o: 0.7;
4777
+ }
4778
+ to {
4779
+ --a: 0deg;
4780
+ --l: 0.35;
4781
+ --o: 1;
4782
+ }
4783
+ }
4784
+
4785
+ @keyframes ring {
4786
+ from {
4787
+ --value: var(--start);
4788
+ --scale: 1;
4789
+ }
4790
+ 50% {
4791
+ --scale: 1.2;
4792
+ --width-ratio: 1.5;
4793
+ }
4794
+ 70% {
4795
+ --scale: 1;
4796
+ --value: calc(var(--start) + 180deg);
4797
+ --width-ratio: 1;
4798
+ }
4799
+ 80% {
4800
+ --scale: 1.2;
4801
+ --width-ratio: 1.5;
4802
+ }
4803
+ to {
4804
+ --value: calc(var(--start) + 360deg);
4805
+ --scale: 1;
4806
+ --width-ratio: 1;
4807
+ }
4808
+ }
4809
+
4810
+ .fluid-background-container {
4811
+ --container-width: ${i};
4812
+ --container-height: ${e};
4813
+ --s: var(--actual-size, min(var(--container-width), var(--container-height)));
4814
+ --p: calc(var(--s) / 4);
4815
+ --radius: calc(var(--s) * 0.25);
4816
+ --count: 4;
4817
+ --width: calc(var(--s) * 0.025);
4818
+ --duration: calc(8s / ${t});
4819
+ --ai-duration: calc(5.5s / ${t});
4820
+ width: var(--container-width);
4821
+ height: var(--container-height);
4822
+ --bg-color: color-mix(in srgb, #7b7bf4, transparent 90%);
4823
+ background: radial-gradient(
4824
+ 60% 75% at center,
4825
+ var(--bg-color) 50%,
4826
+ transparent 50%
4827
+ ),
4828
+ radial-gradient(75% 60% at center, var(--bg-color) 50%, transparent 50%);
4829
+ overflow: hidden;
4830
+ position: relative;
4831
+ }
4832
+
4833
+ .fluid-background-container .fluid-inner {
4834
+ overflow: hidden;
4835
+ background: ${n};
4836
+ width: 100%;
4837
+ height: 100%;
4838
+ position: relative;
4839
+ display: grid;
4840
+ place-items: center;
4841
+ }
4842
+
4843
+ .fluid-background-container .c {
4844
+ opacity: 0.9;
4845
+ position: absolute;
4846
+ width: calc(var(--s) * 0.4);
4847
+ aspect-ratio: 1;
4848
+ border-radius: 50%;
4849
+ --offset-per-item: calc(360deg / var(--count));
4850
+ --current-angle-offset: calc(var(--offset-per-item) * var(--i) + var(--a));
4851
+ translate: calc(
4852
+ cos(var(--current-angle-offset)) * var(--radius) + var(--x, 0)
4853
+ )
4854
+ calc(sin(var(--current-angle-offset)) * var(--radius) * -1);
4855
+ scale: calc(0.6 + var(--l));
4856
+ animation: ai var(--ai-duration) cubic-bezier(0.45, -0.35, 0.16, 1.5) infinite;
4857
+ transition: opacity 0.3s linear;
4858
+ opacity: var(--o, 1);
4859
+ }
4860
+
4861
+ .fluid-background-container .c1 {
4862
+ background: radial-gradient(50% 50% at center, ${r[0]||"#c979ee"}, color-mix(in srgb, ${r[0]||"#c979ee"}, transparent 30%));
4863
+ --x: calc(var(--s) * 0.04);
4864
+ width: calc(var(--s) * 0.6);
4865
+ animation-timing-function: cubic-bezier(0.12, 0.32, 0.68, 0.24);
4866
+ }
4867
+
4868
+ .fluid-background-container .c2 {
4869
+ background: radial-gradient(50% 50% at center, ${r[1]||"#ef788c"}, color-mix(in srgb, ${r[1]||"#ef788c"}, white 40%));
4870
+ width: calc(var(--s) * 0.55);
4871
+ }
4872
+
4873
+ .fluid-background-container .c3 {
4874
+ background: radial-gradient(50% 50% at center, ${r[2]||"#eb7fc6"}, transparent);
4875
+ width: calc(var(--s) * 0.2);
4876
+ opacity: 0.6;
4877
+ --x: calc(var(--s) * -0.04);
4878
+ }
4879
+
4880
+ .fluid-background-container .c4 {
4881
+ background: ${r[3]||"#6d67c8"};
4882
+ animation-timing-function: cubic-bezier(0.39, -0.03, 0.75, 0.47);
4883
+ }
4884
+
4885
+ .fluid-background-container .glass {
4886
+ overflow: hidden;
4887
+ position: absolute;
4888
+ inset: 0;
4889
+ backdrop-filter: blur(calc(var(--s) * 0.12));
4890
+ box-shadow: 0 0 calc(var(--s) * 0.2) color-mix(in srgb, black, transparent 70%);
4891
+ }
4892
+
4893
+ .fluid-background-container .glass::after {
4894
+ content: "";
4895
+ position: absolute;
4896
+ inset: 0;
4897
+ --c: rgba(255, 255, 255, 0.03);
4898
+ --w: 0.0625rem;
4899
+ --g: 0.1875rem;
4900
+ background: repeating-linear-gradient(
4901
+ var(--c),
4902
+ var(--c),
4903
+ var(--w),
4904
+ transparent var(--w),
4905
+ transparent calc(var(--w) + var(--g))
4906
+ );
4907
+ }
4908
+
4909
+ .fluid-background-container .rings {
4910
+ aspect-ratio: 1;
4911
+ border-radius: 50%;
4912
+ position: absolute;
4913
+ inset: 0;
4914
+ perspective: calc(var(--s) * 2.75);
4915
+ opacity: 0.9;
4916
+ }
4917
+
4918
+ .fluid-background-container .rings::before,
4919
+ .fluid-background-container .rings::after {
4920
+ content: "";
4921
+ position: absolute;
4922
+ inset: 0;
4923
+ background: rgba(255, 0, 0, 1);
4924
+ border-radius: 50%;
4925
+ --width-ratio: 1;
4926
+ border: calc(var(--width) * var(--width-ratio)) solid transparent;
4927
+ mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
4928
+ background: linear-gradient(
4929
+ ${s.join(", ")}
4930
+ ) border-box;
4931
+ mask-composite: exclude;
4932
+ animation: ring var(--duration) ease-in-out infinite;
4933
+ --start: 180deg;
4934
+ --value: var(--start);
4935
+ --scale: 1;
4936
+ transform: rotateY(var(--value)) rotateX(var(--value)) rotateZ(var(--value))
4937
+ scale(var(--scale));
4938
+ }
4939
+
4940
+ .fluid-background-container .rings::before {
4941
+ --start: 180deg;
4942
+ }
4943
+
4944
+ .fluid-background-container .rings::after {
4945
+ --start: 90deg;
4946
+ }
4947
+ `}),se.jsxs("div",{ref:o,className:Hr("fluid-background-container",a),children:[se.jsxs("div",{className:"fluid-inner",children:[se.jsx("div",{className:"c c4",style:{"--i":0}}),se.jsx("div",{className:"c c1",style:{"--i":1}}),se.jsx("div",{className:"c c2",style:{"--i":2}}),se.jsx("div",{className:"c c3",style:{"--i":3}}),se.jsx("div",{className:"rings"})]}),se.jsx("div",{className:"glass"})]})]})};function Hr(...i){return i.filter(Boolean).join(" ")}exports.Aurora=G_;exports.BlackHole=rg;exports.BlurText=Hc;exports.CircularText=Wc;exports.ElectricBorder=dg;exports.FallingPattern=nu;exports.FlowingDashedBox=tu;exports.FluidBackground=j_;exports.Gallery3D=cg;exports.LiquidMetalButton=pg;exports.MeshGradient=q_;exports.MetalButton=sg;exports.PixelCard=lg;exports.ScrambledText=eu;exports.ScrollCards3D=fg;exports.ShinyText=iu;exports.SquareLoader=mg;exports.Tunnel3D=ug;exports.cn=Hr;
4707
4948
  //# sourceMappingURL=index.cjs.map