@design-llm/motion 1.0.2 → 1.0.4
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/README.md +127 -105
- package/dist/index.cjs +190 -190
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +4134 -5435
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
- package/dist/motion.css +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var Zl=Object.create;var ta=Object.defineProperty;var Jl=Object.getOwnPropertyDescriptor;var Ql=Object.getOwnPropertyNames;var ec=Object.getPrototypeOf,tc=Object.prototype.hasOwnProperty;var nc=(i,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Ql(e))!tc.call(i,r)&&r!==t&&ta(i,r,{get:()=>e[r],enumerable:!(n=Jl(e,r))||n.enumerable});return i};var ic=(i,e,t)=>(t=i!=null?Zl(ec(i)):{},nc(e||!i||!i.__esModule?ta(t,"default",{value:i,enumerable:!0}):t,i));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const me=require("react"),Et=require("framer-motion"),Ts=require("gsap");var Gi={exports:{}},Si={};var na;function rc(){if(na)return Si;na=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 ia;function sc(){return ia||(ia=1,process.env.NODE_ENV!=="production"&&(function(){function i(F){if(F==null)return null;if(typeof F=="function")return F.$$typeof===N?null:F.displayName||F.name||null;if(typeof F=="string")return F;switch(F){case m:return"Fragment";case b:return"Profiler";case f:return"StrictMode";case T:return"Suspense";case w:return"SuspenseList";case M:return"Activity"}if(typeof F=="object")switch(typeof F.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),F.$$typeof){case v:return"Portal";case D:return F.displayName||"Context";case x:return(F._context.displayName||"Context")+".Consumer";case P:var Q=F.render;return F=F.displayName,F||(F=Q.displayName||Q.name||"",F=F!==""?"ForwardRef("+F+")":"ForwardRef"),F;case L:return Q=F.displayName||null,Q!==null?Q:i(F.type)||"Memo";case E:Q=F._payload,F=F._init;try{return i(F(Q))}catch{}}return null}function e(F){return""+F}function t(F){try{e(F);var Q=!1}catch{Q=!0}if(Q){Q=console;var pe=Q.error,U=typeof Symbol=="function"&&Symbol.toStringTag&&F[Symbol.toStringTag]||F.constructor.name||"Object";return pe.call(Q,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",U),e(F)}}function n(F){if(F===m)return"<>";if(typeof F=="object"&&F!==null&&F.$$typeof===E)return"<...>";try{var Q=i(F);return Q?"<"+Q+">":"<...>"}catch{return"<...>"}}function r(){var F=I.A;return F===null?null:F.getOwner()}function s(){return Error("react-stack-top-frame")}function a(F){if(C.call(F,"key")){var Q=Object.getOwnPropertyDescriptor(F,"key").get;if(Q&&Q.isReactWarning)return!1}return F.key!==void 0}function o(F,Q){function pe(){q||(q=!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)",Q))}pe.isReactWarning=!0,Object.defineProperty(F,"key",{get:pe,configurable:!0})}function l(){var F=i(this.type);return ee[F]||(ee[F]=!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.")),F=this.props.ref,F!==void 0?F:null}function c(F,Q,pe,U,J,le){var ne=pe.ref;return F={$$typeof:_,type:F,key:Q,props:pe,_owner:U},(ne!==void 0?ne:null)!==null?Object.defineProperty(F,"ref",{enumerable:!1,get:l}):Object.defineProperty(F,"ref",{enumerable:!1,value:null}),F._store={},Object.defineProperty(F._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(F,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(F,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:J}),Object.defineProperty(F,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:le}),Object.freeze&&(Object.freeze(F.props),Object.freeze(F)),F}function h(F,Q,pe,U,J,le){var ne=Q.children;if(ne!==void 0)if(U)if(z(ne)){for(U=0;U<ne.length;U++)d(ne[U]);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(Q,"key")){ne=i(F);var xe=Object.keys(Q).filter(function(Ce){return Ce!=="key"});U=0<xe.length?"{key: someKey, "+xe.join(": ..., ")+": ...}":"{key: someKey}",j[ne+U]||(xe=0<xe.length?"{"+xe.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} />`,N,ie,ve,ie),q[ie+N]=!0)}if(ie=null,me!==void 0&&(t(me),ie=""+me),a(ee)&&(t(ee.key),ie=""+ee.key),"key"in ee){me={};for(var De in ee)De!=="key"&&(me[De]=ee[De])}else me=ee;return ie&&o(me,typeof F=="function"?F.displayName||F.name||"Unknown":F),c(F,ie,me,r(),Q,ue)}function u(F){h(F)?F._store&&(F._store.validated=1):typeof F=="object"&&F!==null&&F.$$typeof===S&&(F._payload.status==="fulfilled"?h(F._payload.value)&&F._payload.value._store&&(F._payload.value._store.validated=1):F._store&&(F._store.validated=1))}function h(F){return typeof F=="object"&&F!==null&&F.$$typeof===_}var p=se,_=Symbol.for("react.transitional.element"),x=Symbol.for("react.portal"),m=Symbol.for("react.fragment"),f=Symbol.for("react.strict_mode"),b=Symbol.for("react.profiler"),v=Symbol.for("react.consumer"),D=Symbol.for("react.context"),P=Symbol.for("react.forward_ref"),T=Symbol.for("react.suspense"),w=Symbol.for("react.suspense_list"),L=Symbol.for("react.memo"),S=Symbol.for("react.lazy"),y=Symbol.for("react.activity"),U=Symbol.for("react.client.reference"),I=p.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,C=Object.prototype.hasOwnProperty,k=Array.isArray,G=console.createTask?console.createTask:function(){return null};p={react_stack_bottom_frame:function(F){return F()}};var $,te={},B=p.react_stack_bottom_frame.bind(p,s)(),K=G(n(s)),q={};bi.Fragment=m,bi.jsx=function(F,ee,me){var N=1e4>I.recentlyCreatedOwnerStacks++;return d(F,ee,me,!1,N?Error("react-stack-top-frame"):B,N?G(n(F)):K)},bi.jsxs=function(F,ee,me){var N=1e4>I.recentlyCreatedOwnerStacks++;return d(F,ee,me,!0,N?Error("react-stack-top-frame"):B,N?G(n(F)):K)}})()),bi}var aa;function lc(){return aa||(aa=1,process.env.NODE_ENV==="production"?Xi.exports=ac():Xi.exports=oc()),Xi.exports}var z=lc();const Pt="font-mono text-xs";function cc({field:i,value:e,onChange:t}){const{type:n,key:r,label:s,min:a,max:o,step:l,options:c,placeholder:d}=i;return n==="number"?z.jsxs("div",{className:"space-y-1",children:[z.jsxs("div",{className:"flex justify-between items-center",children:[z.jsx("label",{className:`${Pt} text-zinc-600 dark:text-zinc-400`,children:s}),z.jsx("input",{type:"number",value:e,onChange:u=>t(r,parseFloat(u.target.value)||0),className:`${Pt} w-16 px-1.5 py-0.5 bg-white dark:bg-zinc-900 text-zinc-900 dark:text-zinc-100 rounded border border-zinc-300 dark:border-zinc-700 focus:border-zinc-500 dark:focus:border-zinc-600 focus:outline-none`,min:a,max:o,step:l||1})]}),z.jsx("input",{type:"range",value:e,onChange:u=>t(r,parseFloat(u.target.value)),className:"w-full h-1 bg-zinc-200 dark:bg-zinc-900 rounded appearance-none cursor-pointer accent-zinc-500 dark:accent-zinc-600",min:a,max:o,step:l||1})]}):n==="text"?z.jsxs("div",{className:"space-y-1",children:[z.jsx("label",{className:`${Pt} text-zinc-600 dark:text-zinc-400`,children:s}),z.jsx("input",{type:"text",value:e,onChange:u=>t(r,u.target.value),className:`${Pt} w-full px-2 py-1 bg-white dark:bg-zinc-900 text-zinc-900 dark:text-zinc-100 rounded border border-zinc-300 dark:border-zinc-700 focus:border-zinc-500 dark:focus:border-zinc-600 focus:outline-none`,placeholder:d})]}):n==="select"?z.jsxs("div",{className:"space-y-1",children:[z.jsx("label",{className:`${Pt} text-zinc-600 dark:text-zinc-400`,children:s}),z.jsx("select",{value:e,onChange:u=>t(r,u.target.value),className:`${Pt} w-full px-2 py-1 bg-white dark:bg-zinc-900 text-zinc-900 dark:text-zinc-100 rounded border border-zinc-300 dark:border-zinc-700 focus:border-zinc-500 dark:focus:border-zinc-600 focus:outline-none`,children:c.map(u=>z.jsx("option",{value:u.value,children:u.label},u.value))})]}):n==="color"?z.jsxs("div",{className:"space-y-1",children:[z.jsx("label",{className:`${Pt} text-zinc-600 dark:text-zinc-400`,children:s}),z.jsxs("div",{className:"flex gap-2 items-center",children:[z.jsx("input",{type:"color",value:e,onChange:u=>t(r,u.target.value),className:"w-8 h-8 rounded cursor-pointer bg-white dark:bg-zinc-900 border border-zinc-300 dark:border-zinc-700"}),z.jsx("input",{type:"text",value:e,onChange:u=>t(r,u.target.value),className:`${Pt} flex-1 px-2 py-1 bg-white dark:bg-zinc-900 text-zinc-900 dark:text-zinc-100 rounded border border-zinc-300 dark:border-zinc-700 focus:border-zinc-500 dark:focus:border-zinc-600 focus:outline-none`,placeholder:d||"#71717a"})]})]}):n==="boolean"?z.jsxs("div",{className:"flex justify-between items-center",children:[z.jsx("label",{className:`${Pt} text-zinc-600 dark:text-zinc-400`,children:s}),z.jsx("button",{onClick:()=>t(r,!e),className:`${Pt} px-2 py-1 rounded transition-all ${e?"bg-zinc-600 dark:bg-zinc-700 text-white":"bg-zinc-100 dark:bg-zinc-800/50 text-zinc-600 dark:text-zinc-400 hover:bg-zinc-200 dark:hover:bg-zinc-700 hover:text-zinc-700 dark:hover:text-zinc-300"}`,children:e?"true":"false"})]}):n==="button-group"?z.jsxs("div",{className:"space-y-1",children:[z.jsx("label",{className:`${Pt} text-zinc-600 dark:text-zinc-400`,children:s}),z.jsx("div",{className:"flex gap-1",children:c.map(u=>z.jsx("button",{onClick:()=>t(r,u.value),className:`${Pt} px-2 py-1 rounded transition-all ${e===u.value?"bg-zinc-600 dark:bg-zinc-700 text-white":"bg-zinc-100 dark:bg-zinc-800/50 text-zinc-600 dark:text-zinc-400 hover:bg-zinc-200 dark:hover:bg-zinc-700 hover:text-zinc-700 dark:hover:text-zinc-300"}`,children:u.label},u.value))})]}):null}function Tt({config:i,onChange:e,fields:t,title:n="Parameters"}){const r=(s,a)=>{e({...i,[s]:a})};return z.jsxs("div",{className:"rounded-lg border border-zinc-200 dark:border-zinc-800 bg-zinc-50 dark:bg-zinc-800/30 p-3 space-y-3",children:[z.jsx("h4",{className:`${Pt} font-semibold text-zinc-700 dark:text-zinc-300 mb-2`,children:n}),z.jsx("div",{className:"space-y-2.5",children:t.map(s=>z.jsx(cc,{field:s,value:i[s.key],onChange:r},s.key))})]})}const uc=(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=x=>x,onAnimationComplete:d,stepDuration:u=.35,fontSize:h,fontFamily:p,color:_})=>{const x=n==="words"?i.split(" "):i.split(""),[m,f]=se.useState(!1),b=se.useRef(null);se.useEffect(()=>{if(!b.current)return;const U=new IntersectionObserver(([I])=>{I.isIntersecting&&(f(!0),U.unobserve(b.current))},{threshold:s,rootMargin:a});return U.observe(b.current),()=>U.disconnect()},[s,a]);const v=se.useMemo(()=>r==="top"?{filter:"blur(10px)",opacity:0,y:-50}:{filter:"blur(10px)",opacity:0,y:50},[r]),D=se.useMemo(()=>[{filter:"blur(5px)",opacity:.5,y:r==="top"?5:-5},{filter:"blur(0px)",opacity:1,y:0}],[r]),P=o??v,T=l??D,w=T.length+1,L=u*(w-1),S=Array.from({length:w},(U,I)=>w===1?0:I/(w-1)),y={...h&&{fontSize:h},...p&&{fontFamily:p},..._&&{color:_}};return z.jsx("p",{ref:b,className:`blur-text ${t} flex flex-wrap`,style:y,children:x.map((U,I)=>{const C=uc(P,T),k={duration:L,times:S,delay:I*e/1e3};return k.ease=c,z.jsxs(St.motion.span,{className:"inline-block will-change-[transform,filter,opacity]",initial:P,animate:m?C:P,transition:k,onAnimationComplete:I===x.length-1?d:void 0,children:[U===" "?" ":U,n==="words"&&I<x.length-1&&" "]},I)})})},dc=({onParamsChange:i})=>{const[e,t]=se.useState({text:"Alibaba Cloud SparkDesign",delay:100,animateBy:"words",direction:"top",stepDuration:.35,fontSize:"",fontFamily:"",color:""}),n=s=>{t(s),i&&i(s)};se.useEffect(()=>{i&&i(e)},[]);const r=[{type:"text",key:"text",label:"text",placeholder:"Enter text..."},{type:"number",key:"delay",label:"delay",min:0,max:1e3,step:10},{type:"button-group",key:"animateBy",label:"animateBy",options:[{value:"words",label:"words"},{value:"characters",label:"characters"}]},{type:"button-group",key:"direction",label:"direction",options:[{value:"top",label:"top"},{value:"bottom",label:"bottom"}]},{type:"number",key:"stepDuration",label:"stepDuration",min:.1,max:2,step:.1},{type:"text",key:"fontSize",label:"fontSize",placeholder:"e.g., 24px, 1.5rem, 2em"},{type:"text",key:"fontFamily",label:"fontFamily",placeholder:'e.g., Arial, "Times New Roman", sans-serif'},{type:"color",key:"color",label:"color",placeholder:"#000000"}];return z.jsxs("div",{className:"w-full space-y-6",children:[z.jsx("div",{className:"flex items-center justify-center min-h-[200px] rounded-xl border border-zinc-200 dark:border-zinc-800 bg-zinc-50 dark:bg-zinc-800/50 p-8",children:z.jsx(hc,{text:e.text,className:"text-4xl font-bold text-zinc-900 dark:text-white",delay:e.delay,animateBy:e.animateBy,direction:e.direction,stepDuration:e.stepDuration,fontSize:e.fontSize||void 0,fontFamily:e.fontFamily||void 0,color:e.color||void 0})}),z.jsx(Tt,{config:e,onChange:n,fields:r})]})},fc=(i,e,t=!0)=>({from:e,to:e+360,ease:"linear",duration:i,type:"tween",repeat:t?1/0:0}),kn=(i,e)=>({rotate:fc(i,e),scale:{type:"spring",damping:20,stiffness:300}}),pc=({text:i,spinDuration:e=20,onHover:t="speedUp",className:n="",fontSize:r,fontFamily:s,color:a})=>{const o=Array.from(i),l=St.useAnimation(),c=St.useMotionValue(0);se.useEffect(()=>{const p=c.get();l.start({rotate:p+360,scale:1,transition:kn(e,p)})},[e,i,t,l,c]);const d=()=>{const p=c.get();if(!t)return;let _,x=1;switch(t){case"slowDown":_=kn(e*2,p);break;case"speedUp":_=kn(e/4,p);break;case"pause":_={rotate:{type:"spring",damping:20,stiffness:300},scale:{type:"spring",damping:20,stiffness:300}},x=1;break;case"goBonkers":_=kn(e/20,p),x=.8;break;default:_=kn(e,p)}l.start({rotate:p+360,scale:x,transition:_})},u=()=>{const p=c.get();l.start({rotate:p+360,scale:1,transition:kn(e,p)})},h={...r&&{fontSize:r},...s&&{fontFamily:s},...a&&{color:a}};return z.jsx(St.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:d,onMouseLeave:u,children:o.map((p,_)=>{const x=360/o.length*_,m=Math.PI/o.length,f=m*_,b=m*_,v=`rotateZ(${x}deg) translate3d(${f}px, ${b}px, 0)`;return z.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:p},_)})})},mc=({onParamsChange:i})=>{const[e,t]=se.useState({text:"ALIBABA CLOUD • SPARKDESIGN • ",spinDuration:15,onHover:"speedUp",className:"",fontSize:"",fontFamily:"",color:""}),n=s=>{t(s),i&&i(s)};se.useEffect(()=>{i&&i(e)},[]);const r=[{type:"text",key:"text",label:"text",placeholder:"Enter text..."},{type:"number",key:"spinDuration",label:"spinDuration",min:1,max:60,step:1},{type:"select",key:"onHover",label:"onHover",options:[{value:"speedUp",label:"speedUp"},{value:"slowDown",label:"slowDown"},{value:"pause",label:"pause"},{value:"goBonkers",label:"goBonkers"}]},{type:"text",key:"fontSize",label:"fontSize",placeholder:"e.g., 24px, 1.5rem, 2em"},{type:"text",key:"fontFamily",label:"fontFamily",placeholder:'e.g., Arial, "Times New Roman", sans-serif'},{type:"color",key:"color",label:"color",placeholder:"#ffffff"}];return z.jsxs("div",{className:"w-full space-y-6",children:[z.jsx("div",{className:"flex items-center justify-center min-h-[300px] rounded-xl border border-zinc-200 dark:border-zinc-800 bg-zinc-50 dark:bg-zinc-800/50 p-8",children:z.jsx(pc,{text:e.text,spinDuration:e.spinDuration,onHover:e.onHover,className:e.className,fontSize:e.fontSize||void 0,fontFamily:e.fontFamily||void 0,color:e.color||void 0})}),z.jsx(Tt,{config:e,onChange:n,fields:r})]})};let Di,Hn,oa=typeof Symbol=="function"?Symbol():"_split",Cs,gc=()=>Cs||Vs.register(window.gsap),la=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],ca=i=>Ni(i).filter(e=>e instanceof HTMLElement),Rs=[],Wr=function(){},_c={add:i=>i()},xc=/\s+/g,ua=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},vc=(i,e)=>{for(;++e<i.length&&i[e]===Dr;);return i[e]||Dr},ha=({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")},da=(i,e)=>{if(e){let t=new Set(i.join("").match(e)||Rs),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},fa=i=>window.getComputedStyle(i).display==="inline"&&(i.style.display="inline-block"),Vn=(i,e,t)=>e.insertBefore(typeof i=="string"?document.createTextNode(i):i,t),Ps=(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=d=>{let u=document.createElement(r),h=t.length+1;return n&&(u.className=n+(l?" "+n+h:"")),a&&u.style.setProperty("--"+i,h+""),s!=="none"&&u.setAttribute("aria-hidden","true"),r!=="span"&&(u.style.position="relative",u.style.display=o),u.textContent=d,t.push(u),u};return l&&(n=n.replace("++","")),c.collection=t,c},yc=(i,e,t,n)=>{let r=Ps("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()}},Jo=(i,e,t,n,r,s,a,o,l,c)=>{var d;let u=Array.from(i.childNodes),h=0,{wordDelimiter:p,reduceWhiteSpace:_=!0,prepareText:x}=e,m=i.getBoundingClientRect(),f=m,b=!_&&window.getComputedStyle(i).whiteSpace.substring(0,3)==="pre",v=0,D=t.collection,P,T,w,L,S,y,U,I,C,k,G,$,te,B,K,q,F,ee;for(typeof p=="object"?(w=p.delimiter||p,T=p.replaceWith||""):T=p===""?"":p||" ",P=T!==" ";h<u.length;h++)if(L=u[h],L.nodeType===3){for(K=L.textContent||"",_?K=K.replace(xc," "):b&&(K=K.replace(/\n/g,T+`
|
|
7
|
-
`)),
|
|
8
|
-
`&&((d=L.previousSibling)==null||d.remove(),Vn(document.createElement("br"),i,L),q=q.slice(1)),!_&&q==="")Vn(T,i,L);else if(q===" ")i.insertBefore(document.createTextNode(" "),L);else{if(P&&q.charAt(0)===" "&&Vn(" ",i,L),v&&C===1&&!U&&D.indexOf(v.parentNode)>-1?(y=D[D.length-1],y.appendChild(document.createTextNode(n?"":q))):(y=t(n?"":q),Vn(y,i,L),v&&C===1&&!U&&y.insertBefore(v,y.firstChild)),n)for(G=la?da([...la.segment(q)].map(me=>me.segment),l):q.match(o)||Rs,ee=0;ee<G.length;ee++)y.appendChild(G[ee]===" "?document.createTextNode(" "):n(G[ee]));if(s&&c){if(K=L.textContent=K.substring(q.length+1,K.length),k=y.getBoundingClientRect(),k.top>f.top&&k.left<=f.left){for($=i.cloneNode(),te=i.childNodes[0];te&&te!==y;)B=te,te=te.nextSibling,$.appendChild(B);i.parentNode.insertBefore($,i),r&&fa($)}f=k}(C<S.length||I)&&Vn(C>=S.length?" ":P&&q.slice(-1)===" "?" "+T:T,i,L)}i.removeChild(L),v=0}else L.nodeType===1&&(a&&a.indexOf(L)>-1?(D.indexOf(L.previousSibling)>-1&&D[D.length-1].appendChild(L),v=L):(Jo(L,e,t,n,r,s,a,o,l,!0),v=0),r&&fa(L))};const Qo=class el{constructor(e,t){this.isSplit=!1,gc(),this.elements=ca(e),this.chars=[],this.words=[],this.lines=[],this.masks=[],this.vars=t,this.elements.forEach(a=>{var o;t.overwrite!==!1&&((o=a[oa])==null||o._data.orig.filter(({element:l})=>l===a).forEach(ha)),a[oa]=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)})},Wr(this),this.split(t)}split(e){return(this._ctx||_c).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,d=t.indexOf("lines")>-1,u=t.indexOf("chars")>-1,h=t.indexOf("words")>-1,p=u&&!h&&!d,_=l&&("push"in l?new RegExp("(?:"+l.join("|")+")","gu"):l),x=_?new RegExp(_.source+"|"+ua.source,"gu"):ua,m=!!e.ignore&&ca(e.ignore),{orig:f,animTime:b,obs:v}=this._data,D;(u||h||d)&&(this.elements.forEach((P,T)=>{f[T]={element:P,html:P.innerHTML,ariaL:P.getAttribute("aria-label"),ariaH:P.getAttribute("aria-hidden")},n==="auto"?P.setAttribute("aria-label",(P.textContent||"").trim()):n==="hidden"&&P.setAttribute("aria-hidden","true");let w=[],L=[],S=[],y=u?Ps("char",e,w):null,U=Ps("word",e,L),I,C,k,G;if(Jo(P,e,U,y,p,r&&(d||p),m,x,_,!1),d){let $=Ni(P.childNodes),te=yc(P,$,e,S),B,K=[],q=0,F=$.map(N=>N.nodeType===1?N.getBoundingClientRect():Dr),ee=Dr,me;for(I=0;I<$.length;I++)B=$[I],B.nodeType===1&&(B.nodeName==="BR"?((!I||$[I-1].nodeName!=="BR")&&(K.push(B),te(q,I+1)),q=I+1,ee=vc(F,I)):(me=F[I],I&&me.top>ee.top&&me.left<ee.left+ee.width-1&&(te(q,I),q=I),ee=me));q<I&&te(q,I),K.forEach(N=>{var Q;return(Q=N.parentNode)==null?void 0:Q.removeChild(N)})}if(!h){for(I=0;I<L.length;I++)if(C=L[I],u||!C.nextSibling||C.nextSibling.nodeType!==3)if(s&&!d){for(k=document.createElement("span"),k.style.whiteSpace="nowrap";C.firstChild;)k.appendChild(C.firstChild);C.replaceWith(k)}else C.replaceWith(...C.childNodes);else G=C.nextSibling,G&&G.nodeType===3&&(G.textContent=(C.textContent||"")+(G.textContent||""),C.remove());L.length=0,P.normalize()}this.lines.push(...S),this.words.push(...L),this.chars.push(...w)}),c&&this[c]&&this.masks.push(...this[c].map(P=>{let T=P.cloneNode();return P.replaceWith(T),T.appendChild(P),P.className&&(T.className=P.className.trim()+"-mask"),T.style.overflow="clip",T}))),this.isSplit=!0,Hn&&d&&(o?Hn.addEventListener("loadingdone",this._split):Hn.status==="loading"&&console.warn("SplitText called before fonts loaded")),(D=a&&a(this))&&D.totalTime&&(this._data.anim=b?D.totalTime(b):D),d&&o&&this.elements.forEach((P,T)=>{f[T].width=P.offsetWidth,v&&v.observe(P)})}),this}kill(){let{obs:e}=this._data;e&&e.disconnect(),Hn?.removeEventListener("loadingdone",this._split)}revert(){var e,t;if(this.isSplit){let{orig:n,anim:r}=this._data;this.kill(),n.forEach(ha),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 el(e,t)}static register(e){Di=Di||e||window.gsap,Di&&(Ni=Di.utils.toArray,Wr=Di.core.context||Wr),!Cs&&window.innerWidth>0&&(Hn=document.fonts,Cs=!0)}};Qo.version="3.14.2";let Vs=Qo;var Mc=/(?:^\s+|\s+$)/g,Sc=/([\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 Gs(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+=Gs(i)}else if(e===3||e===4)return i.nodeValue;return t}function Wt(i,e,t,n,r){if(i+="",t&&(i=i.trim?i.trim():i.replace(Mc,"")),e&&e!=="")return i.replace(/>/g,">").replace(/</g,"<").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(Sc)||[])[1]||"").length||2,c=i.substr(o,l),s.emoji=1,o+=l-1),s.push(r?c:c===">"?">":c==="<"?"<":n&&c===" "&&(i.charAt(o-1)===" "||i.charAt(o+1)===" ")?" ":c);return s}var Er=(function(){function i(t){this.chars=Wt(t),this.sets=[],this.length=50;for(var n=0;n<20;n++)this.sets[n]=ma(80,this.chars)}var e=i.prototype;return e.grow=function(n){for(var r=0;r<20;r++)this.sets[r]+=ma(n-this.length,this.chars);this.length=n},i})(),Fn,tl,nl=function(){return Fn||typeof window<"u"&&(Fn=window.gsap)&&Fn.registerPlugin&&Fn},Ec=1,pa=/\s+/g,ma=function(e,t){for(var n=t.length,r="";--e>-1;)r+=t[~~(Math.random()*n)];return r},Ls="ABCDEFGHIJKLMNOPQRSTUVWXYZ",ga=Ls.toLowerCase(),bc={upperCase:new Er(Ls),lowerCase:new Er(ga),upperAndLowerCase:new Er(Ls+ga)},_a=function(){tl=Fn=nl()},Fr={version:"3.14.2",name:"scrambleText",register:function(e,t,n){Fn=e,_a()},init:function(e,t,n,r,s){if(tl||_a(),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,d,u,h;return l.delimiter=c=t.delimiter||"",l.original=Wt(Gs(e).replace(pa," ").split(" ").join(""),c,o),(a==="{original}"||a===!0||a==null)&&(a=l.original.join(c)),l.text=Wt((a||"").replace(pa," "),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&&!!Wt(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(" ")?" ":"",l.charSet=u=bc[t.chars||"upperCase"]||new Er(t.chars),l.speed=.05/(t.speed||1),l.prevScrambleTime=0,l.setIndex=Math.random()*20|0,d=l.length+Math.max(l.lengthDif,0),d>u.length&&u.grow(d),l.chars=u.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"),Ec}},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,d=t.setIndex,u=t.chars,h=t.charSet,p=t.length,_=t.textHasEmoji,x=t.charsHaveEmoji,m=t.lengthDif,f=t.tweenLength,b=t.oldClass,v=t.newClass,D=t.rightToLeft,P=t.fillChar,T=t.speed,w=t.original,L=t.hasClass,S=s.length,y=o._time,U=y-l,I,C,k,G,$,te,B,K,q,F,ee;c&&(o._from&&(y=o._dur-y),e=y===0?0:y<c?1e-6:y===o._dur?1:o._ease((y-c)/(o._dur-c))),e<0?e=0:e>1&&(e=1),D&&(e=1-e),I=~~(e*S+.5),e?((U>T||U<-T)&&(t.setIndex=d=(d+(Math.random()*19|0))%20,t.chars=h.sets[d],t.prevScrambleTime+=U),G=u):G=w.join(a),ee=o._from?e:1-e,F=p+(f?o._from?ee*ee*ee:1-ee*ee*ee:1)*m,D?e===1&&(o._from||o.data==="isFromStart")?(k="",G=w.join(a)):(B=s.slice(I).join(a),x?k=Wt(G).slice(0,F-(_?Wt(B):B).length+.5|0).join(""):k=G.substr(0,F-(_?Wt(B):B).length+.5|0),G=B):(k=s.slice(0,I).join(a),C=(_?Wt(k):k).length,x?G=Wt(G).slice(C,F+.5|0).join(""):G=G.substr(C,F-C+.5|0)),L?(K=D?b:v,q=D?v:b,$=K&&I!==0,te=q&&I!==S,B=($?"<span class='"+K+"'>":"")+k+($?"</span>":"")+(te?"<span class='"+q+"'>":"")+a+G+(te?"</span>":"")):B=k+a+G,n[r]=P===" "&&~B.indexOf(" ")?B.split(" ").join(" "):B}};Fr.emojiSafeSplit=Wt;Fr.getText=Gs;nl()&&Fn.registerPlugin(Fr);ws.gsap.registerPlugin(Vs,Fr);const Dc=({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 d=se.useRef(null);se.useEffect(()=>{if(!d.current)return;const h=Vs.create(d.current.querySelector("p"),{type:"chars",charsClass:"inline-block will-change-transform"});h.chars.forEach(x=>{const m=x;ws.gsap.set(m,{attr:{"data-content":m.innerHTML}})});const p=x=>{h.chars.forEach(m=>{const f=m,{left:b,top:v,width:D,height:P}=f.getBoundingClientRect(),T=x.clientX-(b+D/2),w=x.clientY-(v+P/2),L=Math.hypot(T,w);L<i&&ws.gsap.to(f,{overwrite:!0,duration:e*(1-L/i),scrambleText:{text:f.dataset.content||"",chars:n,speed:t},ease:"none"})})},_=d.current;return _.addEventListener("pointermove",p),()=>{_.removeEventListener("pointermove",p),h.revert()}},[i,e,t,n]);const u={...s,...o&&{fontSize:o},...l&&{fontFamily:l},...c&&{color:c}};return z.jsx("div",{ref:d,className:`m-[7vw] max-w-[800px] font-mono text-[clamp(14px,4vw,32px)] text-white ${r}`,style:u,children:z.jsx("p",{children:a})})},Tc=({onParamsChange:i})=>{const[e,t]=se.useState({text:"Move your cursor over this text to see the scramble effect!",radius:120,duration:1.5,speed:.6,scrambleChars:"!<>-_\\/[]{}—=+*^?#________",fontSize:"",fontFamily:"",color:""}),n=s=>{t(s),i&&i(s)};se.useEffect(()=>{i&&i(e)},[]);const r=[{type:"text",key:"text",label:"text",placeholder:"Enter text..."},{type:"number",key:"radius",label:"radius",min:50,max:300,step:10},{type:"number",key:"duration",label:"duration",min:.1,max:5,step:.1},{type:"number",key:"speed",label:"speed",min:.1,max:2,step:.1},{type:"text",key:"scrambleChars",label:"scrambleChars",placeholder:"!<>-_\\/[]{}—=+*^?#"},{type:"text",key:"fontSize",label:"fontSize",placeholder:"e.g., 24px, 1.5rem, 2em"},{type:"text",key:"fontFamily",label:"fontFamily",placeholder:'e.g., Arial, "Times New Roman", sans-serif'},{type:"color",key:"color",label:"color",placeholder:"#ffffff"}];return z.jsxs("div",{className:"w-full space-y-6",children:[z.jsx("div",{className:"flex items-center justify-center min-h-[300px] rounded-xl border border-zinc-200 dark:border-zinc-800 bg-zinc-50 dark:bg-zinc-800/50 p-8",children:z.jsx(Dc,{radius:e.radius,duration:e.duration,speed:e.speed,scrambleChars:e.scrambleChars,fontSize:e.fontSize||void 0,fontFamily:e.fontFamily||void 0,color:e.color||void 0,children:e.text})}),z.jsx(Tt,{config:e,onChange:n,fields:r})]})},Ac=({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=se.useRef(null);return se.useEffect(()=>{if(!c.current)return;const d=c.current,u=d.getTotalLength();d.style.strokeDasharray=`${n} ${r}`,d.style.strokeDashoffset=i==="clockwise"?u:0;let h,p=i==="clockwise"?u:0;const _=i==="clockwise"?-e:e,x=()=>{p+=_,i==="clockwise"?p<=-(n+r)&&(p=0):p>=n+r&&(p=0),d.style.strokeDashoffset=p,h=requestAnimationFrame(x)};return h=requestAnimationFrame(x),()=>{h&&cancelAnimationFrame(h)}},[i,e,n,r]),z.jsx("svg",{width:s+o*2,height:a+o*2,className:"overflow-visible",children:z.jsx(St.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}})})},wc=({onParamsChange:i})=>{const[e,t]=se.useState({direction:"clockwise",speed:.5,color:"#71717a",dashLength:15,gapLength:8,width:300,height:200,strokeWidth:1,borderRadius:20}),n=s=>{t(s),i&&i(s)};se.useEffect(()=>{i&&i(e)},[]);const r=[{type:"button-group",key:"direction",label:"direction",options:[{value:"clockwise",label:"clockwise"},{value:"counterclockwise",label:"counterclockwise"}]},{type:"number",key:"speed",label:"speed",min:.1,max:10,step:.1},{type:"number",key:"dashLength",label:"dashLength",min:1,max:50},{type:"number",key:"gapLength",label:"gapLength",min:1,max:50},{type:"number",key:"strokeWidth",label:"strokeWidth",min:1,max:10},{type:"number",key:"borderRadius",label:"borderRadius",min:0,max:100},{type:"number",key:"width",label:"width",min:50,max:600},{type:"number",key:"height",label:"height",min:50,max:400},{type:"color",key:"color",label:"color",placeholder:"#71717a"}];return z.jsxs("div",{className:"w-full space-y-6",children:[z.jsx("div",{className:"flex items-center justify-center min-h-[300px] rounded-xl border border-zinc-200 dark:border-zinc-800 bg-zinc-50 dark:bg-zinc-800/50 p-8",children:z.jsx(Ac,{...e})}),z.jsx(Tt,{config:e,onChange:n,fields:r})]})},Cc=({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 z.jsxs("div",{className:ql("relative h-full w-full p-1",s),children:[z.jsx(St.motion.div,{initial:{opacity:0},animate:{opacity:1},transition:{duration:.2},className:"size-full",children:z.jsx(St.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"})}),z.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`}})]})},Rc=({onParamsChange:i})=>{const[e,t]=se.useState({color:"#6366f1",backgroundColor:"#0a0a0a",duration:150,blurIntensity:"1em",density:1}),n=s=>{t(s),i&&i(s)};se.useEffect(()=>{i&&i(e)},[]);const r=[{type:"color",key:"color",label:"color",placeholder:"#6366f1"},{type:"color",key:"backgroundColor",label:"backgroundColor",placeholder:"#0a0a0a"},{type:"number",key:"duration",label:"duration",min:50,max:500,step:10},{type:"text",key:"blurIntensity",label:"blurIntensity",placeholder:"1em"},{type:"number",key:"density",label:"density",min:.5,max:3,step:.1}];return z.jsxs("div",{className:"w-full space-y-6",children:[z.jsx("div",{className:"w-full h-64 rounded-xl border border-zinc-200 dark:border-zinc-800 bg-zinc-50 dark:bg-zinc-800/50 overflow-hidden",children:z.jsx(Cc,{color:e.color,backgroundColor:e.backgroundColor,duration:e.duration,blurIntensity:e.blurIntensity,density:e.density})}),z.jsx(Tt,{config:e,onChange:n,fields:r})]})},Pc=({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:d=0,fontSize:u,fontFamily:h})=>{const[p,_]=se.useState(!1),x=St.useMotionValue(0),m=se.useRef(0),f=se.useRef(null),b=se.useRef(c==="left"?1:-1),v=t*1e3,D=d*1e3;St.useAnimationFrame(y=>{if(e||p){f.current=null;return}if(f.current===null){f.current=y;return}const U=y-f.current;if(f.current=y,m.current+=U,o){const I=v+D,C=I*2,k=m.current%C;if(k<v){const G=k/v*100;x.set(b.current===1?G:100-G)}else if(k<I)x.set(b.current===1?100:0);else if(k<I+v){const $=100-(k-I)/v*100;x.set(b.current===1?$:100-$)}else x.set(b.current===1?0:100)}else{const I=v+D,C=m.current%I;if(C<v){const k=C/v*100;x.set(b.current===1?k:100-k)}else x.set(b.current===1?100:0)}}),se.useEffect(()=>{b.current=c==="left"?1:-1,m.current=0,x.set(0)},[c]);const P=St.useTransform(x,y=>`${150-y*2}% center`),T=se.useCallback(()=>{l&&_(!0)},[l]),w=se.useCallback(()=>{l&&_(!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:P,...u&&{fontSize:u},...h&&{fontFamily:h}};return z.jsx(St.motion.span,{className:`inline-block ${n}`,style:S,onMouseEnter:T,onMouseLeave:w,children:i})},Lc=({onParamsChange:i})=>{const[e,t]=se.useState({text:"Alibaba Cloud SparkDesign",speed:2,color:"#b5b5b5",shineColor:"#ffffff",direction:"left",yoyo:!1,pauseOnHover:!1,spread:120,delay:0,fontSize:"",fontFamily:""}),n=s=>{t(s),i&&i(s)};se.useEffect(()=>{i&&i(e)},[]);const r=[{type:"text",key:"text",label:"text",placeholder:"Enter text..."},{type:"number",key:"speed",label:"speed",min:.5,max:10,step:.5},{type:"color",key:"color",label:"color",placeholder:"#b5b5b5"},{type:"color",key:"shineColor",label:"shineColor",placeholder:"#ffffff"},{type:"button-group",key:"direction",label:"direction",options:[{value:"left",label:"left"},{value:"right",label:"right"}]},{type:"boolean",key:"yoyo",label:"yoyo"},{type:"boolean",key:"pauseOnHover",label:"pauseOnHover"},{type:"number",key:"spread",label:"spread",min:60,max:180,step:10},{type:"number",key:"delay",label:"delay",min:0,max:5,step:.5},{type:"text",key:"fontSize",label:"fontSize",placeholder:"e.g., 24px, 1.5rem, 2em"},{type:"text",key:"fontFamily",label:"fontFamily",placeholder:'e.g., Arial, "Times New Roman", sans-serif'}];return z.jsxs("div",{className:"w-full space-y-6",children:[z.jsx("div",{className:"flex items-center justify-center min-h-[200px] rounded-xl border border-zinc-200 dark:border-zinc-800 bg-zinc-50 dark:bg-zinc-800/50 p-8",children:z.jsx(Pc,{text:e.text,className:"text-4xl font-medium font-spark",speed:e.speed,color:e.color,shineColor:e.shineColor,direction:e.direction,yoyo:e.yoyo,pauseOnHover:e.pauseOnHover,spread:e.spread,delay:e.delay,fontSize:e.fontSize||void 0,fontFamily:e.fontFamily||void 0})}),z.jsx(Tt,{config:e,onChange:n,fields:r})]})};const Ws="163",Gn={ROTATE:0,DOLLY:1,PAN:2},Wn={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},Fc=0,xa=1,Nc=2,il=1,Uc=2,en=3,yn=0,yt=1,jt=2,nn=0,ui=1,hi=2,va=3,ya=4,Ic=5,Pn=100,Oc=101,zc=102,Bc=103,kc=104,Hc=200,Vc=201,Gc=202,Wc=203,Fs=204,Ns=205,Xc=206,jc=207,Yc=208,qc=209,$c=210,Kc=211,Zc=212,Jc=213,Qc=214,eu=0,tu=1,nu=2,Tr=3,iu=4,ru=5,su=6,au=7,rl=0,ou=1,lu=2,_n=0,cu=1,uu=2,hu=3,Xs=4,du=5,fu=6,pu=7,sl=300,mi=301,gi=302,Us=303,Is=304,Nr=306,Os=1e3,Nn=1001,zs=1002,Ot=1003,mu=1004,ji=1005,Ht=1006,Xr=1007,Un=1008,xn=1009,gu=1010,_u=1011,al=1012,ol=1013,_i=1014,gn=1015,vn=1016,ll=1017,cl=1018,zi=1020,xu=35902,vu=1021,yu=1022,Yt=1023,Mu=1024,Su=1025,di=1026,Ui=1027,Eu=1028,ul=1029,bu=1030,hl=1031,dl=1033,jr=33776,Yr=33777,qr=33778,$r=33779,Ma=35840,Sa=35841,Ea=35842,ba=35843,fl=36196,Da=37492,Ta=37496,Aa=37808,wa=37809,Ca=37810,Ra=37811,Pa=37812,La=37813,Fa=37814,Na=37815,Ua=37816,Ia=37817,Oa=37818,za=37819,Ba=37820,ka=37821,Kr=36492,Ha=36494,Va=36495,Du=36283,Ga=36284,Wa=36285,Xa=36286,Tu=3200,Au=3201,wu=0,Cu=1,mn="",It="srgb",Mn="srgb-linear",js="display-p3",Ur="display-p3-linear",Ar="linear",Ke="srgb",wr="rec709",Cr="p3",Xn=7680,ja=519,Ru=512,Pu=513,Lu=514,pl=515,Fu=516,Nu=517,Uu=518,Iu=519,Ya=35044,qa="300 es",tn=2e3,Rr=2001;class zn{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 $a=1234567;const fi=Math.PI/180,Ii=180/Math.PI;function vi(){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 Ys(i,e){return(i%e+e)%e}function Ou(i,e,t,n,r){return n+(i-e)*(r-n)/(t-e)}function zu(i,e,t){return i!==e?(t-i)/(e-i):0}function Pi(i,e,t){return(1-t)*i+t*e}function Bu(i,e,t,n){return Pi(i,e,1-Math.exp(-t*n))}function ku(i,e=1){return e-Math.abs(Ys(i,e*2)-e)}function Hu(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*(3-2*i))}function Vu(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*i*(i*(i*6-15)+10))}function Gu(i,e){return i+Math.floor(Math.random()*(e-i+1))}function Wu(i,e){return i+Math.random()*(e-i)}function Xu(i){return i*(.5-Math.random())}function ju(i){i!==void 0&&($a=i);let e=$a+=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 Yu(i){return i*fi}function qu(i){return i*Ii}function $u(i){return(i&i-1)===0&&i!==0}function Ku(i){return Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))}function Zu(i){return Math.pow(2,Math.floor(Math.log(i)/Math.LN2))}function Ju(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),d=a((e+n)/2),u=s((e-n)/2),h=a((e-n)/2),p=s((n-e)/2),_=a((n-e)/2);switch(r){case"XYX":i.set(o*d,l*u,l*h,o*c);break;case"YZY":i.set(l*h,o*d,l*u,o*c);break;case"ZXZ":i.set(l*u,l*h,o*d,o*c);break;case"XZX":i.set(o*d,l*_,l*p,o*c);break;case"YXY":i.set(l*p,o*d,l*_,o*c);break;case"ZYZ":i.set(l*_,l*p,o*d,o*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function li(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 ml={DEG2RAD:fi,RAD2DEG:Ii,generateUUID:vi,clamp:ht,euclideanModulo:Ys,mapLinear:Ou,inverseLerp:zu,lerp:Pi,damp:Bu,pingpong:ku,smoothstep:Hu,smootherstep:Vu,randInt:Gu,randFloat:Wu,randFloatSpread:Xu,seededRandom:ju,degToRad:Yu,radToDeg:qu,isPowerOfTwo:$u,ceilPowerOfTwo:Ku,floorPowerOfTwo:Zu,setQuaternionFromProperEuler:Ju,normalize:xt,denormalize:li};class he{constructor(e=0,t=0){he.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 ze{constructor(e,t,n,r,s,a,o,l,c){ze.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 d=this.elements;return d[0]=e,d[1]=r,d[2]=o,d[3]=t,d[4]=s,d[5]=l,d[6]=n,d[7]=a,d[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],d=n[4],u=n[7],h=n[2],p=n[5],_=n[8],x=r[0],m=r[3],f=r[6],b=r[1],v=r[4],D=r[7],P=r[2],T=r[5],w=r[8];return s[0]=a*x+o*b+l*P,s[3]=a*m+o*v+l*T,s[6]=a*f+o*D+l*w,s[1]=c*x+d*b+u*P,s[4]=c*m+d*v+u*T,s[7]=c*f+d*D+u*w,s[2]=h*x+p*b+_*P,s[5]=h*m+p*v+_*T,s[8]=h*f+p*D+_*w,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],d=e[8];return t*a*d-t*o*c-n*s*d+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],d=e[8],u=d*a-o*c,h=o*l-d*s,p=c*s-a*l,_=t*u+n*h+r*p;if(_===0)return this.set(0,0,0,0,0,0,0,0,0);const x=1/_;return e[0]=u*x,e[1]=(r*c-d*n)*x,e[2]=(o*n-r*a)*x,e[3]=h*x,e[4]=(d*t-r*l)*x,e[5]=(r*s-o*t)*x,e[6]=p*x,e[7]=(n*l-c*t)*x,e[8]=(a*t-n*s)*x,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(Zr.makeScale(e,t)),this}rotate(e){return this.premultiply(Zr.makeRotation(-e)),this}translate(e,t){return this.premultiply(Zr.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 Zr=new ze;function gl(i){for(let e=i.length-1;e>=0;--e)if(i[e]>=65535)return!0;return!1}function Pr(i){return document.createElementNS("http://www.w3.org/1999/xhtml",i)}function Qu(){const i=Pr("canvas");return i.style.display="block",i}const Ka={};function eh(i){i in Ka||(Ka[i]=!0,console.warn(i))}const Za=new ze().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),Ja=new ze().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),Yi={[Mn]:{transfer:Ar,primaries:wr,toReference:i=>i,fromReference:i=>i},[It]:{transfer:Ke,primaries:wr,toReference:i=>i.convertSRGBToLinear(),fromReference:i=>i.convertLinearToSRGB()},[Ur]:{transfer:Ar,primaries:Cr,toReference:i=>i.applyMatrix3(Ja),fromReference:i=>i.applyMatrix3(Za)},[js]:{transfer:Ke,primaries:Cr,toReference:i=>i.convertSRGBToLinear().applyMatrix3(Ja),fromReference:i=>i.applyMatrix3(Za).convertLinearToSRGB()}},th=new Set([Mn,Ur]),$e={enabled:!0,_workingColorSpace:Mn,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(i){if(!th.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=Yi[e].toReference,r=Yi[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 Yi[i].primaries},getTransfer:function(i){return i===mn?Ar:Yi[i].transfer}};function pi(i){return i<.04045?i*.0773993808:Math.pow(i*.9478672986+.0521327014,2.4)}function Jr(i){return i<.0031308?i*12.92:1.055*Math.pow(i,.41666)-.055}let jn;class nh{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{jn===void 0&&(jn=Pr("canvas")),jn.width=e.width,jn.height=e.height;const n=jn.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=jn}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=Pr("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]=pi(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(pi(t[n]/255)*255):t[n]=pi(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 ih=0;class _l{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:ih++}),this.uuid=vi(),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(Qr(r[a].image)):s.push(Qr(r[a]))}else s=Qr(r);n.url=s}return t||(e.images[this.uuid]=n),n}}function Qr(i){return typeof HTMLImageElement<"u"&&i instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&i instanceof ImageBitmap?nh.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 rh=0;class Dt extends zn{constructor(e=Dt.DEFAULT_IMAGE,t=Dt.DEFAULT_MAPPING,n=Nn,r=Nn,s=Ht,a=Un,o=Yt,l=xn,c=Dt.DEFAULT_ANISOTROPY,d=mn){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:rh++}),this.uuid=vi(),this.name="",this.source=new _l(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 he(0,0),this.repeat=new he(1,1),this.center=new he(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new ze,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=d,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!==sl)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Os:e.x=e.x-Math.floor(e.x);break;case Nn:e.x=e.x<0?0:1;break;case zs: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 Os:e.y=e.y-Math.floor(e.y);break;case Nn:e.y=e.y<0?0:1;break;case zs: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++}}Dt.DEFAULT_IMAGE=null;Dt.DEFAULT_MAPPING=sl;Dt.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],d=l[4],u=l[8],h=l[1],p=l[5],_=l[9],x=l[2],m=l[6],f=l[10];if(Math.abs(d-h)<.01&&Math.abs(u-x)<.01&&Math.abs(_-m)<.01){if(Math.abs(d+h)<.1&&Math.abs(u+x)<.1&&Math.abs(_+m)<.1&&Math.abs(c+p+f-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const v=(c+1)/2,D=(p+1)/2,P=(f+1)/2,T=(d+h)/4,w=(u+x)/4,L=(_+m)/4;return v>D&&v>P?v<.01?(n=0,r=.707106781,s=.707106781):(n=Math.sqrt(v),r=T/n,s=w/n):D>P?D<.01?(n=.707106781,r=0,s=.707106781):(r=Math.sqrt(D),n=T/r,s=L/r):P<.01?(n=.707106781,r=.707106781,s=0):(s=Math.sqrt(P),n=w/s,r=L/s),this.set(n,r,s,t),this}let b=Math.sqrt((m-_)*(m-_)+(u-x)*(u-x)+(h-d)*(h-d));return Math.abs(b)<.001&&(b=1),this.x=(m-_)/b,this.y=(u-x)/b,this.z=(h-d)/b,this.w=Math.acos((c+p+f-1)/2),this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){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 sh extends zn{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:Ht,depthBuffer:!0,stencilBuffer:!1,depthTexture:null,samples:0,count:1},n);const s=new Dt(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 _l(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 Gt extends sh{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}}class xl extends Dt{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=Ot,this.minFilter=Ot,this.wrapR=Nn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class ah extends Dt{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=Ot,this.minFilter=Ot,this.wrapR=Nn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class In{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],d=n[r+2],u=n[r+3];const h=s[a+0],p=s[a+1],_=s[a+2],x=s[a+3];if(o===0){e[t+0]=l,e[t+1]=c,e[t+2]=d,e[t+3]=u;return}if(o===1){e[t+0]=h,e[t+1]=p,e[t+2]=_,e[t+3]=x;return}if(u!==x||l!==h||c!==p||d!==_){let m=1-o;const f=l*h+c*p+d*_+u*x,b=f>=0?1:-1,v=1-f*f;if(v>Number.EPSILON){const P=Math.sqrt(v),T=Math.atan2(P,f*b);m=Math.sin(m*T)/P,o=Math.sin(o*T)/P}const D=o*b;if(l=l*m+h*D,c=c*m+p*D,d=d*m+_*D,u=u*m+x*D,m===1-o){const P=1/Math.sqrt(l*l+c*c+d*d+u*u);l*=P,c*=P,d*=P,u*=P}}e[t]=l,e[t+1]=c,e[t+2]=d,e[t+3]=u}static multiplyQuaternionsFlat(e,t,n,r,s,a){const o=n[r],l=n[r+1],c=n[r+2],d=n[r+3],u=s[a],h=s[a+1],p=s[a+2],_=s[a+3];return e[t]=o*_+d*u+l*p-c*h,e[t+1]=l*_+d*h+c*u-o*p,e[t+2]=c*_+d*p+o*h-l*u,e[t+3]=d*_-o*u-l*h-c*p,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),d=o(r/2),u=o(s/2),h=l(n/2),p=l(r/2),_=l(s/2);switch(a){case"XYZ":this._x=h*d*u+c*p*_,this._y=c*p*u-h*d*_,this._z=c*d*_+h*p*u,this._w=c*d*u-h*p*_;break;case"YXZ":this._x=h*d*u+c*p*_,this._y=c*p*u-h*d*_,this._z=c*d*_-h*p*u,this._w=c*d*u+h*p*_;break;case"ZXY":this._x=h*d*u-c*p*_,this._y=c*p*u+h*d*_,this._z=c*d*_+h*p*u,this._w=c*d*u-h*p*_;break;case"ZYX":this._x=h*d*u-c*p*_,this._y=c*p*u+h*d*_,this._z=c*d*_-h*p*u,this._w=c*d*u+h*p*_;break;case"YZX":this._x=h*d*u+c*p*_,this._y=c*p*u+h*d*_,this._z=c*d*_-h*p*u,this._w=c*d*u-h*p*_;break;case"XZY":this._x=h*d*u-c*p*_,this._y=c*p*u-h*d*_,this._z=c*d*_+h*p*u,this._w=c*d*u+h*p*_;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],d=t[6],u=t[10],h=n+o+u;if(h>0){const p=.5/Math.sqrt(h+1);this._w=.25/p,this._x=(d-l)*p,this._y=(s-c)*p,this._z=(a-r)*p}else if(n>o&&n>u){const p=2*Math.sqrt(1+n-o-u);this._w=(d-l)/p,this._x=.25*p,this._y=(r+a)/p,this._z=(s+c)/p}else if(o>u){const p=2*Math.sqrt(1+o-n-u);this._w=(s-c)/p,this._x=(r+a)/p,this._y=.25*p,this._z=(l+d)/p}else{const p=2*Math.sqrt(1+u-n-o);this._w=(a-r)/p,this._x=(s+c)/p,this._y=(l+d)/p,this._z=.25*p}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,d=t._w;return this._x=n*d+a*o+r*c-s*l,this._y=r*d+a*l+s*o-n*c,this._z=s*d+a*c+n*l-r*o,this._w=a*d-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 p=1-t;return this._w=p*a+t*this._w,this._x=p*n+t*this._x,this._y=p*r+t*this._y,this._z=p*s+t*this._z,this.normalize(),this}const c=Math.sqrt(l),d=Math.atan2(c,o),u=Math.sin((1-t)*d)/c,h=Math.sin(t*d)/c;return this._w=a*u+this._w*h,this._x=n*u+this._x*h,this._y=r*u+this._y*h,this._z=s*u+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 R{constructor(e=0,t=0,n=0){R.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(Qa.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Qa.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),d=2*(o*t-s*r),u=2*(s*n-a*t);return this.x=t+l*c+a*u-o*d,this.y=n+l*d+o*c-s*u,this.z=r+l*u+s*d-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 es.copy(this).projectOnVector(e),this.sub(es)}reflect(e){return this.sub(es.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 es=new R,Qa=new In;class Bi{constructor(e=new R(1/0,1/0,1/0),t=new R(-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(zt.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(zt.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=zt.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,zt):zt.fromBufferAttribute(s,a),zt.applyMatrix4(e.matrixWorld),this.expandByPoint(zt);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),qi.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),qi.copy(n.boundingBox)),qi.applyMatrix4(e.matrixWorld),this.union(qi)}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,zt),zt.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),$i.subVectors(this.max,Ti),Yn.subVectors(e.a,Ti),qn.subVectors(e.b,Ti),$n.subVectors(e.c,Ti),ln.subVectors(qn,Yn),cn.subVectors($n,qn),bn.subVectors(Yn,$n);let t=[0,-ln.z,ln.y,0,-cn.z,cn.y,0,-bn.z,bn.y,ln.z,0,-ln.x,cn.z,0,-cn.x,bn.z,0,-bn.x,-ln.y,ln.x,0,-cn.y,cn.x,0,-bn.y,bn.x,0];return!ts(t,Yn,qn,$n,$i)||(t=[1,0,0,0,1,0,0,0,1],!ts(t,Yn,qn,$n,$i))?!1:(Ki.crossVectors(ln,cn),t=[Ki.x,Ki.y,Ki.z],ts(t,Yn,qn,$n,$i))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,zt).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(zt).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:($t[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),$t[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),$t[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),$t[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),$t[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),$t[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),$t[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),$t[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints($t),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 $t=[new R,new R,new R,new R,new R,new R,new R,new R],zt=new R,qi=new Bi,Yn=new R,qn=new R,$n=new R,ln=new R,cn=new R,bn=new R,Ti=new R,$i=new R,Ki=new R,Dn=new R;function ts(i,e,t,n,r){for(let s=0,a=i.length-3;s<=a;s+=3){Dn.fromArray(i,s);const o=r.x*Math.abs(Dn.x)+r.y*Math.abs(Dn.y)+r.z*Math.abs(Dn.z),l=e.dot(Dn),c=t.dot(Dn),d=n.dot(Dn);if(Math.max(-Math.max(l,c,d),Math.min(l,c,d))>o)return!1}return!0}const oh=new Bi,Ai=new R,ns=new R;class ki{constructor(e=new R,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):oh.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;Ai.subVectors(e,this.center);const t=Ai.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),r=(n-this.radius)*.5;this.center.addScaledVector(Ai,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):(ns.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Ai.copy(e.center).add(ns)),this.expandByPoint(Ai.copy(e.center).sub(ns))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const Kt=new R,is=new R,Zi=new R,un=new R,rs=new R,Ji=new R,ss=new R;class Ir{constructor(e=new R,t=new R(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,Kt)),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=Kt.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Kt.copy(this.origin).addScaledVector(this.direction,t),Kt.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){is.copy(e).add(t).multiplyScalar(.5),Zi.copy(t).sub(e).normalize(),un.copy(this.origin).sub(is);const s=e.distanceTo(t)*.5,a=-this.direction.dot(Zi),o=un.dot(this.direction),l=-un.dot(Zi),c=un.lengthSq(),d=Math.abs(1-a*a);let u,h,p,_;if(d>0)if(u=a*l-o,h=a*o-l,_=s*d,u>=0)if(h>=-_)if(h<=_){const x=1/d;u*=x,h*=x,p=u*(u+a*h+2*o)+h*(a*u+h+2*l)+c}else h=s,u=Math.max(0,-(a*h+o)),p=-u*u+h*(h+2*l)+c;else h=-s,u=Math.max(0,-(a*h+o)),p=-u*u+h*(h+2*l)+c;else h<=-_?(u=Math.max(0,-(-a*s+o)),h=u>0?-s:Math.min(Math.max(-s,-l),s),p=-u*u+h*(h+2*l)+c):h<=_?(u=0,h=Math.min(Math.max(-s,-l),s),p=h*(h+2*l)+c):(u=Math.max(0,-(a*s+o)),h=u>0?s:Math.min(Math.max(-s,-l),s),p=-u*u+h*(h+2*l)+c);else h=a>0?-s:s,u=Math.max(0,-(a*h+o)),p=-u*u+h*(h+2*l)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,u),r&&r.copy(is).addScaledVector(Zi,h),p}intersectSphere(e,t){Kt.subVectors(e.center,this.origin);const n=Kt.dot(this.direction),r=Kt.dot(Kt)-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,d=1/this.direction.y,u=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),d>=0?(s=(e.min.y-h.y)*d,a=(e.max.y-h.y)*d):(s=(e.max.y-h.y)*d,a=(e.min.y-h.y)*d),n>a||s>r||((s>n||isNaN(n))&&(n=s),(a<r||isNaN(r))&&(r=a),u>=0?(o=(e.min.z-h.z)*u,l=(e.max.z-h.z)*u):(o=(e.max.z-h.z)*u,l=(e.min.z-h.z)*u),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,Kt)!==null}intersectTriangle(e,t,n,r,s){rs.subVectors(t,e),Ji.subVectors(n,e),ss.crossVectors(rs,Ji);let a=this.direction.dot(ss),o;if(a>0){if(r)return null;o=1}else if(a<0)o=-1,a=-a;else return null;un.subVectors(this.origin,e);const l=o*this.direction.dot(Ji.crossVectors(un,Ji));if(l<0)return null;const c=o*this.direction.dot(rs.cross(un));if(c<0||l+c>a)return null;const d=-o*un.dot(ss);return d<0?null:this.at(d/a,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class et{constructor(e,t,n,r,s,a,o,l,c,d,u,h,p,_,x,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,d,u,h,p,_,x,m)}set(e,t,n,r,s,a,o,l,c,d,u,h,p,_,x,m){const f=this.elements;return f[0]=e,f[4]=t,f[8]=n,f[12]=r,f[1]=s,f[5]=a,f[9]=o,f[13]=l,f[2]=c,f[6]=d,f[10]=u,f[14]=h,f[3]=p,f[7]=_,f[11]=x,f[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/Kn.setFromMatrixColumn(e,0).length(),s=1/Kn.setFromMatrixColumn(e,1).length(),a=1/Kn.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),d=Math.cos(s),u=Math.sin(s);if(e.order==="XYZ"){const h=a*d,p=a*u,_=o*d,x=o*u;t[0]=l*d,t[4]=-l*u,t[8]=c,t[1]=p+_*c,t[5]=h-x*c,t[9]=-o*l,t[2]=x-h*c,t[6]=_+p*c,t[10]=a*l}else if(e.order==="YXZ"){const h=l*d,p=l*u,_=c*d,x=c*u;t[0]=h+x*o,t[4]=_*o-p,t[8]=a*c,t[1]=a*u,t[5]=a*d,t[9]=-o,t[2]=p*o-_,t[6]=x+h*o,t[10]=a*l}else if(e.order==="ZXY"){const h=l*d,p=l*u,_=c*d,x=c*u;t[0]=h-x*o,t[4]=-a*u,t[8]=_+p*o,t[1]=p+_*o,t[5]=a*d,t[9]=x-h*o,t[2]=-a*c,t[6]=o,t[10]=a*l}else if(e.order==="ZYX"){const h=a*d,p=a*u,_=o*d,x=o*u;t[0]=l*d,t[4]=_*c-p,t[8]=h*c+x,t[1]=l*u,t[5]=x*c+h,t[9]=p*c-_,t[2]=-c,t[6]=o*l,t[10]=a*l}else if(e.order==="YZX"){const h=a*l,p=a*c,_=o*l,x=o*c;t[0]=l*d,t[4]=x-h*u,t[8]=_*u+p,t[1]=u,t[5]=a*d,t[9]=-o*d,t[2]=-c*d,t[6]=p*u+_,t[10]=h-x*u}else if(e.order==="XZY"){const h=a*l,p=a*c,_=o*l,x=o*c;t[0]=l*d,t[4]=-u,t[8]=c*d,t[1]=h*u+x,t[5]=a*d,t[9]=p*u-_,t[2]=_*u-p,t[6]=o*d,t[10]=x*u+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(lh,e,ch)}lookAt(e,t,n){const r=this.elements;return Ct.subVectors(e,t),Ct.lengthSq()===0&&(Ct.z=1),Ct.normalize(),hn.crossVectors(n,Ct),hn.lengthSq()===0&&(Math.abs(n.z)===1?Ct.x+=1e-4:Ct.z+=1e-4,Ct.normalize(),hn.crossVectors(n,Ct)),hn.normalize(),Qi.crossVectors(Ct,hn),r[0]=hn.x,r[4]=Qi.x,r[8]=Ct.x,r[1]=hn.y,r[5]=Qi.y,r[9]=Ct.y,r[2]=hn.z,r[6]=Qi.z,r[10]=Ct.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],d=n[1],u=n[5],h=n[9],p=n[13],_=n[2],x=n[6],m=n[10],f=n[14],b=n[3],v=n[7],D=n[11],P=n[15],T=r[0],w=r[4],L=r[8],S=r[12],y=r[1],U=r[5],I=r[9],C=r[13],k=r[2],G=r[6],$=r[10],te=r[14],B=r[3],K=r[7],q=r[11],F=r[15];return s[0]=a*T+o*y+l*k+c*B,s[4]=a*w+o*U+l*G+c*K,s[8]=a*L+o*I+l*$+c*q,s[12]=a*S+o*C+l*te+c*F,s[1]=d*T+u*y+h*k+p*B,s[5]=d*w+u*U+h*G+p*K,s[9]=d*L+u*I+h*$+p*q,s[13]=d*S+u*C+h*te+p*F,s[2]=_*T+x*y+m*k+f*B,s[6]=_*w+x*U+m*G+f*K,s[10]=_*L+x*I+m*$+f*q,s[14]=_*S+x*C+m*te+f*F,s[3]=b*T+v*y+D*k+P*B,s[7]=b*w+v*U+D*G+P*K,s[11]=b*L+v*I+D*$+P*q,s[15]=b*S+v*C+D*te+P*F,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],d=e[2],u=e[6],h=e[10],p=e[14],_=e[3],x=e[7],m=e[11],f=e[15];return _*(+s*l*u-r*c*u-s*o*h+n*c*h+r*o*p-n*l*p)+x*(+t*l*p-t*c*h+s*a*h-r*a*p+r*c*d-s*l*d)+m*(+t*c*u-t*o*p-s*a*u+n*a*p+s*o*d-n*c*d)+f*(-r*o*d-t*l*u+t*o*h+r*a*u-n*a*h+n*l*d)}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],d=e[8],u=e[9],h=e[10],p=e[11],_=e[12],x=e[13],m=e[14],f=e[15],b=u*m*c-x*h*c+x*l*p-o*m*p-u*l*f+o*h*f,v=_*h*c-d*m*c-_*l*p+a*m*p+d*l*f-a*h*f,D=d*x*c-_*u*c+_*o*p-a*x*p-d*o*f+a*u*f,P=_*u*l-d*x*l-_*o*h+a*x*h+d*o*m-a*u*m,T=t*b+n*v+r*D+s*P;if(T===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const w=1/T;return e[0]=b*w,e[1]=(x*h*s-u*m*s-x*r*p+n*m*p+u*r*f-n*h*f)*w,e[2]=(o*m*s-x*l*s+x*r*c-n*m*c-o*r*f+n*l*f)*w,e[3]=(u*l*s-o*h*s-u*r*c+n*h*c+o*r*p-n*l*p)*w,e[4]=v*w,e[5]=(d*m*s-_*h*s+_*r*p-t*m*p-d*r*f+t*h*f)*w,e[6]=(_*l*s-a*m*s-_*r*c+t*m*c+a*r*f-t*l*f)*w,e[7]=(a*h*s-d*l*s+d*r*c-t*h*c-a*r*p+t*l*p)*w,e[8]=D*w,e[9]=(_*u*s-d*x*s-_*n*p+t*x*p+d*n*f-t*u*f)*w,e[10]=(a*x*s-_*o*s+_*n*c-t*x*c-a*n*f+t*o*f)*w,e[11]=(d*o*s-a*u*s-d*n*c+t*u*c+a*n*p-t*o*p)*w,e[12]=P*w,e[13]=(d*x*r-_*u*r+_*n*h-t*x*h-d*n*m+t*u*m)*w,e[14]=(_*o*r-a*x*r-_*n*l+t*x*l+a*n*m-t*o*m)*w,e[15]=(a*u*r-d*o*r+d*n*l-t*u*l-a*n*h+t*o*h)*w,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,d=s*o;return this.set(c*a+n,c*o-r*l,c*l+r*o,0,c*o+r*l,d*o+n,d*l-r*a,0,c*l-r*o,d*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,d=a+a,u=o+o,h=s*c,p=s*d,_=s*u,x=a*d,m=a*u,f=o*u,b=l*c,v=l*d,D=l*u,P=n.x,T=n.y,w=n.z;return r[0]=(1-(x+f))*P,r[1]=(p+D)*P,r[2]=(_-v)*P,r[3]=0,r[4]=(p-D)*T,r[5]=(1-(h+f))*T,r[6]=(m+b)*T,r[7]=0,r[8]=(_+v)*w,r[9]=(m-b)*w,r[10]=(1-(h+x))*w,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=Kn.set(r[0],r[1],r[2]).length();const a=Kn.set(r[4],r[5],r[6]).length(),o=Kn.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],Bt.copy(this);const c=1/s,d=1/a,u=1/o;return Bt.elements[0]*=c,Bt.elements[1]*=c,Bt.elements[2]*=c,Bt.elements[4]*=d,Bt.elements[5]*=d,Bt.elements[6]*=d,Bt.elements[8]*=u,Bt.elements[9]*=u,Bt.elements[10]*=u,t.setFromRotationMatrix(Bt),n.x=s,n.y=a,n.z=o,this}makePerspective(e,t,n,r,s,a,o=tn){const l=this.elements,c=2*s/(t-e),d=2*s/(n-r),u=(t+e)/(t-e),h=(n+r)/(n-r);let p,_;if(o===tn)p=-(a+s)/(a-s),_=-2*a*s/(a-s);else if(o===Rr)p=-a/(a-s),_=-a*s/(a-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return l[0]=c,l[4]=0,l[8]=u,l[12]=0,l[1]=0,l[5]=d,l[9]=h,l[13]=0,l[2]=0,l[6]=0,l[10]=p,l[14]=_,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,n,r,s,a,o=tn){const l=this.elements,c=1/(t-e),d=1/(n-r),u=1/(a-s),h=(t+e)*c,p=(n+r)*d;let _,x;if(o===tn)_=(a+s)*u,x=-2*u;else if(o===Rr)_=s*u,x=-1*u;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*d,l[9]=0,l[13]=-p,l[2]=0,l[6]=0,l[10]=x,l[14]=-_,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 Kn=new R,Bt=new et,lh=new R(0,0,0),ch=new R(1,1,1),hn=new R,Qi=new R,Ct=new R,eo=new et,to=new In;class rn{constructor(e=0,t=0,n=0,r=rn.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],d=r[9],u=r[2],h=r[6],p=r[10];switch(t){case"XYZ":this._y=Math.asin(ht(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-d,p),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(h,c),this._z=0);break;case"YXZ":this._x=Math.asin(-ht(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(o,p),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-u,s),this._z=0);break;case"ZXY":this._x=Math.asin(ht(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(-u,p),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-ht(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(h,p),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(-d,c),this._y=Math.atan2(-u,s)):(this._x=0,this._y=Math.atan2(o,p));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(-d,p),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 eo.makeRotationFromQuaternion(e),this.setFromRotationMatrix(eo,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return to.setFromEuler(this),this.setFromQuaternion(to,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}}rn.DEFAULT_ORDER="XYZ";class vl{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 no=new R,Zn=new In,Zt=new et,er=new R,wi=new R,hh=new R,dh=new In,io=new R(1,0,0),ro=new R(0,1,0),so=new R(0,0,1),ao={type:"added"},fh={type:"removed"},Jn={type:"childadded",child:null},as={type:"childremoved",child:null};class Mt extends zn{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:uh++}),this.uuid=vi(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Mt.DEFAULT_UP.clone();const e=new R,t=new rn,n=new In,r=new R(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 ze}}),this.matrix=new et,this.matrixWorld=new et,this.matrixAutoUpdate=Mt.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=Mt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new vl,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 Zn.setFromAxisAngle(e,t),this.quaternion.multiply(Zn),this}rotateOnWorldAxis(e,t){return Zn.setFromAxisAngle(e,t),this.quaternion.premultiply(Zn),this}rotateX(e){return this.rotateOnAxis(io,e)}rotateY(e){return this.rotateOnAxis(ro,e)}rotateZ(e){return this.rotateOnAxis(so,e)}translateOnAxis(e,t){return no.copy(e).applyQuaternion(this.quaternion),this.position.add(no.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(io,e)}translateY(e){return this.translateOnAxis(ro,e)}translateZ(e){return this.translateOnAxis(so,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(Zt.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?er.copy(e):er.set(e,t,n);const r=this.parent;this.updateWorldMatrix(!0,!1),wi.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Zt.lookAt(wi,er,this.up):Zt.lookAt(er,wi,this.up),this.quaternion.setFromRotationMatrix(Zt),r&&(Zt.extractRotation(r.matrixWorld),Zn.setFromRotationMatrix(Zt),this.quaternion.premultiply(Zn.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(ao),Jn.child=e,this.dispatchEvent(Jn),Jn.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(fh),as.child=e,this.dispatchEvent(as),as.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),Zt.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),Zt.multiply(e.parent.matrixWorld)),e.applyMatrix4(Zt),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(ao),Jn.child=e,this.dispatchEvent(Jn),Jn.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(wi,e,hh),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(wi,dh,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,d=l.length;c<d;c++){const u=l[c];s(e.shapes,u)}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),d=a(e.images),u=a(e.shapes),h=a(e.skeletons),p=a(e.animations),_=a(e.nodes);o.length>0&&(n.geometries=o),l.length>0&&(n.materials=l),c.length>0&&(n.textures=c),d.length>0&&(n.images=d),u.length>0&&(n.shapes=u),h.length>0&&(n.skeletons=h),p.length>0&&(n.animations=p),_.length>0&&(n.nodes=_)}return n.object=r,n;function a(o){const l=[];for(const c in o){const d=o[c];delete d.metadata,l.push(d)}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}}Mt.DEFAULT_UP=new R(0,1,0);Mt.DEFAULT_MATRIX_AUTO_UPDATE=!0;Mt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const kt=new R,Jt=new R,os=new R,Qt=new R,Qn=new R,ei=new R,oo=new R,ls=new R,cs=new R,us=new R;class Vt{constructor(e=new R,t=new R,n=new R){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,r){r.subVectors(n,t),kt.subVectors(e,t),r.cross(kt);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){kt.subVectors(r,t),Jt.subVectors(n,t),os.subVectors(e,t);const a=kt.dot(kt),o=kt.dot(Jt),l=kt.dot(os),c=Jt.dot(Jt),d=Jt.dot(os),u=a*c-o*o;if(u===0)return s.set(0,0,0),null;const h=1/u,p=(c*l-o*d)*h,_=(a*d-o*l)*h;return s.set(1-p-_,_,p)}static containsPoint(e,t,n,r){return this.getBarycoord(e,t,n,r,Qt)===null?!1:Qt.x>=0&&Qt.y>=0&&Qt.x+Qt.y<=1}static getInterpolation(e,t,n,r,s,a,o,l){return this.getBarycoord(e,t,n,r,Qt)===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,Qt.x),l.addScaledVector(a,Qt.y),l.addScaledVector(o,Qt.z),l)}static isFrontFacing(e,t,n,r){return kt.subVectors(n,t),Jt.subVectors(e,t),kt.cross(Jt).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 kt.subVectors(this.c,this.b),Jt.subVectors(this.a,this.b),kt.cross(Jt).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Vt.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Vt.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,r,s){return Vt.getInterpolation(e,this.a,this.b,this.c,t,n,r,s)}containsPoint(e){return Vt.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Vt.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;Qn.subVectors(r,n),ei.subVectors(s,n),ls.subVectors(e,n);const l=Qn.dot(ls),c=ei.dot(ls);if(l<=0&&c<=0)return t.copy(n);cs.subVectors(e,r);const d=Qn.dot(cs),u=ei.dot(cs);if(d>=0&&u<=d)return t.copy(r);const h=l*u-d*c;if(h<=0&&l>=0&&d<=0)return a=l/(l-d),t.copy(n).addScaledVector(Qn,a);us.subVectors(e,s);const p=Qn.dot(us),_=ei.dot(us);if(_>=0&&p<=_)return t.copy(s);const x=p*c-l*_;if(x<=0&&c>=0&&_<=0)return o=c/(c-_),t.copy(n).addScaledVector(ei,o);const m=d*_-p*u;if(m<=0&&u-d>=0&&p-_>=0)return oo.subVectors(s,r),o=(u-d)/(u-d+(p-_)),t.copy(r).addScaledVector(oo,o);const f=1/(m+x+h);return a=x*f,o=h*f,t.copy(n).addScaledVector(Qn,a).addScaledVector(ei,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},dn={h:0,s:0,l:0},tr={h:0,s:0,l:0};function hs(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}class be{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,$e.toWorkingColorSpace(this,t),this}setRGB(e,t,n,r=$e.workingColorSpace){return this.r=e,this.g=t,this.b=n,$e.toWorkingColorSpace(this,r),this}setHSL(e,t,n,r=$e.workingColorSpace){if(e=Ys(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=hs(a,s,e+1/3),this.g=hs(a,s,e),this.b=hs(a,s,e-1/3)}return $e.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=pi(e.r),this.g=pi(e.g),this.b=pi(e.b),this}copyLinearToSRGB(e){return this.r=Jr(e.r),this.g=Jr(e.g),this.b=Jr(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=It){return $e.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=$e.workingColorSpace){$e.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 d=(o+a)/2;if(o===a)l=0,c=0;else{const u=a-o;switch(c=d<=.5?u/(a+o):u/(2-a-o),a){case n:l=(r-s)/u+(r<s?6:0);break;case r:l=(s-n)/u+2;break;case s:l=(n-r)/u+4;break}l/=6}return e.h=l,e.s=c,e.l=d,e}getRGB(e,t=$e.workingColorSpace){return $e.fromWorkingColorSpace(gt.copy(this),t),e.r=gt.r,e.g=gt.g,e.b=gt.b,e}getStyle(e=It){$e.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(dn),this.setHSL(dn.h+e,dn.s+t,dn.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(dn),e.getHSL(tr);const n=Pi(dn.h,tr.h,t),r=Pi(dn.s,tr.s,t),s=Pi(dn.l,tr.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 ph=0;class yi extends zn{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:ph++}),this.uuid=vi(),this.name="",this.type="Material",this.blending=ui,this.side=yn,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Fs,this.blendDst=Ns,this.blendEquation=Pn,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new be(0,0,0),this.blendAlpha=0,this.depthFunc=Tr,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=ja,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Xn,this.stencilZFail=Xn,this.stencilZPass=Xn,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!==ui&&(n.blending=this.blending),this.side!==yn&&(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!==Fs&&(n.blendSrc=this.blendSrc),this.blendDst!==Ns&&(n.blendDst=this.blendDst),this.blendEquation!==Pn&&(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!==Tr&&(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!==ja&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Xn&&(n.stencilFail=this.stencilFail),this.stencilZFail!==Xn&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==Xn&&(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 yi{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 rn,this.combine=rl,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 R,nr=new he;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=Ya,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=gn,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}get updateRange(){return eh("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++)nr.fromBufferAttribute(this,t),nr.applyMatrix3(e),this.setXY(t,nr.x,nr.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=li(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=li(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=li(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=li(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=li(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!==Ya&&(e.usage=this.usage),e}}class Ml extends Et{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class Sl 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 mh=0;const Ut=new et,ds=new Mt,ti=new R,Rt=new Bi,Ci=new Bi,ut=new R;class _t extends zn{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:mh++}),this.uuid=vi(),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(gl(e)?Sl:Ml)(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 ze().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 Ut.makeRotationFromQuaternion(e),this.applyMatrix4(Ut),this}rotateX(e){return Ut.makeRotationX(e),this.applyMatrix4(Ut),this}rotateY(e){return Ut.makeRotationY(e),this.applyMatrix4(Ut),this}rotateZ(e){return Ut.makeRotationZ(e),this.applyMatrix4(Ut),this}translate(e,t,n){return Ut.makeTranslation(e,t,n),this.applyMatrix4(Ut),this}scale(e,t,n){return Ut.makeScale(e,t,n),this.applyMatrix4(Ut),this}lookAt(e){return ds.lookAt(e),ds.updateMatrix(),this.applyMatrix4(ds.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(ti).negate(),this.translate(ti.x,ti.y,ti.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 Bi);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 R(-1/0,-1/0,-1/0),new R(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];Rt.setFromBufferAttribute(s),this.morphTargetsRelative?(ut.addVectors(this.boundingBox.min,Rt.min),this.boundingBox.expandByPoint(ut),ut.addVectors(this.boundingBox.max,Rt.max),this.boundingBox.expandByPoint(ut)):(this.boundingBox.expandByPoint(Rt.min),this.boundingBox.expandByPoint(Rt.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 ki);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 R,1/0);return}if(e){const n=this.boundingSphere.center;if(Rt.setFromBufferAttribute(e),t)for(let s=0,a=t.length;s<a;s++){const o=t[s];Ci.setFromBufferAttribute(o),this.morphTargetsRelative?(ut.addVectors(Rt.min,Ci.min),Rt.expandByPoint(ut),ut.addVectors(Rt.max,Ci.max),Rt.expandByPoint(ut)):(Rt.expandByPoint(Ci.min),Rt.expandByPoint(Ci.max))}Rt.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,d=o.count;c<d;c++)ut.fromBufferAttribute(o,c),l&&(ti.fromBufferAttribute(e,c),ut.add(ti)),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 L=0;L<n.count;L++)o[L]=new R,l[L]=new R;const c=new R,d=new R,u=new R,h=new he,p=new he,_=new he,x=new R,m=new R;function f(L,S,y){c.fromBufferAttribute(n,L),d.fromBufferAttribute(n,S),u.fromBufferAttribute(n,y),h.fromBufferAttribute(s,L),p.fromBufferAttribute(s,S),_.fromBufferAttribute(s,y),d.sub(c),u.sub(c),p.sub(h),_.sub(h);const U=1/(p.x*_.y-_.x*p.y);isFinite(U)&&(x.copy(d).multiplyScalar(_.y).addScaledVector(u,-p.y).multiplyScalar(U),m.copy(u).multiplyScalar(p.x).addScaledVector(d,-_.x).multiplyScalar(U),o[L].add(x),o[S].add(x),o[y].add(x),l[L].add(m),l[S].add(m),l[y].add(m))}let b=this.groups;b.length===0&&(b=[{start:0,count:e.count}]);for(let L=0,S=b.length;L<S;++L){const y=b[L],U=y.start,I=y.count;for(let C=U,k=U+I;C<k;C+=3)f(e.getX(C+0),e.getX(C+1),e.getX(C+2))}const v=new R,D=new R,P=new R,T=new R;function w(L){P.fromBufferAttribute(r,L),T.copy(P);const S=o[L];v.copy(S),v.sub(P.multiplyScalar(P.dot(S))).normalize(),D.crossVectors(T,S);const U=D.dot(l[L])<0?-1:1;a.setXYZW(L,v.x,v.y,v.z,U)}for(let L=0,S=b.length;L<S;++L){const y=b[L],U=y.start,I=y.count;for(let C=U,k=U+I;C<k;C+=3)w(e.getX(C+0)),w(e.getX(C+1)),w(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,p=n.count;h<p;h++)n.setXYZ(h,0,0,0);const r=new R,s=new R,a=new R,o=new R,l=new R,c=new R,d=new R,u=new R;if(e)for(let h=0,p=e.count;h<p;h+=3){const _=e.getX(h+0),x=e.getX(h+1),m=e.getX(h+2);r.fromBufferAttribute(t,_),s.fromBufferAttribute(t,x),a.fromBufferAttribute(t,m),d.subVectors(a,s),u.subVectors(r,s),d.cross(u),o.fromBufferAttribute(n,_),l.fromBufferAttribute(n,x),c.fromBufferAttribute(n,m),o.add(d),l.add(d),c.add(d),n.setXYZ(_,o.x,o.y,o.z),n.setXYZ(x,l.x,l.y,l.z),n.setXYZ(m,c.x,c.y,c.z)}else for(let h=0,p=t.count;h<p;h+=3)r.fromBufferAttribute(t,h+0),s.fromBufferAttribute(t,h+1),a.fromBufferAttribute(t,h+2),d.subVectors(a,s),u.subVectors(r,s),d.cross(u),n.setXYZ(h+0,d.x,d.y,d.z),n.setXYZ(h+1,d.x,d.y,d.z),n.setXYZ(h+2,d.x,d.y,d.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,d=o.itemSize,u=o.normalized,h=new c.constructor(l.length*d);let p=0,_=0;for(let x=0,m=l.length;x<m;x++){o.isInterleavedBufferAttribute?p=l[x]*o.data.stride+o.offset:p=l[x]*d;for(let f=0;f<d;f++)h[_++]=c[p++]}return new Et(h,d,u)}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 d=0,u=c.length;d<u;d++){const h=c[d],p=e(h,n);l.push(p)}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],d=[];for(let u=0,h=c.length;u<h;u++){const p=c[u];d.push(p.toJSON(e.data))}d.length>0&&(r[l]=d,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 d=r[c];this.setAttribute(c,d.clone(t))}const s=e.morphAttributes;for(const c in s){const d=[],u=s[c];for(let h=0,p=u.length;h<p;h++)d.push(u[h].clone(t));this.morphAttributes[c]=d}this.morphTargetsRelative=e.morphTargetsRelative;const a=e.groups;for(let c=0,d=a.length;c<d;c++){const u=a[c];this.addGroup(u.start,u.count,u.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 lo=new et,Tn=new Ir,ir=new ki,co=new R,ni=new R,ii=new R,ri=new R,fs=new R,rr=new R,sr=new he,ar=new he,or=new he,uo=new R,ho=new R,fo=new R,lr=new R,cr=new R;class bt extends Mt{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){rr.set(0,0,0);for(let l=0,c=s.length;l<c;l++){const d=o[l],u=s[l];d!==0&&(fs.fromBufferAttribute(u,e),a?rr.addScaledVector(fs,d):rr.addScaledVector(fs.sub(t),d))}t.add(rr)}return t}raycast(e,t){const n=this.geometry,r=this.material,s=this.matrixWorld;r!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),ir.copy(n.boundingSphere),ir.applyMatrix4(s),Tn.copy(e.ray).recast(e.near),!(ir.containsPoint(Tn.origin)===!1&&(Tn.intersectSphere(ir,co)===null||Tn.origin.distanceToSquared(co)>(e.far-e.near)**2))&&(lo.copy(s).invert(),Tn.copy(e.ray).applyMatrix4(lo),!(n.boundingBox!==null&&Tn.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,Tn)))}_computeIntersections(e,t,n){let r;const s=this.geometry,a=this.material,o=s.index,l=s.attributes.position,c=s.attributes.uv,d=s.attributes.uv1,u=s.attributes.normal,h=s.groups,p=s.drawRange;if(o!==null)if(Array.isArray(a))for(let _=0,x=h.length;_<x;_++){const m=h[_],f=a[m.materialIndex],b=Math.max(m.start,p.start),v=Math.min(o.count,Math.min(m.start+m.count,p.start+p.count));for(let D=b,P=v;D<P;D+=3){const T=o.getX(D),w=o.getX(D+1),L=o.getX(D+2);r=ur(this,f,e,n,c,d,u,T,w,L),r&&(r.faceIndex=Math.floor(D/3),r.face.materialIndex=m.materialIndex,t.push(r))}}else{const _=Math.max(0,p.start),x=Math.min(o.count,p.start+p.count);for(let m=_,f=x;m<f;m+=3){const b=o.getX(m),v=o.getX(m+1),D=o.getX(m+2);r=ur(this,a,e,n,c,d,u,b,v,D),r&&(r.faceIndex=Math.floor(m/3),t.push(r))}}else if(l!==void 0)if(Array.isArray(a))for(let _=0,x=h.length;_<x;_++){const m=h[_],f=a[m.materialIndex],b=Math.max(m.start,p.start),v=Math.min(l.count,Math.min(m.start+m.count,p.start+p.count));for(let D=b,P=v;D<P;D+=3){const T=D,w=D+1,L=D+2;r=ur(this,f,e,n,c,d,u,T,w,L),r&&(r.faceIndex=Math.floor(D/3),r.face.materialIndex=m.materialIndex,t.push(r))}}else{const _=Math.max(0,p.start),x=Math.min(l.count,p.start+p.count);for(let m=_,f=x;m<f;m+=3){const b=m,v=m+1,D=m+2;r=ur(this,a,e,n,c,d,u,b,v,D),r&&(r.faceIndex=Math.floor(m/3),t.push(r))}}}}function gh(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===yn,o),l===null)return null;cr.copy(o),cr.applyMatrix4(i.matrixWorld);const c=t.ray.origin.distanceTo(cr);return c<t.near||c>t.far?null:{distance:c,point:cr.clone(),object:i}}function ur(i,e,t,n,r,s,a,o,l,c){i.getVertexPosition(o,ni),i.getVertexPosition(l,ii),i.getVertexPosition(c,ri);const d=gh(i,e,t,n,ni,ii,ri,lr);if(d){r&&(sr.fromBufferAttribute(r,o),ar.fromBufferAttribute(r,l),or.fromBufferAttribute(r,c),d.uv=Vt.getInterpolation(lr,ni,ii,ri,sr,ar,or,new he)),s&&(sr.fromBufferAttribute(s,o),ar.fromBufferAttribute(s,l),or.fromBufferAttribute(s,c),d.uv1=Vt.getInterpolation(lr,ni,ii,ri,sr,ar,or,new he)),a&&(uo.fromBufferAttribute(a,o),ho.fromBufferAttribute(a,l),fo.fromBufferAttribute(a,c),d.normal=Vt.getInterpolation(lr,ni,ii,ri,uo,ho,fo,new R),d.normal.dot(n.direction)>0&&d.normal.multiplyScalar(-1));const u={a:o,b:l,c,normal:new R,materialIndex:0};Vt.getNormal(ni,ii,ri,u.normal),d.face=u}return d}class Vi 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=[],d=[],u=[];let h=0,p=0;_("z","y","x",-1,-1,n,t,e,a,s,0),_("z","y","x",1,-1,n,t,-e,a,s,1),_("x","z","y",1,1,e,n,t,r,a,2),_("x","z","y",1,-1,e,n,-t,r,a,3),_("x","y","z",1,-1,e,t,n,r,s,4),_("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(d,3)),this.setAttribute("uv",new nt(u,2));function _(x,m,f,b,v,D,P,T,w,L,S){const y=D/w,U=P/L,I=D/2,C=P/2,k=T/2,G=w+1,$=L+1;let te=0,B=0;const K=new R;for(let q=0;q<$;q++){const F=q*U-C;for(let ee=0;ee<G;ee++){const me=ee*y-I;K[x]=me*b,K[m]=F*v,K[f]=k,c.push(K.x,K.y,K.z),K[x]=0,K[m]=0,K[f]=T>0?1:-1,d.push(K.x,K.y,K.z),u.push(ee/w),u.push(1-q/L),te+=1}}for(let q=0;q<L;q++)for(let F=0;F<w;F++){const ee=h+F+G*q,me=h+F+G*(q+1),N=h+(F+1)+G*(q+1),Q=h+(F+1)+G*q;l.push(ee,me,Q),l.push(me,N,Q),B+=6}o.addGroup(p,B,S),p+=B,h+=te}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Vi(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function xi(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=xi(i[t]);for(const r in n)e[r]=n[r]}return e}function _h(i){const e=[];for(let t=0;t<i.length;t++)e.push(i[t].clone());return e}function El(i){const e=i.getRenderTarget();return e===null?i.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:$e.workingColorSpace}const Lr={clone:xi,merge:vt};var xh=`void main() {
|
|
6
|
+
<%s key={someKey} {...props} />`,U,ne,xe,ne),j[ne+U]=!0)}if(ne=null,pe!==void 0&&(t(pe),ne=""+pe),a(Q)&&(t(Q.key),ne=""+Q.key),"key"in Q){pe={};for(var De in Q)De!=="key"&&(pe[De]=Q[De])}else pe=Q;return ne&&o(pe,typeof F=="function"?F.displayName||F.name||"Unknown":F),c(F,ne,pe,r(),J,le)}function d(F){u(F)?F._store&&(F._store.validated=1):typeof F=="object"&&F!==null&&F.$$typeof===E&&(F._payload.status==="fulfilled"?u(F._payload.value)&&F._payload.value._store&&(F._payload.value._store.validated=1):F._store&&(F._store.validated=1))}function u(F){return typeof F=="object"&&F!==null&&F.$$typeof===_}var p=me,_=Symbol.for("react.transitional.element"),v=Symbol.for("react.portal"),m=Symbol.for("react.fragment"),f=Symbol.for("react.strict_mode"),b=Symbol.for("react.profiler"),x=Symbol.for("react.consumer"),D=Symbol.for("react.context"),P=Symbol.for("react.forward_ref"),T=Symbol.for("react.suspense"),w=Symbol.for("react.suspense_list"),L=Symbol.for("react.memo"),E=Symbol.for("react.lazy"),M=Symbol.for("react.activity"),N=Symbol.for("react.client.reference"),I=p.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,C=Object.prototype.hasOwnProperty,z=Array.isArray,V=console.createTask?console.createTask:function(){return null};p={react_stack_bottom_frame:function(F){return F()}};var q,ee={},B=p.react_stack_bottom_frame.bind(p,s)(),$=V(n(s)),j={};Ei.Fragment=m,Ei.jsx=function(F,Q,pe){var U=1e4>I.recentlyCreatedOwnerStacks++;return h(F,Q,pe,!1,U?Error("react-stack-top-frame"):B,U?V(n(F)):$)},Ei.jsxs=function(F,Q,pe){var U=1e4>I.recentlyCreatedOwnerStacks++;return h(F,Q,pe,!0,U?Error("react-stack-top-frame"):B,U?V(n(F)):$)}})()),Ei}var ra;function ac(){return ra||(ra=1,process.env.NODE_ENV==="production"?Gi.exports=rc():Gi.exports=sc()),Gi.exports}var ce=ac();const oc=(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},lc=({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=v=>v,onAnimationComplete:h,stepDuration:d=.35,fontSize:u,fontFamily:p,color:_})=>{const v=n==="words"?i.split(" "):i.split(""),[m,f]=me.useState(!1),b=me.useRef(null);me.useEffect(()=>{if(!b.current)return;const N=new IntersectionObserver(([I])=>{I.isIntersecting&&(f(!0),N.unobserve(b.current))},{threshold:s,rootMargin:a});return N.observe(b.current),()=>N.disconnect()},[s,a]);const x=me.useMemo(()=>r==="top"?{filter:"blur(10px)",opacity:0,y:-50}:{filter:"blur(10px)",opacity:0,y:50},[r]),D=me.useMemo(()=>[{filter:"blur(5px)",opacity:.5,y:r==="top"?5:-5},{filter:"blur(0px)",opacity:1,y:0}],[r]),P=o??x,T=l??D,w=T.length+1,L=d*(w-1),E=Array.from({length:w},(N,I)=>w===1?0:I/(w-1)),M={...u&&{fontSize:u},...p&&{fontFamily:p},..._&&{color:_}};return ce.jsx("p",{ref:b,className:`blur-text ${t} flex flex-wrap`,style:M,children:v.map((N,I)=>{const C=oc(P,T),z={duration:L,times:E,delay:I*e/1e3};return z.ease=c,ce.jsxs(Et.motion.span,{className:"inline-block will-change-[transform,filter,opacity]",initial:P,animate:m?C:P,transition:z,onAnimationComplete:I===v.length-1?h:void 0,children:[N===" "?" ":N,n==="words"&&I<v.length-1&&" "]},I)})})},cc=(i,e,t=!0)=>({from:e,to:e+360,ease:"linear",duration:i,type:"tween",repeat:t?1/0:0}),Bn=(i,e)=>({rotate:cc(i,e),scale:{type:"spring",damping:20,stiffness:300}}),uc=({text:i,spinDuration:e=20,onHover:t="speedUp",className:n="",fontSize:r,fontFamily:s,color:a})=>{const o=Array.from(i),l=Et.useAnimation(),c=Et.useMotionValue(0);me.useEffect(()=>{const p=c.get();l.start({rotate:p+360,scale:1,transition:Bn(e,p)})},[e,i,t,l,c]);const h=()=>{const p=c.get();if(!t)return;let _,v=1;switch(t){case"slowDown":_=Bn(e*2,p);break;case"speedUp":_=Bn(e/4,p);break;case"pause":_={rotate:{type:"spring",damping:20,stiffness:300},scale:{type:"spring",damping:20,stiffness:300}},v=1;break;case"goBonkers":_=Bn(e/20,p),v=.8;break;default:_=Bn(e,p)}l.start({rotate:p+360,scale:v,transition:_})},d=()=>{const p=c.get();l.start({rotate:p+360,scale:1,transition:Bn(e,p)})},u={...r&&{fontSize:r},...s&&{fontFamily:s},...a&&{color:a}};return ce.jsx(Et.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,...u},initial:{rotate:0},animate:l,onMouseEnter:h,onMouseLeave:d,children:o.map((p,_)=>{const v=360/o.length*_,m=Math.PI/o.length,f=m*_,b=m*_,x=`rotateZ(${v}deg) translate3d(${f}px, ${b}px, 0)`;return ce.jsx("span",{className:"absolute inline-block inset-0 text-2xl transition-all duration-500 ease-[cubic-bezier(0,0,0,1)]",style:{transform:x,WebkitTransform:x,...u},children:p},_)})})};let yi,zn,sa=typeof Symbol=="function"?Symbol():"_split",As,hc=()=>As||ks.register(window.gsap),aa=typeof Intl<"u"&&"Segmenter"in Intl?new Intl.Segmenter:0,Li=i=>typeof i=="string"?Li(document.querySelectorAll(i)):"length"in i?Array.from(i).reduce((e,t)=>(typeof t=="string"?e.push(...Li(t)):e.push(t),e),[]):[i],oa=i=>Li(i).filter(e=>e instanceof HTMLElement),ws=[],Vr=function(){},dc={add:i=>i()},fc=/\s+/g,la=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"),yr={left:0,top:0,width:0,height:0},pc=(i,e)=>{for(;++e<i.length&&i[e]===yr;);return i[e]||yr},ca=({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")},ua=(i,e)=>{if(e){let t=new Set(i.join("").match(e)||ws),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},ha=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),Cs=(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=h=>{let d=document.createElement(r),u=t.length+1;return n&&(d.className=n+(l?" "+n+u:"")),a&&d.style.setProperty("--"+i,u+""),s!=="none"&&d.setAttribute("aria-hidden","true"),r!=="span"&&(d.style.position="relative",d.style.display=o),d.textContent=h,t.push(d),d};return l&&(n=n.replace("++","")),c.collection=t,c},mc=(i,e,t,n)=>{let r=Cs("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()}},Ko=(i,e,t,n,r,s,a,o,l,c)=>{var h;let d=Array.from(i.childNodes),u=0,{wordDelimiter:p,reduceWhiteSpace:_=!0,prepareText:v}=e,m=i.getBoundingClientRect(),f=m,b=!_&&window.getComputedStyle(i).whiteSpace.substring(0,3)==="pre",x=0,D=t.collection,P,T,w,L,E,M,N,I,C,z,V,q,ee,B,$,j,F,Q;for(typeof p=="object"?(w=p.delimiter||p,T=p.replaceWith||""):T=p===""?"":p||" ",P=T!==" ";u<d.length;u++)if(L=d[u],L.nodeType===3){for($=L.textContent||"",_?$=$.replace(fc," "):b&&($=$.replace(/\n/g,T+`
|
|
7
|
+
`)),v&&($=v($,i)),L.textContent=$,E=T||w?$.split(w||T):$.match(o)||ws,F=E[E.length-1],I=P?F.slice(-1)===" ":!F,F||E.pop(),f=m,N=P?E[0].charAt(0)===" ":!E[0],N&&kn(" ",i,L),E[0]||E.shift(),ua(E,l),s&&c||(L.textContent=""),C=1;C<=E.length;C++)if(j=E[C-1],!_&&b&&j.charAt(0)===`
|
|
8
|
+
`&&((h=L.previousSibling)==null||h.remove(),kn(document.createElement("br"),i,L),j=j.slice(1)),!_&&j==="")kn(T,i,L);else if(j===" ")i.insertBefore(document.createTextNode(" "),L);else{if(P&&j.charAt(0)===" "&&kn(" ",i,L),x&&C===1&&!N&&D.indexOf(x.parentNode)>-1?(M=D[D.length-1],M.appendChild(document.createTextNode(n?"":j))):(M=t(n?"":j),kn(M,i,L),x&&C===1&&!N&&M.insertBefore(x,M.firstChild)),n)for(V=aa?ua([...aa.segment(j)].map(pe=>pe.segment),l):j.match(o)||ws,Q=0;Q<V.length;Q++)M.appendChild(V[Q]===" "?document.createTextNode(" "):n(V[Q]));if(s&&c){if($=L.textContent=$.substring(j.length+1,$.length),z=M.getBoundingClientRect(),z.top>f.top&&z.left<=f.left){for(q=i.cloneNode(),ee=i.childNodes[0];ee&&ee!==M;)B=ee,ee=ee.nextSibling,q.appendChild(B);i.parentNode.insertBefore(q,i),r&&ha(q)}f=z}(C<E.length||I)&&kn(C>=E.length?" ":P&&j.slice(-1)===" "?" "+T:T,i,L)}i.removeChild(L),x=0}else L.nodeType===1&&(a&&a.indexOf(L)>-1?(D.indexOf(L.previousSibling)>-1&&D[D.length-1].appendChild(L),x=L):(Ko(L,e,t,n,r,s,a,o,l,!0),x=0),r&&ha(L))};const Zo=class Jo{constructor(e,t){this.isSplit=!1,hc(),this.elements=oa(e),this.chars=[],this.words=[],this.lines=[],this.masks=[],this.vars=t,this.elements.forEach(a=>{var o;t.overwrite!==!1&&((o=a[sa])==null||o._data.orig.filter(({element:l})=>l===a).forEach(ca)),a[sa]=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)})},Vr(this),this.split(t)}split(e){return(this._ctx||dc).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,h=t.indexOf("lines")>-1,d=t.indexOf("chars")>-1,u=t.indexOf("words")>-1,p=d&&!u&&!h,_=l&&("push"in l?new RegExp("(?:"+l.join("|")+")","gu"):l),v=_?new RegExp(_.source+"|"+la.source,"gu"):la,m=!!e.ignore&&oa(e.ignore),{orig:f,animTime:b,obs:x}=this._data,D;(d||u||h)&&(this.elements.forEach((P,T)=>{f[T]={element:P,html:P.innerHTML,ariaL:P.getAttribute("aria-label"),ariaH:P.getAttribute("aria-hidden")},n==="auto"?P.setAttribute("aria-label",(P.textContent||"").trim()):n==="hidden"&&P.setAttribute("aria-hidden","true");let w=[],L=[],E=[],M=d?Cs("char",e,w):null,N=Cs("word",e,L),I,C,z,V;if(Ko(P,e,N,M,p,r&&(h||p),m,v,_,!1),h){let q=Li(P.childNodes),ee=mc(P,q,e,E),B,$=[],j=0,F=q.map(U=>U.nodeType===1?U.getBoundingClientRect():yr),Q=yr,pe;for(I=0;I<q.length;I++)B=q[I],B.nodeType===1&&(B.nodeName==="BR"?((!I||q[I-1].nodeName!=="BR")&&($.push(B),ee(j,I+1)),j=I+1,Q=pc(F,I)):(pe=F[I],I&&pe.top>Q.top&&pe.left<Q.left+Q.width-1&&(ee(j,I),j=I),Q=pe));j<I&&ee(j,I),$.forEach(U=>{var J;return(J=U.parentNode)==null?void 0:J.removeChild(U)})}if(!u){for(I=0;I<L.length;I++)if(C=L[I],d||!C.nextSibling||C.nextSibling.nodeType!==3)if(s&&!h){for(z=document.createElement("span"),z.style.whiteSpace="nowrap";C.firstChild;)z.appendChild(C.firstChild);C.replaceWith(z)}else C.replaceWith(...C.childNodes);else V=C.nextSibling,V&&V.nodeType===3&&(V.textContent=(C.textContent||"")+(V.textContent||""),C.remove());L.length=0,P.normalize()}this.lines.push(...E),this.words.push(...L),this.chars.push(...w)}),c&&this[c]&&this.masks.push(...this[c].map(P=>{let T=P.cloneNode();return P.replaceWith(T),T.appendChild(P),P.className&&(T.className=P.className.trim()+"-mask"),T.style.overflow="clip",T}))),this.isSplit=!0,zn&&h&&(o?zn.addEventListener("loadingdone",this._split):zn.status==="loading"&&console.warn("SplitText called before fonts loaded")),(D=a&&a(this))&&D.totalTime&&(this._data.anim=b?D.totalTime(b):D),h&&o&&this.elements.forEach((P,T)=>{f[T].width=P.offsetWidth,x&&x.observe(P)})}),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(ca),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 Jo(e,t)}static register(e){yi=yi||e||window.gsap,yi&&(Li=yi.utils.toArray,Vr=yi.core.context||Vr),!As&&window.innerWidth>0&&(zn=document.fonts,As=!0)}};Zo.version="3.14.2";let ks=Zo;var gc=/(?:^\s+|\s+$)/g,_c=/([\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 Hs(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+=Hs(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(gc,"")),e&&e!=="")return i.replace(/>/g,">").replace(/</g,"<").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(_c)||[])[1]||"").length||2,c=i.substr(o,l),s.emoji=1,o+=l-1),s.push(r?c:c===">"?">":c==="<"?"<":n&&c===" "&&(i.charAt(o-1)===" "||i.charAt(o+1)===" ")?" ":c);return s}var Sr=(function(){function i(t){this.chars=Vt(t),this.sets=[],this.length=50;for(var n=0;n<20;n++)this.sets[n]=fa(80,this.chars)}var e=i.prototype;return e.grow=function(n){for(var r=0;r<20;r++)this.sets[r]+=fa(n-this.length,this.chars);this.length=n},i})(),Pn,Qo,el=function(){return Pn||typeof window<"u"&&(Pn=window.gsap)&&Pn.registerPlugin&&Pn},vc=1,da=/\s+/g,fa=function(e,t){for(var n=t.length,r="";--e>-1;)r+=t[~~(Math.random()*n)];return r},Rs="ABCDEFGHIJKLMNOPQRSTUVWXYZ",pa=Rs.toLowerCase(),xc={upperCase:new Sr(Rs),lowerCase:new Sr(pa),upperAndLowerCase:new Sr(Rs+pa)},ma=function(){Qo=Pn=el()},Pr={version:"3.14.2",name:"scrambleText",register:function(e,t,n){Pn=e,ma()},init:function(e,t,n,r,s){if(Qo||ma(),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,h,d,u;return l.delimiter=c=t.delimiter||"",l.original=Vt(Hs(e).replace(da," ").split(" ").join(""),c,o),(a==="{original}"||a===!0||a==null)&&(a=l.original.join(c)),l.text=Vt((a||"").replace(da," "),c,o),l.hasClass=!!(t.newClass||t.oldClass),l.newClass=t.newClass,l.oldClass=t.oldClass,u=c==="",l.textHasEmoji=u&&!!l.text.emoji,l.charsHaveEmoji=!!t.chars&&!!Vt(t.chars).emoji,l.length=u?l.original.length:l.original.join(c).length,l.lengthDif=(u?l.text.length:l.text.join(c).length)-l.length,l.fillChar=t.fillChar||t.chars&&~t.chars.indexOf(" ")?" ":"",l.charSet=d=xc[t.chars||"upperCase"]||new Sr(t.chars),l.speed=.05/(t.speed||1),l.prevScrambleTime=0,l.setIndex=Math.random()*20|0,h=l.length+Math.max(l.lengthDif,0),h>d.length&&d.grow(h),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"),vc}},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,h=t.setIndex,d=t.chars,u=t.charSet,p=t.length,_=t.textHasEmoji,v=t.charsHaveEmoji,m=t.lengthDif,f=t.tweenLength,b=t.oldClass,x=t.newClass,D=t.rightToLeft,P=t.fillChar,T=t.speed,w=t.original,L=t.hasClass,E=s.length,M=o._time,N=M-l,I,C,z,V,q,ee,B,$,j,F,Q;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),D&&(e=1-e),I=~~(e*E+.5),e?((N>T||N<-T)&&(t.setIndex=h=(h+(Math.random()*19|0))%20,t.chars=u.sets[h],t.prevScrambleTime+=N),V=d):V=w.join(a),Q=o._from?e:1-e,F=p+(f?o._from?Q*Q*Q:1-Q*Q*Q:1)*m,D?e===1&&(o._from||o.data==="isFromStart")?(z="",V=w.join(a)):(B=s.slice(I).join(a),v?z=Vt(V).slice(0,F-(_?Vt(B):B).length+.5|0).join(""):z=V.substr(0,F-(_?Vt(B):B).length+.5|0),V=B):(z=s.slice(0,I).join(a),C=(_?Vt(z):z).length,v?V=Vt(V).slice(C,F+.5|0).join(""):V=V.substr(C,F-C+.5|0)),L?($=D?b:x,j=D?x:b,q=$&&I!==0,ee=j&&I!==E,B=(q?"<span class='"+$+"'>":"")+z+(q?"</span>":"")+(ee?"<span class='"+j+"'>":"")+a+V+(ee?"</span>":"")):B=z+a+V,n[r]=P===" "&&~B.indexOf(" ")?B.split(" ").join(" "):B}};Pr.emojiSafeSplit=Vt;Pr.getText=Hs;el()&&Pn.registerPlugin(Pr);Ts.gsap.registerPlugin(ks,Pr);const Mc=({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 h=me.useRef(null);me.useEffect(()=>{if(!h.current)return;const u=ks.create(h.current.querySelector("p"),{type:"chars",charsClass:"inline-block will-change-transform"});u.chars.forEach(v=>{const m=v;Ts.gsap.set(m,{attr:{"data-content":m.innerHTML}})});const p=v=>{u.chars.forEach(m=>{const f=m,{left:b,top:x,width:D,height:P}=f.getBoundingClientRect(),T=v.clientX-(b+D/2),w=v.clientY-(x+P/2),L=Math.hypot(T,w);L<i&&Ts.gsap.to(f,{overwrite:!0,duration:e*(1-L/i),scrambleText:{text:f.dataset.content||"",chars:n,speed:t},ease:"none"})})},_=h.current;return _.addEventListener("pointermove",p),()=>{_.removeEventListener("pointermove",p),u.revert()}},[i,e,t,n]);const d={...s,...o&&{fontSize:o},...l&&{fontFamily:l},...c&&{color:c}};return ce.jsx("div",{ref:h,className:`m-[7vw] max-w-[800px] font-mono text-[clamp(14px,4vw,32px)] text-white ${r}`,style:d,children:ce.jsx("p",{children:a})})},Sc=({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=me.useRef(null);return me.useEffect(()=>{if(!c.current)return;const h=c.current,d=h.getTotalLength();h.style.strokeDasharray=`${n} ${r}`,h.style.strokeDashoffset=i==="clockwise"?d:0;let u,p=i==="clockwise"?d:0;const _=i==="clockwise"?-e:e,v=()=>{p+=_,i==="clockwise"?p<=-(n+r)&&(p=0):p>=n+r&&(p=0),h.style.strokeDashoffset=p,u=requestAnimationFrame(v)};return u=requestAnimationFrame(v),()=>{u&&cancelAnimationFrame(u)}},[i,e,n,r]),ce.jsx("svg",{width:s+o*2,height:a+o*2,className:"overflow-visible",children:ce.jsx(Et.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}})})},Ec=({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 ce.jsxs("div",{className:Yl("relative h-full w-full p-1",s),children:[ce.jsx(Et.motion.div,{initial:{opacity:0},animate:{opacity:1},transition:{duration:.2},className:"size-full",children:ce.jsx(Et.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"})}),ce.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`}})]})},yc=({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:h=0,fontSize:d,fontFamily:u})=>{const[p,_]=me.useState(!1),v=Et.useMotionValue(0),m=me.useRef(0),f=me.useRef(null),b=me.useRef(c==="left"?1:-1),x=t*1e3,D=h*1e3;Et.useAnimationFrame(M=>{if(e||p){f.current=null;return}if(f.current===null){f.current=M;return}const N=M-f.current;if(f.current=M,m.current+=N,o){const I=x+D,C=I*2,z=m.current%C;if(z<x){const V=z/x*100;v.set(b.current===1?V:100-V)}else if(z<I)v.set(b.current===1?100:0);else if(z<I+x){const q=100-(z-I)/x*100;v.set(b.current===1?q:100-q)}else v.set(b.current===1?0:100)}else{const I=x+D,C=m.current%I;if(C<x){const z=C/x*100;v.set(b.current===1?z:100-z)}else v.set(b.current===1?100:0)}}),me.useEffect(()=>{b.current=c==="left"?1:-1,m.current=0,v.set(0)},[c]);const P=Et.useTransform(v,M=>`${150-M*2}% center`),T=me.useCallback(()=>{l&&_(!0)},[l]),w=me.useCallback(()=>{l&&_(!1)},[l]),E={...{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:P,...d&&{fontSize:d},...u&&{fontFamily:u}};return ce.jsx(Et.motion.span,{className:`inline-block ${n}`,style:E,onMouseEnter:T,onMouseLeave:w,children:i})};const Vs="163",Hn={ROTATE:0,DOLLY:1,PAN:2},Vn={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},bc=0,ga=1,Dc=2,tl=1,Tc=2,Jt=3,vn=0,Mt=1,Wt=2,en=0,li=1,ci=2,_a=3,va=4,Ac=5,Cn=100,wc=101,Cc=102,Rc=103,Pc=104,Lc=200,Fc=201,Uc=202,Nc=203,Ps=204,Ls=205,Ic=206,Oc=207,Bc=208,zc=209,kc=210,Hc=211,Vc=212,Gc=213,Wc=214,Xc=0,Yc=1,jc=2,br=3,qc=4,$c=5,Kc=6,Zc=7,nl=0,Jc=1,Qc=2,mn=0,eu=1,tu=2,nu=3,Gs=4,iu=5,ru=6,su=7,il=300,fi=301,pi=302,Fs=303,Us=304,Lr=306,Ns=1e3,Ln=1001,Is=1002,Nt=1003,au=1004,Wi=1005,zt=1006,Gr=1007,Fn=1008,gn=1009,ou=1010,lu=1011,rl=1012,sl=1013,mi=1014,pn=1015,_n=1016,al=1017,ol=1018,Ii=1020,cu=35902,uu=1021,hu=1022,Xt=1023,du=1024,fu=1025,ui=1026,Fi=1027,pu=1028,ll=1029,mu=1030,cl=1031,ul=1033,Wr=33776,Xr=33777,Yr=33778,jr=33779,xa=35840,Ma=35841,Sa=35842,Ea=35843,hl=36196,ya=37492,ba=37496,Da=37808,Ta=37809,Aa=37810,wa=37811,Ca=37812,Ra=37813,Pa=37814,La=37815,Fa=37816,Ua=37817,Na=37818,Ia=37819,Oa=37820,Ba=37821,qr=36492,za=36494,ka=36495,gu=36283,Ha=36284,Va=36285,Ga=36286,_u=3200,vu=3201,xu=0,Mu=1,fn="",Ut="srgb",xn="srgb-linear",Ws="display-p3",Fr="display-p3-linear",Dr="linear",Ke="srgb",Tr="rec709",Ar="p3",Gn=7680,Wa=519,Su=512,Eu=513,yu=514,dl=515,bu=516,Du=517,Tu=518,Au=519,Xa=35044,Ya="300 es",Qt=2e3,wr=2001;class In{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 ja=1234567;const hi=Math.PI/180,Ui=180/Math.PI;function _i(){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 Xs(i,e){return(i%e+e)%e}function wu(i,e,t,n,r){return n+(i-e)*(r-n)/(t-e)}function Cu(i,e,t){return i!==e?(t-i)/(e-i):0}function Ci(i,e,t){return(1-t)*i+t*e}function Ru(i,e,t,n){return Ci(i,e,1-Math.exp(-t*n))}function Pu(i,e=1){return e-Math.abs(Xs(i,e*2)-e)}function Lu(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*(3-2*i))}function Fu(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*i*(i*(i*6-15)+10))}function Uu(i,e){return i+Math.floor(Math.random()*(e-i+1))}function Nu(i,e){return i+Math.random()*(e-i)}function Iu(i){return i*(.5-Math.random())}function Ou(i){i!==void 0&&(ja=i);let e=ja+=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 Bu(i){return i*hi}function zu(i){return i*Ui}function ku(i){return(i&i-1)===0&&i!==0}function Hu(i){return Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))}function Vu(i){return Math.pow(2,Math.floor(Math.log(i)/Math.LN2))}function Gu(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),h=a((e+n)/2),d=s((e-n)/2),u=a((e-n)/2),p=s((n-e)/2),_=a((n-e)/2);switch(r){case"XYX":i.set(o*h,l*d,l*u,o*c);break;case"YZY":i.set(l*u,o*h,l*d,o*c);break;case"ZXZ":i.set(l*d,l*u,o*h,o*c);break;case"XZX":i.set(o*h,l*_,l*p,o*c);break;case"YXY":i.set(l*p,o*h,l*_,o*c);break;case"ZYZ":i.set(l*_,l*p,o*h,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 vt(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 fl={DEG2RAD:hi,RAD2DEG:Ui,generateUUID:_i,clamp:ht,euclideanModulo:Xs,mapLinear:wu,inverseLerp:Cu,lerp:Ci,damp:Ru,pingpong:Pu,smoothstep:Lu,smootherstep:Fu,randInt:Uu,randFloat:Nu,randFloatSpread:Iu,seededRandom:Ou,degToRad:Bu,radToDeg:zu,isPowerOfTwo:ku,ceilPowerOfTwo:Hu,floorPowerOfTwo:Vu,setQuaternionFromProperEuler:Gu,normalize:vt,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 h=this.elements;return h[0]=e,h[1]=r,h[2]=o,h[3]=t,h[4]=s,h[5]=l,h[6]=n,h[7]=a,h[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],h=n[4],d=n[7],u=n[2],p=n[5],_=n[8],v=r[0],m=r[3],f=r[6],b=r[1],x=r[4],D=r[7],P=r[2],T=r[5],w=r[8];return s[0]=a*v+o*b+l*P,s[3]=a*m+o*x+l*T,s[6]=a*f+o*D+l*w,s[1]=c*v+h*b+d*P,s[4]=c*m+h*x+d*T,s[7]=c*f+h*D+d*w,s[2]=u*v+p*b+_*P,s[5]=u*m+p*x+_*T,s[8]=u*f+p*D+_*w,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],h=e[8];return t*a*h-t*o*c-n*s*h+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],h=e[8],d=h*a-o*c,u=o*l-h*s,p=c*s-a*l,_=t*d+n*u+r*p;if(_===0)return this.set(0,0,0,0,0,0,0,0,0);const v=1/_;return e[0]=d*v,e[1]=(r*c-h*n)*v,e[2]=(o*n-r*a)*v,e[3]=u*v,e[4]=(h*t-r*l)*v,e[5]=(r*s-o*t)*v,e[6]=p*v,e[7]=(n*l-c*t)*v,e[8]=(a*t-n*s)*v,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($r.makeScale(e,t)),this}rotate(e){return this.premultiply($r.makeRotation(-e)),this}translate(e,t){return this.premultiply($r.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 $r=new Be;function pl(i){for(let e=i.length-1;e>=0;--e)if(i[e]>=65535)return!0;return!1}function Cr(i){return document.createElementNS("http://www.w3.org/1999/xhtml",i)}function Wu(){const i=Cr("canvas");return i.style.display="block",i}const qa={};function Xu(i){i in qa||(qa[i]=!0,console.warn(i))}const $a=new Be().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),Ka=new Be().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),Xi={[xn]:{transfer:Dr,primaries:Tr,toReference:i=>i,fromReference:i=>i},[Ut]:{transfer:Ke,primaries:Tr,toReference:i=>i.convertSRGBToLinear(),fromReference:i=>i.convertLinearToSRGB()},[Fr]:{transfer:Dr,primaries:Ar,toReference:i=>i.applyMatrix3(Ka),fromReference:i=>i.applyMatrix3($a)},[Ws]:{transfer:Ke,primaries:Ar,toReference:i=>i.convertSRGBToLinear().applyMatrix3(Ka),fromReference:i=>i.applyMatrix3($a).convertLinearToSRGB()}},Yu=new Set([xn,Fr]),$e={enabled:!0,_workingColorSpace:xn,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(i){if(!Yu.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=Xi[e].toReference,r=Xi[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 Xi[i].primaries},getTransfer:function(i){return i===fn?Dr:Xi[i].transfer}};function di(i){return i<.04045?i*.0773993808:Math.pow(i*.9478672986+.0521327014,2.4)}function Kr(i){return i<.0031308?i*12.92:1.055*Math.pow(i,.41666)-.055}let Wn;class ju{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=Cr("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=Cr("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]=di(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(di(t[n]/255)*255):t[n]=di(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 qu=0;class ml{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:qu++}),this.uuid=_i(),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(Zr(r[a].image)):s.push(Zr(r[a]))}else s=Zr(r);n.url=s}return t||(e.images[this.uuid]=n),n}}function Zr(i){return typeof HTMLImageElement<"u"&&i instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&i instanceof ImageBitmap?ju.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 $u=0;class Dt extends In{constructor(e=Dt.DEFAULT_IMAGE,t=Dt.DEFAULT_MAPPING,n=Ln,r=Ln,s=zt,a=Fn,o=Xt,l=gn,c=Dt.DEFAULT_ANISOTROPY,h=fn){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:$u++}),this.uuid=_i(),this.name="",this.source=new ml(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=h,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!==il)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Ns:e.x=e.x-Math.floor(e.x);break;case Ln:e.x=e.x<0?0:1;break;case Is: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 Ns:e.y=e.y-Math.floor(e.y);break;case Ln:e.y=e.y<0?0:1;break;case Is: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++}}Dt.DEFAULT_IMAGE=null;Dt.DEFAULT_MAPPING=il;Dt.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],h=l[4],d=l[8],u=l[1],p=l[5],_=l[9],v=l[2],m=l[6],f=l[10];if(Math.abs(h-u)<.01&&Math.abs(d-v)<.01&&Math.abs(_-m)<.01){if(Math.abs(h+u)<.1&&Math.abs(d+v)<.1&&Math.abs(_+m)<.1&&Math.abs(c+p+f-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const x=(c+1)/2,D=(p+1)/2,P=(f+1)/2,T=(h+u)/4,w=(d+v)/4,L=(_+m)/4;return x>D&&x>P?x<.01?(n=0,r=.707106781,s=.707106781):(n=Math.sqrt(x),r=T/n,s=w/n):D>P?D<.01?(n=.707106781,r=0,s=.707106781):(r=Math.sqrt(D),n=T/r,s=L/r):P<.01?(n=.707106781,r=.707106781,s=0):(s=Math.sqrt(P),n=w/s,r=L/s),this.set(n,r,s,t),this}let b=Math.sqrt((m-_)*(m-_)+(d-v)*(d-v)+(u-h)*(u-h));return Math.abs(b)<.001&&(b=1),this.x=(m-_)/b,this.y=(d-v)/b,this.z=(u-h)/b,this.w=Math.acos((c+p+f-1)/2),this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){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 Ku extends In{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 Dt(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 ml(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 Ku{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}}class gl extends Dt{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=Ln,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Zu extends Dt{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=Ln,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Un{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],h=n[r+2],d=n[r+3];const u=s[a+0],p=s[a+1],_=s[a+2],v=s[a+3];if(o===0){e[t+0]=l,e[t+1]=c,e[t+2]=h,e[t+3]=d;return}if(o===1){e[t+0]=u,e[t+1]=p,e[t+2]=_,e[t+3]=v;return}if(d!==v||l!==u||c!==p||h!==_){let m=1-o;const f=l*u+c*p+h*_+d*v,b=f>=0?1:-1,x=1-f*f;if(x>Number.EPSILON){const P=Math.sqrt(x),T=Math.atan2(P,f*b);m=Math.sin(m*T)/P,o=Math.sin(o*T)/P}const D=o*b;if(l=l*m+u*D,c=c*m+p*D,h=h*m+_*D,d=d*m+v*D,m===1-o){const P=1/Math.sqrt(l*l+c*c+h*h+d*d);l*=P,c*=P,h*=P,d*=P}}e[t]=l,e[t+1]=c,e[t+2]=h,e[t+3]=d}static multiplyQuaternionsFlat(e,t,n,r,s,a){const o=n[r],l=n[r+1],c=n[r+2],h=n[r+3],d=s[a],u=s[a+1],p=s[a+2],_=s[a+3];return e[t]=o*_+h*d+l*p-c*u,e[t+1]=l*_+h*u+c*d-o*p,e[t+2]=c*_+h*p+o*u-l*d,e[t+3]=h*_-o*d-l*u-c*p,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),h=o(r/2),d=o(s/2),u=l(n/2),p=l(r/2),_=l(s/2);switch(a){case"XYZ":this._x=u*h*d+c*p*_,this._y=c*p*d-u*h*_,this._z=c*h*_+u*p*d,this._w=c*h*d-u*p*_;break;case"YXZ":this._x=u*h*d+c*p*_,this._y=c*p*d-u*h*_,this._z=c*h*_-u*p*d,this._w=c*h*d+u*p*_;break;case"ZXY":this._x=u*h*d-c*p*_,this._y=c*p*d+u*h*_,this._z=c*h*_+u*p*d,this._w=c*h*d-u*p*_;break;case"ZYX":this._x=u*h*d-c*p*_,this._y=c*p*d+u*h*_,this._z=c*h*_-u*p*d,this._w=c*h*d+u*p*_;break;case"YZX":this._x=u*h*d+c*p*_,this._y=c*p*d+u*h*_,this._z=c*h*_-u*p*d,this._w=c*h*d-u*p*_;break;case"XZY":this._x=u*h*d-c*p*_,this._y=c*p*d-u*h*_,this._z=c*h*_+u*p*d,this._w=c*h*d+u*p*_;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],h=t[6],d=t[10],u=n+o+d;if(u>0){const p=.5/Math.sqrt(u+1);this._w=.25/p,this._x=(h-l)*p,this._y=(s-c)*p,this._z=(a-r)*p}else if(n>o&&n>d){const p=2*Math.sqrt(1+n-o-d);this._w=(h-l)/p,this._x=.25*p,this._y=(r+a)/p,this._z=(s+c)/p}else if(o>d){const p=2*Math.sqrt(1+o-n-d);this._w=(s-c)/p,this._x=(r+a)/p,this._y=.25*p,this._z=(l+h)/p}else{const p=2*Math.sqrt(1+d-n-o);this._w=(a-r)/p,this._x=(s+c)/p,this._y=(l+h)/p,this._z=.25*p}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,h=t._w;return this._x=n*h+a*o+r*c-s*l,this._y=r*h+a*l+s*o-n*c,this._z=s*h+a*c+n*l-r*o,this._w=a*h-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 p=1-t;return this._w=p*a+t*this._w,this._x=p*n+t*this._x,this._y=p*r+t*this._y,this._z=p*s+t*this._z,this.normalize(),this}const c=Math.sqrt(l),h=Math.atan2(c,o),d=Math.sin((1-t)*h)/c,u=Math.sin(t*h)/c;return this._w=a*d+this._w*u,this._x=n*d+this._x*u,this._y=r*d+this._y*u,this._z=s*d+this._z*u,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 R{constructor(e=0,t=0,n=0){R.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(Za.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Za.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),h=2*(o*t-s*r),d=2*(s*n-a*t);return this.x=t+l*c+a*d-o*h,this.y=n+l*h+o*c-s*d,this.z=r+l*d+s*h-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 Jr.copy(this).projectOnVector(e),this.sub(Jr)}reflect(e){return this.sub(Jr.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 Jr=new R,Za=new Un;class Oi{constructor(e=new R(1/0,1/0,1/0),t=new R(-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(It.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(It.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=It.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,It):It.fromBufferAttribute(s,a),It.applyMatrix4(e.matrixWorld),this.expandByPoint(It);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,It),It.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(bi),ji.subVectors(this.max,bi),Xn.subVectors(e.a,bi),Yn.subVectors(e.b,bi),jn.subVectors(e.c,bi),an.subVectors(Yn,Xn),on.subVectors(jn,Yn),En.subVectors(Xn,jn);let t=[0,-an.z,an.y,0,-on.z,on.y,0,-En.z,En.y,an.z,0,-an.x,on.z,0,-on.x,En.z,0,-En.x,-an.y,an.x,0,-on.y,on.x,0,-En.y,En.x,0];return!Qr(t,Xn,Yn,jn,ji)||(t=[1,0,0,0,1,0,0,0,1],!Qr(t,Xn,Yn,jn,ji))?!1:(qi.crossVectors(an,on),t=[qi.x,qi.y,qi.z],Qr(t,Xn,Yn,jn,ji))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,It).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(It).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 R,new R,new R,new R,new R,new R,new R,new R],It=new R,Yi=new Oi,Xn=new R,Yn=new R,jn=new R,an=new R,on=new R,En=new R,bi=new R,ji=new R,qi=new R,yn=new R;function Qr(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),h=n.dot(yn);if(Math.max(-Math.max(l,c,h),Math.min(l,c,h))>o)return!1}return!0}const Ju=new Oi,Di=new R,es=new R;class Bi{constructor(e=new R,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):Ju.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):(es.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Di.copy(e.center).add(es)),this.expandByPoint(Di.copy(e.center).sub(es))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const qt=new R,ts=new R,$i=new R,ln=new R,ns=new R,Ki=new R,is=new R;class Ur{constructor(e=new R,t=new R(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,qt)),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=qt.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(qt.copy(this.origin).addScaledVector(this.direction,t),qt.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){ts.copy(e).add(t).multiplyScalar(.5),$i.copy(t).sub(e).normalize(),ln.copy(this.origin).sub(ts);const s=e.distanceTo(t)*.5,a=-this.direction.dot($i),o=ln.dot(this.direction),l=-ln.dot($i),c=ln.lengthSq(),h=Math.abs(1-a*a);let d,u,p,_;if(h>0)if(d=a*l-o,u=a*o-l,_=s*h,d>=0)if(u>=-_)if(u<=_){const v=1/h;d*=v,u*=v,p=d*(d+a*u+2*o)+u*(a*d+u+2*l)+c}else u=s,d=Math.max(0,-(a*u+o)),p=-d*d+u*(u+2*l)+c;else u=-s,d=Math.max(0,-(a*u+o)),p=-d*d+u*(u+2*l)+c;else u<=-_?(d=Math.max(0,-(-a*s+o)),u=d>0?-s:Math.min(Math.max(-s,-l),s),p=-d*d+u*(u+2*l)+c):u<=_?(d=0,u=Math.min(Math.max(-s,-l),s),p=u*(u+2*l)+c):(d=Math.max(0,-(a*s+o)),u=d>0?s:Math.min(Math.max(-s,-l),s),p=-d*d+u*(u+2*l)+c);else u=a>0?-s:s,d=Math.max(0,-(a*u+o)),p=-d*d+u*(u+2*l)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,d),r&&r.copy(ts).addScaledVector($i,u),p}intersectSphere(e,t){qt.subVectors(e.center,this.origin);const n=qt.dot(this.direction),r=qt.dot(qt)-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,h=1/this.direction.y,d=1/this.direction.z,u=this.origin;return c>=0?(n=(e.min.x-u.x)*c,r=(e.max.x-u.x)*c):(n=(e.max.x-u.x)*c,r=(e.min.x-u.x)*c),h>=0?(s=(e.min.y-u.y)*h,a=(e.max.y-u.y)*h):(s=(e.max.y-u.y)*h,a=(e.min.y-u.y)*h),n>a||s>r||((s>n||isNaN(n))&&(n=s),(a<r||isNaN(r))&&(r=a),d>=0?(o=(e.min.z-u.z)*d,l=(e.max.z-u.z)*d):(o=(e.max.z-u.z)*d,l=(e.min.z-u.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,qt)!==null}intersectTriangle(e,t,n,r,s){ns.subVectors(t,e),Ki.subVectors(n,e),is.crossVectors(ns,Ki);let a=this.direction.dot(is),o;if(a>0){if(r)return null;o=1}else if(a<0)o=-1,a=-a;else return null;ln.subVectors(this.origin,e);const l=o*this.direction.dot(Ki.crossVectors(ln,Ki));if(l<0)return null;const c=o*this.direction.dot(ns.cross(ln));if(c<0||l+c>a)return null;const h=-o*ln.dot(is);return h<0?null:this.at(h/a,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class et{constructor(e,t,n,r,s,a,o,l,c,h,d,u,p,_,v,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,h,d,u,p,_,v,m)}set(e,t,n,r,s,a,o,l,c,h,d,u,p,_,v,m){const f=this.elements;return f[0]=e,f[4]=t,f[8]=n,f[12]=r,f[1]=s,f[5]=a,f[9]=o,f[13]=l,f[2]=c,f[6]=h,f[10]=d,f[14]=u,f[3]=p,f[7]=_,f[11]=v,f[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/qn.setFromMatrixColumn(e,0).length(),s=1/qn.setFromMatrixColumn(e,1).length(),a=1/qn.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),h=Math.cos(s),d=Math.sin(s);if(e.order==="XYZ"){const u=a*h,p=a*d,_=o*h,v=o*d;t[0]=l*h,t[4]=-l*d,t[8]=c,t[1]=p+_*c,t[5]=u-v*c,t[9]=-o*l,t[2]=v-u*c,t[6]=_+p*c,t[10]=a*l}else if(e.order==="YXZ"){const u=l*h,p=l*d,_=c*h,v=c*d;t[0]=u+v*o,t[4]=_*o-p,t[8]=a*c,t[1]=a*d,t[5]=a*h,t[9]=-o,t[2]=p*o-_,t[6]=v+u*o,t[10]=a*l}else if(e.order==="ZXY"){const u=l*h,p=l*d,_=c*h,v=c*d;t[0]=u-v*o,t[4]=-a*d,t[8]=_+p*o,t[1]=p+_*o,t[5]=a*h,t[9]=v-u*o,t[2]=-a*c,t[6]=o,t[10]=a*l}else if(e.order==="ZYX"){const u=a*h,p=a*d,_=o*h,v=o*d;t[0]=l*h,t[4]=_*c-p,t[8]=u*c+v,t[1]=l*d,t[5]=v*c+u,t[9]=p*c-_,t[2]=-c,t[6]=o*l,t[10]=a*l}else if(e.order==="YZX"){const u=a*l,p=a*c,_=o*l,v=o*c;t[0]=l*h,t[4]=v-u*d,t[8]=_*d+p,t[1]=d,t[5]=a*h,t[9]=-o*h,t[2]=-c*h,t[6]=p*d+_,t[10]=u-v*d}else if(e.order==="XZY"){const u=a*l,p=a*c,_=o*l,v=o*c;t[0]=l*h,t[4]=-d,t[8]=c*h,t[1]=u*d+v,t[5]=a*h,t[9]=p*d-_,t[2]=_*d-p,t[6]=o*h,t[10]=v*d+u}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(Qu,e,eh)}lookAt(e,t,n){const r=this.elements;return wt.subVectors(e,t),wt.lengthSq()===0&&(wt.z=1),wt.normalize(),cn.crossVectors(n,wt),cn.lengthSq()===0&&(Math.abs(n.z)===1?wt.x+=1e-4:wt.z+=1e-4,wt.normalize(),cn.crossVectors(n,wt)),cn.normalize(),Zi.crossVectors(wt,cn),r[0]=cn.x,r[4]=Zi.x,r[8]=wt.x,r[1]=cn.y,r[5]=Zi.y,r[9]=wt.y,r[2]=cn.z,r[6]=Zi.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],h=n[1],d=n[5],u=n[9],p=n[13],_=n[2],v=n[6],m=n[10],f=n[14],b=n[3],x=n[7],D=n[11],P=n[15],T=r[0],w=r[4],L=r[8],E=r[12],M=r[1],N=r[5],I=r[9],C=r[13],z=r[2],V=r[6],q=r[10],ee=r[14],B=r[3],$=r[7],j=r[11],F=r[15];return s[0]=a*T+o*M+l*z+c*B,s[4]=a*w+o*N+l*V+c*$,s[8]=a*L+o*I+l*q+c*j,s[12]=a*E+o*C+l*ee+c*F,s[1]=h*T+d*M+u*z+p*B,s[5]=h*w+d*N+u*V+p*$,s[9]=h*L+d*I+u*q+p*j,s[13]=h*E+d*C+u*ee+p*F,s[2]=_*T+v*M+m*z+f*B,s[6]=_*w+v*N+m*V+f*$,s[10]=_*L+v*I+m*q+f*j,s[14]=_*E+v*C+m*ee+f*F,s[3]=b*T+x*M+D*z+P*B,s[7]=b*w+x*N+D*V+P*$,s[11]=b*L+x*I+D*q+P*j,s[15]=b*E+x*C+D*ee+P*F,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],h=e[2],d=e[6],u=e[10],p=e[14],_=e[3],v=e[7],m=e[11],f=e[15];return _*(+s*l*d-r*c*d-s*o*u+n*c*u+r*o*p-n*l*p)+v*(+t*l*p-t*c*u+s*a*u-r*a*p+r*c*h-s*l*h)+m*(+t*c*d-t*o*p-s*a*d+n*a*p+s*o*h-n*c*h)+f*(-r*o*h-t*l*d+t*o*u+r*a*d-n*a*u+n*l*h)}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],h=e[8],d=e[9],u=e[10],p=e[11],_=e[12],v=e[13],m=e[14],f=e[15],b=d*m*c-v*u*c+v*l*p-o*m*p-d*l*f+o*u*f,x=_*u*c-h*m*c-_*l*p+a*m*p+h*l*f-a*u*f,D=h*v*c-_*d*c+_*o*p-a*v*p-h*o*f+a*d*f,P=_*d*l-h*v*l-_*o*u+a*v*u+h*o*m-a*d*m,T=t*b+n*x+r*D+s*P;if(T===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const w=1/T;return e[0]=b*w,e[1]=(v*u*s-d*m*s-v*r*p+n*m*p+d*r*f-n*u*f)*w,e[2]=(o*m*s-v*l*s+v*r*c-n*m*c-o*r*f+n*l*f)*w,e[3]=(d*l*s-o*u*s-d*r*c+n*u*c+o*r*p-n*l*p)*w,e[4]=x*w,e[5]=(h*m*s-_*u*s+_*r*p-t*m*p-h*r*f+t*u*f)*w,e[6]=(_*l*s-a*m*s-_*r*c+t*m*c+a*r*f-t*l*f)*w,e[7]=(a*u*s-h*l*s+h*r*c-t*u*c-a*r*p+t*l*p)*w,e[8]=D*w,e[9]=(_*d*s-h*v*s-_*n*p+t*v*p+h*n*f-t*d*f)*w,e[10]=(a*v*s-_*o*s+_*n*c-t*v*c-a*n*f+t*o*f)*w,e[11]=(h*o*s-a*d*s-h*n*c+t*d*c+a*n*p-t*o*p)*w,e[12]=P*w,e[13]=(h*v*r-_*d*r+_*n*u-t*v*u-h*n*m+t*d*m)*w,e[14]=(_*o*r-a*v*r-_*n*l+t*v*l+a*n*m-t*o*m)*w,e[15]=(a*d*r-h*o*r+h*n*l-t*d*l-a*n*u+t*o*u)*w,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,h=s*o;return this.set(c*a+n,c*o-r*l,c*l+r*o,0,c*o+r*l,h*o+n,h*l-r*a,0,c*l-r*o,h*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,h=a+a,d=o+o,u=s*c,p=s*h,_=s*d,v=a*h,m=a*d,f=o*d,b=l*c,x=l*h,D=l*d,P=n.x,T=n.y,w=n.z;return r[0]=(1-(v+f))*P,r[1]=(p+D)*P,r[2]=(_-x)*P,r[3]=0,r[4]=(p-D)*T,r[5]=(1-(u+f))*T,r[6]=(m+b)*T,r[7]=0,r[8]=(_+x)*w,r[9]=(m-b)*w,r[10]=(1-(u+v))*w,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=qn.set(r[0],r[1],r[2]).length();const a=qn.set(r[4],r[5],r[6]).length(),o=qn.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,h=1/a,d=1/o;return Ot.elements[0]*=c,Ot.elements[1]*=c,Ot.elements[2]*=c,Ot.elements[4]*=h,Ot.elements[5]*=h,Ot.elements[6]*=h,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),h=2*s/(n-r),d=(t+e)/(t-e),u=(n+r)/(n-r);let p,_;if(o===Qt)p=-(a+s)/(a-s),_=-2*a*s/(a-s);else if(o===wr)p=-a/(a-s),_=-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]=h,l[9]=u,l[13]=0,l[2]=0,l[6]=0,l[10]=p,l[14]=_,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),h=1/(n-r),d=1/(a-s),u=(t+e)*c,p=(n+r)*h;let _,v;if(o===Qt)_=(a+s)*d,v=-2*d;else if(o===wr)_=s*d,v=-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]=-u,l[1]=0,l[5]=2*h,l[9]=0,l[13]=-p,l[2]=0,l[6]=0,l[10]=v,l[14]=-_,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 qn=new R,Ot=new et,Qu=new R(0,0,0),eh=new R(1,1,1),cn=new R,Zi=new R,wt=new R,Ja=new et,Qa=new Un;class tn{constructor(e=0,t=0,n=0,r=tn.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],h=r[9],d=r[2],u=r[6],p=r[10];switch(t){case"XYZ":this._y=Math.asin(ht(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-h,p),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(u,c),this._z=0);break;case"YXZ":this._x=Math.asin(-ht(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(o,p),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-d,s),this._z=0);break;case"ZXY":this._x=Math.asin(ht(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(-d,p),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(u,p),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(-h,c),this._y=Math.atan2(-d,s)):(this._x=0,this._y=Math.atan2(o,p));break;case"XZY":this._z=Math.asin(-ht(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(u,c),this._y=Math.atan2(o,s)):(this._x=Math.atan2(-h,p),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 Ja.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Ja,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return Qa.setFromEuler(this),this.setFromQuaternion(Qa,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}}tn.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 th=0;const eo=new R,$n=new Un,$t=new et,Ji=new R,Ti=new R,nh=new R,ih=new Un,to=new R(1,0,0),no=new R(0,1,0),io=new R(0,0,1),ro={type:"added"},rh={type:"removed"},Kn={type:"childadded",child:null},rs={type:"childremoved",child:null};class St extends In{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:th++}),this.uuid=_i(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=St.DEFAULT_UP.clone();const e=new R,t=new tn,n=new Un,r=new R(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 $n.setFromAxisAngle(e,t),this.quaternion.multiply($n),this}rotateOnWorldAxis(e,t){return $n.setFromAxisAngle(e,t),this.quaternion.premultiply($n),this}rotateX(e){return this.rotateOnAxis(to,e)}rotateY(e){return this.rotateOnAxis(no,e)}rotateZ(e){return this.rotateOnAxis(io,e)}translateOnAxis(e,t){return eo.copy(e).applyQuaternion(this.quaternion),this.position.add(eo.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(to,e)}translateY(e){return this.translateOnAxis(no,e)}translateZ(e){return this.translateOnAxis(io,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4($t.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?Ji.copy(e):Ji.set(e,t,n);const r=this.parent;this.updateWorldMatrix(!0,!1),Ti.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?$t.lookAt(Ti,Ji,this.up):$t.lookAt(Ji,Ti,this.up),this.quaternion.setFromRotationMatrix($t),r&&($t.extractRotation(r.matrixWorld),$n.setFromRotationMatrix($t),this.quaternion.premultiply($n.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(ro),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(rh),rs.child=e,this.dispatchEvent(rs),rs.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),$t.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),$t.multiply(e.parent.matrixWorld)),e.applyMatrix4($t),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(ro),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(Ti,e,nh),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Ti,ih,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,h=l.length;c<h;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),h=a(e.images),d=a(e.shapes),u=a(e.skeletons),p=a(e.animations),_=a(e.nodes);o.length>0&&(n.geometries=o),l.length>0&&(n.materials=l),c.length>0&&(n.textures=c),h.length>0&&(n.images=h),d.length>0&&(n.shapes=d),u.length>0&&(n.skeletons=u),p.length>0&&(n.animations=p),_.length>0&&(n.nodes=_)}return n.object=r,n;function a(o){const l=[];for(const c in o){const h=o[c];delete h.metadata,l.push(h)}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 R(0,1,0);St.DEFAULT_MATRIX_AUTO_UPDATE=!0;St.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const Bt=new R,Kt=new R,ss=new R,Zt=new R,Zn=new R,Jn=new R,so=new R,as=new R,os=new R,ls=new R;class kt{constructor(e=new R,t=new R,n=new R){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),ss.subVectors(e,t);const a=Bt.dot(Bt),o=Bt.dot(Kt),l=Bt.dot(ss),c=Kt.dot(Kt),h=Kt.dot(ss),d=a*c-o*o;if(d===0)return s.set(0,0,0),null;const u=1/d,p=(c*l-o*h)*u,_=(a*h-o*l)*u;return s.set(1-p-_,_,p)}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 kt.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return kt.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,r,s){return kt.getInterpolation(e,this.a,this.b,this.c,t,n,r,s)}containsPoint(e){return kt.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return kt.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),as.subVectors(e,n);const l=Zn.dot(as),c=Jn.dot(as);if(l<=0&&c<=0)return t.copy(n);os.subVectors(e,r);const h=Zn.dot(os),d=Jn.dot(os);if(h>=0&&d<=h)return t.copy(r);const u=l*d-h*c;if(u<=0&&l>=0&&h<=0)return a=l/(l-h),t.copy(n).addScaledVector(Zn,a);ls.subVectors(e,s);const p=Zn.dot(ls),_=Jn.dot(ls);if(_>=0&&p<=_)return t.copy(s);const v=p*c-l*_;if(v<=0&&c>=0&&_<=0)return o=c/(c-_),t.copy(n).addScaledVector(Jn,o);const m=h*_-p*d;if(m<=0&&d-h>=0&&p-_>=0)return so.subVectors(s,r),o=(d-h)/(d-h+(p-_)),t.copy(r).addScaledVector(so,o);const f=1/(m+v+u);return a=v*f,o=u*f,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 vl={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},un={h:0,s:0,l:0},Qi={h:0,s:0,l:0};function cs(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}class be{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=Ut){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,$e.toWorkingColorSpace(this,t),this}setRGB(e,t,n,r=$e.workingColorSpace){return this.r=e,this.g=t,this.b=n,$e.toWorkingColorSpace(this,r),this}setHSL(e,t,n,r=$e.workingColorSpace){if(e=Xs(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=cs(a,s,e+1/3),this.g=cs(a,s,e),this.b=cs(a,s,e-1/3)}return $e.toWorkingColorSpace(this,r),this}setStyle(e,t=Ut){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=Ut){const n=vl[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=di(e.r),this.g=di(e.g),this.b=di(e.b),this}copyLinearToSRGB(e){return this.r=Kr(e.r),this.g=Kr(e.g),this.b=Kr(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Ut){return $e.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=Ut){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=$e.workingColorSpace){$e.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 h=(o+a)/2;if(o===a)l=0,c=0;else{const d=a-o;switch(c=h<=.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=h,e}getRGB(e,t=$e.workingColorSpace){return $e.fromWorkingColorSpace(gt.copy(this),t),e.r=gt.r,e.g=gt.g,e.b=gt.b,e}getStyle(e=Ut){$e.fromWorkingColorSpace(gt.copy(this),e);const t=gt.r,n=gt.g,r=gt.b;return e!==Ut?`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(un),this.setHSL(un.h+e,un.s+t,un.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(un),e.getHSL(Qi);const n=Ci(un.h,Qi.h,t),r=Ci(un.s,Qi.s,t),s=Ci(un.l,Qi.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=vl;let sh=0;class vi extends In{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:sh++}),this.uuid=_i(),this.name="",this.type="Material",this.blending=li,this.side=vn,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Ps,this.blendDst=Ls,this.blendEquation=Cn,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new be(0,0,0),this.blendAlpha=0,this.depthFunc=br,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Wa,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!==li&&(n.blending=this.blending),this.side!==vn&&(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!==Ps&&(n.blendSrc=this.blendSrc),this.blendDst!==Ls&&(n.blendDst=this.blendDst),this.blendEquation!==Cn&&(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!==br&&(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!==Wa&&(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 zi 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 tn,this.combine=nl,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 R,er=new ue;class yt{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=Xa,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=pn,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}get updateRange(){return Xu("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++)er.fromBufferAttribute(this,t),er.applyMatrix3(e),this.setXY(t,er.x,er.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=vt(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=vt(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=vt(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=vt(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=vt(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=vt(t,this.array),n=vt(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=vt(t,this.array),n=vt(n,this.array),r=vt(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=vt(t,this.array),n=vt(n,this.array),r=vt(r,this.array),s=vt(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!==Xa&&(e.usage=this.usage),e}}class xl extends yt{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class Ml extends yt{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class nt extends yt{constructor(e,t,n){super(new Float32Array(e),t,n)}}let ah=0;const Ft=new et,us=new St,Qn=new R,Ct=new Oi,Ai=new Oi,ut=new R;class _t extends In{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:ah++}),this.uuid=_i(),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(pl(e)?Ml:xl)(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 us.lookAt(e),us.updateMatrix(),this.applyMatrix4(us.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 Oi);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 R(-1/0,-1/0,-1/0),new R(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 Bi);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 R,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];Ai.setFromBufferAttribute(o),this.morphTargetsRelative?(ut.addVectors(Ct.min,Ai.min),Ct.expandByPoint(ut),ut.addVectors(Ct.max,Ai.max),Ct.expandByPoint(ut)):(Ct.expandByPoint(Ai.min),Ct.expandByPoint(Ai.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,h=o.count;c<h;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 yt(new Float32Array(4*n.count),4));const a=this.getAttribute("tangent"),o=[],l=[];for(let L=0;L<n.count;L++)o[L]=new R,l[L]=new R;const c=new R,h=new R,d=new R,u=new ue,p=new ue,_=new ue,v=new R,m=new R;function f(L,E,M){c.fromBufferAttribute(n,L),h.fromBufferAttribute(n,E),d.fromBufferAttribute(n,M),u.fromBufferAttribute(s,L),p.fromBufferAttribute(s,E),_.fromBufferAttribute(s,M),h.sub(c),d.sub(c),p.sub(u),_.sub(u);const N=1/(p.x*_.y-_.x*p.y);isFinite(N)&&(v.copy(h).multiplyScalar(_.y).addScaledVector(d,-p.y).multiplyScalar(N),m.copy(d).multiplyScalar(p.x).addScaledVector(h,-_.x).multiplyScalar(N),o[L].add(v),o[E].add(v),o[M].add(v),l[L].add(m),l[E].add(m),l[M].add(m))}let b=this.groups;b.length===0&&(b=[{start:0,count:e.count}]);for(let L=0,E=b.length;L<E;++L){const M=b[L],N=M.start,I=M.count;for(let C=N,z=N+I;C<z;C+=3)f(e.getX(C+0),e.getX(C+1),e.getX(C+2))}const x=new R,D=new R,P=new R,T=new R;function w(L){P.fromBufferAttribute(r,L),T.copy(P);const E=o[L];x.copy(E),x.sub(P.multiplyScalar(P.dot(E))).normalize(),D.crossVectors(T,E);const N=D.dot(l[L])<0?-1:1;a.setXYZW(L,x.x,x.y,x.z,N)}for(let L=0,E=b.length;L<E;++L){const M=b[L],N=M.start,I=M.count;for(let C=N,z=N+I;C<z;C+=3)w(e.getX(C+0)),w(e.getX(C+1)),w(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 yt(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let u=0,p=n.count;u<p;u++)n.setXYZ(u,0,0,0);const r=new R,s=new R,a=new R,o=new R,l=new R,c=new R,h=new R,d=new R;if(e)for(let u=0,p=e.count;u<p;u+=3){const _=e.getX(u+0),v=e.getX(u+1),m=e.getX(u+2);r.fromBufferAttribute(t,_),s.fromBufferAttribute(t,v),a.fromBufferAttribute(t,m),h.subVectors(a,s),d.subVectors(r,s),h.cross(d),o.fromBufferAttribute(n,_),l.fromBufferAttribute(n,v),c.fromBufferAttribute(n,m),o.add(h),l.add(h),c.add(h),n.setXYZ(_,o.x,o.y,o.z),n.setXYZ(v,l.x,l.y,l.z),n.setXYZ(m,c.x,c.y,c.z)}else for(let u=0,p=t.count;u<p;u+=3)r.fromBufferAttribute(t,u+0),s.fromBufferAttribute(t,u+1),a.fromBufferAttribute(t,u+2),h.subVectors(a,s),d.subVectors(r,s),h.cross(d),n.setXYZ(u+0,h.x,h.y,h.z),n.setXYZ(u+1,h.x,h.y,h.z),n.setXYZ(u+2,h.x,h.y,h.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,h=o.itemSize,d=o.normalized,u=new c.constructor(l.length*h);let p=0,_=0;for(let v=0,m=l.length;v<m;v++){o.isInterleavedBufferAttribute?p=l[v]*o.data.stride+o.offset:p=l[v]*h;for(let f=0;f<h;f++)u[_++]=c[p++]}return new yt(u,h,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 h=0,d=c.length;h<d;h++){const u=c[h],p=e(u,n);l.push(p)}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],h=[];for(let d=0,u=c.length;d<u;d++){const p=c[d];h.push(p.toJSON(e.data))}h.length>0&&(r[l]=h,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 h=r[c];this.setAttribute(c,h.clone(t))}const s=e.morphAttributes;for(const c in s){const h=[],d=s[c];for(let u=0,p=d.length;u<p;u++)h.push(d[u].clone(t));this.morphAttributes[c]=h}this.morphTargetsRelative=e.morphTargetsRelative;const a=e.groups;for(let c=0,h=a.length;c<h;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 ao=new et,bn=new Ur,tr=new Bi,oo=new R,ei=new R,ti=new R,ni=new R,hs=new R,nr=new R,ir=new ue,rr=new ue,sr=new ue,lo=new R,co=new R,uo=new R,ar=new R,or=new R;class bt extends St{constructor(e=new _t,t=new zi){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){nr.set(0,0,0);for(let l=0,c=s.length;l<c;l++){const h=o[l],d=s[l];h!==0&&(hs.fromBufferAttribute(d,e),a?nr.addScaledVector(hs,h):nr.addScaledVector(hs.sub(t),h))}t.add(nr)}return t}raycast(e,t){const n=this.geometry,r=this.material,s=this.matrixWorld;r!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),tr.copy(n.boundingSphere),tr.applyMatrix4(s),bn.copy(e.ray).recast(e.near),!(tr.containsPoint(bn.origin)===!1&&(bn.intersectSphere(tr,oo)===null||bn.origin.distanceToSquared(oo)>(e.far-e.near)**2))&&(ao.copy(s).invert(),bn.copy(e.ray).applyMatrix4(ao),!(n.boundingBox!==null&&bn.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,bn)))}_computeIntersections(e,t,n){let r;const s=this.geometry,a=this.material,o=s.index,l=s.attributes.position,c=s.attributes.uv,h=s.attributes.uv1,d=s.attributes.normal,u=s.groups,p=s.drawRange;if(o!==null)if(Array.isArray(a))for(let _=0,v=u.length;_<v;_++){const m=u[_],f=a[m.materialIndex],b=Math.max(m.start,p.start),x=Math.min(o.count,Math.min(m.start+m.count,p.start+p.count));for(let D=b,P=x;D<P;D+=3){const T=o.getX(D),w=o.getX(D+1),L=o.getX(D+2);r=lr(this,f,e,n,c,h,d,T,w,L),r&&(r.faceIndex=Math.floor(D/3),r.face.materialIndex=m.materialIndex,t.push(r))}}else{const _=Math.max(0,p.start),v=Math.min(o.count,p.start+p.count);for(let m=_,f=v;m<f;m+=3){const b=o.getX(m),x=o.getX(m+1),D=o.getX(m+2);r=lr(this,a,e,n,c,h,d,b,x,D),r&&(r.faceIndex=Math.floor(m/3),t.push(r))}}else if(l!==void 0)if(Array.isArray(a))for(let _=0,v=u.length;_<v;_++){const m=u[_],f=a[m.materialIndex],b=Math.max(m.start,p.start),x=Math.min(l.count,Math.min(m.start+m.count,p.start+p.count));for(let D=b,P=x;D<P;D+=3){const T=D,w=D+1,L=D+2;r=lr(this,f,e,n,c,h,d,T,w,L),r&&(r.faceIndex=Math.floor(D/3),r.face.materialIndex=m.materialIndex,t.push(r))}}else{const _=Math.max(0,p.start),v=Math.min(l.count,p.start+p.count);for(let m=_,f=v;m<f;m+=3){const b=m,x=m+1,D=m+2;r=lr(this,a,e,n,c,h,d,b,x,D),r&&(r.faceIndex=Math.floor(m/3),t.push(r))}}}}function oh(i,e,t,n,r,s,a,o){let l;if(e.side===Mt?l=n.intersectTriangle(a,s,r,!0,o):l=n.intersectTriangle(r,s,a,e.side===vn,o),l===null)return null;or.copy(o),or.applyMatrix4(i.matrixWorld);const c=t.ray.origin.distanceTo(or);return c<t.near||c>t.far?null:{distance:c,point:or.clone(),object:i}}function lr(i,e,t,n,r,s,a,o,l,c){i.getVertexPosition(o,ei),i.getVertexPosition(l,ti),i.getVertexPosition(c,ni);const h=oh(i,e,t,n,ei,ti,ni,ar);if(h){r&&(ir.fromBufferAttribute(r,o),rr.fromBufferAttribute(r,l),sr.fromBufferAttribute(r,c),h.uv=kt.getInterpolation(ar,ei,ti,ni,ir,rr,sr,new ue)),s&&(ir.fromBufferAttribute(s,o),rr.fromBufferAttribute(s,l),sr.fromBufferAttribute(s,c),h.uv1=kt.getInterpolation(ar,ei,ti,ni,ir,rr,sr,new ue)),a&&(lo.fromBufferAttribute(a,o),co.fromBufferAttribute(a,l),uo.fromBufferAttribute(a,c),h.normal=kt.getInterpolation(ar,ei,ti,ni,lo,co,uo,new R),h.normal.dot(n.direction)>0&&h.normal.multiplyScalar(-1));const d={a:o,b:l,c,normal:new R,materialIndex:0};kt.getNormal(ei,ti,ni,d.normal),h.face=d}return h}class ki 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=[],h=[],d=[];let u=0,p=0;_("z","y","x",-1,-1,n,t,e,a,s,0),_("z","y","x",1,-1,n,t,-e,a,s,1),_("x","z","y",1,1,e,n,t,r,a,2),_("x","z","y",1,-1,e,n,-t,r,a,3),_("x","y","z",1,-1,e,t,n,r,s,4),_("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(h,3)),this.setAttribute("uv",new nt(d,2));function _(v,m,f,b,x,D,P,T,w,L,E){const M=D/w,N=P/L,I=D/2,C=P/2,z=T/2,V=w+1,q=L+1;let ee=0,B=0;const $=new R;for(let j=0;j<q;j++){const F=j*N-C;for(let Q=0;Q<V;Q++){const pe=Q*M-I;$[v]=pe*b,$[m]=F*x,$[f]=z,c.push($.x,$.y,$.z),$[v]=0,$[m]=0,$[f]=T>0?1:-1,h.push($.x,$.y,$.z),d.push(Q/w),d.push(1-j/L),ee+=1}}for(let j=0;j<L;j++)for(let F=0;F<w;F++){const Q=u+F+V*j,pe=u+F+V*(j+1),U=u+(F+1)+V*(j+1),J=u+(F+1)+V*j;l.push(Q,pe,J),l.push(pe,U,J),B+=6}o.addGroup(p,B,E),p+=B,u+=ee}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new ki(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function gi(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 xt(i){const e={};for(let t=0;t<i.length;t++){const n=gi(i[t]);for(const r in n)e[r]=n[r]}return e}function lh(i){const e=[];for(let t=0;t<i.length;t++)e.push(i[t].clone());return e}function Sl(i){const e=i.getRenderTarget();return e===null?i.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:$e.workingColorSpace}const Rr={clone:gi,merge:xt};var ch=`void main() {
|
|
9
9
|
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
10
|
-
}`,
|
|
10
|
+
}`,uh=`void main() {
|
|
11
11
|
gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
|
|
12
|
-
}`;class ft extends
|
|
12
|
+
}`;class ft extends vi{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=ch,this.fragmentShader=uh,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=gi(e.uniforms),this.uniformsGroups=lh(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 El 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 hn=new R,ho=new ue,fo=new ue;class Rt extends El{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=Ui*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(hi*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Ui*2*Math.atan(Math.tan(hi*.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){hn.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(hn.x,hn.y).multiplyScalar(-e/hn.z),hn.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(hn.x,hn.y).multiplyScalar(-e/hn.z)}getViewSize(e,t){return this.getViewBounds(e,ho,fo),t.subVectors(fo,ho)}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(hi*.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 hh 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===wr)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,h]=this.children,d=e.getRenderTarget(),u=e.getActiveCubeFace(),p=e.getActiveMipmapLevel(),_=e.xr.enabled;e.xr.enabled=!1;const v=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=v,e.setRenderTarget(n,5,r),e.render(t,h),e.setRenderTarget(d,u,p),e.xr.enabled=_,n.texture.needsPMREMUpdate=!0}}class yl extends Dt{constructor(e,t,n,r,s,a,o,l,c,h){e=e!==void 0?e:[],t=t!==void 0?t:fi,super(e,t,n,r,s,a,o,l,c,h),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class dh 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 yl(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,9 +44,9 @@ 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
|
|
47
|
+
`},r=new ki(5,5,5),s=new ft({name:"CubemapFromEquirect",uniforms:gi(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:Mt,blending:en});s.uniforms.tEquirect.value=t;const a=new bt(r,s),o=t.minFilter;return t.minFilter===Fn&&(t.minFilter=zt),new hh(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 ds=new R,fh=new R,ph=new Be;class dn{constructor(e=new R(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=ds.subVectors(n,t).cross(fh.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(ds),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||ph.getNormalMatrix(e),r=this.coplanarPoint(ds).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 Dn=new Bi,cr=new R;class bl{constructor(e=new dn,t=new dn,n=new dn,r=new dn,s=new dn,a=new dn){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],h=r[5],d=r[6],u=r[7],p=r[8],_=r[9],v=r[10],m=r[11],f=r[12],b=r[13],x=r[14],D=r[15];if(n[0].setComponents(l-s,u-c,m-p,D-f).normalize(),n[1].setComponents(l+s,u+c,m+p,D+f).normalize(),n[2].setComponents(l+a,u+h,m+_,D+b).normalize(),n[3].setComponents(l-a,u-h,m-_,D-b).normalize(),n[4].setComponents(l-o,u-d,m-v,D-x).normalize(),t===Qt)n[5].setComponents(l+o,u+d,m+v,D+x).normalize();else if(t===wr)n[5].setComponents(o,d,v,x).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(),Dn.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Dn.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Dn)}intersectsSprite(e){return Dn.center.set(0,0,0),Dn.radius=.7071067811865476,Dn.applyMatrix4(e.matrixWorld),this.intersectsSphere(Dn)}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(cr.x=r.normal.x>0?e.max.x:e.min.x,cr.y=r.normal.y>0?e.max.y:e.min.y,cr.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(cr)<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 Dl(){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 mh(i){const e=new WeakMap;function t(o,l){const c=o.array,h=o.usage,d=c.byteLength,u=i.createBuffer();i.bindBuffer(l,u),i.bufferData(l,c,h),o.onUploadCallback();let p;if(c instanceof Float32Array)p=i.FLOAT;else if(c instanceof Uint16Array)o.isFloat16BufferAttribute?p=i.HALF_FLOAT:p=i.UNSIGNED_SHORT;else if(c instanceof Int16Array)p=i.SHORT;else if(c instanceof Uint32Array)p=i.UNSIGNED_INT;else if(c instanceof Int32Array)p=i.INT;else if(c instanceof Int8Array)p=i.BYTE;else if(c instanceof Uint8Array)p=i.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)p=i.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:u,type:p,bytesPerElement:c.BYTES_PER_ELEMENT,version:o.version,size:d}}function n(o,l,c){const h=l.array,d=l._updateRange,u=l.updateRanges;if(i.bindBuffer(c,o),d.count===-1&&u.length===0&&i.bufferSubData(c,0,h),u.length!==0){for(let p=0,_=u.length;p<_;p++){const v=u[p];i.bufferSubData(c,v.start*h.BYTES_PER_ELEMENT,h,v.start,v.count)}l.clearUpdateRanges()}d.count!==-1&&(i.bufferSubData(c,d.offset*h.BYTES_PER_ELEMENT,h,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 h=e.get(o);(!h||h.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 Nr 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,h=l+1,d=e/o,u=t/l,p=[],_=[],v=[],m=[];for(let f=0;f<h;f++){const b=f*u-a;for(let x=0;x<c;x++){const D=x*d-s;_.push(D,-b,0),v.push(0,0,1),m.push(x/o),m.push(1-f/l)}}for(let f=0;f<l;f++)for(let b=0;b<o;b++){const x=b+c*f,D=b+c*(f+1),P=b+1+c*(f+1),T=b+1+c*f;p.push(x,D,T),p.push(D,P,T)}this.setIndex(p),this.setAttribute("position",new nt(_,3)),this.setAttribute("normal",new nt(v,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 Nr(e.width,e.height,e.widthSegments,e.heightSegments)}}var gh=`#ifdef USE_ALPHAHASH
|
|
48
48
|
if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
|
|
49
|
-
#endif`,
|
|
49
|
+
#endif`,_h=`#ifdef USE_ALPHAHASH
|
|
50
50
|
const float ALPHA_HASH_SCALE = 0.05;
|
|
51
51
|
float hash2D( vec2 value ) {
|
|
52
52
|
return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );
|
|
@@ -81,20 +81,20 @@ React keys must be passed directly to JSX without using spread:
|
|
|
81
81
|
: cases.z;
|
|
82
82
|
return clamp( threshold , 1.0e-6, 1.0 );
|
|
83
83
|
}
|
|
84
|
-
#endif`,
|
|
84
|
+
#endif`,vh=`#ifdef USE_ALPHAMAP
|
|
85
85
|
diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
|
|
86
|
-
#endif`,
|
|
86
|
+
#endif`,xh=`#ifdef USE_ALPHAMAP
|
|
87
87
|
uniform sampler2D alphaMap;
|
|
88
|
-
#endif`,
|
|
88
|
+
#endif`,Mh=`#ifdef USE_ALPHATEST
|
|
89
89
|
#ifdef ALPHA_TO_COVERAGE
|
|
90
90
|
diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );
|
|
91
91
|
if ( diffuseColor.a == 0.0 ) discard;
|
|
92
92
|
#else
|
|
93
93
|
if ( diffuseColor.a < alphaTest ) discard;
|
|
94
94
|
#endif
|
|
95
|
-
#endif`,
|
|
95
|
+
#endif`,Sh=`#ifdef USE_ALPHATEST
|
|
96
96
|
uniform float alphaTest;
|
|
97
|
-
#endif`,
|
|
97
|
+
#endif`,Eh=`#ifdef USE_AOMAP
|
|
98
98
|
float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
|
|
99
99
|
reflectedLight.indirectDiffuse *= ambientOcclusion;
|
|
100
100
|
#if defined( USE_CLEARCOAT )
|
|
@@ -107,10 +107,10 @@ React keys must be passed directly to JSX without using spread:
|
|
|
107
107
|
float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
|
|
108
108
|
reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
|
|
109
109
|
#endif
|
|
110
|
-
#endif`,
|
|
110
|
+
#endif`,yh=`#ifdef USE_AOMAP
|
|
111
111
|
uniform sampler2D aoMap;
|
|
112
112
|
uniform float aoMapIntensity;
|
|
113
|
-
#endif`,
|
|
113
|
+
#endif`,bh=`#ifdef USE_BATCHING
|
|
114
114
|
attribute float batchId;
|
|
115
115
|
uniform highp sampler2D batchingTexture;
|
|
116
116
|
mat4 getBatchingMatrix( const in float i ) {
|
|
@@ -124,15 +124,15 @@ React keys must be passed directly to JSX without using spread:
|
|
|
124
124
|
vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );
|
|
125
125
|
return mat4( v1, v2, v3, v4 );
|
|
126
126
|
}
|
|
127
|
-
#endif`,
|
|
127
|
+
#endif`,Dh=`#ifdef USE_BATCHING
|
|
128
128
|
mat4 batchingMatrix = getBatchingMatrix( batchId );
|
|
129
|
-
#endif`,
|
|
129
|
+
#endif`,Th=`vec3 transformed = vec3( position );
|
|
130
130
|
#ifdef USE_ALPHAHASH
|
|
131
131
|
vPosition = vec3( position );
|
|
132
|
-
#endif`,
|
|
132
|
+
#endif`,Ah=`vec3 objectNormal = vec3( normal );
|
|
133
133
|
#ifdef USE_TANGENT
|
|
134
134
|
vec3 objectTangent = vec3( tangent.xyz );
|
|
135
|
-
#endif`,
|
|
135
|
+
#endif`,wh=`float G_BlinnPhong_Implicit( ) {
|
|
136
136
|
return 0.25;
|
|
137
137
|
}
|
|
138
138
|
float D_BlinnPhong( const in float shininess, const in float dotNH ) {
|
|
@@ -146,7 +146,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
|
|
|
146
146
|
float G = G_BlinnPhong_Implicit( );
|
|
147
147
|
float D = D_BlinnPhong( shininess, dotNH );
|
|
148
148
|
return F * ( G * D );
|
|
149
|
-
} // validated`,
|
|
149
|
+
} // validated`,Ch=`#ifdef USE_IRIDESCENCE
|
|
150
150
|
const mat3 XYZ_TO_REC709 = mat3(
|
|
151
151
|
3.2404542, -0.9692660, 0.0556434,
|
|
152
152
|
-1.5371385, 1.8760108, -0.2040259,
|
|
@@ -209,7 +209,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
|
|
|
209
209
|
}
|
|
210
210
|
return max( I, vec3( 0.0 ) );
|
|
211
211
|
}
|
|
212
|
-
#endif`,
|
|
212
|
+
#endif`,Rh=`#ifdef USE_BUMPMAP
|
|
213
213
|
uniform sampler2D bumpMap;
|
|
214
214
|
uniform float bumpScale;
|
|
215
215
|
vec2 dHdxy_fwd() {
|
|
@@ -230,7 +230,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
|
|
|
230
230
|
vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
|
|
231
231
|
return normalize( abs( fDet ) * surf_norm - vGrad );
|
|
232
232
|
}
|
|
233
|
-
#endif`,
|
|
233
|
+
#endif`,Ph=`#if NUM_CLIPPING_PLANES > 0
|
|
234
234
|
vec4 plane;
|
|
235
235
|
#ifdef ALPHA_TO_COVERAGE
|
|
236
236
|
float distanceToPlane, distanceGradient;
|
|
@@ -276,26 +276,26 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
|
|
|
276
276
|
if ( clipped ) discard;
|
|
277
277
|
#endif
|
|
278
278
|
#endif
|
|
279
|
-
#endif`,
|
|
279
|
+
#endif`,Lh=`#if NUM_CLIPPING_PLANES > 0
|
|
280
280
|
varying vec3 vClipPosition;
|
|
281
281
|
uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
|
|
282
|
-
#endif`,
|
|
282
|
+
#endif`,Fh=`#if NUM_CLIPPING_PLANES > 0
|
|
283
283
|
varying vec3 vClipPosition;
|
|
284
|
-
#endif`,
|
|
284
|
+
#endif`,Uh=`#if NUM_CLIPPING_PLANES > 0
|
|
285
285
|
vClipPosition = - mvPosition.xyz;
|
|
286
|
-
#endif`,
|
|
286
|
+
#endif`,Nh=`#if defined( USE_COLOR_ALPHA )
|
|
287
287
|
diffuseColor *= vColor;
|
|
288
288
|
#elif defined( USE_COLOR )
|
|
289
289
|
diffuseColor.rgb *= vColor;
|
|
290
|
-
#endif`,
|
|
290
|
+
#endif`,Ih=`#if defined( USE_COLOR_ALPHA )
|
|
291
291
|
varying vec4 vColor;
|
|
292
292
|
#elif defined( USE_COLOR )
|
|
293
293
|
varying vec3 vColor;
|
|
294
|
-
#endif`,
|
|
294
|
+
#endif`,Oh=`#if defined( USE_COLOR_ALPHA )
|
|
295
295
|
varying vec4 vColor;
|
|
296
296
|
#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )
|
|
297
297
|
varying vec3 vColor;
|
|
298
|
-
#endif`,
|
|
298
|
+
#endif`,Bh=`#if defined( USE_COLOR_ALPHA )
|
|
299
299
|
vColor = vec4( 1.0 );
|
|
300
300
|
#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )
|
|
301
301
|
vColor = vec3( 1.0 );
|
|
@@ -305,7 +305,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
|
|
|
305
305
|
#endif
|
|
306
306
|
#ifdef USE_INSTANCING_COLOR
|
|
307
307
|
vColor.xyz *= instanceColor.xyz;
|
|
308
|
-
#endif`,
|
|
308
|
+
#endif`,zh=`#define PI 3.141592653589793
|
|
309
309
|
#define PI2 6.283185307179586
|
|
310
310
|
#define PI_HALF 1.5707963267948966
|
|
311
311
|
#define RECIPROCAL_PI 0.3183098861837907
|
|
@@ -383,7 +383,7 @@ vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
|
|
|
383
383
|
float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
|
|
384
384
|
float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
|
|
385
385
|
return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
|
|
386
|
-
} // validated
|
|
386
|
+
} // validated`,kh=`#ifdef ENVMAP_TYPE_CUBE_UV
|
|
387
387
|
#define cubeUV_minMipLevel 4.0
|
|
388
388
|
#define cubeUV_minTileSize 16.0
|
|
389
389
|
float getFace( vec3 direction ) {
|
|
@@ -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`,
|
|
479
|
+
#endif`,Hh=`vec3 transformedNormal = objectNormal;
|
|
480
480
|
#ifdef USE_TANGENT
|
|
481
481
|
vec3 transformedTangent = objectTangent;
|
|
482
482
|
#endif
|
|
@@ -505,18 +505,18 @@ transformedNormal = normalMatrix * transformedNormal;
|
|
|
505
505
|
#ifdef FLIP_SIDED
|
|
506
506
|
transformedTangent = - transformedTangent;
|
|
507
507
|
#endif
|
|
508
|
-
#endif`,
|
|
508
|
+
#endif`,Vh=`#ifdef USE_DISPLACEMENTMAP
|
|
509
509
|
uniform sampler2D displacementMap;
|
|
510
510
|
uniform float displacementScale;
|
|
511
511
|
uniform float displacementBias;
|
|
512
|
-
#endif`,
|
|
512
|
+
#endif`,Gh=`#ifdef USE_DISPLACEMENTMAP
|
|
513
513
|
transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );
|
|
514
|
-
#endif`,
|
|
514
|
+
#endif`,Wh=`#ifdef USE_EMISSIVEMAP
|
|
515
515
|
vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
|
|
516
516
|
totalEmissiveRadiance *= emissiveColor.rgb;
|
|
517
|
-
#endif`,
|
|
517
|
+
#endif`,Xh=`#ifdef USE_EMISSIVEMAP
|
|
518
518
|
uniform sampler2D emissiveMap;
|
|
519
|
-
#endif`,
|
|
519
|
+
#endif`,Yh="gl_FragColor = linearToOutputTexel( gl_FragColor );",jh=`
|
|
520
520
|
const mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3(
|
|
521
521
|
vec3( 0.8224621, 0.177538, 0.0 ),
|
|
522
522
|
vec3( 0.0331941, 0.9668058, 0.0 ),
|
|
@@ -544,7 +544,7 @@ vec4 LinearToLinear( in vec4 value ) {
|
|
|
544
544
|
}
|
|
545
545
|
vec4 LinearTosRGB( in vec4 value ) {
|
|
546
546
|
return sRGBTransferOETF( value );
|
|
547
|
-
}`,
|
|
547
|
+
}`,qh=`#ifdef USE_ENVMAP
|
|
548
548
|
#ifdef ENV_WORLDPOS
|
|
549
549
|
vec3 cameraToFrag;
|
|
550
550
|
if ( isOrthographic ) {
|
|
@@ -573,7 +573,7 @@ vec4 LinearTosRGB( in vec4 value ) {
|
|
|
573
573
|
#elif defined( ENVMAP_BLENDING_ADD )
|
|
574
574
|
outgoingLight += envColor.xyz * specularStrength * reflectivity;
|
|
575
575
|
#endif
|
|
576
|
-
#endif
|
|
576
|
+
#endif`,$h=`#ifdef USE_ENVMAP
|
|
577
577
|
uniform float envMapIntensity;
|
|
578
578
|
uniform float flipEnvMap;
|
|
579
579
|
uniform mat3 envMapRotation;
|
|
@@ -583,7 +583,7 @@ vec4 LinearTosRGB( in vec4 value ) {
|
|
|
583
583
|
uniform sampler2D envMap;
|
|
584
584
|
#endif
|
|
585
585
|
|
|
586
|
-
#endif`,
|
|
586
|
+
#endif`,Kh=`#ifdef USE_ENVMAP
|
|
587
587
|
uniform float reflectivity;
|
|
588
588
|
#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
|
|
589
589
|
#define ENV_WORLDPOS
|
|
@@ -594,7 +594,7 @@ vec4 LinearTosRGB( in vec4 value ) {
|
|
|
594
594
|
#else
|
|
595
595
|
varying vec3 vReflect;
|
|
596
596
|
#endif
|
|
597
|
-
#endif`,
|
|
597
|
+
#endif`,Zh=`#ifdef USE_ENVMAP
|
|
598
598
|
#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
|
|
599
599
|
#define ENV_WORLDPOS
|
|
600
600
|
#endif
|
|
@@ -605,7 +605,7 @@ vec4 LinearTosRGB( in vec4 value ) {
|
|
|
605
605
|
varying vec3 vReflect;
|
|
606
606
|
uniform float refractionRatio;
|
|
607
607
|
#endif
|
|
608
|
-
#endif`,
|
|
608
|
+
#endif`,Jh=`#ifdef USE_ENVMAP
|
|
609
609
|
#ifdef ENV_WORLDPOS
|
|
610
610
|
vWorldPosition = worldPosition.xyz;
|
|
611
611
|
#else
|
|
@@ -622,18 +622,18 @@ vec4 LinearTosRGB( in vec4 value ) {
|
|
|
622
622
|
vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
|
|
623
623
|
#endif
|
|
624
624
|
#endif
|
|
625
|
-
#endif`,
|
|
625
|
+
#endif`,Qh=`#ifdef USE_FOG
|
|
626
626
|
vFogDepth = - mvPosition.z;
|
|
627
|
-
#endif`,
|
|
627
|
+
#endif`,ed=`#ifdef USE_FOG
|
|
628
628
|
varying float vFogDepth;
|
|
629
|
-
#endif`,
|
|
629
|
+
#endif`,td=`#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`,
|
|
636
|
+
#endif`,nd=`#ifdef USE_FOG
|
|
637
637
|
uniform vec3 fogColor;
|
|
638
638
|
varying float vFogDepth;
|
|
639
639
|
#ifdef FOG_EXP2
|
|
@@ -642,7 +642,7 @@ vec4 LinearTosRGB( in vec4 value ) {
|
|
|
642
642
|
uniform float fogNear;
|
|
643
643
|
uniform float fogFar;
|
|
644
644
|
#endif
|
|
645
|
-
#endif`,
|
|
645
|
+
#endif`,id=`#ifdef USE_GRADIENTMAP
|
|
646
646
|
uniform sampler2D gradientMap;
|
|
647
647
|
#endif
|
|
648
648
|
vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
|
|
@@ -654,16 +654,16 @@ vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
|
|
|
654
654
|
vec2 fw = fwidth( coord ) * 0.5;
|
|
655
655
|
return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
|
|
656
656
|
#endif
|
|
657
|
-
}`,
|
|
657
|
+
}`,rd=`#ifdef USE_LIGHTMAP
|
|
658
658
|
vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
|
|
659
659
|
vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
|
|
660
660
|
reflectedLight.indirectDiffuse += lightMapIrradiance;
|
|
661
|
-
#endif`,
|
|
661
|
+
#endif`,sd=`#ifdef USE_LIGHTMAP
|
|
662
662
|
uniform sampler2D lightMap;
|
|
663
663
|
uniform float lightMapIntensity;
|
|
664
|
-
#endif`,
|
|
664
|
+
#endif`,ad=`LambertMaterial material;
|
|
665
665
|
material.diffuseColor = diffuseColor.rgb;
|
|
666
|
-
material.specularStrength = specularStrength;`,
|
|
666
|
+
material.specularStrength = specularStrength;`,od=`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`,
|
|
680
|
+
#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,ld=`uniform bool receiveShadow;
|
|
681
681
|
uniform vec3 ambientLightColor;
|
|
682
682
|
#if defined( USE_LIGHT_PROBES )
|
|
683
683
|
uniform vec3 lightProbe[ 9 ];
|
|
@@ -800,7 +800,7 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi
|
|
|
800
800
|
vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
|
|
801
801
|
return irradiance;
|
|
802
802
|
}
|
|
803
|
-
#endif`,
|
|
803
|
+
#endif`,cd=`#ifdef USE_ENVMAP
|
|
804
804
|
vec3 getIBLIrradiance( const in vec3 normal ) {
|
|
805
805
|
#ifdef ENVMAP_TYPE_CUBE_UV
|
|
806
806
|
vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
|
|
@@ -833,8 +833,8 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi
|
|
|
833
833
|
#endif
|
|
834
834
|
}
|
|
835
835
|
#endif
|
|
836
|
-
#endif`,
|
|
837
|
-
material.diffuseColor = diffuseColor.rgb;`,
|
|
836
|
+
#endif`,ud=`ToonMaterial material;
|
|
837
|
+
material.diffuseColor = diffuseColor.rgb;`,hd=`varying vec3 vViewPosition;
|
|
838
838
|
struct ToonMaterial {
|
|
839
839
|
vec3 diffuseColor;
|
|
840
840
|
};
|
|
@@ -846,11 +846,11 @@ void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPo
|
|
|
846
846
|
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
|
847
847
|
}
|
|
848
848
|
#define RE_Direct RE_Direct_Toon
|
|
849
|
-
#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,
|
|
849
|
+
#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,dd=`BlinnPhongMaterial material;
|
|
850
850
|
material.diffuseColor = diffuseColor.rgb;
|
|
851
851
|
material.specularColor = specular;
|
|
852
852
|
material.specularShininess = shininess;
|
|
853
|
-
material.specularStrength = specularStrength;`,
|
|
853
|
+
material.specularStrength = specularStrength;`,fd=`varying vec3 vViewPosition;
|
|
854
854
|
struct BlinnPhongMaterial {
|
|
855
855
|
vec3 diffuseColor;
|
|
856
856
|
vec3 specularColor;
|
|
@@ -867,7 +867,7 @@ void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geom
|
|
|
867
867
|
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
|
868
868
|
}
|
|
869
869
|
#define RE_Direct RE_Direct_BlinnPhong
|
|
870
|
-
#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,
|
|
870
|
+
#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,pd=`PhysicalMaterial material;
|
|
871
871
|
material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );
|
|
872
872
|
vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );
|
|
873
873
|
float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
|
|
@@ -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`,
|
|
953
|
+
#endif`,md=`struct PhysicalMaterial {
|
|
954
954
|
vec3 diffuseColor;
|
|
955
955
|
float roughness;
|
|
956
956
|
vec3 specularColor;
|
|
@@ -1250,7 +1250,7 @@ void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradia
|
|
|
1250
1250
|
#define RE_IndirectSpecular RE_IndirectSpecular_Physical
|
|
1251
1251
|
float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
|
|
1252
1252
|
return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
|
|
1253
|
-
}`,
|
|
1253
|
+
}`,gd=`
|
|
1254
1254
|
vec3 geometryPosition = - vViewPosition;
|
|
1255
1255
|
vec3 geometryNormal = normal;
|
|
1256
1256
|
vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
|
|
@@ -1365,7 +1365,7 @@ IncidentLight directLight;
|
|
|
1365
1365
|
#if defined( RE_IndirectSpecular )
|
|
1366
1366
|
vec3 radiance = vec3( 0.0 );
|
|
1367
1367
|
vec3 clearcoatRadiance = vec3( 0.0 );
|
|
1368
|
-
#endif`,
|
|
1368
|
+
#endif`,_d=`#if defined( RE_IndirectDiffuse )
|
|
1369
1369
|
#ifdef USE_LIGHTMAP
|
|
1370
1370
|
vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
|
|
1371
1371
|
vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
|
|
@@ -1384,33 +1384,33 @@ IncidentLight directLight;
|
|
|
1384
1384
|
#ifdef USE_CLEARCOAT
|
|
1385
1385
|
clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );
|
|
1386
1386
|
#endif
|
|
1387
|
-
#endif`,
|
|
1387
|
+
#endif`,vd=`#if defined( RE_IndirectDiffuse )
|
|
1388
1388
|
RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
|
|
1389
1389
|
#endif
|
|
1390
1390
|
#if defined( RE_IndirectSpecular )
|
|
1391
1391
|
RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
|
|
1392
|
-
#endif`,
|
|
1392
|
+
#endif`,xd=`#if defined( USE_LOGDEPTHBUF )
|
|
1393
1393
|
gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
|
|
1394
|
-
#endif`,
|
|
1394
|
+
#endif`,Md=`#if defined( USE_LOGDEPTHBUF )
|
|
1395
1395
|
uniform float logDepthBufFC;
|
|
1396
1396
|
varying float vFragDepth;
|
|
1397
1397
|
varying float vIsPerspective;
|
|
1398
|
-
#endif`,
|
|
1398
|
+
#endif`,Sd=`#ifdef USE_LOGDEPTHBUF
|
|
1399
1399
|
varying float vFragDepth;
|
|
1400
1400
|
varying float vIsPerspective;
|
|
1401
|
-
#endif`,
|
|
1401
|
+
#endif`,Ed=`#ifdef USE_LOGDEPTHBUF
|
|
1402
1402
|
vFragDepth = 1.0 + gl_Position.w;
|
|
1403
1403
|
vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
|
|
1404
|
-
#endif`,
|
|
1404
|
+
#endif`,yd=`#ifdef USE_MAP
|
|
1405
1405
|
vec4 sampledDiffuseColor = texture2D( map, vMapUv );
|
|
1406
1406
|
#ifdef DECODE_VIDEO_TEXTURE
|
|
1407
1407
|
sampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );
|
|
1408
1408
|
|
|
1409
1409
|
#endif
|
|
1410
1410
|
diffuseColor *= sampledDiffuseColor;
|
|
1411
|
-
#endif`,
|
|
1411
|
+
#endif`,bd=`#ifdef USE_MAP
|
|
1412
1412
|
uniform sampler2D map;
|
|
1413
|
-
#endif`,
|
|
1413
|
+
#endif`,Dd=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
|
|
1414
1414
|
#if defined( USE_POINTS_UV )
|
|
1415
1415
|
vec2 uv = vUv;
|
|
1416
1416
|
#else
|
|
@@ -1422,7 +1422,7 @@ IncidentLight directLight;
|
|
|
1422
1422
|
#endif
|
|
1423
1423
|
#ifdef USE_ALPHAMAP
|
|
1424
1424
|
diffuseColor.a *= texture2D( alphaMap, uv ).g;
|
|
1425
|
-
#endif`,
|
|
1425
|
+
#endif`,Td=`#if defined( USE_POINTS_UV )
|
|
1426
1426
|
varying vec2 vUv;
|
|
1427
1427
|
#else
|
|
1428
1428
|
#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
|
|
@@ -1434,19 +1434,19 @@ IncidentLight directLight;
|
|
|
1434
1434
|
#endif
|
|
1435
1435
|
#ifdef USE_ALPHAMAP
|
|
1436
1436
|
uniform sampler2D alphaMap;
|
|
1437
|
-
#endif`,
|
|
1437
|
+
#endif`,Ad=`float metalnessFactor = metalness;
|
|
1438
1438
|
#ifdef USE_METALNESSMAP
|
|
1439
1439
|
vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
|
|
1440
1440
|
metalnessFactor *= texelMetalness.b;
|
|
1441
|
-
#endif`,
|
|
1441
|
+
#endif`,wd=`#ifdef USE_METALNESSMAP
|
|
1442
1442
|
uniform sampler2D metalnessMap;
|
|
1443
|
-
#endif`,
|
|
1443
|
+
#endif`,Cd=`#ifdef USE_INSTANCING_MORPH
|
|
1444
1444
|
float morphTargetInfluences[MORPHTARGETS_COUNT];
|
|
1445
1445
|
float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;
|
|
1446
1446
|
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
|
|
1447
1447
|
morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;
|
|
1448
1448
|
}
|
|
1449
|
-
#endif`,
|
|
1449
|
+
#endif`,Rd=`#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE )
|
|
1450
1450
|
vColor *= morphTargetBaseInfluence;
|
|
1451
1451
|
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
|
|
1452
1452
|
#if defined( USE_COLOR_ALPHA )
|
|
@@ -1455,7 +1455,7 @@ IncidentLight directLight;
|
|
|
1455
1455
|
if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
|
|
1456
1456
|
#endif
|
|
1457
1457
|
}
|
|
1458
|
-
#endif`,
|
|
1458
|
+
#endif`,Pd=`#ifdef USE_MORPHNORMALS
|
|
1459
1459
|
objectNormal *= morphTargetBaseInfluence;
|
|
1460
1460
|
#ifdef MORPHTARGETS_TEXTURE
|
|
1461
1461
|
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
|
|
@@ -1467,7 +1467,7 @@ IncidentLight directLight;
|
|
|
1467
1467
|
objectNormal += morphNormal2 * morphTargetInfluences[ 2 ];
|
|
1468
1468
|
objectNormal += morphNormal3 * morphTargetInfluences[ 3 ];
|
|
1469
1469
|
#endif
|
|
1470
|
-
#endif`,
|
|
1470
|
+
#endif`,Ld=`#ifdef USE_MORPHTARGETS
|
|
1471
1471
|
#ifndef USE_INSTANCING_MORPH
|
|
1472
1472
|
uniform float morphTargetBaseInfluence;
|
|
1473
1473
|
#endif
|
|
@@ -1491,7 +1491,7 @@ IncidentLight directLight;
|
|
|
1491
1491
|
uniform float morphTargetInfluences[ 4 ];
|
|
1492
1492
|
#endif
|
|
1493
1493
|
#endif
|
|
1494
|
-
#endif`,
|
|
1494
|
+
#endif`,Fd=`#ifdef USE_MORPHTARGETS
|
|
1495
1495
|
transformed *= morphTargetBaseInfluence;
|
|
1496
1496
|
#ifdef MORPHTARGETS_TEXTURE
|
|
1497
1497
|
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
|
|
@@ -1509,7 +1509,7 @@ IncidentLight directLight;
|
|
|
1509
1509
|
transformed += morphTarget7 * morphTargetInfluences[ 7 ];
|
|
1510
1510
|
#endif
|
|
1511
1511
|
#endif
|
|
1512
|
-
#endif`,
|
|
1512
|
+
#endif`,Ud=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
|
|
1513
1513
|
#ifdef FLAT_SHADED
|
|
1514
1514
|
vec3 fdx = dFdx( vViewPosition );
|
|
1515
1515
|
vec3 fdy = dFdy( vViewPosition );
|
|
@@ -1550,7 +1550,7 @@ IncidentLight directLight;
|
|
|
1550
1550
|
tbn2[1] *= faceDirection;
|
|
1551
1551
|
#endif
|
|
1552
1552
|
#endif
|
|
1553
|
-
vec3 nonPerturbedNormal = normal;`,
|
|
1553
|
+
vec3 nonPerturbedNormal = normal;`,Nd=`#ifdef USE_NORMALMAP_OBJECTSPACE
|
|
1554
1554
|
normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
|
|
1555
1555
|
#ifdef FLIP_SIDED
|
|
1556
1556
|
normal = - normal;
|
|
@@ -1565,25 +1565,25 @@ vec3 nonPerturbedNormal = normal;`,Wd=`#ifdef USE_NORMALMAP_OBJECTSPACE
|
|
|
1565
1565
|
normal = normalize( tbn * mapN );
|
|
1566
1566
|
#elif defined( USE_BUMPMAP )
|
|
1567
1567
|
normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
|
|
1568
|
-
#endif`,
|
|
1568
|
+
#endif`,Id=`#ifndef FLAT_SHADED
|
|
1569
1569
|
varying vec3 vNormal;
|
|
1570
1570
|
#ifdef USE_TANGENT
|
|
1571
1571
|
varying vec3 vTangent;
|
|
1572
1572
|
varying vec3 vBitangent;
|
|
1573
1573
|
#endif
|
|
1574
|
-
#endif`,
|
|
1574
|
+
#endif`,Od=`#ifndef FLAT_SHADED
|
|
1575
1575
|
varying vec3 vNormal;
|
|
1576
1576
|
#ifdef USE_TANGENT
|
|
1577
1577
|
varying vec3 vTangent;
|
|
1578
1578
|
varying vec3 vBitangent;
|
|
1579
1579
|
#endif
|
|
1580
|
-
#endif`,
|
|
1580
|
+
#endif`,Bd=`#ifndef FLAT_SHADED
|
|
1581
1581
|
vNormal = normalize( transformedNormal );
|
|
1582
1582
|
#ifdef USE_TANGENT
|
|
1583
1583
|
vTangent = normalize( transformedTangent );
|
|
1584
1584
|
vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
|
|
1585
1585
|
#endif
|
|
1586
|
-
#endif`,
|
|
1586
|
+
#endif`,zd=`#ifdef USE_NORMALMAP
|
|
1587
1587
|
uniform sampler2D normalMap;
|
|
1588
1588
|
uniform vec2 normalScale;
|
|
1589
1589
|
#endif
|
|
@@ -1605,13 +1605,13 @@ vec3 nonPerturbedNormal = normal;`,Wd=`#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
|
|
1608
|
+
#endif`,kd=`#ifdef USE_CLEARCOAT
|
|
1609
1609
|
vec3 clearcoatNormal = nonPerturbedNormal;
|
|
1610
|
-
#endif`,
|
|
1610
|
+
#endif`,Hd=`#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 );
|
|
1614
|
-
#endif`,
|
|
1614
|
+
#endif`,Vd=`#ifdef USE_CLEARCOATMAP
|
|
1615
1615
|
uniform sampler2D clearcoatMap;
|
|
1616
1616
|
#endif
|
|
1617
1617
|
#ifdef USE_CLEARCOAT_NORMALMAP
|
|
@@ -1620,18 +1620,18 @@ vec3 nonPerturbedNormal = normal;`,Wd=`#ifdef USE_NORMALMAP_OBJECTSPACE
|
|
|
1620
1620
|
#endif
|
|
1621
1621
|
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
|
|
1622
1622
|
uniform sampler2D clearcoatRoughnessMap;
|
|
1623
|
-
#endif`,
|
|
1623
|
+
#endif`,Gd=`#ifdef USE_IRIDESCENCEMAP
|
|
1624
1624
|
uniform sampler2D iridescenceMap;
|
|
1625
1625
|
#endif
|
|
1626
1626
|
#ifdef USE_IRIDESCENCE_THICKNESSMAP
|
|
1627
1627
|
uniform sampler2D iridescenceThicknessMap;
|
|
1628
|
-
#endif`,
|
|
1628
|
+
#endif`,Wd=`#ifdef OPAQUE
|
|
1629
1629
|
diffuseColor.a = 1.0;
|
|
1630
1630
|
#endif
|
|
1631
1631
|
#ifdef USE_TRANSMISSION
|
|
1632
1632
|
diffuseColor.a *= material.transmissionAlpha;
|
|
1633
1633
|
#endif
|
|
1634
|
-
gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,
|
|
1634
|
+
gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,Xd=`vec3 packNormalToRGB( const in vec3 normal ) {
|
|
1635
1635
|
return normalize( normal ) * 0.5 + 0.5;
|
|
1636
1636
|
}
|
|
1637
1637
|
vec3 unpackRGBToNormal( const in vec3 rgb ) {
|
|
@@ -1672,9 +1672,9 @@ float viewZToPerspectiveDepth( const in float viewZ, const in float near, const
|
|
|
1672
1672
|
}
|
|
1673
1673
|
float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {
|
|
1674
1674
|
return ( near * far ) / ( ( far - near ) * depth - far );
|
|
1675
|
-
}`,
|
|
1675
|
+
}`,Yd=`#ifdef PREMULTIPLIED_ALPHA
|
|
1676
1676
|
gl_FragColor.rgb *= gl_FragColor.a;
|
|
1677
|
-
#endif`,
|
|
1677
|
+
#endif`,jd=`vec4 mvPosition = vec4( transformed, 1.0 );
|
|
1678
1678
|
#ifdef USE_BATCHING
|
|
1679
1679
|
mvPosition = batchingMatrix * mvPosition;
|
|
1680
1680
|
#endif
|
|
@@ -1682,22 +1682,22 @@ float perspectiveDepthToViewZ( const in float depth, const in float near, const
|
|
|
1682
1682
|
mvPosition = instanceMatrix * mvPosition;
|
|
1683
1683
|
#endif
|
|
1684
1684
|
mvPosition = modelViewMatrix * mvPosition;
|
|
1685
|
-
gl_Position = projectionMatrix * mvPosition;`,
|
|
1685
|
+
gl_Position = projectionMatrix * mvPosition;`,qd=`#ifdef DITHERING
|
|
1686
1686
|
gl_FragColor.rgb = dithering( gl_FragColor.rgb );
|
|
1687
|
-
#endif
|
|
1687
|
+
#endif`,$d=`#ifdef DITHERING
|
|
1688
1688
|
vec3 dithering( vec3 color ) {
|
|
1689
1689
|
float grid_position = rand( gl_FragCoord.xy );
|
|
1690
1690
|
vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
|
|
1691
1691
|
dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
|
|
1692
1692
|
return color + dither_shift_RGB;
|
|
1693
1693
|
}
|
|
1694
|
-
#endif`,
|
|
1694
|
+
#endif`,Kd=`float roughnessFactor = roughness;
|
|
1695
1695
|
#ifdef USE_ROUGHNESSMAP
|
|
1696
1696
|
vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
|
|
1697
1697
|
roughnessFactor *= texelRoughness.g;
|
|
1698
|
-
#endif`,
|
|
1698
|
+
#endif`,Zd=`#ifdef USE_ROUGHNESSMAP
|
|
1699
1699
|
uniform sampler2D roughnessMap;
|
|
1700
|
-
#endif`,
|
|
1700
|
+
#endif`,Jd=`#if NUM_SPOT_LIGHT_COORDS > 0
|
|
1701
1701
|
varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
|
|
1702
1702
|
#endif
|
|
1703
1703
|
#if NUM_SPOT_LIGHT_MAPS > 0
|
|
@@ -1880,7 +1880,7 @@ gl_Position = projectionMatrix * mvPosition;`,rf=`#ifdef DITHERING
|
|
|
1880
1880
|
}
|
|
1881
1881
|
return shadow;
|
|
1882
1882
|
}
|
|
1883
|
-
#endif`,
|
|
1883
|
+
#endif`,Qd=`#if NUM_SPOT_LIGHT_COORDS > 0
|
|
1884
1884
|
uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
|
|
1885
1885
|
varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
|
|
1886
1886
|
#endif
|
|
@@ -1918,7 +1918,7 @@ gl_Position = projectionMatrix * mvPosition;`,rf=`#ifdef DITHERING
|
|
|
1918
1918
|
};
|
|
1919
1919
|
uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
|
|
1920
1920
|
#endif
|
|
1921
|
-
#endif`,
|
|
1921
|
+
#endif`,ef=`#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;`,rf=`#ifdef DITHERING
|
|
|
1950
1950
|
vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
|
|
1951
1951
|
}
|
|
1952
1952
|
#pragma unroll_loop_end
|
|
1953
|
-
#endif`,
|
|
1953
|
+
#endif`,tf=`float getShadowMask() {
|
|
1954
1954
|
float shadow = 1.0;
|
|
1955
1955
|
#ifdef USE_SHADOWMAP
|
|
1956
1956
|
#if NUM_DIR_LIGHT_SHADOWS > 0
|
|
@@ -1982,12 +1982,12 @@ gl_Position = projectionMatrix * mvPosition;`,rf=`#ifdef DITHERING
|
|
|
1982
1982
|
#endif
|
|
1983
1983
|
#endif
|
|
1984
1984
|
return shadow;
|
|
1985
|
-
}`,
|
|
1985
|
+
}`,nf=`#ifdef USE_SKINNING
|
|
1986
1986
|
mat4 boneMatX = getBoneMatrix( skinIndex.x );
|
|
1987
1987
|
mat4 boneMatY = getBoneMatrix( skinIndex.y );
|
|
1988
1988
|
mat4 boneMatZ = getBoneMatrix( skinIndex.z );
|
|
1989
1989
|
mat4 boneMatW = getBoneMatrix( skinIndex.w );
|
|
1990
|
-
#endif`,
|
|
1990
|
+
#endif`,rf=`#ifdef USE_SKINNING
|
|
1991
1991
|
uniform mat4 bindMatrix;
|
|
1992
1992
|
uniform mat4 bindMatrixInverse;
|
|
1993
1993
|
uniform highp sampler2D boneTexture;
|
|
@@ -2002,7 +2002,7 @@ gl_Position = projectionMatrix * mvPosition;`,rf=`#ifdef DITHERING
|
|
|
2002
2002
|
vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );
|
|
2003
2003
|
return mat4( v1, v2, v3, v4 );
|
|
2004
2004
|
}
|
|
2005
|
-
#endif`,
|
|
2005
|
+
#endif`,sf=`#ifdef USE_SKINNING
|
|
2006
2006
|
vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
|
|
2007
2007
|
vec4 skinned = vec4( 0.0 );
|
|
2008
2008
|
skinned += boneMatX * skinVertex * skinWeight.x;
|
|
@@ -2010,7 +2010,7 @@ gl_Position = projectionMatrix * mvPosition;`,rf=`#ifdef DITHERING
|
|
|
2010
2010
|
skinned += boneMatZ * skinVertex * skinWeight.z;
|
|
2011
2011
|
skinned += boneMatW * skinVertex * skinWeight.w;
|
|
2012
2012
|
transformed = ( bindMatrixInverse * skinned ).xyz;
|
|
2013
|
-
#endif`,
|
|
2013
|
+
#endif`,af=`#ifdef USE_SKINNING
|
|
2014
2014
|
mat4 skinMatrix = mat4( 0.0 );
|
|
2015
2015
|
skinMatrix += skinWeight.x * boneMatX;
|
|
2016
2016
|
skinMatrix += skinWeight.y * boneMatY;
|
|
@@ -2021,17 +2021,17 @@ gl_Position = projectionMatrix * mvPosition;`,rf=`#ifdef DITHERING
|
|
|
2021
2021
|
#ifdef USE_TANGENT
|
|
2022
2022
|
objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
|
|
2023
2023
|
#endif
|
|
2024
|
-
#endif`,
|
|
2024
|
+
#endif`,of=`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`,
|
|
2030
|
+
#endif`,lf=`#ifdef USE_SPECULARMAP
|
|
2031
2031
|
uniform sampler2D specularMap;
|
|
2032
|
-
#endif`,
|
|
2032
|
+
#endif`,cf=`#if defined( TONE_MAPPING )
|
|
2033
2033
|
gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
|
|
2034
|
-
#endif`,
|
|
2034
|
+
#endif`,uf=`#ifndef saturate
|
|
2035
2035
|
#define saturate( a ) clamp( a, 0.0, 1.0 )
|
|
2036
2036
|
#endif
|
|
2037
2037
|
uniform float toneMappingExposure;
|
|
@@ -2128,7 +2128,7 @@ vec3 NeutralToneMapping( vec3 color ) {
|
|
|
2128
2128
|
float g = 1. - 1. / (desaturation * (peak - newPeak) + 1.);
|
|
2129
2129
|
return mix(color, newPeak * vec3(1, 1, 1), g);
|
|
2130
2130
|
}
|
|
2131
|
-
vec3 CustomToneMapping( vec3 color ) { return color; }`,
|
|
2131
|
+
vec3 CustomToneMapping( vec3 color ) { return color; }`,hf=`#ifdef USE_TRANSMISSION
|
|
2132
2132
|
material.transmission = transmission;
|
|
2133
2133
|
material.transmissionAlpha = 1.0;
|
|
2134
2134
|
material.thickness = thickness;
|
|
@@ -2149,7 +2149,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,yf=`#ifdef USE_TRANSMISS
|
|
|
2149
2149
|
material.attenuationColor, material.attenuationDistance );
|
|
2150
2150
|
material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
|
|
2151
2151
|
totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );
|
|
2152
|
-
#endif`,
|
|
2152
|
+
#endif`,df=`#ifdef USE_TRANSMISSION
|
|
2153
2153
|
uniform float transmission;
|
|
2154
2154
|
uniform float thickness;
|
|
2155
2155
|
uniform float attenuationDistance;
|
|
@@ -2255,7 +2255,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,yf=`#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`,
|
|
2258
|
+
#endif`,ff=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
|
|
2259
2259
|
varying vec2 vUv;
|
|
2260
2260
|
#endif
|
|
2261
2261
|
#ifdef USE_MAP
|
|
@@ -2325,7 +2325,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,yf=`#ifdef USE_TRANSMISS
|
|
|
2325
2325
|
#ifdef USE_THICKNESSMAP
|
|
2326
2326
|
uniform mat3 thicknessMapTransform;
|
|
2327
2327
|
varying vec2 vThicknessMapUv;
|
|
2328
|
-
#endif`,
|
|
2328
|
+
#endif`,pf=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
|
|
2329
2329
|
varying vec2 vUv;
|
|
2330
2330
|
#endif
|
|
2331
2331
|
#ifdef USE_MAP
|
|
@@ -2419,7 +2419,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,yf=`#ifdef USE_TRANSMISS
|
|
|
2419
2419
|
#ifdef USE_THICKNESSMAP
|
|
2420
2420
|
uniform mat3 thicknessMapTransform;
|
|
2421
2421
|
varying vec2 vThicknessMapUv;
|
|
2422
|
-
#endif`,
|
|
2422
|
+
#endif`,mf=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
|
|
2423
2423
|
vUv = vec3( uv, 1 ).xy;
|
|
2424
2424
|
#endif
|
|
2425
2425
|
#ifdef USE_MAP
|
|
@@ -2490,7 +2490,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,yf=`#ifdef USE_TRANSMISS
|
|
|
2490
2490
|
#endif
|
|
2491
2491
|
#ifdef USE_THICKNESSMAP
|
|
2492
2492
|
vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
|
|
2493
|
-
#endif`,
|
|
2493
|
+
#endif`,gf=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
|
|
2494
2494
|
vec4 worldPosition = vec4( transformed, 1.0 );
|
|
2495
2495
|
#ifdef USE_BATCHING
|
|
2496
2496
|
worldPosition = batchingMatrix * worldPosition;
|
|
@@ -2499,12 +2499,12 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,yf=`#ifdef USE_TRANSMISS
|
|
|
2499
2499
|
worldPosition = instanceMatrix * worldPosition;
|
|
2500
2500
|
#endif
|
|
2501
2501
|
worldPosition = modelMatrix * worldPosition;
|
|
2502
|
-
#endif`;const
|
|
2502
|
+
#endif`;const _f=`varying vec2 vUv;
|
|
2503
2503
|
uniform mat3 uvTransform;
|
|
2504
2504
|
void main() {
|
|
2505
2505
|
vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
|
|
2506
2506
|
gl_Position = vec4( position.xy, 1.0, 1.0 );
|
|
2507
|
-
}`,
|
|
2507
|
+
}`,vf=`uniform sampler2D t2D;
|
|
2508
2508
|
uniform float backgroundIntensity;
|
|
2509
2509
|
varying vec2 vUv;
|
|
2510
2510
|
void main() {
|
|
@@ -2516,14 +2516,14 @@ void main() {
|
|
|
2516
2516
|
gl_FragColor = texColor;
|
|
2517
2517
|
#include <tonemapping_fragment>
|
|
2518
2518
|
#include <colorspace_fragment>
|
|
2519
|
-
}`,
|
|
2519
|
+
}`,xf=`varying vec3 vWorldDirection;
|
|
2520
2520
|
#include <common>
|
|
2521
2521
|
void main() {
|
|
2522
2522
|
vWorldDirection = transformDirection( position, modelMatrix );
|
|
2523
2523
|
#include <begin_vertex>
|
|
2524
2524
|
#include <project_vertex>
|
|
2525
2525
|
gl_Position.z = gl_Position.w;
|
|
2526
|
-
}`,
|
|
2526
|
+
}`,Mf=`#ifdef ENVMAP_TYPE_CUBE
|
|
2527
2527
|
uniform samplerCube envMap;
|
|
2528
2528
|
#elif defined( ENVMAP_TYPE_CUBE_UV )
|
|
2529
2529
|
uniform sampler2D envMap;
|
|
@@ -2546,14 +2546,14 @@ void main() {
|
|
|
2546
2546
|
gl_FragColor = texColor;
|
|
2547
2547
|
#include <tonemapping_fragment>
|
|
2548
2548
|
#include <colorspace_fragment>
|
|
2549
|
-
}`,
|
|
2549
|
+
}`,Sf=`varying vec3 vWorldDirection;
|
|
2550
2550
|
#include <common>
|
|
2551
2551
|
void main() {
|
|
2552
2552
|
vWorldDirection = transformDirection( position, modelMatrix );
|
|
2553
2553
|
#include <begin_vertex>
|
|
2554
2554
|
#include <project_vertex>
|
|
2555
2555
|
gl_Position.z = gl_Position.w;
|
|
2556
|
-
}`,
|
|
2556
|
+
}`,Ef=`uniform samplerCube tCube;
|
|
2557
2557
|
uniform float tFlip;
|
|
2558
2558
|
uniform float opacity;
|
|
2559
2559
|
varying vec3 vWorldDirection;
|
|
@@ -2563,7 +2563,7 @@ void main() {
|
|
|
2563
2563
|
gl_FragColor.a *= opacity;
|
|
2564
2564
|
#include <tonemapping_fragment>
|
|
2565
2565
|
#include <colorspace_fragment>
|
|
2566
|
-
}`,
|
|
2566
|
+
}`,yf=`#include <common>
|
|
2567
2567
|
#include <batching_pars_vertex>
|
|
2568
2568
|
#include <uv_pars_vertex>
|
|
2569
2569
|
#include <displacementmap_pars_vertex>
|
|
@@ -2590,7 +2590,7 @@ void main() {
|
|
|
2590
2590
|
#include <logdepthbuf_vertex>
|
|
2591
2591
|
#include <clipping_planes_vertex>
|
|
2592
2592
|
vHighPrecisionZW = gl_Position.zw;
|
|
2593
|
-
}`,
|
|
2593
|
+
}`,bf=`#if DEPTH_PACKING == 3200
|
|
2594
2594
|
uniform float opacity;
|
|
2595
2595
|
#endif
|
|
2596
2596
|
#include <common>
|
|
@@ -2620,7 +2620,7 @@ void main() {
|
|
|
2620
2620
|
#elif DEPTH_PACKING == 3201
|
|
2621
2621
|
gl_FragColor = packDepthToRGBA( fragCoordZ );
|
|
2622
2622
|
#endif
|
|
2623
|
-
}`,
|
|
2623
|
+
}`,Df=`#define DISTANCE
|
|
2624
2624
|
varying vec3 vWorldPosition;
|
|
2625
2625
|
#include <common>
|
|
2626
2626
|
#include <batching_pars_vertex>
|
|
@@ -2647,7 +2647,7 @@ void main() {
|
|
|
2647
2647
|
#include <worldpos_vertex>
|
|
2648
2648
|
#include <clipping_planes_vertex>
|
|
2649
2649
|
vWorldPosition = worldPosition.xyz;
|
|
2650
|
-
}`,
|
|
2650
|
+
}`,Tf=`#define DISTANCE
|
|
2651
2651
|
uniform vec3 referencePosition;
|
|
2652
2652
|
uniform float nearDistance;
|
|
2653
2653
|
uniform float farDistance;
|
|
@@ -2671,13 +2671,13 @@ void main () {
|
|
|
2671
2671
|
dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
|
|
2672
2672
|
dist = saturate( dist );
|
|
2673
2673
|
gl_FragColor = packDepthToRGBA( dist );
|
|
2674
|
-
}`,
|
|
2674
|
+
}`,Af=`varying vec3 vWorldDirection;
|
|
2675
2675
|
#include <common>
|
|
2676
2676
|
void main() {
|
|
2677
2677
|
vWorldDirection = transformDirection( position, modelMatrix );
|
|
2678
2678
|
#include <begin_vertex>
|
|
2679
2679
|
#include <project_vertex>
|
|
2680
|
-
}`,
|
|
2680
|
+
}`,wf=`uniform sampler2D tEquirect;
|
|
2681
2681
|
varying vec3 vWorldDirection;
|
|
2682
2682
|
#include <common>
|
|
2683
2683
|
void main() {
|
|
@@ -2686,7 +2686,7 @@ void main() {
|
|
|
2686
2686
|
gl_FragColor = texture2D( tEquirect, sampleUV );
|
|
2687
2687
|
#include <tonemapping_fragment>
|
|
2688
2688
|
#include <colorspace_fragment>
|
|
2689
|
-
}`,
|
|
2689
|
+
}`,Cf=`uniform float scale;
|
|
2690
2690
|
attribute float lineDistance;
|
|
2691
2691
|
varying float vLineDistance;
|
|
2692
2692
|
#include <common>
|
|
@@ -2708,7 +2708,7 @@ void main() {
|
|
|
2708
2708
|
#include <logdepthbuf_vertex>
|
|
2709
2709
|
#include <clipping_planes_vertex>
|
|
2710
2710
|
#include <fog_vertex>
|
|
2711
|
-
}`,
|
|
2711
|
+
}`,Rf=`uniform vec3 diffuse;
|
|
2712
2712
|
uniform float opacity;
|
|
2713
2713
|
uniform float dashSize;
|
|
2714
2714
|
uniform float totalSize;
|
|
@@ -2736,7 +2736,7 @@ void main() {
|
|
|
2736
2736
|
#include <colorspace_fragment>
|
|
2737
2737
|
#include <fog_fragment>
|
|
2738
2738
|
#include <premultiplied_alpha_fragment>
|
|
2739
|
-
}`,
|
|
2739
|
+
}`,Pf=`#include <common>
|
|
2740
2740
|
#include <batching_pars_vertex>
|
|
2741
2741
|
#include <uv_pars_vertex>
|
|
2742
2742
|
#include <envmap_pars_vertex>
|
|
@@ -2768,7 +2768,7 @@ void main() {
|
|
|
2768
2768
|
#include <worldpos_vertex>
|
|
2769
2769
|
#include <envmap_vertex>
|
|
2770
2770
|
#include <fog_vertex>
|
|
2771
|
-
}`,
|
|
2771
|
+
}`,Lf=`uniform vec3 diffuse;
|
|
2772
2772
|
uniform float opacity;
|
|
2773
2773
|
#ifndef FLAT_SHADED
|
|
2774
2774
|
varying vec3 vNormal;
|
|
@@ -2816,7 +2816,7 @@ void main() {
|
|
|
2816
2816
|
#include <fog_fragment>
|
|
2817
2817
|
#include <premultiplied_alpha_fragment>
|
|
2818
2818
|
#include <dithering_fragment>
|
|
2819
|
-
}`,
|
|
2819
|
+
}`,Ff=`#define LAMBERT
|
|
2820
2820
|
varying vec3 vViewPosition;
|
|
2821
2821
|
#include <common>
|
|
2822
2822
|
#include <batching_pars_vertex>
|
|
@@ -2855,7 +2855,7 @@ void main() {
|
|
|
2855
2855
|
#include <envmap_vertex>
|
|
2856
2856
|
#include <shadowmap_vertex>
|
|
2857
2857
|
#include <fog_vertex>
|
|
2858
|
-
}`,
|
|
2858
|
+
}`,Uf=`#define LAMBERT
|
|
2859
2859
|
uniform vec3 diffuse;
|
|
2860
2860
|
uniform vec3 emissive;
|
|
2861
2861
|
uniform float opacity;
|
|
@@ -2912,7 +2912,7 @@ void main() {
|
|
|
2912
2912
|
#include <fog_fragment>
|
|
2913
2913
|
#include <premultiplied_alpha_fragment>
|
|
2914
2914
|
#include <dithering_fragment>
|
|
2915
|
-
}`,
|
|
2915
|
+
}`,Nf=`#define MATCAP
|
|
2916
2916
|
varying vec3 vViewPosition;
|
|
2917
2917
|
#include <common>
|
|
2918
2918
|
#include <batching_pars_vertex>
|
|
@@ -2946,7 +2946,7 @@ void main() {
|
|
|
2946
2946
|
#include <clipping_planes_vertex>
|
|
2947
2947
|
#include <fog_vertex>
|
|
2948
2948
|
vViewPosition = - mvPosition.xyz;
|
|
2949
|
-
}`,
|
|
2949
|
+
}`,If=`#define MATCAP
|
|
2950
2950
|
uniform vec3 diffuse;
|
|
2951
2951
|
uniform float opacity;
|
|
2952
2952
|
uniform sampler2D matcap;
|
|
@@ -2992,7 +2992,7 @@ void main() {
|
|
|
2992
2992
|
#include <fog_fragment>
|
|
2993
2993
|
#include <premultiplied_alpha_fragment>
|
|
2994
2994
|
#include <dithering_fragment>
|
|
2995
|
-
}`,
|
|
2995
|
+
}`,Of=`#define NORMAL
|
|
2996
2996
|
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
|
|
2997
2997
|
varying vec3 vViewPosition;
|
|
2998
2998
|
#endif
|
|
@@ -3025,7 +3025,7 @@ void main() {
|
|
|
3025
3025
|
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
|
|
3026
3026
|
vViewPosition = - mvPosition.xyz;
|
|
3027
3027
|
#endif
|
|
3028
|
-
}`,
|
|
3028
|
+
}`,Bf=`#define NORMAL
|
|
3029
3029
|
uniform float opacity;
|
|
3030
3030
|
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
|
|
3031
3031
|
varying vec3 vViewPosition;
|
|
@@ -3047,7 +3047,7 @@ void main() {
|
|
|
3047
3047
|
#ifdef OPAQUE
|
|
3048
3048
|
gl_FragColor.a = 1.0;
|
|
3049
3049
|
#endif
|
|
3050
|
-
}`,
|
|
3050
|
+
}`,zf=`#define PHONG
|
|
3051
3051
|
varying vec3 vViewPosition;
|
|
3052
3052
|
#include <common>
|
|
3053
3053
|
#include <batching_pars_vertex>
|
|
@@ -3086,7 +3086,7 @@ void main() {
|
|
|
3086
3086
|
#include <envmap_vertex>
|
|
3087
3087
|
#include <shadowmap_vertex>
|
|
3088
3088
|
#include <fog_vertex>
|
|
3089
|
-
}
|
|
3089
|
+
}`,kf=`#define PHONG
|
|
3090
3090
|
uniform vec3 diffuse;
|
|
3091
3091
|
uniform vec3 emissive;
|
|
3092
3092
|
uniform vec3 specular;
|
|
@@ -3145,7 +3145,7 @@ void main() {
|
|
|
3145
3145
|
#include <fog_fragment>
|
|
3146
3146
|
#include <premultiplied_alpha_fragment>
|
|
3147
3147
|
#include <dithering_fragment>
|
|
3148
|
-
}`,
|
|
3148
|
+
}`,Hf=`#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
|
-
}`,
|
|
3191
|
+
}`,Vf=`#define STANDARD
|
|
3192
3192
|
#ifdef PHYSICAL
|
|
3193
3193
|
#define IOR
|
|
3194
3194
|
#define USE_SPECULAR
|
|
@@ -3310,7 +3310,7 @@ void main() {
|
|
|
3310
3310
|
#include <fog_fragment>
|
|
3311
3311
|
#include <premultiplied_alpha_fragment>
|
|
3312
3312
|
#include <dithering_fragment>
|
|
3313
|
-
}`,
|
|
3313
|
+
}`,Gf=`#define TOON
|
|
3314
3314
|
varying vec3 vViewPosition;
|
|
3315
3315
|
#include <common>
|
|
3316
3316
|
#include <batching_pars_vertex>
|
|
@@ -3347,7 +3347,7 @@ void main() {
|
|
|
3347
3347
|
#include <worldpos_vertex>
|
|
3348
3348
|
#include <shadowmap_vertex>
|
|
3349
3349
|
#include <fog_vertex>
|
|
3350
|
-
}`,
|
|
3350
|
+
}`,Wf=`#define TOON
|
|
3351
3351
|
uniform vec3 diffuse;
|
|
3352
3352
|
uniform vec3 emissive;
|
|
3353
3353
|
uniform float opacity;
|
|
@@ -3400,7 +3400,7 @@ void main() {
|
|
|
3400
3400
|
#include <fog_fragment>
|
|
3401
3401
|
#include <premultiplied_alpha_fragment>
|
|
3402
3402
|
#include <dithering_fragment>
|
|
3403
|
-
}`,
|
|
3403
|
+
}`,Xf=`uniform float size;
|
|
3404
3404
|
uniform float scale;
|
|
3405
3405
|
#include <common>
|
|
3406
3406
|
#include <color_pars_vertex>
|
|
@@ -3431,7 +3431,7 @@ void main() {
|
|
|
3431
3431
|
#include <clipping_planes_vertex>
|
|
3432
3432
|
#include <worldpos_vertex>
|
|
3433
3433
|
#include <fog_vertex>
|
|
3434
|
-
}`,
|
|
3434
|
+
}`,Yf=`uniform vec3 diffuse;
|
|
3435
3435
|
uniform float opacity;
|
|
3436
3436
|
#include <common>
|
|
3437
3437
|
#include <color_pars_fragment>
|
|
@@ -3456,7 +3456,7 @@ void main() {
|
|
|
3456
3456
|
#include <colorspace_fragment>
|
|
3457
3457
|
#include <fog_fragment>
|
|
3458
3458
|
#include <premultiplied_alpha_fragment>
|
|
3459
|
-
}`,
|
|
3459
|
+
}`,jf=`#include <common>
|
|
3460
3460
|
#include <batching_pars_vertex>
|
|
3461
3461
|
#include <fog_pars_vertex>
|
|
3462
3462
|
#include <morphtarget_pars_vertex>
|
|
@@ -3479,7 +3479,7 @@ void main() {
|
|
|
3479
3479
|
#include <worldpos_vertex>
|
|
3480
3480
|
#include <shadowmap_vertex>
|
|
3481
3481
|
#include <fog_vertex>
|
|
3482
|
-
}`,
|
|
3482
|
+
}`,qf=`uniform vec3 color;
|
|
3483
3483
|
uniform float opacity;
|
|
3484
3484
|
#include <common>
|
|
3485
3485
|
#include <packing>
|
|
@@ -3495,7 +3495,7 @@ void main() {
|
|
|
3495
3495
|
#include <tonemapping_fragment>
|
|
3496
3496
|
#include <colorspace_fragment>
|
|
3497
3497
|
#include <fog_fragment>
|
|
3498
|
-
}
|
|
3498
|
+
}`,$f=`uniform float rotation;
|
|
3499
3499
|
uniform vec2 center;
|
|
3500
3500
|
#include <common>
|
|
3501
3501
|
#include <uv_pars_vertex>
|
|
@@ -3521,7 +3521,7 @@ void main() {
|
|
|
3521
3521
|
#include <logdepthbuf_vertex>
|
|
3522
3522
|
#include <clipping_planes_vertex>
|
|
3523
3523
|
#include <fog_vertex>
|
|
3524
|
-
}`,
|
|
3524
|
+
}`,Kf=`uniform vec3 diffuse;
|
|
3525
3525
|
uniform float opacity;
|
|
3526
3526
|
#include <common>
|
|
3527
3527
|
#include <uv_pars_fragment>
|
|
@@ -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:Dh,alphahash_pars_fragment:Th,alphamap_fragment:Ah,alphamap_pars_fragment:wh,alphatest_fragment:Ch,alphatest_pars_fragment:Rh,aomap_fragment:Ph,aomap_pars_fragment:Lh,batching_pars_vertex:Fh,batching_vertex:Nh,begin_vertex:Uh,beginnormal_vertex:Ih,bsdfs:Oh,iridescence_fragment:zh,bumpmap_pars_fragment:Bh,clipping_planes_fragment:kh,clipping_planes_pars_fragment:Hh,clipping_planes_pars_vertex:Vh,clipping_planes_vertex:Gh,color_fragment:Wh,color_pars_fragment:Xh,color_pars_vertex:jh,color_vertex:Yh,common:qh,cube_uv_reflection_fragment:$h,defaultnormal_vertex:Kh,displacementmap_pars_vertex:Zh,displacementmap_vertex:Jh,emissivemap_fragment:Qh,emissivemap_pars_fragment:ed,colorspace_fragment:td,colorspace_pars_fragment:nd,envmap_fragment:id,envmap_common_pars_fragment:rd,envmap_pars_fragment:sd,envmap_pars_vertex:ad,envmap_physical_pars_fragment:xd,envmap_vertex:od,fog_vertex:ld,fog_pars_vertex:cd,fog_fragment:ud,fog_pars_fragment:hd,gradientmap_pars_fragment:dd,lightmap_fragment:fd,lightmap_pars_fragment:pd,lights_lambert_fragment:md,lights_lambert_pars_fragment:gd,lights_pars_begin:_d,lights_toon_fragment:vd,lights_toon_pars_fragment:yd,lights_phong_fragment:Md,lights_phong_pars_fragment:Sd,lights_physical_fragment:Ed,lights_physical_pars_fragment:bd,lights_fragment_begin:Dd,lights_fragment_maps:Td,lights_fragment_end:Ad,logdepthbuf_fragment:wd,logdepthbuf_pars_fragment:Cd,logdepthbuf_pars_vertex:Rd,logdepthbuf_vertex:Pd,map_fragment:Ld,map_pars_fragment:Fd,map_particle_fragment:Nd,map_particle_pars_fragment:Ud,metalnessmap_fragment:Id,metalnessmap_pars_fragment:Od,morphinstance_vertex:zd,morphcolor_vertex:Bd,morphnormal_vertex:kd,morphtarget_pars_vertex:Hd,morphtarget_vertex:Vd,normal_fragment_begin:Gd,normal_fragment_maps:Wd,normal_pars_fragment:Xd,normal_pars_vertex:jd,normal_vertex:Yd,normalmap_pars_fragment:qd,clearcoat_normal_fragment_begin:$d,clearcoat_normal_fragment_maps:Kd,clearcoat_pars_fragment:Zd,iridescence_pars_fragment:Jd,opaque_fragment:Qd,packing:ef,premultiplied_alpha_fragment:tf,project_vertex:nf,dithering_fragment:rf,dithering_pars_fragment:sf,roughnessmap_fragment:af,roughnessmap_pars_fragment:of,shadowmap_pars_fragment:lf,shadowmap_pars_vertex:cf,shadowmap_vertex:uf,shadowmask_pars_fragment:hf,skinbase_vertex:df,skinning_pars_vertex:ff,skinning_vertex:pf,skinnormal_vertex:mf,specularmap_fragment:gf,specularmap_pars_fragment:_f,tonemapping_fragment:xf,tonemapping_pars_fragment:vf,transmission_fragment:yf,transmission_pars_fragment:Mf,uv_pars_fragment:Sf,uv_pars_vertex:Ef,uv_vertex:bf,worldpos_vertex:Df,background_vert:Tf,background_frag:Af,backgroundCube_vert:wf,backgroundCube_frag:Cf,cube_vert:Rf,cube_frag:Pf,depth_vert:Lf,depth_frag:Ff,distanceRGBA_vert:Nf,distanceRGBA_frag:Uf,equirect_vert:If,equirect_frag:Of,linedashed_vert:zf,linedashed_frag:Bf,meshbasic_vert:kf,meshbasic_frag:Hf,meshlambert_vert:Vf,meshlambert_frag:Gf,meshmatcap_vert:Wf,meshmatcap_frag:Xf,meshnormal_vert:jf,meshnormal_frag:Yf,meshphong_vert:qf,meshphong_frag:$f,meshphysical_vert:Kf,meshphysical_frag:Zf,meshtoon_vert:Jf,meshtoon_frag:Qf,points_vert:ep,points_frag:tp,shadow_vert:np,shadow_frag:ip,sprite_vert:rp,sprite_frag:sp},ce={common:{diffuse:{value:new be(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new ze},alphaMap:{value:null},alphaMapTransform:{value:new ze},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new ze}},envmap:{envMap:{value:null},envMapRotation:{value:new ze},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new ze}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new ze}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new ze},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new ze},normalScale:{value:new he(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new ze},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new ze}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new ze}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new ze}},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 ze},alphaTest:{value:0},uvTransform:{value:new ze}},sprite:{diffuse:{value:new be(16777215)},opacity:{value:1},center:{value:new he(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new ze},alphaMap:{value:null},alphaMapTransform:{value:new ze},alphaTest:{value:0}}},Xt={basic:{uniforms:vt([ce.common,ce.specularmap,ce.envmap,ce.aomap,ce.lightmap,ce.fog]),vertexShader:Oe.meshbasic_vert,fragmentShader:Oe.meshbasic_frag},lambert:{uniforms:vt([ce.common,ce.specularmap,ce.envmap,ce.aomap,ce.lightmap,ce.emissivemap,ce.bumpmap,ce.normalmap,ce.displacementmap,ce.fog,ce.lights,{emissive:{value:new be(0)}}]),vertexShader:Oe.meshlambert_vert,fragmentShader:Oe.meshlambert_frag},phong:{uniforms:vt([ce.common,ce.specularmap,ce.envmap,ce.aomap,ce.lightmap,ce.emissivemap,ce.bumpmap,ce.normalmap,ce.displacementmap,ce.fog,ce.lights,{emissive:{value:new be(0)},specular:{value:new be(1118481)},shininess:{value:30}}]),vertexShader:Oe.meshphong_vert,fragmentShader:Oe.meshphong_frag},standard:{uniforms:vt([ce.common,ce.envmap,ce.aomap,ce.lightmap,ce.emissivemap,ce.bumpmap,ce.normalmap,ce.displacementmap,ce.roughnessmap,ce.metalnessmap,ce.fog,ce.lights,{emissive:{value:new be(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Oe.meshphysical_vert,fragmentShader:Oe.meshphysical_frag},toon:{uniforms:vt([ce.common,ce.aomap,ce.lightmap,ce.emissivemap,ce.bumpmap,ce.normalmap,ce.displacementmap,ce.gradientmap,ce.fog,ce.lights,{emissive:{value:new be(0)}}]),vertexShader:Oe.meshtoon_vert,fragmentShader:Oe.meshtoon_frag},matcap:{uniforms:vt([ce.common,ce.bumpmap,ce.normalmap,ce.displacementmap,ce.fog,{matcap:{value:null}}]),vertexShader:Oe.meshmatcap_vert,fragmentShader:Oe.meshmatcap_frag},points:{uniforms:vt([ce.points,ce.fog]),vertexShader:Oe.points_vert,fragmentShader:Oe.points_frag},dashed:{uniforms:vt([ce.common,ce.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Oe.linedashed_vert,fragmentShader:Oe.linedashed_frag},depth:{uniforms:vt([ce.common,ce.displacementmap]),vertexShader:Oe.depth_vert,fragmentShader:Oe.depth_frag},normal:{uniforms:vt([ce.common,ce.bumpmap,ce.normalmap,ce.displacementmap,{opacity:{value:1}}]),vertexShader:Oe.meshnormal_vert,fragmentShader:Oe.meshnormal_frag},sprite:{uniforms:vt([ce.sprite,ce.fog]),vertexShader:Oe.sprite_vert,fragmentShader:Oe.sprite_frag},background:{uniforms:{uvTransform:{value:new ze},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 ze}},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([ce.common,ce.displacementmap,{referencePosition:{value:new R},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Oe.distanceRGBA_vert,fragmentShader:Oe.distanceRGBA_frag},shadow:{uniforms:vt([ce.lights,ce.fog,{color:{value:new be(0)},opacity:{value:1}}]),vertexShader:Oe.shadow_vert,fragmentShader:Oe.shadow_frag}};Xt.physical={uniforms:vt([Xt.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new ze},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new ze},clearcoatNormalScale:{value:new he(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new ze},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new ze},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new ze},sheen:{value:0},sheenColor:{value:new be(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new ze},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new ze},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new ze},transmissionSamplerSize:{value:new he},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new ze},attenuationDistance:{value:0},attenuationColor:{value:new be(0)},specularColor:{value:new be(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new ze},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new ze},anisotropyVector:{value:new he},anisotropyMap:{value:null},anisotropyMapTransform:{value:new ze}}]),vertexShader:Oe.meshphysical_vert,fragmentShader:Oe.meshphysical_frag};const dr={r:0,b:0,g:0},wn=new rn,ap=new et;function op(i,e,t,n,r,s,a){const o=new be(0);let l=s===!0?0:1,c,d,u=null,h=0,p=null;function _(m,f){let b=!1,v=f.isScene===!0?f.background:null;v&&v.isTexture&&(v=(f.backgroundBlurriness>0?t:e).get(v)),v===null?x(o,l):v&&v.isColor&&(x(v,1),b=!0);const D=i.xr.getEnvironmentBlendMode();D==="additive"?n.buffers.color.setClear(0,0,0,1,a):D==="alpha-blend"&&n.buffers.color.setClear(0,0,0,0,a),(i.autoClear||b)&&i.clear(i.autoClearColor,i.autoClearDepth,i.autoClearStencil),v&&(v.isCubeTexture||v.mapping===Nr)?(d===void 0&&(d=new bt(new Vi(1,1,1),new ft({name:"BackgroundCubeMaterial",uniforms:xi(Xt.backgroundCube.uniforms),vertexShader:Xt.backgroundCube.vertexShader,fragmentShader:Xt.backgroundCube.fragmentShader,side:yt,depthTest:!1,depthWrite:!1,fog:!1})),d.geometry.deleteAttribute("normal"),d.geometry.deleteAttribute("uv"),d.onBeforeRender=function(P,T,w){this.matrixWorld.copyPosition(w.matrixWorld)},Object.defineProperty(d.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(d)),wn.copy(f.backgroundRotation),wn.x*=-1,wn.y*=-1,wn.z*=-1,v.isCubeTexture&&v.isRenderTargetTexture===!1&&(wn.y*=-1,wn.z*=-1),d.material.uniforms.envMap.value=v,d.material.uniforms.flipEnvMap.value=v.isCubeTexture&&v.isRenderTargetTexture===!1?-1:1,d.material.uniforms.backgroundBlurriness.value=f.backgroundBlurriness,d.material.uniforms.backgroundIntensity.value=f.backgroundIntensity,d.material.uniforms.backgroundRotation.value.setFromMatrix4(ap.makeRotationFromEuler(wn)),d.material.toneMapped=$e.getTransfer(v.colorSpace)!==Ke,(u!==v||h!==v.version||p!==i.toneMapping)&&(d.material.needsUpdate=!0,u=v,h=v.version,p=i.toneMapping),d.layers.enableAll(),m.unshift(d,d.geometry,d.material,0,0,null)):v&&v.isTexture&&(c===void 0&&(c=new bt(new Or(2,2),new ft({name:"BackgroundMaterial",uniforms:xi(Xt.background.uniforms),vertexShader:Xt.background.vertexShader,fragmentShader:Xt.background.fragmentShader,side:yn,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=f.backgroundIntensity,c.material.toneMapped=$e.getTransfer(v.colorSpace)!==Ke,v.matrixAutoUpdate===!0&&v.updateMatrix(),c.material.uniforms.uvTransform.value.copy(v.matrix),(u!==v||h!==v.version||p!==i.toneMapping)&&(c.material.needsUpdate=!0,u=v,h=v.version,p=i.toneMapping),c.layers.enableAll(),m.unshift(c,c.geometry,c.material,0,0,null))}function x(m,f){m.getRGB(dr,El(i)),n.buffers.color.setClear(dr.r,dr.g,dr.b,f,a)}return{getClearColor:function(){return o},setClearColor:function(m,f=1){o.set(m),l=f,x(o,l)},getClearAlpha:function(){return l},setClearAlpha:function(m){l=m,x(o,l)},render:_}}function lp(i,e){const t=i.getParameter(i.MAX_VERTEX_ATTRIBS),n={},r=h(null);let s=r,a=!1;function o(y,U,I,C,k){let G=!1;const $=u(C,I,U);s!==$&&(s=$,c(s.object)),G=p(y,C,I,k),G&&_(y,C,I,k),k!==null&&e.update(k,i.ELEMENT_ARRAY_BUFFER),(G||a)&&(a=!1,D(y,U,I,C),k!==null&&i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.get(k).buffer))}function l(){return i.createVertexArray()}function c(y){return i.bindVertexArray(y)}function d(y){return i.deleteVertexArray(y)}function u(y,U,I){const C=I.wireframe===!0;let k=n[y.id];k===void 0&&(k={},n[y.id]=k);let G=k[U.id];G===void 0&&(G={},k[U.id]=G);let $=G[C];return $===void 0&&($=h(l()),G[C]=$),$}function h(y){const U=[],I=[],C=[];for(let k=0;k<t;k++)U[k]=0,I[k]=0,C[k]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:U,enabledAttributes:I,attributeDivisors:C,object:y,attributes:{},index:null}}function p(y,U,I,C){const k=s.attributes,G=U.attributes;let $=0;const te=I.getAttributes();for(const B in te)if(te[B].location>=0){const q=k[B];let F=G[B];if(F===void 0&&(B==="instanceMatrix"&&y.instanceMatrix&&(F=y.instanceMatrix),B==="instanceColor"&&y.instanceColor&&(F=y.instanceColor)),q===void 0||q.attribute!==F||F&&q.data!==F.data)return!0;$++}return s.attributesNum!==$||s.index!==C}function _(y,U,I,C){const k={},G=U.attributes;let $=0;const te=I.getAttributes();for(const B in te)if(te[B].location>=0){let q=G[B];q===void 0&&(B==="instanceMatrix"&&y.instanceMatrix&&(q=y.instanceMatrix),B==="instanceColor"&&y.instanceColor&&(q=y.instanceColor));const F={};F.attribute=q,q&&q.data&&(F.data=q.data),k[B]=F,$++}s.attributes=k,s.attributesNum=$,s.index=C}function x(){const y=s.newAttributes;for(let U=0,I=y.length;U<I;U++)y[U]=0}function m(y){f(y,0)}function f(y,U){const I=s.newAttributes,C=s.enabledAttributes,k=s.attributeDivisors;I[y]=1,C[y]===0&&(i.enableVertexAttribArray(y),C[y]=1),k[y]!==U&&(i.vertexAttribDivisor(y,U),k[y]=U)}function b(){const y=s.newAttributes,U=s.enabledAttributes;for(let I=0,C=U.length;I<C;I++)U[I]!==y[I]&&(i.disableVertexAttribArray(I),U[I]=0)}function v(y,U,I,C,k,G,$){$===!0?i.vertexAttribIPointer(y,U,I,k,G):i.vertexAttribPointer(y,U,I,C,k,G)}function D(y,U,I,C){x();const k=C.attributes,G=I.getAttributes(),$=U.defaultAttributeValues;for(const te in G){const B=G[te];if(B.location>=0){let K=k[te];if(K===void 0&&(te==="instanceMatrix"&&y.instanceMatrix&&(K=y.instanceMatrix),te==="instanceColor"&&y.instanceColor&&(K=y.instanceColor)),K!==void 0){const q=K.normalized,F=K.itemSize,ee=e.get(K);if(ee===void 0)continue;const me=ee.buffer,N=ee.type,Q=ee.bytesPerElement,ue=N===i.INT||N===i.UNSIGNED_INT||K.gpuType===ol;if(K.isInterleavedBufferAttribute){const ie=K.data,ve=ie.stride,De=K.offset;if(ie.isInstancedInterleavedBuffer){for(let Ce=0;Ce<B.locationSize;Ce++)f(B.location+Ce,ie.meshPerAttribute);y.isInstancedMesh!==!0&&C._maxInstanceCount===void 0&&(C._maxInstanceCount=ie.meshPerAttribute*ie.count)}else for(let Ce=0;Ce<B.locationSize;Ce++)m(B.location+Ce);i.bindBuffer(i.ARRAY_BUFFER,me);for(let Ce=0;Ce<B.locationSize;Ce++)v(B.location+Ce,F/B.locationSize,N,q,ve*Q,(De+F/B.locationSize*Ce)*Q,ue)}else{if(K.isInstancedBufferAttribute){for(let ie=0;ie<B.locationSize;ie++)f(B.location+ie,K.meshPerAttribute);y.isInstancedMesh!==!0&&C._maxInstanceCount===void 0&&(C._maxInstanceCount=K.meshPerAttribute*K.count)}else for(let ie=0;ie<B.locationSize;ie++)m(B.location+ie);i.bindBuffer(i.ARRAY_BUFFER,me);for(let ie=0;ie<B.locationSize;ie++)v(B.location+ie,F/B.locationSize,N,q,F*Q,F/B.locationSize*ie*Q,ue)}}else if($!==void 0){const q=$[te];if(q!==void 0)switch(q.length){case 2:i.vertexAttrib2fv(B.location,q);break;case 3:i.vertexAttrib3fv(B.location,q);break;case 4:i.vertexAttrib4fv(B.location,q);break;default:i.vertexAttrib1fv(B.location,q)}}}}b()}function P(){L();for(const y in n){const U=n[y];for(const I in U){const C=U[I];for(const k in C)d(C[k].object),delete C[k];delete U[I]}delete n[y]}}function T(y){if(n[y.id]===void 0)return;const U=n[y.id];for(const I in U){const C=U[I];for(const k in C)d(C[k].object),delete C[k];delete U[I]}delete n[y.id]}function w(y){for(const U in n){const I=n[U];if(I[y.id]===void 0)continue;const C=I[y.id];for(const k in C)d(C[k].object),delete C[k];delete I[y.id]}}function L(){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:L,resetDefaultState:S,dispose:P,releaseStatesOfGeometry:T,releaseStatesOfProgram:w,initAttributes:x,enableAttribute:m,disableUnusedAttributes:b}}function cp(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,d){d!==0&&(i.drawArraysInstanced(n,l,c,d),t.update(c,n,d))}function o(l,c,d){if(d===0)return;const u=e.get("WEBGL_multi_draw");if(u===null)for(let h=0;h<d;h++)this.render(l[h],c[h]);else{u.multiDrawArraysWEBGL(n,l,0,c,0,d);let h=0;for(let p=0;p<d;p++)h+=c[p];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),d=i.getParameter(i.MAX_VERTEX_TEXTURE_IMAGE_UNITS),u=i.getParameter(i.MAX_TEXTURE_SIZE),h=i.getParameter(i.MAX_CUBE_MAP_TEXTURE_SIZE),p=i.getParameter(i.MAX_VERTEX_ATTRIBS),_=i.getParameter(i.MAX_VERTEX_UNIFORM_VECTORS),x=i.getParameter(i.MAX_VARYING_VECTORS),m=i.getParameter(i.MAX_FRAGMENT_UNIFORM_VECTORS),f=d>0,b=i.getParameter(i.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:r,getMaxPrecision:s,precision:a,logarithmicDepthBuffer:l,maxTextures:c,maxVertexTextures:d,maxTextureSize:u,maxCubemapSize:h,maxAttributes:p,maxVertexUniforms:_,maxVaryings:x,maxFragmentUniforms:m,vertexTextures:f,maxSamples:b}}function hp(i){const e=this;let t=null,n=0,r=!1,s=!1;const a=new pn,o=new ze,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(u,h){const p=u.length!==0||h||n!==0||r;return r=h,n=u.length,p},this.beginShadows=function(){s=!0,d(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(u,h){t=d(u,h,0)},this.setState=function(u,h,p){const _=u.clippingPlanes,x=u.clipIntersection,m=u.clipShadows,f=i.get(u);if(!r||_===null||_.length===0||s&&!m)s?d(null):c();else{const b=s?0:n,v=b*4;let D=f.clippingState||null;l.value=D,D=d(_,h,v,p);for(let P=0;P!==v;++P)D[P]=t[P];f.clippingState=D,this.numIntersection=x?this.numPlanes:0,this.numPlanes+=b}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function d(u,h,p,_){const x=u!==null?u.length:0;let m=null;if(x!==0){if(m=l.value,_!==!0||m===null){const f=p+x*4,b=h.matrixWorldInverse;o.getNormalMatrix(b),(m===null||m.length<f)&&(m=new Float32Array(f));for(let v=0,D=p;v!==x;++v,D+=4)a.copy(u[v]).applyMatrix4(b,o),a.normal.toArray(m,D),m[D+3]=a.constant}l.value=m,l.needsUpdate=!0}return e.numPlanes=x,e.numIntersection=0,m}}function dp(i){let e=new WeakMap;function t(a,o){return o===Us?a.mapping=mi:o===Is&&(a.mapping=gi),a}function n(a){if(a&&a.isTexture){const o=a.mapping;if(o===Us||o===Is)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 Mh(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 wl extends bl{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,d=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,a=s+c*this.view.width,o-=d*this.view.offsetY,l=o-d*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 ci=4,go=[.125,.215,.35,.446,.526,.582],Ln=20,ms=new wl,_o=new be;let gs=null,_s=0,xs=0,vs=!1;const Rn=(1+Math.sqrt(5))/2,oi=1/Rn,xo=[new R(1,1,1),new R(-1,1,1),new R(1,1,-1),new R(-1,1,-1),new R(0,Rn,oi),new R(0,Rn,-oi),new R(oi,0,Rn),new R(-oi,0,Rn),new R(Rn,oi,0),new R(-Rn,oi,0)];class vo{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){gs=this._renderer.getRenderTarget(),_s=this._renderer.getActiveCubeFace(),xs=this._renderer.getActiveMipmapLevel(),vs=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=So(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=Mo(),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(gs,_s,xs),this._renderer.xr.enabled=vs,e.scissorTest=!1,fr(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===mi||e.mapping===gi?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),gs=this._renderer.getRenderTarget(),_s=this._renderer.getActiveCubeFace(),xs=this._renderer.getActiveMipmapLevel(),vs=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:Ht,minFilter:Ht,generateMipmaps:!1,type:vn,format:Yt,colorSpace:Mn,depthBuffer:!1},r=yo(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=yo(e,t,n);const{_lodMax:s}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=fp(s)),this._blurMaterial=pp(s,e,t)}return r}_compileMaterial(e){const t=new bt(this._lodPlanes[0],e);this._renderer.compile(t,ms)}_sceneToCubeUV(e,t,n,r){const o=new Lt(90,1,t,n),l=[1,-1,1,1,1,1],c=[1,1,1,-1,-1,-1],d=this._renderer,u=d.autoClear,h=d.toneMapping;d.getClearColor(_o),d.toneMapping=_n,d.autoClear=!1;const p=new Hi({name:"PMREM.Background",side:yt,depthWrite:!1,depthTest:!1}),_=new bt(new Vi,p);let x=!1;const m=e.background;m?m.isColor&&(p.color.copy(m),e.background=null,x=!0):(p.color.copy(_o),x=!0);for(let f=0;f<6;f++){const b=f%3;b===0?(o.up.set(0,l[f],0),o.lookAt(c[f],0,0)):b===1?(o.up.set(0,0,l[f]),o.lookAt(0,c[f],0)):(o.up.set(0,l[f],0),o.lookAt(0,0,c[f]));const v=this._cubeSize;fr(r,b*v,f>2?v:0,v,v),d.setRenderTarget(r),x&&d.render(_,o),d.render(e,o)}_.geometry.dispose(),_.material.dispose(),d.toneMapping=h,d.autoClear=u,e.background=m}_textureToCubeUV(e,t){const n=this._renderer,r=e.mapping===mi||e.mapping===gi;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=So()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=Mo());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;fr(t,0,0,3*l,2*l),n.setRenderTarget(t),n.render(a,ms)}_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=xo[(r-1)%xo.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 d=3,u=new bt(this._lodPlanes[r],c),h=c.uniforms,p=this._sizeLods[n]-1,_=isFinite(s)?Math.PI/(2*p):2*Math.PI/(2*Ln-1),x=s/_,m=isFinite(s)?1+Math.floor(d*x):Ln;m>Ln&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${m} samples when the maximum is set to ${Ln}`);const f=[];let b=0;for(let w=0;w<Ln;++w){const L=w/x,S=Math.exp(-L*L/2);f.push(S),w===0?b+=S:w<m&&(b+=2*S)}for(let w=0;w<f.length;w++)f[w]=f[w]/b;h.envMap.value=e.texture,h.samples.value=m,h.weights.value=f,h.latitudinal.value=a==="latitudinal",o&&(h.poleAxis.value=o);const{_lodMax:v}=this;h.dTheta.value=_,h.mipInt.value=v-n;const D=this._sizeLods[r],P=3*D*(r>v-ci?r-v+ci:0),T=4*(this._cubeSize-D);fr(t,P,T,3*D,2*D),l.setRenderTarget(t),l.render(u,ms)}}function fp(i){const e=[],t=[],n=[];let r=i;const s=i-ci+1+go.length;for(let a=0;a<s;a++){const o=Math.pow(2,r);t.push(o);let l=1/o;a>i-ci?l=go[a-i+ci-1]:a===0&&(l=0),n.push(l);const c=1/(o-2),d=-c,u=1+c,h=[d,d,u,d,u,u,d,d,u,u,d,u],p=6,_=6,x=3,m=2,f=1,b=new Float32Array(x*_*p),v=new Float32Array(m*_*p),D=new Float32Array(f*_*p);for(let T=0;T<p;T++){const w=T%3*2/3-1,L=T>2?0:-1,S=[w,L,0,w+2/3,L,0,w+2/3,L+1,0,w,L,0,w+2/3,L+1,0,w,L+1,0];b.set(S,x*_*T),v.set(h,m*_*T);const y=[T,T,T,T,T,T];D.set(y,f*_*T)}const P=new _t;P.setAttribute("position",new Et(b,x)),P.setAttribute("uv",new Et(v,m)),P.setAttribute("faceIndex",new Et(D,f)),e.push(P),r>ci&&r--}return{lodPlanes:e,sizeLods:t,sigmas:n}}function yo(i,e,t){const n=new Gt(i,e,t);return n.texture.mapping=Nr,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function fr(i,e,t,n,r){i.viewport.set(e,t,n,r),i.scissor.set(e,t,n,r)}function pp(i,e,t){const n=new Float32Array(Ln),r=new R(0,1,0);return new ft({name:"SphericalGaussianBlur",defines:{n:Ln,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:qs(),fragmentShader:`
|
|
3549
|
+
}`,Oe={alphahash_fragment:gh,alphahash_pars_fragment:_h,alphamap_fragment:vh,alphamap_pars_fragment:xh,alphatest_fragment:Mh,alphatest_pars_fragment:Sh,aomap_fragment:Eh,aomap_pars_fragment:yh,batching_pars_vertex:bh,batching_vertex:Dh,begin_vertex:Th,beginnormal_vertex:Ah,bsdfs:wh,iridescence_fragment:Ch,bumpmap_pars_fragment:Rh,clipping_planes_fragment:Ph,clipping_planes_pars_fragment:Lh,clipping_planes_pars_vertex:Fh,clipping_planes_vertex:Uh,color_fragment:Nh,color_pars_fragment:Ih,color_pars_vertex:Oh,color_vertex:Bh,common:zh,cube_uv_reflection_fragment:kh,defaultnormal_vertex:Hh,displacementmap_pars_vertex:Vh,displacementmap_vertex:Gh,emissivemap_fragment:Wh,emissivemap_pars_fragment:Xh,colorspace_fragment:Yh,colorspace_pars_fragment:jh,envmap_fragment:qh,envmap_common_pars_fragment:$h,envmap_pars_fragment:Kh,envmap_pars_vertex:Zh,envmap_physical_pars_fragment:cd,envmap_vertex:Jh,fog_vertex:Qh,fog_pars_vertex:ed,fog_fragment:td,fog_pars_fragment:nd,gradientmap_pars_fragment:id,lightmap_fragment:rd,lightmap_pars_fragment:sd,lights_lambert_fragment:ad,lights_lambert_pars_fragment:od,lights_pars_begin:ld,lights_toon_fragment:ud,lights_toon_pars_fragment:hd,lights_phong_fragment:dd,lights_phong_pars_fragment:fd,lights_physical_fragment:pd,lights_physical_pars_fragment:md,lights_fragment_begin:gd,lights_fragment_maps:_d,lights_fragment_end:vd,logdepthbuf_fragment:xd,logdepthbuf_pars_fragment:Md,logdepthbuf_pars_vertex:Sd,logdepthbuf_vertex:Ed,map_fragment:yd,map_pars_fragment:bd,map_particle_fragment:Dd,map_particle_pars_fragment:Td,metalnessmap_fragment:Ad,metalnessmap_pars_fragment:wd,morphinstance_vertex:Cd,morphcolor_vertex:Rd,morphnormal_vertex:Pd,morphtarget_pars_vertex:Ld,morphtarget_vertex:Fd,normal_fragment_begin:Ud,normal_fragment_maps:Nd,normal_pars_fragment:Id,normal_pars_vertex:Od,normal_vertex:Bd,normalmap_pars_fragment:zd,clearcoat_normal_fragment_begin:kd,clearcoat_normal_fragment_maps:Hd,clearcoat_pars_fragment:Vd,iridescence_pars_fragment:Gd,opaque_fragment:Wd,packing:Xd,premultiplied_alpha_fragment:Yd,project_vertex:jd,dithering_fragment:qd,dithering_pars_fragment:$d,roughnessmap_fragment:Kd,roughnessmap_pars_fragment:Zd,shadowmap_pars_fragment:Jd,shadowmap_pars_vertex:Qd,shadowmap_vertex:ef,shadowmask_pars_fragment:tf,skinbase_vertex:nf,skinning_pars_vertex:rf,skinning_vertex:sf,skinnormal_vertex:af,specularmap_fragment:of,specularmap_pars_fragment:lf,tonemapping_fragment:cf,tonemapping_pars_fragment:uf,transmission_fragment:hf,transmission_pars_fragment:df,uv_pars_fragment:ff,uv_pars_vertex:pf,uv_vertex:mf,worldpos_vertex:gf,background_vert:_f,background_frag:vf,backgroundCube_vert:xf,backgroundCube_frag:Mf,cube_vert:Sf,cube_frag:Ef,depth_vert:yf,depth_frag:bf,distanceRGBA_vert:Df,distanceRGBA_frag:Tf,equirect_vert:Af,equirect_frag:wf,linedashed_vert:Cf,linedashed_frag:Rf,meshbasic_vert:Pf,meshbasic_frag:Lf,meshlambert_vert:Ff,meshlambert_frag:Uf,meshmatcap_vert:Nf,meshmatcap_frag:If,meshnormal_vert:Of,meshnormal_frag:Bf,meshphong_vert:zf,meshphong_frag:kf,meshphysical_vert:Hf,meshphysical_frag:Vf,meshtoon_vert:Gf,meshtoon_frag:Wf,points_vert:Xf,points_frag:Yf,shadow_vert:jf,shadow_frag:qf,sprite_vert:$f,sprite_frag:Kf},oe={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:xt([oe.common,oe.specularmap,oe.envmap,oe.aomap,oe.lightmap,oe.fog]),vertexShader:Oe.meshbasic_vert,fragmentShader:Oe.meshbasic_frag},lambert:{uniforms:xt([oe.common,oe.specularmap,oe.envmap,oe.aomap,oe.lightmap,oe.emissivemap,oe.bumpmap,oe.normalmap,oe.displacementmap,oe.fog,oe.lights,{emissive:{value:new be(0)}}]),vertexShader:Oe.meshlambert_vert,fragmentShader:Oe.meshlambert_frag},phong:{uniforms:xt([oe.common,oe.specularmap,oe.envmap,oe.aomap,oe.lightmap,oe.emissivemap,oe.bumpmap,oe.normalmap,oe.displacementmap,oe.fog,oe.lights,{emissive:{value:new be(0)},specular:{value:new be(1118481)},shininess:{value:30}}]),vertexShader:Oe.meshphong_vert,fragmentShader:Oe.meshphong_frag},standard:{uniforms:xt([oe.common,oe.envmap,oe.aomap,oe.lightmap,oe.emissivemap,oe.bumpmap,oe.normalmap,oe.displacementmap,oe.roughnessmap,oe.metalnessmap,oe.fog,oe.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:xt([oe.common,oe.aomap,oe.lightmap,oe.emissivemap,oe.bumpmap,oe.normalmap,oe.displacementmap,oe.gradientmap,oe.fog,oe.lights,{emissive:{value:new be(0)}}]),vertexShader:Oe.meshtoon_vert,fragmentShader:Oe.meshtoon_frag},matcap:{uniforms:xt([oe.common,oe.bumpmap,oe.normalmap,oe.displacementmap,oe.fog,{matcap:{value:null}}]),vertexShader:Oe.meshmatcap_vert,fragmentShader:Oe.meshmatcap_frag},points:{uniforms:xt([oe.points,oe.fog]),vertexShader:Oe.points_vert,fragmentShader:Oe.points_frag},dashed:{uniforms:xt([oe.common,oe.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Oe.linedashed_vert,fragmentShader:Oe.linedashed_frag},depth:{uniforms:xt([oe.common,oe.displacementmap]),vertexShader:Oe.depth_vert,fragmentShader:Oe.depth_frag},normal:{uniforms:xt([oe.common,oe.bumpmap,oe.normalmap,oe.displacementmap,{opacity:{value:1}}]),vertexShader:Oe.meshnormal_vert,fragmentShader:Oe.meshnormal_frag},sprite:{uniforms:xt([oe.sprite,oe.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:xt([oe.common,oe.displacementmap,{referencePosition:{value:new R},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Oe.distanceRGBA_vert,fragmentShader:Oe.distanceRGBA_frag},shadow:{uniforms:xt([oe.lights,oe.fog,{color:{value:new be(0)},opacity:{value:1}}]),vertexShader:Oe.shadow_vert,fragmentShader:Oe.shadow_frag}};Gt.physical={uniforms:xt([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 ur={r:0,b:0,g:0},Tn=new tn,Zf=new et;function Jf(i,e,t,n,r,s,a){const o=new be(0);let l=s===!0?0:1,c,h,d=null,u=0,p=null;function _(m,f){let b=!1,x=f.isScene===!0?f.background:null;x&&x.isTexture&&(x=(f.backgroundBlurriness>0?t:e).get(x)),x===null?v(o,l):x&&x.isColor&&(v(x,1),b=!0);const D=i.xr.getEnvironmentBlendMode();D==="additive"?n.buffers.color.setClear(0,0,0,1,a):D==="alpha-blend"&&n.buffers.color.setClear(0,0,0,0,a),(i.autoClear||b)&&i.clear(i.autoClearColor,i.autoClearDepth,i.autoClearStencil),x&&(x.isCubeTexture||x.mapping===Lr)?(h===void 0&&(h=new bt(new ki(1,1,1),new ft({name:"BackgroundCubeMaterial",uniforms:gi(Gt.backgroundCube.uniforms),vertexShader:Gt.backgroundCube.vertexShader,fragmentShader:Gt.backgroundCube.fragmentShader,side:Mt,depthTest:!1,depthWrite:!1,fog:!1})),h.geometry.deleteAttribute("normal"),h.geometry.deleteAttribute("uv"),h.onBeforeRender=function(P,T,w){this.matrixWorld.copyPosition(w.matrixWorld)},Object.defineProperty(h.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(h)),Tn.copy(f.backgroundRotation),Tn.x*=-1,Tn.y*=-1,Tn.z*=-1,x.isCubeTexture&&x.isRenderTargetTexture===!1&&(Tn.y*=-1,Tn.z*=-1),h.material.uniforms.envMap.value=x,h.material.uniforms.flipEnvMap.value=x.isCubeTexture&&x.isRenderTargetTexture===!1?-1:1,h.material.uniforms.backgroundBlurriness.value=f.backgroundBlurriness,h.material.uniforms.backgroundIntensity.value=f.backgroundIntensity,h.material.uniforms.backgroundRotation.value.setFromMatrix4(Zf.makeRotationFromEuler(Tn)),h.material.toneMapped=$e.getTransfer(x.colorSpace)!==Ke,(d!==x||u!==x.version||p!==i.toneMapping)&&(h.material.needsUpdate=!0,d=x,u=x.version,p=i.toneMapping),h.layers.enableAll(),m.unshift(h,h.geometry,h.material,0,0,null)):x&&x.isTexture&&(c===void 0&&(c=new bt(new Nr(2,2),new ft({name:"BackgroundMaterial",uniforms:gi(Gt.background.uniforms),vertexShader:Gt.background.vertexShader,fragmentShader:Gt.background.fragmentShader,side:vn,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=x,c.material.uniforms.backgroundIntensity.value=f.backgroundIntensity,c.material.toneMapped=$e.getTransfer(x.colorSpace)!==Ke,x.matrixAutoUpdate===!0&&x.updateMatrix(),c.material.uniforms.uvTransform.value.copy(x.matrix),(d!==x||u!==x.version||p!==i.toneMapping)&&(c.material.needsUpdate=!0,d=x,u=x.version,p=i.toneMapping),c.layers.enableAll(),m.unshift(c,c.geometry,c.material,0,0,null))}function v(m,f){m.getRGB(ur,Sl(i)),n.buffers.color.setClear(ur.r,ur.g,ur.b,f,a)}return{getClearColor:function(){return o},setClearColor:function(m,f=1){o.set(m),l=f,v(o,l)},getClearAlpha:function(){return l},setClearAlpha:function(m){l=m,v(o,l)},render:_}}function Qf(i,e){const t=i.getParameter(i.MAX_VERTEX_ATTRIBS),n={},r=u(null);let s=r,a=!1;function o(M,N,I,C,z){let V=!1;const q=d(C,I,N);s!==q&&(s=q,c(s.object)),V=p(M,C,I,z),V&&_(M,C,I,z),z!==null&&e.update(z,i.ELEMENT_ARRAY_BUFFER),(V||a)&&(a=!1,D(M,N,I,C),z!==null&&i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.get(z).buffer))}function l(){return i.createVertexArray()}function c(M){return i.bindVertexArray(M)}function h(M){return i.deleteVertexArray(M)}function d(M,N,I){const C=I.wireframe===!0;let z=n[M.id];z===void 0&&(z={},n[M.id]=z);let V=z[N.id];V===void 0&&(V={},z[N.id]=V);let q=V[C];return q===void 0&&(q=u(l()),V[C]=q),q}function u(M){const N=[],I=[],C=[];for(let z=0;z<t;z++)N[z]=0,I[z]=0,C[z]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:N,enabledAttributes:I,attributeDivisors:C,object:M,attributes:{},index:null}}function p(M,N,I,C){const z=s.attributes,V=N.attributes;let q=0;const ee=I.getAttributes();for(const B in ee)if(ee[B].location>=0){const j=z[B];let F=V[B];if(F===void 0&&(B==="instanceMatrix"&&M.instanceMatrix&&(F=M.instanceMatrix),B==="instanceColor"&&M.instanceColor&&(F=M.instanceColor)),j===void 0||j.attribute!==F||F&&j.data!==F.data)return!0;q++}return s.attributesNum!==q||s.index!==C}function _(M,N,I,C){const z={},V=N.attributes;let q=0;const ee=I.getAttributes();for(const B in ee)if(ee[B].location>=0){let j=V[B];j===void 0&&(B==="instanceMatrix"&&M.instanceMatrix&&(j=M.instanceMatrix),B==="instanceColor"&&M.instanceColor&&(j=M.instanceColor));const F={};F.attribute=j,j&&j.data&&(F.data=j.data),z[B]=F,q++}s.attributes=z,s.attributesNum=q,s.index=C}function v(){const M=s.newAttributes;for(let N=0,I=M.length;N<I;N++)M[N]=0}function m(M){f(M,0)}function f(M,N){const I=s.newAttributes,C=s.enabledAttributes,z=s.attributeDivisors;I[M]=1,C[M]===0&&(i.enableVertexAttribArray(M),C[M]=1),z[M]!==N&&(i.vertexAttribDivisor(M,N),z[M]=N)}function b(){const M=s.newAttributes,N=s.enabledAttributes;for(let I=0,C=N.length;I<C;I++)N[I]!==M[I]&&(i.disableVertexAttribArray(I),N[I]=0)}function x(M,N,I,C,z,V,q){q===!0?i.vertexAttribIPointer(M,N,I,z,V):i.vertexAttribPointer(M,N,I,C,z,V)}function D(M,N,I,C){v();const z=C.attributes,V=I.getAttributes(),q=N.defaultAttributeValues;for(const ee in V){const B=V[ee];if(B.location>=0){let $=z[ee];if($===void 0&&(ee==="instanceMatrix"&&M.instanceMatrix&&($=M.instanceMatrix),ee==="instanceColor"&&M.instanceColor&&($=M.instanceColor)),$!==void 0){const j=$.normalized,F=$.itemSize,Q=e.get($);if(Q===void 0)continue;const pe=Q.buffer,U=Q.type,J=Q.bytesPerElement,le=U===i.INT||U===i.UNSIGNED_INT||$.gpuType===sl;if($.isInterleavedBufferAttribute){const ne=$.data,xe=ne.stride,De=$.offset;if(ne.isInstancedInterleavedBuffer){for(let Ce=0;Ce<B.locationSize;Ce++)f(B.location+Ce,ne.meshPerAttribute);M.isInstancedMesh!==!0&&C._maxInstanceCount===void 0&&(C._maxInstanceCount=ne.meshPerAttribute*ne.count)}else for(let Ce=0;Ce<B.locationSize;Ce++)m(B.location+Ce);i.bindBuffer(i.ARRAY_BUFFER,pe);for(let Ce=0;Ce<B.locationSize;Ce++)x(B.location+Ce,F/B.locationSize,U,j,xe*J,(De+F/B.locationSize*Ce)*J,le)}else{if($.isInstancedBufferAttribute){for(let ne=0;ne<B.locationSize;ne++)f(B.location+ne,$.meshPerAttribute);M.isInstancedMesh!==!0&&C._maxInstanceCount===void 0&&(C._maxInstanceCount=$.meshPerAttribute*$.count)}else for(let ne=0;ne<B.locationSize;ne++)m(B.location+ne);i.bindBuffer(i.ARRAY_BUFFER,pe);for(let ne=0;ne<B.locationSize;ne++)x(B.location+ne,F/B.locationSize,U,j,F*J,F/B.locationSize*ne*J,le)}}else if(q!==void 0){const j=q[ee];if(j!==void 0)switch(j.length){case 2:i.vertexAttrib2fv(B.location,j);break;case 3:i.vertexAttrib3fv(B.location,j);break;case 4:i.vertexAttrib4fv(B.location,j);break;default:i.vertexAttrib1fv(B.location,j)}}}}b()}function P(){L();for(const M in n){const N=n[M];for(const I in N){const C=N[I];for(const z in C)h(C[z].object),delete C[z];delete N[I]}delete n[M]}}function T(M){if(n[M.id]===void 0)return;const N=n[M.id];for(const I in N){const C=N[I];for(const z in C)h(C[z].object),delete C[z];delete N[I]}delete n[M.id]}function w(M){for(const N in n){const I=n[N];if(I[M.id]===void 0)continue;const C=I[M.id];for(const z in C)h(C[z].object),delete C[z];delete I[M.id]}}function L(){E(),a=!0,s!==r&&(s=r,c(s.object))}function E(){r.geometry=null,r.program=null,r.wireframe=!1}return{setup:o,reset:L,resetDefaultState:E,dispose:P,releaseStatesOfGeometry:T,releaseStatesOfProgram:w,initAttributes:v,enableAttribute:m,disableUnusedAttributes:b}}function ep(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,h){h!==0&&(i.drawArraysInstanced(n,l,c,h),t.update(c,n,h))}function o(l,c,h){if(h===0)return;const d=e.get("WEBGL_multi_draw");if(d===null)for(let u=0;u<h;u++)this.render(l[u],c[u]);else{d.multiDrawArraysWEBGL(n,l,0,c,0,h);let u=0;for(let p=0;p<h;p++)u+=c[p];t.update(u,n,1)}}this.setMode=r,this.render=s,this.renderInstances=a,this.renderMultiDraw=o}function tp(i,e,t){let n;function r(){if(n!==void 0)return n;if(e.has("EXT_texture_filter_anisotropic")===!0){const x=e.get("EXT_texture_filter_anisotropic");n=i.getParameter(x.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else n=0;return n}function s(x){if(x==="highp"){if(i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.HIGH_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision>0)return"highp";x="mediump"}return x==="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),h=i.getParameter(i.MAX_VERTEX_TEXTURE_IMAGE_UNITS),d=i.getParameter(i.MAX_TEXTURE_SIZE),u=i.getParameter(i.MAX_CUBE_MAP_TEXTURE_SIZE),p=i.getParameter(i.MAX_VERTEX_ATTRIBS),_=i.getParameter(i.MAX_VERTEX_UNIFORM_VECTORS),v=i.getParameter(i.MAX_VARYING_VECTORS),m=i.getParameter(i.MAX_FRAGMENT_UNIFORM_VECTORS),f=h>0,b=i.getParameter(i.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:r,getMaxPrecision:s,precision:a,logarithmicDepthBuffer:l,maxTextures:c,maxVertexTextures:h,maxTextureSize:d,maxCubemapSize:u,maxAttributes:p,maxVertexUniforms:_,maxVaryings:v,maxFragmentUniforms:m,vertexTextures:f,maxSamples:b}}function np(i){const e=this;let t=null,n=0,r=!1,s=!1;const a=new dn,o=new Be,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(d,u){const p=d.length!==0||u||n!==0||r;return r=u,n=d.length,p},this.beginShadows=function(){s=!0,h(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(d,u){t=h(d,u,0)},this.setState=function(d,u,p){const _=d.clippingPlanes,v=d.clipIntersection,m=d.clipShadows,f=i.get(d);if(!r||_===null||_.length===0||s&&!m)s?h(null):c();else{const b=s?0:n,x=b*4;let D=f.clippingState||null;l.value=D,D=h(_,u,x,p);for(let P=0;P!==x;++P)D[P]=t[P];f.clippingState=D,this.numIntersection=v?this.numPlanes:0,this.numPlanes+=b}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function h(d,u,p,_){const v=d!==null?d.length:0;let m=null;if(v!==0){if(m=l.value,_!==!0||m===null){const f=p+v*4,b=u.matrixWorldInverse;o.getNormalMatrix(b),(m===null||m.length<f)&&(m=new Float32Array(f));for(let x=0,D=p;x!==v;++x,D+=4)a.copy(d[x]).applyMatrix4(b,o),a.normal.toArray(m,D),m[D+3]=a.constant}l.value=m,l.needsUpdate=!0}return e.numPlanes=v,e.numIntersection=0,m}}function ip(i){let e=new WeakMap;function t(a,o){return o===Fs?a.mapping=fi:o===Us&&(a.mapping=pi),a}function n(a){if(a&&a.isTexture){const o=a.mapping;if(o===Fs||o===Us)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 dh(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 Tl extends El{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,h=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,a=s+c*this.view.width,o-=h*this.view.offsetY,l=o-h*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 oi=4,po=[.125,.215,.35,.446,.526,.582],Rn=20,fs=new Tl,mo=new be;let ps=null,ms=0,gs=0,_s=!1;const wn=(1+Math.sqrt(5))/2,si=1/wn,go=[new R(1,1,1),new R(-1,1,1),new R(1,1,-1),new R(-1,1,-1),new R(0,wn,si),new R(0,wn,-si),new R(si,0,wn),new R(-si,0,wn),new R(wn,si,0),new R(-wn,si,0)];class _o{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){ps=this._renderer.getRenderTarget(),ms=this._renderer.getActiveCubeFace(),gs=this._renderer.getActiveMipmapLevel(),_s=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=Mo(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=xo(),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(ps,ms,gs),this._renderer.xr.enabled=_s,e.scissorTest=!1,hr(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===fi||e.mapping===pi?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),ps=this._renderer.getRenderTarget(),ms=this._renderer.getActiveCubeFace(),gs=this._renderer.getActiveMipmapLevel(),_s=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:_n,format:Xt,colorSpace:xn,depthBuffer:!1},r=vo(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=vo(e,t,n);const{_lodMax:s}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=rp(s)),this._blurMaterial=sp(s,e,t)}return r}_compileMaterial(e){const t=new bt(this._lodPlanes[0],e);this._renderer.compile(t,fs)}_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],h=this._renderer,d=h.autoClear,u=h.toneMapping;h.getClearColor(mo),h.toneMapping=mn,h.autoClear=!1;const p=new zi({name:"PMREM.Background",side:Mt,depthWrite:!1,depthTest:!1}),_=new bt(new ki,p);let v=!1;const m=e.background;m?m.isColor&&(p.color.copy(m),e.background=null,v=!0):(p.color.copy(mo),v=!0);for(let f=0;f<6;f++){const b=f%3;b===0?(o.up.set(0,l[f],0),o.lookAt(c[f],0,0)):b===1?(o.up.set(0,0,l[f]),o.lookAt(0,c[f],0)):(o.up.set(0,l[f],0),o.lookAt(0,0,c[f]));const x=this._cubeSize;hr(r,b*x,f>2?x:0,x,x),h.setRenderTarget(r),v&&h.render(_,o),h.render(e,o)}_.geometry.dispose(),_.material.dispose(),h.toneMapping=u,h.autoClear=d,e.background=m}_textureToCubeUV(e,t){const n=this._renderer,r=e.mapping===fi||e.mapping===pi;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=Mo()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=xo());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;hr(t,0,0,3*l,2*l),n.setRenderTarget(t),n.render(a,fs)}_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=go[(r-1)%go.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 h=3,d=new bt(this._lodPlanes[r],c),u=c.uniforms,p=this._sizeLods[n]-1,_=isFinite(s)?Math.PI/(2*p):2*Math.PI/(2*Rn-1),v=s/_,m=isFinite(s)?1+Math.floor(h*v):Rn;m>Rn&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${m} samples when the maximum is set to ${Rn}`);const f=[];let b=0;for(let w=0;w<Rn;++w){const L=w/v,E=Math.exp(-L*L/2);f.push(E),w===0?b+=E:w<m&&(b+=2*E)}for(let w=0;w<f.length;w++)f[w]=f[w]/b;u.envMap.value=e.texture,u.samples.value=m,u.weights.value=f,u.latitudinal.value=a==="latitudinal",o&&(u.poleAxis.value=o);const{_lodMax:x}=this;u.dTheta.value=_,u.mipInt.value=x-n;const D=this._sizeLods[r],P=3*D*(r>x-oi?r-x+oi:0),T=4*(this._cubeSize-D);hr(t,P,T,3*D,2*D),l.setRenderTarget(t),l.render(d,fs)}}function rp(i){const e=[],t=[],n=[];let r=i;const s=i-oi+1+po.length;for(let a=0;a<s;a++){const o=Math.pow(2,r);t.push(o);let l=1/o;a>i-oi?l=po[a-i+oi-1]:a===0&&(l=0),n.push(l);const c=1/(o-2),h=-c,d=1+c,u=[h,h,d,h,d,d,h,h,d,d,h,d],p=6,_=6,v=3,m=2,f=1,b=new Float32Array(v*_*p),x=new Float32Array(m*_*p),D=new Float32Array(f*_*p);for(let T=0;T<p;T++){const w=T%3*2/3-1,L=T>2?0:-1,E=[w,L,0,w+2/3,L,0,w+2/3,L+1,0,w,L,0,w+2/3,L+1,0,w,L+1,0];b.set(E,v*_*T),x.set(u,m*_*T);const M=[T,T,T,T,T,T];D.set(M,f*_*T)}const P=new _t;P.setAttribute("position",new yt(b,v)),P.setAttribute("uv",new yt(x,m)),P.setAttribute("faceIndex",new yt(D,f)),e.push(P),r>oi&&r--}return{lodPlanes:e,sizeLods:t,sigmas:n}}function vo(i,e,t){const n=new Ht(i,e,t);return n.texture.mapping=Lr,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function hr(i,e,t,n,r){i.viewport.set(e,t,n,r),i.scissor.set(e,t,n,r)}function sp(i,e,t){const n=new Float32Array(Rn),r=new R(0,1,0);return new ft({name:"SphericalGaussianBlur",defines:{n:Rn,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:Ys(),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:
|
|
3609
|
+
`,blending:en,depthTest:!1,depthWrite:!1})}function xo(){return new ft({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Ys(),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:
|
|
3628
|
+
`,blending:en,depthTest:!1,depthWrite:!1})}function Mo(){return new ft({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Ys(),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:
|
|
3644
|
+
`,blending:en,depthTest:!1,depthWrite:!1})}function Ys(){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 mp(i){let e=new WeakMap,t=null;function n(o){if(o&&o.isTexture){const l=o.mapping,c=l===Us||l===Is,d=l===mi||l===gi;if(c||d){let u=e.get(o);const h=u!==void 0?u.texture.pmremVersion:0;if(o.isRenderTargetTexture&&o.pmremVersion!==h)return t===null&&(t=new vo(i)),u=c?t.fromEquirectangular(o,u):t.fromCubemap(o,u),u.texture.pmremVersion=o.pmremVersion,e.set(o,u),u.texture;if(u!==void 0)return u.texture;{const p=o.image;return c&&p&&p.height>0||d&&p&&r(p)?(t===null&&(t=new vo(i)),u=c?t.fromEquirectangular(o):t.fromCubemap(o),u.texture.pmremVersion=o.pmremVersion,e.set(o,u),o.addEventListener("dispose",s),u.texture):null}}}return o}function r(o){let l=0;const c=6;for(let d=0;d<c;d++)o[d]!==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 gp(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 _p(i,e,t,n){const r={},s=new WeakMap;function a(u){const h=u.target;h.index!==null&&e.remove(h.index);for(const _ in h.attributes)e.remove(h.attributes[_]);for(const _ in h.morphAttributes){const x=h.morphAttributes[_];for(let m=0,f=x.length;m<f;m++)e.remove(x[m])}h.removeEventListener("dispose",a),delete r[h.id];const p=s.get(h);p&&(e.remove(p),s.delete(h)),n.releaseStatesOfGeometry(h),h.isInstancedBufferGeometry===!0&&delete h._maxInstanceCount,t.memory.geometries--}function o(u,h){return r[h.id]===!0||(h.addEventListener("dispose",a),r[h.id]=!0,t.memory.geometries++),h}function l(u){const h=u.attributes;for(const _ in h)e.update(h[_],i.ARRAY_BUFFER);const p=u.morphAttributes;for(const _ in p){const x=p[_];for(let m=0,f=x.length;m<f;m++)e.update(x[m],i.ARRAY_BUFFER)}}function c(u){const h=[],p=u.index,_=u.attributes.position;let x=0;if(p!==null){const b=p.array;x=p.version;for(let v=0,D=b.length;v<D;v+=3){const P=b[v+0],T=b[v+1],w=b[v+2];h.push(P,T,T,w,w,P)}}else if(_!==void 0){const b=_.array;x=_.version;for(let v=0,D=b.length/3-1;v<D;v+=3){const P=v+0,T=v+1,w=v+2;h.push(P,T,T,w,w,P)}}else return;const m=new(gl(h)?Sl:Ml)(h,1);m.version=x;const f=s.get(u);f&&e.remove(f),s.set(u,m)}function d(u){const h=s.get(u);if(h){const p=u.index;p!==null&&h.version<p.version&&c(u)}else c(u);return s.get(u)}return{get:o,update:l,getWireframeAttribute:d}}function xp(i,e,t){let n;function r(u){n=u}let s,a;function o(u){s=u.type,a=u.bytesPerElement}function l(u,h){i.drawElements(n,h,s,u*a),t.update(h,n,1)}function c(u,h,p){p!==0&&(i.drawElementsInstanced(n,h,s,u*a,p),t.update(h,n,p))}function d(u,h,p){if(p===0)return;const _=e.get("WEBGL_multi_draw");if(_===null)for(let x=0;x<p;x++)this.render(u[x]/a,h[x]);else{_.multiDrawElementsWEBGL(n,h,0,s,u,0,p);let x=0;for(let m=0;m<p;m++)x+=h[m];t.update(x,n,1)}}this.setMode=r,this.setIndex=o,this.render=l,this.renderInstances=c,this.renderMultiDraw=d}function vp(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 yp(i,e,t){const n=new WeakMap,r=new dt;function s(a,o,l){const c=a.morphTargetInfluences,d=o.morphAttributes.position||o.morphAttributes.normal||o.morphAttributes.color,u=d!==void 0?d.length:0;let h=n.get(o);if(h===void 0||h.count!==u){let S=function(){w.dispose(),n.delete(o),o.removeEventListener("dispose",S)};h!==void 0&&h.texture.dispose();const p=o.morphAttributes.position!==void 0,_=o.morphAttributes.normal!==void 0,x=o.morphAttributes.color!==void 0,m=o.morphAttributes.position||[],f=o.morphAttributes.normal||[],b=o.morphAttributes.color||[];let v=0;p===!0&&(v=1),_===!0&&(v=2),x===!0&&(v=3);let D=o.attributes.position.count*v,P=1;D>e.maxTextureSize&&(P=Math.ceil(D/e.maxTextureSize),D=e.maxTextureSize);const T=new Float32Array(D*P*4*u),w=new xl(T,D,P,u);w.type=gn,w.needsUpdate=!0;const L=v*4;for(let y=0;y<u;y++){const U=m[y],I=f[y],C=b[y],k=D*P*4*y;for(let G=0;G<U.count;G++){const $=G*L;p===!0&&(r.fromBufferAttribute(U,G),T[k+$+0]=r.x,T[k+$+1]=r.y,T[k+$+2]=r.z,T[k+$+3]=0),_===!0&&(r.fromBufferAttribute(I,G),T[k+$+4]=r.x,T[k+$+5]=r.y,T[k+$+6]=r.z,T[k+$+7]=0),x===!0&&(r.fromBufferAttribute(C,G),T[k+$+8]=r.x,T[k+$+9]=r.y,T[k+$+10]=r.z,T[k+$+11]=C.itemSize===4?r.w:1)}}h={count:u,texture:w,size:new he(D,P)},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 p=0;for(let x=0;x<c.length;x++)p+=c[x];const _=o.morphTargetsRelative?1:1-p;l.getUniforms().setValue(i,"morphTargetBaseInfluence",_),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 Mp(i,e,t,n){let r=new WeakMap;function s(l){const c=n.render.frame,d=l.geometry,u=e.get(l,d);if(r.get(u)!==c&&(e.update(u),r.set(u,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 u}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 Cl extends Dt{constructor(e,t,n,r,s,a,o,l,c,d){if(d=d!==void 0?d:di,d!==di&&d!==Ui)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");n===void 0&&d===di&&(n=_i),n===void 0&&d===Ui&&(n=zi),super(null,r,s,a,o,l,d,n,c),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=o!==void 0?o:Ot,this.minFilter=l!==void 0?l:Ot,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 Rl=new Dt,Pl=new Cl(1,1);Pl.compareFunction=pl;const Ll=new xl,Fl=new ah,Nl=new Dl,Eo=[],bo=[],Do=new Float32Array(16),To=new Float32Array(9),Ao=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=Eo[r];if(s===void 0&&(s=new Float32Array(r),Eo[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 zr(i,e){let t=bo[e];t===void 0&&(t=new Int32Array(e),bo[e]=t);for(let n=0;n!==e;++n)t[n]=i.allocateTextureUnit();return t}function Sp(i,e){const t=this.cache;t[0]!==e&&(i.uniform1f(this.addr,e),t[0]=e)}function Ep(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 bp(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 Dp(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 Tp(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;Ao.set(n),i.uniformMatrix2fv(this.addr,!1,Ao),ot(t,n)}}function Ap(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;To.set(n),i.uniformMatrix3fv(this.addr,!1,To),ot(t,n)}}function wp(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;Do.set(n),i.uniformMatrix4fv(this.addr,!1,Do),ot(t,n)}}function Cp(i,e){const t=this.cache;t[0]!==e&&(i.uniform1i(this.addr,e),t[0]=e)}function Rp(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 Pp(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 Lp(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 Fp(i,e){const t=this.cache;t[0]!==e&&(i.uniform1ui(this.addr,e),t[0]=e)}function Np(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 Up(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 Ip(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 Op(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?Pl:Rl;t.setTexture2D(e||s,r)}function zp(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTexture3D(e||Fl,r)}function Bp(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTextureCube(e||Nl,r)}function kp(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTexture2DArray(e||Ll,r)}function Hp(i){switch(i){case 5126:return Sp;case 35664:return Ep;case 35665:return bp;case 35666:return Dp;case 35674:return Tp;case 35675:return Ap;case 35676:return wp;case 5124:case 35670:return Cp;case 35667:case 35671:return Rp;case 35668:case 35672:return Pp;case 35669:case 35673:return Lp;case 5125:return Fp;case 36294:return Np;case 36295:return Up;case 36296:return Ip;case 35678:case 36198:case 36298:case 36306:case 35682:return Op;case 35679:case 36299:case 36307:return zp;case 35680:case 36300:case 36308:case 36293:return Bp;case 36289:case 36303:case 36311:case 36292:return kp}}function Vp(i,e){i.uniform1fv(this.addr,e)}function Gp(i,e){const t=Mi(e,this.size,2);i.uniform2fv(this.addr,t)}function Wp(i,e){const t=Mi(e,this.size,3);i.uniform3fv(this.addr,t)}function Xp(i,e){const t=Mi(e,this.size,4);i.uniform4fv(this.addr,t)}function jp(i,e){const t=Mi(e,this.size,4);i.uniformMatrix2fv(this.addr,!1,t)}function Yp(i,e){const t=Mi(e,this.size,9);i.uniformMatrix3fv(this.addr,!1,t)}function qp(i,e){const t=Mi(e,this.size,16);i.uniformMatrix4fv(this.addr,!1,t)}function $p(i,e){i.uniform1iv(this.addr,e)}function Kp(i,e){i.uniform2iv(this.addr,e)}function Zp(i,e){i.uniform3iv(this.addr,e)}function Jp(i,e){i.uniform4iv(this.addr,e)}function Qp(i,e){i.uniform1uiv(this.addr,e)}function em(i,e){i.uniform2uiv(this.addr,e)}function tm(i,e){i.uniform3uiv(this.addr,e)}function nm(i,e){i.uniform4uiv(this.addr,e)}function im(i,e,t){const n=this.cache,r=e.length,s=zr(t,r);at(n,s)||(i.uniform1iv(this.addr,s),ot(n,s));for(let a=0;a!==r;++a)t.setTexture2D(e[a]||Rl,s[a])}function rm(i,e,t){const n=this.cache,r=e.length,s=zr(t,r);at(n,s)||(i.uniform1iv(this.addr,s),ot(n,s));for(let a=0;a!==r;++a)t.setTexture3D(e[a]||Fl,s[a])}function sm(i,e,t){const n=this.cache,r=e.length,s=zr(t,r);at(n,s)||(i.uniform1iv(this.addr,s),ot(n,s));for(let a=0;a!==r;++a)t.setTextureCube(e[a]||Nl,s[a])}function am(i,e,t){const n=this.cache,r=e.length,s=zr(t,r);at(n,s)||(i.uniform1iv(this.addr,s),ot(n,s));for(let a=0;a!==r;++a)t.setTexture2DArray(e[a]||Ll,s[a])}function om(i){switch(i){case 5126:return Vp;case 35664:return Gp;case 35665:return Wp;case 35666:return Xp;case 35674:return jp;case 35675:return Yp;case 35676:return qp;case 5124:case 35670:return $p;case 35667:case 35671:return Kp;case 35668:case 35672:return Zp;case 35669:case 35673:return Jp;case 5125:return Qp;case 36294:return em;case 36295:return tm;case 36296:return nm;case 35678:case 36198:case 36298:case 36306:case 35682:return im;case 35679:case 36299:case 36307:return rm;case 35680:case 36300:case 36308:case 36293:return sm;case 36289:case 36303:case 36311:case 36292:return am}}class lm{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=Hp(t.type)}}class cm{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=om(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 wo(i,e){i.seq.push(e),i.map[e.id]=e}function hm(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){wo(t,c===void 0?new lm(o,i,e):new cm(o,i,e));break}else{let u=t.map[o];u===void 0&&(u=new um(o),wo(t,u)),t=u}}}class br{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);hm(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 Co(i,e,t){const n=i.createShader(e);return i.shaderSource(n,t),i.compileShader(n),n}const dm=37297;let fm=0;function pm(i,e){const t=i.split(`
|
|
3699
|
+
`}function ap(i){let e=new WeakMap,t=null;function n(o){if(o&&o.isTexture){const l=o.mapping,c=l===Fs||l===Us,h=l===fi||l===pi;if(c||h){let d=e.get(o);const u=d!==void 0?d.texture.pmremVersion:0;if(o.isRenderTargetTexture&&o.pmremVersion!==u)return t===null&&(t=new _o(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 p=o.image;return c&&p&&p.height>0||h&&p&&r(p)?(t===null&&(t=new _o(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 h=0;h<c;h++)o[h]!==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 op(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 lp(i,e,t,n){const r={},s=new WeakMap;function a(d){const u=d.target;u.index!==null&&e.remove(u.index);for(const _ in u.attributes)e.remove(u.attributes[_]);for(const _ in u.morphAttributes){const v=u.morphAttributes[_];for(let m=0,f=v.length;m<f;m++)e.remove(v[m])}u.removeEventListener("dispose",a),delete r[u.id];const p=s.get(u);p&&(e.remove(p),s.delete(u)),n.releaseStatesOfGeometry(u),u.isInstancedBufferGeometry===!0&&delete u._maxInstanceCount,t.memory.geometries--}function o(d,u){return r[u.id]===!0||(u.addEventListener("dispose",a),r[u.id]=!0,t.memory.geometries++),u}function l(d){const u=d.attributes;for(const _ in u)e.update(u[_],i.ARRAY_BUFFER);const p=d.morphAttributes;for(const _ in p){const v=p[_];for(let m=0,f=v.length;m<f;m++)e.update(v[m],i.ARRAY_BUFFER)}}function c(d){const u=[],p=d.index,_=d.attributes.position;let v=0;if(p!==null){const b=p.array;v=p.version;for(let x=0,D=b.length;x<D;x+=3){const P=b[x+0],T=b[x+1],w=b[x+2];u.push(P,T,T,w,w,P)}}else if(_!==void 0){const b=_.array;v=_.version;for(let x=0,D=b.length/3-1;x<D;x+=3){const P=x+0,T=x+1,w=x+2;u.push(P,T,T,w,w,P)}}else return;const m=new(pl(u)?Ml:xl)(u,1);m.version=v;const f=s.get(d);f&&e.remove(f),s.set(d,m)}function h(d){const u=s.get(d);if(u){const p=d.index;p!==null&&u.version<p.version&&c(d)}else c(d);return s.get(d)}return{get:o,update:l,getWireframeAttribute:h}}function cp(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,u){i.drawElements(n,u,s,d*a),t.update(u,n,1)}function c(d,u,p){p!==0&&(i.drawElementsInstanced(n,u,s,d*a,p),t.update(u,n,p))}function h(d,u,p){if(p===0)return;const _=e.get("WEBGL_multi_draw");if(_===null)for(let v=0;v<p;v++)this.render(d[v]/a,u[v]);else{_.multiDrawElementsWEBGL(n,u,0,s,d,0,p);let v=0;for(let m=0;m<p;m++)v+=u[m];t.update(v,n,1)}}this.setMode=r,this.setIndex=o,this.render=l,this.renderInstances=c,this.renderMultiDraw=h}function up(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 hp(i,e,t){const n=new WeakMap,r=new dt;function s(a,o,l){const c=a.morphTargetInfluences,h=o.morphAttributes.position||o.morphAttributes.normal||o.morphAttributes.color,d=h!==void 0?h.length:0;let u=n.get(o);if(u===void 0||u.count!==d){let E=function(){w.dispose(),n.delete(o),o.removeEventListener("dispose",E)};u!==void 0&&u.texture.dispose();const p=o.morphAttributes.position!==void 0,_=o.morphAttributes.normal!==void 0,v=o.morphAttributes.color!==void 0,m=o.morphAttributes.position||[],f=o.morphAttributes.normal||[],b=o.morphAttributes.color||[];let x=0;p===!0&&(x=1),_===!0&&(x=2),v===!0&&(x=3);let D=o.attributes.position.count*x,P=1;D>e.maxTextureSize&&(P=Math.ceil(D/e.maxTextureSize),D=e.maxTextureSize);const T=new Float32Array(D*P*4*d),w=new gl(T,D,P,d);w.type=pn,w.needsUpdate=!0;const L=x*4;for(let M=0;M<d;M++){const N=m[M],I=f[M],C=b[M],z=D*P*4*M;for(let V=0;V<N.count;V++){const q=V*L;p===!0&&(r.fromBufferAttribute(N,V),T[z+q+0]=r.x,T[z+q+1]=r.y,T[z+q+2]=r.z,T[z+q+3]=0),_===!0&&(r.fromBufferAttribute(I,V),T[z+q+4]=r.x,T[z+q+5]=r.y,T[z+q+6]=r.z,T[z+q+7]=0),v===!0&&(r.fromBufferAttribute(C,V),T[z+q+8]=r.x,T[z+q+9]=r.y,T[z+q+10]=r.z,T[z+q+11]=C.itemSize===4?r.w:1)}}u={count:d,texture:w,size:new ue(D,P)},n.set(o,u),o.addEventListener("dispose",E)}if(a.isInstancedMesh===!0&&a.morphTexture!==null)l.getUniforms().setValue(i,"morphTexture",a.morphTexture,t);else{let p=0;for(let v=0;v<c.length;v++)p+=c[v];const _=o.morphTargetsRelative?1:1-p;l.getUniforms().setValue(i,"morphTargetBaseInfluence",_),l.getUniforms().setValue(i,"morphTargetInfluences",c)}l.getUniforms().setValue(i,"morphTargetsTexture",u.texture,t),l.getUniforms().setValue(i,"morphTargetsTextureSize",u.size)}return{update:s}}function dp(i,e,t,n){let r=new WeakMap;function s(l){const c=n.render.frame,h=l.geometry,d=e.get(l,h);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 u=l.skeleton;r.get(u)!==c&&(u.update(),r.set(u,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 Al extends Dt{constructor(e,t,n,r,s,a,o,l,c,h){if(h=h!==void 0?h:ui,h!==ui&&h!==Fi)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");n===void 0&&h===ui&&(n=mi),n===void 0&&h===Fi&&(n=Ii),super(null,r,s,a,o,l,h,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 wl=new Dt,Cl=new Al(1,1);Cl.compareFunction=dl;const Rl=new gl,Pl=new Zu,Ll=new yl,So=[],Eo=[],yo=new Float32Array(16),bo=new Float32Array(9),Do=new Float32Array(4);function xi(i,e,t){const n=i[0];if(n<=0||n>0)return i;const r=e*t;let s=So[r];if(s===void 0&&(s=new Float32Array(r),So[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 Ir(i,e){let t=Eo[e];t===void 0&&(t=new Int32Array(e),Eo[e]=t);for(let n=0;n!==e;++n)t[n]=i.allocateTextureUnit();return t}function fp(i,e){const t=this.cache;t[0]!==e&&(i.uniform1f(this.addr,e),t[0]=e)}function pp(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 mp(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 gp(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 _p(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;Do.set(n),i.uniformMatrix2fv(this.addr,!1,Do),ot(t,n)}}function vp(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;bo.set(n),i.uniformMatrix3fv(this.addr,!1,bo),ot(t,n)}}function xp(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;yo.set(n),i.uniformMatrix4fv(this.addr,!1,yo),ot(t,n)}}function Mp(i,e){const t=this.cache;t[0]!==e&&(i.uniform1i(this.addr,e),t[0]=e)}function Sp(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 Ep(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 yp(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 bp(i,e){const t=this.cache;t[0]!==e&&(i.uniform1ui(this.addr,e),t[0]=e)}function Dp(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 Tp(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 Ap(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 wp(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?Cl:wl;t.setTexture2D(e||s,r)}function Cp(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTexture3D(e||Pl,r)}function Rp(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTextureCube(e||Ll,r)}function Pp(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTexture2DArray(e||Rl,r)}function Lp(i){switch(i){case 5126:return fp;case 35664:return pp;case 35665:return mp;case 35666:return gp;case 35674:return _p;case 35675:return vp;case 35676:return xp;case 5124:case 35670:return Mp;case 35667:case 35671:return Sp;case 35668:case 35672:return Ep;case 35669:case 35673:return yp;case 5125:return bp;case 36294:return Dp;case 36295:return Tp;case 36296:return Ap;case 35678:case 36198:case 36298:case 36306:case 35682:return wp;case 35679:case 36299:case 36307:return Cp;case 35680:case 36300:case 36308:case 36293:return Rp;case 36289:case 36303:case 36311:case 36292:return Pp}}function Fp(i,e){i.uniform1fv(this.addr,e)}function Up(i,e){const t=xi(e,this.size,2);i.uniform2fv(this.addr,t)}function Np(i,e){const t=xi(e,this.size,3);i.uniform3fv(this.addr,t)}function Ip(i,e){const t=xi(e,this.size,4);i.uniform4fv(this.addr,t)}function Op(i,e){const t=xi(e,this.size,4);i.uniformMatrix2fv(this.addr,!1,t)}function Bp(i,e){const t=xi(e,this.size,9);i.uniformMatrix3fv(this.addr,!1,t)}function zp(i,e){const t=xi(e,this.size,16);i.uniformMatrix4fv(this.addr,!1,t)}function kp(i,e){i.uniform1iv(this.addr,e)}function Hp(i,e){i.uniform2iv(this.addr,e)}function Vp(i,e){i.uniform3iv(this.addr,e)}function Gp(i,e){i.uniform4iv(this.addr,e)}function Wp(i,e){i.uniform1uiv(this.addr,e)}function Xp(i,e){i.uniform2uiv(this.addr,e)}function Yp(i,e){i.uniform3uiv(this.addr,e)}function jp(i,e){i.uniform4uiv(this.addr,e)}function qp(i,e,t){const n=this.cache,r=e.length,s=Ir(t,r);at(n,s)||(i.uniform1iv(this.addr,s),ot(n,s));for(let a=0;a!==r;++a)t.setTexture2D(e[a]||wl,s[a])}function $p(i,e,t){const n=this.cache,r=e.length,s=Ir(t,r);at(n,s)||(i.uniform1iv(this.addr,s),ot(n,s));for(let a=0;a!==r;++a)t.setTexture3D(e[a]||Pl,s[a])}function Kp(i,e,t){const n=this.cache,r=e.length,s=Ir(t,r);at(n,s)||(i.uniform1iv(this.addr,s),ot(n,s));for(let a=0;a!==r;++a)t.setTextureCube(e[a]||Ll,s[a])}function Zp(i,e,t){const n=this.cache,r=e.length,s=Ir(t,r);at(n,s)||(i.uniform1iv(this.addr,s),ot(n,s));for(let a=0;a!==r;++a)t.setTexture2DArray(e[a]||Rl,s[a])}function Jp(i){switch(i){case 5126:return Fp;case 35664:return Up;case 35665:return Np;case 35666:return Ip;case 35674:return Op;case 35675:return Bp;case 35676:return zp;case 5124:case 35670:return kp;case 35667:case 35671:return Hp;case 35668:case 35672:return Vp;case 35669:case 35673:return Gp;case 5125:return Wp;case 36294:return Xp;case 36295:return Yp;case 36296:return jp;case 35678:case 36198:case 36298:case 36306:case 35682:return qp;case 35679:case 36299:case 36307:return $p;case 35680:case 36300:case 36308:case 36293:return Kp;case 36289:case 36303:case 36311:case 36292:return Zp}}class Qp{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=Lp(t.type)}}class em{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=Jp(t.type)}}class tm{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 vs=/(\w+)(\])?(\[|\.)?/g;function To(i,e){i.seq.push(e),i.map[e.id]=e}function nm(i,e,t){const n=i.name,r=n.length;for(vs.lastIndex=0;;){const s=vs.exec(n),a=vs.lastIndex;let o=s[1];const l=s[2]==="]",c=s[3];if(l&&(o=o|0),c===void 0||c==="["&&a+2===r){To(t,c===void 0?new Qp(o,i,e):new em(o,i,e));break}else{let d=t.map[o];d===void 0&&(d=new tm(o),To(t,d)),t=d}}}class Er{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 Ao(i,e,t){const n=i.createShader(e);return i.shaderSource(n,t),i.compileShader(n),n}const im=37297;let rm=0;function sm(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
|
|
3701
|
+
`)}function am(i){const e=$e.getPrimaries($e.workingColorSpace),t=$e.getPrimaries(i);let n;switch(e===t?n="":e===Ar&&t===Tr?n="LinearDisplayP3ToLinearSRGB":e===Tr&&t===Ar&&(n="LinearSRGBToLinearDisplayP3"),i){case xn:case Fr:return[n,"LinearTransferOETF"];case Ut:case Ws:return[n,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",i),[n,"LinearTransferOETF"]}}function wo(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
|
-
`+
|
|
3706
|
-
`)}function
|
|
3707
|
-
`)}function
|
|
3705
|
+
`+sm(i.getShaderSource(e),a)}else return r}function om(i,e){const t=am(e);return`vec4 ${i}( vec4 value ) { return ${t[0]}( ${t[1]}( value ) ); }`}function lm(i,e){let t;switch(e){case eu:t="Linear";break;case tu:t="Reinhard";break;case nu:t="OptimizedCineon";break;case Gs:t="ACESFilmic";break;case ru:t="AgX";break;case su:t="Neutral";break;case iu:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+i+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}function cm(i){return[i.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",i.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(wi).join(`
|
|
3706
|
+
`)}function um(i){const e=[];for(const t in i){const n=i[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(`
|
|
3707
|
+
`)}function hm(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 wi(i){return i!==""}function Co(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 Ro(i,e){return i.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const dm=/^[ \t]*#include +<([\w\d./]+)>/gm;function Os(i){return i.replace(dm,pm)}const fm=new Map([["encodings_fragment","colorspace_fragment"],["encodings_pars_fragment","colorspace_pars_fragment"],["output_fragment","opaque_fragment"]]);function pm(i,e){let t=Oe[e];if(t===void 0){const n=fm.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 Os(t)}const mm=/#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 Po(i){return i.replace(mm,gm)}function gm(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 Lo(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,30 +3724,30 @@ 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
|
|
3728
|
-
`:"";t.isRawShaderMaterial?(m=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_].filter(
|
|
3727
|
+
#define LOW_PRECISION`),e}function _m(i){let e="SHADOWMAP_TYPE_BASIC";return i.shadowMapType===tl?e="SHADOWMAP_TYPE_PCF":i.shadowMapType===Tc?e="SHADOWMAP_TYPE_PCF_SOFT":i.shadowMapType===Jt&&(e="SHADOWMAP_TYPE_VSM"),e}function vm(i){let e="ENVMAP_TYPE_CUBE";if(i.envMap)switch(i.envMapMode){case fi:case pi:e="ENVMAP_TYPE_CUBE";break;case Lr:e="ENVMAP_TYPE_CUBE_UV";break}return e}function xm(i){let e="ENVMAP_MODE_REFLECTION";return i.envMap&&i.envMapMode===pi&&(e="ENVMAP_MODE_REFRACTION"),e}function Mm(i){let e="ENVMAP_BLENDING_NONE";if(i.envMap)switch(i.combine){case nl:e="ENVMAP_BLENDING_MULTIPLY";break;case Jc:e="ENVMAP_BLENDING_MIX";break;case Qc:e="ENVMAP_BLENDING_ADD";break}return e}function Sm(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 Em(i,e,t,n){const r=i.getContext(),s=t.defines;let a=t.vertexShader,o=t.fragmentShader;const l=_m(t),c=vm(t),h=xm(t),d=Mm(t),u=Sm(t),p=cm(t),_=um(s),v=r.createProgram();let m,f,b=t.glslVersion?"#version "+t.glslVersion+`
|
|
3728
|
+
`:"";t.isRawShaderMaterial?(m=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_].filter(wi).join(`
|
|
3729
3729
|
`),m.length>0&&(m+=`
|
|
3730
|
-
`),f=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_].filter(
|
|
3730
|
+
`),f=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_].filter(wi).join(`
|
|
3731
3731
|
`),f.length>0&&(f+=`
|
|
3732
|
-
`)):(m=[
|
|
3733
|
-
`].filter(
|
|
3734
|
-
`),f=[
|
|
3735
|
-
`].filter(
|
|
3736
|
-
`)),a=
|
|
3732
|
+
`)):(m=[Lo(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_,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 "+h:"",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
|
+
`].filter(wi).join(`
|
|
3734
|
+
`),f=[Lo(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_,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 "+h:"",t.envMap?"#define "+d:"",u?"#define CUBEUV_TEXEL_WIDTH "+u.texelWidth:"",u?"#define CUBEUV_TEXEL_HEIGHT "+u.texelHeight:"",u?"#define CUBEUV_MAX_MIP "+u.maxMip+".0":"",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!==mn?"#define TONE_MAPPING":"",t.toneMapping!==mn?Oe.tonemapping_pars_fragment:"",t.toneMapping!==mn?lm("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",Oe.colorspace_pars_fragment,om("linearToOutputTexel",t.outputColorSpace),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`
|
|
3735
|
+
`].filter(wi).join(`
|
|
3736
|
+
`)),a=Os(a),a=Co(a,t),a=Ro(a,t),o=Os(o),o=Co(o,t),o=Ro(o,t),a=Po(a),o=Po(o),t.isRawShaderMaterial!==!0&&(b=`#version 300 es
|
|
3737
3737
|
`,m=[p,"#define attribute in","#define varying out","#define texture2D texture"].join(`
|
|
3738
3738
|
`)+`
|
|
3739
|
-
`+m,f=["#define varying in",t.glslVersion===
|
|
3739
|
+
`+m,f=["#define varying in",t.glslVersion===Ya?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===Ya?"":"#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
|
-
`+f);const
|
|
3741
|
+
`+f);const x=b+m+a,D=b+f+o,P=Ao(r,r.VERTEX_SHADER,x),T=Ao(r,r.FRAGMENT_SHADER,D);r.attachShader(v,P),r.attachShader(v,T),t.index0AttributeName!==void 0?r.bindAttribLocation(v,0,t.index0AttributeName):t.morphTargets===!0&&r.bindAttribLocation(v,0,"position"),r.linkProgram(v);function w(N){if(i.debug.checkShaderErrors){const I=r.getProgramInfoLog(v).trim(),C=r.getShaderInfoLog(P).trim(),z=r.getShaderInfoLog(T).trim();let V=!0,q=!0;if(r.getProgramParameter(v,r.LINK_STATUS)===!1)if(V=!1,typeof i.debug.onShaderError=="function")i.debug.onShaderError(r,v,P,T);else{const ee=wo(r,P,"vertex"),B=wo(r,T,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(v,r.VALIDATE_STATUS)+`
|
|
3742
3742
|
|
|
3743
|
-
Material Name: `+
|
|
3744
|
-
Material Type: `+
|
|
3743
|
+
Material Name: `+N.name+`
|
|
3744
|
+
Material Type: `+N.type+`
|
|
3745
3745
|
|
|
3746
3746
|
Program Info Log: `+I+`
|
|
3747
|
-
`+
|
|
3748
|
-
`+B)}else I!==""?console.warn("THREE.WebGLProgram: Program Info Log:",I):(C===""||k==="")&&($=!1);$&&(U.diagnostics={runnable:G,programLog:I,vertexShader:{log:C,prefix:m},fragmentShader:{log:k,prefix:f}})}r.deleteShader(P),r.deleteShader(T),L=new br(r,x),S=ym(r,x)}let L;this.getUniforms=function(){return L===void 0&&w(this),L};let S;this.getAttributes=function(){return S===void 0&&w(this),S};let y=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return y===!1&&(y=r.getProgramParameter(x,dm)),y},this.destroy=function(){n.releaseStatesOfProgram(this),r.deleteProgram(x),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=fm++,this.cacheKey=e,this.usedTimes=1,this.program=x,this.vertexShader=P,this.fragmentShader=T,this}let Lm=0;class Fm{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 Nm(e),t.set(e,n)),n}}class Nm{constructor(e){this.id=Lm++,this.code=e,this.usedTimes=0}}function Um(i,e,t,n,r,s,a){const o=new vl,l=new Fm,c=new Set,d=[],u=r.logarithmicDepthBuffer,h=r.vertexTextures;let p=r.precision;const _={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 x(S){return c.add(S),S===0?"uv":`uv${S}`}function m(S,y,U,I,C){const k=I.fog,G=C.geometry,$=S.isMeshStandardMaterial?I.environment:null,te=(S.isMeshStandardMaterial?t:e).get(S.envMap||$),B=te&&te.mapping===Nr?te.image.height:null,K=_[S.type];S.precision!==null&&(p=r.getMaxPrecision(S.precision),p!==S.precision&&console.warn("THREE.WebGLProgram.getParameters:",S.precision,"not supported, using",p,"instead."));const q=G.morphAttributes.position||G.morphAttributes.normal||G.morphAttributes.color,F=q!==void 0?q.length:0;let ee=0;G.morphAttributes.position!==void 0&&(ee=1),G.morphAttributes.normal!==void 0&&(ee=2),G.morphAttributes.color!==void 0&&(ee=3);let me,N,Q,ue;if(K){const lt=Xt[K];me=lt.vertexShader,N=lt.fragmentShader}else me=S.vertexShader,N=S.fragmentShader,l.update(S),Q=l.getVertexShaderID(S),ue=l.getFragmentShaderID(S);const ie=i.getRenderTarget(),ve=C.isInstancedMesh===!0,De=C.isBatchedMesh===!0,Ce=!!S.map,H=!!S.matcap,Fe=!!te,xe=!!S.aoMap,Ge=!!S.lightMap,Ee=!!S.bumpMap,We=!!S.normalMap,A=!!S.displacementMap,M=!!S.emissiveMap,Y=!!S.metalnessMap,J=!!S.roughnessMap,ne=S.anisotropy>0,re=S.clearcoat>0,Te=S.iridescence>0,ae=S.sheen>0,Se=S.transmission>0,Ae=ne&&!!S.anisotropyMap,le=re&&!!S.clearcoatMap,fe=re&&!!S.clearcoatNormalMap,Re=re&&!!S.clearcoatRoughnessMap,ge=Te&&!!S.iridescenceMap,_e=Te&&!!S.iridescenceThicknessMap,ke=ae&&!!S.sheenColorMap,He=ae&&!!S.sheenRoughnessMap,je=!!S.specularMap,Xe=!!S.specularColorMap,Ye=!!S.specularIntensityMap,ye=Se&&!!S.transmissionMap,g=Se&&!!S.thicknessMap,V=!!S.gradientMap,Z=!!S.alphaMap,oe=S.alphaTest>0,pe=!!S.alphaHash,Ve=!!S.extensions;let Be=_n;S.toneMapped&&(ie===null||ie.isXRRenderTarget===!0)&&(Be=i.toneMapping);const Ze={shaderID:K,shaderType:S.type,shaderName:S.name,vertexShader:me,fragmentShader:N,defines:S.defines,customVertexShaderID:Q,customFragmentShaderID:ue,isRawShaderMaterial:S.isRawShaderMaterial===!0,glslVersion:S.glslVersion,precision:p,batching:De,instancing:ve,instancingColor:ve&&C.instanceColor!==null,instancingMorph:ve&&C.morphTexture!==null,supportsVertexTextures:h,outputColorSpace:ie===null?i.outputColorSpace:ie.isXRRenderTarget===!0?ie.texture.colorSpace:Mn,alphaToCoverage:!!S.alphaToCoverage,map:Ce,matcap:H,envMap:Fe,envMapMode:Fe&&te.mapping,envMapCubeUVHeight:B,aoMap:xe,lightMap:Ge,bumpMap:Ee,normalMap:We,displacementMap:h&&A,emissiveMap:M,normalMapObjectSpace:We&&S.normalMapType===Cu,normalMapTangentSpace:We&&S.normalMapType===wu,metalnessMap:Y,roughnessMap:J,anisotropy:ne,anisotropyMap:Ae,clearcoat:re,clearcoatMap:le,clearcoatNormalMap:fe,clearcoatRoughnessMap:Re,iridescence:Te,iridescenceMap:ge,iridescenceThicknessMap:_e,sheen:ae,sheenColorMap:ke,sheenRoughnessMap:He,specularMap:je,specularColorMap:Xe,specularIntensityMap:Ye,transmission:Se,transmissionMap:ye,thicknessMap:g,gradientMap:V,opaque:S.transparent===!1&&S.blending===ui&&S.alphaToCoverage===!1,alphaMap:Z,alphaTest:oe,alphaHash:pe,combine:S.combine,mapUv:Ce&&x(S.map.channel),aoMapUv:xe&&x(S.aoMap.channel),lightMapUv:Ge&&x(S.lightMap.channel),bumpMapUv:Ee&&x(S.bumpMap.channel),normalMapUv:We&&x(S.normalMap.channel),displacementMapUv:A&&x(S.displacementMap.channel),emissiveMapUv:M&&x(S.emissiveMap.channel),metalnessMapUv:Y&&x(S.metalnessMap.channel),roughnessMapUv:J&&x(S.roughnessMap.channel),anisotropyMapUv:Ae&&x(S.anisotropyMap.channel),clearcoatMapUv:le&&x(S.clearcoatMap.channel),clearcoatNormalMapUv:fe&&x(S.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Re&&x(S.clearcoatRoughnessMap.channel),iridescenceMapUv:ge&&x(S.iridescenceMap.channel),iridescenceThicknessMapUv:_e&&x(S.iridescenceThicknessMap.channel),sheenColorMapUv:ke&&x(S.sheenColorMap.channel),sheenRoughnessMapUv:He&&x(S.sheenRoughnessMap.channel),specularMapUv:je&&x(S.specularMap.channel),specularColorMapUv:Xe&&x(S.specularColorMap.channel),specularIntensityMapUv:Ye&&x(S.specularIntensityMap.channel),transmissionMapUv:ye&&x(S.transmissionMap.channel),thicknessMapUv:g&&x(S.thicknessMap.channel),alphaMapUv:Z&&x(S.alphaMap.channel),vertexTangents:!!G.attributes.tangent&&(We||ne),vertexColors:S.vertexColors,vertexAlphas:S.vertexColors===!0&&!!G.attributes.color&&G.attributes.color.itemSize===4,pointsUvs:C.isPoints===!0&&!!G.attributes.uv&&(Ce||Z),fog:!!k,useFog:S.fog===!0,fogExp2:!!k&&k.isFogExp2,flatShading:S.flatShading===!0,sizeAttenuation:S.sizeAttenuation===!0,logarithmicDepthBuffer:u,skinning:C.isSkinnedMesh===!0,morphTargets:G.morphAttributes.position!==void 0,morphNormals:G.morphAttributes.normal!==void 0,morphColors:G.morphAttributes.color!==void 0,morphTargetsCount:F,morphTextureStride:ee,numDirLights:y.directional.length,numPointLights:y.point.length,numSpotLights:y.spot.length,numSpotLightMaps:y.spotLightMap.length,numRectAreaLights:y.rectArea.length,numHemiLights:y.hemi.length,numDirLightShadows:y.directionalShadowMap.length,numPointLightShadows:y.pointShadowMap.length,numSpotLightShadows:y.spotShadowMap.length,numSpotLightShadowsWithMaps:y.numSpotLightShadowsWithMaps,numLightProbes:y.numLightProbes,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:S.dithering,shadowMapEnabled:i.shadowMap.enabled&&U.length>0,shadowMapType:i.shadowMap.type,toneMapping:Be,useLegacyLights:i._useLegacyLights,decodeVideoTexture:Ce&&S.map.isVideoTexture===!0&&$e.getTransfer(S.map.colorSpace)===Ke,premultipliedAlpha:S.premultipliedAlpha,doubleSided:S.side===jt,flipSided:S.side===yt,useDepthPacking:S.depthPacking>=0,depthPacking:S.depthPacking||0,index0AttributeName:S.index0AttributeName,extensionClipCullDistance:Ve&&S.extensions.clipCullDistance===!0&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:Ve&&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 f(S){const y=[];if(S.shaderID?y.push(S.shaderID):(y.push(S.customVertexShaderID),y.push(S.customFragmentShaderID)),S.defines!==void 0)for(const U in S.defines)y.push(U),y.push(S.defines[U]);return S.isRawShaderMaterial===!1&&(b(y,S),v(y,S),y.push(i.outputColorSpace)),y.push(S.customProgramCacheKey),y.join()}function b(S,y){S.push(y.precision),S.push(y.outputColorSpace),S.push(y.envMapMode),S.push(y.envMapCubeUVHeight),S.push(y.mapUv),S.push(y.alphaMapUv),S.push(y.lightMapUv),S.push(y.aoMapUv),S.push(y.bumpMapUv),S.push(y.normalMapUv),S.push(y.displacementMapUv),S.push(y.emissiveMapUv),S.push(y.metalnessMapUv),S.push(y.roughnessMapUv),S.push(y.anisotropyMapUv),S.push(y.clearcoatMapUv),S.push(y.clearcoatNormalMapUv),S.push(y.clearcoatRoughnessMapUv),S.push(y.iridescenceMapUv),S.push(y.iridescenceThicknessMapUv),S.push(y.sheenColorMapUv),S.push(y.sheenRoughnessMapUv),S.push(y.specularMapUv),S.push(y.specularColorMapUv),S.push(y.specularIntensityMapUv),S.push(y.transmissionMapUv),S.push(y.thicknessMapUv),S.push(y.combine),S.push(y.fogExp2),S.push(y.sizeAttenuation),S.push(y.morphTargetsCount),S.push(y.morphAttributeCount),S.push(y.numDirLights),S.push(y.numPointLights),S.push(y.numSpotLights),S.push(y.numSpotLightMaps),S.push(y.numHemiLights),S.push(y.numRectAreaLights),S.push(y.numDirLightShadows),S.push(y.numPointLightShadows),S.push(y.numSpotLightShadows),S.push(y.numSpotLightShadowsWithMaps),S.push(y.numLightProbes),S.push(y.shadowMapType),S.push(y.toneMapping),S.push(y.numClippingPlanes),S.push(y.numClipIntersection),S.push(y.depthPacking)}function v(S,y){o.disableAll(),y.supportsVertexTextures&&o.enable(0),y.instancing&&o.enable(1),y.instancingColor&&o.enable(2),y.instancingMorph&&o.enable(3),y.matcap&&o.enable(4),y.envMap&&o.enable(5),y.normalMapObjectSpace&&o.enable(6),y.normalMapTangentSpace&&o.enable(7),y.clearcoat&&o.enable(8),y.iridescence&&o.enable(9),y.alphaTest&&o.enable(10),y.vertexColors&&o.enable(11),y.vertexAlphas&&o.enable(12),y.vertexUv1s&&o.enable(13),y.vertexUv2s&&o.enable(14),y.vertexUv3s&&o.enable(15),y.vertexTangents&&o.enable(16),y.anisotropy&&o.enable(17),y.alphaHash&&o.enable(18),y.batching&&o.enable(19),S.push(o.mask),o.disableAll(),y.fog&&o.enable(0),y.useFog&&o.enable(1),y.flatShading&&o.enable(2),y.logarithmicDepthBuffer&&o.enable(3),y.skinning&&o.enable(4),y.morphTargets&&o.enable(5),y.morphNormals&&o.enable(6),y.morphColors&&o.enable(7),y.premultipliedAlpha&&o.enable(8),y.shadowMapEnabled&&o.enable(9),y.useLegacyLights&&o.enable(10),y.doubleSided&&o.enable(11),y.flipSided&&o.enable(12),y.useDepthPacking&&o.enable(13),y.dithering&&o.enable(14),y.transmission&&o.enable(15),y.sheen&&o.enable(16),y.opaque&&o.enable(17),y.pointsUvs&&o.enable(18),y.decodeVideoTexture&&o.enable(19),y.alphaToCoverage&&o.enable(20),S.push(o.mask)}function D(S){const y=_[S.type];let U;if(y){const I=Xt[y];U=Lr.clone(I.uniforms)}else U=S.uniforms;return U}function P(S,y){let U;for(let I=0,C=d.length;I<C;I++){const k=d[I];if(k.cacheKey===y){U=k,++U.usedTimes;break}}return U===void 0&&(U=new Pm(i,y,S,s),d.push(U)),U}function T(S){if(--S.usedTimes===0){const y=d.indexOf(S);d[y]=d[d.length-1],d.pop(),S.destroy()}}function w(S){l.remove(S)}function L(){l.dispose()}return{getParameters:m,getProgramCacheKey:f,getUniforms:D,acquireProgram:P,releaseProgram:T,releaseShaderCache:w,programs:d,dispose:L}}function Im(){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 Om(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 Uo(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 Io(){const i=[];let e=0;const t=[],n=[],r=[];function s(){e=0,t.length=0,n.length=0,r.length=0}function a(u,h,p,_,x,m){let f=i[e];return f===void 0?(f={id:u.id,object:u,geometry:h,material:p,groupOrder:_,renderOrder:u.renderOrder,z:x,group:m},i[e]=f):(f.id=u.id,f.object=u,f.geometry=h,f.material=p,f.groupOrder=_,f.renderOrder=u.renderOrder,f.z=x,f.group=m),e++,f}function o(u,h,p,_,x,m){const f=a(u,h,p,_,x,m);p.transmission>0?n.push(f):p.transparent===!0?r.push(f):t.push(f)}function l(u,h,p,_,x,m){const f=a(u,h,p,_,x,m);p.transmission>0?n.unshift(f):p.transparent===!0?r.unshift(f):t.unshift(f)}function c(u,h){t.length>1&&t.sort(u||Om),n.length>1&&n.sort(h||Uo),r.length>1&&r.sort(h||Uo)}function d(){for(let u=e,h=i.length;u<h;u++){const p=i[u];if(p.id===null)break;p.id=null,p.object=null,p.geometry=null,p.material=null,p.group=null}}return{opaque:t,transmissive:n,transparent:r,init:s,push:o,unshift:l,finish:d,sort:c}}function zm(){let i=new WeakMap;function e(n,r){const s=i.get(n);let a;return s===void 0?(a=new Io,i.set(n,[a])):r>=s.length?(a=new Io,s.push(a)):a=s[r],a}function t(){i=new WeakMap}return{get:e,dispose:t}}function Bm(){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 R,color:new be};break;case"SpotLight":t={position:new R,direction:new R,color:new be,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new R,color:new be,distance:0,decay:0};break;case"HemisphereLight":t={direction:new R,skyColor:new be,groundColor:new be};break;case"RectAreaLight":t={color:new be,position:new R,halfWidth:new R,halfHeight:new R};break}return i[e.id]=t,t}}}function km(){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 he};break;case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new he};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new he,shadowCameraNear:1,shadowCameraFar:1e3};break}return i[e.id]=t,t}}}let Hm=0;function Vm(i,e){return(e.castShadow?2:0)-(i.castShadow?2:0)+(e.map?1:0)-(i.map?1:0)}function Gm(i){const e=new Bm,t=km(),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 R);const r=new R,s=new et,a=new et;function o(c,d){let u=0,h=0,p=0;for(let U=0;U<9;U++)n.probe[U].set(0,0,0);let _=0,x=0,m=0,f=0,b=0,v=0,D=0,P=0,T=0,w=0,L=0;c.sort(Vm);const S=d===!0?Math.PI:1;for(let U=0,I=c.length;U<I;U++){const C=c[U],k=C.color,G=C.intensity,$=C.distance,te=C.shadow&&C.shadow.map?C.shadow.map.texture:null;if(C.isAmbientLight)u+=k.r*G*S,h+=k.g*G*S,p+=k.b*G*S;else if(C.isLightProbe){for(let B=0;B<9;B++)n.probe[B].addScaledVector(C.sh.coefficients[B],G);L++}else if(C.isDirectionalLight){const B=e.get(C);if(B.color.copy(C.color).multiplyScalar(C.intensity*S),C.castShadow){const K=C.shadow,q=t.get(C);q.shadowBias=K.bias,q.shadowNormalBias=K.normalBias,q.shadowRadius=K.radius,q.shadowMapSize=K.mapSize,n.directionalShadow[_]=q,n.directionalShadowMap[_]=te,n.directionalShadowMatrix[_]=C.shadow.matrix,v++}n.directional[_]=B,_++}else if(C.isSpotLight){const B=e.get(C);B.position.setFromMatrixPosition(C.matrixWorld),B.color.copy(k).multiplyScalar(G*S),B.distance=$,B.coneCos=Math.cos(C.angle),B.penumbraCos=Math.cos(C.angle*(1-C.penumbra)),B.decay=C.decay,n.spot[m]=B;const K=C.shadow;if(C.map&&(n.spotLightMap[T]=C.map,T++,K.updateMatrices(C),C.castShadow&&w++),n.spotLightMatrix[m]=K.matrix,C.castShadow){const q=t.get(C);q.shadowBias=K.bias,q.shadowNormalBias=K.normalBias,q.shadowRadius=K.radius,q.shadowMapSize=K.mapSize,n.spotShadow[m]=q,n.spotShadowMap[m]=te,P++}m++}else if(C.isRectAreaLight){const B=e.get(C);B.color.copy(k).multiplyScalar(G),B.halfWidth.set(C.width*.5,0,0),B.halfHeight.set(0,C.height*.5,0),n.rectArea[f]=B,f++}else if(C.isPointLight){const B=e.get(C);if(B.color.copy(C.color).multiplyScalar(C.intensity*S),B.distance=C.distance,B.decay=C.decay,C.castShadow){const K=C.shadow,q=t.get(C);q.shadowBias=K.bias,q.shadowNormalBias=K.normalBias,q.shadowRadius=K.radius,q.shadowMapSize=K.mapSize,q.shadowCameraNear=K.camera.near,q.shadowCameraFar=K.camera.far,n.pointShadow[x]=q,n.pointShadowMap[x]=te,n.pointShadowMatrix[x]=C.shadow.matrix,D++}n.point[x]=B,x++}else if(C.isHemisphereLight){const B=e.get(C);B.skyColor.copy(C.color).multiplyScalar(G*S),B.groundColor.copy(C.groundColor).multiplyScalar(G*S),n.hemi[b]=B,b++}}f>0&&(i.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=ce.LTC_FLOAT_1,n.rectAreaLTC2=ce.LTC_FLOAT_2):(n.rectAreaLTC1=ce.LTC_HALF_1,n.rectAreaLTC2=ce.LTC_HALF_2)),n.ambient[0]=u,n.ambient[1]=h,n.ambient[2]=p;const y=n.hash;(y.directionalLength!==_||y.pointLength!==x||y.spotLength!==m||y.rectAreaLength!==f||y.hemiLength!==b||y.numDirectionalShadows!==v||y.numPointShadows!==D||y.numSpotShadows!==P||y.numSpotMaps!==T||y.numLightProbes!==L)&&(n.directional.length=_,n.spot.length=m,n.rectArea.length=f,n.point.length=x,n.hemi.length=b,n.directionalShadow.length=v,n.directionalShadowMap.length=v,n.pointShadow.length=D,n.pointShadowMap.length=D,n.spotShadow.length=P,n.spotShadowMap.length=P,n.directionalShadowMatrix.length=v,n.pointShadowMatrix.length=D,n.spotLightMatrix.length=P+T-w,n.spotLightMap.length=T,n.numSpotLightShadowsWithMaps=w,n.numLightProbes=L,y.directionalLength=_,y.pointLength=x,y.spotLength=m,y.rectAreaLength=f,y.hemiLength=b,y.numDirectionalShadows=v,y.numPointShadows=D,y.numSpotShadows=P,y.numSpotMaps=T,y.numLightProbes=L,n.version=Hm++)}function l(c,d){let u=0,h=0,p=0,_=0,x=0;const m=d.matrixWorldInverse;for(let f=0,b=c.length;f<b;f++){const v=c[f];if(v.isDirectionalLight){const D=n.directional[u];D.direction.setFromMatrixPosition(v.matrixWorld),r.setFromMatrixPosition(v.target.matrixWorld),D.direction.sub(r),D.direction.transformDirection(m),u++}else if(v.isSpotLight){const D=n.spot[p];D.position.setFromMatrixPosition(v.matrixWorld),D.position.applyMatrix4(m),D.direction.setFromMatrixPosition(v.matrixWorld),r.setFromMatrixPosition(v.target.matrixWorld),D.direction.sub(r),D.direction.transformDirection(m),p++}else if(v.isRectAreaLight){const D=n.rectArea[_];D.position.setFromMatrixPosition(v.matrixWorld),D.position.applyMatrix4(m),a.identity(),s.copy(v.matrixWorld),s.premultiply(m),a.extractRotation(s),D.halfWidth.set(v.width*.5,0,0),D.halfHeight.set(0,v.height*.5,0),D.halfWidth.applyMatrix4(a),D.halfHeight.applyMatrix4(a),_++}else if(v.isPointLight){const D=n.point[h];D.position.setFromMatrixPosition(v.matrixWorld),D.position.applyMatrix4(m),h++}else if(v.isHemisphereLight){const D=n.hemi[x];D.direction.setFromMatrixPosition(v.matrixWorld),D.direction.transformDirection(m),x++}}}return{setup:o,setupView:l,state:n}}function Oo(i){const e=new Gm(i),t=[],n=[];function r(){t.length=0,n.length=0}function s(d){t.push(d)}function a(d){n.push(d)}function o(d){e.setup(t,d)}function l(d){e.setupView(t,d)}return{init:r,state:{lightsArray:t,shadowsArray:n,lights:e,transmissionRenderTarget:null},setupLights:o,setupLightsView:l,pushLight:s,pushShadow:a}}function Wm(i){let e=new WeakMap;function t(r,s=0){const a=e.get(r);let o;return a===void 0?(o=new Oo(i),e.set(r,[o])):s>=a.length?(o=new Oo(i),a.push(o)):o=a[s],o}function n(){e=new WeakMap}return{get:t,dispose:n}}class Xm extends yi{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=Tu,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 jm extends yi{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 Ym=`void main() {
|
|
3747
|
+
`+ee+`
|
|
3748
|
+
`+B)}else I!==""?console.warn("THREE.WebGLProgram: Program Info Log:",I):(C===""||z==="")&&(q=!1);q&&(N.diagnostics={runnable:V,programLog:I,vertexShader:{log:C,prefix:m},fragmentShader:{log:z,prefix:f}})}r.deleteShader(P),r.deleteShader(T),L=new Er(r,v),E=hm(r,v)}let L;this.getUniforms=function(){return L===void 0&&w(this),L};let E;this.getAttributes=function(){return E===void 0&&w(this),E};let M=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return M===!1&&(M=r.getProgramParameter(v,im)),M},this.destroy=function(){n.releaseStatesOfProgram(this),r.deleteProgram(v),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=rm++,this.cacheKey=e,this.usedTimes=1,this.program=v,this.vertexShader=P,this.fragmentShader=T,this}let ym=0;class bm{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 Dm(e),t.set(e,n)),n}}class Dm{constructor(e){this.id=ym++,this.code=e,this.usedTimes=0}}function Tm(i,e,t,n,r,s,a){const o=new _l,l=new bm,c=new Set,h=[],d=r.logarithmicDepthBuffer,u=r.vertexTextures;let p=r.precision;const _={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 v(E){return c.add(E),E===0?"uv":`uv${E}`}function m(E,M,N,I,C){const z=I.fog,V=C.geometry,q=E.isMeshStandardMaterial?I.environment:null,ee=(E.isMeshStandardMaterial?t:e).get(E.envMap||q),B=ee&&ee.mapping===Lr?ee.image.height:null,$=_[E.type];E.precision!==null&&(p=r.getMaxPrecision(E.precision),p!==E.precision&&console.warn("THREE.WebGLProgram.getParameters:",E.precision,"not supported, using",p,"instead."));const j=V.morphAttributes.position||V.morphAttributes.normal||V.morphAttributes.color,F=j!==void 0?j.length:0;let Q=0;V.morphAttributes.position!==void 0&&(Q=1),V.morphAttributes.normal!==void 0&&(Q=2),V.morphAttributes.color!==void 0&&(Q=3);let pe,U,J,le;if($){const lt=Gt[$];pe=lt.vertexShader,U=lt.fragmentShader}else pe=E.vertexShader,U=E.fragmentShader,l.update(E),J=l.getVertexShaderID(E),le=l.getFragmentShaderID(E);const ne=i.getRenderTarget(),xe=C.isInstancedMesh===!0,De=C.isBatchedMesh===!0,Ce=!!E.map,k=!!E.matcap,Fe=!!ee,ve=!!E.aoMap,Ge=!!E.lightMap,ye=!!E.bumpMap,We=!!E.normalMap,A=!!E.displacementMap,S=!!E.emissiveMap,Y=!!E.metalnessMap,Z=!!E.roughnessMap,te=E.anisotropy>0,ie=E.clearcoat>0,Te=E.iridescence>0,re=E.sheen>0,Ee=E.transmission>0,Ae=te&&!!E.anisotropyMap,ae=ie&&!!E.clearcoatMap,de=ie&&!!E.clearcoatNormalMap,Re=ie&&!!E.clearcoatRoughnessMap,ge=Te&&!!E.iridescenceMap,_e=Te&&!!E.iridescenceThicknessMap,ke=re&&!!E.sheenColorMap,He=re&&!!E.sheenRoughnessMap,Ye=!!E.specularMap,Xe=!!E.specularColorMap,je=!!E.specularIntensityMap,Me=Ee&&!!E.transmissionMap,g=Ee&&!!E.thicknessMap,H=!!E.gradientMap,K=!!E.alphaMap,se=E.alphaTest>0,fe=!!E.alphaHash,Ve=!!E.extensions;let ze=mn;E.toneMapped&&(ne===null||ne.isXRRenderTarget===!0)&&(ze=i.toneMapping);const Ze={shaderID:$,shaderType:E.type,shaderName:E.name,vertexShader:pe,fragmentShader:U,defines:E.defines,customVertexShaderID:J,customFragmentShaderID:le,isRawShaderMaterial:E.isRawShaderMaterial===!0,glslVersion:E.glslVersion,precision:p,batching:De,instancing:xe,instancingColor:xe&&C.instanceColor!==null,instancingMorph:xe&&C.morphTexture!==null,supportsVertexTextures:u,outputColorSpace:ne===null?i.outputColorSpace:ne.isXRRenderTarget===!0?ne.texture.colorSpace:xn,alphaToCoverage:!!E.alphaToCoverage,map:Ce,matcap:k,envMap:Fe,envMapMode:Fe&&ee.mapping,envMapCubeUVHeight:B,aoMap:ve,lightMap:Ge,bumpMap:ye,normalMap:We,displacementMap:u&&A,emissiveMap:S,normalMapObjectSpace:We&&E.normalMapType===Mu,normalMapTangentSpace:We&&E.normalMapType===xu,metalnessMap:Y,roughnessMap:Z,anisotropy:te,anisotropyMap:Ae,clearcoat:ie,clearcoatMap:ae,clearcoatNormalMap:de,clearcoatRoughnessMap:Re,iridescence:Te,iridescenceMap:ge,iridescenceThicknessMap:_e,sheen:re,sheenColorMap:ke,sheenRoughnessMap:He,specularMap:Ye,specularColorMap:Xe,specularIntensityMap:je,transmission:Ee,transmissionMap:Me,thicknessMap:g,gradientMap:H,opaque:E.transparent===!1&&E.blending===li&&E.alphaToCoverage===!1,alphaMap:K,alphaTest:se,alphaHash:fe,combine:E.combine,mapUv:Ce&&v(E.map.channel),aoMapUv:ve&&v(E.aoMap.channel),lightMapUv:Ge&&v(E.lightMap.channel),bumpMapUv:ye&&v(E.bumpMap.channel),normalMapUv:We&&v(E.normalMap.channel),displacementMapUv:A&&v(E.displacementMap.channel),emissiveMapUv:S&&v(E.emissiveMap.channel),metalnessMapUv:Y&&v(E.metalnessMap.channel),roughnessMapUv:Z&&v(E.roughnessMap.channel),anisotropyMapUv:Ae&&v(E.anisotropyMap.channel),clearcoatMapUv:ae&&v(E.clearcoatMap.channel),clearcoatNormalMapUv:de&&v(E.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Re&&v(E.clearcoatRoughnessMap.channel),iridescenceMapUv:ge&&v(E.iridescenceMap.channel),iridescenceThicknessMapUv:_e&&v(E.iridescenceThicknessMap.channel),sheenColorMapUv:ke&&v(E.sheenColorMap.channel),sheenRoughnessMapUv:He&&v(E.sheenRoughnessMap.channel),specularMapUv:Ye&&v(E.specularMap.channel),specularColorMapUv:Xe&&v(E.specularColorMap.channel),specularIntensityMapUv:je&&v(E.specularIntensityMap.channel),transmissionMapUv:Me&&v(E.transmissionMap.channel),thicknessMapUv:g&&v(E.thicknessMap.channel),alphaMapUv:K&&v(E.alphaMap.channel),vertexTangents:!!V.attributes.tangent&&(We||te),vertexColors:E.vertexColors,vertexAlphas:E.vertexColors===!0&&!!V.attributes.color&&V.attributes.color.itemSize===4,pointsUvs:C.isPoints===!0&&!!V.attributes.uv&&(Ce||K),fog:!!z,useFog:E.fog===!0,fogExp2:!!z&&z.isFogExp2,flatShading:E.flatShading===!0,sizeAttenuation:E.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:F,morphTextureStride:Q,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:E.dithering,shadowMapEnabled:i.shadowMap.enabled&&N.length>0,shadowMapType:i.shadowMap.type,toneMapping:ze,useLegacyLights:i._useLegacyLights,decodeVideoTexture:Ce&&E.map.isVideoTexture===!0&&$e.getTransfer(E.map.colorSpace)===Ke,premultipliedAlpha:E.premultipliedAlpha,doubleSided:E.side===Wt,flipSided:E.side===Mt,useDepthPacking:E.depthPacking>=0,depthPacking:E.depthPacking||0,index0AttributeName:E.index0AttributeName,extensionClipCullDistance:Ve&&E.extensions.clipCullDistance===!0&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:Ve&&E.extensions.multiDraw===!0&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:E.customProgramCacheKey()};return Ze.vertexUv1s=c.has(1),Ze.vertexUv2s=c.has(2),Ze.vertexUv3s=c.has(3),c.clear(),Ze}function f(E){const M=[];if(E.shaderID?M.push(E.shaderID):(M.push(E.customVertexShaderID),M.push(E.customFragmentShaderID)),E.defines!==void 0)for(const N in E.defines)M.push(N),M.push(E.defines[N]);return E.isRawShaderMaterial===!1&&(b(M,E),x(M,E),M.push(i.outputColorSpace)),M.push(E.customProgramCacheKey),M.join()}function b(E,M){E.push(M.precision),E.push(M.outputColorSpace),E.push(M.envMapMode),E.push(M.envMapCubeUVHeight),E.push(M.mapUv),E.push(M.alphaMapUv),E.push(M.lightMapUv),E.push(M.aoMapUv),E.push(M.bumpMapUv),E.push(M.normalMapUv),E.push(M.displacementMapUv),E.push(M.emissiveMapUv),E.push(M.metalnessMapUv),E.push(M.roughnessMapUv),E.push(M.anisotropyMapUv),E.push(M.clearcoatMapUv),E.push(M.clearcoatNormalMapUv),E.push(M.clearcoatRoughnessMapUv),E.push(M.iridescenceMapUv),E.push(M.iridescenceThicknessMapUv),E.push(M.sheenColorMapUv),E.push(M.sheenRoughnessMapUv),E.push(M.specularMapUv),E.push(M.specularColorMapUv),E.push(M.specularIntensityMapUv),E.push(M.transmissionMapUv),E.push(M.thicknessMapUv),E.push(M.combine),E.push(M.fogExp2),E.push(M.sizeAttenuation),E.push(M.morphTargetsCount),E.push(M.morphAttributeCount),E.push(M.numDirLights),E.push(M.numPointLights),E.push(M.numSpotLights),E.push(M.numSpotLightMaps),E.push(M.numHemiLights),E.push(M.numRectAreaLights),E.push(M.numDirLightShadows),E.push(M.numPointLightShadows),E.push(M.numSpotLightShadows),E.push(M.numSpotLightShadowsWithMaps),E.push(M.numLightProbes),E.push(M.shadowMapType),E.push(M.toneMapping),E.push(M.numClippingPlanes),E.push(M.numClipIntersection),E.push(M.depthPacking)}function x(E,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),E.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),E.push(o.mask)}function D(E){const M=_[E.type];let N;if(M){const I=Gt[M];N=Rr.clone(I.uniforms)}else N=E.uniforms;return N}function P(E,M){let N;for(let I=0,C=h.length;I<C;I++){const z=h[I];if(z.cacheKey===M){N=z,++N.usedTimes;break}}return N===void 0&&(N=new Em(i,M,E,s),h.push(N)),N}function T(E){if(--E.usedTimes===0){const M=h.indexOf(E);h[M]=h[h.length-1],h.pop(),E.destroy()}}function w(E){l.remove(E)}function L(){l.dispose()}return{getParameters:m,getProgramCacheKey:f,getUniforms:D,acquireProgram:P,releaseProgram:T,releaseShaderCache:w,programs:h,dispose:L}}function Am(){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 wm(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 Fo(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 Uo(){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,u,p,_,v,m){let f=i[e];return f===void 0?(f={id:d.id,object:d,geometry:u,material:p,groupOrder:_,renderOrder:d.renderOrder,z:v,group:m},i[e]=f):(f.id=d.id,f.object=d,f.geometry=u,f.material=p,f.groupOrder=_,f.renderOrder=d.renderOrder,f.z=v,f.group=m),e++,f}function o(d,u,p,_,v,m){const f=a(d,u,p,_,v,m);p.transmission>0?n.push(f):p.transparent===!0?r.push(f):t.push(f)}function l(d,u,p,_,v,m){const f=a(d,u,p,_,v,m);p.transmission>0?n.unshift(f):p.transparent===!0?r.unshift(f):t.unshift(f)}function c(d,u){t.length>1&&t.sort(d||wm),n.length>1&&n.sort(u||Fo),r.length>1&&r.sort(u||Fo)}function h(){for(let d=e,u=i.length;d<u;d++){const p=i[d];if(p.id===null)break;p.id=null,p.object=null,p.geometry=null,p.material=null,p.group=null}}return{opaque:t,transmissive:n,transparent:r,init:s,push:o,unshift:l,finish:h,sort:c}}function Cm(){let i=new WeakMap;function e(n,r){const s=i.get(n);let a;return s===void 0?(a=new Uo,i.set(n,[a])):r>=s.length?(a=new Uo,s.push(a)):a=s[r],a}function t(){i=new WeakMap}return{get:e,dispose:t}}function Rm(){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 R,color:new be};break;case"SpotLight":t={position:new R,direction:new R,color:new be,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new R,color:new be,distance:0,decay:0};break;case"HemisphereLight":t={direction:new R,skyColor:new be,groundColor:new be};break;case"RectAreaLight":t={color:new be,position:new R,halfWidth:new R,halfHeight:new R};break}return i[e.id]=t,t}}}function Pm(){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 Lm=0;function Fm(i,e){return(e.castShadow?2:0)-(i.castShadow?2:0)+(e.map?1:0)-(i.map?1:0)}function Um(i){const e=new Rm,t=Pm(),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 R);const r=new R,s=new et,a=new et;function o(c,h){let d=0,u=0,p=0;for(let N=0;N<9;N++)n.probe[N].set(0,0,0);let _=0,v=0,m=0,f=0,b=0,x=0,D=0,P=0,T=0,w=0,L=0;c.sort(Fm);const E=h===!0?Math.PI:1;for(let N=0,I=c.length;N<I;N++){const C=c[N],z=C.color,V=C.intensity,q=C.distance,ee=C.shadow&&C.shadow.map?C.shadow.map.texture:null;if(C.isAmbientLight)d+=z.r*V*E,u+=z.g*V*E,p+=z.b*V*E;else if(C.isLightProbe){for(let B=0;B<9;B++)n.probe[B].addScaledVector(C.sh.coefficients[B],V);L++}else if(C.isDirectionalLight){const B=e.get(C);if(B.color.copy(C.color).multiplyScalar(C.intensity*E),C.castShadow){const $=C.shadow,j=t.get(C);j.shadowBias=$.bias,j.shadowNormalBias=$.normalBias,j.shadowRadius=$.radius,j.shadowMapSize=$.mapSize,n.directionalShadow[_]=j,n.directionalShadowMap[_]=ee,n.directionalShadowMatrix[_]=C.shadow.matrix,x++}n.directional[_]=B,_++}else if(C.isSpotLight){const B=e.get(C);B.position.setFromMatrixPosition(C.matrixWorld),B.color.copy(z).multiplyScalar(V*E),B.distance=q,B.coneCos=Math.cos(C.angle),B.penumbraCos=Math.cos(C.angle*(1-C.penumbra)),B.decay=C.decay,n.spot[m]=B;const $=C.shadow;if(C.map&&(n.spotLightMap[T]=C.map,T++,$.updateMatrices(C),C.castShadow&&w++),n.spotLightMatrix[m]=$.matrix,C.castShadow){const j=t.get(C);j.shadowBias=$.bias,j.shadowNormalBias=$.normalBias,j.shadowRadius=$.radius,j.shadowMapSize=$.mapSize,n.spotShadow[m]=j,n.spotShadowMap[m]=ee,P++}m++}else if(C.isRectAreaLight){const B=e.get(C);B.color.copy(z).multiplyScalar(V),B.halfWidth.set(C.width*.5,0,0),B.halfHeight.set(0,C.height*.5,0),n.rectArea[f]=B,f++}else if(C.isPointLight){const B=e.get(C);if(B.color.copy(C.color).multiplyScalar(C.intensity*E),B.distance=C.distance,B.decay=C.decay,C.castShadow){const $=C.shadow,j=t.get(C);j.shadowBias=$.bias,j.shadowNormalBias=$.normalBias,j.shadowRadius=$.radius,j.shadowMapSize=$.mapSize,j.shadowCameraNear=$.camera.near,j.shadowCameraFar=$.camera.far,n.pointShadow[v]=j,n.pointShadowMap[v]=ee,n.pointShadowMatrix[v]=C.shadow.matrix,D++}n.point[v]=B,v++}else if(C.isHemisphereLight){const B=e.get(C);B.skyColor.copy(C.color).multiplyScalar(V*E),B.groundColor.copy(C.groundColor).multiplyScalar(V*E),n.hemi[b]=B,b++}}f>0&&(i.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=oe.LTC_FLOAT_1,n.rectAreaLTC2=oe.LTC_FLOAT_2):(n.rectAreaLTC1=oe.LTC_HALF_1,n.rectAreaLTC2=oe.LTC_HALF_2)),n.ambient[0]=d,n.ambient[1]=u,n.ambient[2]=p;const M=n.hash;(M.directionalLength!==_||M.pointLength!==v||M.spotLength!==m||M.rectAreaLength!==f||M.hemiLength!==b||M.numDirectionalShadows!==x||M.numPointShadows!==D||M.numSpotShadows!==P||M.numSpotMaps!==T||M.numLightProbes!==L)&&(n.directional.length=_,n.spot.length=m,n.rectArea.length=f,n.point.length=v,n.hemi.length=b,n.directionalShadow.length=x,n.directionalShadowMap.length=x,n.pointShadow.length=D,n.pointShadowMap.length=D,n.spotShadow.length=P,n.spotShadowMap.length=P,n.directionalShadowMatrix.length=x,n.pointShadowMatrix.length=D,n.spotLightMatrix.length=P+T-w,n.spotLightMap.length=T,n.numSpotLightShadowsWithMaps=w,n.numLightProbes=L,M.directionalLength=_,M.pointLength=v,M.spotLength=m,M.rectAreaLength=f,M.hemiLength=b,M.numDirectionalShadows=x,M.numPointShadows=D,M.numSpotShadows=P,M.numSpotMaps=T,M.numLightProbes=L,n.version=Lm++)}function l(c,h){let d=0,u=0,p=0,_=0,v=0;const m=h.matrixWorldInverse;for(let f=0,b=c.length;f<b;f++){const x=c[f];if(x.isDirectionalLight){const D=n.directional[d];D.direction.setFromMatrixPosition(x.matrixWorld),r.setFromMatrixPosition(x.target.matrixWorld),D.direction.sub(r),D.direction.transformDirection(m),d++}else if(x.isSpotLight){const D=n.spot[p];D.position.setFromMatrixPosition(x.matrixWorld),D.position.applyMatrix4(m),D.direction.setFromMatrixPosition(x.matrixWorld),r.setFromMatrixPosition(x.target.matrixWorld),D.direction.sub(r),D.direction.transformDirection(m),p++}else if(x.isRectAreaLight){const D=n.rectArea[_];D.position.setFromMatrixPosition(x.matrixWorld),D.position.applyMatrix4(m),a.identity(),s.copy(x.matrixWorld),s.premultiply(m),a.extractRotation(s),D.halfWidth.set(x.width*.5,0,0),D.halfHeight.set(0,x.height*.5,0),D.halfWidth.applyMatrix4(a),D.halfHeight.applyMatrix4(a),_++}else if(x.isPointLight){const D=n.point[u];D.position.setFromMatrixPosition(x.matrixWorld),D.position.applyMatrix4(m),u++}else if(x.isHemisphereLight){const D=n.hemi[v];D.direction.setFromMatrixPosition(x.matrixWorld),D.direction.transformDirection(m),v++}}}return{setup:o,setupView:l,state:n}}function No(i){const e=new Um(i),t=[],n=[];function r(){t.length=0,n.length=0}function s(h){t.push(h)}function a(h){n.push(h)}function o(h){e.setup(t,h)}function l(h){e.setupView(t,h)}return{init:r,state:{lightsArray:t,shadowsArray:n,lights:e,transmissionRenderTarget:null},setupLights:o,setupLightsView:l,pushLight:s,pushShadow:a}}function Nm(i){let e=new WeakMap;function t(r,s=0){const a=e.get(r);let o;return a===void 0?(o=new No(i),e.set(r,[o])):s>=a.length?(o=new No(i),a.push(o)):o=a[s],o}function n(){e=new WeakMap}return{get:t,dispose:n}}class Im extends vi{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=_u,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 Om 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 Bm=`void main() {
|
|
3749
3749
|
gl_Position = vec4( position, 1.0 );
|
|
3750
|
-
}`,
|
|
3750
|
+
}`,zm=`uniform sampler2D shadow_pass;
|
|
3751
3751
|
uniform vec2 resolution;
|
|
3752
3752
|
uniform float radius;
|
|
3753
3753
|
#include <packing>
|
|
@@ -3773,12 +3773,12 @@ 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 $m(i,e,t){let n=new Tl;const r=new he,s=new he,a=new dt,o=new Xm({depthPacking:Au}),l=new jm,c={},d=t.maxTextureSize,u={[yn]:yt,[yt]:yn,[jt]:jt},h=new ft({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new he},radius:{value:4}},vertexShader:Ym,fragmentShader:qm}),p=h.clone();p.defines.HORIZONTAL_PASS=1;const _=new _t;_.setAttribute("position",new Et(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const x=new bt(_,h),m=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=il;let f=this.type;this.render=function(T,w,L){if(m.enabled===!1||m.autoUpdate===!1&&m.needsUpdate===!1||T.length===0)return;const S=i.getRenderTarget(),y=i.getActiveCubeFace(),U=i.getActiveMipmapLevel(),I=i.state;I.setBlending(nn),I.buffers.color.setClear(1,1,1,1),I.buffers.depth.setTest(!0),I.setScissorTest(!1);const C=f!==en&&this.type===en,k=f===en&&this.type!==en;for(let G=0,$=T.length;G<$;G++){const te=T[G],B=te.shadow;if(B===void 0){console.warn("THREE.WebGLShadowMap:",te,"has no shadow.");continue}if(B.autoUpdate===!1&&B.needsUpdate===!1)continue;r.copy(B.mapSize);const K=B.getFrameExtents();if(r.multiply(K),s.copy(B.mapSize),(r.x>d||r.y>d)&&(r.x>d&&(s.x=Math.floor(d/K.x),r.x=s.x*K.x,B.mapSize.x=s.x),r.y>d&&(s.y=Math.floor(d/K.y),r.y=s.y*K.y,B.mapSize.y=s.y)),B.map===null||C===!0||k===!0){const F=this.type!==en?{minFilter:Ot,magFilter:Ot}:{};B.map!==null&&B.map.dispose(),B.map=new Gt(r.x,r.y,F),B.map.texture.name=te.name+".shadowMap",B.camera.updateProjectionMatrix()}i.setRenderTarget(B.map),i.clear();const q=B.getViewportCount();for(let F=0;F<q;F++){const ee=B.getViewport(F);a.set(s.x*ee.x,s.y*ee.y,s.x*ee.z,s.y*ee.w),I.viewport(a),B.updateMatrices(te,F),n=B.getFrustum(),D(w,L,B.camera,te,this.type)}B.isPointLightShadow!==!0&&this.type===en&&b(B,L),B.needsUpdate=!1}f=this.type,m.needsUpdate=!1,i.setRenderTarget(S,y,U)};function b(T,w){const L=e.update(x);h.defines.VSM_SAMPLES!==T.blurSamples&&(h.defines.VSM_SAMPLES=T.blurSamples,p.defines.VSM_SAMPLES=T.blurSamples,h.needsUpdate=!0,p.needsUpdate=!0),T.mapPass===null&&(T.mapPass=new Gt(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(w,null,L,h,x,null),p.uniforms.shadow_pass.value=T.mapPass.texture,p.uniforms.resolution.value=T.mapSize,p.uniforms.radius.value=T.radius,i.setRenderTarget(T.map),i.clear(),i.renderBufferDirect(w,null,L,p,x,null)}function v(T,w,L,S){let y=null;const U=L.isPointLight===!0?T.customDistanceMaterial:T.customDepthMaterial;if(U!==void 0)y=U;else if(y=L.isPointLight===!0?l:o,i.localClippingEnabled&&w.clipShadows===!0&&Array.isArray(w.clippingPlanes)&&w.clippingPlanes.length!==0||w.displacementMap&&w.displacementScale!==0||w.alphaMap&&w.alphaTest>0||w.map&&w.alphaTest>0){const I=y.uuid,C=w.uuid;let k=c[I];k===void 0&&(k={},c[I]=k);let G=k[C];G===void 0&&(G=y.clone(),k[C]=G,w.addEventListener("dispose",P)),y=G}if(y.visible=w.visible,y.wireframe=w.wireframe,S===en?y.side=w.shadowSide!==null?w.shadowSide:w.side:y.side=w.shadowSide!==null?w.shadowSide:u[w.side],y.alphaMap=w.alphaMap,y.alphaTest=w.alphaTest,y.map=w.map,y.clipShadows=w.clipShadows,y.clippingPlanes=w.clippingPlanes,y.clipIntersection=w.clipIntersection,y.displacementMap=w.displacementMap,y.displacementScale=w.displacementScale,y.displacementBias=w.displacementBias,y.wireframeLinewidth=w.wireframeLinewidth,y.linewidth=w.linewidth,L.isPointLight===!0&&y.isMeshDistanceMaterial===!0){const I=i.properties.get(y);I.light=L}return y}function D(T,w,L,S,y){if(T.visible===!1)return;if(T.layers.test(w.layers)&&(T.isMesh||T.isLine||T.isPoints)&&(T.castShadow||T.receiveShadow&&y===en)&&(!T.frustumCulled||n.intersectsObject(T))){T.modelViewMatrix.multiplyMatrices(L.matrixWorldInverse,T.matrixWorld);const C=e.update(T),k=T.material;if(Array.isArray(k)){const G=C.groups;for(let $=0,te=G.length;$<te;$++){const B=G[$],K=k[B.materialIndex];if(K&&K.visible){const q=v(T,K,S,y);T.onBeforeShadow(i,T,w,L,C,q,B),i.renderBufferDirect(L,null,C,q,T,B),T.onAfterShadow(i,T,w,L,C,q,B)}}}else if(k.visible){const G=v(T,k,S,y);T.onBeforeShadow(i,T,w,L,C,G,null),i.renderBufferDirect(L,null,C,G,T,null),T.onAfterShadow(i,T,w,L,C,G,null)}}const I=T.children;for(let C=0,k=I.length;C<k;C++)D(I[C],w,L,S,y)}function P(T){T.target.removeEventListener("dispose",P);for(const L in c){const S=c[L],y=T.target.uuid;y in S&&(S[y].dispose(),delete S[y])}}}function Km(i){function e(){let g=!1;const V=new dt;let Z=null;const oe=new dt(0,0,0,0);return{setMask:function(pe){Z!==pe&&!g&&(i.colorMask(pe,pe,pe,pe),Z=pe)},setLocked:function(pe){g=pe},setClear:function(pe,Ve,Be,Ze,lt){lt===!0&&(pe*=Ze,Ve*=Ze,Be*=Ze),V.set(pe,Ve,Be,Ze),oe.equals(V)===!1&&(i.clearColor(pe,Ve,Be,Ze),oe.copy(V))},reset:function(){g=!1,Z=null,oe.set(-1,0,0,0)}}}function t(){let g=!1,V=null,Z=null,oe=null;return{setTest:function(pe){pe?ue(i.DEPTH_TEST):ie(i.DEPTH_TEST)},setMask:function(pe){V!==pe&&!g&&(i.depthMask(pe),V=pe)},setFunc:function(pe){if(Z!==pe){switch(pe){case eu:i.depthFunc(i.NEVER);break;case tu:i.depthFunc(i.ALWAYS);break;case nu:i.depthFunc(i.LESS);break;case Tr:i.depthFunc(i.LEQUAL);break;case iu:i.depthFunc(i.EQUAL);break;case ru:i.depthFunc(i.GEQUAL);break;case su:i.depthFunc(i.GREATER);break;case au:i.depthFunc(i.NOTEQUAL);break;default:i.depthFunc(i.LEQUAL)}Z=pe}},setLocked:function(pe){g=pe},setClear:function(pe){oe!==pe&&(i.clearDepth(pe),oe=pe)},reset:function(){g=!1,V=null,Z=null,oe=null}}}function n(){let g=!1,V=null,Z=null,oe=null,pe=null,Ve=null,Be=null,Ze=null,lt=null;return{setTest:function(qe){g||(qe?ue(i.STENCIL_TEST):ie(i.STENCIL_TEST))},setMask:function(qe){V!==qe&&!g&&(i.stencilMask(qe),V=qe)},setFunc:function(qe,it,rt){(Z!==qe||oe!==it||pe!==rt)&&(i.stencilFunc(qe,it,rt),Z=qe,oe=it,pe=rt)},setOp:function(qe,it,rt){(Ve!==qe||Be!==it||Ze!==rt)&&(i.stencilOp(qe,it,rt),Ve=qe,Be=it,Ze=rt)},setLocked:function(qe){g=qe},setClear:function(qe){lt!==qe&&(i.clearStencil(qe),lt=qe)},reset:function(){g=!1,V=null,Z=null,oe=null,pe=null,Ve=null,Be=null,Ze=null,lt=null}}}const r=new e,s=new t,a=new n,o=new WeakMap,l=new WeakMap;let c={},d={},u=new WeakMap,h=[],p=null,_=!1,x=null,m=null,f=null,b=null,v=null,D=null,P=null,T=new be(0,0,0),w=0,L=!1,S=null,y=null,U=null,I=null,C=null;const k=i.getParameter(i.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let G=!1,$=0;const te=i.getParameter(i.VERSION);te.indexOf("WebGL")!==-1?($=parseFloat(/^WebGL (\d)/.exec(te)[1]),G=$>=1):te.indexOf("OpenGL ES")!==-1&&($=parseFloat(/^OpenGL ES (\d)/.exec(te)[1]),G=$>=2);let B=null,K={};const q=i.getParameter(i.SCISSOR_BOX),F=i.getParameter(i.VIEWPORT),ee=new dt().fromArray(q),me=new dt().fromArray(F);function N(g,V,Z,oe){const pe=new Uint8Array(4),Ve=i.createTexture();i.bindTexture(g,Ve),i.texParameteri(g,i.TEXTURE_MIN_FILTER,i.NEAREST),i.texParameteri(g,i.TEXTURE_MAG_FILTER,i.NEAREST);for(let Be=0;Be<Z;Be++)g===i.TEXTURE_3D||g===i.TEXTURE_2D_ARRAY?i.texImage3D(V,0,i.RGBA,1,1,oe,0,i.RGBA,i.UNSIGNED_BYTE,pe):i.texImage2D(V+Be,0,i.RGBA,1,1,0,i.RGBA,i.UNSIGNED_BYTE,pe);return Ve}const Q={};Q[i.TEXTURE_2D]=N(i.TEXTURE_2D,i.TEXTURE_2D,1),Q[i.TEXTURE_CUBE_MAP]=N(i.TEXTURE_CUBE_MAP,i.TEXTURE_CUBE_MAP_POSITIVE_X,6),Q[i.TEXTURE_2D_ARRAY]=N(i.TEXTURE_2D_ARRAY,i.TEXTURE_2D_ARRAY,1,1),Q[i.TEXTURE_3D]=N(i.TEXTURE_3D,i.TEXTURE_3D,1,1),r.setClear(0,0,0,1),s.setClear(1),a.setClear(0),ue(i.DEPTH_TEST),s.setFunc(Tr),Ee(!1),We(xa),ue(i.CULL_FACE),xe(nn);function ue(g){c[g]!==!0&&(i.enable(g),c[g]=!0)}function ie(g){c[g]!==!1&&(i.disable(g),c[g]=!1)}function ve(g,V){return d[g]!==V?(i.bindFramebuffer(g,V),d[g]=V,g===i.DRAW_FRAMEBUFFER&&(d[i.FRAMEBUFFER]=V),g===i.FRAMEBUFFER&&(d[i.DRAW_FRAMEBUFFER]=V),!0):!1}function De(g,V){let Z=h,oe=!1;if(g){Z=u.get(V),Z===void 0&&(Z=[],u.set(V,Z));const pe=g.textures;if(Z.length!==pe.length||Z[0]!==i.COLOR_ATTACHMENT0){for(let Ve=0,Be=pe.length;Ve<Be;Ve++)Z[Ve]=i.COLOR_ATTACHMENT0+Ve;Z.length=pe.length,oe=!0}}else Z[0]!==i.BACK&&(Z[0]=i.BACK,oe=!0);oe&&i.drawBuffers(Z)}function Ce(g){return p!==g?(i.useProgram(g),p=g,!0):!1}const H={[Pn]:i.FUNC_ADD,[Oc]:i.FUNC_SUBTRACT,[zc]:i.FUNC_REVERSE_SUBTRACT};H[Bc]=i.MIN,H[kc]=i.MAX;const Fe={[Hc]:i.ZERO,[Vc]:i.ONE,[Gc]:i.SRC_COLOR,[Fs]:i.SRC_ALPHA,[$c]:i.SRC_ALPHA_SATURATE,[Yc]:i.DST_COLOR,[Xc]:i.DST_ALPHA,[Wc]:i.ONE_MINUS_SRC_COLOR,[Ns]:i.ONE_MINUS_SRC_ALPHA,[qc]:i.ONE_MINUS_DST_COLOR,[jc]:i.ONE_MINUS_DST_ALPHA,[Kc]:i.CONSTANT_COLOR,[Zc]:i.ONE_MINUS_CONSTANT_COLOR,[Jc]:i.CONSTANT_ALPHA,[Qc]:i.ONE_MINUS_CONSTANT_ALPHA};function xe(g,V,Z,oe,pe,Ve,Be,Ze,lt,qe){if(g===nn){_===!0&&(ie(i.BLEND),_=!1);return}if(_===!1&&(ue(i.BLEND),_=!0),g!==Ic){if(g!==x||qe!==L){if((m!==Pn||v!==Pn)&&(i.blendEquation(i.FUNC_ADD),m=Pn,v=Pn),qe)switch(g){case ui:i.blendFuncSeparate(i.ONE,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case hi:i.blendFunc(i.ONE,i.ONE);break;case va:i.blendFuncSeparate(i.ZERO,i.ONE_MINUS_SRC_COLOR,i.ZERO,i.ONE);break;case ya:i.blendFuncSeparate(i.ZERO,i.SRC_COLOR,i.ZERO,i.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",g);break}else switch(g){case ui:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case hi:i.blendFunc(i.SRC_ALPHA,i.ONE);break;case va:i.blendFuncSeparate(i.ZERO,i.ONE_MINUS_SRC_COLOR,i.ZERO,i.ONE);break;case ya:i.blendFunc(i.ZERO,i.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",g);break}f=null,b=null,D=null,P=null,T.set(0,0,0),w=0,x=g,L=qe}return}pe=pe||V,Ve=Ve||Z,Be=Be||oe,(V!==m||pe!==v)&&(i.blendEquationSeparate(H[V],H[pe]),m=V,v=pe),(Z!==f||oe!==b||Ve!==D||Be!==P)&&(i.blendFuncSeparate(Fe[Z],Fe[oe],Fe[Ve],Fe[Be]),f=Z,b=oe,D=Ve,P=Be),(Ze.equals(T)===!1||lt!==w)&&(i.blendColor(Ze.r,Ze.g,Ze.b,lt),T.copy(Ze),w=lt),x=g,L=!1}function Ge(g,V){g.side===jt?ie(i.CULL_FACE):ue(i.CULL_FACE);let Z=g.side===yt;V&&(Z=!Z),Ee(Z),g.blending===ui&&g.transparent===!1?xe(nn):xe(g.blending,g.blendEquation,g.blendSrc,g.blendDst,g.blendEquationAlpha,g.blendSrcAlpha,g.blendDstAlpha,g.blendColor,g.blendAlpha,g.premultipliedAlpha),s.setFunc(g.depthFunc),s.setTest(g.depthTest),s.setMask(g.depthWrite),r.setMask(g.colorWrite);const oe=g.stencilWrite;a.setTest(oe),oe&&(a.setMask(g.stencilWriteMask),a.setFunc(g.stencilFunc,g.stencilRef,g.stencilFuncMask),a.setOp(g.stencilFail,g.stencilZFail,g.stencilZPass)),M(g.polygonOffset,g.polygonOffsetFactor,g.polygonOffsetUnits),g.alphaToCoverage===!0?ue(i.SAMPLE_ALPHA_TO_COVERAGE):ie(i.SAMPLE_ALPHA_TO_COVERAGE)}function Ee(g){S!==g&&(g?i.frontFace(i.CW):i.frontFace(i.CCW),S=g)}function We(g){g!==Fc?(ue(i.CULL_FACE),g!==y&&(g===xa?i.cullFace(i.BACK):g===Nc?i.cullFace(i.FRONT):i.cullFace(i.FRONT_AND_BACK))):ie(i.CULL_FACE),y=g}function A(g){g!==U&&(G&&i.lineWidth(g),U=g)}function M(g,V,Z){g?(ue(i.POLYGON_OFFSET_FILL),(I!==V||C!==Z)&&(i.polygonOffset(V,Z),I=V,C=Z)):ie(i.POLYGON_OFFSET_FILL)}function Y(g){g?ue(i.SCISSOR_TEST):ie(i.SCISSOR_TEST)}function J(g){g===void 0&&(g=i.TEXTURE0+k-1),B!==g&&(i.activeTexture(g),B=g)}function ne(g,V,Z){Z===void 0&&(B===null?Z=i.TEXTURE0+k-1:Z=B);let oe=K[Z];oe===void 0&&(oe={type:void 0,texture:void 0},K[Z]=oe),(oe.type!==g||oe.texture!==V)&&(B!==Z&&(i.activeTexture(Z),B=Z),i.bindTexture(g,V||Q[g]),oe.type=g,oe.texture=V)}function re(){const g=K[B];g!==void 0&&g.type!==void 0&&(i.bindTexture(g.type,null),g.type=void 0,g.texture=void 0)}function Te(){try{i.compressedTexImage2D.apply(i,arguments)}catch(g){console.error("THREE.WebGLState:",g)}}function ae(){try{i.compressedTexImage3D.apply(i,arguments)}catch(g){console.error("THREE.WebGLState:",g)}}function Se(){try{i.texSubImage2D.apply(i,arguments)}catch(g){console.error("THREE.WebGLState:",g)}}function Ae(){try{i.texSubImage3D.apply(i,arguments)}catch(g){console.error("THREE.WebGLState:",g)}}function le(){try{i.compressedTexSubImage2D.apply(i,arguments)}catch(g){console.error("THREE.WebGLState:",g)}}function fe(){try{i.compressedTexSubImage3D.apply(i,arguments)}catch(g){console.error("THREE.WebGLState:",g)}}function Re(){try{i.texStorage2D.apply(i,arguments)}catch(g){console.error("THREE.WebGLState:",g)}}function ge(){try{i.texStorage3D.apply(i,arguments)}catch(g){console.error("THREE.WebGLState:",g)}}function _e(){try{i.texImage2D.apply(i,arguments)}catch(g){console.error("THREE.WebGLState:",g)}}function ke(){try{i.texImage3D.apply(i,arguments)}catch(g){console.error("THREE.WebGLState:",g)}}function He(g){ee.equals(g)===!1&&(i.scissor(g.x,g.y,g.z,g.w),ee.copy(g))}function je(g){me.equals(g)===!1&&(i.viewport(g.x,g.y,g.z,g.w),me.copy(g))}function Xe(g,V){let Z=l.get(V);Z===void 0&&(Z=new WeakMap,l.set(V,Z));let oe=Z.get(g);oe===void 0&&(oe=i.getUniformBlockIndex(V,g.name),Z.set(g,oe))}function Ye(g,V){const oe=l.get(V).get(g);o.get(V)!==oe&&(i.uniformBlockBinding(V,oe,g.__bindingPointIndex),o.set(V,oe))}function ye(){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={},B=null,K={},d={},u=new WeakMap,h=[],p=null,_=!1,x=null,m=null,f=null,b=null,v=null,D=null,P=null,T=new be(0,0,0),w=0,L=!1,S=null,y=null,U=null,I=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:ue,disable:ie,bindFramebuffer:ve,drawBuffers:De,useProgram:Ce,setBlending:xe,setMaterial:Ge,setFlipSided:Ee,setCullFace:We,setLineWidth:A,setPolygonOffset:M,setScissorTest:Y,activeTexture:J,bindTexture:ne,unbindTexture:re,compressedTexImage2D:Te,compressedTexImage3D:ae,texImage2D:_e,texImage3D:ke,updateUBOMapping:Xe,uniformBlockBinding:Ye,texStorage2D:Re,texStorage3D:ge,texSubImage2D:Se,texSubImage3D:Ae,compressedTexSubImage2D:le,compressedTexSubImage3D:fe,scissor:He,viewport:je,reset:ye}}function Zm(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 he,d=new WeakMap;let u;const h=new WeakMap;let p=!1;try{p=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function _(A,M){return p?new OffscreenCanvas(A,M):Pr("canvas")}function x(A,M,Y){let J=1;const ne=We(A);if((ne.width>Y||ne.height>Y)&&(J=Y/Math.max(ne.width,ne.height)),J<1)if(typeof HTMLImageElement<"u"&&A instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&A instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&A instanceof ImageBitmap||typeof VideoFrame<"u"&&A instanceof VideoFrame){const re=Math.floor(J*ne.width),Te=Math.floor(J*ne.height);u===void 0&&(u=_(re,Te));const ae=M?_(re,Te):u;return ae.width=re,ae.height=Te,ae.getContext("2d").drawImage(A,0,0,re,Te),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+ne.width+"x"+ne.height+") to ("+re+"x"+Te+")."),ae}else return"data"in A&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+ne.width+"x"+ne.height+")."),A;return A}function m(A){return A.generateMipmaps&&A.minFilter!==Ot&&A.minFilter!==Ht}function f(A){i.generateMipmap(A)}function b(A,M,Y,J,ne=!1){if(A!==null){if(i[A]!==void 0)return i[A];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+A+"'")}let re=M;if(M===i.RED&&(Y===i.FLOAT&&(re=i.R32F),Y===i.HALF_FLOAT&&(re=i.R16F),Y===i.UNSIGNED_BYTE&&(re=i.R8)),M===i.RED_INTEGER&&(Y===i.UNSIGNED_BYTE&&(re=i.R8UI),Y===i.UNSIGNED_SHORT&&(re=i.R16UI),Y===i.UNSIGNED_INT&&(re=i.R32UI),Y===i.BYTE&&(re=i.R8I),Y===i.SHORT&&(re=i.R16I),Y===i.INT&&(re=i.R32I)),M===i.RG&&(Y===i.FLOAT&&(re=i.RG32F),Y===i.HALF_FLOAT&&(re=i.RG16F),Y===i.UNSIGNED_BYTE&&(re=i.RG8)),M===i.RG_INTEGER&&(Y===i.UNSIGNED_BYTE&&(re=i.RG8UI),Y===i.UNSIGNED_SHORT&&(re=i.RG16UI),Y===i.UNSIGNED_INT&&(re=i.RG32UI),Y===i.BYTE&&(re=i.RG8I),Y===i.SHORT&&(re=i.RG16I),Y===i.INT&&(re=i.RG32I)),M===i.RGB&&Y===i.UNSIGNED_INT_5_9_9_9_REV&&(re=i.RGB9_E5),M===i.RGBA){const Te=ne?Ar:$e.getTransfer(J);Y===i.FLOAT&&(re=i.RGBA32F),Y===i.HALF_FLOAT&&(re=i.RGBA16F),Y===i.UNSIGNED_BYTE&&(re=Te===Ke?i.SRGB8_ALPHA8:i.RGBA8),Y===i.UNSIGNED_SHORT_4_4_4_4&&(re=i.RGBA4),Y===i.UNSIGNED_SHORT_5_5_5_1&&(re=i.RGB5_A1)}return(re===i.R16F||re===i.R32F||re===i.RG16F||re===i.RG32F||re===i.RGBA16F||re===i.RGBA32F)&&e.get("EXT_color_buffer_float"),re}function v(A,M){return m(A)===!0||A.isFramebufferTexture&&A.minFilter!==Ot&&A.minFilter!==Ht?Math.log2(Math.max(M.width,M.height))+1:A.mipmaps!==void 0&&A.mipmaps.length>0?A.mipmaps.length:A.isCompressedTexture&&Array.isArray(A.image)?M.mipmaps.length:1}function D(A){const M=A.target;M.removeEventListener("dispose",D),T(M),M.isVideoTexture&&d.delete(M)}function P(A){const M=A.target;M.removeEventListener("dispose",P),L(M)}function T(A){const M=n.get(A);if(M.__webglInit===void 0)return;const Y=A.source,J=h.get(Y);if(J){const ne=J[M.__cacheKey];ne.usedTimes--,ne.usedTimes===0&&w(A),Object.keys(J).length===0&&h.delete(Y)}n.remove(A)}function w(A){const M=n.get(A);i.deleteTexture(M.__webglTexture);const Y=A.source,J=h.get(Y);delete J[M.__cacheKey],a.memory.textures--}function L(A){const M=n.get(A);if(A.depthTexture&&A.depthTexture.dispose(),A.isWebGLCubeRenderTarget)for(let J=0;J<6;J++){if(Array.isArray(M.__webglFramebuffer[J]))for(let ne=0;ne<M.__webglFramebuffer[J].length;ne++)i.deleteFramebuffer(M.__webglFramebuffer[J][ne]);else i.deleteFramebuffer(M.__webglFramebuffer[J]);M.__webglDepthbuffer&&i.deleteRenderbuffer(M.__webglDepthbuffer[J])}else{if(Array.isArray(M.__webglFramebuffer))for(let J=0;J<M.__webglFramebuffer.length;J++)i.deleteFramebuffer(M.__webglFramebuffer[J]);else i.deleteFramebuffer(M.__webglFramebuffer);if(M.__webglDepthbuffer&&i.deleteRenderbuffer(M.__webglDepthbuffer),M.__webglMultisampledFramebuffer&&i.deleteFramebuffer(M.__webglMultisampledFramebuffer),M.__webglColorRenderbuffer)for(let J=0;J<M.__webglColorRenderbuffer.length;J++)M.__webglColorRenderbuffer[J]&&i.deleteRenderbuffer(M.__webglColorRenderbuffer[J]);M.__webglDepthRenderbuffer&&i.deleteRenderbuffer(M.__webglDepthRenderbuffer)}const Y=A.textures;for(let J=0,ne=Y.length;J<ne;J++){const re=n.get(Y[J]);re.__webglTexture&&(i.deleteTexture(re.__webglTexture),a.memory.textures--),n.remove(Y[J])}n.remove(A)}let S=0;function y(){S=0}function U(){const A=S;return A>=r.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+A+" texture units while this GPU supports only "+r.maxTextures),S+=1,A}function I(A){const M=[];return M.push(A.wrapS),M.push(A.wrapT),M.push(A.wrapR||0),M.push(A.magFilter),M.push(A.minFilter),M.push(A.anisotropy),M.push(A.internalFormat),M.push(A.format),M.push(A.type),M.push(A.generateMipmaps),M.push(A.premultiplyAlpha),M.push(A.flipY),M.push(A.unpackAlignment),M.push(A.colorSpace),M.join()}function C(A,M){const Y=n.get(A);if(A.isVideoTexture&&Ge(A),A.isRenderTargetTexture===!1&&A.version>0&&Y.__version!==A.version){const J=A.image;if(J===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(J.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{ee(Y,A,M);return}}t.bindTexture(i.TEXTURE_2D,Y.__webglTexture,i.TEXTURE0+M)}function k(A,M){const Y=n.get(A);if(A.version>0&&Y.__version!==A.version){ee(Y,A,M);return}t.bindTexture(i.TEXTURE_2D_ARRAY,Y.__webglTexture,i.TEXTURE0+M)}function G(A,M){const Y=n.get(A);if(A.version>0&&Y.__version!==A.version){ee(Y,A,M);return}t.bindTexture(i.TEXTURE_3D,Y.__webglTexture,i.TEXTURE0+M)}function $(A,M){const Y=n.get(A);if(A.version>0&&Y.__version!==A.version){me(Y,A,M);return}t.bindTexture(i.TEXTURE_CUBE_MAP,Y.__webglTexture,i.TEXTURE0+M)}const te={[Os]:i.REPEAT,[Nn]:i.CLAMP_TO_EDGE,[zs]:i.MIRRORED_REPEAT},B={[Ot]:i.NEAREST,[mu]:i.NEAREST_MIPMAP_NEAREST,[ji]:i.NEAREST_MIPMAP_LINEAR,[Ht]:i.LINEAR,[Xr]:i.LINEAR_MIPMAP_NEAREST,[Un]:i.LINEAR_MIPMAP_LINEAR},K={[Ru]:i.NEVER,[Iu]:i.ALWAYS,[Pu]:i.LESS,[pl]:i.LEQUAL,[Lu]:i.EQUAL,[Uu]:i.GEQUAL,[Fu]:i.GREATER,[Nu]:i.NOTEQUAL};function q(A,M){if(M.type===gn&&e.has("OES_texture_float_linear")===!1&&(M.magFilter===Ht||M.magFilter===Xr||M.magFilter===ji||M.magFilter===Un||M.minFilter===Ht||M.minFilter===Xr||M.minFilter===ji||M.minFilter===Un)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),i.texParameteri(A,i.TEXTURE_WRAP_S,te[M.wrapS]),i.texParameteri(A,i.TEXTURE_WRAP_T,te[M.wrapT]),(A===i.TEXTURE_3D||A===i.TEXTURE_2D_ARRAY)&&i.texParameteri(A,i.TEXTURE_WRAP_R,te[M.wrapR]),i.texParameteri(A,i.TEXTURE_MAG_FILTER,B[M.magFilter]),i.texParameteri(A,i.TEXTURE_MIN_FILTER,B[M.minFilter]),M.compareFunction&&(i.texParameteri(A,i.TEXTURE_COMPARE_MODE,i.COMPARE_REF_TO_TEXTURE),i.texParameteri(A,i.TEXTURE_COMPARE_FUNC,K[M.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(M.magFilter===Ot||M.minFilter!==ji&&M.minFilter!==Un||M.type===gn&&e.has("OES_texture_float_linear")===!1)return;if(M.anisotropy>1||n.get(M).__currentAnisotropy){const Y=e.get("EXT_texture_filter_anisotropic");i.texParameterf(A,Y.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(M.anisotropy,r.getMaxAnisotropy())),n.get(M).__currentAnisotropy=M.anisotropy}}}function F(A,M){let Y=!1;A.__webglInit===void 0&&(A.__webglInit=!0,M.addEventListener("dispose",D));const J=M.source;let ne=h.get(J);ne===void 0&&(ne={},h.set(J,ne));const re=I(M);if(re!==A.__cacheKey){ne[re]===void 0&&(ne[re]={texture:i.createTexture(),usedTimes:0},a.memory.textures++,Y=!0),ne[re].usedTimes++;const Te=ne[A.__cacheKey];Te!==void 0&&(ne[A.__cacheKey].usedTimes--,Te.usedTimes===0&&w(M)),A.__cacheKey=re,A.__webglTexture=ne[re].texture}return Y}function ee(A,M,Y){let J=i.TEXTURE_2D;(M.isDataArrayTexture||M.isCompressedArrayTexture)&&(J=i.TEXTURE_2D_ARRAY),M.isData3DTexture&&(J=i.TEXTURE_3D);const ne=F(A,M),re=M.source;t.bindTexture(J,A.__webglTexture,i.TEXTURE0+Y);const Te=n.get(re);if(re.version!==Te.__version||ne===!0){t.activeTexture(i.TEXTURE0+Y);const ae=$e.getPrimaries($e.workingColorSpace),Se=M.colorSpace===mn?null:$e.getPrimaries(M.colorSpace),Ae=M.colorSpace===mn||ae===Se?i.NONE:i.BROWSER_DEFAULT_WEBGL;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,M.flipY),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,M.premultiplyAlpha),i.pixelStorei(i.UNPACK_ALIGNMENT,M.unpackAlignment),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,Ae);let le=x(M.image,!1,r.maxTextureSize);le=Ee(M,le);const fe=s.convert(M.format,M.colorSpace),Re=s.convert(M.type);let ge=b(M.internalFormat,fe,Re,M.colorSpace,M.isVideoTexture);q(J,M);let _e;const ke=M.mipmaps,He=M.isVideoTexture!==!0&&ge!==fl,je=Te.__version===void 0||ne===!0,Xe=re.dataReady,Ye=v(M,le);if(M.isDepthTexture)ge=i.DEPTH_COMPONENT16,M.type===gn?ge=i.DEPTH_COMPONENT32F:M.type===_i?ge=i.DEPTH_COMPONENT24:M.type===zi&&(ge=i.DEPTH24_STENCIL8),je&&(He?t.texStorage2D(i.TEXTURE_2D,1,ge,le.width,le.height):t.texImage2D(i.TEXTURE_2D,0,ge,le.width,le.height,0,fe,Re,null));else if(M.isDataTexture)if(ke.length>0){He&&je&&t.texStorage2D(i.TEXTURE_2D,Ye,ge,ke[0].width,ke[0].height);for(let ye=0,g=ke.length;ye<g;ye++)_e=ke[ye],He?Xe&&t.texSubImage2D(i.TEXTURE_2D,ye,0,0,_e.width,_e.height,fe,Re,_e.data):t.texImage2D(i.TEXTURE_2D,ye,ge,_e.width,_e.height,0,fe,Re,_e.data);M.generateMipmaps=!1}else He?(je&&t.texStorage2D(i.TEXTURE_2D,Ye,ge,le.width,le.height),Xe&&t.texSubImage2D(i.TEXTURE_2D,0,0,0,le.width,le.height,fe,Re,le.data)):t.texImage2D(i.TEXTURE_2D,0,ge,le.width,le.height,0,fe,Re,le.data);else if(M.isCompressedTexture)if(M.isCompressedArrayTexture){He&&je&&t.texStorage3D(i.TEXTURE_2D_ARRAY,Ye,ge,ke[0].width,ke[0].height,le.depth);for(let ye=0,g=ke.length;ye<g;ye++)_e=ke[ye],M.format!==Yt?fe!==null?He?Xe&&t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,ye,0,0,0,_e.width,_e.height,le.depth,fe,_e.data,0,0):t.compressedTexImage3D(i.TEXTURE_2D_ARRAY,ye,ge,_e.width,_e.height,le.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,ye,0,0,0,_e.width,_e.height,le.depth,fe,Re,_e.data):t.texImage3D(i.TEXTURE_2D_ARRAY,ye,ge,_e.width,_e.height,le.depth,0,fe,Re,_e.data)}else{He&&je&&t.texStorage2D(i.TEXTURE_2D,Ye,ge,ke[0].width,ke[0].height);for(let ye=0,g=ke.length;ye<g;ye++)_e=ke[ye],M.format!==Yt?fe!==null?He?Xe&&t.compressedTexSubImage2D(i.TEXTURE_2D,ye,0,0,_e.width,_e.height,fe,_e.data):t.compressedTexImage2D(i.TEXTURE_2D,ye,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,ye,0,0,_e.width,_e.height,fe,Re,_e.data):t.texImage2D(i.TEXTURE_2D,ye,ge,_e.width,_e.height,0,fe,Re,_e.data)}else if(M.isDataArrayTexture)He?(je&&t.texStorage3D(i.TEXTURE_2D_ARRAY,Ye,ge,le.width,le.height,le.depth),Xe&&t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,0,le.width,le.height,le.depth,fe,Re,le.data)):t.texImage3D(i.TEXTURE_2D_ARRAY,0,ge,le.width,le.height,le.depth,0,fe,Re,le.data);else if(M.isData3DTexture)He?(je&&t.texStorage3D(i.TEXTURE_3D,Ye,ge,le.width,le.height,le.depth),Xe&&t.texSubImage3D(i.TEXTURE_3D,0,0,0,0,le.width,le.height,le.depth,fe,Re,le.data)):t.texImage3D(i.TEXTURE_3D,0,ge,le.width,le.height,le.depth,0,fe,Re,le.data);else if(M.isFramebufferTexture){if(je)if(He)t.texStorage2D(i.TEXTURE_2D,Ye,ge,le.width,le.height);else{let ye=le.width,g=le.height;for(let V=0;V<Ye;V++)t.texImage2D(i.TEXTURE_2D,V,ge,ye,g,0,fe,Re,null),ye>>=1,g>>=1}}else if(ke.length>0){if(He&&je){const ye=We(ke[0]);t.texStorage2D(i.TEXTURE_2D,Ye,ge,ye.width,ye.height)}for(let ye=0,g=ke.length;ye<g;ye++)_e=ke[ye],He?Xe&&t.texSubImage2D(i.TEXTURE_2D,ye,0,0,fe,Re,_e):t.texImage2D(i.TEXTURE_2D,ye,ge,fe,Re,_e);M.generateMipmaps=!1}else if(He){if(je){const ye=We(le);t.texStorage2D(i.TEXTURE_2D,Ye,ge,ye.width,ye.height)}Xe&&t.texSubImage2D(i.TEXTURE_2D,0,0,0,fe,Re,le)}else t.texImage2D(i.TEXTURE_2D,0,ge,fe,Re,le);m(M)&&f(J),Te.__version=re.version,M.onUpdate&&M.onUpdate(M)}A.__version=M.version}function me(A,M,Y){if(M.image.length!==6)return;const J=F(A,M),ne=M.source;t.bindTexture(i.TEXTURE_CUBE_MAP,A.__webglTexture,i.TEXTURE0+Y);const re=n.get(ne);if(ne.version!==re.__version||J===!0){t.activeTexture(i.TEXTURE0+Y);const Te=$e.getPrimaries($e.workingColorSpace),ae=M.colorSpace===mn?null:$e.getPrimaries(M.colorSpace),Se=M.colorSpace===mn||Te===ae?i.NONE:i.BROWSER_DEFAULT_WEBGL;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,M.flipY),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,M.premultiplyAlpha),i.pixelStorei(i.UNPACK_ALIGNMENT,M.unpackAlignment),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,Se);const Ae=M.isCompressedTexture||M.image[0].isCompressedTexture,le=M.image[0]&&M.image[0].isDataTexture,fe=[];for(let g=0;g<6;g++)!Ae&&!le?fe[g]=x(M.image[g],!0,r.maxCubemapSize):fe[g]=le?M.image[g].image:M.image[g],fe[g]=Ee(M,fe[g]);const Re=fe[0],ge=s.convert(M.format,M.colorSpace),_e=s.convert(M.type),ke=b(M.internalFormat,ge,_e,M.colorSpace),He=M.isVideoTexture!==!0,je=re.__version===void 0||J===!0,Xe=ne.dataReady;let Ye=v(M,Re);q(i.TEXTURE_CUBE_MAP,M);let ye;if(Ae){He&&je&&t.texStorage2D(i.TEXTURE_CUBE_MAP,Ye,ke,Re.width,Re.height);for(let g=0;g<6;g++){ye=fe[g].mipmaps;for(let V=0;V<ye.length;V++){const Z=ye[V];M.format!==Yt?ge!==null?He?Xe&&t.compressedTexSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+g,V,0,0,Z.width,Z.height,ge,Z.data):t.compressedTexImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+g,V,ke,Z.width,Z.height,0,Z.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):He?Xe&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+g,V,0,0,Z.width,Z.height,ge,_e,Z.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+g,V,ke,Z.width,Z.height,0,ge,_e,Z.data)}}}else{if(ye=M.mipmaps,He&&je){ye.length>0&&Ye++;const g=We(fe[0]);t.texStorage2D(i.TEXTURE_CUBE_MAP,Ye,ke,g.width,g.height)}for(let g=0;g<6;g++)if(le){He?Xe&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+g,0,0,0,fe[g].width,fe[g].height,ge,_e,fe[g].data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+g,0,ke,fe[g].width,fe[g].height,0,ge,_e,fe[g].data);for(let V=0;V<ye.length;V++){const oe=ye[V].image[g].image;He?Xe&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+g,V+1,0,0,oe.width,oe.height,ge,_e,oe.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+g,V+1,ke,oe.width,oe.height,0,ge,_e,oe.data)}}else{He?Xe&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+g,0,0,0,ge,_e,fe[g]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+g,0,ke,ge,_e,fe[g]);for(let V=0;V<ye.length;V++){const Z=ye[V];He?Xe&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+g,V+1,0,0,ge,_e,Z.image[g]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+g,V+1,ke,ge,_e,Z.image[g])}}}m(M)&&f(i.TEXTURE_CUBE_MAP),re.__version=ne.version,M.onUpdate&&M.onUpdate(M)}A.__version=M.version}function N(A,M,Y,J,ne,re){const Te=s.convert(Y.format,Y.colorSpace),ae=s.convert(Y.type),Se=b(Y.internalFormat,Te,ae,Y.colorSpace);if(!n.get(M).__hasExternalTextures){const le=Math.max(1,M.width>>re),fe=Math.max(1,M.height>>re);ne===i.TEXTURE_3D||ne===i.TEXTURE_2D_ARRAY?t.texImage3D(ne,re,Se,le,fe,M.depth,0,Te,ae,null):t.texImage2D(ne,re,Se,le,fe,0,Te,ae,null)}t.bindFramebuffer(i.FRAMEBUFFER,A),xe(M)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,J,ne,n.get(Y).__webglTexture,0,Fe(M)):(ne===i.TEXTURE_2D||ne>=i.TEXTURE_CUBE_MAP_POSITIVE_X&&ne<=i.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&i.framebufferTexture2D(i.FRAMEBUFFER,J,ne,n.get(Y).__webglTexture,re),t.bindFramebuffer(i.FRAMEBUFFER,null)}function Q(A,M,Y){if(i.bindRenderbuffer(i.RENDERBUFFER,A),M.depthBuffer&&!M.stencilBuffer){let J=i.DEPTH_COMPONENT24;if(Y||xe(M)){const ne=M.depthTexture;ne&&ne.isDepthTexture&&(ne.type===gn?J=i.DEPTH_COMPONENT32F:ne.type===_i&&(J=i.DEPTH_COMPONENT24));const re=Fe(M);xe(M)?o.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,re,J,M.width,M.height):i.renderbufferStorageMultisample(i.RENDERBUFFER,re,J,M.width,M.height)}else i.renderbufferStorage(i.RENDERBUFFER,J,M.width,M.height);i.framebufferRenderbuffer(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.RENDERBUFFER,A)}else if(M.depthBuffer&&M.stencilBuffer){const J=Fe(M);Y&&xe(M)===!1?i.renderbufferStorageMultisample(i.RENDERBUFFER,J,i.DEPTH24_STENCIL8,M.width,M.height):xe(M)?o.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,J,i.DEPTH24_STENCIL8,M.width,M.height):i.renderbufferStorage(i.RENDERBUFFER,i.DEPTH_STENCIL,M.width,M.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.RENDERBUFFER,A)}else{const J=M.textures;for(let ne=0;ne<J.length;ne++){const re=J[ne],Te=s.convert(re.format,re.colorSpace),ae=s.convert(re.type),Se=b(re.internalFormat,Te,ae,re.colorSpace),Ae=Fe(M);Y&&xe(M)===!1?i.renderbufferStorageMultisample(i.RENDERBUFFER,Ae,Se,M.width,M.height):xe(M)?o.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,Ae,Se,M.width,M.height):i.renderbufferStorage(i.RENDERBUFFER,Se,M.width,M.height)}}i.bindRenderbuffer(i.RENDERBUFFER,null)}function ue(A,M){if(M&&M.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(i.FRAMEBUFFER,A),!(M.depthTexture&&M.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");(!n.get(M.depthTexture).__webglTexture||M.depthTexture.image.width!==M.width||M.depthTexture.image.height!==M.height)&&(M.depthTexture.image.width=M.width,M.depthTexture.image.height=M.height,M.depthTexture.needsUpdate=!0),C(M.depthTexture,0);const J=n.get(M.depthTexture).__webglTexture,ne=Fe(M);if(M.depthTexture.format===di)xe(M)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_2D,J,0,ne):i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_2D,J,0);else if(M.depthTexture.format===Ui)xe(M)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.TEXTURE_2D,J,0,ne):i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.TEXTURE_2D,J,0);else throw new Error("Unknown depthTexture format")}function ie(A){const M=n.get(A),Y=A.isWebGLCubeRenderTarget===!0;if(A.depthTexture&&!M.__autoAllocateDepthBuffer){if(Y)throw new Error("target.depthTexture not supported in Cube render targets");ue(M.__webglFramebuffer,A)}else if(Y){M.__webglDepthbuffer=[];for(let J=0;J<6;J++)t.bindFramebuffer(i.FRAMEBUFFER,M.__webglFramebuffer[J]),M.__webglDepthbuffer[J]=i.createRenderbuffer(),Q(M.__webglDepthbuffer[J],A,!1)}else t.bindFramebuffer(i.FRAMEBUFFER,M.__webglFramebuffer),M.__webglDepthbuffer=i.createRenderbuffer(),Q(M.__webglDepthbuffer,A,!1);t.bindFramebuffer(i.FRAMEBUFFER,null)}function ve(A,M,Y){const J=n.get(A);M!==void 0&&N(J.__webglFramebuffer,A,A.texture,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,0),Y!==void 0&&ie(A)}function De(A){const M=A.texture,Y=n.get(A),J=n.get(M);A.addEventListener("dispose",P);const ne=A.textures,re=A.isWebGLCubeRenderTarget===!0,Te=ne.length>1;if(Te||(J.__webglTexture===void 0&&(J.__webglTexture=i.createTexture()),J.__version=M.version,a.memory.textures++),re){Y.__webglFramebuffer=[];for(let ae=0;ae<6;ae++)if(M.mipmaps&&M.mipmaps.length>0){Y.__webglFramebuffer[ae]=[];for(let Se=0;Se<M.mipmaps.length;Se++)Y.__webglFramebuffer[ae][Se]=i.createFramebuffer()}else Y.__webglFramebuffer[ae]=i.createFramebuffer()}else{if(M.mipmaps&&M.mipmaps.length>0){Y.__webglFramebuffer=[];for(let ae=0;ae<M.mipmaps.length;ae++)Y.__webglFramebuffer[ae]=i.createFramebuffer()}else Y.__webglFramebuffer=i.createFramebuffer();if(Te)for(let ae=0,Se=ne.length;ae<Se;ae++){const Ae=n.get(ne[ae]);Ae.__webglTexture===void 0&&(Ae.__webglTexture=i.createTexture(),a.memory.textures++)}if(A.samples>0&&xe(A)===!1){Y.__webglMultisampledFramebuffer=i.createFramebuffer(),Y.__webglColorRenderbuffer=[],t.bindFramebuffer(i.FRAMEBUFFER,Y.__webglMultisampledFramebuffer);for(let ae=0;ae<ne.length;ae++){const Se=ne[ae];Y.__webglColorRenderbuffer[ae]=i.createRenderbuffer(),i.bindRenderbuffer(i.RENDERBUFFER,Y.__webglColorRenderbuffer[ae]);const Ae=s.convert(Se.format,Se.colorSpace),le=s.convert(Se.type),fe=b(Se.internalFormat,Ae,le,Se.colorSpace,A.isXRRenderTarget===!0),Re=Fe(A);i.renderbufferStorageMultisample(i.RENDERBUFFER,Re,fe,A.width,A.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+ae,i.RENDERBUFFER,Y.__webglColorRenderbuffer[ae])}i.bindRenderbuffer(i.RENDERBUFFER,null),A.depthBuffer&&(Y.__webglDepthRenderbuffer=i.createRenderbuffer(),Q(Y.__webglDepthRenderbuffer,A,!0)),t.bindFramebuffer(i.FRAMEBUFFER,null)}}if(re){t.bindTexture(i.TEXTURE_CUBE_MAP,J.__webglTexture),q(i.TEXTURE_CUBE_MAP,M);for(let ae=0;ae<6;ae++)if(M.mipmaps&&M.mipmaps.length>0)for(let Se=0;Se<M.mipmaps.length;Se++)N(Y.__webglFramebuffer[ae][Se],A,M,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+ae,Se);else N(Y.__webglFramebuffer[ae],A,M,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+ae,0);m(M)&&f(i.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(Te){for(let ae=0,Se=ne.length;ae<Se;ae++){const Ae=ne[ae],le=n.get(Ae);t.bindTexture(i.TEXTURE_2D,le.__webglTexture),q(i.TEXTURE_2D,Ae),N(Y.__webglFramebuffer,A,Ae,i.COLOR_ATTACHMENT0+ae,i.TEXTURE_2D,0),m(Ae)&&f(i.TEXTURE_2D)}t.unbindTexture()}else{let ae=i.TEXTURE_2D;if((A.isWebGL3DRenderTarget||A.isWebGLArrayRenderTarget)&&(ae=A.isWebGL3DRenderTarget?i.TEXTURE_3D:i.TEXTURE_2D_ARRAY),t.bindTexture(ae,J.__webglTexture),q(ae,M),M.mipmaps&&M.mipmaps.length>0)for(let Se=0;Se<M.mipmaps.length;Se++)N(Y.__webglFramebuffer[Se],A,M,i.COLOR_ATTACHMENT0,ae,Se);else N(Y.__webglFramebuffer,A,M,i.COLOR_ATTACHMENT0,ae,0);m(M)&&f(ae),t.unbindTexture()}A.depthBuffer&&ie(A)}function Ce(A){const M=A.textures;for(let Y=0,J=M.length;Y<J;Y++){const ne=M[Y];if(m(ne)){const re=A.isWebGLCubeRenderTarget?i.TEXTURE_CUBE_MAP:i.TEXTURE_2D,Te=n.get(ne).__webglTexture;t.bindTexture(re,Te),f(re),t.unbindTexture()}}}function H(A){if(A.samples>0&&xe(A)===!1){const M=A.textures,Y=A.width,J=A.height;let ne=i.COLOR_BUFFER_BIT;const re=[],Te=A.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,ae=n.get(A),Se=M.length>1;if(Se)for(let Ae=0;Ae<M.length;Ae++)t.bindFramebuffer(i.FRAMEBUFFER,ae.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+Ae,i.RENDERBUFFER,null),t.bindFramebuffer(i.FRAMEBUFFER,ae.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+Ae,i.TEXTURE_2D,null,0);t.bindFramebuffer(i.READ_FRAMEBUFFER,ae.__webglMultisampledFramebuffer),t.bindFramebuffer(i.DRAW_FRAMEBUFFER,ae.__webglFramebuffer);for(let Ae=0;Ae<M.length;Ae++){re.push(i.COLOR_ATTACHMENT0+Ae),A.depthBuffer&&re.push(Te);const le=ae.__ignoreDepthValues!==void 0?ae.__ignoreDepthValues:!1;if(le===!1&&(A.depthBuffer&&(ne|=i.DEPTH_BUFFER_BIT),A.stencilBuffer&&ae.__isTransmissionRenderTarget!==!0&&(ne|=i.STENCIL_BUFFER_BIT)),Se&&i.framebufferRenderbuffer(i.READ_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.RENDERBUFFER,ae.__webglColorRenderbuffer[Ae]),le===!0&&(i.invalidateFramebuffer(i.READ_FRAMEBUFFER,[Te]),i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,[Te])),Se){const fe=n.get(M[Ae]).__webglTexture;i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,fe,0)}i.blitFramebuffer(0,0,Y,J,0,0,Y,J,ne,i.NEAREST),l&&i.invalidateFramebuffer(i.READ_FRAMEBUFFER,re)}if(t.bindFramebuffer(i.READ_FRAMEBUFFER,null),t.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),Se)for(let Ae=0;Ae<M.length;Ae++){t.bindFramebuffer(i.FRAMEBUFFER,ae.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+Ae,i.RENDERBUFFER,ae.__webglColorRenderbuffer[Ae]);const le=n.get(M[Ae]).__webglTexture;t.bindFramebuffer(i.FRAMEBUFFER,ae.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+Ae,i.TEXTURE_2D,le,0)}t.bindFramebuffer(i.DRAW_FRAMEBUFFER,ae.__webglMultisampledFramebuffer)}}function Fe(A){return Math.min(r.maxSamples,A.samples)}function xe(A){const M=n.get(A);return A.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&M.__useRenderToTexture!==!1}function Ge(A){const M=a.render.frame;d.get(A)!==M&&(d.set(A,M),A.update())}function Ee(A,M){const Y=A.colorSpace,J=A.format,ne=A.type;return A.isCompressedTexture===!0||A.isVideoTexture===!0||Y!==Mn&&Y!==mn&&($e.getTransfer(Y)===Ke?(J!==Yt||ne!==xn)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",Y)),M}function We(A){return typeof HTMLImageElement<"u"&&A instanceof HTMLImageElement?(c.width=A.naturalWidth||A.width,c.height=A.naturalHeight||A.height):typeof VideoFrame<"u"&&A instanceof VideoFrame?(c.width=A.displayWidth,c.height=A.displayHeight):(c.width=A.width,c.height=A.height),c}this.allocateTextureUnit=U,this.resetTextureUnits=y,this.setTexture2D=C,this.setTexture2DArray=k,this.setTexture3D=G,this.setTextureCube=$,this.rebindTextures=ve,this.setupRenderTarget=De,this.updateRenderTargetMipmap=Ce,this.updateMultisampleRenderTarget=H,this.setupDepthRenderbuffer=ie,this.setupFrameBufferTexture=N,this.useMultisampledRTT=xe}function Jm(i,e){function t(n,r=mn){let s;const a=$e.getTransfer(r);if(n===xn)return i.UNSIGNED_BYTE;if(n===ll)return i.UNSIGNED_SHORT_4_4_4_4;if(n===cl)return i.UNSIGNED_SHORT_5_5_5_1;if(n===xu)return i.UNSIGNED_INT_5_9_9_9_REV;if(n===gu)return i.BYTE;if(n===_u)return i.SHORT;if(n===al)return i.UNSIGNED_SHORT;if(n===ol)return i.INT;if(n===_i)return i.UNSIGNED_INT;if(n===gn)return i.FLOAT;if(n===vn)return i.HALF_FLOAT;if(n===vu)return i.ALPHA;if(n===yu)return i.RGB;if(n===Yt)return i.RGBA;if(n===Mu)return i.LUMINANCE;if(n===Su)return i.LUMINANCE_ALPHA;if(n===di)return i.DEPTH_COMPONENT;if(n===Ui)return i.DEPTH_STENCIL;if(n===Eu)return i.RED;if(n===ul)return i.RED_INTEGER;if(n===bu)return i.RG;if(n===hl)return i.RG_INTEGER;if(n===dl)return i.RGBA_INTEGER;if(n===jr||n===Yr||n===qr||n===$r)if(a===Ke)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(n===jr)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Yr)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===qr)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===$r)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(n===jr)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Yr)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===qr)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===$r)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===Ma||n===Sa||n===Ea||n===ba)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(n===Ma)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===Sa)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===Ea)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===ba)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===fl)return s=e.get("WEBGL_compressed_texture_etc1"),s!==null?s.COMPRESSED_RGB_ETC1_WEBGL:null;if(n===Da||n===Ta)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(n===Da)return a===Ke?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(n===Ta)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(n===Aa||n===wa||n===Ca||n===Ra||n===Pa||n===La||n===Fa||n===Na||n===Ua||n===Ia||n===Oa||n===za||n===Ba||n===ka)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(n===Aa)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===wa)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===Ca)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===Ra)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===Pa)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===La)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===Fa)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===Na)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===Ua)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===Ia)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===Oa)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===za)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===Ba)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===ka)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===Kr||n===Ha||n===Va)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(n===Kr)return a===Ke?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===Ha)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===Va)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===Du||n===Ga||n===Wa||n===Xa)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(n===Kr)return s.COMPRESSED_RED_RGTC1_EXT;if(n===Ga)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===Wa)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===Xa)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 Qm extends Lt{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class pr extends Mt{constructor(){super(),this.isGroup=!0,this.type="Group"}}const e0={type:"move"};class Ms{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new pr,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 pr,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new R,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new R),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new pr,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new R,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new R),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 x of e.hand.values()){const m=t.getJointPose(x,n),f=this._getHandJoint(c,x);m!==null&&(f.matrix.fromArray(m.transform.matrix),f.matrix.decompose(f.position,f.rotation,f.scale),f.matrixWorldNeedsUpdate=!0,f.jointRadius=m.radius),f.visible=m!==null}const d=c.joints["index-finger-tip"],u=c.joints["thumb-tip"],h=d.position.distanceTo(u.position),p=.02,_=.005;c.inputState.pinching&&h>p+_?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&h<=p-_&&(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(e0)))}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 pr;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}const t0=`
|
|
3776
|
+
}`;function km(i,e,t){let n=new bl;const r=new ue,s=new ue,a=new dt,o=new Im({depthPacking:vu}),l=new Om,c={},h=t.maxTextureSize,d={[vn]:Mt,[Mt]:vn,[Wt]:Wt},u=new ft({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new ue},radius:{value:4}},vertexShader:Bm,fragmentShader:zm}),p=u.clone();p.defines.HORIZONTAL_PASS=1;const _=new _t;_.setAttribute("position",new yt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const v=new bt(_,u),m=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=tl;let f=this.type;this.render=function(T,w,L){if(m.enabled===!1||m.autoUpdate===!1&&m.needsUpdate===!1||T.length===0)return;const E=i.getRenderTarget(),M=i.getActiveCubeFace(),N=i.getActiveMipmapLevel(),I=i.state;I.setBlending(en),I.buffers.color.setClear(1,1,1,1),I.buffers.depth.setTest(!0),I.setScissorTest(!1);const C=f!==Jt&&this.type===Jt,z=f===Jt&&this.type!==Jt;for(let V=0,q=T.length;V<q;V++){const ee=T[V],B=ee.shadow;if(B===void 0){console.warn("THREE.WebGLShadowMap:",ee,"has no shadow.");continue}if(B.autoUpdate===!1&&B.needsUpdate===!1)continue;r.copy(B.mapSize);const $=B.getFrameExtents();if(r.multiply($),s.copy(B.mapSize),(r.x>h||r.y>h)&&(r.x>h&&(s.x=Math.floor(h/$.x),r.x=s.x*$.x,B.mapSize.x=s.x),r.y>h&&(s.y=Math.floor(h/$.y),r.y=s.y*$.y,B.mapSize.y=s.y)),B.map===null||C===!0||z===!0){const F=this.type!==Jt?{minFilter:Nt,magFilter:Nt}:{};B.map!==null&&B.map.dispose(),B.map=new Ht(r.x,r.y,F),B.map.texture.name=ee.name+".shadowMap",B.camera.updateProjectionMatrix()}i.setRenderTarget(B.map),i.clear();const j=B.getViewportCount();for(let F=0;F<j;F++){const Q=B.getViewport(F);a.set(s.x*Q.x,s.y*Q.y,s.x*Q.z,s.y*Q.w),I.viewport(a),B.updateMatrices(ee,F),n=B.getFrustum(),D(w,L,B.camera,ee,this.type)}B.isPointLightShadow!==!0&&this.type===Jt&&b(B,L),B.needsUpdate=!1}f=this.type,m.needsUpdate=!1,i.setRenderTarget(E,M,N)};function b(T,w){const L=e.update(v);u.defines.VSM_SAMPLES!==T.blurSamples&&(u.defines.VSM_SAMPLES=T.blurSamples,p.defines.VSM_SAMPLES=T.blurSamples,u.needsUpdate=!0,p.needsUpdate=!0),T.mapPass===null&&(T.mapPass=new Ht(r.x,r.y)),u.uniforms.shadow_pass.value=T.map.texture,u.uniforms.resolution.value=T.mapSize,u.uniforms.radius.value=T.radius,i.setRenderTarget(T.mapPass),i.clear(),i.renderBufferDirect(w,null,L,u,v,null),p.uniforms.shadow_pass.value=T.mapPass.texture,p.uniforms.resolution.value=T.mapSize,p.uniforms.radius.value=T.radius,i.setRenderTarget(T.map),i.clear(),i.renderBufferDirect(w,null,L,p,v,null)}function x(T,w,L,E){let M=null;const N=L.isPointLight===!0?T.customDistanceMaterial:T.customDepthMaterial;if(N!==void 0)M=N;else if(M=L.isPointLight===!0?l:o,i.localClippingEnabled&&w.clipShadows===!0&&Array.isArray(w.clippingPlanes)&&w.clippingPlanes.length!==0||w.displacementMap&&w.displacementScale!==0||w.alphaMap&&w.alphaTest>0||w.map&&w.alphaTest>0){const I=M.uuid,C=w.uuid;let z=c[I];z===void 0&&(z={},c[I]=z);let V=z[C];V===void 0&&(V=M.clone(),z[C]=V,w.addEventListener("dispose",P)),M=V}if(M.visible=w.visible,M.wireframe=w.wireframe,E===Jt?M.side=w.shadowSide!==null?w.shadowSide:w.side:M.side=w.shadowSide!==null?w.shadowSide:d[w.side],M.alphaMap=w.alphaMap,M.alphaTest=w.alphaTest,M.map=w.map,M.clipShadows=w.clipShadows,M.clippingPlanes=w.clippingPlanes,M.clipIntersection=w.clipIntersection,M.displacementMap=w.displacementMap,M.displacementScale=w.displacementScale,M.displacementBias=w.displacementBias,M.wireframeLinewidth=w.wireframeLinewidth,M.linewidth=w.linewidth,L.isPointLight===!0&&M.isMeshDistanceMaterial===!0){const I=i.properties.get(M);I.light=L}return M}function D(T,w,L,E,M){if(T.visible===!1)return;if(T.layers.test(w.layers)&&(T.isMesh||T.isLine||T.isPoints)&&(T.castShadow||T.receiveShadow&&M===Jt)&&(!T.frustumCulled||n.intersectsObject(T))){T.modelViewMatrix.multiplyMatrices(L.matrixWorldInverse,T.matrixWorld);const C=e.update(T),z=T.material;if(Array.isArray(z)){const V=C.groups;for(let q=0,ee=V.length;q<ee;q++){const B=V[q],$=z[B.materialIndex];if($&&$.visible){const j=x(T,$,E,M);T.onBeforeShadow(i,T,w,L,C,j,B),i.renderBufferDirect(L,null,C,j,T,B),T.onAfterShadow(i,T,w,L,C,j,B)}}}else if(z.visible){const V=x(T,z,E,M);T.onBeforeShadow(i,T,w,L,C,V,null),i.renderBufferDirect(L,null,C,V,T,null),T.onAfterShadow(i,T,w,L,C,V,null)}}const I=T.children;for(let C=0,z=I.length;C<z;C++)D(I[C],w,L,E,M)}function P(T){T.target.removeEventListener("dispose",P);for(const L in c){const E=c[L],M=T.target.uuid;M in E&&(E[M].dispose(),delete E[M])}}}function Hm(i){function e(){let g=!1;const H=new dt;let K=null;const se=new dt(0,0,0,0);return{setMask:function(fe){K!==fe&&!g&&(i.colorMask(fe,fe,fe,fe),K=fe)},setLocked:function(fe){g=fe},setClear:function(fe,Ve,ze,Ze,lt){lt===!0&&(fe*=Ze,Ve*=Ze,ze*=Ze),H.set(fe,Ve,ze,Ze),se.equals(H)===!1&&(i.clearColor(fe,Ve,ze,Ze),se.copy(H))},reset:function(){g=!1,K=null,se.set(-1,0,0,0)}}}function t(){let g=!1,H=null,K=null,se=null;return{setTest:function(fe){fe?le(i.DEPTH_TEST):ne(i.DEPTH_TEST)},setMask:function(fe){H!==fe&&!g&&(i.depthMask(fe),H=fe)},setFunc:function(fe){if(K!==fe){switch(fe){case Xc:i.depthFunc(i.NEVER);break;case Yc:i.depthFunc(i.ALWAYS);break;case jc:i.depthFunc(i.LESS);break;case br:i.depthFunc(i.LEQUAL);break;case qc:i.depthFunc(i.EQUAL);break;case $c:i.depthFunc(i.GEQUAL);break;case Kc:i.depthFunc(i.GREATER);break;case Zc:i.depthFunc(i.NOTEQUAL);break;default:i.depthFunc(i.LEQUAL)}K=fe}},setLocked:function(fe){g=fe},setClear:function(fe){se!==fe&&(i.clearDepth(fe),se=fe)},reset:function(){g=!1,H=null,K=null,se=null}}}function n(){let g=!1,H=null,K=null,se=null,fe=null,Ve=null,ze=null,Ze=null,lt=null;return{setTest:function(qe){g||(qe?le(i.STENCIL_TEST):ne(i.STENCIL_TEST))},setMask:function(qe){H!==qe&&!g&&(i.stencilMask(qe),H=qe)},setFunc:function(qe,it,rt){(K!==qe||se!==it||fe!==rt)&&(i.stencilFunc(qe,it,rt),K=qe,se=it,fe=rt)},setOp:function(qe,it,rt){(Ve!==qe||ze!==it||Ze!==rt)&&(i.stencilOp(qe,it,rt),Ve=qe,ze=it,Ze=rt)},setLocked:function(qe){g=qe},setClear:function(qe){lt!==qe&&(i.clearStencil(qe),lt=qe)},reset:function(){g=!1,H=null,K=null,se=null,fe=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={},h={},d=new WeakMap,u=[],p=null,_=!1,v=null,m=null,f=null,b=null,x=null,D=null,P=null,T=new be(0,0,0),w=0,L=!1,E=null,M=null,N=null,I=null,C=null;const z=i.getParameter(i.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let V=!1,q=0;const ee=i.getParameter(i.VERSION);ee.indexOf("WebGL")!==-1?(q=parseFloat(/^WebGL (\d)/.exec(ee)[1]),V=q>=1):ee.indexOf("OpenGL ES")!==-1&&(q=parseFloat(/^OpenGL ES (\d)/.exec(ee)[1]),V=q>=2);let B=null,$={};const j=i.getParameter(i.SCISSOR_BOX),F=i.getParameter(i.VIEWPORT),Q=new dt().fromArray(j),pe=new dt().fromArray(F);function U(g,H,K,se){const fe=new Uint8Array(4),Ve=i.createTexture();i.bindTexture(g,Ve),i.texParameteri(g,i.TEXTURE_MIN_FILTER,i.NEAREST),i.texParameteri(g,i.TEXTURE_MAG_FILTER,i.NEAREST);for(let ze=0;ze<K;ze++)g===i.TEXTURE_3D||g===i.TEXTURE_2D_ARRAY?i.texImage3D(H,0,i.RGBA,1,1,se,0,i.RGBA,i.UNSIGNED_BYTE,fe):i.texImage2D(H+ze,0,i.RGBA,1,1,0,i.RGBA,i.UNSIGNED_BYTE,fe);return Ve}const J={};J[i.TEXTURE_2D]=U(i.TEXTURE_2D,i.TEXTURE_2D,1),J[i.TEXTURE_CUBE_MAP]=U(i.TEXTURE_CUBE_MAP,i.TEXTURE_CUBE_MAP_POSITIVE_X,6),J[i.TEXTURE_2D_ARRAY]=U(i.TEXTURE_2D_ARRAY,i.TEXTURE_2D_ARRAY,1,1),J[i.TEXTURE_3D]=U(i.TEXTURE_3D,i.TEXTURE_3D,1,1),r.setClear(0,0,0,1),s.setClear(1),a.setClear(0),le(i.DEPTH_TEST),s.setFunc(br),ye(!1),We(ga),le(i.CULL_FACE),ve(en);function le(g){c[g]!==!0&&(i.enable(g),c[g]=!0)}function ne(g){c[g]!==!1&&(i.disable(g),c[g]=!1)}function xe(g,H){return h[g]!==H?(i.bindFramebuffer(g,H),h[g]=H,g===i.DRAW_FRAMEBUFFER&&(h[i.FRAMEBUFFER]=H),g===i.FRAMEBUFFER&&(h[i.DRAW_FRAMEBUFFER]=H),!0):!1}function De(g,H){let K=u,se=!1;if(g){K=d.get(H),K===void 0&&(K=[],d.set(H,K));const fe=g.textures;if(K.length!==fe.length||K[0]!==i.COLOR_ATTACHMENT0){for(let Ve=0,ze=fe.length;Ve<ze;Ve++)K[Ve]=i.COLOR_ATTACHMENT0+Ve;K.length=fe.length,se=!0}}else K[0]!==i.BACK&&(K[0]=i.BACK,se=!0);se&&i.drawBuffers(K)}function Ce(g){return p!==g?(i.useProgram(g),p=g,!0):!1}const k={[Cn]:i.FUNC_ADD,[wc]:i.FUNC_SUBTRACT,[Cc]:i.FUNC_REVERSE_SUBTRACT};k[Rc]=i.MIN,k[Pc]=i.MAX;const Fe={[Lc]:i.ZERO,[Fc]:i.ONE,[Uc]:i.SRC_COLOR,[Ps]:i.SRC_ALPHA,[kc]:i.SRC_ALPHA_SATURATE,[Bc]:i.DST_COLOR,[Ic]:i.DST_ALPHA,[Nc]:i.ONE_MINUS_SRC_COLOR,[Ls]:i.ONE_MINUS_SRC_ALPHA,[zc]:i.ONE_MINUS_DST_COLOR,[Oc]:i.ONE_MINUS_DST_ALPHA,[Hc]:i.CONSTANT_COLOR,[Vc]:i.ONE_MINUS_CONSTANT_COLOR,[Gc]:i.CONSTANT_ALPHA,[Wc]:i.ONE_MINUS_CONSTANT_ALPHA};function ve(g,H,K,se,fe,Ve,ze,Ze,lt,qe){if(g===en){_===!0&&(ne(i.BLEND),_=!1);return}if(_===!1&&(le(i.BLEND),_=!0),g!==Ac){if(g!==v||qe!==L){if((m!==Cn||x!==Cn)&&(i.blendEquation(i.FUNC_ADD),m=Cn,x=Cn),qe)switch(g){case li:i.blendFuncSeparate(i.ONE,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case ci:i.blendFunc(i.ONE,i.ONE);break;case _a:i.blendFuncSeparate(i.ZERO,i.ONE_MINUS_SRC_COLOR,i.ZERO,i.ONE);break;case va:i.blendFuncSeparate(i.ZERO,i.SRC_COLOR,i.ZERO,i.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",g);break}else switch(g){case li:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case ci:i.blendFunc(i.SRC_ALPHA,i.ONE);break;case _a:i.blendFuncSeparate(i.ZERO,i.ONE_MINUS_SRC_COLOR,i.ZERO,i.ONE);break;case va:i.blendFunc(i.ZERO,i.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",g);break}f=null,b=null,D=null,P=null,T.set(0,0,0),w=0,v=g,L=qe}return}fe=fe||H,Ve=Ve||K,ze=ze||se,(H!==m||fe!==x)&&(i.blendEquationSeparate(k[H],k[fe]),m=H,x=fe),(K!==f||se!==b||Ve!==D||ze!==P)&&(i.blendFuncSeparate(Fe[K],Fe[se],Fe[Ve],Fe[ze]),f=K,b=se,D=Ve,P=ze),(Ze.equals(T)===!1||lt!==w)&&(i.blendColor(Ze.r,Ze.g,Ze.b,lt),T.copy(Ze),w=lt),v=g,L=!1}function Ge(g,H){g.side===Wt?ne(i.CULL_FACE):le(i.CULL_FACE);let K=g.side===Mt;H&&(K=!K),ye(K),g.blending===li&&g.transparent===!1?ve(en):ve(g.blending,g.blendEquation,g.blendSrc,g.blendDst,g.blendEquationAlpha,g.blendSrcAlpha,g.blendDstAlpha,g.blendColor,g.blendAlpha,g.premultipliedAlpha),s.setFunc(g.depthFunc),s.setTest(g.depthTest),s.setMask(g.depthWrite),r.setMask(g.colorWrite);const se=g.stencilWrite;a.setTest(se),se&&(a.setMask(g.stencilWriteMask),a.setFunc(g.stencilFunc,g.stencilRef,g.stencilFuncMask),a.setOp(g.stencilFail,g.stencilZFail,g.stencilZPass)),S(g.polygonOffset,g.polygonOffsetFactor,g.polygonOffsetUnits),g.alphaToCoverage===!0?le(i.SAMPLE_ALPHA_TO_COVERAGE):ne(i.SAMPLE_ALPHA_TO_COVERAGE)}function ye(g){E!==g&&(g?i.frontFace(i.CW):i.frontFace(i.CCW),E=g)}function We(g){g!==bc?(le(i.CULL_FACE),g!==M&&(g===ga?i.cullFace(i.BACK):g===Dc?i.cullFace(i.FRONT):i.cullFace(i.FRONT_AND_BACK))):ne(i.CULL_FACE),M=g}function A(g){g!==N&&(V&&i.lineWidth(g),N=g)}function S(g,H,K){g?(le(i.POLYGON_OFFSET_FILL),(I!==H||C!==K)&&(i.polygonOffset(H,K),I=H,C=K)):ne(i.POLYGON_OFFSET_FILL)}function Y(g){g?le(i.SCISSOR_TEST):ne(i.SCISSOR_TEST)}function Z(g){g===void 0&&(g=i.TEXTURE0+z-1),B!==g&&(i.activeTexture(g),B=g)}function te(g,H,K){K===void 0&&(B===null?K=i.TEXTURE0+z-1:K=B);let se=$[K];se===void 0&&(se={type:void 0,texture:void 0},$[K]=se),(se.type!==g||se.texture!==H)&&(B!==K&&(i.activeTexture(K),B=K),i.bindTexture(g,H||J[g]),se.type=g,se.texture=H)}function ie(){const g=$[B];g!==void 0&&g.type!==void 0&&(i.bindTexture(g.type,null),g.type=void 0,g.texture=void 0)}function Te(){try{i.compressedTexImage2D.apply(i,arguments)}catch(g){console.error("THREE.WebGLState:",g)}}function re(){try{i.compressedTexImage3D.apply(i,arguments)}catch(g){console.error("THREE.WebGLState:",g)}}function Ee(){try{i.texSubImage2D.apply(i,arguments)}catch(g){console.error("THREE.WebGLState:",g)}}function Ae(){try{i.texSubImage3D.apply(i,arguments)}catch(g){console.error("THREE.WebGLState:",g)}}function ae(){try{i.compressedTexSubImage2D.apply(i,arguments)}catch(g){console.error("THREE.WebGLState:",g)}}function de(){try{i.compressedTexSubImage3D.apply(i,arguments)}catch(g){console.error("THREE.WebGLState:",g)}}function Re(){try{i.texStorage2D.apply(i,arguments)}catch(g){console.error("THREE.WebGLState:",g)}}function ge(){try{i.texStorage3D.apply(i,arguments)}catch(g){console.error("THREE.WebGLState:",g)}}function _e(){try{i.texImage2D.apply(i,arguments)}catch(g){console.error("THREE.WebGLState:",g)}}function ke(){try{i.texImage3D.apply(i,arguments)}catch(g){console.error("THREE.WebGLState:",g)}}function He(g){Q.equals(g)===!1&&(i.scissor(g.x,g.y,g.z,g.w),Q.copy(g))}function Ye(g){pe.equals(g)===!1&&(i.viewport(g.x,g.y,g.z,g.w),pe.copy(g))}function Xe(g,H){let K=l.get(H);K===void 0&&(K=new WeakMap,l.set(H,K));let se=K.get(g);se===void 0&&(se=i.getUniformBlockIndex(H,g.name),K.set(g,se))}function je(g,H){const se=l.get(H).get(g);o.get(H)!==se&&(i.uniformBlockBinding(H,se,g.__bindingPointIndex),o.set(H,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={},B=null,$={},h={},d=new WeakMap,u=[],p=null,_=!1,v=null,m=null,f=null,b=null,x=null,D=null,P=null,T=new be(0,0,0),w=0,L=!1,E=null,M=null,N=null,I=null,C=null,Q.set(0,0,i.canvas.width,i.canvas.height),pe.set(0,0,i.canvas.width,i.canvas.height),r.reset(),s.reset(),a.reset()}return{buffers:{color:r,depth:s,stencil:a},enable:le,disable:ne,bindFramebuffer:xe,drawBuffers:De,useProgram:Ce,setBlending:ve,setMaterial:Ge,setFlipSided:ye,setCullFace:We,setLineWidth:A,setPolygonOffset:S,setScissorTest:Y,activeTexture:Z,bindTexture:te,unbindTexture:ie,compressedTexImage2D:Te,compressedTexImage3D:re,texImage2D:_e,texImage3D:ke,updateUBOMapping:Xe,uniformBlockBinding:je,texStorage2D:Re,texStorage3D:ge,texSubImage2D:Ee,texSubImage3D:Ae,compressedTexSubImage2D:ae,compressedTexSubImage3D:de,scissor:He,viewport:Ye,reset:Me}}function Vm(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,h=new WeakMap;let d;const u=new WeakMap;let p=!1;try{p=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function _(A,S){return p?new OffscreenCanvas(A,S):Cr("canvas")}function v(A,S,Y){let Z=1;const te=We(A);if((te.width>Y||te.height>Y)&&(Z=Y/Math.max(te.width,te.height)),Z<1)if(typeof HTMLImageElement<"u"&&A instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&A instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&A instanceof ImageBitmap||typeof VideoFrame<"u"&&A instanceof VideoFrame){const ie=Math.floor(Z*te.width),Te=Math.floor(Z*te.height);d===void 0&&(d=_(ie,Te));const re=S?_(ie,Te):d;return re.width=ie,re.height=Te,re.getContext("2d").drawImage(A,0,0,ie,Te),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+te.width+"x"+te.height+") to ("+ie+"x"+Te+")."),re}else return"data"in A&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+te.width+"x"+te.height+")."),A;return A}function m(A){return A.generateMipmaps&&A.minFilter!==Nt&&A.minFilter!==zt}function f(A){i.generateMipmap(A)}function b(A,S,Y,Z,te=!1){if(A!==null){if(i[A]!==void 0)return i[A];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+A+"'")}let ie=S;if(S===i.RED&&(Y===i.FLOAT&&(ie=i.R32F),Y===i.HALF_FLOAT&&(ie=i.R16F),Y===i.UNSIGNED_BYTE&&(ie=i.R8)),S===i.RED_INTEGER&&(Y===i.UNSIGNED_BYTE&&(ie=i.R8UI),Y===i.UNSIGNED_SHORT&&(ie=i.R16UI),Y===i.UNSIGNED_INT&&(ie=i.R32UI),Y===i.BYTE&&(ie=i.R8I),Y===i.SHORT&&(ie=i.R16I),Y===i.INT&&(ie=i.R32I)),S===i.RG&&(Y===i.FLOAT&&(ie=i.RG32F),Y===i.HALF_FLOAT&&(ie=i.RG16F),Y===i.UNSIGNED_BYTE&&(ie=i.RG8)),S===i.RG_INTEGER&&(Y===i.UNSIGNED_BYTE&&(ie=i.RG8UI),Y===i.UNSIGNED_SHORT&&(ie=i.RG16UI),Y===i.UNSIGNED_INT&&(ie=i.RG32UI),Y===i.BYTE&&(ie=i.RG8I),Y===i.SHORT&&(ie=i.RG16I),Y===i.INT&&(ie=i.RG32I)),S===i.RGB&&Y===i.UNSIGNED_INT_5_9_9_9_REV&&(ie=i.RGB9_E5),S===i.RGBA){const Te=te?Dr:$e.getTransfer(Z);Y===i.FLOAT&&(ie=i.RGBA32F),Y===i.HALF_FLOAT&&(ie=i.RGBA16F),Y===i.UNSIGNED_BYTE&&(ie=Te===Ke?i.SRGB8_ALPHA8:i.RGBA8),Y===i.UNSIGNED_SHORT_4_4_4_4&&(ie=i.RGBA4),Y===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 x(A,S){return m(A)===!0||A.isFramebufferTexture&&A.minFilter!==Nt&&A.minFilter!==zt?Math.log2(Math.max(S.width,S.height))+1:A.mipmaps!==void 0&&A.mipmaps.length>0?A.mipmaps.length:A.isCompressedTexture&&Array.isArray(A.image)?S.mipmaps.length:1}function D(A){const S=A.target;S.removeEventListener("dispose",D),T(S),S.isVideoTexture&&h.delete(S)}function P(A){const S=A.target;S.removeEventListener("dispose",P),L(S)}function T(A){const S=n.get(A);if(S.__webglInit===void 0)return;const Y=A.source,Z=u.get(Y);if(Z){const te=Z[S.__cacheKey];te.usedTimes--,te.usedTimes===0&&w(A),Object.keys(Z).length===0&&u.delete(Y)}n.remove(A)}function w(A){const S=n.get(A);i.deleteTexture(S.__webglTexture);const Y=A.source,Z=u.get(Y);delete Z[S.__cacheKey],a.memory.textures--}function L(A){const S=n.get(A);if(A.depthTexture&&A.depthTexture.dispose(),A.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 Y=A.textures;for(let Z=0,te=Y.length;Z<te;Z++){const ie=n.get(Y[Z]);ie.__webglTexture&&(i.deleteTexture(ie.__webglTexture),a.memory.textures--),n.remove(Y[Z])}n.remove(A)}let E=0;function M(){E=0}function N(){const A=E;return A>=r.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+A+" texture units while this GPU supports only "+r.maxTextures),E+=1,A}function I(A){const S=[];return S.push(A.wrapS),S.push(A.wrapT),S.push(A.wrapR||0),S.push(A.magFilter),S.push(A.minFilter),S.push(A.anisotropy),S.push(A.internalFormat),S.push(A.format),S.push(A.type),S.push(A.generateMipmaps),S.push(A.premultiplyAlpha),S.push(A.flipY),S.push(A.unpackAlignment),S.push(A.colorSpace),S.join()}function C(A,S){const Y=n.get(A);if(A.isVideoTexture&&Ge(A),A.isRenderTargetTexture===!1&&A.version>0&&Y.__version!==A.version){const Z=A.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{Q(Y,A,S);return}}t.bindTexture(i.TEXTURE_2D,Y.__webglTexture,i.TEXTURE0+S)}function z(A,S){const Y=n.get(A);if(A.version>0&&Y.__version!==A.version){Q(Y,A,S);return}t.bindTexture(i.TEXTURE_2D_ARRAY,Y.__webglTexture,i.TEXTURE0+S)}function V(A,S){const Y=n.get(A);if(A.version>0&&Y.__version!==A.version){Q(Y,A,S);return}t.bindTexture(i.TEXTURE_3D,Y.__webglTexture,i.TEXTURE0+S)}function q(A,S){const Y=n.get(A);if(A.version>0&&Y.__version!==A.version){pe(Y,A,S);return}t.bindTexture(i.TEXTURE_CUBE_MAP,Y.__webglTexture,i.TEXTURE0+S)}const ee={[Ns]:i.REPEAT,[Ln]:i.CLAMP_TO_EDGE,[Is]:i.MIRRORED_REPEAT},B={[Nt]:i.NEAREST,[au]:i.NEAREST_MIPMAP_NEAREST,[Wi]:i.NEAREST_MIPMAP_LINEAR,[zt]:i.LINEAR,[Gr]:i.LINEAR_MIPMAP_NEAREST,[Fn]:i.LINEAR_MIPMAP_LINEAR},$={[Su]:i.NEVER,[Au]:i.ALWAYS,[Eu]:i.LESS,[dl]:i.LEQUAL,[yu]:i.EQUAL,[Tu]:i.GEQUAL,[bu]:i.GREATER,[Du]:i.NOTEQUAL};function j(A,S){if(S.type===pn&&e.has("OES_texture_float_linear")===!1&&(S.magFilter===zt||S.magFilter===Gr||S.magFilter===Wi||S.magFilter===Fn||S.minFilter===zt||S.minFilter===Gr||S.minFilter===Wi||S.minFilter===Fn)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),i.texParameteri(A,i.TEXTURE_WRAP_S,ee[S.wrapS]),i.texParameteri(A,i.TEXTURE_WRAP_T,ee[S.wrapT]),(A===i.TEXTURE_3D||A===i.TEXTURE_2D_ARRAY)&&i.texParameteri(A,i.TEXTURE_WRAP_R,ee[S.wrapR]),i.texParameteri(A,i.TEXTURE_MAG_FILTER,B[S.magFilter]),i.texParameteri(A,i.TEXTURE_MIN_FILTER,B[S.minFilter]),S.compareFunction&&(i.texParameteri(A,i.TEXTURE_COMPARE_MODE,i.COMPARE_REF_TO_TEXTURE),i.texParameteri(A,i.TEXTURE_COMPARE_FUNC,$[S.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(S.magFilter===Nt||S.minFilter!==Wi&&S.minFilter!==Fn||S.type===pn&&e.has("OES_texture_float_linear")===!1)return;if(S.anisotropy>1||n.get(S).__currentAnisotropy){const Y=e.get("EXT_texture_filter_anisotropic");i.texParameterf(A,Y.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(S.anisotropy,r.getMaxAnisotropy())),n.get(S).__currentAnisotropy=S.anisotropy}}}function F(A,S){let Y=!1;A.__webglInit===void 0&&(A.__webglInit=!0,S.addEventListener("dispose",D));const Z=S.source;let te=u.get(Z);te===void 0&&(te={},u.set(Z,te));const ie=I(S);if(ie!==A.__cacheKey){te[ie]===void 0&&(te[ie]={texture:i.createTexture(),usedTimes:0},a.memory.textures++,Y=!0),te[ie].usedTimes++;const Te=te[A.__cacheKey];Te!==void 0&&(te[A.__cacheKey].usedTimes--,Te.usedTimes===0&&w(S)),A.__cacheKey=ie,A.__webglTexture=te[ie].texture}return Y}function Q(A,S,Y){let Z=i.TEXTURE_2D;(S.isDataArrayTexture||S.isCompressedArrayTexture)&&(Z=i.TEXTURE_2D_ARRAY),S.isData3DTexture&&(Z=i.TEXTURE_3D);const te=F(A,S),ie=S.source;t.bindTexture(Z,A.__webglTexture,i.TEXTURE0+Y);const Te=n.get(ie);if(ie.version!==Te.__version||te===!0){t.activeTexture(i.TEXTURE0+Y);const re=$e.getPrimaries($e.workingColorSpace),Ee=S.colorSpace===fn?null:$e.getPrimaries(S.colorSpace),Ae=S.colorSpace===fn||re===Ee?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=v(S.image,!1,r.maxTextureSize);ae=ye(S,ae);const de=s.convert(S.format,S.colorSpace),Re=s.convert(S.type);let ge=b(S.internalFormat,de,Re,S.colorSpace,S.isVideoTexture);j(Z,S);let _e;const ke=S.mipmaps,He=S.isVideoTexture!==!0&&ge!==hl,Ye=Te.__version===void 0||te===!0,Xe=ie.dataReady,je=x(S,ae);if(S.isDepthTexture)ge=i.DEPTH_COMPONENT16,S.type===pn?ge=i.DEPTH_COMPONENT32F:S.type===mi?ge=i.DEPTH_COMPONENT24:S.type===Ii&&(ge=i.DEPTH24_STENCIL8),Ye&&(He?t.texStorage2D(i.TEXTURE_2D,1,ge,ae.width,ae.height):t.texImage2D(i.TEXTURE_2D,0,ge,ae.width,ae.height,0,de,Re,null));else if(S.isDataTexture)if(ke.length>0){He&&Ye&&t.texStorage2D(i.TEXTURE_2D,je,ge,ke[0].width,ke[0].height);for(let Me=0,g=ke.length;Me<g;Me++)_e=ke[Me],He?Xe&&t.texSubImage2D(i.TEXTURE_2D,Me,0,0,_e.width,_e.height,de,Re,_e.data):t.texImage2D(i.TEXTURE_2D,Me,ge,_e.width,_e.height,0,de,Re,_e.data);S.generateMipmaps=!1}else He?(Ye&&t.texStorage2D(i.TEXTURE_2D,je,ge,ae.width,ae.height),Xe&&t.texSubImage2D(i.TEXTURE_2D,0,0,0,ae.width,ae.height,de,Re,ae.data)):t.texImage2D(i.TEXTURE_2D,0,ge,ae.width,ae.height,0,de,Re,ae.data);else if(S.isCompressedTexture)if(S.isCompressedArrayTexture){He&&Ye&&t.texStorage3D(i.TEXTURE_2D_ARRAY,je,ge,ke[0].width,ke[0].height,ae.depth);for(let Me=0,g=ke.length;Me<g;Me++)_e=ke[Me],S.format!==Xt?de!==null?He?Xe&&t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,Me,0,0,0,_e.width,_e.height,ae.depth,de,_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,de,Re,_e.data):t.texImage3D(i.TEXTURE_2D_ARRAY,Me,ge,_e.width,_e.height,ae.depth,0,de,Re,_e.data)}else{He&&Ye&&t.texStorage2D(i.TEXTURE_2D,je,ge,ke[0].width,ke[0].height);for(let Me=0,g=ke.length;Me<g;Me++)_e=ke[Me],S.format!==Xt?de!==null?He?Xe&&t.compressedTexSubImage2D(i.TEXTURE_2D,Me,0,0,_e.width,_e.height,de,_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,de,Re,_e.data):t.texImage2D(i.TEXTURE_2D,Me,ge,_e.width,_e.height,0,de,Re,_e.data)}else if(S.isDataArrayTexture)He?(Ye&&t.texStorage3D(i.TEXTURE_2D_ARRAY,je,ge,ae.width,ae.height,ae.depth),Xe&&t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,0,ae.width,ae.height,ae.depth,de,Re,ae.data)):t.texImage3D(i.TEXTURE_2D_ARRAY,0,ge,ae.width,ae.height,ae.depth,0,de,Re,ae.data);else if(S.isData3DTexture)He?(Ye&&t.texStorage3D(i.TEXTURE_3D,je,ge,ae.width,ae.height,ae.depth),Xe&&t.texSubImage3D(i.TEXTURE_3D,0,0,0,0,ae.width,ae.height,ae.depth,de,Re,ae.data)):t.texImage3D(i.TEXTURE_3D,0,ge,ae.width,ae.height,ae.depth,0,de,Re,ae.data);else if(S.isFramebufferTexture){if(Ye)if(He)t.texStorage2D(i.TEXTURE_2D,je,ge,ae.width,ae.height);else{let Me=ae.width,g=ae.height;for(let H=0;H<je;H++)t.texImage2D(i.TEXTURE_2D,H,ge,Me,g,0,de,Re,null),Me>>=1,g>>=1}}else if(ke.length>0){if(He&&Ye){const Me=We(ke[0]);t.texStorage2D(i.TEXTURE_2D,je,ge,Me.width,Me.height)}for(let Me=0,g=ke.length;Me<g;Me++)_e=ke[Me],He?Xe&&t.texSubImage2D(i.TEXTURE_2D,Me,0,0,de,Re,_e):t.texImage2D(i.TEXTURE_2D,Me,ge,de,Re,_e);S.generateMipmaps=!1}else if(He){if(Ye){const Me=We(ae);t.texStorage2D(i.TEXTURE_2D,je,ge,Me.width,Me.height)}Xe&&t.texSubImage2D(i.TEXTURE_2D,0,0,0,de,Re,ae)}else t.texImage2D(i.TEXTURE_2D,0,ge,de,Re,ae);m(S)&&f(Z),Te.__version=ie.version,S.onUpdate&&S.onUpdate(S)}A.__version=S.version}function pe(A,S,Y){if(S.image.length!==6)return;const Z=F(A,S),te=S.source;t.bindTexture(i.TEXTURE_CUBE_MAP,A.__webglTexture,i.TEXTURE0+Y);const ie=n.get(te);if(te.version!==ie.__version||Z===!0){t.activeTexture(i.TEXTURE0+Y);const Te=$e.getPrimaries($e.workingColorSpace),re=S.colorSpace===fn?null:$e.getPrimaries(S.colorSpace),Ee=S.colorSpace===fn||Te===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,Ee);const Ae=S.isCompressedTexture||S.image[0].isCompressedTexture,ae=S.image[0]&&S.image[0].isDataTexture,de=[];for(let g=0;g<6;g++)!Ae&&!ae?de[g]=v(S.image[g],!0,r.maxCubemapSize):de[g]=ae?S.image[g].image:S.image[g],de[g]=ye(S,de[g]);const Re=de[0],ge=s.convert(S.format,S.colorSpace),_e=s.convert(S.type),ke=b(S.internalFormat,ge,_e,S.colorSpace),He=S.isVideoTexture!==!0,Ye=ie.__version===void 0||Z===!0,Xe=te.dataReady;let je=x(S,Re);j(i.TEXTURE_CUBE_MAP,S);let Me;if(Ae){He&&Ye&&t.texStorage2D(i.TEXTURE_CUBE_MAP,je,ke,Re.width,Re.height);for(let g=0;g<6;g++){Me=de[g].mipmaps;for(let H=0;H<Me.length;H++){const K=Me[H];S.format!==Xt?ge!==null?He?Xe&&t.compressedTexSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+g,H,0,0,K.width,K.height,ge,K.data):t.compressedTexImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+g,H,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+g,H,0,0,K.width,K.height,ge,_e,K.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+g,H,ke,K.width,K.height,0,ge,_e,K.data)}}}else{if(Me=S.mipmaps,He&&Ye){Me.length>0&&je++;const g=We(de[0]);t.texStorage2D(i.TEXTURE_CUBE_MAP,je,ke,g.width,g.height)}for(let g=0;g<6;g++)if(ae){He?Xe&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+g,0,0,0,de[g].width,de[g].height,ge,_e,de[g].data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+g,0,ke,de[g].width,de[g].height,0,ge,_e,de[g].data);for(let H=0;H<Me.length;H++){const se=Me[H].image[g].image;He?Xe&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+g,H+1,0,0,se.width,se.height,ge,_e,se.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+g,H+1,ke,se.width,se.height,0,ge,_e,se.data)}}else{He?Xe&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+g,0,0,0,ge,_e,de[g]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+g,0,ke,ge,_e,de[g]);for(let H=0;H<Me.length;H++){const K=Me[H];He?Xe&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+g,H+1,0,0,ge,_e,K.image[g]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+g,H+1,ke,ge,_e,K.image[g])}}}m(S)&&f(i.TEXTURE_CUBE_MAP),ie.__version=te.version,S.onUpdate&&S.onUpdate(S)}A.__version=S.version}function U(A,S,Y,Z,te,ie){const Te=s.convert(Y.format,Y.colorSpace),re=s.convert(Y.type),Ee=b(Y.internalFormat,Te,re,Y.colorSpace);if(!n.get(S).__hasExternalTextures){const ae=Math.max(1,S.width>>ie),de=Math.max(1,S.height>>ie);te===i.TEXTURE_3D||te===i.TEXTURE_2D_ARRAY?t.texImage3D(te,ie,Ee,ae,de,S.depth,0,Te,re,null):t.texImage2D(te,ie,Ee,ae,de,0,Te,re,null)}t.bindFramebuffer(i.FRAMEBUFFER,A),ve(S)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,Z,te,n.get(Y).__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(Y).__webglTexture,ie),t.bindFramebuffer(i.FRAMEBUFFER,null)}function J(A,S,Y){if(i.bindRenderbuffer(i.RENDERBUFFER,A),S.depthBuffer&&!S.stencilBuffer){let Z=i.DEPTH_COMPONENT24;if(Y||ve(S)){const te=S.depthTexture;te&&te.isDepthTexture&&(te.type===pn?Z=i.DEPTH_COMPONENT32F:te.type===mi&&(Z=i.DEPTH_COMPONENT24));const ie=Fe(S);ve(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,A)}else if(S.depthBuffer&&S.stencilBuffer){const Z=Fe(S);Y&&ve(S)===!1?i.renderbufferStorageMultisample(i.RENDERBUFFER,Z,i.DEPTH24_STENCIL8,S.width,S.height):ve(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,A)}else{const Z=S.textures;for(let te=0;te<Z.length;te++){const ie=Z[te],Te=s.convert(ie.format,ie.colorSpace),re=s.convert(ie.type),Ee=b(ie.internalFormat,Te,re,ie.colorSpace),Ae=Fe(S);Y&&ve(S)===!1?i.renderbufferStorageMultisample(i.RENDERBUFFER,Ae,Ee,S.width,S.height):ve(S)?o.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,Ae,Ee,S.width,S.height):i.renderbufferStorage(i.RENDERBUFFER,Ee,S.width,S.height)}}i.bindRenderbuffer(i.RENDERBUFFER,null)}function le(A,S){if(S&&S.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(i.FRAMEBUFFER,A),!(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===ui)ve(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===Fi)ve(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(A){const S=n.get(A),Y=A.isWebGLCubeRenderTarget===!0;if(A.depthTexture&&!S.__autoAllocateDepthBuffer){if(Y)throw new Error("target.depthTexture not supported in Cube render targets");le(S.__webglFramebuffer,A)}else if(Y){S.__webglDepthbuffer=[];for(let Z=0;Z<6;Z++)t.bindFramebuffer(i.FRAMEBUFFER,S.__webglFramebuffer[Z]),S.__webglDepthbuffer[Z]=i.createRenderbuffer(),J(S.__webglDepthbuffer[Z],A,!1)}else t.bindFramebuffer(i.FRAMEBUFFER,S.__webglFramebuffer),S.__webglDepthbuffer=i.createRenderbuffer(),J(S.__webglDepthbuffer,A,!1);t.bindFramebuffer(i.FRAMEBUFFER,null)}function xe(A,S,Y){const Z=n.get(A);S!==void 0&&U(Z.__webglFramebuffer,A,A.texture,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,0),Y!==void 0&&ne(A)}function De(A){const S=A.texture,Y=n.get(A),Z=n.get(S);A.addEventListener("dispose",P);const te=A.textures,ie=A.isWebGLCubeRenderTarget===!0,Te=te.length>1;if(Te||(Z.__webglTexture===void 0&&(Z.__webglTexture=i.createTexture()),Z.__version=S.version,a.memory.textures++),ie){Y.__webglFramebuffer=[];for(let re=0;re<6;re++)if(S.mipmaps&&S.mipmaps.length>0){Y.__webglFramebuffer[re]=[];for(let Ee=0;Ee<S.mipmaps.length;Ee++)Y.__webglFramebuffer[re][Ee]=i.createFramebuffer()}else Y.__webglFramebuffer[re]=i.createFramebuffer()}else{if(S.mipmaps&&S.mipmaps.length>0){Y.__webglFramebuffer=[];for(let re=0;re<S.mipmaps.length;re++)Y.__webglFramebuffer[re]=i.createFramebuffer()}else Y.__webglFramebuffer=i.createFramebuffer();if(Te)for(let re=0,Ee=te.length;re<Ee;re++){const Ae=n.get(te[re]);Ae.__webglTexture===void 0&&(Ae.__webglTexture=i.createTexture(),a.memory.textures++)}if(A.samples>0&&ve(A)===!1){Y.__webglMultisampledFramebuffer=i.createFramebuffer(),Y.__webglColorRenderbuffer=[],t.bindFramebuffer(i.FRAMEBUFFER,Y.__webglMultisampledFramebuffer);for(let re=0;re<te.length;re++){const Ee=te[re];Y.__webglColorRenderbuffer[re]=i.createRenderbuffer(),i.bindRenderbuffer(i.RENDERBUFFER,Y.__webglColorRenderbuffer[re]);const Ae=s.convert(Ee.format,Ee.colorSpace),ae=s.convert(Ee.type),de=b(Ee.internalFormat,Ae,ae,Ee.colorSpace,A.isXRRenderTarget===!0),Re=Fe(A);i.renderbufferStorageMultisample(i.RENDERBUFFER,Re,de,A.width,A.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+re,i.RENDERBUFFER,Y.__webglColorRenderbuffer[re])}i.bindRenderbuffer(i.RENDERBUFFER,null),A.depthBuffer&&(Y.__webglDepthRenderbuffer=i.createRenderbuffer(),J(Y.__webglDepthRenderbuffer,A,!0)),t.bindFramebuffer(i.FRAMEBUFFER,null)}}if(ie){t.bindTexture(i.TEXTURE_CUBE_MAP,Z.__webglTexture),j(i.TEXTURE_CUBE_MAP,S);for(let re=0;re<6;re++)if(S.mipmaps&&S.mipmaps.length>0)for(let Ee=0;Ee<S.mipmaps.length;Ee++)U(Y.__webglFramebuffer[re][Ee],A,S,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+re,Ee);else U(Y.__webglFramebuffer[re],A,S,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+re,0);m(S)&&f(i.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(Te){for(let re=0,Ee=te.length;re<Ee;re++){const Ae=te[re],ae=n.get(Ae);t.bindTexture(i.TEXTURE_2D,ae.__webglTexture),j(i.TEXTURE_2D,Ae),U(Y.__webglFramebuffer,A,Ae,i.COLOR_ATTACHMENT0+re,i.TEXTURE_2D,0),m(Ae)&&f(i.TEXTURE_2D)}t.unbindTexture()}else{let re=i.TEXTURE_2D;if((A.isWebGL3DRenderTarget||A.isWebGLArrayRenderTarget)&&(re=A.isWebGL3DRenderTarget?i.TEXTURE_3D:i.TEXTURE_2D_ARRAY),t.bindTexture(re,Z.__webglTexture),j(re,S),S.mipmaps&&S.mipmaps.length>0)for(let Ee=0;Ee<S.mipmaps.length;Ee++)U(Y.__webglFramebuffer[Ee],A,S,i.COLOR_ATTACHMENT0,re,Ee);else U(Y.__webglFramebuffer,A,S,i.COLOR_ATTACHMENT0,re,0);m(S)&&f(re),t.unbindTexture()}A.depthBuffer&&ne(A)}function Ce(A){const S=A.textures;for(let Y=0,Z=S.length;Y<Z;Y++){const te=S[Y];if(m(te)){const ie=A.isWebGLCubeRenderTarget?i.TEXTURE_CUBE_MAP:i.TEXTURE_2D,Te=n.get(te).__webglTexture;t.bindTexture(ie,Te),f(ie),t.unbindTexture()}}}function k(A){if(A.samples>0&&ve(A)===!1){const S=A.textures,Y=A.width,Z=A.height;let te=i.COLOR_BUFFER_BIT;const ie=[],Te=A.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,re=n.get(A),Ee=S.length>1;if(Ee)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),A.depthBuffer&&ie.push(Te);const ae=re.__ignoreDepthValues!==void 0?re.__ignoreDepthValues:!1;if(ae===!1&&(A.depthBuffer&&(te|=i.DEPTH_BUFFER_BIT),A.stencilBuffer&&re.__isTransmissionRenderTarget!==!0&&(te|=i.STENCIL_BUFFER_BIT)),Ee&&i.framebufferRenderbuffer(i.READ_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.RENDERBUFFER,re.__webglColorRenderbuffer[Ae]),ae===!0&&(i.invalidateFramebuffer(i.READ_FRAMEBUFFER,[Te]),i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,[Te])),Ee){const de=n.get(S[Ae]).__webglTexture;i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,de,0)}i.blitFramebuffer(0,0,Y,Z,0,0,Y,Z,te,i.NEAREST),l&&i.invalidateFramebuffer(i.READ_FRAMEBUFFER,ie)}if(t.bindFramebuffer(i.READ_FRAMEBUFFER,null),t.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),Ee)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(A){return Math.min(r.maxSamples,A.samples)}function ve(A){const S=n.get(A);return A.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&S.__useRenderToTexture!==!1}function Ge(A){const S=a.render.frame;h.get(A)!==S&&(h.set(A,S),A.update())}function ye(A,S){const Y=A.colorSpace,Z=A.format,te=A.type;return A.isCompressedTexture===!0||A.isVideoTexture===!0||Y!==xn&&Y!==fn&&($e.getTransfer(Y)===Ke?(Z!==Xt||te!==gn)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",Y)),S}function We(A){return typeof HTMLImageElement<"u"&&A instanceof HTMLImageElement?(c.width=A.naturalWidth||A.width,c.height=A.naturalHeight||A.height):typeof VideoFrame<"u"&&A instanceof VideoFrame?(c.width=A.displayWidth,c.height=A.displayHeight):(c.width=A.width,c.height=A.height),c}this.allocateTextureUnit=N,this.resetTextureUnits=M,this.setTexture2D=C,this.setTexture2DArray=z,this.setTexture3D=V,this.setTextureCube=q,this.rebindTextures=xe,this.setupRenderTarget=De,this.updateRenderTargetMipmap=Ce,this.updateMultisampleRenderTarget=k,this.setupDepthRenderbuffer=ne,this.setupFrameBufferTexture=U,this.useMultisampledRTT=ve}function Gm(i,e){function t(n,r=fn){let s;const a=$e.getTransfer(r);if(n===gn)return i.UNSIGNED_BYTE;if(n===al)return i.UNSIGNED_SHORT_4_4_4_4;if(n===ol)return i.UNSIGNED_SHORT_5_5_5_1;if(n===cu)return i.UNSIGNED_INT_5_9_9_9_REV;if(n===ou)return i.BYTE;if(n===lu)return i.SHORT;if(n===rl)return i.UNSIGNED_SHORT;if(n===sl)return i.INT;if(n===mi)return i.UNSIGNED_INT;if(n===pn)return i.FLOAT;if(n===_n)return i.HALF_FLOAT;if(n===uu)return i.ALPHA;if(n===hu)return i.RGB;if(n===Xt)return i.RGBA;if(n===du)return i.LUMINANCE;if(n===fu)return i.LUMINANCE_ALPHA;if(n===ui)return i.DEPTH_COMPONENT;if(n===Fi)return i.DEPTH_STENCIL;if(n===pu)return i.RED;if(n===ll)return i.RED_INTEGER;if(n===mu)return i.RG;if(n===cl)return i.RG_INTEGER;if(n===ul)return i.RGBA_INTEGER;if(n===Wr||n===Xr||n===Yr||n===jr)if(a===Ke)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(n===Wr)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Xr)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===Yr)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===Wr)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Xr)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===Yr)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===jr)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===xa||n===Ma||n===Sa||n===Ea)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(n===xa)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===Ma)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===Sa)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===Ea)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===ya||n===ba)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(n===ya)return a===Ke?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(n===ba)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(n===Da||n===Ta||n===Aa||n===wa||n===Ca||n===Ra||n===Pa||n===La||n===Fa||n===Ua||n===Na||n===Ia||n===Oa||n===Ba)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(n===Da)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===Ta)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===Aa)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===wa)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===Ca)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===Ra)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===Pa)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===La)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===Fa)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===Ua)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===Na)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===Ia)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===Oa)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===Ba)return a===Ke?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===qr||n===za||n===ka)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===za)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===ka)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===gu||n===Ha||n===Va||n===Ga)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(n===qr)return s.COMPRESSED_RED_RGTC1_EXT;if(n===Ha)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===Va)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===Ga)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===Ii?i.UNSIGNED_INT_24_8:i[n]!==void 0?i[n]:null}return{convert:t}}class Wm extends Rt{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class dr extends St{constructor(){super(),this.isGroup=!0,this.type="Group"}}const Xm={type:"move"};class xs{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new dr,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 dr,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new R,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new R),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new dr,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new R,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new R),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 v of e.hand.values()){const m=t.getJointPose(v,n),f=this._getHandJoint(c,v);m!==null&&(f.matrix.fromArray(m.transform.matrix),f.matrix.decompose(f.position,f.rotation,f.scale),f.matrixWorldNeedsUpdate=!0,f.jointRadius=m.radius),f.visible=m!==null}const h=c.joints["index-finger-tip"],d=c.joints["thumb-tip"],u=h.position.distanceTo(d.position),p=.02,_=.005;c.inputState.pinching&&u>p+_?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&u<=p-_&&(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(Xm)))}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 dr;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}const Ym=`
|
|
3777
3777
|
void main() {
|
|
3778
3778
|
|
|
3779
3779
|
gl_Position = vec4( position, 1.0 );
|
|
3780
3780
|
|
|
3781
|
-
}`,
|
|
3781
|
+
}`,jm=`
|
|
3782
3782
|
uniform sampler2DArray depthColor;
|
|
3783
3783
|
uniform float depthWidth;
|
|
3784
3784
|
uniform float depthHeight;
|
|
@@ -3797,7 +3797,7 @@ void main() {
|
|
|
3797
3797
|
|
|
3798
3798
|
}
|
|
3799
3799
|
|
|
3800
|
-
}`;class i0{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,n){if(this.texture===null){const r=new Dt,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:t0,fragmentShader:n0,uniforms:{depthColor:{value:this.texture},depthWidth:{value:n.z},depthHeight:{value:n.w}}});this.mesh=new bt(new Or(20,20),r)}e.render(this.mesh,t)}}reset(){this.texture=null,this.mesh=null}}class r0 extends zn{constructor(e,t){super();const n=this;let r=null,s=1,a=null,o="local-floor",l=1,c=null,d=null,u=null,h=null,p=null,_=null;const x=new i0,m=t.getContextAttributes();let f=null,b=null;const v=[],D=[],P=new he;let T=null;const w=new Lt;w.layers.enable(1),w.viewport=new dt;const L=new Lt;L.layers.enable(2),L.viewport=new dt;const S=[w,L],y=new Qm;y.layers.enable(1),y.layers.enable(2);let U=null,I=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(N){let Q=v[N];return Q===void 0&&(Q=new Ms,v[N]=Q),Q.getTargetRaySpace()},this.getControllerGrip=function(N){let Q=v[N];return Q===void 0&&(Q=new Ms,v[N]=Q),Q.getGripSpace()},this.getHand=function(N){let Q=v[N];return Q===void 0&&(Q=new Ms,v[N]=Q),Q.getHandSpace()};function C(N){const Q=D.indexOf(N.inputSource);if(Q===-1)return;const ue=v[Q];ue!==void 0&&(ue.update(N.inputSource,N.frame,c||a),ue.dispatchEvent({type:N.type,data:N.inputSource}))}function k(){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",k),r.removeEventListener("inputsourceschange",G);for(let N=0;N<v.length;N++){const Q=D[N];Q!==null&&(D[N]=null,v[N].disconnect(Q))}U=null,I=null,x.reset(),e.setRenderTarget(f),p=null,h=null,u=null,r=null,b=null,me.stop(),n.isPresenting=!1,e.setPixelRatio(T),e.setSize(P.width,P.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(N){s=N,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(N){o=N,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||a},this.setReferenceSpace=function(N){c=N},this.getBaseLayer=function(){return h!==null?h:p},this.getBinding=function(){return u},this.getFrame=function(){return _},this.getSession=function(){return r},this.setSession=async function(N){if(r=N,r!==null){if(f=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",k),r.addEventListener("inputsourceschange",G),m.xrCompatible!==!0&&await t.makeXRCompatible(),T=e.getPixelRatio(),e.getSize(P),r.renderState.layers===void 0){const Q={antialias:m.antialias,alpha:!0,depth:m.depth,stencil:m.stencil,framebufferScaleFactor:s};p=new XRWebGLLayer(r,t,Q),r.updateRenderState({baseLayer:p}),e.setPixelRatio(1),e.setSize(p.framebufferWidth,p.framebufferHeight,!1),b=new Gt(p.framebufferWidth,p.framebufferHeight,{format:Yt,type:xn,colorSpace:e.outputColorSpace,stencilBuffer:m.stencil})}else{let Q=null,ue=null,ie=null;m.depth&&(ie=m.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,Q=m.stencil?Ui:di,ue=m.stencil?zi:_i);const ve={colorFormat:t.RGBA8,depthFormat:ie,scaleFactor:s};u=new XRWebGLBinding(r,t),h=u.createProjectionLayer(ve),r.updateRenderState({layers:[h]}),e.setPixelRatio(1),e.setSize(h.textureWidth,h.textureHeight,!1),b=new Gt(h.textureWidth,h.textureHeight,{format:Yt,type:xn,depthTexture:new Cl(h.textureWidth,h.textureHeight,ue,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 De=e.properties.get(b);De.__ignoreDepthValues=h.ignoreDepthValues}b.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 G(N){for(let Q=0;Q<N.removed.length;Q++){const ue=N.removed[Q],ie=D.indexOf(ue);ie>=0&&(D[ie]=null,v[ie].disconnect(ue))}for(let Q=0;Q<N.added.length;Q++){const ue=N.added[Q];let ie=D.indexOf(ue);if(ie===-1){for(let De=0;De<v.length;De++)if(De>=D.length){D.push(ue),ie=De;break}else if(D[De]===null){D[De]=ue,ie=De;break}if(ie===-1)break}const ve=v[ie];ve&&ve.connect(ue)}}const $=new R,te=new R;function B(N,Q,ue){$.setFromMatrixPosition(Q.matrixWorld),te.setFromMatrixPosition(ue.matrixWorld);const ie=$.distanceTo(te),ve=Q.projectionMatrix.elements,De=ue.projectionMatrix.elements,Ce=ve[14]/(ve[10]-1),H=ve[14]/(ve[10]+1),Fe=(ve[9]+1)/ve[5],xe=(ve[9]-1)/ve[5],Ge=(ve[8]-1)/ve[0],Ee=(De[8]+1)/De[0],We=Ce*Ge,A=Ce*Ee,M=ie/(-Ge+Ee),Y=M*-Ge;Q.matrixWorld.decompose(N.position,N.quaternion,N.scale),N.translateX(Y),N.translateZ(M),N.matrixWorld.compose(N.position,N.quaternion,N.scale),N.matrixWorldInverse.copy(N.matrixWorld).invert();const J=Ce+M,ne=H+M,re=We-Y,Te=A+(ie-Y),ae=Fe*H/ne*J,Se=xe*H/ne*J;N.projectionMatrix.makePerspective(re,Te,ae,Se,J,ne),N.projectionMatrixInverse.copy(N.projectionMatrix).invert()}function K(N,Q){Q===null?N.matrixWorld.copy(N.matrix):N.matrixWorld.multiplyMatrices(Q.matrixWorld,N.matrix),N.matrixWorldInverse.copy(N.matrixWorld).invert()}this.updateCamera=function(N){if(r===null)return;x.texture!==null&&(N.near=x.depthNear,N.far=x.depthFar),y.near=L.near=w.near=N.near,y.far=L.far=w.far=N.far,(U!==y.near||I!==y.far)&&(r.updateRenderState({depthNear:y.near,depthFar:y.far}),U=y.near,I=y.far,w.near=U,w.far=I,L.near=U,L.far=I,w.updateProjectionMatrix(),L.updateProjectionMatrix(),N.updateProjectionMatrix());const Q=N.parent,ue=y.cameras;K(y,Q);for(let ie=0;ie<ue.length;ie++)K(ue[ie],Q);ue.length===2?B(y,w,L):y.projectionMatrix.copy(w.projectionMatrix),q(N,y,Q)};function q(N,Q,ue){ue===null?N.matrix.copy(Q.matrixWorld):(N.matrix.copy(ue.matrixWorld),N.matrix.invert(),N.matrix.multiply(Q.matrixWorld)),N.matrix.decompose(N.position,N.quaternion,N.scale),N.updateMatrixWorld(!0),N.projectionMatrix.copy(Q.projectionMatrix),N.projectionMatrixInverse.copy(Q.projectionMatrixInverse),N.isPerspectiveCamera&&(N.fov=Ii*2*Math.atan(1/N.projectionMatrix.elements[5]),N.zoom=1)}this.getCamera=function(){return y},this.getFoveation=function(){if(!(h===null&&p===null))return l},this.setFoveation=function(N){l=N,h!==null&&(h.fixedFoveation=N),p!==null&&p.fixedFoveation!==void 0&&(p.fixedFoveation=N)},this.hasDepthSensing=function(){return x.texture!==null};let F=null;function ee(N,Q){if(d=Q.getViewerPose(c||a),_=Q,d!==null){const ue=d.views;p!==null&&(e.setRenderTargetFramebuffer(b,p.framebuffer),e.setRenderTarget(b));let ie=!1;ue.length!==y.cameras.length&&(y.cameras.length=0,ie=!0);for(let De=0;De<ue.length;De++){const Ce=ue[De];let H=null;if(p!==null)H=p.getViewport(Ce);else{const xe=u.getViewSubImage(h,Ce);H=xe.viewport,De===0&&(e.setRenderTargetTextures(b,xe.colorTexture,h.ignoreDepthValues?void 0:xe.depthStencilTexture),e.setRenderTarget(b))}let Fe=S[De];Fe===void 0&&(Fe=new Lt,Fe.layers.enable(De),Fe.viewport=new dt,S[De]=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(H.x,H.y,H.width,H.height),De===0&&(y.matrix.copy(Fe.matrix),y.matrix.decompose(y.position,y.quaternion,y.scale)),ie===!0&&y.cameras.push(Fe)}const ve=r.enabledFeatures;if(ve&&ve.includes("depth-sensing")){const De=u.getDepthInformation(ue[0]);De&&De.isValid&&De.texture&&x.init(e,De,r.renderState)}}for(let ue=0;ue<v.length;ue++){const ie=D[ue],ve=v[ue];ie!==null&&ve!==void 0&&ve.update(ie,Q,c||a)}x.render(e,y),F&&F(N,Q),Q.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:Q}),_=null}const me=new Al;me.setAnimationLoop(ee),this.setAnimationLoop=function(N){F=N},this.dispose=function(){}}}const Cn=new rn,s0=new et;function a0(i,e){function t(m,f){m.matrixAutoUpdate===!0&&m.updateMatrix(),f.value.copy(m.matrix)}function n(m,f){f.color.getRGB(m.fogColor.value,El(i)),f.isFog?(m.fogNear.value=f.near,m.fogFar.value=f.far):f.isFogExp2&&(m.fogDensity.value=f.density)}function r(m,f,b,v,D){f.isMeshBasicMaterial||f.isMeshLambertMaterial?s(m,f):f.isMeshToonMaterial?(s(m,f),u(m,f)):f.isMeshPhongMaterial?(s(m,f),d(m,f)):f.isMeshStandardMaterial?(s(m,f),h(m,f),f.isMeshPhysicalMaterial&&p(m,f,D)):f.isMeshMatcapMaterial?(s(m,f),_(m,f)):f.isMeshDepthMaterial?s(m,f):f.isMeshDistanceMaterial?(s(m,f),x(m,f)):f.isMeshNormalMaterial?s(m,f):f.isLineBasicMaterial?(a(m,f),f.isLineDashedMaterial&&o(m,f)):f.isPointsMaterial?l(m,f,b,v):f.isSpriteMaterial?c(m,f):f.isShadowMaterial?(m.color.value.copy(f.color),m.opacity.value=f.opacity):f.isShaderMaterial&&(f.uniformsNeedUpdate=!1)}function s(m,f){m.opacity.value=f.opacity,f.color&&m.diffuse.value.copy(f.color),f.emissive&&m.emissive.value.copy(f.emissive).multiplyScalar(f.emissiveIntensity),f.map&&(m.map.value=f.map,t(f.map,m.mapTransform)),f.alphaMap&&(m.alphaMap.value=f.alphaMap,t(f.alphaMap,m.alphaMapTransform)),f.bumpMap&&(m.bumpMap.value=f.bumpMap,t(f.bumpMap,m.bumpMapTransform),m.bumpScale.value=f.bumpScale,f.side===yt&&(m.bumpScale.value*=-1)),f.normalMap&&(m.normalMap.value=f.normalMap,t(f.normalMap,m.normalMapTransform),m.normalScale.value.copy(f.normalScale),f.side===yt&&m.normalScale.value.negate()),f.displacementMap&&(m.displacementMap.value=f.displacementMap,t(f.displacementMap,m.displacementMapTransform),m.displacementScale.value=f.displacementScale,m.displacementBias.value=f.displacementBias),f.emissiveMap&&(m.emissiveMap.value=f.emissiveMap,t(f.emissiveMap,m.emissiveMapTransform)),f.specularMap&&(m.specularMap.value=f.specularMap,t(f.specularMap,m.specularMapTransform)),f.alphaTest>0&&(m.alphaTest.value=f.alphaTest);const b=e.get(f),v=b.envMap,D=b.envMapRotation;if(v&&(m.envMap.value=v,Cn.copy(D),Cn.x*=-1,Cn.y*=-1,Cn.z*=-1,v.isCubeTexture&&v.isRenderTargetTexture===!1&&(Cn.y*=-1,Cn.z*=-1),m.envMapRotation.value.setFromMatrix4(s0.makeRotationFromEuler(Cn)),m.flipEnvMap.value=v.isCubeTexture&&v.isRenderTargetTexture===!1?-1:1,m.reflectivity.value=f.reflectivity,m.ior.value=f.ior,m.refractionRatio.value=f.refractionRatio),f.lightMap){m.lightMap.value=f.lightMap;const P=i._useLegacyLights===!0?Math.PI:1;m.lightMapIntensity.value=f.lightMapIntensity*P,t(f.lightMap,m.lightMapTransform)}f.aoMap&&(m.aoMap.value=f.aoMap,m.aoMapIntensity.value=f.aoMapIntensity,t(f.aoMap,m.aoMapTransform))}function a(m,f){m.diffuse.value.copy(f.color),m.opacity.value=f.opacity,f.map&&(m.map.value=f.map,t(f.map,m.mapTransform))}function o(m,f){m.dashSize.value=f.dashSize,m.totalSize.value=f.dashSize+f.gapSize,m.scale.value=f.scale}function l(m,f,b,v){m.diffuse.value.copy(f.color),m.opacity.value=f.opacity,m.size.value=f.size*b,m.scale.value=v*.5,f.map&&(m.map.value=f.map,t(f.map,m.uvTransform)),f.alphaMap&&(m.alphaMap.value=f.alphaMap,t(f.alphaMap,m.alphaMapTransform)),f.alphaTest>0&&(m.alphaTest.value=f.alphaTest)}function c(m,f){m.diffuse.value.copy(f.color),m.opacity.value=f.opacity,m.rotation.value=f.rotation,f.map&&(m.map.value=f.map,t(f.map,m.mapTransform)),f.alphaMap&&(m.alphaMap.value=f.alphaMap,t(f.alphaMap,m.alphaMapTransform)),f.alphaTest>0&&(m.alphaTest.value=f.alphaTest)}function d(m,f){m.specular.value.copy(f.specular),m.shininess.value=Math.max(f.shininess,1e-4)}function u(m,f){f.gradientMap&&(m.gradientMap.value=f.gradientMap)}function h(m,f){m.metalness.value=f.metalness,f.metalnessMap&&(m.metalnessMap.value=f.metalnessMap,t(f.metalnessMap,m.metalnessMapTransform)),m.roughness.value=f.roughness,f.roughnessMap&&(m.roughnessMap.value=f.roughnessMap,t(f.roughnessMap,m.roughnessMapTransform)),f.envMap&&(m.envMapIntensity.value=f.envMapIntensity)}function p(m,f,b){m.ior.value=f.ior,f.sheen>0&&(m.sheenColor.value.copy(f.sheenColor).multiplyScalar(f.sheen),m.sheenRoughness.value=f.sheenRoughness,f.sheenColorMap&&(m.sheenColorMap.value=f.sheenColorMap,t(f.sheenColorMap,m.sheenColorMapTransform)),f.sheenRoughnessMap&&(m.sheenRoughnessMap.value=f.sheenRoughnessMap,t(f.sheenRoughnessMap,m.sheenRoughnessMapTransform))),f.clearcoat>0&&(m.clearcoat.value=f.clearcoat,m.clearcoatRoughness.value=f.clearcoatRoughness,f.clearcoatMap&&(m.clearcoatMap.value=f.clearcoatMap,t(f.clearcoatMap,m.clearcoatMapTransform)),f.clearcoatRoughnessMap&&(m.clearcoatRoughnessMap.value=f.clearcoatRoughnessMap,t(f.clearcoatRoughnessMap,m.clearcoatRoughnessMapTransform)),f.clearcoatNormalMap&&(m.clearcoatNormalMap.value=f.clearcoatNormalMap,t(f.clearcoatNormalMap,m.clearcoatNormalMapTransform),m.clearcoatNormalScale.value.copy(f.clearcoatNormalScale),f.side===yt&&m.clearcoatNormalScale.value.negate())),f.iridescence>0&&(m.iridescence.value=f.iridescence,m.iridescenceIOR.value=f.iridescenceIOR,m.iridescenceThicknessMinimum.value=f.iridescenceThicknessRange[0],m.iridescenceThicknessMaximum.value=f.iridescenceThicknessRange[1],f.iridescenceMap&&(m.iridescenceMap.value=f.iridescenceMap,t(f.iridescenceMap,m.iridescenceMapTransform)),f.iridescenceThicknessMap&&(m.iridescenceThicknessMap.value=f.iridescenceThicknessMap,t(f.iridescenceThicknessMap,m.iridescenceThicknessMapTransform))),f.transmission>0&&(m.transmission.value=f.transmission,m.transmissionSamplerMap.value=b.texture,m.transmissionSamplerSize.value.set(b.width,b.height),f.transmissionMap&&(m.transmissionMap.value=f.transmissionMap,t(f.transmissionMap,m.transmissionMapTransform)),m.thickness.value=f.thickness,f.thicknessMap&&(m.thicknessMap.value=f.thicknessMap,t(f.thicknessMap,m.thicknessMapTransform)),m.attenuationDistance.value=f.attenuationDistance,m.attenuationColor.value.copy(f.attenuationColor)),f.anisotropy>0&&(m.anisotropyVector.value.set(f.anisotropy*Math.cos(f.anisotropyRotation),f.anisotropy*Math.sin(f.anisotropyRotation)),f.anisotropyMap&&(m.anisotropyMap.value=f.anisotropyMap,t(f.anisotropyMap,m.anisotropyMapTransform))),m.specularIntensity.value=f.specularIntensity,m.specularColor.value.copy(f.specularColor),f.specularColorMap&&(m.specularColorMap.value=f.specularColorMap,t(f.specularColorMap,m.specularColorMapTransform)),f.specularIntensityMap&&(m.specularIntensityMap.value=f.specularIntensityMap,t(f.specularIntensityMap,m.specularIntensityMapTransform))}function _(m,f){f.matcap&&(m.matcap.value=f.matcap)}function x(m,f){const b=e.get(f).light;m.referencePosition.value.setFromMatrixPosition(b.matrixWorld),m.nearDistance.value=b.shadow.camera.near,m.farDistance.value=b.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:r}}function o0(i,e,t,n){let r={},s={},a=[];const o=i.getParameter(i.MAX_UNIFORM_BUFFER_BINDINGS);function l(b,v){const D=v.program;n.uniformBlockBinding(b,D)}function c(b,v){let D=r[b.id];D===void 0&&(_(b),D=d(b),r[b.id]=D,b.addEventListener("dispose",m));const P=v.program;n.updateUBOMapping(b,P);const T=e.render.frame;s[b.id]!==T&&(h(b),s[b.id]=T)}function d(b){const v=u();b.__bindingPointIndex=v;const D=i.createBuffer(),P=b.__size,T=b.usage;return i.bindBuffer(i.UNIFORM_BUFFER,D),i.bufferData(i.UNIFORM_BUFFER,P,T),i.bindBuffer(i.UNIFORM_BUFFER,null),i.bindBufferBase(i.UNIFORM_BUFFER,v,D),D}function u(){for(let b=0;b<o;b++)if(a.indexOf(b)===-1)return a.push(b),b;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function h(b){const v=r[b.id],D=b.uniforms,P=b.__cache;i.bindBuffer(i.UNIFORM_BUFFER,v);for(let T=0,w=D.length;T<w;T++){const L=Array.isArray(D[T])?D[T]:[D[T]];for(let S=0,y=L.length;S<y;S++){const U=L[S];if(p(U,T,S,P)===!0){const I=U.__offset,C=Array.isArray(U.value)?U.value:[U.value];let k=0;for(let G=0;G<C.length;G++){const $=C[G],te=x($);typeof $=="number"||typeof $=="boolean"?(U.__data[0]=$,i.bufferSubData(i.UNIFORM_BUFFER,I+k,U.__data)):$.isMatrix3?(U.__data[0]=$.elements[0],U.__data[1]=$.elements[1],U.__data[2]=$.elements[2],U.__data[3]=0,U.__data[4]=$.elements[3],U.__data[5]=$.elements[4],U.__data[6]=$.elements[5],U.__data[7]=0,U.__data[8]=$.elements[6],U.__data[9]=$.elements[7],U.__data[10]=$.elements[8],U.__data[11]=0):($.toArray(U.__data,k),k+=te.storage/Float32Array.BYTES_PER_ELEMENT)}i.bufferSubData(i.UNIFORM_BUFFER,I,U.__data)}}}i.bindBuffer(i.UNIFORM_BUFFER,null)}function p(b,v,D,P){const T=b.value,w=v+"_"+D;if(P[w]===void 0)return typeof T=="number"||typeof T=="boolean"?P[w]=T:P[w]=T.clone(),!0;{const L=P[w];if(typeof T=="number"||typeof T=="boolean"){if(L!==T)return P[w]=T,!0}else if(L.equals(T)===!1)return L.copy(T),!0}return!1}function _(b){const v=b.uniforms;let D=0;const P=16;for(let w=0,L=v.length;w<L;w++){const S=Array.isArray(v[w])?v[w]:[v[w]];for(let y=0,U=S.length;y<U;y++){const I=S[y],C=Array.isArray(I.value)?I.value:[I.value];for(let k=0,G=C.length;k<G;k++){const $=C[k],te=x($),B=D%P;B!==0&&P-B<te.boundary&&(D+=P-B),I.__data=new Float32Array(te.storage/Float32Array.BYTES_PER_ELEMENT),I.__offset=D,D+=te.storage}}}const T=D%P;return T>0&&(D+=P-T),b.__size=D,b.__cache={},this}function x(b){const v={boundary:0,storage:0};return typeof b=="number"||typeof b=="boolean"?(v.boundary=4,v.storage=4):b.isVector2?(v.boundary=8,v.storage=8):b.isVector3||b.isColor?(v.boundary=16,v.storage=12):b.isVector4?(v.boundary=16,v.storage=16):b.isMatrix3?(v.boundary=48,v.storage=48):b.isMatrix4?(v.boundary=64,v.storage=64):b.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",b),v}function m(b){const v=b.target;v.removeEventListener("dispose",m);const D=a.indexOf(v.__bindingPointIndex);a.splice(D,1),i.deleteBuffer(r[v.id]),delete r[v.id],delete s[v.id]}function f(){for(const b in r)i.deleteBuffer(r[b]);a=[],r={},s={}}return{bind:l,update:c,dispose:f}}class Ul{constructor(e={}){const{canvas:t=Qu(),context:n=null,depth:r=!0,stencil:s=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:d="default",failIfMajorPerformanceCaveat:u=!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 p=new Uint32Array(4),_=new Int32Array(4);let x=null,m=null;const f=[],b=[];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=_n,this.toneMappingExposure=1;const v=this;let D=!1,P=0,T=0,w=null,L=-1,S=null;const y=new dt,U=new dt;let I=null;const C=new be(0);let k=0,G=t.width,$=t.height,te=1,B=null,K=null;const q=new dt(0,0,G,$),F=new dt(0,0,G,$);let ee=!1;const me=new Tl;let N=!1,Q=!1;const ue=new et,ie=new he,ve=new R,De={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function Ce(){return w===null?te:1}let H=n;function Fe(E,O){const X=t.getContext(E,O);return X!==null?X:null}try{const E={alpha:!0,depth:r,stencil:s,antialias:o,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:d,failIfMajorPerformanceCaveat:u};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${Ws}`),t.addEventListener("webglcontextlost",V,!1),t.addEventListener("webglcontextrestored",Z,!1),t.addEventListener("webglcontextcreationerror",oe,!1),H===null){const O="webgl2";if(H=Fe(O,E),H===null)throw Fe(O)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(E){throw console.error("THREE.WebGLRenderer: "+E.message),E}let xe,Ge,Ee,We,A,M,Y,J,ne,re,Te,ae,Se,Ae,le,fe,Re,ge,_e,ke,He,je,Xe,Ye;function ye(){xe=new gp(H),xe.init(),Ge=new up(H,xe,e),je=new Jm(H,xe),Ee=new Km(H),We=new vp(H),A=new Im,M=new Zm(H,xe,Ee,A,Ge,je,We),Y=new dp(v),J=new mp(v),ne=new bh(H),Xe=new lp(H,ne),re=new _p(H,ne,We,Xe),Te=new Mp(H,re,ne,We),_e=new yp(H,Ge,M),fe=new hp(A),ae=new Um(v,Y,J,xe,Ge,Xe,fe),Se=new a0(v,A),Ae=new zm,le=new Wm(xe),ge=new op(v,Y,J,Ee,Te,h,l),Re=new $m(v,Te,Ge),Ye=new o0(H,We,Ge,Ee),ke=new cp(H,xe,We),He=new xp(H,xe,We),We.programs=ae.programs,v.capabilities=Ge,v.extensions=xe,v.properties=A,v.renderLists=Ae,v.shadowMap=Re,v.state=Ee,v.info=We}ye();const g=new r0(v,H);this.xr=g,this.getContext=function(){return H},this.getContextAttributes=function(){return H.getContextAttributes()},this.forceContextLoss=function(){const E=xe.get("WEBGL_lose_context");E&&E.loseContext()},this.forceContextRestore=function(){const E=xe.get("WEBGL_lose_context");E&&E.restoreContext()},this.getPixelRatio=function(){return te},this.setPixelRatio=function(E){E!==void 0&&(te=E,this.setSize(G,$,!1))},this.getSize=function(E){return E.set(G,$)},this.setSize=function(E,O,X=!0){if(g.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}G=E,$=O,t.width=Math.floor(E*te),t.height=Math.floor(O*te),X===!0&&(t.style.width=E+"px",t.style.height=O+"px"),this.setViewport(0,0,E,O)},this.getDrawingBufferSize=function(E){return E.set(G*te,$*te).floor()},this.setDrawingBufferSize=function(E,O,X){G=E,$=O,te=X,t.width=Math.floor(E*X),t.height=Math.floor(O*X),this.setViewport(0,0,E,O)},this.getCurrentViewport=function(E){return E.copy(y)},this.getViewport=function(E){return E.copy(q)},this.setViewport=function(E,O,X,j){E.isVector4?q.set(E.x,E.y,E.z,E.w):q.set(E,O,X,j),Ee.viewport(y.copy(q).multiplyScalar(te).round())},this.getScissor=function(E){return E.copy(F)},this.setScissor=function(E,O,X,j){E.isVector4?F.set(E.x,E.y,E.z,E.w):F.set(E,O,X,j),Ee.scissor(U.copy(F).multiplyScalar(te).round())},this.getScissorTest=function(){return ee},this.setScissorTest=function(E){Ee.setScissorTest(ee=E)},this.setOpaqueSort=function(E){B=E},this.setTransparentSort=function(E){K=E},this.getClearColor=function(E){return E.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(E=!0,O=!0,X=!0){let j=0;if(E){let W=!1;if(w!==null){const de=w.texture.format;W=de===dl||de===hl||de===ul}if(W){const de=w.texture.type,Me=de===xn||de===_i||de===al||de===zi||de===ll||de===cl,we=ge.getClearColor(),Pe=ge.getClearAlpha(),Ne=we.r,Le=we.g,Ue=we.b;Me?(p[0]=Ne,p[1]=Le,p[2]=Ue,p[3]=Pe,H.clearBufferuiv(H.COLOR,0,p)):(_[0]=Ne,_[1]=Le,_[2]=Ue,_[3]=Pe,H.clearBufferiv(H.COLOR,0,_))}else j|=H.COLOR_BUFFER_BIT}O&&(j|=H.DEPTH_BUFFER_BIT),X&&(j|=H.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),H.clear(j)},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",Z,!1),t.removeEventListener("webglcontextcreationerror",oe,!1),Ae.dispose(),le.dispose(),A.dispose(),Y.dispose(),J.dispose(),Te.dispose(),Xe.dispose(),Ye.dispose(),ae.dispose(),g.dispose(),g.removeEventListener("sessionstart",it),g.removeEventListener("sessionend",rt),At.stop()};function V(E){E.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),D=!0}function Z(){console.log("THREE.WebGLRenderer: Context Restored."),D=!1;const E=We.autoReset,O=Re.enabled,X=Re.autoUpdate,j=Re.needsUpdate,W=Re.type;ye(),We.autoReset=E,Re.enabled=O,Re.autoUpdate=X,Re.needsUpdate=j,Re.type=W}function oe(E){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",E.statusMessage)}function pe(E){const O=E.target;O.removeEventListener("dispose",pe),Ve(O)}function Ve(E){Be(E),A.remove(E)}function Be(E){const O=A.get(E).programs;O!==void 0&&(O.forEach(function(X){ae.releaseProgram(X)}),E.isShaderMaterial&&ae.releaseShaderCache(E))}this.renderBufferDirect=function(E,O,X,j,W,de){O===null&&(O=De);const Me=W.isMesh&&W.matrixWorld.determinant()<0,we=$l(E,O,X,j,W);Ee.setMaterial(j,Me);let Pe=X.index,Ne=1;if(j.wireframe===!0){if(Pe=re.getWireframeAttribute(X),Pe===void 0)return;Ne=2}const Le=X.drawRange,Ue=X.attributes.position;let tt=Le.start*Ne,wt=(Le.start+Le.count)*Ne;de!==null&&(tt=Math.max(tt,de.start*Ne),wt=Math.min(wt,(de.start+de.count)*Ne)),Pe!==null?(tt=Math.max(tt,0),wt=Math.min(wt,Pe.count)):Ue!=null&&(tt=Math.max(tt,0),wt=Math.min(wt,Ue.count));const ct=wt-tt;if(ct<0||ct===1/0)return;Xe.setup(W,j,we,X,Pe);let qt,Qe=ke;if(Pe!==null&&(qt=ne.get(Pe),Qe=He,Qe.setIndex(qt)),W.isMesh)j.wireframe===!0?(Ee.setLineWidth(j.wireframeLinewidth*Ce()),Qe.setMode(H.LINES)):Qe.setMode(H.TRIANGLES);else if(W.isLine){let Ie=j.linewidth;Ie===void 0&&(Ie=1),Ee.setLineWidth(Ie*Ce()),W.isLineSegments?Qe.setMode(H.LINES):W.isLineLoop?Qe.setMode(H.LINE_LOOP):Qe.setMode(H.LINE_STRIP)}else W.isPoints?Qe.setMode(H.POINTS):W.isSprite&&Qe.setMode(H.TRIANGLES);if(W.isBatchedMesh)Qe.renderMultiDraw(W._multiDrawStarts,W._multiDrawCounts,W._multiDrawCount);else if(W.isInstancedMesh)Qe.renderInstances(tt,ct,W.count);else if(X.isInstancedBufferGeometry){const Ie=X._maxInstanceCount!==void 0?X._maxInstanceCount:1/0,kr=Math.min(X.instanceCount,Ie);Qe.renderInstances(tt,ct,kr)}else Qe.render(tt,ct)};function Ze(E,O,X){E.transparent===!0&&E.side===jt&&E.forceSinglePass===!1?(E.side=yt,E.needsUpdate=!0,Wi(E,O,X),E.side=yn,E.needsUpdate=!0,Wi(E,O,X),E.side=jt):Wi(E,O,X)}this.compile=function(E,O,X=null){X===null&&(X=E),m=le.get(X),m.init(),b.push(m),X.traverseVisible(function(W){W.isLight&&W.layers.test(O.layers)&&(m.pushLight(W),W.castShadow&&m.pushShadow(W))}),E!==X&&E.traverseVisible(function(W){W.isLight&&W.layers.test(O.layers)&&(m.pushLight(W),W.castShadow&&m.pushShadow(W))}),m.setupLights(v._useLegacyLights);const j=new Set;return E.traverse(function(W){const de=W.material;if(de)if(Array.isArray(de))for(let Me=0;Me<de.length;Me++){const we=de[Me];Ze(we,X,W),j.add(we)}else Ze(de,X,W),j.add(de)}),b.pop(),m=null,j},this.compileAsync=function(E,O,X=null){const j=this.compile(E,O,X);return new Promise(W=>{function de(){if(j.forEach(function(Me){A.get(Me).currentProgram.isReady()&&j.delete(Me)}),j.size===0){W(E);return}setTimeout(de,10)}xe.get("KHR_parallel_shader_compile")!==null?de():setTimeout(de,10)})};let lt=null;function qe(E){lt&<(E)}function it(){At.stop()}function rt(){At.start()}const At=new Al;At.setAnimationLoop(qe),typeof self<"u"&&At.setContext(self),this.setAnimationLoop=function(E){lt=E,g.setAnimationLoop(E),E===null?At.stop():At.start()},g.addEventListener("sessionstart",it),g.addEventListener("sessionend",rt),this.render=function(E,O){if(O!==void 0&&O.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(D===!0)return;E.matrixWorldAutoUpdate===!0&&E.updateMatrixWorld(),O.parent===null&&O.matrixWorldAutoUpdate===!0&&O.updateMatrixWorld(),g.enabled===!0&&g.isPresenting===!0&&(g.cameraAutoUpdate===!0&&g.updateCamera(O),O=g.getCamera()),E.isScene===!0&&E.onBeforeRender(v,E,O,w),m=le.get(E,b.length),m.init(),b.push(m),ue.multiplyMatrices(O.projectionMatrix,O.matrixWorldInverse),me.setFromProjectionMatrix(ue),Q=this.localClippingEnabled,N=fe.init(this.clippingPlanes,Q),x=Ae.get(E,f.length),x.init(),f.push(x),Ft(E,O,0,v.sortObjects),x.finish(),v.sortObjects===!0&&x.sort(B,K),this.info.render.frame++,N===!0&&fe.beginShadows();const X=m.state.shadowsArray;if(Re.render(X,E,O),N===!0&&fe.endShadows(),this.info.autoReset===!0&&this.info.reset(),(g.enabled===!1||g.isPresenting===!1||g.hasDepthSensing()===!1)&&ge.render(x,E),m.setupLights(v._useLegacyLights),O.isArrayCamera){const j=O.cameras;for(let W=0,de=j.length;W<de;W++){const Me=j[W];an(x,E,Me,Me.viewport)}}else an(x,E,O);w!==null&&(M.updateMultisampleRenderTarget(w),M.updateRenderTargetMipmap(w)),E.isScene===!0&&E.onAfterRender(v,E,O),Xe.resetDefaultState(),L=-1,S=null,b.pop(),b.length>0?m=b[b.length-1]:m=null,f.pop(),f.length>0?x=f[f.length-1]:x=null};function Ft(E,O,X,j){if(E.visible===!1)return;if(E.layers.test(O.layers)){if(E.isGroup)X=E.renderOrder;else if(E.isLOD)E.autoUpdate===!0&&E.update(O);else if(E.isLight)m.pushLight(E),E.castShadow&&m.pushShadow(E);else if(E.isSprite){if(!E.frustumCulled||me.intersectsSprite(E)){j&&ve.setFromMatrixPosition(E.matrixWorld).applyMatrix4(ue);const Me=Te.update(E),we=E.material;we.visible&&x.push(E,Me,we,X,ve.z,null)}}else if((E.isMesh||E.isLine||E.isPoints)&&(!E.frustumCulled||me.intersectsObject(E))){const Me=Te.update(E),we=E.material;if(j&&(E.boundingSphere!==void 0?(E.boundingSphere===null&&E.computeBoundingSphere(),ve.copy(E.boundingSphere.center)):(Me.boundingSphere===null&&Me.computeBoundingSphere(),ve.copy(Me.boundingSphere.center)),ve.applyMatrix4(E.matrixWorld).applyMatrix4(ue)),Array.isArray(we)){const Pe=Me.groups;for(let Ne=0,Le=Pe.length;Ne<Le;Ne++){const Ue=Pe[Ne],tt=we[Ue.materialIndex];tt&&tt.visible&&x.push(E,Me,tt,X,ve.z,Ue)}}else we.visible&&x.push(E,Me,we,X,ve.z,null)}}const de=E.children;for(let Me=0,we=de.length;Me<we;Me++)Ft(de[Me],O,X,j)}function an(E,O,X,j){const W=E.opaque,de=E.transmissive,Me=E.transparent;m.setupLightsView(X),N===!0&&fe.setGlobalState(v.clippingPlanes,X),de.length>0&&Bn(W,de,O,X),j&&Ee.viewport(y.copy(j)),W.length>0&&Sn(W,O,X),de.length>0&&Sn(de,O,X),Me.length>0&&Sn(Me,O,X),Ee.buffers.depth.setTest(!0),Ee.buffers.depth.setMask(!0),Ee.buffers.color.setMask(!0),Ee.setPolygonOffset(!1)}function Bn(E,O,X,j){if((X.isScene===!0?X.overrideMaterial:null)!==null)return;if(m.state.transmissionRenderTarget===null){m.state.transmissionRenderTarget=new Gt(1,1,{generateMipmaps:!0,type:xe.has("EXT_color_buffer_half_float")||xe.has("EXT_color_buffer_float")?vn:xn,minFilter:Un,samples:4,stencilBuffer:s});const Ne=A.get(m.state.transmissionRenderTarget);Ne.__isTransmissionRenderTarget=!0}const de=m.state.transmissionRenderTarget;v.getDrawingBufferSize(ie),de.setSize(ie.x,ie.y);const Me=v.getRenderTarget();v.setRenderTarget(de),v.getClearColor(C),k=v.getClearAlpha(),k<1&&v.setClearColor(16777215,.5),v.clear();const we=v.toneMapping;v.toneMapping=_n,Sn(E,X,j),M.updateMultisampleRenderTarget(de),M.updateRenderTargetMipmap(de);let Pe=!1;for(let Ne=0,Le=O.length;Ne<Le;Ne++){const Ue=O[Ne],tt=Ue.object,wt=Ue.geometry,ct=Ue.material,qt=Ue.group;if(ct.side===jt&&tt.layers.test(j.layers)){const Qe=ct.side;ct.side=yt,ct.needsUpdate=!0,Js(tt,X,j,wt,ct,qt),ct.side=Qe,ct.needsUpdate=!0,Pe=!0}}Pe===!0&&(M.updateMultisampleRenderTarget(de),M.updateRenderTargetMipmap(de)),v.setRenderTarget(Me),v.setClearColor(C,k),v.toneMapping=we}function Sn(E,O,X){const j=O.isScene===!0?O.overrideMaterial:null;for(let W=0,de=E.length;W<de;W++){const Me=E[W],we=Me.object,Pe=Me.geometry,Ne=j===null?Me.material:j,Le=Me.group;we.layers.test(X.layers)&&Js(we,O,X,Pe,Ne,Le)}}function Js(E,O,X,j,W,de){E.onBeforeRender(v,O,X,j,W,de),E.modelViewMatrix.multiplyMatrices(X.matrixWorldInverse,E.matrixWorld),E.normalMatrix.getNormalMatrix(E.modelViewMatrix),W.onBeforeRender(v,O,X,j,E,de),W.transparent===!0&&W.side===jt&&W.forceSinglePass===!1?(W.side=yt,W.needsUpdate=!0,v.renderBufferDirect(X,O,j,W,E,de),W.side=yn,W.needsUpdate=!0,v.renderBufferDirect(X,O,j,W,E,de),W.side=jt):v.renderBufferDirect(X,O,j,W,E,de),E.onAfterRender(v,O,X,j,W,de)}function Wi(E,O,X){O.isScene!==!0&&(O=De);const j=A.get(E),W=m.state.lights,de=m.state.shadowsArray,Me=W.state.version,we=ae.getParameters(E,W.state,de,O,X),Pe=ae.getProgramCacheKey(we);let Ne=j.programs;j.environment=E.isMeshStandardMaterial?O.environment:null,j.fog=O.fog,j.envMap=(E.isMeshStandardMaterial?J:Y).get(E.envMap||j.environment),j.envMapRotation=j.environment!==null&&E.envMap===null?O.environmentRotation:E.envMapRotation,Ne===void 0&&(E.addEventListener("dispose",pe),Ne=new Map,j.programs=Ne);let Le=Ne.get(Pe);if(Le!==void 0){if(j.currentProgram===Le&&j.lightsStateVersion===Me)return ea(E,we),Le}else we.uniforms=ae.getUniforms(E),E.onBuild(X,we,v),E.onBeforeCompile(we,v),Le=ae.acquireProgram(we,Pe),Ne.set(Pe,Le),j.uniforms=we.uniforms;const Ue=j.uniforms;return(!E.isShaderMaterial&&!E.isRawShaderMaterial||E.clipping===!0)&&(Ue.clippingPlanes=fe.uniform),ea(E,we),j.needsLights=Zl(E),j.lightsStateVersion=Me,j.needsLights&&(Ue.ambientLightColor.value=W.state.ambient,Ue.lightProbe.value=W.state.probe,Ue.directionalLights.value=W.state.directional,Ue.directionalLightShadows.value=W.state.directionalShadow,Ue.spotLights.value=W.state.spot,Ue.spotLightShadows.value=W.state.spotShadow,Ue.rectAreaLights.value=W.state.rectArea,Ue.ltc_1.value=W.state.rectAreaLTC1,Ue.ltc_2.value=W.state.rectAreaLTC2,Ue.pointLights.value=W.state.point,Ue.pointLightShadows.value=W.state.pointShadow,Ue.hemisphereLights.value=W.state.hemi,Ue.directionalShadowMap.value=W.state.directionalShadowMap,Ue.directionalShadowMatrix.value=W.state.directionalShadowMatrix,Ue.spotShadowMap.value=W.state.spotShadowMap,Ue.spotLightMatrix.value=W.state.spotLightMatrix,Ue.spotLightMap.value=W.state.spotLightMap,Ue.pointShadowMap.value=W.state.pointShadowMap,Ue.pointShadowMatrix.value=W.state.pointShadowMatrix),j.currentProgram=Le,j.uniformsList=null,Le}function Qs(E){if(E.uniformsList===null){const O=E.currentProgram.getUniforms();E.uniformsList=br.seqWithValue(O.seq,E.uniforms)}return E.uniformsList}function ea(E,O){const X=A.get(E);X.outputColorSpace=O.outputColorSpace,X.batching=O.batching,X.instancing=O.instancing,X.instancingColor=O.instancingColor,X.instancingMorph=O.instancingMorph,X.skinning=O.skinning,X.morphTargets=O.morphTargets,X.morphNormals=O.morphNormals,X.morphColors=O.morphColors,X.morphTargetsCount=O.morphTargetsCount,X.numClippingPlanes=O.numClippingPlanes,X.numIntersection=O.numClipIntersection,X.vertexAlphas=O.vertexAlphas,X.vertexTangents=O.vertexTangents,X.toneMapping=O.toneMapping}function $l(E,O,X,j,W){O.isScene!==!0&&(O=De),M.resetTextureUnits();const de=O.fog,Me=j.isMeshStandardMaterial?O.environment:null,we=w===null?v.outputColorSpace:w.isXRRenderTarget===!0?w.texture.colorSpace:Mn,Pe=(j.isMeshStandardMaterial?J:Y).get(j.envMap||Me),Ne=j.vertexColors===!0&&!!X.attributes.color&&X.attributes.color.itemSize===4,Le=!!X.attributes.tangent&&(!!j.normalMap||j.anisotropy>0),Ue=!!X.morphAttributes.position,tt=!!X.morphAttributes.normal,wt=!!X.morphAttributes.color;let ct=_n;j.toneMapped&&(w===null||w.isXRRenderTarget===!0)&&(ct=v.toneMapping);const qt=X.morphAttributes.position||X.morphAttributes.normal||X.morphAttributes.color,Qe=qt!==void 0?qt.length:0,Ie=A.get(j),kr=m.state.lights;if(N===!0&&(Q===!0||E!==S)){const Nt=E===S&&j.id===L;fe.setState(j,E,Nt)}let Je=!1;j.version===Ie.__version?(Ie.needsLights&&Ie.lightsStateVersion!==kr.state.version||Ie.outputColorSpace!==we||W.isBatchedMesh&&Ie.batching===!1||!W.isBatchedMesh&&Ie.batching===!0||W.isInstancedMesh&&Ie.instancing===!1||!W.isInstancedMesh&&Ie.instancing===!0||W.isSkinnedMesh&&Ie.skinning===!1||!W.isSkinnedMesh&&Ie.skinning===!0||W.isInstancedMesh&&Ie.instancingColor===!0&&W.instanceColor===null||W.isInstancedMesh&&Ie.instancingColor===!1&&W.instanceColor!==null||W.isInstancedMesh&&Ie.instancingMorph===!0&&W.morphTexture===null||W.isInstancedMesh&&Ie.instancingMorph===!1&&W.morphTexture!==null||Ie.envMap!==Pe||j.fog===!0&&Ie.fog!==de||Ie.numClippingPlanes!==void 0&&(Ie.numClippingPlanes!==fe.numPlanes||Ie.numIntersection!==fe.numIntersection)||Ie.vertexAlphas!==Ne||Ie.vertexTangents!==Le||Ie.morphTargets!==Ue||Ie.morphNormals!==tt||Ie.morphColors!==wt||Ie.toneMapping!==ct||Ie.morphTargetsCount!==Qe)&&(Je=!0):(Je=!0,Ie.__version=j.version);let En=Ie.currentProgram;Je===!0&&(En=Wi(j,O,W));let ta=!1,Si=!1,Hr=!1;const pt=En.getUniforms(),on=Ie.uniforms;if(Ee.useProgram(En.program)&&(ta=!0,Si=!0,Hr=!0),j.id!==L&&(L=j.id,Si=!0),ta||S!==E){pt.setValue(H,"projectionMatrix",E.projectionMatrix),pt.setValue(H,"viewMatrix",E.matrixWorldInverse);const Nt=pt.map.cameraPosition;Nt!==void 0&&Nt.setValue(H,ve.setFromMatrixPosition(E.matrixWorld)),Ge.logarithmicDepthBuffer&&pt.setValue(H,"logDepthBufFC",2/(Math.log(E.far+1)/Math.LN2)),(j.isMeshPhongMaterial||j.isMeshToonMaterial||j.isMeshLambertMaterial||j.isMeshBasicMaterial||j.isMeshStandardMaterial||j.isShaderMaterial)&&pt.setValue(H,"isOrthographic",E.isOrthographicCamera===!0),S!==E&&(S=E,Si=!0,Hr=!0)}if(W.isSkinnedMesh){pt.setOptional(H,W,"bindMatrix"),pt.setOptional(H,W,"bindMatrixInverse");const Nt=W.skeleton;Nt&&(Nt.boneTexture===null&&Nt.computeBoneTexture(),pt.setValue(H,"boneTexture",Nt.boneTexture,M))}W.isBatchedMesh&&(pt.setOptional(H,W,"batchingTexture"),pt.setValue(H,"batchingTexture",W._matricesTexture,M));const Vr=X.morphAttributes;if((Vr.position!==void 0||Vr.normal!==void 0||Vr.color!==void 0)&&_e.update(W,X,En),(Si||Ie.receiveShadow!==W.receiveShadow)&&(Ie.receiveShadow=W.receiveShadow,pt.setValue(H,"receiveShadow",W.receiveShadow)),j.isMeshGouraudMaterial&&j.envMap!==null&&(on.envMap.value=Pe,on.flipEnvMap.value=Pe.isCubeTexture&&Pe.isRenderTargetTexture===!1?-1:1),j.isMeshStandardMaterial&&j.envMap===null&&O.environment!==null&&(on.envMapIntensity.value=O.environmentIntensity),Si&&(pt.setValue(H,"toneMappingExposure",v.toneMappingExposure),Ie.needsLights&&Kl(on,Hr),de&&j.fog===!0&&Se.refreshFogUniforms(on,de),Se.refreshMaterialUniforms(on,j,te,$,m.state.transmissionRenderTarget),br.upload(H,Qs(Ie),on,M)),j.isShaderMaterial&&j.uniformsNeedUpdate===!0&&(br.upload(H,Qs(Ie),on,M),j.uniformsNeedUpdate=!1),j.isSpriteMaterial&&pt.setValue(H,"center",W.center),pt.setValue(H,"modelViewMatrix",W.modelViewMatrix),pt.setValue(H,"normalMatrix",W.normalMatrix),pt.setValue(H,"modelMatrix",W.matrixWorld),j.isShaderMaterial||j.isRawShaderMaterial){const Nt=j.uniformsGroups;for(let Gr=0,Jl=Nt.length;Gr<Jl;Gr++){const na=Nt[Gr];Ye.update(na,En),Ye.bind(na,En)}}return En}function Kl(E,O){E.ambientLightColor.needsUpdate=O,E.lightProbe.needsUpdate=O,E.directionalLights.needsUpdate=O,E.directionalLightShadows.needsUpdate=O,E.pointLights.needsUpdate=O,E.pointLightShadows.needsUpdate=O,E.spotLights.needsUpdate=O,E.spotLightShadows.needsUpdate=O,E.rectAreaLights.needsUpdate=O,E.hemisphereLights.needsUpdate=O}function Zl(E){return E.isMeshLambertMaterial||E.isMeshToonMaterial||E.isMeshPhongMaterial||E.isMeshStandardMaterial||E.isShadowMaterial||E.isShaderMaterial&&E.lights===!0}this.getActiveCubeFace=function(){return P},this.getActiveMipmapLevel=function(){return T},this.getRenderTarget=function(){return w},this.setRenderTargetTextures=function(E,O,X){A.get(E.texture).__webglTexture=O,A.get(E.depthTexture).__webglTexture=X;const j=A.get(E);j.__hasExternalTextures=!0,j.__autoAllocateDepthBuffer=X===void 0,j.__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"),j.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(E,O){const X=A.get(E);X.__webglFramebuffer=O,X.__useDefaultFramebuffer=O===void 0},this.setRenderTarget=function(E,O=0,X=0){w=E,P=O,T=X;let j=!0,W=null,de=!1,Me=!1;if(E){const Pe=A.get(E);Pe.__useDefaultFramebuffer!==void 0?(Ee.bindFramebuffer(H.FRAMEBUFFER,null),j=!1):Pe.__webglFramebuffer===void 0?M.setupRenderTarget(E):Pe.__hasExternalTextures&&M.rebindTextures(E,A.get(E.texture).__webglTexture,A.get(E.depthTexture).__webglTexture);const Ne=E.texture;(Ne.isData3DTexture||Ne.isDataArrayTexture||Ne.isCompressedArrayTexture)&&(Me=!0);const Le=A.get(E).__webglFramebuffer;E.isWebGLCubeRenderTarget?(Array.isArray(Le[O])?W=Le[O][X]:W=Le[O],de=!0):E.samples>0&&M.useMultisampledRTT(E)===!1?W=A.get(E).__webglMultisampledFramebuffer:Array.isArray(Le)?W=Le[X]:W=Le,y.copy(E.viewport),U.copy(E.scissor),I=E.scissorTest}else y.copy(q).multiplyScalar(te).floor(),U.copy(F).multiplyScalar(te).floor(),I=ee;if(Ee.bindFramebuffer(H.FRAMEBUFFER,W)&&j&&Ee.drawBuffers(E,W),Ee.viewport(y),Ee.scissor(U),Ee.setScissorTest(I),de){const Pe=A.get(E.texture);H.framebufferTexture2D(H.FRAMEBUFFER,H.COLOR_ATTACHMENT0,H.TEXTURE_CUBE_MAP_POSITIVE_X+O,Pe.__webglTexture,X)}else if(Me){const Pe=A.get(E.texture),Ne=O||0;H.framebufferTextureLayer(H.FRAMEBUFFER,H.COLOR_ATTACHMENT0,Pe.__webglTexture,X||0,Ne)}L=-1},this.readRenderTargetPixels=function(E,O,X,j,W,de,Me){if(!(E&&E.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let we=A.get(E).__webglFramebuffer;if(E.isWebGLCubeRenderTarget&&Me!==void 0&&(we=we[Me]),we){Ee.bindFramebuffer(H.FRAMEBUFFER,we);try{const Pe=E.texture,Ne=Pe.format,Le=Pe.type;if(Ne!==Yt&&je.convert(Ne)!==H.getParameter(H.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const Ue=Le===vn&&(xe.has("EXT_color_buffer_half_float")||xe.has("EXT_color_buffer_float"));if(Le!==xn&&je.convert(Le)!==H.getParameter(H.IMPLEMENTATION_COLOR_READ_TYPE)&&Le!==gn&&!Ue){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}O>=0&&O<=E.width-j&&X>=0&&X<=E.height-W&&H.readPixels(O,X,j,W,je.convert(Ne),je.convert(Le),de)}finally{const Pe=w!==null?A.get(w).__webglFramebuffer:null;Ee.bindFramebuffer(H.FRAMEBUFFER,Pe)}}},this.copyFramebufferToTexture=function(E,O,X=0){const j=Math.pow(2,-X),W=Math.floor(O.image.width*j),de=Math.floor(O.image.height*j);M.setTexture2D(O,0),H.copyTexSubImage2D(H.TEXTURE_2D,X,0,0,E.x,E.y,W,de),Ee.unbindTexture()},this.copyTextureToTexture=function(E,O,X,j=0){const W=O.image.width,de=O.image.height,Me=je.convert(X.format),we=je.convert(X.type);M.setTexture2D(X,0),H.pixelStorei(H.UNPACK_FLIP_Y_WEBGL,X.flipY),H.pixelStorei(H.UNPACK_PREMULTIPLY_ALPHA_WEBGL,X.premultiplyAlpha),H.pixelStorei(H.UNPACK_ALIGNMENT,X.unpackAlignment),O.isDataTexture?H.texSubImage2D(H.TEXTURE_2D,j,E.x,E.y,W,de,Me,we,O.image.data):O.isCompressedTexture?H.compressedTexSubImage2D(H.TEXTURE_2D,j,E.x,E.y,O.mipmaps[0].width,O.mipmaps[0].height,Me,O.mipmaps[0].data):H.texSubImage2D(H.TEXTURE_2D,j,E.x,E.y,Me,we,O.image),j===0&&X.generateMipmaps&&H.generateMipmap(H.TEXTURE_2D),Ee.unbindTexture()},this.copyTextureToTexture3D=function(E,O,X,j,W=0){const de=Math.round(E.max.x-E.min.x),Me=Math.round(E.max.y-E.min.y),we=E.max.z-E.min.z+1,Pe=je.convert(j.format),Ne=je.convert(j.type);let Le;if(j.isData3DTexture)M.setTexture3D(j,0),Le=H.TEXTURE_3D;else if(j.isDataArrayTexture||j.isCompressedArrayTexture)M.setTexture2DArray(j,0),Le=H.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}H.pixelStorei(H.UNPACK_FLIP_Y_WEBGL,j.flipY),H.pixelStorei(H.UNPACK_PREMULTIPLY_ALPHA_WEBGL,j.premultiplyAlpha),H.pixelStorei(H.UNPACK_ALIGNMENT,j.unpackAlignment);const Ue=H.getParameter(H.UNPACK_ROW_LENGTH),tt=H.getParameter(H.UNPACK_IMAGE_HEIGHT),wt=H.getParameter(H.UNPACK_SKIP_PIXELS),ct=H.getParameter(H.UNPACK_SKIP_ROWS),qt=H.getParameter(H.UNPACK_SKIP_IMAGES),Qe=X.isCompressedTexture?X.mipmaps[W]:X.image;H.pixelStorei(H.UNPACK_ROW_LENGTH,Qe.width),H.pixelStorei(H.UNPACK_IMAGE_HEIGHT,Qe.height),H.pixelStorei(H.UNPACK_SKIP_PIXELS,E.min.x),H.pixelStorei(H.UNPACK_SKIP_ROWS,E.min.y),H.pixelStorei(H.UNPACK_SKIP_IMAGES,E.min.z),X.isDataTexture||X.isData3DTexture?H.texSubImage3D(Le,W,O.x,O.y,O.z,de,Me,we,Pe,Ne,Qe.data):j.isCompressedArrayTexture?H.compressedTexSubImage3D(Le,W,O.x,O.y,O.z,de,Me,we,Pe,Qe.data):H.texSubImage3D(Le,W,O.x,O.y,O.z,de,Me,we,Pe,Ne,Qe),H.pixelStorei(H.UNPACK_ROW_LENGTH,Ue),H.pixelStorei(H.UNPACK_IMAGE_HEIGHT,tt),H.pixelStorei(H.UNPACK_SKIP_PIXELS,wt),H.pixelStorei(H.UNPACK_SKIP_ROWS,ct),H.pixelStorei(H.UNPACK_SKIP_IMAGES,qt),W===0&&j.generateMipmaps&&H.generateMipmap(Le),Ee.unbindTexture()},this.initTexture=function(E){E.isCubeTexture?M.setTextureCube(E,0):E.isData3DTexture?M.setTexture3D(E,0):E.isDataArrayTexture||E.isCompressedArrayTexture?M.setTexture2DArray(E,0):M.setTexture2D(E,0),Ee.unbindTexture()},this.resetState=function(){P=0,T=0,w=null,Ee.reset(),Xe.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return tn}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=e===js?"display-p3":"srgb",t.unpackColorSpace=$e.workingColorSpace===Ur?"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 Br{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new be(e),this.density=t}clone(){return new Br(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class Il extends Mt{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 rn,this.environmentIntensity=1,this.environmentRotation=new rn,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 ks extends yi{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 zo=new R,Bo=new R,ko=new et,Ss=new Ir,mr=new ki;class Ol extends Mt{constructor(e=new _t,t=new ks){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++)zo.fromBufferAttribute(t,r-1),Bo.fromBufferAttribute(t,r),n[r]=n[r-1],n[r]+=zo.distanceTo(Bo);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(),mr.copy(n.boundingSphere),mr.applyMatrix4(r),mr.radius+=s,e.ray.intersectsSphere(mr)===!1)return;ko.copy(r).invert(),Ss.copy(e.ray).applyMatrix4(ko);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=new R,d=new R,u=new R,h=new R,p=this.isLineSegments?2:1,_=n.index,m=n.attributes.position;if(_!==null){const f=Math.max(0,a.start),b=Math.min(_.count,a.start+a.count);for(let v=f,D=b-1;v<D;v+=p){const P=_.getX(v),T=_.getX(v+1);if(c.fromBufferAttribute(m,P),d.fromBufferAttribute(m,T),Ss.distanceSqToSegment(c,d,h,u)>l)continue;h.applyMatrix4(this.matrixWorld);const L=e.ray.origin.distanceTo(h);L<e.near||L>e.far||t.push({distance:L,point:u.clone().applyMatrix4(this.matrixWorld),index:v,face:null,faceIndex:null,object:this})}}else{const f=Math.max(0,a.start),b=Math.min(m.count,a.start+a.count);for(let v=f,D=b-1;v<D;v+=p){if(c.fromBufferAttribute(m,v),d.fromBufferAttribute(m,v+1),Ss.distanceSqToSegment(c,d,h,u)>l)continue;h.applyMatrix4(this.matrixWorld);const T=e.ray.origin.distanceTo(h);T<e.near||T>e.far||t.push({distance:T,point:u.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 Ho=new R,Vo=new R;class l0 extends Ol{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)Ho.fromBufferAttribute(t,r),Vo.fromBufferAttribute(t,r+1),n[r]=r===0?0:n[r-1],n[r+1]=n[r]+Ho.distanceTo(Vo);e.setAttribute("lineDistance",new nt(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class c0 extends yi{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 Go=new et,Hs=new Ir,gr=new ki,_r=new R;class u0 extends Mt{constructor(e=new _t,t=new c0){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(),gr.copy(n.boundingSphere),gr.applyMatrix4(r),gr.radius+=s,e.ray.intersectsSphere(gr)===!1)return;Go.copy(r).invert(),Hs.copy(e.ray).applyMatrix4(Go);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=n.index,u=n.attributes.position;if(c!==null){const h=Math.max(0,a.start),p=Math.min(c.count,a.start+a.count);for(let _=h,x=p;_<x;_++){const m=c.getX(_);_r.fromBufferAttribute(u,m),Wo(_r,m,l,r,e,t,this)}}else{const h=Math.max(0,a.start),p=Math.min(u.count,a.start+a.count);for(let _=h,x=p;_<x;_++)_r.fromBufferAttribute(u,_),Wo(_r,_,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 Wo(i,e,t,n,r,s,a){const o=Hs.distanceSqToPoint(i);if(o<t){const l=new R;Hs.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 sn{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 d=n[r],h=n[r+1]-d,p=(a-d)/h;return(r+p)/(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 he:new R);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 R,r=[],s=[],a=[],o=new R,l=new et;for(let p=0;p<=e;p++){const _=p/e;r[p]=this.getTangentAt(_,new R)}s[0]=new R,a[0]=new R;let c=Number.MAX_VALUE;const d=Math.abs(r[0].x),u=Math.abs(r[0].y),h=Math.abs(r[0].z);d<=c&&(c=d,n.set(1,0,0)),u<=c&&(c=u,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 p=1;p<=e;p++){if(s[p]=s[p-1].clone(),a[p]=a[p-1].clone(),o.crossVectors(r[p-1],r[p]),o.length()>Number.EPSILON){o.normalize();const _=Math.acos(ht(r[p-1].dot(r[p]),-1,1));s[p].applyMatrix4(l.makeRotationAxis(o,_))}a[p].crossVectors(r[p],s[p])}if(t===!0){let p=Math.acos(ht(s[0].dot(s[e]),-1,1));p/=e,r[0].dot(o.crossVectors(s[0],s[e]))>0&&(p=-p);for(let _=1;_<=e;_++)s[_].applyMatrix4(l.makeRotationAxis(r[_],p*_)),a[_].crossVectors(r[_],s[_])}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 zl extends sn{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 he){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 d=Math.cos(this.aRotation),u=Math.sin(this.aRotation),h=l-this.aX,p=c-this.aY;l=h*d-p*u+this.aX,c=h*u+p*d+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 h0 extends zl{constructor(e,t,n,r,s,a){super(e,t,n,n,r,s,a),this.isArcCurve=!0,this.type="ArcCurve"}}function $s(){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,d,u){let h=(a-s)/c-(o-s)/(c+d)+(o-a)/d,p=(o-a)/d-(l-a)/(d+u)+(l-o)/u;h*=d,p*=d,r(a,o,h,p)},calc:function(s){const a=s*s,o=a*s;return i+e*s+t*a+n*o}}}const xr=new R,Es=new $s,bs=new $s,Ds=new $s;class Bl extends sn{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 R){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,d;this.closed||o>0?c=r[(o-1)%s]:(xr.subVectors(r[0],r[1]).add(r[0]),c=xr);const u=r[o%s],h=r[(o+1)%s];if(this.closed||o+2<s?d=r[(o+2)%s]:(xr.subVectors(r[s-1],r[s-2]).add(r[s-1]),d=xr),this.curveType==="centripetal"||this.curveType==="chordal"){const p=this.curveType==="chordal"?.5:.25;let _=Math.pow(c.distanceToSquared(u),p),x=Math.pow(u.distanceToSquared(h),p),m=Math.pow(h.distanceToSquared(d),p);x<1e-4&&(x=1),_<1e-4&&(_=x),m<1e-4&&(m=x),Es.initNonuniformCatmullRom(c.x,u.x,h.x,d.x,_,x,m),bs.initNonuniformCatmullRom(c.y,u.y,h.y,d.y,_,x,m),Ds.initNonuniformCatmullRom(c.z,u.z,h.z,d.z,_,x,m)}else this.curveType==="catmullrom"&&(Es.initCatmullRom(c.x,u.x,h.x,d.x,this.tension),bs.initCatmullRom(c.y,u.y,h.y,d.y,this.tension),Ds.initCatmullRom(c.z,u.z,h.z,d.z,this.tension));return n.set(Es.calc(l),bs.calc(l),Ds.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 R().fromArray(r))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}function Xo(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 d0(i,e){const t=1-i;return t*t*e}function f0(i,e){return 2*(1-i)*i*e}function p0(i,e){return i*i*e}function Li(i,e,t,n){return d0(i,e)+f0(i,t)+p0(i,n)}function m0(i,e){const t=1-i;return t*t*t*e}function g0(i,e){const t=1-i;return 3*t*t*i*e}function _0(i,e){return 3*(1-i)*i*i*e}function x0(i,e){return i*i*i*e}function Fi(i,e,t,n,r){return m0(i,e)+g0(i,t)+_0(i,n)+x0(i,r)}class v0 extends sn{constructor(e=new he,t=new he,n=new he,r=new he){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=n,this.v3=r}getPoint(e,t=new he){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 y0 extends sn{constructor(e=new R,t=new R,n=new R,r=new R){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=n,this.v3=r}getPoint(e,t=new R){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 M0 extends sn{constructor(e=new he,t=new he){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new he){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 he){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 S0 extends sn{constructor(e=new R,t=new R){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new R){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 R){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 E0 extends sn{constructor(e=new he,t=new he,n=new he){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new he){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 kl extends sn{constructor(e=new R,t=new R,n=new R){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new R){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 b0 extends sn{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new he){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],d=r[a>r.length-2?r.length-1:a+1],u=r[a>r.length-3?r.length-1:a+2];return n.set(Xo(o,l.x,c.x,d.x,u.x),Xo(o,l.y,c.y,d.y,u.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 he().fromArray(r))}return this}}var D0=Object.freeze({__proto__:null,ArcCurve:h0,CatmullRomCurve3:Bl,CubicBezierCurve:v0,CubicBezierCurve3:y0,EllipseCurve:zl,LineCurve:M0,LineCurve3:S0,QuadraticBezierCurve:E0,QuadraticBezierCurve3:kl,SplineCurve:b0});const vr=new R,yr=new R,Ts=new R,Mr=new Vt;class T0 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(fi*t),a=e.getIndex(),o=e.getAttribute("position"),l=a?a.count:o.count,c=[0,0,0],d=["a","b","c"],u=new Array(3),h={},p=[];for(let _=0;_<l;_+=3){a?(c[0]=a.getX(_),c[1]=a.getX(_+1),c[2]=a.getX(_+2)):(c[0]=_,c[1]=_+1,c[2]=_+2);const{a:x,b:m,c:f}=Mr;if(x.fromBufferAttribute(o,c[0]),m.fromBufferAttribute(o,c[1]),f.fromBufferAttribute(o,c[2]),Mr.getNormal(Ts),u[0]=`${Math.round(x.x*r)},${Math.round(x.y*r)},${Math.round(x.z*r)}`,u[1]=`${Math.round(m.x*r)},${Math.round(m.y*r)},${Math.round(m.z*r)}`,u[2]=`${Math.round(f.x*r)},${Math.round(f.y*r)},${Math.round(f.z*r)}`,!(u[0]===u[1]||u[1]===u[2]||u[2]===u[0]))for(let b=0;b<3;b++){const v=(b+1)%3,D=u[b],P=u[v],T=Mr[d[b]],w=Mr[d[v]],L=`${D}_${P}`,S=`${P}_${D}`;S in h&&h[S]?(Ts.dot(h[S].normal)<=s&&(p.push(T.x,T.y,T.z),p.push(w.x,w.y,w.z)),h[S]=null):L in h||(h[L]={index0:c[b],index1:c[v],normal:Ts.clone()})}}for(const _ in h)if(h[_]){const{index0:x,index1:m}=h[_];vr.fromBufferAttribute(o,x),yr.fromBufferAttribute(o,m),p.push(vr.x,vr.y,vr.z),p.push(yr.x,yr.y,yr.z)}this.setAttribute("position",new nt(p,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}class Ks 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=[],d=[];let u=e;const h=(t-e)/r,p=new R,_=new he;for(let x=0;x<=r;x++){for(let m=0;m<=n;m++){const f=s+m/n*a;p.x=u*Math.cos(f),p.y=u*Math.sin(f),l.push(p.x,p.y,p.z),c.push(0,0,1),_.x=(p.x/t+1)/2,_.y=(p.y/t+1)/2,d.push(_.x,_.y)}u+=h}for(let x=0;x<r;x++){const m=x*(n+1);for(let f=0;f<n;f++){const b=f+m,v=b,D=b+n+1,P=b+n+2,T=b+1;o.push(v,D,T),o.push(D,P,T)}}this.setIndex(o),this.setAttribute("position",new nt(l,3)),this.setAttribute("normal",new nt(c,3)),this.setAttribute("uv",new nt(d,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Ks(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}class Oi 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 d=[],u=new R,h=new R,p=[],_=[],x=[],m=[];for(let f=0;f<=n;f++){const b=[],v=f/n;let D=0;f===0&&a===0?D=.5/t:f===n&&l===Math.PI&&(D=-.5/t);for(let P=0;P<=t;P++){const T=P/t;u.x=-e*Math.cos(r+T*s)*Math.sin(a+v*o),u.y=e*Math.cos(a+v*o),u.z=e*Math.sin(r+T*s)*Math.sin(a+v*o),_.push(u.x,u.y,u.z),h.copy(u).normalize(),x.push(h.x,h.y,h.z),m.push(T+D,1-v),b.push(c++)}d.push(b)}for(let f=0;f<n;f++)for(let b=0;b<t;b++){const v=d[f][b+1],D=d[f][b],P=d[f+1][b],T=d[f+1][b+1];(f!==0||a>0)&&p.push(v,D,T),(f!==n-1||l<Math.PI)&&p.push(D,P,T)}this.setIndex(p),this.setAttribute("position",new nt(_,3)),this.setAttribute("normal",new nt(x,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 Oi(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class Zs extends _t{constructor(e=new kl(new R(-1,-1,0),new R(-1,1,0),new R(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 R,l=new R,c=new he;let d=new R;const u=[],h=[],p=[],_=[];x(),this.setIndex(_),this.setAttribute("position",new nt(u,3)),this.setAttribute("normal",new nt(h,3)),this.setAttribute("uv",new nt(p,2));function x(){for(let v=0;v<t;v++)m(v);m(s===!1?t:0),b(),f()}function m(v){d=e.getPointAt(v/t,d);const D=a.normals[v],P=a.binormals[v];for(let T=0;T<=r;T++){const w=T/r*Math.PI*2,L=Math.sin(w),S=-Math.cos(w);l.x=S*D.x+L*P.x,l.y=S*D.y+L*P.y,l.z=S*D.z+L*P.z,l.normalize(),h.push(l.x,l.y,l.z),o.x=d.x+n*l.x,o.y=d.y+n*l.y,o.z=d.z+n*l.z,u.push(o.x,o.y,o.z)}}function f(){for(let v=1;v<=t;v++)for(let D=1;D<=r;D++){const P=(r+1)*(v-1)+(D-1),T=(r+1)*v+(D-1),w=(r+1)*v+D,L=(r+1)*(v-1)+D;_.push(P,T,L),_.push(T,w,L)}}function b(){for(let v=0;v<=t;v++)for(let D=0;D<=r;D++)c.x=v/t,c.y=D/r,p.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 Zs(new D0[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}class Hl{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=jo(),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=jo();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function jo(){return(typeof performance>"u"?Date:performance).now()}class Yo{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:Ws}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Ws);const qo={type:"change"},As={type:"start"},$o={type:"end"},Sr=new Ir,Ko=new pn,A0=Math.cos(70*ml.DEG2RAD);class Vl extends zn{constructor(e,t){super(),this.object=e,this.domElement=t,this.domElement.style.touchAction="none",this.enabled=!0,this.target=new R,this.cursor=new R,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:Gn.ROTATE,MIDDLE:Gn.DOLLY,RIGHT:Gn.PAN},this.touches={ONE:Wn.ROTATE,TWO:Wn.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(g){g.addEventListener("keydown",fe),this._domElementKeyEvents=g},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(qo),n.update(),s=r.NONE},this.update=(function(){const g=new R,V=new In().setFromUnitVectors(e.up,new R(0,1,0)),Z=V.clone().invert(),oe=new R,pe=new In,Ve=new R,Be=2*Math.PI;return function(lt=null){const qe=n.object.position;g.copy(qe).sub(n.target),g.applyQuaternion(V),o.setFromVector3(g),n.autoRotate&&s===r.NONE&&I(y(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+=Be:it>Math.PI&&(it-=Be),rt<-Math.PI?rt+=Be:rt>Math.PI&&(rt-=Be),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(d,n.dampingFactor):n.target.add(d),n.target.sub(n.cursor),n.target.clampLength(n.minTargetRadius,n.maxTargetRadius),n.target.add(n.cursor);let At=!1;if(n.zoomToCursor&&T||n.object.isOrthographicCamera)o.radius=q(o.radius);else{const Ft=o.radius;o.radius=q(o.radius*c),At=Ft!=o.radius}if(g.setFromSpherical(o),g.applyQuaternion(Z),qe.copy(n.target).add(g),n.object.lookAt(n.target),n.enableDamping===!0?(l.theta*=1-n.dampingFactor,l.phi*=1-n.dampingFactor,d.multiplyScalar(1-n.dampingFactor)):(l.set(0,0,0),d.set(0,0,0)),n.zoomToCursor&&T){let Ft=null;if(n.object.isPerspectiveCamera){const an=g.length();Ft=q(an*c);const Bn=an-Ft;n.object.position.addScaledVector(D,Bn),n.object.updateMatrixWorld(),At=!!Bn}else if(n.object.isOrthographicCamera){const an=new R(P.x,P.y,0);an.unproject(n.object);const Bn=n.object.zoom;n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/c)),n.object.updateProjectionMatrix(),At=Bn!==n.object.zoom;const Sn=new R(P.x,P.y,0);Sn.unproject(n.object),n.object.position.sub(Sn).add(an),n.object.updateMatrixWorld(),Ft=g.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),n.zoomToCursor=!1;Ft!==null&&(this.screenSpacePanning?n.target.set(0,0,-1).transformDirection(n.object.matrix).multiplyScalar(Ft).add(n.object.position):(Sr.origin.copy(n.object.position),Sr.direction.set(0,0,-1).transformDirection(n.object.matrix),Math.abs(n.object.up.dot(Sr.direction))<A0?e.lookAt(n.target):(Ko.setFromNormalAndCoplanarPoint(n.object.up,n.target),Sr.intersectPlane(Ko,n.target))))}else if(n.object.isOrthographicCamera){const Ft=n.object.zoom;n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/c)),Ft!==n.object.zoom&&(n.object.updateProjectionMatrix(),At=!0)}return c=1,T=!1,At||oe.distanceToSquared(n.object.position)>a||8*(1-pe.dot(n.object.quaternion))>a||Ve.distanceToSquared(n.target)>a?(n.dispatchEvent(qo),oe.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",Y),n.domElement.removeEventListener("pointercancel",ne),n.domElement.removeEventListener("wheel",ae),n.domElement.removeEventListener("pointermove",J),n.domElement.removeEventListener("pointerup",ne),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 Yo,l=new Yo;let c=1;const d=new R,u=new he,h=new he,p=new he,_=new he,x=new he,m=new he,f=new he,b=new he,v=new he,D=new R,P=new he;let T=!1;const w=[],L={};let S=!1;function y(g){return g!==null?2*Math.PI/60*n.autoRotateSpeed*g:2*Math.PI/60/60*n.autoRotateSpeed}function U(g){const V=Math.abs(g*.01);return Math.pow(.95,n.zoomSpeed*V)}function I(g){l.theta-=g}function C(g){l.phi-=g}const k=(function(){const g=new R;return function(Z,oe){g.setFromMatrixColumn(oe,0),g.multiplyScalar(-Z),d.add(g)}})(),G=(function(){const g=new R;return function(Z,oe){n.screenSpacePanning===!0?g.setFromMatrixColumn(oe,1):(g.setFromMatrixColumn(oe,0),g.crossVectors(n.object.up,g)),g.multiplyScalar(Z),d.add(g)}})(),$=(function(){const g=new R;return function(Z,oe){const pe=n.domElement;if(n.object.isPerspectiveCamera){const Ve=n.object.position;g.copy(Ve).sub(n.target);let Be=g.length();Be*=Math.tan(n.object.fov/2*Math.PI/180),k(2*Z*Be/pe.clientHeight,n.object.matrix),G(2*oe*Be/pe.clientHeight,n.object.matrix)}else n.object.isOrthographicCamera?(k(Z*(n.object.right-n.object.left)/n.object.zoom/pe.clientWidth,n.object.matrix),G(oe*(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 te(g){n.object.isPerspectiveCamera||n.object.isOrthographicCamera?c/=g:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function B(g){n.object.isPerspectiveCamera||n.object.isOrthographicCamera?c*=g:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function K(g,V){if(!n.zoomToCursor)return;T=!0;const Z=n.domElement.getBoundingClientRect(),oe=g-Z.left,pe=V-Z.top,Ve=Z.width,Be=Z.height;P.x=oe/Ve*2-1,P.y=-(pe/Be)*2+1,D.set(P.x,P.y,1).unproject(n.object).sub(n.object.position).normalize()}function q(g){return Math.max(n.minDistance,Math.min(n.maxDistance,g))}function F(g){u.set(g.clientX,g.clientY)}function ee(g){K(g.clientX,g.clientX),f.set(g.clientX,g.clientY)}function me(g){_.set(g.clientX,g.clientY)}function N(g){h.set(g.clientX,g.clientY),p.subVectors(h,u).multiplyScalar(n.rotateSpeed);const V=n.domElement;I(2*Math.PI*p.x/V.clientHeight),C(2*Math.PI*p.y/V.clientHeight),u.copy(h),n.update()}function Q(g){b.set(g.clientX,g.clientY),v.subVectors(b,f),v.y>0?te(U(v.y)):v.y<0&&B(U(v.y)),f.copy(b),n.update()}function ue(g){x.set(g.clientX,g.clientY),m.subVectors(x,_).multiplyScalar(n.panSpeed),$(m.x,m.y),_.copy(x),n.update()}function ie(g){K(g.clientX,g.clientY),g.deltaY<0?B(U(g.deltaY)):g.deltaY>0&&te(U(g.deltaY)),n.update()}function ve(g){let V=!1;switch(g.code){case n.keys.UP:g.ctrlKey||g.metaKey||g.shiftKey?C(2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):$(0,n.keyPanSpeed),V=!0;break;case n.keys.BOTTOM:g.ctrlKey||g.metaKey||g.shiftKey?C(-2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):$(0,-n.keyPanSpeed),V=!0;break;case n.keys.LEFT:g.ctrlKey||g.metaKey||g.shiftKey?I(2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):$(n.keyPanSpeed,0),V=!0;break;case n.keys.RIGHT:g.ctrlKey||g.metaKey||g.shiftKey?I(-2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):$(-n.keyPanSpeed,0),V=!0;break}V&&(g.preventDefault(),n.update())}function De(g){if(w.length===1)u.set(g.pageX,g.pageY);else{const V=Ye(g),Z=.5*(g.pageX+V.x),oe=.5*(g.pageY+V.y);u.set(Z,oe)}}function Ce(g){if(w.length===1)_.set(g.pageX,g.pageY);else{const V=Ye(g),Z=.5*(g.pageX+V.x),oe=.5*(g.pageY+V.y);_.set(Z,oe)}}function H(g){const V=Ye(g),Z=g.pageX-V.x,oe=g.pageY-V.y,pe=Math.sqrt(Z*Z+oe*oe);f.set(0,pe)}function Fe(g){n.enableZoom&&H(g),n.enablePan&&Ce(g)}function xe(g){n.enableZoom&&H(g),n.enableRotate&&De(g)}function Ge(g){if(w.length==1)h.set(g.pageX,g.pageY);else{const Z=Ye(g),oe=.5*(g.pageX+Z.x),pe=.5*(g.pageY+Z.y);h.set(oe,pe)}p.subVectors(h,u).multiplyScalar(n.rotateSpeed);const V=n.domElement;I(2*Math.PI*p.x/V.clientHeight),C(2*Math.PI*p.y/V.clientHeight),u.copy(h)}function Ee(g){if(w.length===1)x.set(g.pageX,g.pageY);else{const V=Ye(g),Z=.5*(g.pageX+V.x),oe=.5*(g.pageY+V.y);x.set(Z,oe)}m.subVectors(x,_).multiplyScalar(n.panSpeed),$(m.x,m.y),_.copy(x)}function We(g){const V=Ye(g),Z=g.pageX-V.x,oe=g.pageY-V.y,pe=Math.sqrt(Z*Z+oe*oe);b.set(0,pe),v.set(0,Math.pow(b.y/f.y,n.zoomSpeed)),te(v.y),f.copy(b);const Ve=(g.pageX+V.x)*.5,Be=(g.pageY+V.y)*.5;K(Ve,Be)}function A(g){n.enableZoom&&We(g),n.enablePan&&Ee(g)}function M(g){n.enableZoom&&We(g),n.enableRotate&&Ge(g)}function Y(g){n.enabled!==!1&&(w.length===0&&(n.domElement.setPointerCapture(g.pointerId),n.domElement.addEventListener("pointermove",J),n.domElement.addEventListener("pointerup",ne)),!je(g)&&(ke(g),g.pointerType==="touch"?Re(g):re(g)))}function J(g){n.enabled!==!1&&(g.pointerType==="touch"?ge(g):Te(g))}function ne(g){switch(He(g),w.length){case 0:n.domElement.releasePointerCapture(g.pointerId),n.domElement.removeEventListener("pointermove",J),n.domElement.removeEventListener("pointerup",ne),n.dispatchEvent($o),s=r.NONE;break;case 1:const V=w[0],Z=L[V];Re({pointerId:V,pageX:Z.x,pageY:Z.y});break}}function re(g){let V;switch(g.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 Gn.DOLLY:if(n.enableZoom===!1)return;ee(g),s=r.DOLLY;break;case Gn.ROTATE:if(g.ctrlKey||g.metaKey||g.shiftKey){if(n.enablePan===!1)return;me(g),s=r.PAN}else{if(n.enableRotate===!1)return;F(g),s=r.ROTATE}break;case Gn.PAN:if(g.ctrlKey||g.metaKey||g.shiftKey){if(n.enableRotate===!1)return;F(g),s=r.ROTATE}else{if(n.enablePan===!1)return;me(g),s=r.PAN}break;default:s=r.NONE}s!==r.NONE&&n.dispatchEvent(As)}function Te(g){switch(s){case r.ROTATE:if(n.enableRotate===!1)return;N(g);break;case r.DOLLY:if(n.enableZoom===!1)return;Q(g);break;case r.PAN:if(n.enablePan===!1)return;ue(g);break}}function ae(g){n.enabled===!1||n.enableZoom===!1||s!==r.NONE||(g.preventDefault(),n.dispatchEvent(As),ie(Se(g)),n.dispatchEvent($o))}function Se(g){const V=g.deltaMode,Z={clientX:g.clientX,clientY:g.clientY,deltaY:g.deltaY};switch(V){case 1:Z.deltaY*=16;break;case 2:Z.deltaY*=100;break}return g.ctrlKey&&!S&&(Z.deltaY*=10),Z}function Ae(g){g.key==="Control"&&(S=!0,n.domElement.getRootNode().addEventListener("keyup",le,{passive:!0,capture:!0}))}function le(g){g.key==="Control"&&(S=!1,n.domElement.getRootNode().removeEventListener("keyup",le,{passive:!0,capture:!0}))}function fe(g){n.enabled===!1||n.enablePan===!1||ve(g)}function Re(g){switch(Xe(g),w.length){case 1:switch(n.touches.ONE){case Wn.ROTATE:if(n.enableRotate===!1)return;De(g),s=r.TOUCH_ROTATE;break;case Wn.PAN:if(n.enablePan===!1)return;Ce(g),s=r.TOUCH_PAN;break;default:s=r.NONE}break;case 2:switch(n.touches.TWO){case Wn.DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;Fe(g),s=r.TOUCH_DOLLY_PAN;break;case Wn.DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;xe(g),s=r.TOUCH_DOLLY_ROTATE;break;default:s=r.NONE}break;default:s=r.NONE}s!==r.NONE&&n.dispatchEvent(As)}function ge(g){switch(Xe(g),s){case r.TOUCH_ROTATE:if(n.enableRotate===!1)return;Ge(g),n.update();break;case r.TOUCH_PAN:if(n.enablePan===!1)return;Ee(g),n.update();break;case r.TOUCH_DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;A(g),n.update();break;case r.TOUCH_DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;M(g),n.update();break;default:s=r.NONE}}function _e(g){n.enabled!==!1&&g.preventDefault()}function ke(g){w.push(g.pointerId)}function He(g){delete L[g.pointerId];for(let V=0;V<w.length;V++)if(w[V]==g.pointerId){w.splice(V,1);return}}function je(g){for(let V=0;V<w.length;V++)if(w[V]==g.pointerId)return!0;return!1}function Xe(g){let V=L[g.pointerId];V===void 0&&(V=new he,L[g.pointerId]=V),V.set(g.pageX,g.pageY)}function Ye(g){const V=g.pointerId===w[0]?w[1]:w[0];return L[V]}n.domElement.addEventListener("contextmenu",_e),n.domElement.addEventListener("pointerdown",Y),n.domElement.addEventListener("pointercancel",ne),n.domElement.addEventListener("wheel",ae,{passive:!1}),n.domElement.getRootNode().addEventListener("keydown",Ae,{passive:!0,capture:!0}),this.update()}}const Gl={name:"CopyShader",uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:`
|
|
3800
|
+
}`;class qm{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,n){if(this.texture===null){const r=new Dt,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:Ym,fragmentShader:jm,uniforms:{depthColor:{value:this.texture},depthWidth:{value:n.z},depthHeight:{value:n.w}}});this.mesh=new bt(new Nr(20,20),r)}e.render(this.mesh,t)}}reset(){this.texture=null,this.mesh=null}}class $m extends In{constructor(e,t){super();const n=this;let r=null,s=1,a=null,o="local-floor",l=1,c=null,h=null,d=null,u=null,p=null,_=null;const v=new qm,m=t.getContextAttributes();let f=null,b=null;const x=[],D=[],P=new ue;let T=null;const w=new Rt;w.layers.enable(1),w.viewport=new dt;const L=new Rt;L.layers.enable(2),L.viewport=new dt;const E=[w,L],M=new Wm;M.layers.enable(1),M.layers.enable(2);let N=null,I=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(U){let J=x[U];return J===void 0&&(J=new xs,x[U]=J),J.getTargetRaySpace()},this.getControllerGrip=function(U){let J=x[U];return J===void 0&&(J=new xs,x[U]=J),J.getGripSpace()},this.getHand=function(U){let J=x[U];return J===void 0&&(J=new xs,x[U]=J),J.getHandSpace()};function C(U){const J=D.indexOf(U.inputSource);if(J===-1)return;const le=x[J];le!==void 0&&(le.update(U.inputSource,U.frame,c||a),le.dispatchEvent({type:U.type,data:U.inputSource}))}function z(){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",z),r.removeEventListener("inputsourceschange",V);for(let U=0;U<x.length;U++){const J=D[U];J!==null&&(D[U]=null,x[U].disconnect(J))}N=null,I=null,v.reset(),e.setRenderTarget(f),p=null,u=null,d=null,r=null,b=null,pe.stop(),n.isPresenting=!1,e.setPixelRatio(T),e.setSize(P.width,P.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(U){s=U,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(U){o=U,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||a},this.setReferenceSpace=function(U){c=U},this.getBaseLayer=function(){return u!==null?u:p},this.getBinding=function(){return d},this.getFrame=function(){return _},this.getSession=function(){return r},this.setSession=async function(U){if(r=U,r!==null){if(f=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",z),r.addEventListener("inputsourceschange",V),m.xrCompatible!==!0&&await t.makeXRCompatible(),T=e.getPixelRatio(),e.getSize(P),r.renderState.layers===void 0){const J={antialias:m.antialias,alpha:!0,depth:m.depth,stencil:m.stencil,framebufferScaleFactor:s};p=new XRWebGLLayer(r,t,J),r.updateRenderState({baseLayer:p}),e.setPixelRatio(1),e.setSize(p.framebufferWidth,p.framebufferHeight,!1),b=new Ht(p.framebufferWidth,p.framebufferHeight,{format:Xt,type:gn,colorSpace:e.outputColorSpace,stencilBuffer:m.stencil})}else{let J=null,le=null,ne=null;m.depth&&(ne=m.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,J=m.stencil?Fi:ui,le=m.stencil?Ii:mi);const xe={colorFormat:t.RGBA8,depthFormat:ne,scaleFactor:s};d=new XRWebGLBinding(r,t),u=d.createProjectionLayer(xe),r.updateRenderState({layers:[u]}),e.setPixelRatio(1),e.setSize(u.textureWidth,u.textureHeight,!1),b=new Ht(u.textureWidth,u.textureHeight,{format:Xt,type:gn,depthTexture:new Al(u.textureWidth,u.textureHeight,le,void 0,void 0,void 0,void 0,void 0,void 0,J),stencilBuffer:m.stencil,colorSpace:e.outputColorSpace,samples:m.antialias?4:0});const De=e.properties.get(b);De.__ignoreDepthValues=u.ignoreDepthValues}b.isXRRenderTarget=!0,this.setFoveation(l),c=null,a=await r.requestReferenceSpace(o),pe.setContext(r),pe.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(r!==null)return r.environmentBlendMode};function V(U){for(let J=0;J<U.removed.length;J++){const le=U.removed[J],ne=D.indexOf(le);ne>=0&&(D[ne]=null,x[ne].disconnect(le))}for(let J=0;J<U.added.length;J++){const le=U.added[J];let ne=D.indexOf(le);if(ne===-1){for(let De=0;De<x.length;De++)if(De>=D.length){D.push(le),ne=De;break}else if(D[De]===null){D[De]=le,ne=De;break}if(ne===-1)break}const xe=x[ne];xe&&xe.connect(le)}}const q=new R,ee=new R;function B(U,J,le){q.setFromMatrixPosition(J.matrixWorld),ee.setFromMatrixPosition(le.matrixWorld);const ne=q.distanceTo(ee),xe=J.projectionMatrix.elements,De=le.projectionMatrix.elements,Ce=xe[14]/(xe[10]-1),k=xe[14]/(xe[10]+1),Fe=(xe[9]+1)/xe[5],ve=(xe[9]-1)/xe[5],Ge=(xe[8]-1)/xe[0],ye=(De[8]+1)/De[0],We=Ce*Ge,A=Ce*ye,S=ne/(-Ge+ye),Y=S*-Ge;J.matrixWorld.decompose(U.position,U.quaternion,U.scale),U.translateX(Y),U.translateZ(S),U.matrixWorld.compose(U.position,U.quaternion,U.scale),U.matrixWorldInverse.copy(U.matrixWorld).invert();const Z=Ce+S,te=k+S,ie=We-Y,Te=A+(ne-Y),re=Fe*k/te*Z,Ee=ve*k/te*Z;U.projectionMatrix.makePerspective(ie,Te,re,Ee,Z,te),U.projectionMatrixInverse.copy(U.projectionMatrix).invert()}function $(U,J){J===null?U.matrixWorld.copy(U.matrix):U.matrixWorld.multiplyMatrices(J.matrixWorld,U.matrix),U.matrixWorldInverse.copy(U.matrixWorld).invert()}this.updateCamera=function(U){if(r===null)return;v.texture!==null&&(U.near=v.depthNear,U.far=v.depthFar),M.near=L.near=w.near=U.near,M.far=L.far=w.far=U.far,(N!==M.near||I!==M.far)&&(r.updateRenderState({depthNear:M.near,depthFar:M.far}),N=M.near,I=M.far,w.near=N,w.far=I,L.near=N,L.far=I,w.updateProjectionMatrix(),L.updateProjectionMatrix(),U.updateProjectionMatrix());const J=U.parent,le=M.cameras;$(M,J);for(let ne=0;ne<le.length;ne++)$(le[ne],J);le.length===2?B(M,w,L):M.projectionMatrix.copy(w.projectionMatrix),j(U,M,J)};function j(U,J,le){le===null?U.matrix.copy(J.matrixWorld):(U.matrix.copy(le.matrixWorld),U.matrix.invert(),U.matrix.multiply(J.matrixWorld)),U.matrix.decompose(U.position,U.quaternion,U.scale),U.updateMatrixWorld(!0),U.projectionMatrix.copy(J.projectionMatrix),U.projectionMatrixInverse.copy(J.projectionMatrixInverse),U.isPerspectiveCamera&&(U.fov=Ui*2*Math.atan(1/U.projectionMatrix.elements[5]),U.zoom=1)}this.getCamera=function(){return M},this.getFoveation=function(){if(!(u===null&&p===null))return l},this.setFoveation=function(U){l=U,u!==null&&(u.fixedFoveation=U),p!==null&&p.fixedFoveation!==void 0&&(p.fixedFoveation=U)},this.hasDepthSensing=function(){return v.texture!==null};let F=null;function Q(U,J){if(h=J.getViewerPose(c||a),_=J,h!==null){const le=h.views;p!==null&&(e.setRenderTargetFramebuffer(b,p.framebuffer),e.setRenderTarget(b));let ne=!1;le.length!==M.cameras.length&&(M.cameras.length=0,ne=!0);for(let De=0;De<le.length;De++){const Ce=le[De];let k=null;if(p!==null)k=p.getViewport(Ce);else{const ve=d.getViewSubImage(u,Ce);k=ve.viewport,De===0&&(e.setRenderTargetTextures(b,ve.colorTexture,u.ignoreDepthValues?void 0:ve.depthStencilTexture),e.setRenderTarget(b))}let Fe=E[De];Fe===void 0&&(Fe=new Rt,Fe.layers.enable(De),Fe.viewport=new dt,E[De]=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),De===0&&(M.matrix.copy(Fe.matrix),M.matrix.decompose(M.position,M.quaternion,M.scale)),ne===!0&&M.cameras.push(Fe)}const xe=r.enabledFeatures;if(xe&&xe.includes("depth-sensing")){const De=d.getDepthInformation(le[0]);De&&De.isValid&&De.texture&&v.init(e,De,r.renderState)}}for(let le=0;le<x.length;le++){const ne=D[le],xe=x[le];ne!==null&&xe!==void 0&&xe.update(ne,J,c||a)}v.render(e,M),F&&F(U,J),J.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:J}),_=null}const pe=new Dl;pe.setAnimationLoop(Q),this.setAnimationLoop=function(U){F=U},this.dispose=function(){}}}const An=new tn,Km=new et;function Zm(i,e){function t(m,f){m.matrixAutoUpdate===!0&&m.updateMatrix(),f.value.copy(m.matrix)}function n(m,f){f.color.getRGB(m.fogColor.value,Sl(i)),f.isFog?(m.fogNear.value=f.near,m.fogFar.value=f.far):f.isFogExp2&&(m.fogDensity.value=f.density)}function r(m,f,b,x,D){f.isMeshBasicMaterial||f.isMeshLambertMaterial?s(m,f):f.isMeshToonMaterial?(s(m,f),d(m,f)):f.isMeshPhongMaterial?(s(m,f),h(m,f)):f.isMeshStandardMaterial?(s(m,f),u(m,f),f.isMeshPhysicalMaterial&&p(m,f,D)):f.isMeshMatcapMaterial?(s(m,f),_(m,f)):f.isMeshDepthMaterial?s(m,f):f.isMeshDistanceMaterial?(s(m,f),v(m,f)):f.isMeshNormalMaterial?s(m,f):f.isLineBasicMaterial?(a(m,f),f.isLineDashedMaterial&&o(m,f)):f.isPointsMaterial?l(m,f,b,x):f.isSpriteMaterial?c(m,f):f.isShadowMaterial?(m.color.value.copy(f.color),m.opacity.value=f.opacity):f.isShaderMaterial&&(f.uniformsNeedUpdate=!1)}function s(m,f){m.opacity.value=f.opacity,f.color&&m.diffuse.value.copy(f.color),f.emissive&&m.emissive.value.copy(f.emissive).multiplyScalar(f.emissiveIntensity),f.map&&(m.map.value=f.map,t(f.map,m.mapTransform)),f.alphaMap&&(m.alphaMap.value=f.alphaMap,t(f.alphaMap,m.alphaMapTransform)),f.bumpMap&&(m.bumpMap.value=f.bumpMap,t(f.bumpMap,m.bumpMapTransform),m.bumpScale.value=f.bumpScale,f.side===Mt&&(m.bumpScale.value*=-1)),f.normalMap&&(m.normalMap.value=f.normalMap,t(f.normalMap,m.normalMapTransform),m.normalScale.value.copy(f.normalScale),f.side===Mt&&m.normalScale.value.negate()),f.displacementMap&&(m.displacementMap.value=f.displacementMap,t(f.displacementMap,m.displacementMapTransform),m.displacementScale.value=f.displacementScale,m.displacementBias.value=f.displacementBias),f.emissiveMap&&(m.emissiveMap.value=f.emissiveMap,t(f.emissiveMap,m.emissiveMapTransform)),f.specularMap&&(m.specularMap.value=f.specularMap,t(f.specularMap,m.specularMapTransform)),f.alphaTest>0&&(m.alphaTest.value=f.alphaTest);const b=e.get(f),x=b.envMap,D=b.envMapRotation;if(x&&(m.envMap.value=x,An.copy(D),An.x*=-1,An.y*=-1,An.z*=-1,x.isCubeTexture&&x.isRenderTargetTexture===!1&&(An.y*=-1,An.z*=-1),m.envMapRotation.value.setFromMatrix4(Km.makeRotationFromEuler(An)),m.flipEnvMap.value=x.isCubeTexture&&x.isRenderTargetTexture===!1?-1:1,m.reflectivity.value=f.reflectivity,m.ior.value=f.ior,m.refractionRatio.value=f.refractionRatio),f.lightMap){m.lightMap.value=f.lightMap;const P=i._useLegacyLights===!0?Math.PI:1;m.lightMapIntensity.value=f.lightMapIntensity*P,t(f.lightMap,m.lightMapTransform)}f.aoMap&&(m.aoMap.value=f.aoMap,m.aoMapIntensity.value=f.aoMapIntensity,t(f.aoMap,m.aoMapTransform))}function a(m,f){m.diffuse.value.copy(f.color),m.opacity.value=f.opacity,f.map&&(m.map.value=f.map,t(f.map,m.mapTransform))}function o(m,f){m.dashSize.value=f.dashSize,m.totalSize.value=f.dashSize+f.gapSize,m.scale.value=f.scale}function l(m,f,b,x){m.diffuse.value.copy(f.color),m.opacity.value=f.opacity,m.size.value=f.size*b,m.scale.value=x*.5,f.map&&(m.map.value=f.map,t(f.map,m.uvTransform)),f.alphaMap&&(m.alphaMap.value=f.alphaMap,t(f.alphaMap,m.alphaMapTransform)),f.alphaTest>0&&(m.alphaTest.value=f.alphaTest)}function c(m,f){m.diffuse.value.copy(f.color),m.opacity.value=f.opacity,m.rotation.value=f.rotation,f.map&&(m.map.value=f.map,t(f.map,m.mapTransform)),f.alphaMap&&(m.alphaMap.value=f.alphaMap,t(f.alphaMap,m.alphaMapTransform)),f.alphaTest>0&&(m.alphaTest.value=f.alphaTest)}function h(m,f){m.specular.value.copy(f.specular),m.shininess.value=Math.max(f.shininess,1e-4)}function d(m,f){f.gradientMap&&(m.gradientMap.value=f.gradientMap)}function u(m,f){m.metalness.value=f.metalness,f.metalnessMap&&(m.metalnessMap.value=f.metalnessMap,t(f.metalnessMap,m.metalnessMapTransform)),m.roughness.value=f.roughness,f.roughnessMap&&(m.roughnessMap.value=f.roughnessMap,t(f.roughnessMap,m.roughnessMapTransform)),f.envMap&&(m.envMapIntensity.value=f.envMapIntensity)}function p(m,f,b){m.ior.value=f.ior,f.sheen>0&&(m.sheenColor.value.copy(f.sheenColor).multiplyScalar(f.sheen),m.sheenRoughness.value=f.sheenRoughness,f.sheenColorMap&&(m.sheenColorMap.value=f.sheenColorMap,t(f.sheenColorMap,m.sheenColorMapTransform)),f.sheenRoughnessMap&&(m.sheenRoughnessMap.value=f.sheenRoughnessMap,t(f.sheenRoughnessMap,m.sheenRoughnessMapTransform))),f.clearcoat>0&&(m.clearcoat.value=f.clearcoat,m.clearcoatRoughness.value=f.clearcoatRoughness,f.clearcoatMap&&(m.clearcoatMap.value=f.clearcoatMap,t(f.clearcoatMap,m.clearcoatMapTransform)),f.clearcoatRoughnessMap&&(m.clearcoatRoughnessMap.value=f.clearcoatRoughnessMap,t(f.clearcoatRoughnessMap,m.clearcoatRoughnessMapTransform)),f.clearcoatNormalMap&&(m.clearcoatNormalMap.value=f.clearcoatNormalMap,t(f.clearcoatNormalMap,m.clearcoatNormalMapTransform),m.clearcoatNormalScale.value.copy(f.clearcoatNormalScale),f.side===Mt&&m.clearcoatNormalScale.value.negate())),f.iridescence>0&&(m.iridescence.value=f.iridescence,m.iridescenceIOR.value=f.iridescenceIOR,m.iridescenceThicknessMinimum.value=f.iridescenceThicknessRange[0],m.iridescenceThicknessMaximum.value=f.iridescenceThicknessRange[1],f.iridescenceMap&&(m.iridescenceMap.value=f.iridescenceMap,t(f.iridescenceMap,m.iridescenceMapTransform)),f.iridescenceThicknessMap&&(m.iridescenceThicknessMap.value=f.iridescenceThicknessMap,t(f.iridescenceThicknessMap,m.iridescenceThicknessMapTransform))),f.transmission>0&&(m.transmission.value=f.transmission,m.transmissionSamplerMap.value=b.texture,m.transmissionSamplerSize.value.set(b.width,b.height),f.transmissionMap&&(m.transmissionMap.value=f.transmissionMap,t(f.transmissionMap,m.transmissionMapTransform)),m.thickness.value=f.thickness,f.thicknessMap&&(m.thicknessMap.value=f.thicknessMap,t(f.thicknessMap,m.thicknessMapTransform)),m.attenuationDistance.value=f.attenuationDistance,m.attenuationColor.value.copy(f.attenuationColor)),f.anisotropy>0&&(m.anisotropyVector.value.set(f.anisotropy*Math.cos(f.anisotropyRotation),f.anisotropy*Math.sin(f.anisotropyRotation)),f.anisotropyMap&&(m.anisotropyMap.value=f.anisotropyMap,t(f.anisotropyMap,m.anisotropyMapTransform))),m.specularIntensity.value=f.specularIntensity,m.specularColor.value.copy(f.specularColor),f.specularColorMap&&(m.specularColorMap.value=f.specularColorMap,t(f.specularColorMap,m.specularColorMapTransform)),f.specularIntensityMap&&(m.specularIntensityMap.value=f.specularIntensityMap,t(f.specularIntensityMap,m.specularIntensityMapTransform))}function _(m,f){f.matcap&&(m.matcap.value=f.matcap)}function v(m,f){const b=e.get(f).light;m.referencePosition.value.setFromMatrixPosition(b.matrixWorld),m.nearDistance.value=b.shadow.camera.near,m.farDistance.value=b.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:r}}function Jm(i,e,t,n){let r={},s={},a=[];const o=i.getParameter(i.MAX_UNIFORM_BUFFER_BINDINGS);function l(b,x){const D=x.program;n.uniformBlockBinding(b,D)}function c(b,x){let D=r[b.id];D===void 0&&(_(b),D=h(b),r[b.id]=D,b.addEventListener("dispose",m));const P=x.program;n.updateUBOMapping(b,P);const T=e.render.frame;s[b.id]!==T&&(u(b),s[b.id]=T)}function h(b){const x=d();b.__bindingPointIndex=x;const D=i.createBuffer(),P=b.__size,T=b.usage;return i.bindBuffer(i.UNIFORM_BUFFER,D),i.bufferData(i.UNIFORM_BUFFER,P,T),i.bindBuffer(i.UNIFORM_BUFFER,null),i.bindBufferBase(i.UNIFORM_BUFFER,x,D),D}function d(){for(let b=0;b<o;b++)if(a.indexOf(b)===-1)return a.push(b),b;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function u(b){const x=r[b.id],D=b.uniforms,P=b.__cache;i.bindBuffer(i.UNIFORM_BUFFER,x);for(let T=0,w=D.length;T<w;T++){const L=Array.isArray(D[T])?D[T]:[D[T]];for(let E=0,M=L.length;E<M;E++){const N=L[E];if(p(N,T,E,P)===!0){const I=N.__offset,C=Array.isArray(N.value)?N.value:[N.value];let z=0;for(let V=0;V<C.length;V++){const q=C[V],ee=v(q);typeof q=="number"||typeof q=="boolean"?(N.__data[0]=q,i.bufferSubData(i.UNIFORM_BUFFER,I+z,N.__data)):q.isMatrix3?(N.__data[0]=q.elements[0],N.__data[1]=q.elements[1],N.__data[2]=q.elements[2],N.__data[3]=0,N.__data[4]=q.elements[3],N.__data[5]=q.elements[4],N.__data[6]=q.elements[5],N.__data[7]=0,N.__data[8]=q.elements[6],N.__data[9]=q.elements[7],N.__data[10]=q.elements[8],N.__data[11]=0):(q.toArray(N.__data,z),z+=ee.storage/Float32Array.BYTES_PER_ELEMENT)}i.bufferSubData(i.UNIFORM_BUFFER,I,N.__data)}}}i.bindBuffer(i.UNIFORM_BUFFER,null)}function p(b,x,D,P){const T=b.value,w=x+"_"+D;if(P[w]===void 0)return typeof T=="number"||typeof T=="boolean"?P[w]=T:P[w]=T.clone(),!0;{const L=P[w];if(typeof T=="number"||typeof T=="boolean"){if(L!==T)return P[w]=T,!0}else if(L.equals(T)===!1)return L.copy(T),!0}return!1}function _(b){const x=b.uniforms;let D=0;const P=16;for(let w=0,L=x.length;w<L;w++){const E=Array.isArray(x[w])?x[w]:[x[w]];for(let M=0,N=E.length;M<N;M++){const I=E[M],C=Array.isArray(I.value)?I.value:[I.value];for(let z=0,V=C.length;z<V;z++){const q=C[z],ee=v(q),B=D%P;B!==0&&P-B<ee.boundary&&(D+=P-B),I.__data=new Float32Array(ee.storage/Float32Array.BYTES_PER_ELEMENT),I.__offset=D,D+=ee.storage}}}const T=D%P;return T>0&&(D+=P-T),b.__size=D,b.__cache={},this}function v(b){const x={boundary:0,storage:0};return typeof b=="number"||typeof b=="boolean"?(x.boundary=4,x.storage=4):b.isVector2?(x.boundary=8,x.storage=8):b.isVector3||b.isColor?(x.boundary=16,x.storage=12):b.isVector4?(x.boundary=16,x.storage=16):b.isMatrix3?(x.boundary=48,x.storage=48):b.isMatrix4?(x.boundary=64,x.storage=64):b.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",b),x}function m(b){const x=b.target;x.removeEventListener("dispose",m);const D=a.indexOf(x.__bindingPointIndex);a.splice(D,1),i.deleteBuffer(r[x.id]),delete r[x.id],delete s[x.id]}function f(){for(const b in r)i.deleteBuffer(r[b]);a=[],r={},s={}}return{bind:l,update:c,dispose:f}}class Fl{constructor(e={}){const{canvas:t=Wu(),context:n=null,depth:r=!0,stencil:s=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:h="default",failIfMajorPerformanceCaveat:d=!1}=e;this.isWebGLRenderer=!0;let u;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");u=n.getContextAttributes().alpha}else u=a;const p=new Uint32Array(4),_=new Int32Array(4);let v=null,m=null;const f=[],b=[];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=Ut,this._useLegacyLights=!1,this.toneMapping=mn,this.toneMappingExposure=1;const x=this;let D=!1,P=0,T=0,w=null,L=-1,E=null;const M=new dt,N=new dt;let I=null;const C=new be(0);let z=0,V=t.width,q=t.height,ee=1,B=null,$=null;const j=new dt(0,0,V,q),F=new dt(0,0,V,q);let Q=!1;const pe=new bl;let U=!1,J=!1;const le=new et,ne=new ue,xe=new R,De={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function Ce(){return w===null?ee:1}let k=n;function Fe(y,O){const W=t.getContext(y,O);return W!==null?W:null}try{const y={alpha:!0,depth:r,stencil:s,antialias:o,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:h,failIfMajorPerformanceCaveat:d};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${Vs}`),t.addEventListener("webglcontextlost",H,!1),t.addEventListener("webglcontextrestored",K,!1),t.addEventListener("webglcontextcreationerror",se,!1),k===null){const O="webgl2";if(k=Fe(O,y),k===null)throw Fe(O)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(y){throw console.error("THREE.WebGLRenderer: "+y.message),y}let ve,Ge,ye,We,A,S,Y,Z,te,ie,Te,re,Ee,Ae,ae,de,Re,ge,_e,ke,He,Ye,Xe,je;function Me(){ve=new op(k),ve.init(),Ge=new tp(k,ve,e),Ye=new Gm(k,ve),ye=new Hm(k),We=new up(k),A=new Am,S=new Vm(k,ve,ye,A,Ge,Ye,We),Y=new ip(x),Z=new ap(x),te=new mh(k),Xe=new Qf(k,te),ie=new lp(k,te,We,Xe),Te=new dp(k,ie,te,We),_e=new hp(k,Ge,S),de=new np(A),re=new Tm(x,Y,Z,ve,Ge,Xe,de),Ee=new Zm(x,A),Ae=new Cm,ae=new Nm(ve),ge=new Jf(x,Y,Z,ye,Te,u,l),Re=new km(x,Te,Ge),je=new Jm(k,We,Ge,ye),ke=new ep(k,ve,We),He=new cp(k,ve,We),We.programs=re.programs,x.capabilities=Ge,x.extensions=ve,x.properties=A,x.renderLists=Ae,x.shadowMap=Re,x.state=ye,x.info=We}Me();const g=new $m(x,k);this.xr=g,this.getContext=function(){return k},this.getContextAttributes=function(){return k.getContextAttributes()},this.forceContextLoss=function(){const y=ve.get("WEBGL_lose_context");y&&y.loseContext()},this.forceContextRestore=function(){const y=ve.get("WEBGL_lose_context");y&&y.restoreContext()},this.getPixelRatio=function(){return ee},this.setPixelRatio=function(y){y!==void 0&&(ee=y,this.setSize(V,q,!1))},this.getSize=function(y){return y.set(V,q)},this.setSize=function(y,O,W=!0){if(g.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}V=y,q=O,t.width=Math.floor(y*ee),t.height=Math.floor(O*ee),W===!0&&(t.style.width=y+"px",t.style.height=O+"px"),this.setViewport(0,0,y,O)},this.getDrawingBufferSize=function(y){return y.set(V*ee,q*ee).floor()},this.setDrawingBufferSize=function(y,O,W){V=y,q=O,ee=W,t.width=Math.floor(y*W),t.height=Math.floor(O*W),this.setViewport(0,0,y,O)},this.getCurrentViewport=function(y){return y.copy(M)},this.getViewport=function(y){return y.copy(j)},this.setViewport=function(y,O,W,X){y.isVector4?j.set(y.x,y.y,y.z,y.w):j.set(y,O,W,X),ye.viewport(M.copy(j).multiplyScalar(ee).round())},this.getScissor=function(y){return y.copy(F)},this.setScissor=function(y,O,W,X){y.isVector4?F.set(y.x,y.y,y.z,y.w):F.set(y,O,W,X),ye.scissor(N.copy(F).multiplyScalar(ee).round())},this.getScissorTest=function(){return Q},this.setScissorTest=function(y){ye.setScissorTest(Q=y)},this.setOpaqueSort=function(y){B=y},this.setTransparentSort=function(y){$=y},this.getClearColor=function(y){return y.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(y=!0,O=!0,W=!0){let X=0;if(y){let G=!1;if(w!==null){const he=w.texture.format;G=he===ul||he===cl||he===ll}if(G){const he=w.texture.type,Se=he===gn||he===mi||he===rl||he===Ii||he===al||he===ol,we=ge.getClearColor(),Pe=ge.getClearAlpha(),Ue=we.r,Le=we.g,Ne=we.b;Se?(p[0]=Ue,p[1]=Le,p[2]=Ne,p[3]=Pe,k.clearBufferuiv(k.COLOR,0,p)):(_[0]=Ue,_[1]=Le,_[2]=Ne,_[3]=Pe,k.clearBufferiv(k.COLOR,0,_))}else X|=k.COLOR_BUFFER_BIT}O&&(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",se,!1),Ae.dispose(),ae.dispose(),A.dispose(),Y.dispose(),Z.dispose(),Te.dispose(),Xe.dispose(),je.dispose(),re.dispose(),g.dispose(),g.removeEventListener("sessionstart",it),g.removeEventListener("sessionend",rt),Tt.stop()};function H(y){y.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),D=!0}function K(){console.log("THREE.WebGLRenderer: Context Restored."),D=!1;const y=We.autoReset,O=Re.enabled,W=Re.autoUpdate,X=Re.needsUpdate,G=Re.type;Me(),We.autoReset=y,Re.enabled=O,Re.autoUpdate=W,Re.needsUpdate=X,Re.type=G}function se(y){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",y.statusMessage)}function fe(y){const O=y.target;O.removeEventListener("dispose",fe),Ve(O)}function Ve(y){ze(y),A.remove(y)}function ze(y){const O=A.get(y).programs;O!==void 0&&(O.forEach(function(W){re.releaseProgram(W)}),y.isShaderMaterial&&re.releaseShaderCache(y))}this.renderBufferDirect=function(y,O,W,X,G,he){O===null&&(O=De);const Se=G.isMesh&&G.matrixWorld.determinant()<0,we=jl(y,O,W,X,G);ye.setMaterial(X,Se);let Pe=W.index,Ue=1;if(X.wireframe===!0){if(Pe=ie.getWireframeAttribute(W),Pe===void 0)return;Ue=2}const Le=W.drawRange,Ne=W.attributes.position;let tt=Le.start*Ue,At=(Le.start+Le.count)*Ue;he!==null&&(tt=Math.max(tt,he.start*Ue),At=Math.min(At,(he.start+he.count)*Ue)),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 Yt,Qe=ke;if(Pe!==null&&(Yt=te.get(Pe),Qe=He,Qe.setIndex(Yt)),G.isMesh)X.wireframe===!0?(ye.setLineWidth(X.wireframeLinewidth*Ce()),Qe.setMode(k.LINES)):Qe.setMode(k.TRIANGLES);else if(G.isLine){let Ie=X.linewidth;Ie===void 0&&(Ie=1),ye.setLineWidth(Ie*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 Ie=W._maxInstanceCount!==void 0?W._maxInstanceCount:1/0,Br=Math.min(W.instanceCount,Ie);Qe.renderInstances(tt,ct,Br)}else Qe.render(tt,ct)};function Ze(y,O,W){y.transparent===!0&&y.side===Wt&&y.forceSinglePass===!1?(y.side=Mt,y.needsUpdate=!0,Vi(y,O,W),y.side=vn,y.needsUpdate=!0,Vi(y,O,W),y.side=Wt):Vi(y,O,W)}this.compile=function(y,O,W=null){W===null&&(W=y),m=ae.get(W),m.init(),b.push(m),W.traverseVisible(function(G){G.isLight&&G.layers.test(O.layers)&&(m.pushLight(G),G.castShadow&&m.pushShadow(G))}),y!==W&&y.traverseVisible(function(G){G.isLight&&G.layers.test(O.layers)&&(m.pushLight(G),G.castShadow&&m.pushShadow(G))}),m.setupLights(x._useLegacyLights);const X=new Set;return y.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)}),b.pop(),m=null,X},this.compileAsync=function(y,O,W=null){const X=this.compile(y,O,W);return new Promise(G=>{function he(){if(X.forEach(function(Se){A.get(Se).currentProgram.isReady()&&X.delete(Se)}),X.size===0){G(y);return}setTimeout(he,10)}ve.get("KHR_parallel_shader_compile")!==null?he():setTimeout(he,10)})};let lt=null;function qe(y){lt&<(y)}function it(){Tt.stop()}function rt(){Tt.start()}const Tt=new Dl;Tt.setAnimationLoop(qe),typeof self<"u"&&Tt.setContext(self),this.setAnimationLoop=function(y){lt=y,g.setAnimationLoop(y),y===null?Tt.stop():Tt.start()},g.addEventListener("sessionstart",it),g.addEventListener("sessionend",rt),this.render=function(y,O){if(O!==void 0&&O.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(D===!0)return;y.matrixWorldAutoUpdate===!0&&y.updateMatrixWorld(),O.parent===null&&O.matrixWorldAutoUpdate===!0&&O.updateMatrixWorld(),g.enabled===!0&&g.isPresenting===!0&&(g.cameraAutoUpdate===!0&&g.updateCamera(O),O=g.getCamera()),y.isScene===!0&&y.onBeforeRender(x,y,O,w),m=ae.get(y,b.length),m.init(),b.push(m),le.multiplyMatrices(O.projectionMatrix,O.matrixWorldInverse),pe.setFromProjectionMatrix(le),J=this.localClippingEnabled,U=de.init(this.clippingPlanes,J),v=Ae.get(y,f.length),v.init(),f.push(v),Pt(y,O,0,x.sortObjects),v.finish(),x.sortObjects===!0&&v.sort(B,$),this.info.render.frame++,U===!0&&de.beginShadows();const W=m.state.shadowsArray;if(Re.render(W,y,O),U===!0&&de.endShadows(),this.info.autoReset===!0&&this.info.reset(),(g.enabled===!1||g.isPresenting===!1||g.hasDepthSensing()===!1)&&ge.render(v,y),m.setupLights(x._useLegacyLights),O.isArrayCamera){const X=O.cameras;for(let G=0,he=X.length;G<he;G++){const Se=X[G];rn(v,y,Se,Se.viewport)}}else rn(v,y,O);w!==null&&(S.updateMultisampleRenderTarget(w),S.updateRenderTargetMipmap(w)),y.isScene===!0&&y.onAfterRender(x,y,O),Xe.resetDefaultState(),L=-1,E=null,b.pop(),b.length>0?m=b[b.length-1]:m=null,f.pop(),f.length>0?v=f[f.length-1]:v=null};function Pt(y,O,W,X){if(y.visible===!1)return;if(y.layers.test(O.layers)){if(y.isGroup)W=y.renderOrder;else if(y.isLOD)y.autoUpdate===!0&&y.update(O);else if(y.isLight)m.pushLight(y),y.castShadow&&m.pushShadow(y);else if(y.isSprite){if(!y.frustumCulled||pe.intersectsSprite(y)){X&&xe.setFromMatrixPosition(y.matrixWorld).applyMatrix4(le);const Se=Te.update(y),we=y.material;we.visible&&v.push(y,Se,we,W,xe.z,null)}}else if((y.isMesh||y.isLine||y.isPoints)&&(!y.frustumCulled||pe.intersectsObject(y))){const Se=Te.update(y),we=y.material;if(X&&(y.boundingSphere!==void 0?(y.boundingSphere===null&&y.computeBoundingSphere(),xe.copy(y.boundingSphere.center)):(Se.boundingSphere===null&&Se.computeBoundingSphere(),xe.copy(Se.boundingSphere.center)),xe.applyMatrix4(y.matrixWorld).applyMatrix4(le)),Array.isArray(we)){const Pe=Se.groups;for(let Ue=0,Le=Pe.length;Ue<Le;Ue++){const Ne=Pe[Ue],tt=we[Ne.materialIndex];tt&&tt.visible&&v.push(y,Se,tt,W,xe.z,Ne)}}else we.visible&&v.push(y,Se,we,W,xe.z,null)}}const he=y.children;for(let Se=0,we=he.length;Se<we;Se++)Pt(he[Se],O,W,X)}function rn(y,O,W,X){const G=y.opaque,he=y.transmissive,Se=y.transparent;m.setupLightsView(W),U===!0&&de.setGlobalState(x.clippingPlanes,W),he.length>0&&On(G,he,O,W),X&&ye.viewport(M.copy(X)),G.length>0&&Mn(G,O,W),he.length>0&&Mn(he,O,W),Se.length>0&&Mn(Se,O,W),ye.buffers.depth.setTest(!0),ye.buffers.depth.setMask(!0),ye.buffers.color.setMask(!0),ye.setPolygonOffset(!1)}function On(y,O,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:ve.has("EXT_color_buffer_half_float")||ve.has("EXT_color_buffer_float")?_n:gn,minFilter:Fn,samples:4,stencilBuffer:s});const Ue=A.get(m.state.transmissionRenderTarget);Ue.__isTransmissionRenderTarget=!0}const he=m.state.transmissionRenderTarget;x.getDrawingBufferSize(ne),he.setSize(ne.x,ne.y);const Se=x.getRenderTarget();x.setRenderTarget(he),x.getClearColor(C),z=x.getClearAlpha(),z<1&&x.setClearColor(16777215,.5),x.clear();const we=x.toneMapping;x.toneMapping=mn,Mn(y,W,X),S.updateMultisampleRenderTarget(he),S.updateRenderTargetMipmap(he);let Pe=!1;for(let Ue=0,Le=O.length;Ue<Le;Ue++){const Ne=O[Ue],tt=Ne.object,At=Ne.geometry,ct=Ne.material,Yt=Ne.group;if(ct.side===Wt&&tt.layers.test(X.layers)){const Qe=ct.side;ct.side=Mt,ct.needsUpdate=!0,Ks(tt,W,X,At,ct,Yt),ct.side=Qe,ct.needsUpdate=!0,Pe=!0}}Pe===!0&&(S.updateMultisampleRenderTarget(he),S.updateRenderTargetMipmap(he)),x.setRenderTarget(Se),x.setClearColor(C,z),x.toneMapping=we}function Mn(y,O,W){const X=O.isScene===!0?O.overrideMaterial:null;for(let G=0,he=y.length;G<he;G++){const Se=y[G],we=Se.object,Pe=Se.geometry,Ue=X===null?Se.material:X,Le=Se.group;we.layers.test(W.layers)&&Ks(we,O,W,Pe,Ue,Le)}}function Ks(y,O,W,X,G,he){y.onBeforeRender(x,O,W,X,G,he),y.modelViewMatrix.multiplyMatrices(W.matrixWorldInverse,y.matrixWorld),y.normalMatrix.getNormalMatrix(y.modelViewMatrix),G.onBeforeRender(x,O,W,X,y,he),G.transparent===!0&&G.side===Wt&&G.forceSinglePass===!1?(G.side=Mt,G.needsUpdate=!0,x.renderBufferDirect(W,O,X,G,y,he),G.side=vn,G.needsUpdate=!0,x.renderBufferDirect(W,O,X,G,y,he),G.side=Wt):x.renderBufferDirect(W,O,X,G,y,he),y.onAfterRender(x,O,W,X,G,he)}function Vi(y,O,W){O.isScene!==!0&&(O=De);const X=A.get(y),G=m.state.lights,he=m.state.shadowsArray,Se=G.state.version,we=re.getParameters(y,G.state,he,O,W),Pe=re.getProgramCacheKey(we);let Ue=X.programs;X.environment=y.isMeshStandardMaterial?O.environment:null,X.fog=O.fog,X.envMap=(y.isMeshStandardMaterial?Z:Y).get(y.envMap||X.environment),X.envMapRotation=X.environment!==null&&y.envMap===null?O.environmentRotation:y.envMapRotation,Ue===void 0&&(y.addEventListener("dispose",fe),Ue=new Map,X.programs=Ue);let Le=Ue.get(Pe);if(Le!==void 0){if(X.currentProgram===Le&&X.lightsStateVersion===Se)return Js(y,we),Le}else we.uniforms=re.getUniforms(y),y.onBuild(W,we,x),y.onBeforeCompile(we,x),Le=re.acquireProgram(we,Pe),Ue.set(Pe,Le),X.uniforms=we.uniforms;const Ne=X.uniforms;return(!y.isShaderMaterial&&!y.isRawShaderMaterial||y.clipping===!0)&&(Ne.clippingPlanes=de.uniform),Js(y,we),X.needsLights=$l(y),X.lightsStateVersion=Se,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 Zs(y){if(y.uniformsList===null){const O=y.currentProgram.getUniforms();y.uniformsList=Er.seqWithValue(O.seq,y.uniforms)}return y.uniformsList}function Js(y,O){const W=A.get(y);W.outputColorSpace=O.outputColorSpace,W.batching=O.batching,W.instancing=O.instancing,W.instancingColor=O.instancingColor,W.instancingMorph=O.instancingMorph,W.skinning=O.skinning,W.morphTargets=O.morphTargets,W.morphNormals=O.morphNormals,W.morphColors=O.morphColors,W.morphTargetsCount=O.morphTargetsCount,W.numClippingPlanes=O.numClippingPlanes,W.numIntersection=O.numClipIntersection,W.vertexAlphas=O.vertexAlphas,W.vertexTangents=O.vertexTangents,W.toneMapping=O.toneMapping}function jl(y,O,W,X,G){O.isScene!==!0&&(O=De),S.resetTextureUnits();const he=O.fog,Se=X.isMeshStandardMaterial?O.environment:null,we=w===null?x.outputColorSpace:w.isXRRenderTarget===!0?w.texture.colorSpace:xn,Pe=(X.isMeshStandardMaterial?Z:Y).get(X.envMap||Se),Ue=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=mn;X.toneMapped&&(w===null||w.isXRRenderTarget===!0)&&(ct=x.toneMapping);const Yt=W.morphAttributes.position||W.morphAttributes.normal||W.morphAttributes.color,Qe=Yt!==void 0?Yt.length:0,Ie=A.get(X),Br=m.state.lights;if(U===!0&&(J===!0||y!==E)){const Lt=y===E&&X.id===L;de.setState(X,y,Lt)}let Je=!1;X.version===Ie.__version?(Ie.needsLights&&Ie.lightsStateVersion!==Br.state.version||Ie.outputColorSpace!==we||G.isBatchedMesh&&Ie.batching===!1||!G.isBatchedMesh&&Ie.batching===!0||G.isInstancedMesh&&Ie.instancing===!1||!G.isInstancedMesh&&Ie.instancing===!0||G.isSkinnedMesh&&Ie.skinning===!1||!G.isSkinnedMesh&&Ie.skinning===!0||G.isInstancedMesh&&Ie.instancingColor===!0&&G.instanceColor===null||G.isInstancedMesh&&Ie.instancingColor===!1&&G.instanceColor!==null||G.isInstancedMesh&&Ie.instancingMorph===!0&&G.morphTexture===null||G.isInstancedMesh&&Ie.instancingMorph===!1&&G.morphTexture!==null||Ie.envMap!==Pe||X.fog===!0&&Ie.fog!==he||Ie.numClippingPlanes!==void 0&&(Ie.numClippingPlanes!==de.numPlanes||Ie.numIntersection!==de.numIntersection)||Ie.vertexAlphas!==Ue||Ie.vertexTangents!==Le||Ie.morphTargets!==Ne||Ie.morphNormals!==tt||Ie.morphColors!==At||Ie.toneMapping!==ct||Ie.morphTargetsCount!==Qe)&&(Je=!0):(Je=!0,Ie.__version=X.version);let Sn=Ie.currentProgram;Je===!0&&(Sn=Vi(X,O,G));let Qs=!1,Mi=!1,zr=!1;const pt=Sn.getUniforms(),sn=Ie.uniforms;if(ye.useProgram(Sn.program)&&(Qs=!0,Mi=!0,zr=!0),X.id!==L&&(L=X.id,Mi=!0),Qs||E!==y){pt.setValue(k,"projectionMatrix",y.projectionMatrix),pt.setValue(k,"viewMatrix",y.matrixWorldInverse);const Lt=pt.map.cameraPosition;Lt!==void 0&&Lt.setValue(k,xe.setFromMatrixPosition(y.matrixWorld)),Ge.logarithmicDepthBuffer&&pt.setValue(k,"logDepthBufFC",2/(Math.log(y.far+1)/Math.LN2)),(X.isMeshPhongMaterial||X.isMeshToonMaterial||X.isMeshLambertMaterial||X.isMeshBasicMaterial||X.isMeshStandardMaterial||X.isShaderMaterial)&&pt.setValue(k,"isOrthographic",y.isOrthographicCamera===!0),E!==y&&(E=y,Mi=!0,zr=!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 kr=W.morphAttributes;if((kr.position!==void 0||kr.normal!==void 0||kr.color!==void 0)&&_e.update(G,W,Sn),(Mi||Ie.receiveShadow!==G.receiveShadow)&&(Ie.receiveShadow=G.receiveShadow,pt.setValue(k,"receiveShadow",G.receiveShadow)),X.isMeshGouraudMaterial&&X.envMap!==null&&(sn.envMap.value=Pe,sn.flipEnvMap.value=Pe.isCubeTexture&&Pe.isRenderTargetTexture===!1?-1:1),X.isMeshStandardMaterial&&X.envMap===null&&O.environment!==null&&(sn.envMapIntensity.value=O.environmentIntensity),Mi&&(pt.setValue(k,"toneMappingExposure",x.toneMappingExposure),Ie.needsLights&&ql(sn,zr),he&&X.fog===!0&&Ee.refreshFogUniforms(sn,he),Ee.refreshMaterialUniforms(sn,X,ee,q,m.state.transmissionRenderTarget),Er.upload(k,Zs(Ie),sn,S)),X.isShaderMaterial&&X.uniformsNeedUpdate===!0&&(Er.upload(k,Zs(Ie),sn,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 Hr=0,Kl=Lt.length;Hr<Kl;Hr++){const ea=Lt[Hr];je.update(ea,Sn),je.bind(ea,Sn)}}return Sn}function ql(y,O){y.ambientLightColor.needsUpdate=O,y.lightProbe.needsUpdate=O,y.directionalLights.needsUpdate=O,y.directionalLightShadows.needsUpdate=O,y.pointLights.needsUpdate=O,y.pointLightShadows.needsUpdate=O,y.spotLights.needsUpdate=O,y.spotLightShadows.needsUpdate=O,y.rectAreaLights.needsUpdate=O,y.hemisphereLights.needsUpdate=O}function $l(y){return y.isMeshLambertMaterial||y.isMeshToonMaterial||y.isMeshPhongMaterial||y.isMeshStandardMaterial||y.isShadowMaterial||y.isShaderMaterial&&y.lights===!0}this.getActiveCubeFace=function(){return P},this.getActiveMipmapLevel=function(){return T},this.getRenderTarget=function(){return w},this.setRenderTargetTextures=function(y,O,W){A.get(y.texture).__webglTexture=O,A.get(y.depthTexture).__webglTexture=W;const X=A.get(y);X.__hasExternalTextures=!0,X.__autoAllocateDepthBuffer=W===void 0,X.__autoAllocateDepthBuffer||ve.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(y,O){const W=A.get(y);W.__webglFramebuffer=O,W.__useDefaultFramebuffer=O===void 0},this.setRenderTarget=function(y,O=0,W=0){w=y,P=O,T=W;let X=!0,G=null,he=!1,Se=!1;if(y){const Pe=A.get(y);Pe.__useDefaultFramebuffer!==void 0?(ye.bindFramebuffer(k.FRAMEBUFFER,null),X=!1):Pe.__webglFramebuffer===void 0?S.setupRenderTarget(y):Pe.__hasExternalTextures&&S.rebindTextures(y,A.get(y.texture).__webglTexture,A.get(y.depthTexture).__webglTexture);const Ue=y.texture;(Ue.isData3DTexture||Ue.isDataArrayTexture||Ue.isCompressedArrayTexture)&&(Se=!0);const Le=A.get(y).__webglFramebuffer;y.isWebGLCubeRenderTarget?(Array.isArray(Le[O])?G=Le[O][W]:G=Le[O],he=!0):y.samples>0&&S.useMultisampledRTT(y)===!1?G=A.get(y).__webglMultisampledFramebuffer:Array.isArray(Le)?G=Le[W]:G=Le,M.copy(y.viewport),N.copy(y.scissor),I=y.scissorTest}else M.copy(j).multiplyScalar(ee).floor(),N.copy(F).multiplyScalar(ee).floor(),I=Q;if(ye.bindFramebuffer(k.FRAMEBUFFER,G)&&X&&ye.drawBuffers(y,G),ye.viewport(M),ye.scissor(N),ye.setScissorTest(I),he){const Pe=A.get(y.texture);k.framebufferTexture2D(k.FRAMEBUFFER,k.COLOR_ATTACHMENT0,k.TEXTURE_CUBE_MAP_POSITIVE_X+O,Pe.__webglTexture,W)}else if(Se){const Pe=A.get(y.texture),Ue=O||0;k.framebufferTextureLayer(k.FRAMEBUFFER,k.COLOR_ATTACHMENT0,Pe.__webglTexture,W||0,Ue)}L=-1},this.readRenderTargetPixels=function(y,O,W,X,G,he,Se){if(!(y&&y.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let we=A.get(y).__webglFramebuffer;if(y.isWebGLCubeRenderTarget&&Se!==void 0&&(we=we[Se]),we){ye.bindFramebuffer(k.FRAMEBUFFER,we);try{const Pe=y.texture,Ue=Pe.format,Le=Pe.type;if(Ue!==Xt&&Ye.convert(Ue)!==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===_n&&(ve.has("EXT_color_buffer_half_float")||ve.has("EXT_color_buffer_float"));if(Le!==gn&&Ye.convert(Le)!==k.getParameter(k.IMPLEMENTATION_COLOR_READ_TYPE)&&Le!==pn&&!Ne){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}O>=0&&O<=y.width-X&&W>=0&&W<=y.height-G&&k.readPixels(O,W,X,G,Ye.convert(Ue),Ye.convert(Le),he)}finally{const Pe=w!==null?A.get(w).__webglFramebuffer:null;ye.bindFramebuffer(k.FRAMEBUFFER,Pe)}}},this.copyFramebufferToTexture=function(y,O,W=0){const X=Math.pow(2,-W),G=Math.floor(O.image.width*X),he=Math.floor(O.image.height*X);S.setTexture2D(O,0),k.copyTexSubImage2D(k.TEXTURE_2D,W,0,0,y.x,y.y,G,he),ye.unbindTexture()},this.copyTextureToTexture=function(y,O,W,X=0){const G=O.image.width,he=O.image.height,Se=Ye.convert(W.format),we=Ye.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),O.isDataTexture?k.texSubImage2D(k.TEXTURE_2D,X,y.x,y.y,G,he,Se,we,O.image.data):O.isCompressedTexture?k.compressedTexSubImage2D(k.TEXTURE_2D,X,y.x,y.y,O.mipmaps[0].width,O.mipmaps[0].height,Se,O.mipmaps[0].data):k.texSubImage2D(k.TEXTURE_2D,X,y.x,y.y,Se,we,O.image),X===0&&W.generateMipmaps&&k.generateMipmap(k.TEXTURE_2D),ye.unbindTexture()},this.copyTextureToTexture3D=function(y,O,W,X,G=0){const he=Math.round(y.max.x-y.min.x),Se=Math.round(y.max.y-y.min.y),we=y.max.z-y.min.z+1,Pe=Ye.convert(X.format),Ue=Ye.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 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),Yt=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,y.min.x),k.pixelStorei(k.UNPACK_SKIP_ROWS,y.min.y),k.pixelStorei(k.UNPACK_SKIP_IMAGES,y.min.z),W.isDataTexture||W.isData3DTexture?k.texSubImage3D(Le,G,O.x,O.y,O.z,he,Se,we,Pe,Ue,Qe.data):X.isCompressedArrayTexture?k.compressedTexSubImage3D(Le,G,O.x,O.y,O.z,he,Se,we,Pe,Qe.data):k.texSubImage3D(Le,G,O.x,O.y,O.z,he,Se,we,Pe,Ue,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,Yt),G===0&&X.generateMipmaps&&k.generateMipmap(Le),ye.unbindTexture()},this.initTexture=function(y){y.isCubeTexture?S.setTextureCube(y,0):y.isData3DTexture?S.setTexture3D(y,0):y.isDataArrayTexture||y.isCompressedArrayTexture?S.setTexture2DArray(y,0):S.setTexture2D(y,0),ye.unbindTexture()},this.resetState=function(){P=0,T=0,w=null,ye.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===Ws?"display-p3":"srgb",t.unpackColorSpace=$e.workingColorSpace===Fr?"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 Or{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new be(e),this.density=t}clone(){return new Or(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class Ul 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 tn,this.environmentIntensity=1,this.environmentRotation=new tn,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 Bs 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 Io=new R,Oo=new R,Bo=new et,Ms=new Ur,fr=new Bi;class Nl extends St{constructor(e=new _t,t=new Bs){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++)Io.fromBufferAttribute(t,r-1),Oo.fromBufferAttribute(t,r),n[r]=n[r-1],n[r]+=Io.distanceTo(Oo);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(),fr.copy(n.boundingSphere),fr.applyMatrix4(r),fr.radius+=s,e.ray.intersectsSphere(fr)===!1)return;Bo.copy(r).invert(),Ms.copy(e.ray).applyMatrix4(Bo);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=new R,h=new R,d=new R,u=new R,p=this.isLineSegments?2:1,_=n.index,m=n.attributes.position;if(_!==null){const f=Math.max(0,a.start),b=Math.min(_.count,a.start+a.count);for(let x=f,D=b-1;x<D;x+=p){const P=_.getX(x),T=_.getX(x+1);if(c.fromBufferAttribute(m,P),h.fromBufferAttribute(m,T),Ms.distanceSqToSegment(c,h,u,d)>l)continue;u.applyMatrix4(this.matrixWorld);const L=e.ray.origin.distanceTo(u);L<e.near||L>e.far||t.push({distance:L,point:d.clone().applyMatrix4(this.matrixWorld),index:x,face:null,faceIndex:null,object:this})}}else{const f=Math.max(0,a.start),b=Math.min(m.count,a.start+a.count);for(let x=f,D=b-1;x<D;x+=p){if(c.fromBufferAttribute(m,x),h.fromBufferAttribute(m,x+1),Ms.distanceSqToSegment(c,h,u,d)>l)continue;u.applyMatrix4(this.matrixWorld);const T=e.ray.origin.distanceTo(u);T<e.near||T>e.far||t.push({distance:T,point:d.clone().applyMatrix4(this.matrixWorld),index:x,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 zo=new R,ko=new R;class Qm extends Nl{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)zo.fromBufferAttribute(t,r),ko.fromBufferAttribute(t,r+1),n[r]=r===0?0:n[r-1],n[r+1]=n[r]+zo.distanceTo(ko);e.setAttribute("lineDistance",new nt(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class eg 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 Ho=new et,zs=new Ur,pr=new Bi,mr=new R;class tg extends St{constructor(e=new _t,t=new eg){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(),pr.copy(n.boundingSphere),pr.applyMatrix4(r),pr.radius+=s,e.ray.intersectsSphere(pr)===!1)return;Ho.copy(r).invert(),zs.copy(e.ray).applyMatrix4(Ho);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 u=Math.max(0,a.start),p=Math.min(c.count,a.start+a.count);for(let _=u,v=p;_<v;_++){const m=c.getX(_);mr.fromBufferAttribute(d,m),Vo(mr,m,l,r,e,t,this)}}else{const u=Math.max(0,a.start),p=Math.min(d.count,a.start+a.count);for(let _=u,v=p;_<v;_++)mr.fromBufferAttribute(d,_),Vo(mr,_,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 Vo(i,e,t,n,r,s,a){const o=zs.distanceSqToPoint(i);if(o<t){const l=new R;zs.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 nn{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 h=n[r],u=n[r+1]-h,p=(a-h)/u;return(r+p)/(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 R);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 R,r=[],s=[],a=[],o=new R,l=new et;for(let p=0;p<=e;p++){const _=p/e;r[p]=this.getTangentAt(_,new R)}s[0]=new R,a[0]=new R;let c=Number.MAX_VALUE;const h=Math.abs(r[0].x),d=Math.abs(r[0].y),u=Math.abs(r[0].z);h<=c&&(c=h,n.set(1,0,0)),d<=c&&(c=d,n.set(0,1,0)),u<=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 p=1;p<=e;p++){if(s[p]=s[p-1].clone(),a[p]=a[p-1].clone(),o.crossVectors(r[p-1],r[p]),o.length()>Number.EPSILON){o.normalize();const _=Math.acos(ht(r[p-1].dot(r[p]),-1,1));s[p].applyMatrix4(l.makeRotationAxis(o,_))}a[p].crossVectors(r[p],s[p])}if(t===!0){let p=Math.acos(ht(s[0].dot(s[e]),-1,1));p/=e,r[0].dot(o.crossVectors(s[0],s[e]))>0&&(p=-p);for(let _=1;_<=e;_++)s[_].applyMatrix4(l.makeRotationAxis(r[_],p*_)),a[_].crossVectors(r[_],s[_])}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 Il extends nn{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 h=Math.cos(this.aRotation),d=Math.sin(this.aRotation),u=l-this.aX,p=c-this.aY;l=u*h-p*d+this.aX,c=u*d+p*h+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 ng extends Il{constructor(e,t,n,r,s,a){super(e,t,n,n,r,s,a),this.isArcCurve=!0,this.type="ArcCurve"}}function js(){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,h,d){let u=(a-s)/c-(o-s)/(c+h)+(o-a)/h,p=(o-a)/h-(l-a)/(h+d)+(l-o)/d;u*=h,p*=h,r(a,o,u,p)},calc:function(s){const a=s*s,o=a*s;return i+e*s+t*a+n*o}}}const gr=new R,Ss=new js,Es=new js,ys=new js;class Ol extends nn{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 R){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,h;this.closed||o>0?c=r[(o-1)%s]:(gr.subVectors(r[0],r[1]).add(r[0]),c=gr);const d=r[o%s],u=r[(o+1)%s];if(this.closed||o+2<s?h=r[(o+2)%s]:(gr.subVectors(r[s-1],r[s-2]).add(r[s-1]),h=gr),this.curveType==="centripetal"||this.curveType==="chordal"){const p=this.curveType==="chordal"?.5:.25;let _=Math.pow(c.distanceToSquared(d),p),v=Math.pow(d.distanceToSquared(u),p),m=Math.pow(u.distanceToSquared(h),p);v<1e-4&&(v=1),_<1e-4&&(_=v),m<1e-4&&(m=v),Ss.initNonuniformCatmullRom(c.x,d.x,u.x,h.x,_,v,m),Es.initNonuniformCatmullRom(c.y,d.y,u.y,h.y,_,v,m),ys.initNonuniformCatmullRom(c.z,d.z,u.z,h.z,_,v,m)}else this.curveType==="catmullrom"&&(Ss.initCatmullRom(c.x,d.x,u.x,h.x,this.tension),Es.initCatmullRom(c.y,d.y,u.y,h.y,this.tension),ys.initCatmullRom(c.z,d.z,u.z,h.z,this.tension));return n.set(Ss.calc(l),Es.calc(l),ys.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 R().fromArray(r))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}function Go(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 ig(i,e){const t=1-i;return t*t*e}function rg(i,e){return 2*(1-i)*i*e}function sg(i,e){return i*i*e}function Ri(i,e,t,n){return ig(i,e)+rg(i,t)+sg(i,n)}function ag(i,e){const t=1-i;return t*t*t*e}function og(i,e){const t=1-i;return 3*t*t*i*e}function lg(i,e){return 3*(1-i)*i*i*e}function cg(i,e){return i*i*i*e}function Pi(i,e,t,n,r){return ag(i,e)+og(i,t)+lg(i,n)+cg(i,r)}class ug extends nn{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(Pi(e,r.x,s.x,a.x,o.x),Pi(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 hg extends nn{constructor(e=new R,t=new R,n=new R,r=new R){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=n,this.v3=r}getPoint(e,t=new R){const n=t,r=this.v0,s=this.v1,a=this.v2,o=this.v3;return n.set(Pi(e,r.x,s.x,a.x,o.x),Pi(e,r.y,s.y,a.y,o.y),Pi(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 dg extends nn{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 fg extends nn{constructor(e=new R,t=new R){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new R){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 R){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 pg extends nn{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(Ri(e,r.x,s.x,a.x),Ri(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 Bl extends nn{constructor(e=new R,t=new R,n=new R){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new R){const n=t,r=this.v0,s=this.v1,a=this.v2;return n.set(Ri(e,r.x,s.x,a.x),Ri(e,r.y,s.y,a.y),Ri(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 mg extends nn{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],h=r[a>r.length-2?r.length-1:a+1],d=r[a>r.length-3?r.length-1:a+2];return n.set(Go(o,l.x,c.x,h.x,d.x),Go(o,l.y,c.y,h.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 gg=Object.freeze({__proto__:null,ArcCurve:ng,CatmullRomCurve3:Ol,CubicBezierCurve:ug,CubicBezierCurve3:hg,EllipseCurve:Il,LineCurve:dg,LineCurve3:fg,QuadraticBezierCurve:pg,QuadraticBezierCurve3:Bl,SplineCurve:mg});const _r=new R,vr=new R,bs=new R,xr=new kt;class _g 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(hi*t),a=e.getIndex(),o=e.getAttribute("position"),l=a?a.count:o.count,c=[0,0,0],h=["a","b","c"],d=new Array(3),u={},p=[];for(let _=0;_<l;_+=3){a?(c[0]=a.getX(_),c[1]=a.getX(_+1),c[2]=a.getX(_+2)):(c[0]=_,c[1]=_+1,c[2]=_+2);const{a:v,b:m,c:f}=xr;if(v.fromBufferAttribute(o,c[0]),m.fromBufferAttribute(o,c[1]),f.fromBufferAttribute(o,c[2]),xr.getNormal(bs),d[0]=`${Math.round(v.x*r)},${Math.round(v.y*r)},${Math.round(v.z*r)}`,d[1]=`${Math.round(m.x*r)},${Math.round(m.y*r)},${Math.round(m.z*r)}`,d[2]=`${Math.round(f.x*r)},${Math.round(f.y*r)},${Math.round(f.z*r)}`,!(d[0]===d[1]||d[1]===d[2]||d[2]===d[0]))for(let b=0;b<3;b++){const x=(b+1)%3,D=d[b],P=d[x],T=xr[h[b]],w=xr[h[x]],L=`${D}_${P}`,E=`${P}_${D}`;E in u&&u[E]?(bs.dot(u[E].normal)<=s&&(p.push(T.x,T.y,T.z),p.push(w.x,w.y,w.z)),u[E]=null):L in u||(u[L]={index0:c[b],index1:c[x],normal:bs.clone()})}}for(const _ in u)if(u[_]){const{index0:v,index1:m}=u[_];_r.fromBufferAttribute(o,v),vr.fromBufferAttribute(o,m),p.push(_r.x,_r.y,_r.z),p.push(vr.x,vr.y,vr.z)}this.setAttribute("position",new nt(p,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}class qs 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=[],h=[];let d=e;const u=(t-e)/r,p=new R,_=new ue;for(let v=0;v<=r;v++){for(let m=0;m<=n;m++){const f=s+m/n*a;p.x=d*Math.cos(f),p.y=d*Math.sin(f),l.push(p.x,p.y,p.z),c.push(0,0,1),_.x=(p.x/t+1)/2,_.y=(p.y/t+1)/2,h.push(_.x,_.y)}d+=u}for(let v=0;v<r;v++){const m=v*(n+1);for(let f=0;f<n;f++){const b=f+m,x=b,D=b+n+1,P=b+n+2,T=b+1;o.push(x,D,T),o.push(D,P,T)}}this.setIndex(o),this.setAttribute("position",new nt(l,3)),this.setAttribute("normal",new nt(c,3)),this.setAttribute("uv",new nt(h,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new qs(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}class Ni 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 h=[],d=new R,u=new R,p=[],_=[],v=[],m=[];for(let f=0;f<=n;f++){const b=[],x=f/n;let D=0;f===0&&a===0?D=.5/t:f===n&&l===Math.PI&&(D=-.5/t);for(let P=0;P<=t;P++){const T=P/t;d.x=-e*Math.cos(r+T*s)*Math.sin(a+x*o),d.y=e*Math.cos(a+x*o),d.z=e*Math.sin(r+T*s)*Math.sin(a+x*o),_.push(d.x,d.y,d.z),u.copy(d).normalize(),v.push(u.x,u.y,u.z),m.push(T+D,1-x),b.push(c++)}h.push(b)}for(let f=0;f<n;f++)for(let b=0;b<t;b++){const x=h[f][b+1],D=h[f][b],P=h[f+1][b],T=h[f+1][b+1];(f!==0||a>0)&&p.push(x,D,T),(f!==n-1||l<Math.PI)&&p.push(D,P,T)}this.setIndex(p),this.setAttribute("position",new nt(_,3)),this.setAttribute("normal",new nt(v,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 Ni(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class $s extends _t{constructor(e=new Bl(new R(-1,-1,0),new R(-1,1,0),new R(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 R,l=new R,c=new ue;let h=new R;const d=[],u=[],p=[],_=[];v(),this.setIndex(_),this.setAttribute("position",new nt(d,3)),this.setAttribute("normal",new nt(u,3)),this.setAttribute("uv",new nt(p,2));function v(){for(let x=0;x<t;x++)m(x);m(s===!1?t:0),b(),f()}function m(x){h=e.getPointAt(x/t,h);const D=a.normals[x],P=a.binormals[x];for(let T=0;T<=r;T++){const w=T/r*Math.PI*2,L=Math.sin(w),E=-Math.cos(w);l.x=E*D.x+L*P.x,l.y=E*D.y+L*P.y,l.z=E*D.z+L*P.z,l.normalize(),u.push(l.x,l.y,l.z),o.x=h.x+n*l.x,o.y=h.y+n*l.y,o.z=h.z+n*l.z,d.push(o.x,o.y,o.z)}}function f(){for(let x=1;x<=t;x++)for(let D=1;D<=r;D++){const P=(r+1)*(x-1)+(D-1),T=(r+1)*x+(D-1),w=(r+1)*x+D,L=(r+1)*(x-1)+D;_.push(P,T,L),_.push(T,w,L)}}function b(){for(let x=0;x<=t;x++)for(let D=0;D<=r;D++)c.x=x/t,c.y=D/r,p.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 $s(new gg[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}class zl{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=Wo(),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=Wo();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function Wo(){return(typeof performance>"u"?Date:performance).now()}class Xo{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:Vs}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Vs);const Yo={type:"change"},Ds={type:"start"},jo={type:"end"},Mr=new Ur,qo=new dn,vg=Math.cos(70*fl.DEG2RAD);class kl extends In{constructor(e,t){super(),this.object=e,this.domElement=t,this.domElement.style.touchAction="none",this.enabled=!0,this.target=new R,this.cursor=new R,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(g){g.addEventListener("keydown",de),this._domElementKeyEvents=g},this.stopListenToKeyEvents=function(){this._domElementKeyEvents.removeEventListener("keydown",de),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(Yo),n.update(),s=r.NONE},this.update=(function(){const g=new R,H=new Un().setFromUnitVectors(e.up,new R(0,1,0)),K=H.clone().invert(),se=new R,fe=new Un,Ve=new R,ze=2*Math.PI;return function(lt=null){const qe=n.object.position;g.copy(qe).sub(n.target),g.applyQuaternion(H),o.setFromVector3(g),n.autoRotate&&s===r.NONE&&I(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(h,n.dampingFactor):n.target.add(h),n.target.sub(n.cursor),n.target.clampLength(n.minTargetRadius,n.maxTargetRadius),n.target.add(n.cursor);let Tt=!1;if(n.zoomToCursor&&T||n.object.isOrthographicCamera)o.radius=j(o.radius);else{const Pt=o.radius;o.radius=j(o.radius*c),Tt=Pt!=o.radius}if(g.setFromSpherical(o),g.applyQuaternion(K),qe.copy(n.target).add(g),n.object.lookAt(n.target),n.enableDamping===!0?(l.theta*=1-n.dampingFactor,l.phi*=1-n.dampingFactor,h.multiplyScalar(1-n.dampingFactor)):(l.set(0,0,0),h.set(0,0,0)),n.zoomToCursor&&T){let Pt=null;if(n.object.isPerspectiveCamera){const rn=g.length();Pt=j(rn*c);const On=rn-Pt;n.object.position.addScaledVector(D,On),n.object.updateMatrixWorld(),Tt=!!On}else if(n.object.isOrthographicCamera){const rn=new R(P.x,P.y,0);rn.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(),Tt=On!==n.object.zoom;const Mn=new R(P.x,P.y,0);Mn.unproject(n.object),n.object.position.sub(Mn).add(rn),n.object.updateMatrixWorld(),Pt=g.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):(Mr.origin.copy(n.object.position),Mr.direction.set(0,0,-1).transformDirection(n.object.matrix),Math.abs(n.object.up.dot(Mr.direction))<vg?e.lookAt(n.target):(qo.setFromNormalAndCoplanarPoint(n.object.up,n.target),Mr.intersectPlane(qo,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(),Tt=!0)}return c=1,T=!1,Tt||se.distanceToSquared(n.object.position)>a||8*(1-fe.dot(n.object.quaternion))>a||Ve.distanceToSquared(n.target)>a?(n.dispatchEvent(Yo),se.copy(n.object.position),fe.copy(n.object.quaternion),Ve.copy(n.target),!0):!1}})(),this.dispose=function(){n.domElement.removeEventListener("contextmenu",_e),n.domElement.removeEventListener("pointerdown",Y),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",de),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 Xo,l=new Xo;let c=1;const h=new R,d=new ue,u=new ue,p=new ue,_=new ue,v=new ue,m=new ue,f=new ue,b=new ue,x=new ue,D=new R,P=new ue;let T=!1;const w=[],L={};let E=!1;function M(g){return g!==null?2*Math.PI/60*n.autoRotateSpeed*g:2*Math.PI/60/60*n.autoRotateSpeed}function N(g){const H=Math.abs(g*.01);return Math.pow(.95,n.zoomSpeed*H)}function I(g){l.theta-=g}function C(g){l.phi-=g}const z=(function(){const g=new R;return function(K,se){g.setFromMatrixColumn(se,0),g.multiplyScalar(-K),h.add(g)}})(),V=(function(){const g=new R;return function(K,se){n.screenSpacePanning===!0?g.setFromMatrixColumn(se,1):(g.setFromMatrixColumn(se,0),g.crossVectors(n.object.up,g)),g.multiplyScalar(K),h.add(g)}})(),q=(function(){const g=new R;return function(K,se){const fe=n.domElement;if(n.object.isPerspectiveCamera){const Ve=n.object.position;g.copy(Ve).sub(n.target);let ze=g.length();ze*=Math.tan(n.object.fov/2*Math.PI/180),z(2*K*ze/fe.clientHeight,n.object.matrix),V(2*se*ze/fe.clientHeight,n.object.matrix)}else n.object.isOrthographicCamera?(z(K*(n.object.right-n.object.left)/n.object.zoom/fe.clientWidth,n.object.matrix),V(se*(n.object.top-n.object.bottom)/n.object.zoom/fe.clientHeight,n.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),n.enablePan=!1)}})();function ee(g){n.object.isPerspectiveCamera||n.object.isOrthographicCamera?c/=g:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function B(g){n.object.isPerspectiveCamera||n.object.isOrthographicCamera?c*=g:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function $(g,H){if(!n.zoomToCursor)return;T=!0;const K=n.domElement.getBoundingClientRect(),se=g-K.left,fe=H-K.top,Ve=K.width,ze=K.height;P.x=se/Ve*2-1,P.y=-(fe/ze)*2+1,D.set(P.x,P.y,1).unproject(n.object).sub(n.object.position).normalize()}function j(g){return Math.max(n.minDistance,Math.min(n.maxDistance,g))}function F(g){d.set(g.clientX,g.clientY)}function Q(g){$(g.clientX,g.clientX),f.set(g.clientX,g.clientY)}function pe(g){_.set(g.clientX,g.clientY)}function U(g){u.set(g.clientX,g.clientY),p.subVectors(u,d).multiplyScalar(n.rotateSpeed);const H=n.domElement;I(2*Math.PI*p.x/H.clientHeight),C(2*Math.PI*p.y/H.clientHeight),d.copy(u),n.update()}function J(g){b.set(g.clientX,g.clientY),x.subVectors(b,f),x.y>0?ee(N(x.y)):x.y<0&&B(N(x.y)),f.copy(b),n.update()}function le(g){v.set(g.clientX,g.clientY),m.subVectors(v,_).multiplyScalar(n.panSpeed),q(m.x,m.y),_.copy(v),n.update()}function ne(g){$(g.clientX,g.clientY),g.deltaY<0?B(N(g.deltaY)):g.deltaY>0&&ee(N(g.deltaY)),n.update()}function xe(g){let H=!1;switch(g.code){case n.keys.UP:g.ctrlKey||g.metaKey||g.shiftKey?C(2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):q(0,n.keyPanSpeed),H=!0;break;case n.keys.BOTTOM:g.ctrlKey||g.metaKey||g.shiftKey?C(-2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):q(0,-n.keyPanSpeed),H=!0;break;case n.keys.LEFT:g.ctrlKey||g.metaKey||g.shiftKey?I(2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):q(n.keyPanSpeed,0),H=!0;break;case n.keys.RIGHT:g.ctrlKey||g.metaKey||g.shiftKey?I(-2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):q(-n.keyPanSpeed,0),H=!0;break}H&&(g.preventDefault(),n.update())}function De(g){if(w.length===1)d.set(g.pageX,g.pageY);else{const H=je(g),K=.5*(g.pageX+H.x),se=.5*(g.pageY+H.y);d.set(K,se)}}function Ce(g){if(w.length===1)_.set(g.pageX,g.pageY);else{const H=je(g),K=.5*(g.pageX+H.x),se=.5*(g.pageY+H.y);_.set(K,se)}}function k(g){const H=je(g),K=g.pageX-H.x,se=g.pageY-H.y,fe=Math.sqrt(K*K+se*se);f.set(0,fe)}function Fe(g){n.enableZoom&&k(g),n.enablePan&&Ce(g)}function ve(g){n.enableZoom&&k(g),n.enableRotate&&De(g)}function Ge(g){if(w.length==1)u.set(g.pageX,g.pageY);else{const K=je(g),se=.5*(g.pageX+K.x),fe=.5*(g.pageY+K.y);u.set(se,fe)}p.subVectors(u,d).multiplyScalar(n.rotateSpeed);const H=n.domElement;I(2*Math.PI*p.x/H.clientHeight),C(2*Math.PI*p.y/H.clientHeight),d.copy(u)}function ye(g){if(w.length===1)v.set(g.pageX,g.pageY);else{const H=je(g),K=.5*(g.pageX+H.x),se=.5*(g.pageY+H.y);v.set(K,se)}m.subVectors(v,_).multiplyScalar(n.panSpeed),q(m.x,m.y),_.copy(v)}function We(g){const H=je(g),K=g.pageX-H.x,se=g.pageY-H.y,fe=Math.sqrt(K*K+se*se);b.set(0,fe),x.set(0,Math.pow(b.y/f.y,n.zoomSpeed)),ee(x.y),f.copy(b);const Ve=(g.pageX+H.x)*.5,ze=(g.pageY+H.y)*.5;$(Ve,ze)}function A(g){n.enableZoom&&We(g),n.enablePan&&ye(g)}function S(g){n.enableZoom&&We(g),n.enableRotate&&Ge(g)}function Y(g){n.enabled!==!1&&(w.length===0&&(n.domElement.setPointerCapture(g.pointerId),n.domElement.addEventListener("pointermove",Z),n.domElement.addEventListener("pointerup",te)),!Ye(g)&&(ke(g),g.pointerType==="touch"?Re(g):ie(g)))}function Z(g){n.enabled!==!1&&(g.pointerType==="touch"?ge(g):Te(g))}function te(g){switch(He(g),w.length){case 0:n.domElement.releasePointerCapture(g.pointerId),n.domElement.removeEventListener("pointermove",Z),n.domElement.removeEventListener("pointerup",te),n.dispatchEvent(jo),s=r.NONE;break;case 1:const H=w[0],K=L[H];Re({pointerId:H,pageX:K.x,pageY:K.y});break}}function ie(g){let H;switch(g.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 Hn.DOLLY:if(n.enableZoom===!1)return;Q(g),s=r.DOLLY;break;case Hn.ROTATE:if(g.ctrlKey||g.metaKey||g.shiftKey){if(n.enablePan===!1)return;pe(g),s=r.PAN}else{if(n.enableRotate===!1)return;F(g),s=r.ROTATE}break;case Hn.PAN:if(g.ctrlKey||g.metaKey||g.shiftKey){if(n.enableRotate===!1)return;F(g),s=r.ROTATE}else{if(n.enablePan===!1)return;pe(g),s=r.PAN}break;default:s=r.NONE}s!==r.NONE&&n.dispatchEvent(Ds)}function Te(g){switch(s){case r.ROTATE:if(n.enableRotate===!1)return;U(g);break;case r.DOLLY:if(n.enableZoom===!1)return;J(g);break;case r.PAN:if(n.enablePan===!1)return;le(g);break}}function re(g){n.enabled===!1||n.enableZoom===!1||s!==r.NONE||(g.preventDefault(),n.dispatchEvent(Ds),ne(Ee(g)),n.dispatchEvent(jo))}function Ee(g){const H=g.deltaMode,K={clientX:g.clientX,clientY:g.clientY,deltaY:g.deltaY};switch(H){case 1:K.deltaY*=16;break;case 2:K.deltaY*=100;break}return g.ctrlKey&&!E&&(K.deltaY*=10),K}function Ae(g){g.key==="Control"&&(E=!0,n.domElement.getRootNode().addEventListener("keyup",ae,{passive:!0,capture:!0}))}function ae(g){g.key==="Control"&&(E=!1,n.domElement.getRootNode().removeEventListener("keyup",ae,{passive:!0,capture:!0}))}function de(g){n.enabled===!1||n.enablePan===!1||xe(g)}function Re(g){switch(Xe(g),w.length){case 1:switch(n.touches.ONE){case Vn.ROTATE:if(n.enableRotate===!1)return;De(g),s=r.TOUCH_ROTATE;break;case Vn.PAN:if(n.enablePan===!1)return;Ce(g),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(g),s=r.TOUCH_DOLLY_PAN;break;case Vn.DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;ve(g),s=r.TOUCH_DOLLY_ROTATE;break;default:s=r.NONE}break;default:s=r.NONE}s!==r.NONE&&n.dispatchEvent(Ds)}function ge(g){switch(Xe(g),s){case r.TOUCH_ROTATE:if(n.enableRotate===!1)return;Ge(g),n.update();break;case r.TOUCH_PAN:if(n.enablePan===!1)return;ye(g),n.update();break;case r.TOUCH_DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;A(g),n.update();break;case r.TOUCH_DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;S(g),n.update();break;default:s=r.NONE}}function _e(g){n.enabled!==!1&&g.preventDefault()}function ke(g){w.push(g.pointerId)}function He(g){delete L[g.pointerId];for(let H=0;H<w.length;H++)if(w[H]==g.pointerId){w.splice(H,1);return}}function Ye(g){for(let H=0;H<w.length;H++)if(w[H]==g.pointerId)return!0;return!1}function Xe(g){let H=L[g.pointerId];H===void 0&&(H=new ue,L[g.pointerId]=H),H.set(g.pageX,g.pageY)}function je(g){const H=g.pointerId===w[0]?w[1]:w[0];return L[H]}n.domElement.addEventListener("contextmenu",_e),n.domElement.addEventListener("pointerdown",Y),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 Hl={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
|
|
3823
|
+
}`};class Hi{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 xg=new Tl(-1,1,1,-1,0,1);class Mg 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 Sg=new Mg;class Vl{constructor(e){this._mesh=new bt(Sg,e)}dispose(){this._mesh.geometry.dispose()}render(e){e.render(this._mesh,xg)}get material(){return this._mesh.material}set material(e){this._mesh.material=e}}class Gl extends Hi{constructor(e,t){super(),this.textureID=t!==void 0?t:"tDiffuse",e instanceof ft?(this.uniforms=e.uniforms,this.material=e):e&&(this.uniforms=Rr.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 Vl(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 $o extends Hi{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 Eg extends Hi{constructor(){super(),this.needsSwap=!1}render(e){e.state.buffers.stencil.setLocked(!1),e.state.buffers.stencil.setTest(!1)}}class Wl{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:_n}),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 Gl(Hl),this.copyPass.material.blending=en,this.clock=new zl}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()}$o!==void 0&&(a instanceof $o?n=!0:a instanceof Eg&&(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 Xl extends Hi{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 yg={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
|
|
3857
|
+
}`};class Nn extends Hi{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:_n}),this.renderTargetBright.texture.name="UnrealBloomPass.bright",this.renderTargetBright.texture.generateMipmaps=!1;for(let d=0;d<this.nMips;d++){const u=new Ht(s,a,{type:_n});u.texture.name="UnrealBloomPass.h"+d,u.texture.generateMipmaps=!1,this.renderTargetsHorizontal.push(u);const p=new Ht(s,a,{type:_n});p.texture.name="UnrealBloomPass.v"+d,p.texture.generateMipmaps=!1,this.renderTargetsVertical.push(p),s=Math.round(s/2),a=Math.round(a/2)}const o=yg;this.highPassUniforms=Rr.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 R(1,1,1),new R(1,1,1),new R(1,1,1),new R(1,1,1),new R(1,1,1)],this.compositeMaterial.uniforms.bloomTintColors.value=this.bloomTintColors;const h=Hl;this.copyUniforms=Rr.clone(h.uniforms),this.blendMaterial=new ft({uniforms:this.copyUniforms,vertexShader:h.vertexShader,fragmentShader:h.fragmentShader,blending:ci,depthTest:!1,depthWrite:!1,transparent:!0}),this.enabled=!0,this.needsSwap=!1,this._oldClearColor=new be,this.oldClearAlpha=1,this.basic=new zi,this.fsQuad=new Vl(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
|
-
}`})}}
|
|
3907
|
+
}`})}}Nn.BlurDirectionX=new ue(1,0);Nn.BlurDirectionY=new ue(0,1);const bg=({onParamsChange:i,diskColor:e,glowColor:t,autoRotate:n})=>{const r=me.useRef(null),[s,a]=me.useState(n!==void 0?n:!1),[o,l]=me.useState(e||"#ff7733"),[c,h]=me.useState(t||"#ff6600"),d=me.useRef(null);return me.useEffect(()=>{e!==void 0&&l(e),t!==void 0&&h(t),n!==void 0&&a(n)},[e,t,n]),me.useEffect(()=>{if(!r.current)return;const u=r.current.querySelector("canvas");u&&r.current.removeChild(u);const p=1.3,_=p+.2,v=8,m=Math.PI/3,f=new Ul;f.fog=new Or(131332,.025),d.current=f;const b=new Rt(60,r.current.clientWidth/r.current.clientHeight,.1,4e3);b.position.set(-6.5,5,6.5);const x=new Fl({antialias:!0,powerPreference:"high-performance"});x.setSize(r.current.clientWidth,r.current.clientHeight),x.setPixelRatio(Math.min(window.devicePixelRatio,1.5)),x.outputColorSpace=Ut,x.toneMapping=Gs,x.toneMappingExposure=1.2,r.current.appendChild(x.domElement);const D=new Wl(x);D.addPass(new Xl(f,b));const P=new Nn(new ue(r.current.clientWidth,r.current.clientHeight),.8,.7,.8);D.addPass(P);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
|
-
`},w=new
|
|
3946
|
+
`},w=new Gl(T);D.addPass(w);const L=new kl(b,x.domElement);L.enableDamping=!0,L.dampingFactor=.035,L.rotateSpeed=.4,L.autoRotate=s,L.autoRotateSpeed=.1,L.target.set(0,0,0),L.minDistance=2.5,L.maxDistance=100,L.enablePan=!1,L.update();const E=new _t,M=15e4,N=new Float32Array(M*3),I=new Float32Array(M*3),C=new Float32Array(M),z=new Float32Array(M),V=2e3,q=[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 ve=0;ve<M;ve++){const Ge=ve*3,ye=Math.acos(-1+2*ve/M),We=Math.sqrt(M*Math.PI)*ye,A=Math.cbrt(Math.random())*V+100;N[Ge]=A*Math.sin(ye)*Math.cos(We),N[Ge+1]=A*Math.sin(ye)*Math.sin(We),N[Ge+2]=A*Math.cos(ye);const S=q[Math.floor(Math.random()*q.length)].clone();S.multiplyScalar(Math.random()*.7+.3),I[Ge]=S.r,I[Ge+1]=S.g,I[Ge+2]=S.b,C[ve]=fl.randFloat(.6,3),z[ve]=Math.random()*Math.PI*2}E.setAttribute("position",new yt(N,3)),E.setAttribute("color",new yt(I,3)),E.setAttribute("size",new yt(C,1)),E.setAttribute("twinkle",new yt(z,1));const ee=new ft({uniforms:{uTime:{value:0},uPixelRatio:{value:x.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:
|
|
3975
|
+
`,transparent:!0,vertexColors:!0,blending:ci,depthWrite:!1}),B=new tg(E,ee);f.add(B);const $=new Ni(p*1.05,128,64),j=new ft({uniforms:{uTime:{value:0},uCameraPosition:{value:b.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:
|
|
3999
|
+
`,transparent:!0,blending:ci,side:Mt}),F=new bt($,j);f.add(F);const Q=new Ni(p,128,64),pe=new zi({color:0}),U=new bt(Q,pe);U.renderOrder=0,f.add(U);const J=new qs(_,v,256,128),le=new be(o),ne=new ft({uniforms:{uTime:{value:0},uColorHot:{value:new be(16777215)},uColorMid1:{value:le.clone()},uColorMid2:{value:le.clone().multiplyScalar(.8)},uColorMid3:{value:le.clone().multiplyScalar(.6)},uColorOuter:{value:le.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;
|
|
@@ -4070,7 +4070,7 @@ void main() {
|
|
|
4070
4070
|
}
|
|
4071
4071
|
|
|
4072
4072
|
void main() {
|
|
4073
|
-
float normalizedRadius = smoothstep(${_.toFixed(2)}, ${
|
|
4073
|
+
float normalizedRadius = smoothstep(${_.toFixed(2)}, ${v.toFixed(2)}, vRadius);
|
|
4074
4074
|
|
|
4075
4075
|
float spiral = vAngle * 3.0 - (1.0 / (normalizedRadius + 0.1)) * 2.0;
|
|
4076
4076
|
vec2 noiseUv = vec2(vUv.x + uTime * uFlowSpeed * (2.0 / (vRadius * 0.3 + 1.0)) + sin(spiral) * 0.1, vUv.y * 0.8 + cos(spiral) * 0.1);
|
|
@@ -4101,7 +4101,7 @@ void main() {
|
|
|
4101
4101
|
|
|
4102
4102
|
gl_FragColor = vec4(color * brightness, alpha);
|
|
4103
4103
|
}
|
|
4104
|
-
`,transparent:!0,side:
|
|
4104
|
+
`,transparent:!0,side:Wt,depthWrite:!1,blending:ci}),xe=new bt(J,ne);xe.rotation.x=m,xe.renderOrder=1,f.add(xe);const De=new zl,Ce=new R,k=()=>{requestAnimationFrame(k);const ve=De.getElapsedTime(),Ge=De.getDelta();ne.uniforms.uTime.value=ve,ee.uniforms.uTime.value=ve,j.uniforms.uTime.value=ve,j.uniforms.uCameraPosition.value.copy(b.position),j.uniforms.uGlowColor.value.set(c),Ce.copy(U.position).project(b),w.uniforms.blackHoleScreenPos.value.set((Ce.x+1)/2,(Ce.y+1)/2),L.update(),B.rotation.y+=Ge*.003,B.rotation.x+=Ge*.001,xe.rotation.z+=Ge*.005,D.render(Ge)};k();const Fe=()=>{r.current&&(b.aspect=r.current.clientWidth/r.current.clientHeight,b.updateProjectionMatrix(),x.setSize(r.current.clientWidth,r.current.clientHeight),D.setSize(r.current.clientWidth,r.current.clientHeight),P.resolution.set(r.current.clientWidth,r.current.clientHeight),w.uniforms.aspectRatio.value=r.current.clientWidth/r.current.clientHeight)};return window.addEventListener("resize",Fe),()=>{window.removeEventListener("resize",Fe),x.dispose(),E.dispose(),ee.dispose(),$.dispose(),j.dispose(),Q.dispose(),pe.dispose(),J.dispose(),ne.dispose(),r.current&&x.domElement&&r.current.removeChild(x.domElement)}},[s,o,c]),me.useEffect(()=>{i&&i({diskColor:o,glowColor:c,autoRotate:s})},[o,c,s,i]),ce.jsx("div",{className:"relative w-full h-full",children:ce.jsx("div",{ref:r,className:"w-full h-full"})})},Dg=({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,h=()=>r?me.isValidElement(r)?ce.jsx("div",{style:{width:`${c}px`,height:`${c}px`,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:me.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?ce.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:ce.jsx("path",{d:s})}):n||ce.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:ce.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 ce.jsxs(Et.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:[ce.jsx(Et.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"}}),
|
|
4123
|
+
`},animate:{rotate:[0,-360]},transition:{duration:8,repeat:1/0,ease:"linear"}}),ce.jsx(Et.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"}}),
|
|
4131
|
+
rgb(200 200 220 / 0.5)) border-box`},animate:{rotate:[0,360]},transition:{duration:12,repeat:1/0,ease:"linear"}}),ce.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:h()})]})};class Tg{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 Ag=({colors:i,gap:e,speed:t,pixelSize:n,isActive:r})=>{const s=me.useRef(null),a=me.useRef([]),o=me.useRef(null),l=me.useRef(0);return me.useEffect(()=>{l.current=performance.now()},[]),me.useEffect(()=>{const c=s.current;if(!c)return;const h=c.getContext("2d"),d=c.parentElement.getBoundingClientRect(),u=Math.floor(d.width),p=Math.floor(d.height);c.width=u,c.height=p,c.style.width=`${u}px`,c.style.height=`${p}px`,a.current=[];const _=(v,m)=>{const f=v-u/2,b=m-p/2;return Math.sqrt(f*f+b*b)};for(let v=0;v<u;v+=e)for(let m=0;m<p;m+=e){const f=i[Math.floor(Math.random()*i.length)],b=_(v,m);a.current.push(new Tg(c,h,v,m,f,t,b,n))}},[i,e,t,n]),me.useEffect(()=>{const c=h=>{const d=s.current;if(!d)return;const u=d.getContext("2d"),p=1e3/60,_=()=>{o.current=requestAnimationFrame(_);const v=performance.now(),m=v-l.current;if(!(m<p)){l.current=v-m%p,u.clearRect(0,0,d.width,d.height);for(let f=0;f<a.current.length;f++)a.current[f][h]();a.current.every(f=>f.isIdle)&&cancelAnimationFrame(o.current)}};_()};if(o.current&&cancelAnimationFrame(o.current),a.current.length!==0)return c(r?"appear":"disappear"),()=>{o.current&&cancelAnimationFrame(o.current)}},[r]),ce.jsx("canvas",{ref:s,className:"absolute inset-0 w-full h-full"})},wg=({colors:i=["#e0f2fe","#7dd3fc","#0ea5e9"],gap:e=5,speed:t=.035,pixelSize:n=2,onParamsChange:r})=>{const[s,a]=me.useState(!1);return me.useEffect(()=>{r&&r({colors:i,gap:e,speed:t,pixelSize:n})},[i,e,t,n,r]),ce.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:[ce.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}}),ce.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}}),ce.jsx(Ag,{colors:i,gap:e,speed:t,pixelSize:n,isActive:s}),ce.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=me.useRef(null),a=me.useRef([]);me.useEffect(()=>{if(!s.current)return;a.current.forEach(c=>{if(c){const h=window.innerWidth*.5/16,d=-Math.random()*h+"rem",u=window.innerWidth*.5/16,p=-Math.random()*u+"rem";c.style.setProperty("--left",d),c.style.setProperty("--right",p)}})},[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 ce.jsxs(ce.Fragment,{children:[ce.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,11 +4227,11 @@ void main() {
|
|
|
4227
4227
|
--translate-z: 2000px;
|
|
4228
4228
|
}
|
|
4229
4229
|
}
|
|
4230
|
-
`}),z.jsxs("section",{ref:s,className:`gallery3d-container ${r}`,style:{"--count":t,"--duration":`${n}s`},children:[z.jsx("h1",{className:"gallery3d-title",children:e}),z.jsx("div",{children:o.map((l,c)=>z.jsx("img",{ref:d=>a.current[c]=d,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))})]})]})},W0=({onParamsChange:i})=>{const[e,t]=se.useState({title:"SPARK GALLERY",count:10,duration:16,images:["https://images.pexels.com/photos/614117/pexels-photo-614117.jpeg","https://images.unsplash.com/photo-1505238680356-667803448bb6?q=80&w=1170&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D","https://images.pexels.com/photos/270360/pexels-photo-270360.jpeg","https://images.pexels.com/photos/6424587/pexels-photo-6424587.jpeg","https://images.pexels.com/photos/29445973/pexels-photo-29445973.jpeg","https://images.pexels.com/photos/10725897/pexels-photo-10725897.jpeg","https://images.pexels.com/photos/3888151/pexels-photo-3888151.jpeg","https://images.pexels.com/photos/34600/pexels-photo.jpg","https://images.pexels.com/photos/943096/pexels-photo-943096.jpeg","https://images.pexels.com/photos/6424589/pexels-photo-6424589.jpeg"]}),n=s=>{t(s),i&&i(s)};se.useEffect(()=>{i&&i(e)},[]);const r=[{type:"text",key:"title",label:"title",placeholder:"Enter title..."},{type:"number",key:"count",label:"count",min:1,max:20,step:1},{type:"number",key:"duration",label:"duration",min:5,max:30,step:1}];return z.jsxs("div",{className:"w-full space-y-6",children:[z.jsx("div",{className:"relative flex items-center justify-center h-[600px] rounded-xl border border-zinc-200 dark:border-zinc-800 bg-black overflow-hidden",children:z.jsx(G0,{title:e.title,count:e.count,duration:e.duration,images:e.images})}),z.jsx(Tt,{config:e,onChange:n,fields:r})]})},X0=({speed:i=.1,lineColor:e="#4499ff",pointColors:t=["#00ff00","#ffff00","#4499ff"],fogDensity:n=.7,bloomStrength:r=7,className:s=""})=>{const a=se.useRef(null),o=se.useRef(null),l=se.useRef(null);return se.useEffect(()=>{if(!a.current)return;const c=a.current.querySelector("canvas");c&&a.current.removeChild(c);const d=a.current.clientWidth,u=a.current.clientHeight,h=new Il;h.fog=new Br(0,n),o.current=h;const p=new Lt(75,d/u,.1,1e3);p.position.z=5;const _=new Ul({antialias:!0});_.setSize(d,u),_.toneMapping=Xs,_.outputColorSpace=It,a.current.appendChild(_.domElement);const x=new Vl(p,_.domElement);x.enableDamping=!0,x.dampingFactor=.03;const m=new Yl(h,p),f=new On(new he(d,u),1.5,.4,100);f.threshold=.002,f.strength=r,f.radius=0;const b=new jl(_);b.addPass(m),b.addPass(f);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],D=[],P=v.length;for(let N=0;N<P;N+=3)D.push(new R(v[N],v[N+1],v[N+2]));const T=new Bl(D),w=T.getPoints(100),L=new _t().setFromPoints(w),S=new ks({color:new be(e)}),y=new Ol(L,S);h.add(y);const U=new Zs(T,222,.65,16,!0),I=U.attributes.position,C=new Oi(.01,.01,.01),k=t.map(N=>new be(N)),G=[];for(let N=0;N<I.count;N++){const Q=I.getX(N),ue=I.getY(N),ie=I.getZ(N),ve=N%k.length,De=new Hi({color:k[ve]}),Ce=new bt(C,De);Ce.position.set(Q,ue,ie),h.add(Ce),G.push(Ce)}const $=new T0(U,.35),te=new ks({color:new be(e)}),B=new l0($,te);h.add(B);let K=0;const q=20*400;function F(N){K=N*i;const Q=K%q/q,ue=T.getPointAt(Q),ie=T.getPointAt((Q+.01)%1);p.position.copy(ue),p.lookAt(ie)}function ee(N=0){l.current=requestAnimationFrame(ee),F(N),b.render(h,p),x.update()}ee();const me=()=>{if(!a.current)return;const N=a.current.clientWidth,Q=a.current.clientHeight;p.aspect=N/Q,p.updateProjectionMatrix(),_.setSize(N,Q),b.setSize(N,Q),f.resolution.set(N,Q)};return window.addEventListener("resize",me),()=>{window.removeEventListener("resize",me),l.current&&cancelAnimationFrame(l.current),_.dispose(),L.dispose(),S.dispose(),C.dispose(),G.forEach(N=>{N.material.dispose(),h.remove(N)}),$.dispose(),te.dispose(),U.dispose(),a.current&&_.domElement&&a.current.removeChild(_.domElement)}},[i,e,t,n,r]),z.jsx("div",{className:`relative w-full h-full ${s}`,children:z.jsx("div",{ref:a,className:"w-full h-full"})})},j0=({onParamsChange:i})=>{const[e,t]=se.useState({speed:.1,lineColor:"#4499ff",pointColor1:"#00ff00",pointColor2:"#ffff00",pointColor3:"#4499ff",fogDensity:.7,bloomStrength:7}),n=s=>{t(s),i&&i({...s,pointColors:[s.pointColor1,s.pointColor2,s.pointColor3]})};se.useEffect(()=>{i&&i({...e,pointColors:[e.pointColor1,e.pointColor2,e.pointColor3]})},[]);const r=[{type:"number",key:"speed",label:"speed",min:.01,max:.5,step:.01},{type:"color",key:"lineColor",label:"lineColor",placeholder:"#4499ff"},{type:"color",key:"pointColor1",label:"pointColor1",placeholder:"#00ff00"},{type:"color",key:"pointColor2",label:"pointColor2",placeholder:"#ffff00"},{type:"color",key:"pointColor3",label:"pointColor3",placeholder:"#4499ff"},{type:"number",key:"fogDensity",label:"fogDensity",min:.1,max:2,step:.1},{type:"number",key:"bloomStrength",label:"bloomStrength",min:0,max:15,step:.5}];return z.jsxs("div",{className:"w-full space-y-6",children:[z.jsx("div",{className:"relative flex items-center justify-center h-[600px] rounded-xl border border-zinc-200 dark:border-zinc-800 bg-black overflow-hidden",children:z.jsx(X0,{speed:e.speed,lineColor:e.lineColor,pointColors:[e.pointColor1,e.pointColor2,e.pointColor3],fogDensity:e.fogDensity,bloomStrength:e.bloomStrength})}),z.jsx(Tt,{config:e,onChange:n,fields:r})]})};class Y0{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),d=this.random(n+1+(r+1)*57),u=s*s*(3-2*s),h=a*a*(3-2*a);return o*(1-u)*(1-h)+l*u*(1-h)+c*(1-u)*h+d*u*h}octavedNoise(e,t,n,r,s,a,o=0,l=0,c=1){let d=0,u=s,h=a;for(let p=0;p<t;p++){let _=u;p===0&&(_*=c),d+=_*this.noise2D(h*e+l*100,o*h*.3),h*=n,u*=r}return d}getRoundedRectPoint(e,t,n,r,s,a){const o=r-2*a,l=s-2*a,c=Math.PI*a/2,d=2*o+2*l+4*c,u=e*d;let h=0;if(u<=h+o){const _=(u-h)/o;return{x:t+a+_*o,y:n}}if(h+=o,u<=h+c){const _=(u-h)/c;return this.getCornerPoint(t+r-a,n+a,a,-Math.PI/2,Math.PI/2,_)}if(h+=c,u<=h+l){const _=(u-h)/l;return{x:t+r,y:n+a+_*l}}if(h+=l,u<=h+c){const _=(u-h)/c;return this.getCornerPoint(t+r-a,n+s-a,a,0,Math.PI/2,_)}if(h+=c,u<=h+o){const _=(u-h)/o;return{x:t+r-a-_*o,y:n+s}}if(h+=o,u<=h+c){const _=(u-h)/c;return this.getCornerPoint(t+a,n+s-a,a,Math.PI/2,Math.PI/2,_)}if(h+=c,u<=h+l){const _=(u-h)/l;return{x:t,y:n+s-a-_*l}}h+=l;const p=(u-h)/c;return this.getCornerPoint(t+a,n+a,a,Math.PI,Math.PI/2,p)}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),d=2*(a+o)+2*Math.PI*c,u=Math.floor(d/2);this.ctx.beginPath();for(let h=0;h<=u;h++){const p=h/u,_=this.getRoundedRectPoint(p,r,s,a,o,c),x=this.octavedNoise(p*8,this.octaves,this.lacunarity,this.gain,this.amplitude,this.frequency,this.time,0,this.baseFlatness),m=this.octavedNoise(p*8,this.octaves,this.lacunarity,this.gain,this.amplitude,this.frequency,this.time,1,this.baseFlatness),f=_.x+x*n,b=_.y+m*n;h===0?this.ctx.moveTo(f,b):this.ctx.lineTo(f,b)}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 q0=({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=se.useRef(null),c=se.useRef(null);se.useEffect(()=>{if(!l.current)return;const h=new Y0(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()}},[]),se.useEffect(()=>{c.current&&c.current.updateOptions({color:t,speed:n})},[t,n]);const d=t,u=t+"66";return z.jsxs(z.Fragment,{children:[z.jsx("style",{children:`
|
|
4230
|
+
`}),ce.jsxs("section",{ref:s,className:`gallery3d-container ${r}`,style:{"--count":t,"--duration":`${n}s`},children:[ce.jsx("h1",{className:"gallery3d-title",children:e}),ce.jsx("div",{children:o.map((l,c)=>ce.jsx("img",{ref:h=>a.current[c]=h,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))})]})]})},Rg=({speed:i=.1,lineColor:e="#4499ff",pointColors:t=["#00ff00","#ffff00","#4499ff"],fogDensity:n=.7,bloomStrength:r=7,className:s=""})=>{const a=me.useRef(null),o=me.useRef(null),l=me.useRef(null);return me.useEffect(()=>{if(!a.current)return;const c=a.current.querySelector("canvas");c&&a.current.removeChild(c);const h=a.current.clientWidth,d=a.current.clientHeight,u=new Ul;u.fog=new Or(0,n),o.current=u;const p=new Rt(75,h/d,.1,1e3);p.position.z=5;const _=new Fl({antialias:!0});_.setSize(h,d),_.toneMapping=Gs,_.outputColorSpace=Ut,a.current.appendChild(_.domElement);const v=new kl(p,_.domElement);v.enableDamping=!0,v.dampingFactor=.03;const m=new Xl(u,p),f=new Nn(new ue(h,d),1.5,.4,100);f.threshold=.002,f.strength=r,f.radius=0;const b=new Wl(_);b.addPass(m),b.addPass(f);const x=[-.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],D=[],P=x.length;for(let U=0;U<P;U+=3)D.push(new R(x[U],x[U+1],x[U+2]));const T=new Ol(D),w=T.getPoints(100),L=new _t().setFromPoints(w),E=new Bs({color:new be(e)}),M=new Nl(L,E);u.add(M);const N=new $s(T,222,.65,16,!0),I=N.attributes.position,C=new Ni(.01,.01,.01),z=t.map(U=>new be(U)),V=[];for(let U=0;U<I.count;U++){const J=I.getX(U),le=I.getY(U),ne=I.getZ(U),xe=U%z.length,De=new zi({color:z[xe]}),Ce=new bt(C,De);Ce.position.set(J,le,ne),u.add(Ce),V.push(Ce)}const q=new _g(N,.35),ee=new Bs({color:new be(e)}),B=new Qm(q,ee);u.add(B);let $=0;const j=20*400;function F(U){$=U*i;const J=$%j/j,le=T.getPointAt(J),ne=T.getPointAt((J+.01)%1);p.position.copy(le),p.lookAt(ne)}function Q(U=0){l.current=requestAnimationFrame(Q),F(U),b.render(u,p),v.update()}Q();const pe=()=>{if(!a.current)return;const U=a.current.clientWidth,J=a.current.clientHeight;p.aspect=U/J,p.updateProjectionMatrix(),_.setSize(U,J),b.setSize(U,J),f.resolution.set(U,J)};return window.addEventListener("resize",pe),()=>{window.removeEventListener("resize",pe),l.current&&cancelAnimationFrame(l.current),_.dispose(),L.dispose(),E.dispose(),C.dispose(),V.forEach(U=>{U.material.dispose(),u.remove(U)}),q.dispose(),ee.dispose(),N.dispose(),a.current&&_.domElement&&a.current.removeChild(_.domElement)}},[i,e,t,n,r]),ce.jsx("div",{className:`relative w-full h-full ${s}`,children:ce.jsx("div",{ref:a,className:"w-full h-full"})})};class Pg{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),h=this.random(n+1+(r+1)*57),d=s*s*(3-2*s),u=a*a*(3-2*a);return o*(1-d)*(1-u)+l*d*(1-u)+c*(1-d)*u+h*d*u}octavedNoise(e,t,n,r,s,a,o=0,l=0,c=1){let h=0,d=s,u=a;for(let p=0;p<t;p++){let _=d;p===0&&(_*=c),h+=_*this.noise2D(u*e+l*100,o*u*.3),u*=n,d*=r}return h}getRoundedRectPoint(e,t,n,r,s,a){const o=r-2*a,l=s-2*a,c=Math.PI*a/2,h=2*o+2*l+4*c,d=e*h;let u=0;if(d<=u+o){const _=(d-u)/o;return{x:t+a+_*o,y:n}}if(u+=o,d<=u+c){const _=(d-u)/c;return this.getCornerPoint(t+r-a,n+a,a,-Math.PI/2,Math.PI/2,_)}if(u+=c,d<=u+l){const _=(d-u)/l;return{x:t+r,y:n+a+_*l}}if(u+=l,d<=u+c){const _=(d-u)/c;return this.getCornerPoint(t+r-a,n+s-a,a,0,Math.PI/2,_)}if(u+=c,d<=u+o){const _=(d-u)/o;return{x:t+r-a-_*o,y:n+s}}if(u+=o,d<=u+c){const _=(d-u)/c;return this.getCornerPoint(t+a,n+s-a,a,Math.PI/2,Math.PI/2,_)}if(u+=c,d<=u+l){const _=(d-u)/l;return{x:t,y:n+s-a-_*l}}u+=l;const p=(d-u)/c;return this.getCornerPoint(t+a,n+a,a,Math.PI,Math.PI/2,p)}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),h=2*(a+o)+2*Math.PI*c,d=Math.floor(h/2);this.ctx.beginPath();for(let u=0;u<=d;u++){const p=u/d,_=this.getRoundedRectPoint(p,r,s,a,o,c),v=this.octavedNoise(p*8,this.octaves,this.lacunarity,this.gain,this.amplitude,this.frequency,this.time,0,this.baseFlatness),m=this.octavedNoise(p*8,this.octaves,this.lacunarity,this.gain,this.amplitude,this.frequency,this.time,1,this.baseFlatness),f=_.x+v*n,b=_.y+m*n;u===0?this.ctx.moveTo(f,b):this.ctx.lineTo(f,b)}this.ctx.closePath(),this.ctx.stroke(),this.animationId=requestAnimationFrame(u=>this.drawElectricBorder(u))}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 Lg=({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=me.useRef(null),c=me.useRef(null);me.useEffect(()=>{if(!l.current)return;const u=new Pg(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=u,u.start(),()=>{u.stop()}},[]),me.useEffect(()=>{c.current&&c.current.updateOptions({color:t,speed:n})},[t,n]);const h=t,d=t+"66";return ce.jsxs(ce.Fragment,{children:[ce.jsx("style",{children:`
|
|
4231
4231
|
.electric-border-card {
|
|
4232
4232
|
--electric-border-color: ${t};
|
|
4233
|
-
--electric-light-color: ${
|
|
4234
|
-
--gradient-color: ${
|
|
4233
|
+
--electric-light-color: ${h};
|
|
4234
|
+
--gradient-color: ${d};
|
|
4235
4235
|
--color-neutral-900: oklch(0.185 0 0);
|
|
4236
4236
|
}
|
|
4237
4237
|
|
|
@@ -4470,11 +4470,11 @@ void main() {
|
|
|
4470
4470
|
transparent
|
|
4471
4471
|
);
|
|
4472
4472
|
}
|
|
4473
|
-
`}),
|
|
4473
|
+
`}),ce.jsx("div",{className:`electric-border-card ${o}`,children:ce.jsxs("div",{className:"electric-border-card-container",children:[ce.jsxs("div",{className:"electric-border-inner-container",children:[ce.jsx("div",{className:"electric-border-canvas-container",children:ce.jsx("canvas",{ref:l,className:"electric-border-canvas",width:475,height:625})}),ce.jsx("div",{className:"electric-border-glow-layer-1"}),ce.jsx("div",{className:"electric-border-glow-layer-2"})]}),ce.jsx("div",{className:"electric-border-overlay-1"}),ce.jsx("div",{className:"electric-border-overlay-2"}),ce.jsx("div",{className:"electric-border-background-glow"}),ce.jsxs("div",{className:"electric-border-content-container",children:[ce.jsxs("div",{className:"electric-border-content-top",children:[ce.jsx("div",{className:"electric-border-button-glass",children:a}),ce.jsx("p",{className:"electric-border-title",children:r})]}),ce.jsx("hr",{className:"electric-border-divider"}),ce.jsx("div",{className:"electric-border-content-bottom",children:ce.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=me.useRef(null),l=me.useRef(null),c=me.useRef([]),h=["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:h;return me.useEffect(()=>{if(!l.current||!c.current.length)return;const u=c.current,p=u.length;[...u].reverse().forEach((_,v)=>{if(!_)return;const m=v/p*Math.PI*2,f=Math.sin(m)*t;_.style.transform=`
|
|
4474
4474
|
rotateX(${m*180/Math.PI}deg)
|
|
4475
4475
|
translateZ(${e}px)
|
|
4476
4476
|
rotateY(${f}deg)
|
|
4477
|
-
`})},[i,e,t]),
|
|
4477
|
+
`})},[i,e,t]),me.useEffect(()=>{c.current.forEach((u,p)=>{if(!u)return;const _=d[p%d.length];_&&(u.style.background=`url(${_}) center/cover no-repeat`)})},[d,i]),me.useEffect(()=>{if(!l.current)return;const u=()=>{const p=document.body.scrollHeight-window.innerHeight,v=(p>0?window.scrollY/p:0)*360;l.current&&(l.current.style.transform=`rotateX(${v}deg)`)};return window.addEventListener("scroll",u),u(),()=>{window.removeEventListener("scroll",u)}},[]),ce.jsxs(ce.Fragment,{children:[ce.jsx("style",{children:`
|
|
4478
4478
|
.scroll-cards-3d-scene {
|
|
4479
4479
|
position: sticky;
|
|
4480
4480
|
top: 0;
|
|
@@ -4511,5 +4511,5 @@ void main() {
|
|
|
4511
4511
|
backface-visibility: hidden;
|
|
4512
4512
|
transform-origin: center center;
|
|
4513
4513
|
}
|
|
4514
|
-
`}),
|
|
4514
|
+
`}),ce.jsx("div",{className:`scroll-cards-3d-scene ${a}`,ref:o,children:ce.jsx("div",{className:"scroll-cards-3d-container",ref:l,children:Array.from({length:i},(u,p)=>ce.jsx("div",{className:"scroll-cards-3d-card",ref:_=>{_&&(c.current[p]=_)}},p))})})]})},Ug=({onClick:i,size:e=400,className:t="",icon:n,hoverGradient:r="linear-gradient(180deg, #3EF7A4 0%, rgba(62, 247, 164, 0) 100%)"})=>{const s=me.useRef(null),a=me.useRef(null),o=me.useRef(null),[l,c]=me.useState(!1),h=400,d=e/h;me.useEffect(()=>{let _=!0;return(async()=>{try{const{liquidMetalFragmentShader:m,ShaderMount:f}=await import("https://esm.sh/@paper-design/shaders");if(!_||!s.current)return;a.current&&(typeof a.current.destroy=="function"&&a.current.destroy(),a.current=null);const b=new f(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=b}catch(m){console.error("Failed to load shader:",m)}})(),()=>{_=!1,a.current&&(typeof a.current.destroy=="function"&&a.current.destroy(),a.current=null)}},[]);const u=h*.52,p=()=>n&&me.isValidElement(n)?ce.jsx("div",{style:{width:`${u}px`,height:`${u}px`,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,position:"relative",zIndex:1},children:me.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:`${u}px`,transition:"color 0.3s ease",...n.props?.style}})}):null;return ce.jsx("div",{className:`relative ${t}`,style:{width:`${e}px`,height:`${e}px`,display:"flex",alignItems:"center",justifyContent:"center"},children:ce.jsxs("div",{style:{width:`${h}px`,height:`${h}px`,transform:`scale(${d})`,transformOrigin:"center center",borderRadius:"50%",position:"relative"},children:[ce.jsx("div",{ref:s,id:"liquid-metal-container",style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:`${h}px`,height:`${h}px`,borderRadius:"50%",overflow:"hidden"}}),ce.jsx("div",{style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:`${h*.91}px`,height:`${h*.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}}),ce.jsx("div",{className:"outline group",style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",display:"flex",alignItems:"center",justifyContent:"center",width:`${h*1.01}px`,height:`${h*1.01}px`,borderRadius:"50%",zIndex:1,pointerEvents:"none"},children:ce.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"}})}),ce.jsx("div",{style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:2,pointerEvents:"none"},children:p()}),ce.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)})]})})};function Yl(...i){return i.filter(Boolean).join(" ")}exports.BlackHole=bg;exports.BlurText=lc;exports.CircularText=uc;exports.ElectricBorder=Lg;exports.FallingPattern=Ec;exports.FlowingDashedBox=Sc;exports.Gallery3D=Cg;exports.LiquidMetalButton=Ug;exports.MetalButton=Dg;exports.PixelCard=wg;exports.ScrambledText=Mc;exports.ScrollCards3D=Fg;exports.ShinyText=yc;exports.Tunnel3D=Rg;exports.cn=Yl;
|
|
4515
4515
|
//# sourceMappingURL=index.cjs.map
|