diff --git a/assets/index-3fa8a7ce.js b/assets/index-0bdaf7ac.js similarity index 98% rename from assets/index-3fa8a7ce.js rename to assets/index-0bdaf7ac.js index 6f09970..5ea0153 100644 --- a/assets/index-3fa8a7ce.js +++ b/assets/index-0bdaf7ac.js @@ -35,17 +35,17 @@ `),r=i.stack.split(` `),o=s.length-1,a=r.length-1;1<=o&&0<=a&&s[o]!==r[a];)a--;for(;1<=o&&0<=a;o--,a--)if(s[o]!==r[a]){if(o!==1||a!==1)do if(o--,a--,0>a||s[o]!==r[a]){var l=` `+s[o].replace(" at new "," at ");return n.displayName&&l.includes("")&&(l=l.replace("",n.displayName)),l}while(1<=o&&0<=a);break}}}finally{lm=!1,Error.prepareStackTrace=t}return(n=n?n.displayName||n.name:"")?dI(n):""}function m5(n){switch(n.tag){case 5:return dI(n.type);case 16:return dI("Lazy");case 13:return dI("Suspense");case 19:return dI("SuspenseList");case 0:case 2:case 15:return n=gm(n.type,!1),n;case 11:return n=gm(n.type.render,!1),n;case 1:return n=gm(n.type,!0),n;default:return""}}function Yf(n){if(n==null)return null;if(typeof n=="function")return n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case Ag:return"Fragment";case hg:return"Portal";case Nf:return"Profiler";case Vb:return"StrictMode";case Hf:return"Suspense";case Xf:return"SuspenseList"}if(typeof n=="object")switch(n.$$typeof){case XS:return(n.displayName||"Context")+".Consumer";case HS:return(n._context.displayName||"Context")+".Provider";case Mb:var e=n.render;return n=n.displayName,n||(n=e.displayName||e.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case Nb:return e=n.displayName||null,e!==null?e:Yf(n.type)||"Memo";case zo:e=n._payload,n=n._init;try{return Yf(n(e))}catch{}}return null}function f5(n){var e=n.type;switch(n.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return n=e.render,n=n.displayName||n.name||"",e.displayName||(n!==""?"ForwardRef("+n+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Yf(e);case 8:return e===Vb?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function sa(n){switch(typeof n){case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function FS(n){var e=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function b5(n){var e=FS(n)?"checked":"value",t=Object.getOwnPropertyDescriptor(n.constructor.prototype,e),i=""+n[e];if(!n.hasOwnProperty(e)&&typeof t<"u"&&typeof t.get=="function"&&typeof t.set=="function"){var s=t.get,r=t.set;return Object.defineProperty(n,e,{configurable:!0,get:function(){return s.call(this)},set:function(o){i=""+o,r.call(this,o)}}),Object.defineProperty(n,e,{enumerable:t.enumerable}),{getValue:function(){return i},setValue:function(o){i=""+o},stopTracking:function(){n._valueTracker=null,delete n[e]}}}}function _C(n){n._valueTracker||(n._valueTracker=b5(n))}function KS(n){if(!n)return!1;var e=n._valueTracker;if(!e)return!0;var t=e.getValue(),i="";return n&&(i=FS(n)?n.checked?"true":"false":n.value),n=i,n!==t?(e.setValue(n),!0):!1}function Nh(n){if(n=n||(typeof document<"u"?document:void 0),typeof n>"u")return null;try{return n.activeElement||n.body}catch{return n.body}}function Ff(n,e){var t=e.checked;return fn({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:t??n._wrapperState.initialChecked})}function aB(n,e){var t=e.defaultValue==null?"":e.defaultValue,i=e.checked!=null?e.checked:e.defaultChecked;t=sa(e.value!=null?e.value:t),n._wrapperState={initialChecked:i,initialValue:t,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function zS(n,e){e=e.checked,e!=null&&Wb(n,"checked",e,!1)}function Kf(n,e){zS(n,e);var t=sa(e.value),i=e.type;if(t!=null)i==="number"?(t===0&&n.value===""||n.value!=t)&&(n.value=""+t):n.value!==""+t&&(n.value=""+t);else if(i==="submit"||i==="reset"){n.removeAttribute("value");return}e.hasOwnProperty("value")?zf(n,e.type,t):e.hasOwnProperty("defaultValue")&&zf(n,e.type,sa(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(n.defaultChecked=!!e.defaultChecked)}function lB(n,e,t){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var i=e.type;if(!(i!=="submit"&&i!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+n._wrapperState.initialValue,t||e===n.value||(n.value=e),n.defaultValue=e}t=n.name,t!==""&&(n.name=""),n.defaultChecked=!!n._wrapperState.initialChecked,t!==""&&(n.name=t)}function zf(n,e,t){(e!=="number"||Nh(n.ownerDocument)!==n)&&(t==null?n.defaultValue=""+n._wrapperState.initialValue:n.defaultValue!==""+t&&(n.defaultValue=""+t))}var hI=Array.isArray;function Hg(n,e,t,i){if(n=n.options,e){e={};for(var s=0;s"+e.valueOf().toString()+"",e=JC.firstChild;n.firstChild;)n.removeChild(n.firstChild);for(;e.firstChild;)n.appendChild(e.firstChild)}});function EI(n,e){if(e){var t=n.firstChild;if(t&&t===n.lastChild&&t.nodeType===3){t.nodeValue=e;return}}n.textContent=e}var yI={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},v5=["Webkit","ms","Moz","O"];Object.keys(yI).forEach(function(n){v5.forEach(function(e){e=e+n.charAt(0).toUpperCase()+n.substring(1),yI[e]=yI[n]})});function kS(n,e,t){return e==null||typeof e=="boolean"||e===""?"":t||typeof e!="number"||e===0||yI.hasOwnProperty(n)&&yI[n]?(""+e).trim():e+"px"}function DS(n,e){n=n.style;for(var t in e)if(e.hasOwnProperty(t)){var i=t.indexOf("--")===0,s=kS(t,e[t],i);t==="float"&&(t="cssFloat"),i?n.setProperty(t,s):n[t]=s}}var y5=fn({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Ef(n,e){if(e){if(y5[n]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(we(137,n));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(we(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(we(61))}if(e.style!=null&&typeof e.style!="object")throw Error(we(62))}}function kf(n,e){if(n.indexOf("-")===-1)return typeof e.is=="string";switch(n){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Df=null;function Hb(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var Uf=null,Xg=null,Yg=null;function IB(n){if(n=xu(n)){if(typeof Uf!="function")throw Error(we(280));var e=n.stateNode;e&&(e=AA(e),Uf(n.stateNode,n.type,e))}}function US(n){Xg?Yg?Yg.push(n):Yg=[n]:Xg=n}function PS(){if(Xg){var n=Xg,e=Yg;if(Yg=Xg=null,IB(n),e)for(n=0;n>>=0,n===0?32:31-(N5(n)/H5|0)|0}var OC=64,QC=4194304;function AI(n){switch(n&-n){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return n&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return n&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return n}}function Fh(n,e){var t=n.pendingLanes;if(t===0)return 0;var i=0,s=n.suspendedLanes,r=n.pingedLanes,o=t&268435455;if(o!==0){var a=o&~s;a!==0?i=AI(a):(r&=o,r!==0&&(i=AI(r)))}else o=t&~s,o!==0?i=AI(o):r!==0&&(i=AI(r));if(i===0)return 0;if(e!==0&&e!==i&&!(e&s)&&(s=i&-i,r=e&-e,s>=r||s===16&&(r&4194240)!==0))return e;if(i&4&&(i|=t&16),e=n.entangledLanes,e!==0)for(n=n.entanglements,e&=i;0t;t++)e.push(n);return e}function wu(n,e,t){n.pendingLanes|=e,e!==536870912&&(n.suspendedLanes=0,n.pingedLanes=0),n=n.eventTimes,e=31-ar(e),n[e]=t}function K5(n,e){var t=n.pendingLanes&~e;n.pendingLanes=e,n.suspendedLanes=0,n.pingedLanes=0,n.expiredLanes&=e,n.mutableReadLanes&=e,n.entangledLanes&=e,e=n.entanglements;var i=n.eventTimes;for(n=n.expirationTimes;0=BI),bB=String.fromCharCode(32),vB=!1;function ux(n,e){switch(n){case"keyup":return uN.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Cx(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var pg=!1;function dN(n,e){switch(n){case"compositionend":return Cx(e);case"keypress":return e.which!==32?null:(vB=!0,bB);case"textInput":return n=e.data,n===bB&&vB?null:n;default:return null}}function hN(n,e){if(pg)return n==="compositionend"||!Eb&&ux(n,e)?(n=cx(),Ch=zb=Do=null,pg=!1,n):null;switch(n){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1=e)return{node:t,offset:e-n};n=i}e:{for(;t;){if(t.nextSibling){t=t.nextSibling;break e}t=t.parentNode}t=void 0}t=ZB(t)}}function px(n,e){return n&&e?n===e?!0:n&&n.nodeType===3?!1:e&&e.nodeType===3?px(n,e.parentNode):"contains"in n?n.contains(e):n.compareDocumentPosition?!!(n.compareDocumentPosition(e)&16):!1:!1}function mx(){for(var n=window,e=Nh();e instanceof n.HTMLIFrameElement;){try{var t=typeof e.contentWindow.location.href=="string"}catch{t=!1}if(t)n=e.contentWindow;else break;e=Nh(n.document)}return e}function kb(n){var e=n&&n.nodeName&&n.nodeName.toLowerCase();return e&&(e==="input"&&(n.type==="text"||n.type==="search"||n.type==="tel"||n.type==="url"||n.type==="password")||e==="textarea"||n.contentEditable==="true")}function BN(n){var e=mx(),t=n.focusedElem,i=n.selectionRange;if(e!==t&&t&&t.ownerDocument&&px(t.ownerDocument.documentElement,t)){if(i!==null&&kb(t)){if(e=i.start,n=i.end,n===void 0&&(n=e),"selectionStart"in t)t.selectionStart=e,t.selectionEnd=Math.min(n,t.value.length);else if(n=(e=t.ownerDocument||document)&&e.defaultView||window,n.getSelection){n=n.getSelection();var s=t.textContent.length,r=Math.min(i.start,s);i=i.end===void 0?r:Math.min(i.end,s),!n.extend&&r>i&&(s=i,i=r,r=s),s=wB(t,r);var o=wB(t,i);s&&o&&(n.rangeCount!==1||n.anchorNode!==s.node||n.anchorOffset!==s.offset||n.focusNode!==o.node||n.focusOffset!==o.offset)&&(e=e.createRange(),e.setStart(s.node,s.offset),n.removeAllRanges(),r>i?(n.addRange(e),n.extend(o.node,o.offset)):(e.setEnd(o.node,o.offset),n.addRange(e)))}}for(e=[],n=t;n=n.parentNode;)n.nodeType===1&&e.push({element:n,left:n.scrollLeft,top:n.scrollTop});for(typeof t.focus=="function"&&t.focus(),t=0;t=document.documentMode,mg=null,jf=null,wI=null,qf=!1;function SB(n,e,t){var i=t.window===t?t.document:t.nodeType===9?t:t.ownerDocument;qf||mg==null||mg!==Nh(i)||(i=mg,"selectionStart"in i&&kb(i)?i={start:i.selectionStart,end:i.selectionEnd}:(i=(i.ownerDocument&&i.ownerDocument.defaultView||window).getSelection(),i={anchorNode:i.anchorNode,anchorOffset:i.anchorOffset,focusNode:i.focusNode,focusOffset:i.focusOffset}),wI&&JI(wI,i)||(wI=i,i=Lh(jf,"onSelect"),0vg||(n.current=s0[vg],s0[vg]=null,vg--)}function sn(n,e){vg++,s0[vg]=n.current,n.current=e}var ra={},vi=ua(ra),Oi=ua(!1),gl=ra;function Pg(n,e){var t=n.type.contextTypes;if(!t)return ra;var i=n.stateNode;if(i&&i.__reactInternalMemoizedUnmaskedChildContext===e)return i.__reactInternalMemoizedMaskedChildContext;var s={},r;for(r in t)s[r]=e[r];return i&&(n=n.stateNode,n.__reactInternalMemoizedUnmaskedChildContext=e,n.__reactInternalMemoizedMaskedChildContext=s),s}function Qi(n){return n=n.childContextTypes,n!=null}function Eh(){ln(Oi),ln(vi)}function HB(n,e,t){if(vi.current!==ra)throw Error(we(168));sn(vi,e),sn(Oi,t)}function Sx(n,e,t){var i=n.stateNode;if(e=e.childContextTypes,typeof i.getChildContext!="function")return t;i=i.getChildContext();for(var s in i)if(!(s in e))throw Error(we(108,f5(n)||"Unknown",s));return fn({},t,i)}function kh(n){return n=(n=n.stateNode)&&n.__reactInternalMemoizedMergedChildContext||ra,gl=vi.current,sn(vi,n),sn(Oi,Oi.current),!0}function XB(n,e,t){var i=n.stateNode;if(!i)throw Error(we(169));t?(n=Sx(n,e,gl),i.__reactInternalMemoizedMergedChildContext=n,ln(Oi),ln(vi),sn(vi,n)):ln(Oi),sn(Oi,t)}var to=null,pA=!1,Gm=!1;function xx(n){to===null?to=[n]:to.push(n)}function YN(n){pA=!0,xx(n)}function Ca(){if(!Gm&&to!==null){Gm=!0;var n=0,e=Qt;try{var t=to;for(Qt=1;n>=o,s-=o,so=1<<32-ar(e)+s|t<M?(Z=R,R=null):Z=R.sibling;var V=d(A,R,f[M],B);if(V===null){R===null&&(R=Z);break}n&&R&&V.alternate===null&&e(A,R),b=r(V,b,M),x===null?S=V:x.sibling=V,x=V,R=Z}if(M===f.length)return t(A,R),In&&Ka(A,M),S;if(R===null){for(;MM?(Z=R,R=null):Z=R.sibling;var N=d(A,R,V.value,B);if(N===null){R===null&&(R=Z);break}n&&R&&N.alternate===null&&e(A,R),b=r(N,b,M),x===null?S=N:x.sibling=N,x=N,R=Z}if(V.done)return t(A,R),In&&Ka(A,M),S;if(R===null){for(;!V.done;M++,V=f.next())V=C(A,V.value,B),V!==null&&(b=r(V,b,M),x===null?S=V:x.sibling=V,x=V);return In&&Ka(A,M),S}for(R=i(A,R);!V.done;M++,V=f.next())V=h(R,A,M,V.value,B),V!==null&&(n&&V.alternate!==null&&R.delete(V.key===null?M:V.key),b=r(V,b,M),x===null?S=V:x.sibling=V,x=V);return n&&R.forEach(function(D){return e(A,D)}),In&&Ka(A,M),S}function y(A,b,f,B){if(typeof f=="object"&&f!==null&&f.type===Ag&&f.key===null&&(f=f.props.children),typeof f=="object"&&f!==null){switch(f.$$typeof){case PC:e:{for(var S=f.key,x=b;x!==null;){if(x.key===S){if(S=f.type,S===Ag){if(x.tag===7){t(A,x.sibling),b=s(x,f.props.children),b.return=A,A=b;break e}}else if(x.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===zo&&EB(S)===x.type){t(A,x.sibling),b=s(x,f.props),b.ref=kc(A,x,f),b.return=A,A=b;break e}t(A,x);break}else e(A,x);x=x.sibling}f.type===Ag?(b=il(f.props.children,A.mode,B,f.key),b.return=A,A=b):(B=vh(f.type,f.key,f.props,null,A.mode,B),B.ref=kc(A,b,f),B.return=A,A=B)}return o(A);case hg:e:{for(x=f.key;b!==null;){if(b.key===x)if(b.tag===4&&b.stateNode.containerInfo===f.containerInfo&&b.stateNode.implementation===f.implementation){t(A,b.sibling),b=s(b,f.children||[]),b.return=A,A=b;break e}else{t(A,b);break}else e(A,b);b=b.sibling}b=Vm(f,A.mode,B),b.return=A,A=b}return o(A);case zo:return x=f._init,y(A,b,x(f._payload),B)}if(hI(f))return m(A,b,f,B);if(Kc(f))return v(A,b,f,B);id(A,f)}return typeof f=="string"&&f!==""||typeof f=="number"?(f=""+f,b!==null&&b.tag===6?(t(A,b.sibling),b=s(b,f),b.return=A,A=b):(t(A,b),b=Wm(f,A.mode,B),b.return=A,A=b),o(A)):t(A,b)}return y}var Jg=Yx(!0),Fx=Yx(!1),Ru={},Vr=ua(Ru),qI=ua(Ru),$I=ua(Ru);function Oa(n){if(n===Ru)throw Error(we(174));return n}function qb(n,e){switch(sn($I,e),sn(qI,n),sn(Vr,Ru),n=e.nodeType,n){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:Tf(null,"");break;default:n=n===8?e.parentNode:e,e=n.namespaceURI||null,n=n.tagName,e=Tf(e,n)}ln(Vr),sn(Vr,e)}function Og(){ln(Vr),ln(qI),ln($I)}function Kx(n){Oa($I.current);var e=Oa(Vr.current),t=Tf(e,n.type);e!==t&&(sn(qI,n),sn(Vr,t))}function $b(n){qI.current===n&&(ln(Vr),ln(qI))}var hn=ua(0);function Oh(n){for(var e=n;e!==null;){if(e.tag===13){var t=e.memoizedState;if(t!==null&&(t=t.dehydrated,t===null||t.data==="$?"||t.data==="$!"))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if(e.flags&128)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===n)break;for(;e.sibling===null;){if(e.return===null||e.return===n)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var Bm=[];function ev(){for(var n=0;nt?t:4,n(!0);var i=Zm.transition;Zm.transition={};try{n(!1),e()}finally{Qt=t,Zm.transition=i}}function eR(){return Ks().memoizedState}function LN(n,e,t){var i=$o(n);if(t={lane:i,action:t,hasEagerState:!1,eagerState:null,next:null},tR(n))nR(e,t);else if(t=Mx(n,e,t,i),t!==null){var s=Wi();lr(t,n,i,s),iR(t,e,i)}}function TN(n,e,t){var i=$o(n),s={lane:i,action:t,hasEagerState:!1,eagerState:null,next:null};if(tR(n))nR(e,s);else{var r=n.alternate;if(n.lanes===0&&(r===null||r.lanes===0)&&(r=e.lastRenderedReducer,r!==null))try{var o=e.lastRenderedState,a=r(o,t);if(s.hasEagerState=!0,s.eagerState=a,Ir(a,o)){var l=e.interleaved;l===null?(s.next=s,Qb(e)):(s.next=l.next,l.next=s),e.interleaved=s;return}}catch{}finally{}t=Mx(n,e,s,i),t!==null&&(s=Wi(),lr(t,n,i,s),iR(t,e,i))}}function tR(n){var e=n.alternate;return n===mn||e!==null&&e===mn}function nR(n,e){SI=Qh=!0;var t=n.pending;t===null?e.next=e:(e.next=t.next,t.next=e),n.pending=e}function iR(n,e,t){if(t&4194240){var i=e.lanes;i&=n.pendingLanes,t|=i,e.lanes=t,Yb(n,t)}}var jh={readContext:Fs,useCallback:di,useContext:di,useEffect:di,useImperativeHandle:di,useInsertionEffect:di,useLayoutEffect:di,useMemo:di,useReducer:di,useRef:di,useState:di,useDebugValue:di,useDeferredValue:di,useTransition:di,useMutableSource:di,useSyncExternalStore:di,useId:di,unstable_isNewReconciler:!1},EN={readContext:Fs,useCallback:function(n,e){return xr().memoizedState=[n,e===void 0?null:e],n},useContext:Fs,useEffect:DB,useImperativeHandle:function(n,e,t){return t=t!=null?t.concat([n]):null,ph(4194308,4,Ox.bind(null,e,n),t)},useLayoutEffect:function(n,e){return ph(4194308,4,n,e)},useInsertionEffect:function(n,e){return ph(4,2,n,e)},useMemo:function(n,e){var t=xr();return e=e===void 0?null:e,n=n(),t.memoizedState=[n,e],n},useReducer:function(n,e,t){var i=xr();return e=t!==void 0?t(e):e,i.memoizedState=i.baseState=e,n={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:e},i.queue=n,n=n.dispatch=LN.bind(null,mn,n),[i.memoizedState,n]},useRef:function(n){var e=xr();return n={current:n},e.memoizedState=n},useState:kB,useDebugValue:rv,useDeferredValue:function(n){return xr().memoizedState=n},useTransition:function(){var n=kB(!1),e=n[0];return n=zN.bind(null,n[1]),xr().memoizedState=n,[e,n]},useMutableSource:function(){},useSyncExternalStore:function(n,e,t){var i=mn,s=xr();if(In){if(t===void 0)throw Error(we(407));t=t()}else{if(t=e(),ei===null)throw Error(we(349));Il&30||Tx(i,e,t)}s.memoizedState=t;var r={value:t,getSnapshot:e};return s.queue=r,DB(kx.bind(null,i,r,n),[n]),i.flags|=2048,nu(9,Ex.bind(null,i,r,t,e),void 0,null),t},useId:function(){var n=xr(),e=ei.identifierPrefix;if(In){var t=ro,i=so;t=(i&~(1<<32-ar(i)-1)).toString(32)+t,e=":"+e+"R"+t,t=eu++,0vg||(n.current=s0[vg],s0[vg]=null,vg--)}function sn(n,e){vg++,s0[vg]=n.current,n.current=e}var ra={},vi=ua(ra),Oi=ua(!1),gl=ra;function Pg(n,e){var t=n.type.contextTypes;if(!t)return ra;var i=n.stateNode;if(i&&i.__reactInternalMemoizedUnmaskedChildContext===e)return i.__reactInternalMemoizedMaskedChildContext;var s={},r;for(r in t)s[r]=e[r];return i&&(n=n.stateNode,n.__reactInternalMemoizedUnmaskedChildContext=e,n.__reactInternalMemoizedMaskedChildContext=s),s}function Qi(n){return n=n.childContextTypes,n!=null}function Eh(){ln(Oi),ln(vi)}function HB(n,e,t){if(vi.current!==ra)throw Error(we(168));sn(vi,e),sn(Oi,t)}function Sx(n,e,t){var i=n.stateNode;if(e=e.childContextTypes,typeof i.getChildContext!="function")return t;i=i.getChildContext();for(var s in i)if(!(s in e))throw Error(we(108,f5(n)||"Unknown",s));return fn({},t,i)}function kh(n){return n=(n=n.stateNode)&&n.__reactInternalMemoizedMergedChildContext||ra,gl=vi.current,sn(vi,n),sn(Oi,Oi.current),!0}function XB(n,e,t){var i=n.stateNode;if(!i)throw Error(we(169));t?(n=Sx(n,e,gl),i.__reactInternalMemoizedMergedChildContext=n,ln(Oi),ln(vi),sn(vi,n)):ln(Oi),sn(Oi,t)}var to=null,pA=!1,Gm=!1;function xx(n){to===null?to=[n]:to.push(n)}function YN(n){pA=!0,xx(n)}function Ca(){if(!Gm&&to!==null){Gm=!0;var n=0,e=Qt;try{var t=to;for(Qt=1;n>=o,s-=o,so=1<<32-ar(e)+s|t<M?(Z=R,R=null):Z=R.sibling;var V=d(A,R,f[M],B);if(V===null){R===null&&(R=Z);break}n&&R&&V.alternate===null&&e(A,R),b=r(V,b,M),x===null?S=V:x.sibling=V,x=V,R=Z}if(M===f.length)return t(A,R),In&&Ka(A,M),S;if(R===null){for(;MM?(Z=R,R=null):Z=R.sibling;var N=d(A,R,V.value,B);if(N===null){R===null&&(R=Z);break}n&&R&&N.alternate===null&&e(A,R),b=r(N,b,M),x===null?S=N:x.sibling=N,x=N,R=Z}if(V.done)return t(A,R),In&&Ka(A,M),S;if(R===null){for(;!V.done;M++,V=f.next())V=C(A,V.value,B),V!==null&&(b=r(V,b,M),x===null?S=V:x.sibling=V,x=V);return In&&Ka(A,M),S}for(R=i(A,R);!V.done;M++,V=f.next())V=h(R,A,M,V.value,B),V!==null&&(n&&V.alternate!==null&&R.delete(V.key===null?M:V.key),b=r(V,b,M),x===null?S=V:x.sibling=V,x=V);return n&&R.forEach(function(D){return e(A,D)}),In&&Ka(A,M),S}function y(A,b,f,B){if(typeof f=="object"&&f!==null&&f.type===Ag&&f.key===null&&(f=f.props.children),typeof f=="object"&&f!==null){switch(f.$$typeof){case PC:e:{for(var S=f.key,x=b;x!==null;){if(x.key===S){if(S=f.type,S===Ag){if(x.tag===7){t(A,x.sibling),b=s(x,f.props.children),b.return=A,A=b;break e}}else if(x.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===zo&&EB(S)===x.type){t(A,x.sibling),b=s(x,f.props),b.ref=kc(A,x,f),b.return=A,A=b;break e}t(A,x);break}else e(A,x);x=x.sibling}f.type===Ag?(b=il(f.props.children,A.mode,B,f.key),b.return=A,A=b):(B=vh(f.type,f.key,f.props,null,A.mode,B),B.ref=kc(A,b,f),B.return=A,A=B)}return o(A);case hg:e:{for(x=f.key;b!==null;){if(b.key===x)if(b.tag===4&&b.stateNode.containerInfo===f.containerInfo&&b.stateNode.implementation===f.implementation){t(A,b.sibling),b=s(b,f.children||[]),b.return=A,A=b;break e}else{t(A,b);break}else e(A,b);b=b.sibling}b=Vm(f,A.mode,B),b.return=A,A=b}return o(A);case zo:return x=f._init,y(A,b,x(f._payload),B)}if(hI(f))return m(A,b,f,B);if(Kc(f))return v(A,b,f,B);id(A,f)}return typeof f=="string"&&f!==""||typeof f=="number"?(f=""+f,b!==null&&b.tag===6?(t(A,b.sibling),b=s(b,f),b.return=A,A=b):(t(A,b),b=Wm(f,A.mode,B),b.return=A,A=b),o(A)):t(A,b)}return y}var Jg=Yx(!0),Fx=Yx(!1),Ru={},Vr=ua(Ru),qI=ua(Ru),$I=ua(Ru);function Oa(n){if(n===Ru)throw Error(we(174));return n}function qb(n,e){switch(sn($I,e),sn(qI,n),sn(Vr,Ru),n=e.nodeType,n){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:Tf(null,"");break;default:n=n===8?e.parentNode:e,e=n.namespaceURI||null,n=n.tagName,e=Tf(e,n)}ln(Vr),sn(Vr,e)}function Og(){ln(Vr),ln(qI),ln($I)}function Kx(n){Oa($I.current);var e=Oa(Vr.current),t=Tf(e,n.type);e!==t&&(sn(qI,n),sn(Vr,t))}function $b(n){qI.current===n&&(ln(Vr),ln(qI))}var hn=ua(0);function Oh(n){for(var e=n;e!==null;){if(e.tag===13){var t=e.memoizedState;if(t!==null&&(t=t.dehydrated,t===null||t.data==="$?"||t.data==="$!"))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if(e.flags&128)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===n)break;for(;e.sibling===null;){if(e.return===null||e.return===n)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var Bm=[];function ev(){for(var n=0;nt?t:4,n(!0);var i=Zm.transition;Zm.transition={};try{n(!1),e()}finally{Qt=t,Zm.transition=i}}function eR(){return Ks().memoizedState}function LN(n,e,t){var i=$o(n);if(t={lane:i,action:t,hasEagerState:!1,eagerState:null,next:null},tR(n))nR(e,t);else if(t=Mx(n,e,t,i),t!==null){var s=Wi();lr(t,n,i,s),iR(t,e,i)}}function TN(n,e,t){var i=$o(n),s={lane:i,action:t,hasEagerState:!1,eagerState:null,next:null};if(tR(n))nR(e,s);else{var r=n.alternate;if(n.lanes===0&&(r===null||r.lanes===0)&&(r=e.lastRenderedReducer,r!==null))try{var o=e.lastRenderedState,a=r(o,t);if(s.hasEagerState=!0,s.eagerState=a,Ir(a,o)){var l=e.interleaved;l===null?(s.next=s,Qb(e)):(s.next=l.next,l.next=s),e.interleaved=s;return}}catch{}finally{}t=Mx(n,e,s,i),t!==null&&(s=Wi(),lr(t,n,i,s),iR(t,e,i))}}function tR(n){var e=n.alternate;return n===mn||e!==null&&e===mn}function nR(n,e){SI=Qh=!0;var t=n.pending;t===null?e.next=e:(e.next=t.next,t.next=e),n.pending=e}function iR(n,e,t){if(t&4194240){var i=e.lanes;i&=n.pendingLanes,t|=i,e.lanes=t,Yb(n,t)}}var jh={readContext:Fs,useCallback:di,useContext:di,useEffect:di,useImperativeHandle:di,useInsertionEffect:di,useLayoutEffect:di,useMemo:di,useReducer:di,useRef:di,useState:di,useDebugValue:di,useDeferredValue:di,useTransition:di,useMutableSource:di,useSyncExternalStore:di,useId:di,unstable_isNewReconciler:!1},EN={readContext:Fs,useCallback:function(n,e){return xr().memoizedState=[n,e===void 0?null:e],n},useContext:Fs,useEffect:DB,useImperativeHandle:function(n,e,t){return t=t!=null?t.concat([n]):null,ph(4194308,4,Ox.bind(null,e,n),t)},useLayoutEffect:function(n,e){return ph(4194308,4,n,e)},useInsertionEffect:function(n,e){return ph(4,2,n,e)},useMemo:function(n,e){var t=xr();return e=e===void 0?null:e,n=n(),t.memoizedState=[n,e],n},useReducer:function(n,e,t){var i=xr();return e=t!==void 0?t(e):e,i.memoizedState=i.baseState=e,n={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:e},i.queue=n,n=n.dispatch=LN.bind(null,mn,n),[i.memoizedState,n]},useRef:function(n){var e=xr();return n={current:n},e.memoizedState=n},useState:kB,useDebugValue:rv,useDeferredValue:function(n){return xr().memoizedState=n},useTransition:function(){var n=kB(!1),e=n[0];return n=zN.bind(null,n[1]),xr().memoizedState=n,[e,n]},useMutableSource:function(){},useSyncExternalStore:function(n,e,t){var i=mn,s=xr();if(In){if(t===void 0)throw Error(we(407));t=t()}else{if(t=e(),ei===null)throw Error(we(349));Il&30||Tx(i,e,t)}s.memoizedState=t;var r={value:t,getSnapshot:e};return s.queue=r,DB(kx.bind(null,i,r,n),[n]),i.flags|=2048,nu(9,Ex.bind(null,i,r,t,e),void 0,null),t},useId:function(){var n=xr(),e=ei.identifierPrefix;if(In){var t=ro,i=so;t=(i&~(1<<32-ar(i)-1)).toString(32)+t,e=":"+e+"R"+t,t=eu++,0<\/script>",n=n.removeChild(n.firstChild)):typeof i.is=="string"?n=o.createElement(t,{is:i.is}):(n=o.createElement(t),t==="select"&&(o=n,i.multiple?o.multiple=!0:i.size&&(o.size=i.size))):n=o.createElementNS(n,t),n[Rr]=e,n[jI]=i,uR(n,e,!1,!1),e.stateNode=n;e:{switch(o=kf(t,i),t){case"dialog":on("cancel",n),on("close",n),s=i;break;case"iframe":case"object":case"embed":on("load",n),s=i;break;case"video":case"audio":for(s=0;sjg&&(e.flags|=128,i=!0,Dc(r,!1),e.lanes=4194304)}else{if(!i)if(n=Oh(o),n!==null){if(e.flags|=128,i=!0,t=n.updateQueue,t!==null&&(e.updateQueue=t,e.flags|=4),Dc(r,!0),r.tail===null&&r.tailMode==="hidden"&&!o.alternate&&!In)return hi(e),null}else 2*Sn()-r.renderingStartTime>jg&&t!==1073741824&&(e.flags|=128,i=!0,Dc(r,!1),e.lanes=4194304);r.isBackwards?(o.sibling=e.child,e.child=o):(t=r.last,t!==null?t.sibling=o:e.child=o,r.last=o)}return r.tail!==null?(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=Sn(),e.sibling=null,t=hn.current,sn(hn,i?t&1|2:t&1),e):(hi(e),null);case 22:case 23:return Iv(),i=e.memoizedState!==null,n!==null&&n.memoizedState!==null!==i&&(e.flags|=8192),i&&e.mode&1?as&1073741824&&(hi(e),e.subtreeFlags&6&&(e.flags|=8192)):hi(e),null;case 24:return null;case 25:return null}throw Error(we(156,e.tag))}function QN(n,e){switch(Ub(e),e.tag){case 1:return Qi(e.type)&&Eh(),n=e.flags,n&65536?(e.flags=n&-65537|128,e):null;case 3:return Og(),ln(Oi),ln(vi),ev(),n=e.flags,n&65536&&!(n&128)?(e.flags=n&-65537|128,e):null;case 5:return $b(e),null;case 13:if(ln(hn),n=e.memoizedState,n!==null&&n.dehydrated!==null){if(e.alternate===null)throw Error(we(340));_g()}return n=e.flags,n&65536?(e.flags=n&-65537|128,e):null;case 19:return ln(hn),null;case 4:return Og(),null;case 10:return Ob(e.type._context),null;case 22:case 23:return Iv(),null;case 24:return null;default:return null}}var rd=!1,bi=!1,jN=typeof WeakSet=="function"?WeakSet:Set,ze=null;function Zg(n,e){var t=n.ref;if(t!==null)if(typeof t=="function")try{t(null)}catch(i){yn(n,e,i)}else t.current=null}function A0(n,e,t){try{t()}catch(i){yn(n,e,i)}}var $B=!1;function qN(n,e){if($f=Kh,n=mx(),kb(n)){if("selectionStart"in n)var t={start:n.selectionStart,end:n.selectionEnd};else e:{t=(t=n.ownerDocument)&&t.defaultView||window;var i=t.getSelection&&t.getSelection();if(i&&i.rangeCount!==0){t=i.anchorNode;var s=i.anchorOffset,r=i.focusNode;i=i.focusOffset;try{t.nodeType,r.nodeType}catch{t=null;break e}var o=0,a=-1,l=-1,c=0,u=0,C=n,d=null;t:for(;;){for(var h;C!==t||s!==0&&C.nodeType!==3||(a=o+s),C!==r||i!==0&&C.nodeType!==3||(l=o+i),C.nodeType===3&&(o+=C.nodeValue.length),(h=C.firstChild)!==null;)d=C,C=h;for(;;){if(C===n)break t;if(d===t&&++c===s&&(a=o),d===r&&++u===i&&(l=o),(h=C.nextSibling)!==null)break;C=d,d=C.parentNode}C=h}t=a===-1||l===-1?null:{start:a,end:l}}else t=null}t=t||{start:0,end:0}}else t=null;for(e0={focusedElem:n,selectionRange:t},Kh=!1,ze=e;ze!==null;)if(e=ze,n=e.child,(e.subtreeFlags&1028)!==0&&n!==null)n.return=e,ze=n;else for(;ze!==null;){e=ze;try{var m=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(m!==null){var v=m.memoizedProps,y=m.memoizedState,A=e.stateNode,b=A.getSnapshotBeforeUpdate(e.elementType===e.type?v:nr(e.type,v),y);A.__reactInternalSnapshotBeforeUpdate=b}break;case 3:var f=e.stateNode.containerInfo;f.nodeType===1?f.textContent="":f.nodeType===9&&f.documentElement&&f.removeChild(f.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(we(163))}}catch(B){yn(e,e.return,B)}if(n=e.sibling,n!==null){n.return=e.return,ze=n;break}ze=e.return}return m=$B,$B=!1,m}function xI(n,e,t){var i=e.updateQueue;if(i=i!==null?i.lastEffect:null,i!==null){var s=i=i.next;do{if((s.tag&n)===n){var r=s.destroy;s.destroy=void 0,r!==void 0&&A0(e,t,r)}s=s.next}while(s!==i)}}function bA(n,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var t=e=e.next;do{if((t.tag&n)===n){var i=t.create;t.destroy=i()}t=t.next}while(t!==e)}}function p0(n){var e=n.ref;if(e!==null){var t=n.stateNode;switch(n.tag){case 5:n=t;break;default:n=t}typeof e=="function"?e(n):e.current=n}}function hR(n){var e=n.alternate;e!==null&&(n.alternate=null,hR(e)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(e=n.stateNode,e!==null&&(delete e[Rr],delete e[jI],delete e[i0],delete e[HN],delete e[XN])),n.stateNode=null,n.return=null,n.dependencies=null,n.memoizedProps=null,n.memoizedState=null,n.pendingProps=null,n.stateNode=null,n.updateQueue=null}function AR(n){return n.tag===5||n.tag===3||n.tag===4}function e2(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||AR(n.return))return null;n=n.return}for(n.sibling.return=n.return,n=n.sibling;n.tag!==5&&n.tag!==6&&n.tag!==18;){if(n.flags&2||n.child===null||n.tag===4)continue e;n.child.return=n,n=n.child}if(!(n.flags&2))return n.stateNode}}function m0(n,e,t){var i=n.tag;if(i===5||i===6)n=n.stateNode,e?t.nodeType===8?t.parentNode.insertBefore(n,e):t.insertBefore(n,e):(t.nodeType===8?(e=t.parentNode,e.insertBefore(n,t)):(e=t,e.appendChild(n)),t=t._reactRootContainer,t!=null||e.onclick!==null||(e.onclick=Th));else if(i!==4&&(n=n.child,n!==null))for(m0(n,e,t),n=n.sibling;n!==null;)m0(n,e,t),n=n.sibling}function f0(n,e,t){var i=n.tag;if(i===5||i===6)n=n.stateNode,e?t.insertBefore(n,e):t.appendChild(n);else if(i!==4&&(n=n.child,n!==null))for(f0(n,e,t),n=n.sibling;n!==null;)f0(n,e,t),n=n.sibling}var ri=null,sr=!1;function Vo(n,e,t){for(t=t.child;t!==null;)pR(n,e,t),t=t.sibling}function pR(n,e,t){if(Wr&&typeof Wr.onCommitFiberUnmount=="function")try{Wr.onCommitFiberUnmount(uA,t)}catch{}switch(t.tag){case 5:bi||Zg(t,e);case 6:var i=ri,s=sr;ri=null,Vo(n,e,t),ri=i,sr=s,ri!==null&&(sr?(n=ri,t=t.stateNode,n.nodeType===8?n.parentNode.removeChild(t):n.removeChild(t)):ri.removeChild(t.stateNode));break;case 18:ri!==null&&(sr?(n=ri,t=t.stateNode,n.nodeType===8?ym(n.parentNode,t):n.nodeType===1&&ym(n,t),PI(n)):ym(ri,t.stateNode));break;case 4:i=ri,s=sr,ri=t.stateNode.containerInfo,sr=!0,Vo(n,e,t),ri=i,sr=s;break;case 0:case 11:case 14:case 15:if(!bi&&(i=t.updateQueue,i!==null&&(i=i.lastEffect,i!==null))){s=i=i.next;do{var r=s,o=r.destroy;r=r.tag,o!==void 0&&(r&2||r&4)&&A0(t,e,o),s=s.next}while(s!==i)}Vo(n,e,t);break;case 1:if(!bi&&(Zg(t,e),i=t.stateNode,typeof i.componentWillUnmount=="function"))try{i.props=t.memoizedProps,i.state=t.memoizedState,i.componentWillUnmount()}catch(a){yn(t,e,a)}Vo(n,e,t);break;case 21:Vo(n,e,t);break;case 22:t.mode&1?(bi=(i=bi)||t.memoizedState!==null,Vo(n,e,t),bi=i):Vo(n,e,t);break;default:Vo(n,e,t)}}function t2(n){var e=n.updateQueue;if(e!==null){n.updateQueue=null;var t=n.stateNode;t===null&&(t=n.stateNode=new jN),e.forEach(function(i){var s=a3.bind(null,n,i);t.has(i)||(t.add(i),i.then(s,s))})}}function Os(n,e){var t=e.deletions;if(t!==null)for(var i=0;is&&(s=o),i&=~r}if(i=s,i=Sn()-i,i=(120>i?120:480>i?480:1080>i?1080:1920>i?1920:3e3>i?3e3:4320>i?4320:1960*e3(i/1960))-i,10n?16:n,Uo===null)var i=!1;else{if(n=Uo,Uo=null,eA=0,Yt&6)throw Error(we(331));var s=Yt;for(Yt|=4,ze=n.current;ze!==null;){var r=ze,o=r.child;if(ze.flags&16){var a=r.deletions;if(a!==null){for(var l=0;lSn()-gv?nl(n,0):lv|=t),ji(n,e)}function ZR(n,e){e===0&&(n.mode&1?(e=QC,QC<<=1,!(QC&130023424)&&(QC=4194304)):e=1);var t=Wi();n=Co(n,e),n!==null&&(wu(n,e,t),ji(n,t))}function o3(n){var e=n.memoizedState,t=0;e!==null&&(t=e.retryLane),ZR(n,t)}function a3(n,e){var t=0;switch(n.tag){case 13:var i=n.stateNode,s=n.memoizedState;s!==null&&(t=s.retryLane);break;case 19:i=n.stateNode;break;default:throw Error(we(314))}i!==null&&i.delete(e),ZR(n,t)}var wR;wR=function(n,e,t){if(n!==null)if(n.memoizedProps!==e.pendingProps||Oi.current)_i=!0;else{if(!(n.lanes&t)&&!(e.flags&128))return _i=!1,JN(n,e,t);_i=!!(n.flags&131072)}else _i=!1,In&&e.flags&1048576&&Rx(e,Uh,e.index);switch(e.lanes=0,e.tag){case 2:var i=e.type;mh(n,e),n=e.pendingProps;var s=Pg(e,vi.current);Kg(e,t),s=nv(null,e,i,n,s,t);var r=iv();return e.flags|=1,typeof s=="object"&&s!==null&&typeof s.render=="function"&&s.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,Qi(i)?(r=!0,kh(e)):r=!1,e.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,jb(e),s.updater=mA,e.stateNode=s,s._reactInternals=e,g0(e,i,n,t),e=u0(null,e,i,!0,r,t)):(e.tag=0,In&&r&&Db(e),Si(null,e,s,t),e=e.child),e;case 16:i=e.elementType;e:{switch(mh(n,e),n=e.pendingProps,s=i._init,i=s(i._payload),e.type=i,s=e.tag=g3(i),n=nr(i,n),s){case 0:e=I0(null,e,i,n,t);break e;case 1:e=QB(null,e,i,n,t);break e;case 11:e=JB(null,e,i,n,t);break e;case 14:e=OB(null,e,i,nr(i.type,n),t);break e}throw Error(we(306,i,""))}return e;case 0:return i=e.type,s=e.pendingProps,s=e.elementType===i?s:nr(i,s),I0(n,e,i,s,t);case 1:return i=e.type,s=e.pendingProps,s=e.elementType===i?s:nr(i,s),QB(n,e,i,s,t);case 3:e:{if(gR(e),n===null)throw Error(we(387));i=e.pendingProps,r=e.memoizedState,s=r.element,Nx(n,e),Jh(e,i,null,t);var o=e.memoizedState;if(i=o.element,r.isDehydrated)if(r={element:i,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},e.updateQueue.baseState=r,e.memoizedState=r,e.flags&256){s=Qg(Error(we(423)),e),e=jB(n,e,i,t,s);break e}else if(i!==s){s=Qg(Error(we(424)),e),e=jB(n,e,i,t,s);break e}else for(gs=Qo(e.stateNode.containerInfo.firstChild),Is=e,In=!0,rr=null,t=Fx(e,null,i,t),e.child=t;t;)t.flags=t.flags&-3|4096,t=t.sibling;else{if(_g(),i===s){e=ho(n,e,t);break e}Si(n,e,i,t)}e=e.child}return e;case 5:return Kx(e),n===null&&o0(e),i=e.type,s=e.pendingProps,r=n!==null?n.memoizedProps:null,o=s.children,t0(i,s)?o=null:r!==null&&t0(i,r)&&(e.flags|=32),lR(n,e),Si(n,e,o,t),e.child;case 6:return n===null&&o0(e),null;case 13:return cR(n,e,t);case 4:return qb(e,e.stateNode.containerInfo),i=e.pendingProps,n===null?e.child=Jg(e,null,i,t):Si(n,e,i,t),e.child;case 11:return i=e.type,s=e.pendingProps,s=e.elementType===i?s:nr(i,s),JB(n,e,i,s,t);case 7:return Si(n,e,e.pendingProps,t),e.child;case 8:return Si(n,e,e.pendingProps.children,t),e.child;case 12:return Si(n,e,e.pendingProps.children,t),e.child;case 10:e:{if(i=e.type._context,s=e.pendingProps,r=e.memoizedProps,o=s.value,sn(Ph,i._currentValue),i._currentValue=o,r!==null)if(Ir(r.value,o)){if(r.children===s.children&&!Oi.current){e=ho(n,e,t);break e}}else for(r=e.child,r!==null&&(r.return=e);r!==null;){var a=r.dependencies;if(a!==null){o=r.child;for(var l=a.firstContext;l!==null;){if(l.context===i){if(r.tag===1){l=go(-1,t&-t),l.tag=2;var c=r.updateQueue;if(c!==null){c=c.shared;var u=c.pending;u===null?l.next=l:(l.next=u.next,u.next=l),c.pending=l}}r.lanes|=t,l=r.alternate,l!==null&&(l.lanes|=t),a0(r.return,t,e),a.lanes|=t;break}l=l.next}}else if(r.tag===10)o=r.type===e.type?null:r.child;else if(r.tag===18){if(o=r.return,o===null)throw Error(we(341));o.lanes|=t,a=o.alternate,a!==null&&(a.lanes|=t),a0(o,t,e),o=r.sibling}else o=r.child;if(o!==null)o.return=r;else for(o=r;o!==null;){if(o===e){o=null;break}if(r=o.sibling,r!==null){r.return=o.return,o=r;break}o=o.return}r=o}Si(n,e,s.children,t),e=e.child}return e;case 9:return s=e.type,i=e.pendingProps.children,Kg(e,t),s=Fs(s),i=i(s),e.flags|=1,Si(n,e,i,t),e.child;case 14:return i=e.type,s=nr(i,e.pendingProps),s=nr(i.type,s),OB(n,e,i,s,t);case 15:return oR(n,e,e.type,e.pendingProps,t);case 17:return i=e.type,s=e.pendingProps,s=e.elementType===i?s:nr(i,s),mh(n,e),e.tag=1,Qi(i)?(n=!0,kh(e)):n=!1,Kg(e,t),Xx(e,i,s),g0(e,i,s,t),u0(null,e,i,!0,n,t);case 19:return IR(n,e,t);case 22:return aR(n,e,t)}throw Error(we(156,e.tag))};function SR(n,e){return $S(n,e)}function l3(n,e,t,i){this.tag=n,this.key=t,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=i,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Hs(n,e,t,i){return new l3(n,e,t,i)}function Cv(n){return n=n.prototype,!(!n||!n.isReactComponent)}function g3(n){if(typeof n=="function")return Cv(n)?1:0;if(n!=null){if(n=n.$$typeof,n===Mb)return 11;if(n===Nb)return 14}return 2}function ea(n,e){var t=n.alternate;return t===null?(t=Hs(n.tag,e,n.key,n.mode),t.elementType=n.elementType,t.type=n.type,t.stateNode=n.stateNode,t.alternate=n,n.alternate=t):(t.pendingProps=e,t.type=n.type,t.flags=0,t.subtreeFlags=0,t.deletions=null),t.flags=n.flags&14680064,t.childLanes=n.childLanes,t.lanes=n.lanes,t.child=n.child,t.memoizedProps=n.memoizedProps,t.memoizedState=n.memoizedState,t.updateQueue=n.updateQueue,e=n.dependencies,t.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},t.sibling=n.sibling,t.index=n.index,t.ref=n.ref,t}function vh(n,e,t,i,s,r){var o=2;if(i=n,typeof n=="function")Cv(n)&&(o=1);else if(typeof n=="string")o=5;else e:switch(n){case Ag:return il(t.children,s,r,e);case Vb:o=8,s|=8;break;case Nf:return n=Hs(12,t,e,s|2),n.elementType=Nf,n.lanes=r,n;case Hf:return n=Hs(13,t,e,s),n.elementType=Hf,n.lanes=r,n;case Xf:return n=Hs(19,t,e,s),n.elementType=Xf,n.lanes=r,n;case YS:return yA(t,s,r,e);default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case HS:o=10;break e;case XS:o=9;break e;case Mb:o=11;break e;case Nb:o=14;break e;case zo:o=16,i=null;break e}throw Error(we(130,n==null?n:typeof n,""))}return e=Hs(o,t,e,s),e.elementType=n,e.type=i,e.lanes=r,e}function il(n,e,t,i){return n=Hs(7,n,i,e),n.lanes=t,n}function yA(n,e,t,i){return n=Hs(22,n,i,e),n.elementType=YS,n.lanes=t,n.stateNode={isHidden:!1},n}function Wm(n,e,t){return n=Hs(6,n,null,e),n.lanes=t,n}function Vm(n,e,t){return e=Hs(4,n.children!==null?n.children:[],n.key,e),e.lanes=t,e.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},e}function c3(n,e,t,i,s){this.tag=e,this.containerInfo=n,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Im(0),this.expirationTimes=Im(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Im(0),this.identifierPrefix=i,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function dv(n,e,t,i,s,r,o,a,l){return n=new c3(n,e,t,a,l),e===1?(e=1,r===!0&&(e|=8)):e=0,r=Hs(3,null,null,e),n.current=r,r.stateNode=n,r.memoizedState={element:i,isDehydrated:t,cache:null,transitions:null,pendingSuspenseBoundaries:null},jb(r),n}function I3(n,e,t){var i=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(VR)}catch(n){console.error(n)}}VR(),RS.exports=As;var A3=RS.exports,g2=A3;Vf.createRoot=g2.createRoot,Vf.hydrateRoot=g2.hydrateRoot;const p3=({className:n})=>E.jsxs("svg",{className:n,width:"100%",height:"100%",viewBox:"0 0 180 180",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[E.jsx("path",{className:"fill-icontext dark:fill-icontext-dark",d:"M76.875 5.3125L65.25 51H54.2188L48.0312 27C47.9062 26.5417 47.7396 25.8438 47.5312 24.9062C47.3229 23.9688 47.1042 22.9479 46.875 21.8438C46.6458 20.7188 46.4375 19.6667 46.25 18.6875C46.0833 17.6875 45.9688 16.8958 45.9062 16.3125C45.8438 16.8958 45.7188 17.6771 45.5312 18.6562C45.3646 19.6354 45.1667 20.6771 44.9375 21.7812C44.7292 22.8854 44.5208 23.9167 44.3125 24.875C44.1042 25.8333 43.9375 26.5625 43.8125 27.0625L37.6562 51H26.6562L15 5.3125H24.5312L30.375 30.25C30.5417 31 30.7292 31.8958 30.9375 32.9375C31.1667 33.9792 31.3854 35.0729 31.5938 36.2188C31.8229 37.3438 32.0208 38.4375 32.1875 39.5C32.375 40.5417 32.5104 41.4479 32.5938 42.2188C32.6979 41.4271 32.8333 40.5104 33 39.4688C33.1667 38.4062 33.3438 37.3333 33.5312 36.25C33.7396 35.1458 33.9479 34.125 34.1562 33.1875C34.3646 32.25 34.5521 31.4896 34.7188 30.9062L41.375 5.3125H50.5312L57.1875 30.9062C57.3333 31.4688 57.5 32.2292 57.6875 33.1875C57.8958 34.125 58.1042 35.1458 58.3125 36.25C58.5208 37.3542 58.7083 38.4375 58.875 39.5C59.0625 40.5417 59.1979 41.4479 59.2812 42.2188C59.4271 41.1771 59.625 39.9167 59.875 38.4375C60.1458 36.9375 60.4271 35.4479 60.7188 33.9688C61.0312 32.4896 61.3021 31.25 61.5312 30.25L67.3438 5.3125H76.875ZM107.225 33.4688C107.225 36.3854 106.829 38.9688 106.037 41.2188C105.267 43.4688 104.131 45.375 102.631 46.9375C101.152 48.4792 99.3604 49.6458 97.2562 50.4375C95.1729 51.2292 92.8187 51.625 90.1937 51.625C87.7354 51.625 85.475 51.2292 83.4125 50.4375C81.3708 49.6458 79.5896 48.4792 78.0687 46.9375C76.5687 45.375 75.4021 43.4688 74.5687 41.2188C73.7562 38.9688 73.35 36.3854 73.35 33.4688C73.35 29.5938 74.0375 26.3125 75.4125 23.625C76.7875 20.9375 78.7458 18.8958 81.2875 17.5C83.8292 16.1042 86.8604 15.4062 90.3812 15.4062C93.6521 15.4062 96.5479 16.1042 99.0687 17.5C101.61 18.8958 103.6 20.9375 105.037 23.625C106.496 26.3125 107.225 29.5938 107.225 33.4688ZM83.0687 33.4688C83.0687 35.7604 83.3187 37.6875 83.8187 39.25C84.3187 40.8125 85.1 41.9896 86.1625 42.7812C87.225 43.5729 88.6104 43.9688 90.3187 43.9688C92.0062 43.9688 93.3708 43.5729 94.4125 42.7812C95.475 41.9896 96.2458 40.8125 96.725 39.25C97.225 37.6875 97.475 35.7604 97.475 33.4688C97.475 31.1562 97.225 29.2396 96.725 27.7188C96.2458 26.1771 95.475 25.0208 94.4125 24.25C93.35 23.4792 91.9646 23.0938 90.2562 23.0938C87.7354 23.0938 85.9021 23.9583 84.7562 25.6875C83.6312 27.4167 83.0687 30.0104 83.0687 33.4688ZM122.003 51.625C118.107 51.625 114.93 50.1042 112.471 47.0625C110.034 44 108.815 39.5104 108.815 33.5938C108.815 27.6146 110.055 23.0938 112.534 20.0312C115.013 16.9479 118.253 15.4062 122.253 15.4062C123.919 15.4062 125.388 15.6354 126.659 16.0938C127.93 16.5521 129.023 17.1667 129.94 17.9375C130.878 18.7083 131.669 19.5729 132.315 20.5312H132.628C132.503 19.8646 132.346 18.8854 132.159 17.5938C131.992 16.2812 131.909 14.9375 131.909 13.5625V2.375H141.471V51H134.159L132.315 46.4688H131.909C131.305 47.4271 130.544 48.3021 129.628 49.0938C128.732 49.8646 127.659 50.4792 126.409 50.9375C125.159 51.3958 123.69 51.625 122.003 51.625ZM125.346 44.0312C127.95 44.0312 129.784 43.2604 130.846 41.7188C131.93 40.1562 132.503 37.8125 132.565 34.6875V33.6562C132.565 30.2604 132.044 27.6667 131.003 25.875C129.961 24.0625 128.023 23.1562 125.19 23.1562C123.086 23.1562 121.44 24.0625 120.253 25.875C119.065 27.6875 118.471 30.3021 118.471 33.7188C118.471 37.1354 119.065 39.7083 120.253 41.4375C121.461 43.1667 123.159 44.0312 125.346 44.0312ZM159.446 15.4062C162.675 15.4062 165.457 16.0312 167.79 17.2812C170.123 18.5104 171.925 20.3021 173.196 22.6562C174.467 25.0104 175.103 27.8854 175.103 31.2812V35.9062H152.571C152.675 38.5938 153.478 40.7083 154.978 42.25C156.498 43.7708 158.603 44.5312 161.29 44.5312C163.519 44.5312 165.561 44.3021 167.415 43.8438C169.269 43.3854 171.175 42.6979 173.134 41.7812V49.1562C171.405 50.0104 169.592 50.6354 167.696 51.0312C165.821 51.4271 163.54 51.625 160.853 51.625C157.353 51.625 154.248 50.9792 151.54 49.6875C148.853 48.3958 146.738 46.4271 145.196 43.7812C143.675 41.1354 142.915 37.8021 142.915 33.7812C142.915 29.6979 143.603 26.3021 144.978 23.5938C146.373 20.8646 148.311 18.8229 150.79 17.4688C153.269 16.0938 156.155 15.4062 159.446 15.4062ZM159.509 22.1875C157.655 22.1875 156.113 22.7812 154.884 23.9688C153.675 25.1562 152.978 27.0208 152.79 29.5625H166.165C166.144 28.1458 165.884 26.8854 165.384 25.7812C164.905 24.6771 164.175 23.8021 163.196 23.1562C162.238 22.5104 161.009 22.1875 159.509 22.1875ZM61.2812 155H48.9688L29.0938 120.438H28.8125C28.8958 121.875 28.9688 123.323 29.0312 124.781C29.0938 126.24 29.1562 127.698 29.2188 129.156C29.2812 130.594 29.3438 132.042 29.4062 133.5V155H20.75V109.312H32.9688L52.8125 143.531H53.0312C52.9896 142.115 52.9375 140.708 52.875 139.312C52.8125 137.917 52.75 136.521 52.6875 135.125C52.6458 133.729 52.6042 132.333 52.5625 130.938V109.312H61.2812V155ZM75.1937 120.062V155H65.6625V120.062H75.1937ZM70.4437 106.375C71.8604 106.375 73.0792 106.708 74.1 107.375C75.1208 108.021 75.6312 109.24 75.6312 111.031C75.6312 112.802 75.1208 114.031 74.1 114.719C73.0792 115.385 71.8604 115.719 70.4437 115.719C69.0062 115.719 67.7771 115.385 66.7562 114.719C65.7562 114.031 65.2562 112.802 65.2562 111.031C65.2562 109.24 65.7562 108.021 66.7562 107.375C67.7771 106.708 69.0062 106.375 70.4437 106.375Z"}),E.jsx("path",{className:"fill-primary",d:"M18.3382 54.625C18.1007 55.7875 17.857 57.0187 17.607 58.3187C17.3695 59.6187 17.1507 60.8937 16.9507 62.1437C16.7632 63.3937 16.6132 64.5312 16.5007 65.5562H10.0882L9.807 65.1437C10.0445 64.2187 10.3382 63.1187 10.6882 61.8437C11.0507 60.5562 11.4382 59.2687 11.8507 57.9812C12.2757 56.6812 12.7007 55.5625 13.1257 54.625H18.3382ZM8.77575 54.625C8.53825 55.7875 8.2945 57.0187 8.0445 58.3187C7.807 59.6187 7.58825 60.8937 7.38825 62.1437C7.20075 63.3937 7.05075 64.5312 6.93825 65.5562H0.525749L0.244499 65.1437C0.481999 64.2187 0.775749 63.1187 1.12575 61.8437C1.48825 60.5562 1.87575 59.2687 2.28825 57.9812C2.71325 56.6812 3.13825 55.5625 3.56325 54.625H8.77575ZM61.2812 103H48.9688L29.0938 68.4375H28.8125C28.8958 69.875 28.9688 71.3229 29.0312 72.7812C29.0938 74.2396 29.1562 75.6979 29.2188 77.1562C29.2812 78.5938 29.3438 80.0417 29.4062 81.5V103H20.75V57.3125H32.9688L52.8125 91.5312H53.0312C52.9896 90.1146 52.9375 88.7083 52.875 87.3125C52.8125 85.9167 52.75 84.5208 52.6875 83.125C52.6458 81.7292 52.6042 80.3333 52.5625 78.9375V57.3125H61.2812V103ZM75.1937 68.0625V103H65.6625V68.0625H75.1937ZM70.4437 54.375C71.8604 54.375 73.0792 54.7083 74.1 55.375C75.1208 56.0208 75.6312 57.2396 75.6312 59.0312C75.6312 60.8021 75.1208 62.0312 74.1 62.7188C73.0792 63.3854 71.8604 63.7188 70.4437 63.7188C69.0062 63.7188 67.7771 63.3854 66.7562 62.7188C65.7562 62.0312 65.2562 60.8021 65.2562 59.0312C65.2562 57.2396 65.7562 56.0208 66.7562 55.375C67.7771 54.7083 69.0062 54.375 70.4437 54.375ZM119.856 67.4062C123.815 67.4062 126.804 68.4271 128.825 70.4688C130.867 72.4896 131.888 75.7396 131.888 80.2188V103H122.325V82.5938C122.325 80.0938 121.898 78.2083 121.044 76.9375C120.19 75.6667 118.867 75.0312 117.075 75.0312C114.554 75.0312 112.763 75.9375 111.7 77.75C110.638 79.5417 110.106 82.1146 110.106 85.4688V103H100.575V82.5938C100.575 80.9271 100.388 79.5312 100.013 78.4062C99.6375 77.2812 99.0646 76.4375 98.2938 75.875C97.5229 75.3125 96.5333 75.0312 95.325 75.0312C93.5542 75.0312 92.1583 75.4792 91.1375 76.375C90.1375 77.25 89.4188 78.5521 88.9813 80.2812C88.5646 81.9896 88.3563 84.0833 88.3563 86.5625V103H78.825V68.0625H86.1063L87.3875 72.5312H87.9188C88.6271 71.3229 89.5125 70.3438 90.575 69.5938C91.6583 68.8438 92.8458 68.2917 94.1375 67.9375C95.4292 67.5833 96.7417 67.4062 98.075 67.4062C100.638 67.4062 102.804 67.8229 104.575 68.6562C106.367 69.4896 107.742 70.7812 108.7 72.5312H109.544C110.585 70.7396 112.054 69.4375 113.95 68.625C115.867 67.8125 117.835 67.4062 119.856 67.4062ZM167.05 85.4688C167.05 88.3854 166.654 90.9688 165.863 93.2188C165.092 95.4688 163.956 97.375 162.456 98.9375C160.977 100.479 159.185 101.646 157.081 102.438C154.998 103.229 152.644 103.625 150.019 103.625C147.56 103.625 145.3 103.229 143.238 102.438C141.196 101.646 139.415 100.479 137.894 98.9375C136.394 97.375 135.227 95.4688 134.394 93.2188C133.581 90.9688 133.175 88.3854 133.175 85.4688C133.175 81.5938 133.863 78.3125 135.238 75.625C136.613 72.9375 138.571 70.8958 141.113 69.5C143.654 68.1042 146.685 67.4062 150.206 67.4062C153.477 67.4062 156.373 68.1042 158.894 69.5C161.435 70.8958 163.425 72.9375 164.863 75.625C166.321 78.3125 167.05 81.5938 167.05 85.4688ZM142.894 85.4688C142.894 87.7604 143.144 89.6875 143.644 91.25C144.144 92.8125 144.925 93.9896 145.988 94.7812C147.05 95.5729 148.435 95.9688 150.144 95.9688C151.831 95.9688 153.196 95.5729 154.238 94.7812C155.3 93.9896 156.071 92.8125 156.55 91.25C157.05 89.6875 157.3 87.7604 157.3 85.4688C157.3 83.1562 157.05 81.2396 156.55 79.7188C156.071 78.1771 155.3 77.0208 154.238 76.25C153.175 75.4792 151.79 75.0938 150.081 75.0938C147.56 75.0938 145.727 75.9583 144.581 77.6875C143.456 79.4167 142.894 82.0104 142.894 85.4688ZM182.031 54.625L182.294 55.0375C182.069 55.9625 181.775 57.0687 181.412 58.3562C181.062 59.6312 180.675 60.9125 180.25 62.2C179.837 63.4875 179.419 64.6062 178.994 65.5562H173.781C174.031 64.3937 174.275 63.1625 174.512 61.8625C174.75 60.5625 174.962 59.2875 175.15 58.0375C175.35 56.7875 175.506 55.65 175.619 54.625H182.031ZM172.469 54.625L172.75 55.0375C172.525 55.9625 172.231 57.0687 171.869 58.3562C171.506 59.6312 171.112 60.9125 170.687 62.2C170.275 63.4875 169.856 64.6062 169.431 65.5562H164.219C164.406 64.6812 164.587 63.7687 164.762 62.8187C164.95 61.8562 165.125 60.8937 165.287 59.9312C165.45 58.9687 165.594 58.0375 165.719 57.1375C165.856 56.225 165.969 55.3875 166.056 54.625H172.469Z"})]}),m3="/assets/penrose.svg",f3="/assets/edgeworth.svg",b3="/assets/mathdiagrams.webp";/** +`+r.stack}return{value:n,source:e,stack:s,digest:null}}function xm(n,e,t){return{value:n,source:null,stack:t??null,digest:e??null}}function c0(n,e){try{console.error(e.value)}catch(t){setTimeout(function(){throw t})}}var UN=typeof WeakMap=="function"?WeakMap:Map;function sR(n,e,t){t=go(-1,t),t.tag=3,t.payload={element:null};var i=e.value;return t.callback=function(){$h||($h=!0,b0=i),c0(n,e)},t}function rR(n,e,t){t=go(-1,t),t.tag=3;var i=n.type.getDerivedStateFromError;if(typeof i=="function"){var s=e.value;t.payload=function(){return i(s)},t.callback=function(){c0(n,e)}}var r=n.stateNode;return r!==null&&typeof r.componentDidCatch=="function"&&(t.callback=function(){c0(n,e),typeof i!="function"&&(qo===null?qo=new Set([this]):qo.add(this));var o=e.stack;this.componentDidCatch(e.value,{componentStack:o!==null?o:""})}),t}function UB(n,e,t){var i=n.pingCache;if(i===null){i=n.pingCache=new UN;var s=new Set;i.set(e,s)}else s=i.get(e),s===void 0&&(s=new Set,i.set(e,s));s.has(t)||(s.add(t),n=r3.bind(null,n,e,t),e.then(n,n))}function PB(n){do{var e;if((e=n.tag===13)&&(e=n.memoizedState,e=e!==null?e.dehydrated!==null:!0),e)return n;n=n.return}while(n!==null);return null}function _B(n,e,t,i,s){return n.mode&1?(n.flags|=65536,n.lanes=s,n):(n===e?n.flags|=65536:(n.flags|=128,t.flags|=131072,t.flags&=-52805,t.tag===1&&(t.alternate===null?t.tag=17:(e=go(-1,1),e.tag=2,jo(t,e,1))),t.lanes|=1),n)}var PN=mo.ReactCurrentOwner,_i=!1;function Si(n,e,t,i){e.child=n===null?Fx(e,null,t,i):Jg(e,n.child,t,i)}function JB(n,e,t,i,s){t=t.render;var r=e.ref;return Kg(e,s),i=nv(n,e,t,i,r,s),t=iv(),n!==null&&!_i?(e.updateQueue=n.updateQueue,e.flags&=-2053,n.lanes&=~s,ho(n,e,s)):(In&&t&&Db(e),e.flags|=1,Si(n,e,i,s),e.child)}function OB(n,e,t,i,s){if(n===null){var r=t.type;return typeof r=="function"&&!Cv(r)&&r.defaultProps===void 0&&t.compare===null&&t.defaultProps===void 0?(e.tag=15,e.type=r,oR(n,e,r,i,s)):(n=vh(t.type,null,i,e,e.mode,s),n.ref=e.ref,n.return=e,e.child=n)}if(r=n.child,!(n.lanes&s)){var o=r.memoizedProps;if(t=t.compare,t=t!==null?t:JI,t(o,i)&&n.ref===e.ref)return ho(n,e,s)}return e.flags|=1,n=ea(r,i),n.ref=e.ref,n.return=e,e.child=n}function oR(n,e,t,i,s){if(n!==null){var r=n.memoizedProps;if(JI(r,i)&&n.ref===e.ref)if(_i=!1,e.pendingProps=i=r,(n.lanes&s)!==0)n.flags&131072&&(_i=!0);else return e.lanes=n.lanes,ho(n,e,s)}return I0(n,e,t,i,s)}function aR(n,e,t){var i=e.pendingProps,s=i.children,r=n!==null?n.memoizedState:null;if(i.mode==="hidden")if(!(e.mode&1))e.memoizedState={baseLanes:0,cachePool:null,transitions:null},sn(wg,as),as|=t;else{if(!(t&1073741824))return n=r!==null?r.baseLanes|t:t,e.lanes=e.childLanes=1073741824,e.memoizedState={baseLanes:n,cachePool:null,transitions:null},e.updateQueue=null,sn(wg,as),as|=n,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},i=r!==null?r.baseLanes:t,sn(wg,as),as|=i}else r!==null?(i=r.baseLanes|t,e.memoizedState=null):i=t,sn(wg,as),as|=i;return Si(n,e,s,t),e.child}function lR(n,e){var t=e.ref;(n===null&&t!==null||n!==null&&n.ref!==t)&&(e.flags|=512,e.flags|=2097152)}function I0(n,e,t,i,s){var r=Qi(t)?gl:vi.current;return r=Pg(e,r),Kg(e,s),t=nv(n,e,t,i,r,s),i=iv(),n!==null&&!_i?(e.updateQueue=n.updateQueue,e.flags&=-2053,n.lanes&=~s,ho(n,e,s)):(In&&i&&Db(e),e.flags|=1,Si(n,e,t,s),e.child)}function QB(n,e,t,i,s){if(Qi(t)){var r=!0;kh(e)}else r=!1;if(Kg(e,s),e.stateNode===null)mh(n,e),Xx(e,t,i),g0(e,t,i,s),i=!0;else if(n===null){var o=e.stateNode,a=e.memoizedProps;o.props=a;var l=o.context,c=t.contextType;typeof c=="object"&&c!==null?c=Fs(c):(c=Qi(t)?gl:vi.current,c=Pg(e,c));var u=t.getDerivedStateFromProps,C=typeof u=="function"||typeof o.getSnapshotBeforeUpdate=="function";C||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==i||l!==c)&&TB(e,o,i,c),Lo=!1;var d=e.memoizedState;o.state=d,Jh(e,i,o,s),l=e.memoizedState,a!==i||d!==l||Oi.current||Lo?(typeof u=="function"&&(l0(e,t,u,i),l=e.memoizedState),(a=Lo||LB(e,t,a,i,d,l,c))?(C||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(e.flags|=4194308)):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),e.memoizedProps=i,e.memoizedState=l),o.props=i,o.state=l,o.context=c,i=a):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),i=!1)}else{o=e.stateNode,Nx(n,e),a=e.memoizedProps,c=e.type===e.elementType?a:nr(e.type,a),o.props=c,C=e.pendingProps,d=o.context,l=t.contextType,typeof l=="object"&&l!==null?l=Fs(l):(l=Qi(t)?gl:vi.current,l=Pg(e,l));var h=t.getDerivedStateFromProps;(u=typeof h=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==C||d!==l)&&TB(e,o,i,l),Lo=!1,d=e.memoizedState,o.state=d,Jh(e,i,o,s);var m=e.memoizedState;a!==C||d!==m||Oi.current||Lo?(typeof h=="function"&&(l0(e,t,h,i),m=e.memoizedState),(c=Lo||LB(e,t,c,i,d,m,l)||!1)?(u||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(i,m,l),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(i,m,l)),typeof o.componentDidUpdate=="function"&&(e.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof o.componentDidUpdate!="function"||a===n.memoizedProps&&d===n.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===n.memoizedProps&&d===n.memoizedState||(e.flags|=1024),e.memoizedProps=i,e.memoizedState=m),o.props=i,o.state=m,o.context=l,i=c):(typeof o.componentDidUpdate!="function"||a===n.memoizedProps&&d===n.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===n.memoizedProps&&d===n.memoizedState||(e.flags|=1024),i=!1)}return u0(n,e,t,i,r,s)}function u0(n,e,t,i,s,r){lR(n,e);var o=(e.flags&128)!==0;if(!i&&!o)return s&&XB(e,t,!1),ho(n,e,r);i=e.stateNode,PN.current=e;var a=o&&typeof t.getDerivedStateFromError!="function"?null:i.render();return e.flags|=1,n!==null&&o?(e.child=Jg(e,n.child,null,r),e.child=Jg(e,null,a,r)):Si(n,e,a,r),e.memoizedState=i.state,s&&XB(e,t,!0),e.child}function gR(n){var e=n.stateNode;e.pendingContext?HB(n,e.pendingContext,e.pendingContext!==e.context):e.context&&HB(n,e.context,!1),qb(n,e.containerInfo)}function jB(n,e,t,i,s){return _g(),Pb(s),e.flags|=256,Si(n,e,t,i),e.child}var C0={dehydrated:null,treeContext:null,retryLane:0};function d0(n){return{baseLanes:n,cachePool:null,transitions:null}}function cR(n,e,t){var i=e.pendingProps,s=hn.current,r=!1,o=(e.flags&128)!==0,a;if((a=o)||(a=n!==null&&n.memoizedState===null?!1:(s&2)!==0),a?(r=!0,e.flags&=-129):(n===null||n.memoizedState!==null)&&(s|=1),sn(hn,s&1),n===null)return o0(e),n=e.memoizedState,n!==null&&(n=n.dehydrated,n!==null)?(e.mode&1?n.data==="$!"?e.lanes=8:e.lanes=1073741824:e.lanes=1,null):(o=i.children,n=i.fallback,r?(i=e.mode,r=e.child,o={mode:"hidden",children:o},!(i&1)&&r!==null?(r.childLanes=0,r.pendingProps=o):r=yA(o,i,0,null),n=il(n,i,t,null),r.return=e,n.return=e,r.sibling=n,e.child=r,e.child.memoizedState=d0(t),e.memoizedState=C0,n):ov(e,o));if(s=n.memoizedState,s!==null&&(a=s.dehydrated,a!==null))return _N(n,e,o,i,a,s,t);if(r){r=i.fallback,o=e.mode,s=n.child,a=s.sibling;var l={mode:"hidden",children:i.children};return!(o&1)&&e.child!==s?(i=e.child,i.childLanes=0,i.pendingProps=l,e.deletions=null):(i=ea(s,l),i.subtreeFlags=s.subtreeFlags&14680064),a!==null?r=ea(a,r):(r=il(r,o,t,null),r.flags|=2),r.return=e,i.return=e,i.sibling=r,e.child=i,i=r,r=e.child,o=n.child.memoizedState,o=o===null?d0(t):{baseLanes:o.baseLanes|t,cachePool:null,transitions:o.transitions},r.memoizedState=o,r.childLanes=n.childLanes&~t,e.memoizedState=C0,i}return r=n.child,n=r.sibling,i=ea(r,{mode:"visible",children:i.children}),!(e.mode&1)&&(i.lanes=t),i.return=e,i.sibling=null,n!==null&&(t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)),e.child=i,e.memoizedState=null,i}function ov(n,e){return e=yA({mode:"visible",children:e},n.mode,0,null),e.return=n,n.child=e}function sd(n,e,t,i){return i!==null&&Pb(i),Jg(e,n.child,null,t),n=ov(e,e.pendingProps.children),n.flags|=2,e.memoizedState=null,n}function _N(n,e,t,i,s,r,o){if(t)return e.flags&256?(e.flags&=-257,i=xm(Error(we(422))),sd(n,e,o,i)):e.memoizedState!==null?(e.child=n.child,e.flags|=128,null):(r=i.fallback,s=e.mode,i=yA({mode:"visible",children:i.children},s,0,null),r=il(r,s,o,null),r.flags|=2,i.return=e,r.return=e,i.sibling=r,e.child=i,e.mode&1&&Jg(e,n.child,null,o),e.child.memoizedState=d0(o),e.memoizedState=C0,r);if(!(e.mode&1))return sd(n,e,o,null);if(s.data==="$!"){if(i=s.nextSibling&&s.nextSibling.dataset,i)var a=i.dgst;return i=a,r=Error(we(419)),i=xm(r,i,void 0),sd(n,e,o,i)}if(a=(o&n.childLanes)!==0,_i||a){if(i=ei,i!==null){switch(o&-o){case 4:s=2;break;case 16:s=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:s=32;break;case 536870912:s=268435456;break;default:s=0}s=s&(i.suspendedLanes|o)?0:s,s!==0&&s!==r.retryLane&&(r.retryLane=s,Co(n,s),lr(i,n,s,-1))}return uv(),i=xm(Error(we(421))),sd(n,e,o,i)}return s.data==="$?"?(e.flags|=128,e.child=n.child,e=o3.bind(null,n),s._reactRetry=e,null):(n=r.treeContext,gs=Qo(s.nextSibling),Is=e,In=!0,rr=null,n!==null&&(Ms[Ns++]=so,Ms[Ns++]=ro,Ms[Ns++]=cl,so=n.id,ro=n.overflow,cl=e),e=ov(e,i.children),e.flags|=4096,e)}function qB(n,e,t){n.lanes|=e;var i=n.alternate;i!==null&&(i.lanes|=e),a0(n.return,e,t)}function Rm(n,e,t,i,s){var r=n.memoizedState;r===null?n.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:i,tail:t,tailMode:s}:(r.isBackwards=e,r.rendering=null,r.renderingStartTime=0,r.last=i,r.tail=t,r.tailMode=s)}function IR(n,e,t){var i=e.pendingProps,s=i.revealOrder,r=i.tail;if(Si(n,e,i.children,t),i=hn.current,i&2)i=i&1|2,e.flags|=128;else{if(n!==null&&n.flags&128)e:for(n=e.child;n!==null;){if(n.tag===13)n.memoizedState!==null&&qB(n,t,e);else if(n.tag===19)qB(n,t,e);else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break e;for(;n.sibling===null;){if(n.return===null||n.return===e)break e;n=n.return}n.sibling.return=n.return,n=n.sibling}i&=1}if(sn(hn,i),!(e.mode&1))e.memoizedState=null;else switch(s){case"forwards":for(t=e.child,s=null;t!==null;)n=t.alternate,n!==null&&Oh(n)===null&&(s=t),t=t.sibling;t=s,t===null?(s=e.child,e.child=null):(s=t.sibling,t.sibling=null),Rm(e,!1,s,t,r);break;case"backwards":for(t=null,s=e.child,e.child=null;s!==null;){if(n=s.alternate,n!==null&&Oh(n)===null){e.child=s;break}n=s.sibling,s.sibling=t,t=s,s=n}Rm(e,!0,t,null,r);break;case"together":Rm(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function mh(n,e){!(e.mode&1)&&n!==null&&(n.alternate=null,e.alternate=null,e.flags|=2)}function ho(n,e,t){if(n!==null&&(e.dependencies=n.dependencies),ul|=e.lanes,!(t&e.childLanes))return null;if(n!==null&&e.child!==n.child)throw Error(we(153));if(e.child!==null){for(n=e.child,t=ea(n,n.pendingProps),e.child=t,t.return=e;n.sibling!==null;)n=n.sibling,t=t.sibling=ea(n,n.pendingProps),t.return=e;t.sibling=null}return e.child}function JN(n,e,t){switch(e.tag){case 3:gR(e),_g();break;case 5:Kx(e);break;case 1:Qi(e.type)&&kh(e);break;case 4:qb(e,e.stateNode.containerInfo);break;case 10:var i=e.type._context,s=e.memoizedProps.value;sn(Ph,i._currentValue),i._currentValue=s;break;case 13:if(i=e.memoizedState,i!==null)return i.dehydrated!==null?(sn(hn,hn.current&1),e.flags|=128,null):t&e.child.childLanes?cR(n,e,t):(sn(hn,hn.current&1),n=ho(n,e,t),n!==null?n.sibling:null);sn(hn,hn.current&1);break;case 19:if(i=(t&e.childLanes)!==0,n.flags&128){if(i)return IR(n,e,t);e.flags|=128}if(s=e.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),sn(hn,hn.current),i)break;return null;case 22:case 23:return e.lanes=0,aR(n,e,t)}return ho(n,e,t)}var uR,h0,CR,dR;uR=function(n,e){for(var t=e.child;t!==null;){if(t.tag===5||t.tag===6)n.appendChild(t.stateNode);else if(t.tag!==4&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return;t=t.return}t.sibling.return=t.return,t=t.sibling}};h0=function(){};CR=function(n,e,t,i){var s=n.memoizedProps;if(s!==i){n=e.stateNode,Oa(Vr.current);var r=null;switch(t){case"input":s=Ff(n,s),i=Ff(n,i),r=[];break;case"select":s=fn({},s,{value:void 0}),i=fn({},i,{value:void 0}),r=[];break;case"textarea":s=Lf(n,s),i=Lf(n,i),r=[];break;default:typeof s.onClick!="function"&&typeof i.onClick=="function"&&(n.onclick=Th)}Ef(t,i);var o;t=null;for(c in s)if(!i.hasOwnProperty(c)&&s.hasOwnProperty(c)&&s[c]!=null)if(c==="style"){var a=s[c];for(o in a)a.hasOwnProperty(o)&&(t||(t={}),t[o]="")}else c!=="dangerouslySetInnerHTML"&&c!=="children"&&c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&c!=="autoFocus"&&(TI.hasOwnProperty(c)?r||(r=[]):(r=r||[]).push(c,null));for(c in i){var l=i[c];if(a=s?.[c],i.hasOwnProperty(c)&&l!==a&&(l!=null||a!=null))if(c==="style")if(a){for(o in a)!a.hasOwnProperty(o)||l&&l.hasOwnProperty(o)||(t||(t={}),t[o]="");for(o in l)l.hasOwnProperty(o)&&a[o]!==l[o]&&(t||(t={}),t[o]=l[o])}else t||(r||(r=[]),r.push(c,t)),t=l;else c==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,a=a?a.__html:void 0,l!=null&&a!==l&&(r=r||[]).push(c,l)):c==="children"?typeof l!="string"&&typeof l!="number"||(r=r||[]).push(c,""+l):c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&(TI.hasOwnProperty(c)?(l!=null&&c==="onScroll"&&on("scroll",n),r||a===l||(r=[])):(r=r||[]).push(c,l))}t&&(r=r||[]).push("style",t);var c=r;(e.updateQueue=c)&&(e.flags|=4)}};dR=function(n,e,t,i){t!==i&&(e.flags|=4)};function Dc(n,e){if(!In)switch(n.tailMode){case"hidden":e=n.tail;for(var t=null;e!==null;)e.alternate!==null&&(t=e),e=e.sibling;t===null?n.tail=null:t.sibling=null;break;case"collapsed":t=n.tail;for(var i=null;t!==null;)t.alternate!==null&&(i=t),t=t.sibling;i===null?e||n.tail===null?n.tail=null:n.tail.sibling=null:i.sibling=null}}function hi(n){var e=n.alternate!==null&&n.alternate.child===n.child,t=0,i=0;if(e)for(var s=n.child;s!==null;)t|=s.lanes|s.childLanes,i|=s.subtreeFlags&14680064,i|=s.flags&14680064,s.return=n,s=s.sibling;else for(s=n.child;s!==null;)t|=s.lanes|s.childLanes,i|=s.subtreeFlags,i|=s.flags,s.return=n,s=s.sibling;return n.subtreeFlags|=i,n.childLanes=t,e}function ON(n,e,t){var i=e.pendingProps;switch(Ub(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return hi(e),null;case 1:return Qi(e.type)&&Eh(),hi(e),null;case 3:return i=e.stateNode,Og(),ln(Oi),ln(vi),ev(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(n===null||n.child===null)&&(nd(e)?e.flags|=4:n===null||n.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,rr!==null&&(G0(rr),rr=null))),h0(n,e),hi(e),null;case 5:$b(e);var s=Oa($I.current);if(t=e.type,n!==null&&e.stateNode!=null)CR(n,e,t,i,s),n.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!i){if(e.stateNode===null)throw Error(we(166));return hi(e),null}if(n=Oa(Vr.current),nd(e)){i=e.stateNode,t=e.type;var r=e.memoizedProps;switch(i[Rr]=e,i[jI]=r,n=(e.mode&1)!==0,t){case"dialog":on("cancel",i),on("close",i);break;case"iframe":case"object":case"embed":on("load",i);break;case"video":case"audio":for(s=0;s<\/script>",n=n.removeChild(n.firstChild)):typeof i.is=="string"?n=o.createElement(t,{is:i.is}):(n=o.createElement(t),t==="select"&&(o=n,i.multiple?o.multiple=!0:i.size&&(o.size=i.size))):n=o.createElementNS(n,t),n[Rr]=e,n[jI]=i,uR(n,e,!1,!1),e.stateNode=n;e:{switch(o=kf(t,i),t){case"dialog":on("cancel",n),on("close",n),s=i;break;case"iframe":case"object":case"embed":on("load",n),s=i;break;case"video":case"audio":for(s=0;sjg&&(e.flags|=128,i=!0,Dc(r,!1),e.lanes=4194304)}else{if(!i)if(n=Oh(o),n!==null){if(e.flags|=128,i=!0,t=n.updateQueue,t!==null&&(e.updateQueue=t,e.flags|=4),Dc(r,!0),r.tail===null&&r.tailMode==="hidden"&&!o.alternate&&!In)return hi(e),null}else 2*Sn()-r.renderingStartTime>jg&&t!==1073741824&&(e.flags|=128,i=!0,Dc(r,!1),e.lanes=4194304);r.isBackwards?(o.sibling=e.child,e.child=o):(t=r.last,t!==null?t.sibling=o:e.child=o,r.last=o)}return r.tail!==null?(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=Sn(),e.sibling=null,t=hn.current,sn(hn,i?t&1|2:t&1),e):(hi(e),null);case 22:case 23:return Iv(),i=e.memoizedState!==null,n!==null&&n.memoizedState!==null!==i&&(e.flags|=8192),i&&e.mode&1?as&1073741824&&(hi(e),e.subtreeFlags&6&&(e.flags|=8192)):hi(e),null;case 24:return null;case 25:return null}throw Error(we(156,e.tag))}function QN(n,e){switch(Ub(e),e.tag){case 1:return Qi(e.type)&&Eh(),n=e.flags,n&65536?(e.flags=n&-65537|128,e):null;case 3:return Og(),ln(Oi),ln(vi),ev(),n=e.flags,n&65536&&!(n&128)?(e.flags=n&-65537|128,e):null;case 5:return $b(e),null;case 13:if(ln(hn),n=e.memoizedState,n!==null&&n.dehydrated!==null){if(e.alternate===null)throw Error(we(340));_g()}return n=e.flags,n&65536?(e.flags=n&-65537|128,e):null;case 19:return ln(hn),null;case 4:return Og(),null;case 10:return Ob(e.type._context),null;case 22:case 23:return Iv(),null;case 24:return null;default:return null}}var rd=!1,bi=!1,jN=typeof WeakSet=="function"?WeakSet:Set,ze=null;function Zg(n,e){var t=n.ref;if(t!==null)if(typeof t=="function")try{t(null)}catch(i){yn(n,e,i)}else t.current=null}function A0(n,e,t){try{t()}catch(i){yn(n,e,i)}}var $B=!1;function qN(n,e){if($f=Kh,n=mx(),kb(n)){if("selectionStart"in n)var t={start:n.selectionStart,end:n.selectionEnd};else e:{t=(t=n.ownerDocument)&&t.defaultView||window;var i=t.getSelection&&t.getSelection();if(i&&i.rangeCount!==0){t=i.anchorNode;var s=i.anchorOffset,r=i.focusNode;i=i.focusOffset;try{t.nodeType,r.nodeType}catch{t=null;break e}var o=0,a=-1,l=-1,c=0,u=0,C=n,d=null;t:for(;;){for(var h;C!==t||s!==0&&C.nodeType!==3||(a=o+s),C!==r||i!==0&&C.nodeType!==3||(l=o+i),C.nodeType===3&&(o+=C.nodeValue.length),(h=C.firstChild)!==null;)d=C,C=h;for(;;){if(C===n)break t;if(d===t&&++c===s&&(a=o),d===r&&++u===i&&(l=o),(h=C.nextSibling)!==null)break;C=d,d=C.parentNode}C=h}t=a===-1||l===-1?null:{start:a,end:l}}else t=null}t=t||{start:0,end:0}}else t=null;for(e0={focusedElem:n,selectionRange:t},Kh=!1,ze=e;ze!==null;)if(e=ze,n=e.child,(e.subtreeFlags&1028)!==0&&n!==null)n.return=e,ze=n;else for(;ze!==null;){e=ze;try{var m=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(m!==null){var v=m.memoizedProps,y=m.memoizedState,A=e.stateNode,b=A.getSnapshotBeforeUpdate(e.elementType===e.type?v:nr(e.type,v),y);A.__reactInternalSnapshotBeforeUpdate=b}break;case 3:var f=e.stateNode.containerInfo;f.nodeType===1?f.textContent="":f.nodeType===9&&f.documentElement&&f.removeChild(f.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(we(163))}}catch(B){yn(e,e.return,B)}if(n=e.sibling,n!==null){n.return=e.return,ze=n;break}ze=e.return}return m=$B,$B=!1,m}function xI(n,e,t){var i=e.updateQueue;if(i=i!==null?i.lastEffect:null,i!==null){var s=i=i.next;do{if((s.tag&n)===n){var r=s.destroy;s.destroy=void 0,r!==void 0&&A0(e,t,r)}s=s.next}while(s!==i)}}function bA(n,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var t=e=e.next;do{if((t.tag&n)===n){var i=t.create;t.destroy=i()}t=t.next}while(t!==e)}}function p0(n){var e=n.ref;if(e!==null){var t=n.stateNode;switch(n.tag){case 5:n=t;break;default:n=t}typeof e=="function"?e(n):e.current=n}}function hR(n){var e=n.alternate;e!==null&&(n.alternate=null,hR(e)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(e=n.stateNode,e!==null&&(delete e[Rr],delete e[jI],delete e[i0],delete e[HN],delete e[XN])),n.stateNode=null,n.return=null,n.dependencies=null,n.memoizedProps=null,n.memoizedState=null,n.pendingProps=null,n.stateNode=null,n.updateQueue=null}function AR(n){return n.tag===5||n.tag===3||n.tag===4}function e2(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||AR(n.return))return null;n=n.return}for(n.sibling.return=n.return,n=n.sibling;n.tag!==5&&n.tag!==6&&n.tag!==18;){if(n.flags&2||n.child===null||n.tag===4)continue e;n.child.return=n,n=n.child}if(!(n.flags&2))return n.stateNode}}function m0(n,e,t){var i=n.tag;if(i===5||i===6)n=n.stateNode,e?t.nodeType===8?t.parentNode.insertBefore(n,e):t.insertBefore(n,e):(t.nodeType===8?(e=t.parentNode,e.insertBefore(n,t)):(e=t,e.appendChild(n)),t=t._reactRootContainer,t!=null||e.onclick!==null||(e.onclick=Th));else if(i!==4&&(n=n.child,n!==null))for(m0(n,e,t),n=n.sibling;n!==null;)m0(n,e,t),n=n.sibling}function f0(n,e,t){var i=n.tag;if(i===5||i===6)n=n.stateNode,e?t.insertBefore(n,e):t.appendChild(n);else if(i!==4&&(n=n.child,n!==null))for(f0(n,e,t),n=n.sibling;n!==null;)f0(n,e,t),n=n.sibling}var ri=null,sr=!1;function Vo(n,e,t){for(t=t.child;t!==null;)pR(n,e,t),t=t.sibling}function pR(n,e,t){if(Wr&&typeof Wr.onCommitFiberUnmount=="function")try{Wr.onCommitFiberUnmount(uA,t)}catch{}switch(t.tag){case 5:bi||Zg(t,e);case 6:var i=ri,s=sr;ri=null,Vo(n,e,t),ri=i,sr=s,ri!==null&&(sr?(n=ri,t=t.stateNode,n.nodeType===8?n.parentNode.removeChild(t):n.removeChild(t)):ri.removeChild(t.stateNode));break;case 18:ri!==null&&(sr?(n=ri,t=t.stateNode,n.nodeType===8?ym(n.parentNode,t):n.nodeType===1&&ym(n,t),PI(n)):ym(ri,t.stateNode));break;case 4:i=ri,s=sr,ri=t.stateNode.containerInfo,sr=!0,Vo(n,e,t),ri=i,sr=s;break;case 0:case 11:case 14:case 15:if(!bi&&(i=t.updateQueue,i!==null&&(i=i.lastEffect,i!==null))){s=i=i.next;do{var r=s,o=r.destroy;r=r.tag,o!==void 0&&(r&2||r&4)&&A0(t,e,o),s=s.next}while(s!==i)}Vo(n,e,t);break;case 1:if(!bi&&(Zg(t,e),i=t.stateNode,typeof i.componentWillUnmount=="function"))try{i.props=t.memoizedProps,i.state=t.memoizedState,i.componentWillUnmount()}catch(a){yn(t,e,a)}Vo(n,e,t);break;case 21:Vo(n,e,t);break;case 22:t.mode&1?(bi=(i=bi)||t.memoizedState!==null,Vo(n,e,t),bi=i):Vo(n,e,t);break;default:Vo(n,e,t)}}function t2(n){var e=n.updateQueue;if(e!==null){n.updateQueue=null;var t=n.stateNode;t===null&&(t=n.stateNode=new jN),e.forEach(function(i){var s=a3.bind(null,n,i);t.has(i)||(t.add(i),i.then(s,s))})}}function Os(n,e){var t=e.deletions;if(t!==null)for(var i=0;is&&(s=o),i&=~r}if(i=s,i=Sn()-i,i=(120>i?120:480>i?480:1080>i?1080:1920>i?1920:3e3>i?3e3:4320>i?4320:1960*e3(i/1960))-i,10n?16:n,Uo===null)var i=!1;else{if(n=Uo,Uo=null,eA=0,Ft&6)throw Error(we(331));var s=Ft;for(Ft|=4,ze=n.current;ze!==null;){var r=ze,o=r.child;if(ze.flags&16){var a=r.deletions;if(a!==null){for(var l=0;lSn()-gv?nl(n,0):lv|=t),ji(n,e)}function ZR(n,e){e===0&&(n.mode&1?(e=QC,QC<<=1,!(QC&130023424)&&(QC=4194304)):e=1);var t=Wi();n=Co(n,e),n!==null&&(wu(n,e,t),ji(n,t))}function o3(n){var e=n.memoizedState,t=0;e!==null&&(t=e.retryLane),ZR(n,t)}function a3(n,e){var t=0;switch(n.tag){case 13:var i=n.stateNode,s=n.memoizedState;s!==null&&(t=s.retryLane);break;case 19:i=n.stateNode;break;default:throw Error(we(314))}i!==null&&i.delete(e),ZR(n,t)}var wR;wR=function(n,e,t){if(n!==null)if(n.memoizedProps!==e.pendingProps||Oi.current)_i=!0;else{if(!(n.lanes&t)&&!(e.flags&128))return _i=!1,JN(n,e,t);_i=!!(n.flags&131072)}else _i=!1,In&&e.flags&1048576&&Rx(e,Uh,e.index);switch(e.lanes=0,e.tag){case 2:var i=e.type;mh(n,e),n=e.pendingProps;var s=Pg(e,vi.current);Kg(e,t),s=nv(null,e,i,n,s,t);var r=iv();return e.flags|=1,typeof s=="object"&&s!==null&&typeof s.render=="function"&&s.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,Qi(i)?(r=!0,kh(e)):r=!1,e.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,jb(e),s.updater=mA,e.stateNode=s,s._reactInternals=e,g0(e,i,n,t),e=u0(null,e,i,!0,r,t)):(e.tag=0,In&&r&&Db(e),Si(null,e,s,t),e=e.child),e;case 16:i=e.elementType;e:{switch(mh(n,e),n=e.pendingProps,s=i._init,i=s(i._payload),e.type=i,s=e.tag=g3(i),n=nr(i,n),s){case 0:e=I0(null,e,i,n,t);break e;case 1:e=QB(null,e,i,n,t);break e;case 11:e=JB(null,e,i,n,t);break e;case 14:e=OB(null,e,i,nr(i.type,n),t);break e}throw Error(we(306,i,""))}return e;case 0:return i=e.type,s=e.pendingProps,s=e.elementType===i?s:nr(i,s),I0(n,e,i,s,t);case 1:return i=e.type,s=e.pendingProps,s=e.elementType===i?s:nr(i,s),QB(n,e,i,s,t);case 3:e:{if(gR(e),n===null)throw Error(we(387));i=e.pendingProps,r=e.memoizedState,s=r.element,Nx(n,e),Jh(e,i,null,t);var o=e.memoizedState;if(i=o.element,r.isDehydrated)if(r={element:i,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},e.updateQueue.baseState=r,e.memoizedState=r,e.flags&256){s=Qg(Error(we(423)),e),e=jB(n,e,i,t,s);break e}else if(i!==s){s=Qg(Error(we(424)),e),e=jB(n,e,i,t,s);break e}else for(gs=Qo(e.stateNode.containerInfo.firstChild),Is=e,In=!0,rr=null,t=Fx(e,null,i,t),e.child=t;t;)t.flags=t.flags&-3|4096,t=t.sibling;else{if(_g(),i===s){e=ho(n,e,t);break e}Si(n,e,i,t)}e=e.child}return e;case 5:return Kx(e),n===null&&o0(e),i=e.type,s=e.pendingProps,r=n!==null?n.memoizedProps:null,o=s.children,t0(i,s)?o=null:r!==null&&t0(i,r)&&(e.flags|=32),lR(n,e),Si(n,e,o,t),e.child;case 6:return n===null&&o0(e),null;case 13:return cR(n,e,t);case 4:return qb(e,e.stateNode.containerInfo),i=e.pendingProps,n===null?e.child=Jg(e,null,i,t):Si(n,e,i,t),e.child;case 11:return i=e.type,s=e.pendingProps,s=e.elementType===i?s:nr(i,s),JB(n,e,i,s,t);case 7:return Si(n,e,e.pendingProps,t),e.child;case 8:return Si(n,e,e.pendingProps.children,t),e.child;case 12:return Si(n,e,e.pendingProps.children,t),e.child;case 10:e:{if(i=e.type._context,s=e.pendingProps,r=e.memoizedProps,o=s.value,sn(Ph,i._currentValue),i._currentValue=o,r!==null)if(Ir(r.value,o)){if(r.children===s.children&&!Oi.current){e=ho(n,e,t);break e}}else for(r=e.child,r!==null&&(r.return=e);r!==null;){var a=r.dependencies;if(a!==null){o=r.child;for(var l=a.firstContext;l!==null;){if(l.context===i){if(r.tag===1){l=go(-1,t&-t),l.tag=2;var c=r.updateQueue;if(c!==null){c=c.shared;var u=c.pending;u===null?l.next=l:(l.next=u.next,u.next=l),c.pending=l}}r.lanes|=t,l=r.alternate,l!==null&&(l.lanes|=t),a0(r.return,t,e),a.lanes|=t;break}l=l.next}}else if(r.tag===10)o=r.type===e.type?null:r.child;else if(r.tag===18){if(o=r.return,o===null)throw Error(we(341));o.lanes|=t,a=o.alternate,a!==null&&(a.lanes|=t),a0(o,t,e),o=r.sibling}else o=r.child;if(o!==null)o.return=r;else for(o=r;o!==null;){if(o===e){o=null;break}if(r=o.sibling,r!==null){r.return=o.return,o=r;break}o=o.return}r=o}Si(n,e,s.children,t),e=e.child}return e;case 9:return s=e.type,i=e.pendingProps.children,Kg(e,t),s=Fs(s),i=i(s),e.flags|=1,Si(n,e,i,t),e.child;case 14:return i=e.type,s=nr(i,e.pendingProps),s=nr(i.type,s),OB(n,e,i,s,t);case 15:return oR(n,e,e.type,e.pendingProps,t);case 17:return i=e.type,s=e.pendingProps,s=e.elementType===i?s:nr(i,s),mh(n,e),e.tag=1,Qi(i)?(n=!0,kh(e)):n=!1,Kg(e,t),Xx(e,i,s),g0(e,i,s,t),u0(null,e,i,!0,n,t);case 19:return IR(n,e,t);case 22:return aR(n,e,t)}throw Error(we(156,e.tag))};function SR(n,e){return $S(n,e)}function l3(n,e,t,i){this.tag=n,this.key=t,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=i,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Hs(n,e,t,i){return new l3(n,e,t,i)}function Cv(n){return n=n.prototype,!(!n||!n.isReactComponent)}function g3(n){if(typeof n=="function")return Cv(n)?1:0;if(n!=null){if(n=n.$$typeof,n===Mb)return 11;if(n===Nb)return 14}return 2}function ea(n,e){var t=n.alternate;return t===null?(t=Hs(n.tag,e,n.key,n.mode),t.elementType=n.elementType,t.type=n.type,t.stateNode=n.stateNode,t.alternate=n,n.alternate=t):(t.pendingProps=e,t.type=n.type,t.flags=0,t.subtreeFlags=0,t.deletions=null),t.flags=n.flags&14680064,t.childLanes=n.childLanes,t.lanes=n.lanes,t.child=n.child,t.memoizedProps=n.memoizedProps,t.memoizedState=n.memoizedState,t.updateQueue=n.updateQueue,e=n.dependencies,t.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},t.sibling=n.sibling,t.index=n.index,t.ref=n.ref,t}function vh(n,e,t,i,s,r){var o=2;if(i=n,typeof n=="function")Cv(n)&&(o=1);else if(typeof n=="string")o=5;else e:switch(n){case Ag:return il(t.children,s,r,e);case Vb:o=8,s|=8;break;case Nf:return n=Hs(12,t,e,s|2),n.elementType=Nf,n.lanes=r,n;case Hf:return n=Hs(13,t,e,s),n.elementType=Hf,n.lanes=r,n;case Xf:return n=Hs(19,t,e,s),n.elementType=Xf,n.lanes=r,n;case YS:return yA(t,s,r,e);default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case HS:o=10;break e;case XS:o=9;break e;case Mb:o=11;break e;case Nb:o=14;break e;case zo:o=16,i=null;break e}throw Error(we(130,n==null?n:typeof n,""))}return e=Hs(o,t,e,s),e.elementType=n,e.type=i,e.lanes=r,e}function il(n,e,t,i){return n=Hs(7,n,i,e),n.lanes=t,n}function yA(n,e,t,i){return n=Hs(22,n,i,e),n.elementType=YS,n.lanes=t,n.stateNode={isHidden:!1},n}function Wm(n,e,t){return n=Hs(6,n,null,e),n.lanes=t,n}function Vm(n,e,t){return e=Hs(4,n.children!==null?n.children:[],n.key,e),e.lanes=t,e.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},e}function c3(n,e,t,i,s){this.tag=e,this.containerInfo=n,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Im(0),this.expirationTimes=Im(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Im(0),this.identifierPrefix=i,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function dv(n,e,t,i,s,r,o,a,l){return n=new c3(n,e,t,a,l),e===1?(e=1,r===!0&&(e|=8)):e=0,r=Hs(3,null,null,e),n.current=r,r.stateNode=n,r.memoizedState={element:i,isDehydrated:t,cache:null,transitions:null,pendingSuspenseBoundaries:null},jb(r),n}function I3(n,e,t){var i=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(VR)}catch(n){console.error(n)}}VR(),RS.exports=As;var A3=RS.exports,g2=A3;Vf.createRoot=g2.createRoot,Vf.hydrateRoot=g2.hydrateRoot;const p3=({className:n})=>E.jsxs("svg",{className:n,width:"100%",height:"100%",viewBox:"0 0 180 180",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[E.jsx("path",{className:"fill-icontext dark:fill-icontext-dark",d:"M76.875 5.3125L65.25 51H54.2188L48.0312 27C47.9062 26.5417 47.7396 25.8438 47.5312 24.9062C47.3229 23.9688 47.1042 22.9479 46.875 21.8438C46.6458 20.7188 46.4375 19.6667 46.25 18.6875C46.0833 17.6875 45.9688 16.8958 45.9062 16.3125C45.8438 16.8958 45.7188 17.6771 45.5312 18.6562C45.3646 19.6354 45.1667 20.6771 44.9375 21.7812C44.7292 22.8854 44.5208 23.9167 44.3125 24.875C44.1042 25.8333 43.9375 26.5625 43.8125 27.0625L37.6562 51H26.6562L15 5.3125H24.5312L30.375 30.25C30.5417 31 30.7292 31.8958 30.9375 32.9375C31.1667 33.9792 31.3854 35.0729 31.5938 36.2188C31.8229 37.3438 32.0208 38.4375 32.1875 39.5C32.375 40.5417 32.5104 41.4479 32.5938 42.2188C32.6979 41.4271 32.8333 40.5104 33 39.4688C33.1667 38.4062 33.3438 37.3333 33.5312 36.25C33.7396 35.1458 33.9479 34.125 34.1562 33.1875C34.3646 32.25 34.5521 31.4896 34.7188 30.9062L41.375 5.3125H50.5312L57.1875 30.9062C57.3333 31.4688 57.5 32.2292 57.6875 33.1875C57.8958 34.125 58.1042 35.1458 58.3125 36.25C58.5208 37.3542 58.7083 38.4375 58.875 39.5C59.0625 40.5417 59.1979 41.4479 59.2812 42.2188C59.4271 41.1771 59.625 39.9167 59.875 38.4375C60.1458 36.9375 60.4271 35.4479 60.7188 33.9688C61.0312 32.4896 61.3021 31.25 61.5312 30.25L67.3438 5.3125H76.875ZM107.225 33.4688C107.225 36.3854 106.829 38.9688 106.037 41.2188C105.267 43.4688 104.131 45.375 102.631 46.9375C101.152 48.4792 99.3604 49.6458 97.2562 50.4375C95.1729 51.2292 92.8187 51.625 90.1937 51.625C87.7354 51.625 85.475 51.2292 83.4125 50.4375C81.3708 49.6458 79.5896 48.4792 78.0687 46.9375C76.5687 45.375 75.4021 43.4688 74.5687 41.2188C73.7562 38.9688 73.35 36.3854 73.35 33.4688C73.35 29.5938 74.0375 26.3125 75.4125 23.625C76.7875 20.9375 78.7458 18.8958 81.2875 17.5C83.8292 16.1042 86.8604 15.4062 90.3812 15.4062C93.6521 15.4062 96.5479 16.1042 99.0687 17.5C101.61 18.8958 103.6 20.9375 105.037 23.625C106.496 26.3125 107.225 29.5938 107.225 33.4688ZM83.0687 33.4688C83.0687 35.7604 83.3187 37.6875 83.8187 39.25C84.3187 40.8125 85.1 41.9896 86.1625 42.7812C87.225 43.5729 88.6104 43.9688 90.3187 43.9688C92.0062 43.9688 93.3708 43.5729 94.4125 42.7812C95.475 41.9896 96.2458 40.8125 96.725 39.25C97.225 37.6875 97.475 35.7604 97.475 33.4688C97.475 31.1562 97.225 29.2396 96.725 27.7188C96.2458 26.1771 95.475 25.0208 94.4125 24.25C93.35 23.4792 91.9646 23.0938 90.2562 23.0938C87.7354 23.0938 85.9021 23.9583 84.7562 25.6875C83.6312 27.4167 83.0687 30.0104 83.0687 33.4688ZM122.003 51.625C118.107 51.625 114.93 50.1042 112.471 47.0625C110.034 44 108.815 39.5104 108.815 33.5938C108.815 27.6146 110.055 23.0938 112.534 20.0312C115.013 16.9479 118.253 15.4062 122.253 15.4062C123.919 15.4062 125.388 15.6354 126.659 16.0938C127.93 16.5521 129.023 17.1667 129.94 17.9375C130.878 18.7083 131.669 19.5729 132.315 20.5312H132.628C132.503 19.8646 132.346 18.8854 132.159 17.5938C131.992 16.2812 131.909 14.9375 131.909 13.5625V2.375H141.471V51H134.159L132.315 46.4688H131.909C131.305 47.4271 130.544 48.3021 129.628 49.0938C128.732 49.8646 127.659 50.4792 126.409 50.9375C125.159 51.3958 123.69 51.625 122.003 51.625ZM125.346 44.0312C127.95 44.0312 129.784 43.2604 130.846 41.7188C131.93 40.1562 132.503 37.8125 132.565 34.6875V33.6562C132.565 30.2604 132.044 27.6667 131.003 25.875C129.961 24.0625 128.023 23.1562 125.19 23.1562C123.086 23.1562 121.44 24.0625 120.253 25.875C119.065 27.6875 118.471 30.3021 118.471 33.7188C118.471 37.1354 119.065 39.7083 120.253 41.4375C121.461 43.1667 123.159 44.0312 125.346 44.0312ZM159.446 15.4062C162.675 15.4062 165.457 16.0312 167.79 17.2812C170.123 18.5104 171.925 20.3021 173.196 22.6562C174.467 25.0104 175.103 27.8854 175.103 31.2812V35.9062H152.571C152.675 38.5938 153.478 40.7083 154.978 42.25C156.498 43.7708 158.603 44.5312 161.29 44.5312C163.519 44.5312 165.561 44.3021 167.415 43.8438C169.269 43.3854 171.175 42.6979 173.134 41.7812V49.1562C171.405 50.0104 169.592 50.6354 167.696 51.0312C165.821 51.4271 163.54 51.625 160.853 51.625C157.353 51.625 154.248 50.9792 151.54 49.6875C148.853 48.3958 146.738 46.4271 145.196 43.7812C143.675 41.1354 142.915 37.8021 142.915 33.7812C142.915 29.6979 143.603 26.3021 144.978 23.5938C146.373 20.8646 148.311 18.8229 150.79 17.4688C153.269 16.0938 156.155 15.4062 159.446 15.4062ZM159.509 22.1875C157.655 22.1875 156.113 22.7812 154.884 23.9688C153.675 25.1562 152.978 27.0208 152.79 29.5625H166.165C166.144 28.1458 165.884 26.8854 165.384 25.7812C164.905 24.6771 164.175 23.8021 163.196 23.1562C162.238 22.5104 161.009 22.1875 159.509 22.1875ZM61.2812 155H48.9688L29.0938 120.438H28.8125C28.8958 121.875 28.9688 123.323 29.0312 124.781C29.0938 126.24 29.1562 127.698 29.2188 129.156C29.2812 130.594 29.3438 132.042 29.4062 133.5V155H20.75V109.312H32.9688L52.8125 143.531H53.0312C52.9896 142.115 52.9375 140.708 52.875 139.312C52.8125 137.917 52.75 136.521 52.6875 135.125C52.6458 133.729 52.6042 132.333 52.5625 130.938V109.312H61.2812V155ZM75.1937 120.062V155H65.6625V120.062H75.1937ZM70.4437 106.375C71.8604 106.375 73.0792 106.708 74.1 107.375C75.1208 108.021 75.6312 109.24 75.6312 111.031C75.6312 112.802 75.1208 114.031 74.1 114.719C73.0792 115.385 71.8604 115.719 70.4437 115.719C69.0062 115.719 67.7771 115.385 66.7562 114.719C65.7562 114.031 65.2562 112.802 65.2562 111.031C65.2562 109.24 65.7562 108.021 66.7562 107.375C67.7771 106.708 69.0062 106.375 70.4437 106.375Z"}),E.jsx("path",{className:"fill-primary",d:"M18.3382 54.625C18.1007 55.7875 17.857 57.0187 17.607 58.3187C17.3695 59.6187 17.1507 60.8937 16.9507 62.1437C16.7632 63.3937 16.6132 64.5312 16.5007 65.5562H10.0882L9.807 65.1437C10.0445 64.2187 10.3382 63.1187 10.6882 61.8437C11.0507 60.5562 11.4382 59.2687 11.8507 57.9812C12.2757 56.6812 12.7007 55.5625 13.1257 54.625H18.3382ZM8.77575 54.625C8.53825 55.7875 8.2945 57.0187 8.0445 58.3187C7.807 59.6187 7.58825 60.8937 7.38825 62.1437C7.20075 63.3937 7.05075 64.5312 6.93825 65.5562H0.525749L0.244499 65.1437C0.481999 64.2187 0.775749 63.1187 1.12575 61.8437C1.48825 60.5562 1.87575 59.2687 2.28825 57.9812C2.71325 56.6812 3.13825 55.5625 3.56325 54.625H8.77575ZM61.2812 103H48.9688L29.0938 68.4375H28.8125C28.8958 69.875 28.9688 71.3229 29.0312 72.7812C29.0938 74.2396 29.1562 75.6979 29.2188 77.1562C29.2812 78.5938 29.3438 80.0417 29.4062 81.5V103H20.75V57.3125H32.9688L52.8125 91.5312H53.0312C52.9896 90.1146 52.9375 88.7083 52.875 87.3125C52.8125 85.9167 52.75 84.5208 52.6875 83.125C52.6458 81.7292 52.6042 80.3333 52.5625 78.9375V57.3125H61.2812V103ZM75.1937 68.0625V103H65.6625V68.0625H75.1937ZM70.4437 54.375C71.8604 54.375 73.0792 54.7083 74.1 55.375C75.1208 56.0208 75.6312 57.2396 75.6312 59.0312C75.6312 60.8021 75.1208 62.0312 74.1 62.7188C73.0792 63.3854 71.8604 63.7188 70.4437 63.7188C69.0062 63.7188 67.7771 63.3854 66.7562 62.7188C65.7562 62.0312 65.2562 60.8021 65.2562 59.0312C65.2562 57.2396 65.7562 56.0208 66.7562 55.375C67.7771 54.7083 69.0062 54.375 70.4437 54.375ZM119.856 67.4062C123.815 67.4062 126.804 68.4271 128.825 70.4688C130.867 72.4896 131.888 75.7396 131.888 80.2188V103H122.325V82.5938C122.325 80.0938 121.898 78.2083 121.044 76.9375C120.19 75.6667 118.867 75.0312 117.075 75.0312C114.554 75.0312 112.763 75.9375 111.7 77.75C110.638 79.5417 110.106 82.1146 110.106 85.4688V103H100.575V82.5938C100.575 80.9271 100.388 79.5312 100.013 78.4062C99.6375 77.2812 99.0646 76.4375 98.2938 75.875C97.5229 75.3125 96.5333 75.0312 95.325 75.0312C93.5542 75.0312 92.1583 75.4792 91.1375 76.375C90.1375 77.25 89.4188 78.5521 88.9813 80.2812C88.5646 81.9896 88.3563 84.0833 88.3563 86.5625V103H78.825V68.0625H86.1063L87.3875 72.5312H87.9188C88.6271 71.3229 89.5125 70.3438 90.575 69.5938C91.6583 68.8438 92.8458 68.2917 94.1375 67.9375C95.4292 67.5833 96.7417 67.4062 98.075 67.4062C100.638 67.4062 102.804 67.8229 104.575 68.6562C106.367 69.4896 107.742 70.7812 108.7 72.5312H109.544C110.585 70.7396 112.054 69.4375 113.95 68.625C115.867 67.8125 117.835 67.4062 119.856 67.4062ZM167.05 85.4688C167.05 88.3854 166.654 90.9688 165.863 93.2188C165.092 95.4688 163.956 97.375 162.456 98.9375C160.977 100.479 159.185 101.646 157.081 102.438C154.998 103.229 152.644 103.625 150.019 103.625C147.56 103.625 145.3 103.229 143.238 102.438C141.196 101.646 139.415 100.479 137.894 98.9375C136.394 97.375 135.227 95.4688 134.394 93.2188C133.581 90.9688 133.175 88.3854 133.175 85.4688C133.175 81.5938 133.863 78.3125 135.238 75.625C136.613 72.9375 138.571 70.8958 141.113 69.5C143.654 68.1042 146.685 67.4062 150.206 67.4062C153.477 67.4062 156.373 68.1042 158.894 69.5C161.435 70.8958 163.425 72.9375 164.863 75.625C166.321 78.3125 167.05 81.5938 167.05 85.4688ZM142.894 85.4688C142.894 87.7604 143.144 89.6875 143.644 91.25C144.144 92.8125 144.925 93.9896 145.988 94.7812C147.05 95.5729 148.435 95.9688 150.144 95.9688C151.831 95.9688 153.196 95.5729 154.238 94.7812C155.3 93.9896 156.071 92.8125 156.55 91.25C157.05 89.6875 157.3 87.7604 157.3 85.4688C157.3 83.1562 157.05 81.2396 156.55 79.7188C156.071 78.1771 155.3 77.0208 154.238 76.25C153.175 75.4792 151.79 75.0938 150.081 75.0938C147.56 75.0938 145.727 75.9583 144.581 77.6875C143.456 79.4167 142.894 82.0104 142.894 85.4688ZM182.031 54.625L182.294 55.0375C182.069 55.9625 181.775 57.0687 181.412 58.3562C181.062 59.6312 180.675 60.9125 180.25 62.2C179.837 63.4875 179.419 64.6062 178.994 65.5562H173.781C174.031 64.3937 174.275 63.1625 174.512 61.8625C174.75 60.5625 174.962 59.2875 175.15 58.0375C175.35 56.7875 175.506 55.65 175.619 54.625H182.031ZM172.469 54.625L172.75 55.0375C172.525 55.9625 172.231 57.0687 171.869 58.3562C171.506 59.6312 171.112 60.9125 170.687 62.2C170.275 63.4875 169.856 64.6062 169.431 65.5562H164.219C164.406 64.6812 164.587 63.7687 164.762 62.8187C164.95 61.8562 165.125 60.8937 165.287 59.9312C165.45 58.9687 165.594 58.0375 165.719 57.1375C165.856 56.225 165.969 55.3875 166.056 54.625H172.469Z"})]}),m3="/assets/penrose.svg",f3="/assets/edgeworth.svg",b3="/assets/mathdiagrams.webp";/** * @license * Copyright 2010-2023 Three.js Authors * SPDX-License-Identifier: MIT - */const da="152",v3={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},y3={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},MR=0,B0=1,NR=2,G3=3,HR=0,SA=1,VI=2,ir=3,Hr=0,Tn=1,Pi=2,B3=2,tn=0,sl=1,Z0=2,w0=3,S0=4,XR=5,Ea=100,YR=101,FR=102,x0=103,R0=104,KR=200,zR=201,LR=202,TR=203,mv=204,fv=205,ER=206,kR=207,DR=208,UR=209,PR=210,bv=0,vv=1,iA=2,su=3,ru=4,yv=5,Gv=6,xA=7,Wu=0,_R=1,JR=2,gr=0,OR=1,QR=2,jR=3,Bv=4,qR=5,RA=300,oa=301,aa=302,ou=303,au=304,oc=306,hs=1e3,zn=1001,lu=1002,pt=1003,sA=1004,Z3=1004,MI=1005,w3=1005,je=1006,Zv=1007,S3=1007,la=1008,x3=1008,rn=1009,$R=1010,e1=1011,wv=1012,t1=1013,oo=1014,wn=1015,us=1016,n1=1017,i1=1018,ta=1020,s1=1021,un=1023,WA=1024,r1=1025,na=1026,ga=1027,Sv=1028,o1=1029,xv=1030,a1=1031,l1=1033,yh=33776,Gh=33777,Bh=33778,Zh=33779,W0=35840,V0=35841,M0=35842,N0=35843,g1=36196,H0=37492,X0=37496,Y0=37808,F0=37809,K0=37810,z0=37811,L0=37812,T0=37813,E0=37814,k0=37815,D0=37816,U0=37817,P0=37818,_0=37819,J0=37820,O0=37821,wh=36492,c1=36283,Q0=36284,j0=36285,q0=36286,I1=2200,u1=2201,C1=2202,gu=2300,cu=2301,Sh=2302,Qa=2400,ja=2401,Iu=2402,VA=2500,Rv=2501,R3=0,W3=1,V3=2,Vu=3e3,Ys=3001,Yn=3200,Xr=3201,fo=0,d1=1,co="",mt="srgb",ur="srgb-linear",Wv="display-p3",M3=0,xh=7680,N3=7681,H3=7682,X3=7683,Y3=34055,F3=34056,K3=5386,z3=512,L3=513,T3=514,E3=515,k3=516,D3=517,U3=518,h1=519,uu=35044,A1=35048,P3=35040,_3=35045,J3=35049,O3=35041,Q3=35046,j3=35050,q3=35042,$3="100",rA="300 es",oA=1035;class zs{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(t)===-1&&i[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const i=this._listeners;return i[e]!==void 0&&i[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const s=this._listeners[e];if(s!==void 0){const r=s.indexOf(t);r!==-1&&s.splice(r,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const i=this._listeners[e.type];if(i!==void 0){e.target=this;const s=i.slice(0);for(let r=0,o=s.length;r>8&255]+Ai[n>>16&255]+Ai[n>>24&255]+"-"+Ai[e&255]+Ai[e>>8&255]+"-"+Ai[e>>16&15|64]+Ai[e>>24&255]+"-"+Ai[t&63|128]+Ai[t>>8&255]+"-"+Ai[t>>16&255]+Ai[t>>24&255]+Ai[i&255]+Ai[i>>8&255]+Ai[i>>16&255]+Ai[i>>24&255]).toLowerCase()}function Gn(n,e,t){return Math.max(e,Math.min(t,n))}function Vv(n,e){return(n%e+e)%e}function eH(n,e,t,i,s){return i+(n-e)*(s-i)/(t-e)}function tH(n,e,t){return n!==e?(t-n)/(e-n):0}function NI(n,e,t){return(1-t)*n+t*e}function nH(n,e,t,i){return NI(n,e,1-Math.exp(-t*i))}function iH(n,e=1){return e-Math.abs(Vv(n,e*2)-e)}function sH(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*(3-2*n))}function rH(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*n*(n*(n*6-15)+10))}function oH(n,e){return n+Math.floor(Math.random()*(e-n+1))}function aH(n,e){return n+Math.random()*(e-n)}function lH(n){return n*(.5-Math.random())}function gH(n){n!==void 0&&(c2=n);let e=c2+=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 cH(n){return n*rl}function IH(n){return n*qg}function $0(n){return(n&n-1)===0&&n!==0}function p1(n){return Math.pow(2,Math.ceil(Math.log(n)/Math.LN2))}function m1(n){return Math.pow(2,Math.floor(Math.log(n)/Math.LN2))}function uH(n,e,t,i,s){const r=Math.cos,o=Math.sin,a=r(t/2),l=o(t/2),c=r((e+i)/2),u=o((e+i)/2),C=r((e-i)/2),d=o((e-i)/2),h=r((i-e)/2),m=o((i-e)/2);switch(s){case"XYX":n.set(a*u,l*C,l*d,a*c);break;case"YZY":n.set(l*d,a*u,l*C,a*c);break;case"ZXZ":n.set(l*C,l*d,a*u,a*c);break;case"XZX":n.set(a*u,l*m,l*h,a*c);break;case"YXY":n.set(l*h,a*u,l*m,a*c);break;case"ZYZ":n.set(l*m,l*h,a*u,a*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+s)}}function cs(n,e){switch(e.constructor){case Float32Array:return n;case Uint16Array:return n/65535;case Uint8Array:return n/255;case Int16Array:return Math.max(n/32767,-1);case Int8Array:return Math.max(n/127,-1);default:throw new Error("Invalid component type.")}}function vt(n,e){switch(e.constructor){case Float32Array:return n;case Uint16Array:return Math.round(n*65535);case Uint8Array:return Math.round(n*255);case Int16Array:return Math.round(n*32767);case Int8Array:return Math.round(n*127);default:throw new Error("Invalid component type.")}}const f1={DEG2RAD:rl,RAD2DEG:qg,generateUUID:Cs,clamp:Gn,euclideanModulo:Vv,mapLinear:eH,inverseLerp:tH,lerp:NI,damp:nH,pingpong:iH,smoothstep:sH,smootherstep:rH,randInt:oH,randFloat:aH,randFloatSpread:lH,seededRandom:gH,degToRad:cH,radToDeg:IH,isPowerOfTwo:$0,ceilPowerOfTwo:p1,floorPowerOfTwo:m1,setQuaternionFromProperEuler:uH,normalize:vt,denormalize:cs};class ne{constructor(e=0,t=0){ne.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,i=this.y,s=e.elements;return this.x=s[0]*t+s[3]*i+s[6],this.y=s[1]*t+s[4]*i+s[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 i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const i=this.dot(e)/t;return Math.acos(Gn(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y;return t*t+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const i=Math.cos(t),s=Math.sin(t),r=this.x-e.x,o=this.y-e.y;return this.x=r*i-o*s+e.x,this.y=r*s+o*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class xt{constructor(){xt.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1]}set(e,t,i,s,r,o,a,l,c){const u=this.elements;return u[0]=e,u[1]=s,u[2]=a,u[3]=t,u[4]=r,u[5]=l,u[6]=i,u[7]=o,u[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],this}extractBasis(e,t,i){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(e){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 i=e.elements,s=t.elements,r=this.elements,o=i[0],a=i[3],l=i[6],c=i[1],u=i[4],C=i[7],d=i[2],h=i[5],m=i[8],v=s[0],y=s[3],A=s[6],b=s[1],f=s[4],B=s[7],S=s[2],x=s[5],R=s[8];return r[0]=o*v+a*b+l*S,r[3]=o*y+a*f+l*x,r[6]=o*A+a*B+l*R,r[1]=c*v+u*b+C*S,r[4]=c*y+u*f+C*x,r[7]=c*A+u*B+C*R,r[2]=d*v+h*b+m*S,r[5]=d*y+h*f+m*x,r[8]=d*A+h*B+m*R,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],i=e[1],s=e[2],r=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8];return t*o*u-t*a*c-i*r*u+i*a*l+s*r*c-s*o*l}invert(){const e=this.elements,t=e[0],i=e[1],s=e[2],r=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],C=u*o-a*c,d=a*l-u*r,h=c*r-o*l,m=t*C+i*d+s*h;if(m===0)return this.set(0,0,0,0,0,0,0,0,0);const v=1/m;return e[0]=C*v,e[1]=(s*c-u*i)*v,e[2]=(a*i-s*o)*v,e[3]=d*v,e[4]=(u*t-s*l)*v,e[5]=(s*r-a*t)*v,e[6]=h*v,e[7]=(i*l-c*t)*v,e[8]=(o*t-i*r)*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,i,s,r,o,a){const l=Math.cos(r),c=Math.sin(r);return this.set(i*l,i*c,-i*(l*o+c*a)+o+e,-s*c,s*l,-s*(-c*o+l*a)+a+t,0,0,1),this}scale(e,t){return this.premultiply(Mm.makeScale(e,t)),this}rotate(e){return this.premultiply(Mm.makeRotation(-e)),this}translate(e,t){return this.premultiply(Mm.makeTranslation(e,t)),this}makeTranslation(e,t){return this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,i,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,i=e.elements;for(let s=0;s<9;s++)if(t[s]!==i[s])return!1;return!0}fromArray(e,t=0){for(let i=0;i<9;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const Mm=new xt;function b1(n){for(let e=n.length-1;e>=0;--e)if(n[e]>=65535)return!0;return!1}const CH={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function Sg(n,e){return new CH[n](e)}function Cu(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}const I2={};function HI(n){n in I2||(I2[n]=!0,console.warn(n))}function Lg(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function Nm(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}const dH=new xt().fromArray([.8224621,.0331941,.0170827,.177538,.9668058,.0723974,-1e-7,1e-7,.9105199]),hH=new xt().fromArray([1.2249401,-.0420569,-.0196376,-.2249404,1.0420571,-.0786361,1e-7,0,1.0982735]);function AH(n){return n.convertSRGBToLinear().applyMatrix3(hH)}function pH(n){return n.applyMatrix3(dH).convertLinearToSRGB()}const mH={[ur]:n=>n,[mt]:n=>n.convertSRGBToLinear(),[Wv]:AH},fH={[ur]:n=>n,[mt]:n=>n.convertLinearToSRGB(),[Wv]:pH},Ws={enabled:!0,get legacyMode(){return console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),!this.enabled},set legacyMode(n){console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),this.enabled=!n},get workingColorSpace(){return ur},set workingColorSpace(n){console.warn("THREE.ColorManagement: .workingColorSpace is readonly.")},convert:function(n,e,t){if(this.enabled===!1||e===t||!e||!t)return n;const i=mH[e],s=fH[t];if(i===void 0||s===void 0)throw new Error(`Unsupported color space conversion, "${e}" to "${t}".`);return s(i(n))},fromWorkingColorSpace:function(n,e){return this.convert(n,this.workingColorSpace,e)},toWorkingColorSpace:function(n,e){return this.convert(n,e,this.workingColorSpace)}};let El;class Mv{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{El===void 0&&(El=Cu("canvas")),El.width=e.width,El.height=e.height;const i=El.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),t=El}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=Cu("canvas");t.width=e.width,t.height=e.height;const i=t.getContext("2d");i.drawImage(e,0,0,e.width,e.height);const s=i.getImageData(0,0,e.width,e.height),r=s.data;for(let o=0;o0&&(i.userData=this.userData),t||(e.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==RA)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case hs:e.x=e.x-Math.floor(e.x);break;case zn:e.x=e.x<0?0:1;break;case lu: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 hs:e.y=e.y-Math.floor(e.y);break;case zn:e.y=e.y<0?0:1;break;case lu: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)}get encoding(){return HI("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace===mt?Ys:Vu}set encoding(e){HI("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=e===Ys?mt:co}}qt.DEFAULT_IMAGE=null;qt.DEFAULT_MAPPING=RA;qt.DEFAULT_ANISOTROPY=1;class Vt{constructor(e=0,t=0,i=0,s=1){Vt.prototype.isVector4=!0,this.x=e,this.y=t,this.z=i,this.w=s}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,i,s){return this.x=e,this.y=t,this.z=i,this.w=s,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,i=this.y,s=this.z,r=this.w,o=e.elements;return this.x=o[0]*t+o[4]*i+o[8]*s+o[12]*r,this.y=o[1]*t+o[5]*i+o[9]*s+o[13]*r,this.z=o[2]*t+o[6]*i+o[10]*s+o[14]*r,this.w=o[3]*t+o[7]*i+o[11]*s+o[15]*r,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,i,s,r;const l=e.elements,c=l[0],u=l[4],C=l[8],d=l[1],h=l[5],m=l[9],v=l[2],y=l[6],A=l[10];if(Math.abs(u-d)<.01&&Math.abs(C-v)<.01&&Math.abs(m-y)<.01){if(Math.abs(u+d)<.1&&Math.abs(C+v)<.1&&Math.abs(m+y)<.1&&Math.abs(c+h+A-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const f=(c+1)/2,B=(h+1)/2,S=(A+1)/2,x=(u+d)/4,R=(C+v)/4,M=(m+y)/4;return f>B&&f>S?f<.01?(i=0,s=.707106781,r=.707106781):(i=Math.sqrt(f),s=x/i,r=R/i):B>S?B<.01?(i=.707106781,s=0,r=.707106781):(s=Math.sqrt(B),i=x/s,r=M/s):S<.01?(i=.707106781,s=.707106781,r=0):(r=Math.sqrt(S),i=R/r,s=M/r),this.set(i,s,r,t),this}let b=Math.sqrt((y-m)*(y-m)+(C-v)*(C-v)+(d-u)*(d-u));return Math.abs(b)<.001&&(b=1),this.x=(y-m)/b,this.y=(C-v)/b,this.z=(d-u)/b,this.w=Math.acos((c+h+A-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 i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this.w=e.w+(t.w-e.w)*i,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class Rt extends zs{constructor(e=1,t=1,i={}){super(),this.isWebGLRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new Vt(0,0,e,t),this.scissorTest=!1,this.viewport=new Vt(0,0,e,t);const s={width:e,height:t,depth:1};i.encoding!==void 0&&(HI("THREE.WebGLRenderTarget: option.encoding has been replaced by option.colorSpace."),i.colorSpace=i.encoding===Ys?mt:co),this.texture=new qt(s,i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.flipY=!1,this.texture.generateMipmaps=i.generateMipmaps!==void 0?i.generateMipmaps:!1,this.texture.internalFormat=i.internalFormat!==void 0?i.internalFormat:null,this.texture.minFilter=i.minFilter!==void 0?i.minFilter:je,this.depthBuffer=i.depthBuffer!==void 0?i.depthBuffer:!0,this.stencilBuffer=i.stencilBuffer!==void 0?i.stencilBuffer:!1,this.depthTexture=i.depthTexture!==void 0?i.depthTexture:null,this.samples=i.samples!==void 0?i.samples:0}setSize(e,t,i=1){(this.width!==e||this.height!==t||this.depth!==i)&&(this.width=e,this.height=t,this.depth=i,this.texture.image.width=e,this.texture.image.height=t,this.texture.image.depth=i,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.texture.isRenderTargetTexture=!0;const t=Object.assign({},e.texture.image);return this.texture.source=new qa(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 MA extends qt{constructor(e=null,t=1,i=1,s=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:i,depth:s},this.magFilter=pt,this.minFilter=pt,this.wrapR=zn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class vH extends Rt{constructor(e=1,t=1,i=1){super(e,t),this.isWebGLArrayRenderTarget=!0,this.depth=i,this.texture=new MA(null,e,t,i),this.texture.isRenderTargetTexture=!0}}class ol extends qt{constructor(e=null,t=1,i=1,s=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:i,depth:s},this.magFilter=pt,this.minFilter=pt,this.wrapR=zn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class yH extends Rt{constructor(e=1,t=1,i=1){super(e,t),this.isWebGL3DRenderTarget=!0,this.depth=i,this.texture=new ol(null,e,t,i),this.texture.isRenderTargetTexture=!0}}class v1 extends Rt{constructor(e=1,t=1,i=1,s={}){super(e,t,s),this.isWebGLMultipleRenderTargets=!0;const r=this.texture;this.texture=[];for(let o=0;o=0?1:-1,f=1-A*A;if(f>Number.EPSILON){const S=Math.sqrt(f),x=Math.atan2(S,A*b);y=Math.sin(y*x)/S,a=Math.sin(a*x)/S}const B=a*b;if(l=l*y+d*B,c=c*y+h*B,u=u*y+m*B,C=C*y+v*B,y===1-a){const S=1/Math.sqrt(l*l+c*c+u*u+C*C);l*=S,c*=S,u*=S,C*=S}}e[t]=l,e[t+1]=c,e[t+2]=u,e[t+3]=C}static multiplyQuaternionsFlat(e,t,i,s,r,o){const a=i[s],l=i[s+1],c=i[s+2],u=i[s+3],C=r[o],d=r[o+1],h=r[o+2],m=r[o+3];return e[t]=a*m+u*C+l*h-c*d,e[t+1]=l*m+u*d+c*C-a*h,e[t+2]=c*m+u*h+a*d-l*C,e[t+3]=u*m-a*C-l*d-c*h,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,i,s){return this._x=e,this._y=t,this._z=i,this._w=s,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){const i=e._x,s=e._y,r=e._z,o=e._order,a=Math.cos,l=Math.sin,c=a(i/2),u=a(s/2),C=a(r/2),d=l(i/2),h=l(s/2),m=l(r/2);switch(o){case"XYZ":this._x=d*u*C+c*h*m,this._y=c*h*C-d*u*m,this._z=c*u*m+d*h*C,this._w=c*u*C-d*h*m;break;case"YXZ":this._x=d*u*C+c*h*m,this._y=c*h*C-d*u*m,this._z=c*u*m-d*h*C,this._w=c*u*C+d*h*m;break;case"ZXY":this._x=d*u*C-c*h*m,this._y=c*h*C+d*u*m,this._z=c*u*m+d*h*C,this._w=c*u*C-d*h*m;break;case"ZYX":this._x=d*u*C-c*h*m,this._y=c*h*C+d*u*m,this._z=c*u*m-d*h*C,this._w=c*u*C+d*h*m;break;case"YZX":this._x=d*u*C+c*h*m,this._y=c*h*C+d*u*m,this._z=c*u*m-d*h*C,this._w=c*u*C-d*h*m;break;case"XZY":this._x=d*u*C-c*h*m,this._y=c*h*C-d*u*m,this._z=c*u*m+d*h*C,this._w=c*u*C+d*h*m;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t!==!1&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const i=t/2,s=Math.sin(i);return this._x=e.x*s,this._y=e.y*s,this._z=e.z*s,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,i=t[0],s=t[4],r=t[8],o=t[1],a=t[5],l=t[9],c=t[2],u=t[6],C=t[10],d=i+a+C;if(d>0){const h=.5/Math.sqrt(d+1);this._w=.25/h,this._x=(u-l)*h,this._y=(r-c)*h,this._z=(o-s)*h}else if(i>a&&i>C){const h=2*Math.sqrt(1+i-a-C);this._w=(u-l)/h,this._x=.25*h,this._y=(s+o)/h,this._z=(r+c)/h}else if(a>C){const h=2*Math.sqrt(1+a-i-C);this._w=(r-c)/h,this._x=(s+o)/h,this._y=.25*h,this._z=(l+u)/h}else{const h=2*Math.sqrt(1+C-i-a);this._w=(o-s)/h,this._x=(r+c)/h,this._y=(l+u)/h,this._z=.25*h}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let i=e.dot(t)+1;return iMath.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=i):(this._x=0,this._y=-e.z,this._z=e.y,this._w=i)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=i),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Gn(this.dot(e),-1,1)))}rotateTowards(e,t){const i=this.angleTo(e);if(i===0)return this;const s=Math.min(1,t/i);return this.slerp(e,s),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 i=e._x,s=e._y,r=e._z,o=e._w,a=t._x,l=t._y,c=t._z,u=t._w;return this._x=i*u+o*a+s*c-r*l,this._y=s*u+o*l+r*a-i*c,this._z=r*u+o*c+i*l-s*a,this._w=o*u-i*a-s*l-r*c,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const i=this._x,s=this._y,r=this._z,o=this._w;let a=o*e._w+i*e._x+s*e._y+r*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=o,this._x=i,this._y=s,this._z=r,this;const l=1-a*a;if(l<=Number.EPSILON){const h=1-t;return this._w=h*o+t*this._w,this._x=h*i+t*this._x,this._y=h*s+t*this._y,this._z=h*r+t*this._z,this.normalize(),this._onChangeCallback(),this}const c=Math.sqrt(l),u=Math.atan2(c,a),C=Math.sin((1-t)*u)/c,d=Math.sin(t*u)/c;return this._w=o*C+this._w*d,this._x=i*C+this._x*d,this._y=s*C+this._y*d,this._z=r*C+this._z*d,this._onChangeCallback(),this}slerpQuaternions(e,t,i){return this.copy(e).slerp(t,i)}random(){const e=Math.random(),t=Math.sqrt(1-e),i=Math.sqrt(e),s=2*Math.PI*Math.random(),r=2*Math.PI*Math.random();return this.set(t*Math.cos(s),i*Math.sin(r),i*Math.cos(r),t*Math.sin(s))}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}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 H{constructor(e=0,t=0,i=0){H.prototype.isVector3=!0,this.x=e,this.y=t,this.z=i}set(e,t,i){return i===void 0&&(i=this.z),this.x=e,this.y=t,this.z=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(u2.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(u2.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,i=this.y,s=this.z,r=e.elements;return this.x=r[0]*t+r[3]*i+r[6]*s,this.y=r[1]*t+r[4]*i+r[7]*s,this.z=r[2]*t+r[5]*i+r[8]*s,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,i=this.y,s=this.z,r=e.elements,o=1/(r[3]*t+r[7]*i+r[11]*s+r[15]);return this.x=(r[0]*t+r[4]*i+r[8]*s+r[12])*o,this.y=(r[1]*t+r[5]*i+r[9]*s+r[13])*o,this.z=(r[2]*t+r[6]*i+r[10]*s+r[14])*o,this}applyQuaternion(e){const t=this.x,i=this.y,s=this.z,r=e.x,o=e.y,a=e.z,l=e.w,c=l*t+o*s-a*i,u=l*i+a*t-r*s,C=l*s+r*i-o*t,d=-r*t-o*i-a*s;return this.x=c*l+d*-r+u*-a-C*-o,this.y=u*l+d*-o+C*-r-c*-a,this.z=C*l+d*-a+c*-o-u*-r,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,i=this.y,s=this.z,r=e.elements;return this.x=r[0]*t+r[4]*i+r[8]*s,this.y=r[1]*t+r[5]*i+r[9]*s,this.z=r[2]*t+r[6]*i+r[10]*s,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 i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const i=e.x,s=e.y,r=e.z,o=t.x,a=t.y,l=t.z;return this.x=s*l-r*a,this.y=r*o-i*l,this.z=i*a-s*o,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const i=e.dot(this)/t;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return Xm.copy(this).projectOnVector(e),this.sub(Xm)}reflect(e){return this.sub(Xm.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 i=this.dot(e)/t;return Math.acos(Gn(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y,s=this.z-e.z;return t*t+i*i+s*s}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,i){const s=Math.sin(t)*e;return this.x=s*Math.sin(i),this.y=Math.cos(t)*e,this.z=s*Math.cos(i),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,i){return this.x=e*Math.sin(t),this.y=i,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){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(),i=this.setFromMatrixColumn(e,1).length(),s=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=i,this.z=s,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()-.5)*2,t=Math.random()*Math.PI*2,i=Math.sqrt(1-e**2);return this.x=i*Math.cos(t),this.y=i*Math.sin(t),this.z=e,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const Xm=new H,u2=new xn;class Yr{constructor(e=new H(1/0,1/0,1/0),t=new H(-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,i=e.length;tthis.max.x||e.ythis.max.y||e.zthis.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.xthis.max.x||e.max.ythis.max.y||e.max.zthis.max.z)}intersectsSphere(e){return this.clampPoint(e.center,_r),_r.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,i;return e.normal.x>0?(t=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),t<=-e.constant&&i>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Pc),ld.subVectors(this.max,Pc),Dl.subVectors(e.a,Pc),Ul.subVectors(e.b,Pc),Pl.subVectors(e.c,Pc),Mo.subVectors(Ul,Dl),No.subVectors(Pl,Ul),Ra.subVectors(Dl,Pl);let t=[0,-Mo.z,Mo.y,0,-No.z,No.y,0,-Ra.z,Ra.y,Mo.z,0,-Mo.x,No.z,0,-No.x,Ra.z,0,-Ra.x,-Mo.y,Mo.x,0,-No.y,No.x,0,-Ra.y,Ra.x,0];return!Ym(t,Dl,Ul,Pl,ld)||(t=[1,0,0,0,1,0,0,0,1],!Ym(t,Dl,Ul,Pl,ld))?!1:(gd.crossVectors(Mo,No),t=[gd.x,gd.y,gd.z],Ym(t,Dl,Ul,Pl,ld))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,_r).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(_r).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:(Pr[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Pr[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Pr[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Pr[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Pr[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Pr[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Pr[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Pr[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Pr),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 Pr=[new H,new H,new H,new H,new H,new H,new H,new H],_r=new H,kl=new Yr,Dl=new H,Ul=new H,Pl=new H,Mo=new H,No=new H,Ra=new H,Pc=new H,ld=new H,gd=new H,Wa=new H;function Ym(n,e,t,i,s){for(let r=0,o=n.length-3;r<=o;r+=3){Wa.fromArray(n,r);const a=s.x*Math.abs(Wa.x)+s.y*Math.abs(Wa.y)+s.z*Math.abs(Wa.z),l=e.dot(Wa),c=t.dot(Wa),u=i.dot(Wa);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>a)return!1}return!0}const GH=new Yr,_c=new H,Fm=new H;class Fr{constructor(e=new H,t=-1){this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const i=this.center;t!==void 0?i.copy(t):GH.setFromPoints(e).getCenter(i);let s=0;for(let r=0,o=e.length;rthis.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;_c.subVectors(e,this.center);const t=_c.lengthSq();if(t>this.radius*this.radius){const i=Math.sqrt(t),s=(i-this.radius)*.5;this.center.addScaledVector(_c,s/i),this.radius+=s}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):(Fm.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(_c.copy(e.center).add(Fm)),this.expandByPoint(_c.copy(e.center).sub(Fm))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const Jr=new H,Km=new H,cd=new H,Ho=new H,zm=new H,Id=new H,Lm=new H;let Mu=class{constructor(e=new H,t=new H(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,Jr)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const i=t.dot(this.direction);return i<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=Jr.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Jr.copy(this.origin).addScaledVector(this.direction,t),Jr.distanceToSquared(e))}distanceSqToSegment(e,t,i,s){Km.copy(e).add(t).multiplyScalar(.5),cd.copy(t).sub(e).normalize(),Ho.copy(this.origin).sub(Km);const r=e.distanceTo(t)*.5,o=-this.direction.dot(cd),a=Ho.dot(this.direction),l=-Ho.dot(cd),c=Ho.lengthSq(),u=Math.abs(1-o*o);let C,d,h,m;if(u>0)if(C=o*l-a,d=o*a-l,m=r*u,C>=0)if(d>=-m)if(d<=m){const v=1/u;C*=v,d*=v,h=C*(C+o*d+2*a)+d*(o*C+d+2*l)+c}else d=r,C=Math.max(0,-(o*d+a)),h=-C*C+d*(d+2*l)+c;else d=-r,C=Math.max(0,-(o*d+a)),h=-C*C+d*(d+2*l)+c;else d<=-m?(C=Math.max(0,-(-o*r+a)),d=C>0?-r:Math.min(Math.max(-r,-l),r),h=-C*C+d*(d+2*l)+c):d<=m?(C=0,d=Math.min(Math.max(-r,-l),r),h=d*(d+2*l)+c):(C=Math.max(0,-(o*r+a)),d=C>0?r:Math.min(Math.max(-r,-l),r),h=-C*C+d*(d+2*l)+c);else d=o>0?-r:r,C=Math.max(0,-(o*d+a)),h=-C*C+d*(d+2*l)+c;return i&&i.copy(this.origin).addScaledVector(this.direction,C),s&&s.copy(Km).addScaledVector(cd,d),h}intersectSphere(e,t){Jr.subVectors(e.center,this.origin);const i=Jr.dot(this.direction),s=Jr.dot(Jr)-i*i,r=e.radius*e.radius;if(s>r)return null;const o=Math.sqrt(r-s),a=i-o,l=i+o;return l<0?null:a<0?this.at(l,t):this.at(a,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 i=-(this.origin.dot(e.normal)+e.constant)/t;return i>=0?i:null}intersectPlane(e,t){const i=this.distanceToPlane(e);return i===null?null:this.at(i,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let i,s,r,o,a,l;const c=1/this.direction.x,u=1/this.direction.y,C=1/this.direction.z,d=this.origin;return c>=0?(i=(e.min.x-d.x)*c,s=(e.max.x-d.x)*c):(i=(e.max.x-d.x)*c,s=(e.min.x-d.x)*c),u>=0?(r=(e.min.y-d.y)*u,o=(e.max.y-d.y)*u):(r=(e.max.y-d.y)*u,o=(e.min.y-d.y)*u),i>o||r>s||((r>i||isNaN(i))&&(i=r),(o=0?(a=(e.min.z-d.z)*C,l=(e.max.z-d.z)*C):(a=(e.max.z-d.z)*C,l=(e.min.z-d.z)*C),i>l||a>s)||((a>i||i!==i)&&(i=a),(l=0?i:s,t)}intersectsBox(e){return this.intersectBox(e,Jr)!==null}intersectTriangle(e,t,i,s,r){zm.subVectors(t,e),Id.subVectors(i,e),Lm.crossVectors(zm,Id);let o=this.direction.dot(Lm),a;if(o>0){if(s)return null;a=1}else if(o<0)a=-1,o=-o;else return null;Ho.subVectors(this.origin,e);const l=a*this.direction.dot(Id.crossVectors(Ho,Id));if(l<0)return null;const c=a*this.direction.dot(zm.cross(Ho));if(c<0||l+c>o)return null;const u=-a*Ho.dot(Lm);return u<0?null:this.at(u/o,r)}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 Fe{constructor(){Fe.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}set(e,t,i,s,r,o,a,l,c,u,C,d,h,m,v,y){const A=this.elements;return A[0]=e,A[4]=t,A[8]=i,A[12]=s,A[1]=r,A[5]=o,A[9]=a,A[13]=l,A[2]=c,A[6]=u,A[10]=C,A[14]=d,A[3]=h,A[7]=m,A[11]=v,A[15]=y,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 Fe().fromArray(this.elements)}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],this}copyPosition(e){const t=this.elements,i=e.elements;return t[12]=i[12],t[13]=i[13],t[14]=i[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,i){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(e,t,i){return this.set(e.x,t.x,i.x,0,e.y,t.y,i.y,0,e.z,t.z,i.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,i=e.elements,s=1/_l.setFromMatrixColumn(e,0).length(),r=1/_l.setFromMatrixColumn(e,1).length(),o=1/_l.setFromMatrixColumn(e,2).length();return t[0]=i[0]*s,t[1]=i[1]*s,t[2]=i[2]*s,t[3]=0,t[4]=i[4]*r,t[5]=i[5]*r,t[6]=i[6]*r,t[7]=0,t[8]=i[8]*o,t[9]=i[9]*o,t[10]=i[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,i=e.x,s=e.y,r=e.z,o=Math.cos(i),a=Math.sin(i),l=Math.cos(s),c=Math.sin(s),u=Math.cos(r),C=Math.sin(r);if(e.order==="XYZ"){const d=o*u,h=o*C,m=a*u,v=a*C;t[0]=l*u,t[4]=-l*C,t[8]=c,t[1]=h+m*c,t[5]=d-v*c,t[9]=-a*l,t[2]=v-d*c,t[6]=m+h*c,t[10]=o*l}else if(e.order==="YXZ"){const d=l*u,h=l*C,m=c*u,v=c*C;t[0]=d+v*a,t[4]=m*a-h,t[8]=o*c,t[1]=o*C,t[5]=o*u,t[9]=-a,t[2]=h*a-m,t[6]=v+d*a,t[10]=o*l}else if(e.order==="ZXY"){const d=l*u,h=l*C,m=c*u,v=c*C;t[0]=d-v*a,t[4]=-o*C,t[8]=m+h*a,t[1]=h+m*a,t[5]=o*u,t[9]=v-d*a,t[2]=-o*c,t[6]=a,t[10]=o*l}else if(e.order==="ZYX"){const d=o*u,h=o*C,m=a*u,v=a*C;t[0]=l*u,t[4]=m*c-h,t[8]=d*c+v,t[1]=l*C,t[5]=v*c+d,t[9]=h*c-m,t[2]=-c,t[6]=a*l,t[10]=o*l}else if(e.order==="YZX"){const d=o*l,h=o*c,m=a*l,v=a*c;t[0]=l*u,t[4]=v-d*C,t[8]=m*C+h,t[1]=C,t[5]=o*u,t[9]=-a*u,t[2]=-c*u,t[6]=h*C+m,t[10]=d-v*C}else if(e.order==="XZY"){const d=o*l,h=o*c,m=a*l,v=a*c;t[0]=l*u,t[4]=-C,t[8]=c*u,t[1]=d*C+v,t[5]=o*u,t[9]=h*C-m,t[2]=m*C-h,t[6]=a*u,t[10]=v*C+d}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(BH,e,ZH)}lookAt(e,t,i){const s=this.elements;return rs.subVectors(e,t),rs.lengthSq()===0&&(rs.z=1),rs.normalize(),Xo.crossVectors(i,rs),Xo.lengthSq()===0&&(Math.abs(i.z)===1?rs.x+=1e-4:rs.z+=1e-4,rs.normalize(),Xo.crossVectors(i,rs)),Xo.normalize(),ud.crossVectors(rs,Xo),s[0]=Xo.x,s[4]=ud.x,s[8]=rs.x,s[1]=Xo.y,s[5]=ud.y,s[9]=rs.y,s[2]=Xo.z,s[6]=ud.z,s[10]=rs.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,s=t.elements,r=this.elements,o=i[0],a=i[4],l=i[8],c=i[12],u=i[1],C=i[5],d=i[9],h=i[13],m=i[2],v=i[6],y=i[10],A=i[14],b=i[3],f=i[7],B=i[11],S=i[15],x=s[0],R=s[4],M=s[8],Z=s[12],V=s[1],N=s[5],D=s[9],k=s[13],$=s[2],te=s[6],Ce=s[10],le=s[14],L=s[3],J=s[7],P=s[11],ce=s[15];return r[0]=o*x+a*V+l*$+c*L,r[4]=o*R+a*N+l*te+c*J,r[8]=o*M+a*D+l*Ce+c*P,r[12]=o*Z+a*k+l*le+c*ce,r[1]=u*x+C*V+d*$+h*L,r[5]=u*R+C*N+d*te+h*J,r[9]=u*M+C*D+d*Ce+h*P,r[13]=u*Z+C*k+d*le+h*ce,r[2]=m*x+v*V+y*$+A*L,r[6]=m*R+v*N+y*te+A*J,r[10]=m*M+v*D+y*Ce+A*P,r[14]=m*Z+v*k+y*le+A*ce,r[3]=b*x+f*V+B*$+S*L,r[7]=b*R+f*N+B*te+S*J,r[11]=b*M+f*D+B*Ce+S*P,r[15]=b*Z+f*k+B*le+S*ce,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],i=e[4],s=e[8],r=e[12],o=e[1],a=e[5],l=e[9],c=e[13],u=e[2],C=e[6],d=e[10],h=e[14],m=e[3],v=e[7],y=e[11],A=e[15];return m*(+r*l*C-s*c*C-r*a*d+i*c*d+s*a*h-i*l*h)+v*(+t*l*h-t*c*d+r*o*d-s*o*h+s*c*u-r*l*u)+y*(+t*c*C-t*a*h-r*o*C+i*o*h+r*a*u-i*c*u)+A*(-s*a*u-t*l*C+t*a*d+s*o*C-i*o*d+i*l*u)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,i){const s=this.elements;return e.isVector3?(s[12]=e.x,s[13]=e.y,s[14]=e.z):(s[12]=e,s[13]=t,s[14]=i),this}invert(){const e=this.elements,t=e[0],i=e[1],s=e[2],r=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],C=e[9],d=e[10],h=e[11],m=e[12],v=e[13],y=e[14],A=e[15],b=C*y*c-v*d*c+v*l*h-a*y*h-C*l*A+a*d*A,f=m*d*c-u*y*c-m*l*h+o*y*h+u*l*A-o*d*A,B=u*v*c-m*C*c+m*a*h-o*v*h-u*a*A+o*C*A,S=m*C*l-u*v*l-m*a*d+o*v*d+u*a*y-o*C*y,x=t*b+i*f+s*B+r*S;if(x===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const R=1/x;return e[0]=b*R,e[1]=(v*d*r-C*y*r-v*s*h+i*y*h+C*s*A-i*d*A)*R,e[2]=(a*y*r-v*l*r+v*s*c-i*y*c-a*s*A+i*l*A)*R,e[3]=(C*l*r-a*d*r-C*s*c+i*d*c+a*s*h-i*l*h)*R,e[4]=f*R,e[5]=(u*y*r-m*d*r+m*s*h-t*y*h-u*s*A+t*d*A)*R,e[6]=(m*l*r-o*y*r-m*s*c+t*y*c+o*s*A-t*l*A)*R,e[7]=(o*d*r-u*l*r+u*s*c-t*d*c-o*s*h+t*l*h)*R,e[8]=B*R,e[9]=(m*C*r-u*v*r-m*i*h+t*v*h+u*i*A-t*C*A)*R,e[10]=(o*v*r-m*a*r+m*i*c-t*v*c-o*i*A+t*a*A)*R,e[11]=(u*a*r-o*C*r-u*i*c+t*C*c+o*i*h-t*a*h)*R,e[12]=S*R,e[13]=(u*v*s-m*C*s+m*i*d-t*v*d-u*i*y+t*C*y)*R,e[14]=(m*a*s-o*v*s-m*i*l+t*v*l+o*i*y-t*a*y)*R,e[15]=(o*C*s-u*a*s+u*i*l-t*C*l-o*i*d+t*a*d)*R,this}scale(e){const t=this.elements,i=e.x,s=e.y,r=e.z;return t[0]*=i,t[4]*=s,t[8]*=r,t[1]*=i,t[5]*=s,t[9]*=r,t[2]*=i,t[6]*=s,t[10]*=r,t[3]*=i,t[7]*=s,t[11]*=r,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],s=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,i,s))}makeTranslation(e,t,i){return this.set(1,0,0,e,0,1,0,t,0,0,1,i,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,t,-i,0,0,i,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,0,i,0,0,1,0,0,-i,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,0,i,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const i=Math.cos(t),s=Math.sin(t),r=1-i,o=e.x,a=e.y,l=e.z,c=r*o,u=r*a;return this.set(c*o+i,c*a-s*l,c*l+s*a,0,c*a+s*l,u*a+i,u*l-s*o,0,c*l-s*a,u*l+s*o,r*l*l+i,0,0,0,0,1),this}makeScale(e,t,i){return this.set(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1),this}makeShear(e,t,i,s,r,o){return this.set(1,i,r,0,e,1,o,0,t,s,1,0,0,0,0,1),this}compose(e,t,i){const s=this.elements,r=t._x,o=t._y,a=t._z,l=t._w,c=r+r,u=o+o,C=a+a,d=r*c,h=r*u,m=r*C,v=o*u,y=o*C,A=a*C,b=l*c,f=l*u,B=l*C,S=i.x,x=i.y,R=i.z;return s[0]=(1-(v+A))*S,s[1]=(h+B)*S,s[2]=(m-f)*S,s[3]=0,s[4]=(h-B)*x,s[5]=(1-(d+A))*x,s[6]=(y+b)*x,s[7]=0,s[8]=(m+f)*R,s[9]=(y-b)*R,s[10]=(1-(d+v))*R,s[11]=0,s[12]=e.x,s[13]=e.y,s[14]=e.z,s[15]=1,this}decompose(e,t,i){const s=this.elements;let r=_l.set(s[0],s[1],s[2]).length();const o=_l.set(s[4],s[5],s[6]).length(),a=_l.set(s[8],s[9],s[10]).length();this.determinant()<0&&(r=-r),e.x=s[12],e.y=s[13],e.z=s[14],Qs.copy(this);const c=1/r,u=1/o,C=1/a;return Qs.elements[0]*=c,Qs.elements[1]*=c,Qs.elements[2]*=c,Qs.elements[4]*=u,Qs.elements[5]*=u,Qs.elements[6]*=u,Qs.elements[8]*=C,Qs.elements[9]*=C,Qs.elements[10]*=C,t.setFromRotationMatrix(Qs),i.x=r,i.y=o,i.z=a,this}makePerspective(e,t,i,s,r,o){const a=this.elements,l=2*r/(t-e),c=2*r/(i-s),u=(t+e)/(t-e),C=(i+s)/(i-s),d=-(o+r)/(o-r),h=-2*o*r/(o-r);return a[0]=l,a[4]=0,a[8]=u,a[12]=0,a[1]=0,a[5]=c,a[9]=C,a[13]=0,a[2]=0,a[6]=0,a[10]=d,a[14]=h,a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this}makeOrthographic(e,t,i,s,r,o){const a=this.elements,l=1/(t-e),c=1/(i-s),u=1/(o-r),C=(t+e)*l,d=(i+s)*c,h=(o+r)*u;return a[0]=2*l,a[4]=0,a[8]=0,a[12]=-C,a[1]=0,a[5]=2*c,a[9]=0,a[13]=-d,a[2]=0,a[6]=0,a[10]=-2*u,a[14]=-h,a[3]=0,a[7]=0,a[11]=0,a[15]=1,this}equals(e){const t=this.elements,i=e.elements;for(let s=0;s<16;s++)if(t[s]!==i[s])return!1;return!0}fromArray(e,t=0){for(let i=0;i<16;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e[t+9]=i[9],e[t+10]=i[10],e[t+11]=i[11],e[t+12]=i[12],e[t+13]=i[13],e[t+14]=i[14],e[t+15]=i[15],e}}const _l=new H,Qs=new Fe,BH=new H(0,0,0),ZH=new H(1,1,1),Xo=new H,ud=new H,rs=new H,C2=new Fe,d2=new xn;class bl{constructor(e=0,t=0,i=0,s=bl.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=i,this._order=s}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,i,s=this._order){return this._x=e,this._y=t,this._z=i,this._order=s,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,i=!0){const s=e.elements,r=s[0],o=s[4],a=s[8],l=s[1],c=s[5],u=s[9],C=s[2],d=s[6],h=s[10];switch(t){case"XYZ":this._y=Math.asin(Gn(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-u,h),this._z=Math.atan2(-o,r)):(this._x=Math.atan2(d,c),this._z=0);break;case"YXZ":this._x=Math.asin(-Gn(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(a,h),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-C,r),this._z=0);break;case"ZXY":this._x=Math.asin(Gn(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-C,h),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,r));break;case"ZYX":this._y=Math.asin(-Gn(C,-1,1)),Math.abs(C)<.9999999?(this._x=Math.atan2(d,h),this._z=Math.atan2(l,r)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin(Gn(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-C,r)):(this._x=0,this._y=Math.atan2(a,h));break;case"XZY":this._z=Math.asin(-Gn(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(d,c),this._y=Math.atan2(a,r)):(this._x=Math.atan2(-u,h),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,i===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,i){return C2.makeRotationFromQuaternion(e),this.setFromRotationMatrix(C2,t,i)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return d2.setFromEuler(this),this.setFromQuaternion(d2,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}}bl.DEFAULT_ORDER="XYZ";class al{constructor(){this.mask=1}set(e){this.mask=(1<>>0}enable(e){this.mask|=1<1){for(let t=0;t1){for(let i=0;i0&&(i=i.concat(o))}return i}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Jc,e,SH),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Jc,xH,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 i=0,s=t.length;i0&&(s.userData=this.userData),s.layers=this.layers.mask,s.matrix=this.matrix.toArray(),s.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(s.matrixAutoUpdate=!1),this.isInstancedMesh&&(s.type="InstancedMesh",s.count=this.count,s.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(s.instanceColor=this.instanceColor.toJSON()));function r(a,l){return a[l.uuid]===void 0&&(a[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?s.background=this.background.toJSON():this.background.isTexture&&(s.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(s.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){s.geometry=r(e.geometries,this.geometry);const a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){const l=a.shapes;if(Array.isArray(l))for(let c=0,u=l.length;c0){s.children=[];for(let a=0;a0){s.animations=[];for(let a=0;a0&&(i.geometries=a),l.length>0&&(i.materials=l),c.length>0&&(i.textures=c),u.length>0&&(i.images=u),C.length>0&&(i.shapes=C),d.length>0&&(i.skeletons=d),h.length>0&&(i.animations=h),m.length>0&&(i.nodes=m)}return i.object=s,i;function o(a){const l=[];for(const c in a){const u=a[c];delete u.metadata,l.push(u)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations,this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let i=0;i0?s.multiplyScalar(1/Math.sqrt(r)):s.set(0,0,0)}static getBarycoord(e,t,i,s,r){js.subVectors(s,t),Qr.subVectors(i,t),Tm.subVectors(e,t);const o=js.dot(js),a=js.dot(Qr),l=js.dot(Tm),c=Qr.dot(Qr),u=Qr.dot(Tm),C=o*c-a*a;if(C===0)return r.set(-2,-1,-1);const d=1/C,h=(c*l-a*u)*d,m=(o*u-a*l)*d;return r.set(1-h-m,m,h)}static containsPoint(e,t,i,s){return this.getBarycoord(e,t,i,s,jr),jr.x>=0&&jr.y>=0&&jr.x+jr.y<=1}static getUV(e,t,i,s,r,o,a,l){return dd===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),dd=!0),this.getInterpolation(e,t,i,s,r,o,a,l)}static getInterpolation(e,t,i,s,r,o,a,l){return this.getBarycoord(e,t,i,s,jr),l.setScalar(0),l.addScaledVector(r,jr.x),l.addScaledVector(o,jr.y),l.addScaledVector(a,jr.z),l}static isFrontFacing(e,t,i,s){return js.subVectors(i,t),Qr.subVectors(e,t),js.cross(Qr).dot(s)<0}set(e,t,i){return this.a.copy(e),this.b.copy(t),this.c.copy(i),this}setFromPointsAndIndices(e,t,i,s){return this.a.copy(e[t]),this.b.copy(e[i]),this.c.copy(e[s]),this}setFromAttributeAndIndices(e,t,i,s){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,i),this.c.fromBufferAttribute(e,s),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 js.subVectors(this.c,this.b),Qr.subVectors(this.a,this.b),js.cross(Qr).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Ui.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Ui.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,i,s,r){return dd===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),dd=!0),Ui.getInterpolation(e,this.a,this.b,this.c,t,i,s,r)}getInterpolation(e,t,i,s,r){return Ui.getInterpolation(e,this.a,this.b,this.c,t,i,s,r)}containsPoint(e){return Ui.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Ui.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const i=this.a,s=this.b,r=this.c;let o,a;Ol.subVectors(s,i),Ql.subVectors(r,i),Em.subVectors(e,i);const l=Ol.dot(Em),c=Ql.dot(Em);if(l<=0&&c<=0)return t.copy(i);km.subVectors(e,s);const u=Ol.dot(km),C=Ql.dot(km);if(u>=0&&C<=u)return t.copy(s);const d=l*C-u*c;if(d<=0&&l>=0&&u<=0)return o=l/(l-u),t.copy(i).addScaledVector(Ol,o);Dm.subVectors(e,r);const h=Ol.dot(Dm),m=Ql.dot(Dm);if(m>=0&&h<=m)return t.copy(r);const v=h*c-l*m;if(v<=0&&c>=0&&m<=0)return a=c/(c-m),t.copy(i).addScaledVector(Ql,a);const y=u*m-h*C;if(y<=0&&C-u>=0&&h-m>=0)return b2.subVectors(r,s),a=(C-u)/(C-u+(h-m)),t.copy(s).addScaledVector(b2,a);const A=1/(y+v+d);return o=v*A,a=d*A,t.copy(i).addScaledVector(Ol,o).addScaledVector(Ql,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}let WH=0;class _n extends zs{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:WH++}),this.uuid=Cs(),this.name="",this.type="Material",this.blending=sl,this.side=Hr,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=mv,this.blendDst=fv,this.blendEquation=Ea,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=su,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=h1,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=xh,this.stencilZFail=xh,this.stencilZPass=xh,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 i=e[t];if(i===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const s=this[t];if(s===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}s&&s.isColor?s.set(i):s&&s.isVector3&&i&&i.isVector3?s.copy(i):this[t]=i}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const i={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),this.roughness!==void 0&&(i.roughness=this.roughness),this.metalness!==void 0&&(i.metalness=this.metalness),this.sheen!==void 0&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity&&this.emissiveIntensity!==1&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(i.shininess=this.shininess),this.clearcoat!==void 0&&(i.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.iridescence!==void 0&&(i.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(i.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(e).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(e).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(e).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(e).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(e).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(i.combine=this.combine)),this.envMapIntensity!==void 0&&(i.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(i.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(i.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(i.size=this.size),this.shadowSide!==null&&(i.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==sl&&(i.blending=this.blending),this.side!==Hr&&(i.side=this.side),this.vertexColors&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),this.transparent===!0&&(i.transparent=this.transparent),i.depthFunc=this.depthFunc,i.depthTest=this.depthTest,i.depthWrite=this.depthWrite,i.colorWrite=this.colorWrite,i.stencilWrite=this.stencilWrite,i.stencilWriteMask=this.stencilWriteMask,i.stencilFunc=this.stencilFunc,i.stencilRef=this.stencilRef,i.stencilFuncMask=this.stencilFuncMask,i.stencilFail=this.stencilFail,i.stencilZFail=this.stencilZFail,i.stencilZPass=this.stencilZPass,this.rotation!==void 0&&this.rotation!==0&&(i.rotation=this.rotation),this.polygonOffset===!0&&(i.polygonOffset=!0),this.polygonOffsetFactor!==0&&(i.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(i.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(i.linewidth=this.linewidth),this.dashSize!==void 0&&(i.dashSize=this.dashSize),this.gapSize!==void 0&&(i.gapSize=this.gapSize),this.scale!==void 0&&(i.scale=this.scale),this.dithering===!0&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),this.alphaToCoverage===!0&&(i.alphaToCoverage=this.alphaToCoverage),this.premultipliedAlpha===!0&&(i.premultipliedAlpha=this.premultipliedAlpha),this.forceSinglePass===!0&&(i.forceSinglePass=this.forceSinglePass),this.wireframe===!0&&(i.wireframe=this.wireframe),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(i.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(i.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(i.flatShading=this.flatShading),this.visible===!1&&(i.visible=!1),this.toneMapped===!1&&(i.toneMapped=!1),this.fog===!1&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData);function s(r){const o=[];for(const a in r){const l=r[a];delete l.metadata,o.push(l)}return o}if(t){const r=s(e.textures),o=s(e.images);r.length>0&&(i.textures=r),o.length>0&&(i.images=o)}return i}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let i=null;if(t!==null){const s=t.length;i=new Array(s);for(let r=0;r!==s;++r)i[r]=t[r].clone()}return this.clippingPlanes=i,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}const y1={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},qs={h:0,s:0,l:0},hd={h:0,s:0,l:0};function Um(n,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?n+(e-n)*6*t:t<1/2?e:t<2/3?n+(e-n)*6*(2/3-t):n}class Re{constructor(e,t,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,t===void 0&&i===void 0?this.set(e):this.setRGB(e,t,i)}set(e){return e&&e.isColor?this.copy(e):typeof e=="number"?this.setHex(e):typeof e=="string"&&this.setStyle(e),this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=mt){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Ws.toWorkingColorSpace(this,t),this}setRGB(e,t,i,s=Ws.workingColorSpace){return this.r=e,this.g=t,this.b=i,Ws.toWorkingColorSpace(this,s),this}setHSL(e,t,i,s=Ws.workingColorSpace){if(e=Vv(e,1),t=Gn(t,0,1),i=Gn(i,0,1),t===0)this.r=this.g=this.b=i;else{const r=i<=.5?i*(1+t):i+t-i*t,o=2*i-r;this.r=Um(o,r,e+1/3),this.g=Um(o,r,e),this.b=Um(o,r,e-1/3)}return Ws.toWorkingColorSpace(this,s),this}setStyle(e,t=mt){function i(r){r!==void 0&&parseFloat(r)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let s;if(s=/^(\w+)\(([^\)]*)\)/.exec(e)){let r;const o=s[1],a=s[2];switch(o){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,t);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,t);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(s=/^\#([A-Fa-f\d]+)$/.exec(e)){const r=s[1],o=r.length;if(o===3)return this.setRGB(parseInt(r.charAt(0),16)/15,parseInt(r.charAt(1),16)/15,parseInt(r.charAt(2),16)/15,t);if(o===6)return this.setHex(parseInt(r,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=mt){const i=y1[e.toLowerCase()];return i!==void 0?this.setHex(i,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=Lg(e.r),this.g=Lg(e.g),this.b=Lg(e.b),this}copyLinearToSRGB(e){return this.r=Nm(e.r),this.g=Nm(e.g),this.b=Nm(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=mt){return Ws.fromWorkingColorSpace(pi.copy(this),e),Math.round(Gn(pi.r*255,0,255))*65536+Math.round(Gn(pi.g*255,0,255))*256+Math.round(Gn(pi.b*255,0,255))}getHexString(e=mt){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Ws.workingColorSpace){Ws.fromWorkingColorSpace(pi.copy(this),t);const i=pi.r,s=pi.g,r=pi.b,o=Math.max(i,s,r),a=Math.min(i,s,r);let l,c;const u=(a+o)/2;if(a===o)l=0,c=0;else{const C=o-a;switch(c=u<=.5?C/(o+a):C/(2-o-a),o){case i:l=(s-r)/C+(s>-c-14,i[l|256]=1024>>-c-14|32768,s[l]=-c-1,s[l|256]=-c-1):c<=15?(i[l]=c+15<<10,i[l|256]=c+15<<10|32768,s[l]=13,s[l|256]=13):c<128?(i[l]=31744,i[l|256]=64512,s[l]=24,s[l|256]=24):(i[l]=31744,i[l|256]=64512,s[l]=13,s[l|256]=13)}const r=new Uint32Array(2048),o=new Uint32Array(64),a=new Uint32Array(64);for(let l=1;l<1024;++l){let c=l<<13,u=0;for(;!(c&8388608);)c<<=1,u-=8388608;c&=-8388609,u+=947912704,r[l]=c|u}for(let l=1024;l<2048;++l)r[l]=939524096+(l-1024<<13);for(let l=1;l<31;++l)o[l]=l<<23;o[31]=1199570944,o[32]=2147483648;for(let l=33;l<63;++l)o[l]=2147483648+(l-32<<23);o[63]=3347054592;for(let l=1;l<64;++l)l!==32&&(a[l]=1024);return{floatView:e,uint32View:t,baseTable:i,shiftTable:s,mantissaTable:r,exponentTable:o,offsetTable:a}}function Ti(n){Math.abs(n)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),n=Gn(n,-65504,65504),no.floatView[0]=n;const e=no.uint32View[0],t=e>>23&511;return no.baseTable[t]+((e&8388607)>>no.shiftTable[t])}function mI(n){const e=n>>10;return no.uint32View[0]=no.mantissaTable[no.offsetTable[e]+(n&1023)]+no.exponentTable[e],no.floatView[0]}const MH={toHalfFloat:Ti,fromHalfFloat:mI},Hn=new H,Ad=new ne;class kt{constructor(e,t,i=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=i,this.usage=uu,this.updateRange={offset:0,count:-1},this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this}copyAt(e,t,i){e*=this.itemSize,i*=t.itemSize;for(let s=0,r=this.itemSize;s0&&(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 i=this.attributes;for(const l in i){const c=i[l];e.data.attributes[l]=c.toJSON(e.data)}const s={};let r=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],u=[];for(let C=0,d=c.length;C0&&(s[l]=u,r=!0)}r&&(e.data.morphAttributes=s,e.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));const a=this.boundingSphere;return a!==null&&(e.data.boundingSphere={center:a.center.toArray(),radius:a.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 i=e.index;i!==null&&this.setIndex(i.clone(t));const s=e.attributes;for(const c in s){const u=s[c];this.setAttribute(c,u.clone(t))}const r=e.morphAttributes;for(const c in r){const u=[],C=r[c];for(let d=0,h=C.length;d0){const s=t[i[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,o=s.length;r(e.far-e.near)**2))&&(v2.copy(r).invert(),Gr.copy(e.ray).applyMatrix4(v2),!(i.boundingBox!==null&&Gr.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(e,t)))}_computeIntersections(e,t){let i;const s=this.geometry,r=this.material,o=s.index,a=s.attributes.position,l=s.attributes.uv,c=s.attributes.uv1,u=s.attributes.normal,C=s.groups,d=s.drawRange;if(o!==null)if(Array.isArray(r))for(let h=0,m=C.length;ht.far?null:{distance:c,point:Gd.clone(),object:n}}function Bd(n,e,t,i,s,r,o,a,l,c){n.getVertexPosition(a,ql),n.getVertexPosition(l,$l),n.getVertexPosition(c,eg);const u=TH(n,e,t,i,ql,$l,eg,yd);if(u){s&&(fd.fromBufferAttribute(s,a),bd.fromBufferAttribute(s,l),vd.fromBufferAttribute(s,c),u.uv=Ui.getInterpolation(yd,ql,$l,eg,fd,bd,vd,new ne)),r&&(fd.fromBufferAttribute(r,a),bd.fromBufferAttribute(r,l),vd.fromBufferAttribute(r,c),u.uv1=Ui.getInterpolation(yd,ql,$l,eg,fd,bd,vd,new ne),u.uv2=u.uv1),o&&(G2.fromBufferAttribute(o,a),B2.fromBufferAttribute(o,l),Z2.fromBufferAttribute(o,c),u.normal=Ui.getInterpolation(yd,ql,$l,eg,G2,B2,Z2,new H),u.normal.dot(i.direction)>0&&u.normal.multiplyScalar(-1));const C={a,b:l,c,normal:new H,materialIndex:0};Ui.getNormal(ql,$l,eg,C.normal),u.face=C}return u}class Aa extends ft{constructor(e=1,t=1,i=1,s=1,r=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:i,widthSegments:s,heightSegments:r,depthSegments:o};const a=this;s=Math.floor(s),r=Math.floor(r),o=Math.floor(o);const l=[],c=[],u=[],C=[];let d=0,h=0;m("z","y","x",-1,-1,i,t,e,o,r,0),m("z","y","x",1,-1,i,t,-e,o,r,1),m("x","z","y",1,1,e,i,t,s,o,2),m("x","z","y",1,-1,e,i,-t,s,o,3),m("x","y","z",1,-1,e,t,i,s,r,4),m("x","y","z",-1,-1,e,t,-i,s,r,5),this.setIndex(l),this.setAttribute("position",new ke(c,3)),this.setAttribute("normal",new ke(u,3)),this.setAttribute("uv",new ke(C,2));function m(v,y,A,b,f,B,S,x,R,M,Z){const V=B/R,N=S/M,D=B/2,k=S/2,$=x/2,te=R+1,Ce=M+1;let le=0,L=0;const J=new H;for(let P=0;P0?1:-1,u.push(J.x,J.y,J.z),C.push(se/R),C.push(1-P/M),le+=1}}for(let P=0;P>8&255]+Ai[n>>16&255]+Ai[n>>24&255]+"-"+Ai[e&255]+Ai[e>>8&255]+"-"+Ai[e>>16&15|64]+Ai[e>>24&255]+"-"+Ai[t&63|128]+Ai[t>>8&255]+"-"+Ai[t>>16&255]+Ai[t>>24&255]+Ai[i&255]+Ai[i>>8&255]+Ai[i>>16&255]+Ai[i>>24&255]).toLowerCase()}function Gn(n,e,t){return Math.max(e,Math.min(t,n))}function Vv(n,e){return(n%e+e)%e}function eH(n,e,t,i,s){return i+(n-e)*(s-i)/(t-e)}function tH(n,e,t){return n!==e?(t-n)/(e-n):0}function NI(n,e,t){return(1-t)*n+t*e}function nH(n,e,t,i){return NI(n,e,1-Math.exp(-t*i))}function iH(n,e=1){return e-Math.abs(Vv(n,e*2)-e)}function sH(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*(3-2*n))}function rH(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*n*(n*(n*6-15)+10))}function oH(n,e){return n+Math.floor(Math.random()*(e-n+1))}function aH(n,e){return n+Math.random()*(e-n)}function lH(n){return n*(.5-Math.random())}function gH(n){n!==void 0&&(c2=n);let e=c2+=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 cH(n){return n*rl}function IH(n){return n*qg}function $0(n){return(n&n-1)===0&&n!==0}function p1(n){return Math.pow(2,Math.ceil(Math.log(n)/Math.LN2))}function m1(n){return Math.pow(2,Math.floor(Math.log(n)/Math.LN2))}function uH(n,e,t,i,s){const r=Math.cos,o=Math.sin,a=r(t/2),l=o(t/2),c=r((e+i)/2),u=o((e+i)/2),C=r((e-i)/2),d=o((e-i)/2),h=r((i-e)/2),m=o((i-e)/2);switch(s){case"XYX":n.set(a*u,l*C,l*d,a*c);break;case"YZY":n.set(l*d,a*u,l*C,a*c);break;case"ZXZ":n.set(l*C,l*d,a*u,a*c);break;case"XZX":n.set(a*u,l*m,l*h,a*c);break;case"YXY":n.set(l*h,a*u,l*m,a*c);break;case"ZYZ":n.set(l*m,l*h,a*u,a*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+s)}}function cs(n,e){switch(e.constructor){case Float32Array:return n;case Uint16Array:return n/65535;case Uint8Array:return n/255;case Int16Array:return Math.max(n/32767,-1);case Int8Array:return Math.max(n/127,-1);default:throw new Error("Invalid component type.")}}function vt(n,e){switch(e.constructor){case Float32Array:return n;case Uint16Array:return Math.round(n*65535);case Uint8Array:return Math.round(n*255);case Int16Array:return Math.round(n*32767);case Int8Array:return Math.round(n*127);default:throw new Error("Invalid component type.")}}const f1={DEG2RAD:rl,RAD2DEG:qg,generateUUID:Cs,clamp:Gn,euclideanModulo:Vv,mapLinear:eH,inverseLerp:tH,lerp:NI,damp:nH,pingpong:iH,smoothstep:sH,smootherstep:rH,randInt:oH,randFloat:aH,randFloatSpread:lH,seededRandom:gH,degToRad:cH,radToDeg:IH,isPowerOfTwo:$0,ceilPowerOfTwo:p1,floorPowerOfTwo:m1,setQuaternionFromProperEuler:uH,normalize:vt,denormalize:cs};class ne{constructor(e=0,t=0){ne.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,i=this.y,s=e.elements;return this.x=s[0]*t+s[3]*i+s[6],this.y=s[1]*t+s[4]*i+s[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 i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const i=this.dot(e)/t;return Math.acos(Gn(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y;return t*t+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const i=Math.cos(t),s=Math.sin(t),r=this.x-e.x,o=this.y-e.y;return this.x=r*i-o*s+e.x,this.y=r*s+o*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class xt{constructor(){xt.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1]}set(e,t,i,s,r,o,a,l,c){const u=this.elements;return u[0]=e,u[1]=s,u[2]=a,u[3]=t,u[4]=r,u[5]=l,u[6]=i,u[7]=o,u[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],this}extractBasis(e,t,i){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(e){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 i=e.elements,s=t.elements,r=this.elements,o=i[0],a=i[3],l=i[6],c=i[1],u=i[4],C=i[7],d=i[2],h=i[5],m=i[8],v=s[0],y=s[3],A=s[6],b=s[1],f=s[4],B=s[7],S=s[2],x=s[5],R=s[8];return r[0]=o*v+a*b+l*S,r[3]=o*y+a*f+l*x,r[6]=o*A+a*B+l*R,r[1]=c*v+u*b+C*S,r[4]=c*y+u*f+C*x,r[7]=c*A+u*B+C*R,r[2]=d*v+h*b+m*S,r[5]=d*y+h*f+m*x,r[8]=d*A+h*B+m*R,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],i=e[1],s=e[2],r=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8];return t*o*u-t*a*c-i*r*u+i*a*l+s*r*c-s*o*l}invert(){const e=this.elements,t=e[0],i=e[1],s=e[2],r=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],C=u*o-a*c,d=a*l-u*r,h=c*r-o*l,m=t*C+i*d+s*h;if(m===0)return this.set(0,0,0,0,0,0,0,0,0);const v=1/m;return e[0]=C*v,e[1]=(s*c-u*i)*v,e[2]=(a*i-s*o)*v,e[3]=d*v,e[4]=(u*t-s*l)*v,e[5]=(s*r-a*t)*v,e[6]=h*v,e[7]=(i*l-c*t)*v,e[8]=(o*t-i*r)*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,i,s,r,o,a){const l=Math.cos(r),c=Math.sin(r);return this.set(i*l,i*c,-i*(l*o+c*a)+o+e,-s*c,s*l,-s*(-c*o+l*a)+a+t,0,0,1),this}scale(e,t){return this.premultiply(Mm.makeScale(e,t)),this}rotate(e){return this.premultiply(Mm.makeRotation(-e)),this}translate(e,t){return this.premultiply(Mm.makeTranslation(e,t)),this}makeTranslation(e,t){return this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,i,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,i=e.elements;for(let s=0;s<9;s++)if(t[s]!==i[s])return!1;return!0}fromArray(e,t=0){for(let i=0;i<9;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const Mm=new xt;function b1(n){for(let e=n.length-1;e>=0;--e)if(n[e]>=65535)return!0;return!1}const CH={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function Sg(n,e){return new CH[n](e)}function Cu(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}const I2={};function HI(n){n in I2||(I2[n]=!0,console.warn(n))}function Lg(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function Nm(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}const dH=new xt().fromArray([.8224621,.0331941,.0170827,.177538,.9668058,.0723974,-1e-7,1e-7,.9105199]),hH=new xt().fromArray([1.2249401,-.0420569,-.0196376,-.2249404,1.0420571,-.0786361,1e-7,0,1.0982735]);function AH(n){return n.convertSRGBToLinear().applyMatrix3(hH)}function pH(n){return n.applyMatrix3(dH).convertLinearToSRGB()}const mH={[ur]:n=>n,[mt]:n=>n.convertSRGBToLinear(),[Wv]:AH},fH={[ur]:n=>n,[mt]:n=>n.convertLinearToSRGB(),[Wv]:pH},Ws={enabled:!0,get legacyMode(){return console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),!this.enabled},set legacyMode(n){console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),this.enabled=!n},get workingColorSpace(){return ur},set workingColorSpace(n){console.warn("THREE.ColorManagement: .workingColorSpace is readonly.")},convert:function(n,e,t){if(this.enabled===!1||e===t||!e||!t)return n;const i=mH[e],s=fH[t];if(i===void 0||s===void 0)throw new Error(`Unsupported color space conversion, "${e}" to "${t}".`);return s(i(n))},fromWorkingColorSpace:function(n,e){return this.convert(n,this.workingColorSpace,e)},toWorkingColorSpace:function(n,e){return this.convert(n,e,this.workingColorSpace)}};let El;class Mv{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{El===void 0&&(El=Cu("canvas")),El.width=e.width,El.height=e.height;const i=El.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),t=El}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=Cu("canvas");t.width=e.width,t.height=e.height;const i=t.getContext("2d");i.drawImage(e,0,0,e.width,e.height);const s=i.getImageData(0,0,e.width,e.height),r=s.data;for(let o=0;o0&&(i.userData=this.userData),t||(e.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==RA)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case hs:e.x=e.x-Math.floor(e.x);break;case zn:e.x=e.x<0?0:1;break;case lu: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 hs:e.y=e.y-Math.floor(e.y);break;case zn:e.y=e.y<0?0:1;break;case lu: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)}get encoding(){return HI("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace===mt?Ys:Vu}set encoding(e){HI("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=e===Ys?mt:co}}qt.DEFAULT_IMAGE=null;qt.DEFAULT_MAPPING=RA;qt.DEFAULT_ANISOTROPY=1;class Vt{constructor(e=0,t=0,i=0,s=1){Vt.prototype.isVector4=!0,this.x=e,this.y=t,this.z=i,this.w=s}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,i,s){return this.x=e,this.y=t,this.z=i,this.w=s,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,i=this.y,s=this.z,r=this.w,o=e.elements;return this.x=o[0]*t+o[4]*i+o[8]*s+o[12]*r,this.y=o[1]*t+o[5]*i+o[9]*s+o[13]*r,this.z=o[2]*t+o[6]*i+o[10]*s+o[14]*r,this.w=o[3]*t+o[7]*i+o[11]*s+o[15]*r,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,i,s,r;const l=e.elements,c=l[0],u=l[4],C=l[8],d=l[1],h=l[5],m=l[9],v=l[2],y=l[6],A=l[10];if(Math.abs(u-d)<.01&&Math.abs(C-v)<.01&&Math.abs(m-y)<.01){if(Math.abs(u+d)<.1&&Math.abs(C+v)<.1&&Math.abs(m+y)<.1&&Math.abs(c+h+A-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const f=(c+1)/2,B=(h+1)/2,S=(A+1)/2,x=(u+d)/4,R=(C+v)/4,M=(m+y)/4;return f>B&&f>S?f<.01?(i=0,s=.707106781,r=.707106781):(i=Math.sqrt(f),s=x/i,r=R/i):B>S?B<.01?(i=.707106781,s=0,r=.707106781):(s=Math.sqrt(B),i=x/s,r=M/s):S<.01?(i=.707106781,s=.707106781,r=0):(r=Math.sqrt(S),i=R/r,s=M/r),this.set(i,s,r,t),this}let b=Math.sqrt((y-m)*(y-m)+(C-v)*(C-v)+(d-u)*(d-u));return Math.abs(b)<.001&&(b=1),this.x=(y-m)/b,this.y=(C-v)/b,this.z=(d-u)/b,this.w=Math.acos((c+h+A-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 i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this.w=e.w+(t.w-e.w)*i,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class Rt extends zs{constructor(e=1,t=1,i={}){super(),this.isWebGLRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new Vt(0,0,e,t),this.scissorTest=!1,this.viewport=new Vt(0,0,e,t);const s={width:e,height:t,depth:1};i.encoding!==void 0&&(HI("THREE.WebGLRenderTarget: option.encoding has been replaced by option.colorSpace."),i.colorSpace=i.encoding===Ys?mt:co),this.texture=new qt(s,i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.flipY=!1,this.texture.generateMipmaps=i.generateMipmaps!==void 0?i.generateMipmaps:!1,this.texture.internalFormat=i.internalFormat!==void 0?i.internalFormat:null,this.texture.minFilter=i.minFilter!==void 0?i.minFilter:je,this.depthBuffer=i.depthBuffer!==void 0?i.depthBuffer:!0,this.stencilBuffer=i.stencilBuffer!==void 0?i.stencilBuffer:!1,this.depthTexture=i.depthTexture!==void 0?i.depthTexture:null,this.samples=i.samples!==void 0?i.samples:0}setSize(e,t,i=1){(this.width!==e||this.height!==t||this.depth!==i)&&(this.width=e,this.height=t,this.depth=i,this.texture.image.width=e,this.texture.image.height=t,this.texture.image.depth=i,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.texture.isRenderTargetTexture=!0;const t=Object.assign({},e.texture.image);return this.texture.source=new qa(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 MA extends qt{constructor(e=null,t=1,i=1,s=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:i,depth:s},this.magFilter=pt,this.minFilter=pt,this.wrapR=zn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class vH extends Rt{constructor(e=1,t=1,i=1){super(e,t),this.isWebGLArrayRenderTarget=!0,this.depth=i,this.texture=new MA(null,e,t,i),this.texture.isRenderTargetTexture=!0}}class ol extends qt{constructor(e=null,t=1,i=1,s=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:i,depth:s},this.magFilter=pt,this.minFilter=pt,this.wrapR=zn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class yH extends Rt{constructor(e=1,t=1,i=1){super(e,t),this.isWebGL3DRenderTarget=!0,this.depth=i,this.texture=new ol(null,e,t,i),this.texture.isRenderTargetTexture=!0}}class v1 extends Rt{constructor(e=1,t=1,i=1,s={}){super(e,t,s),this.isWebGLMultipleRenderTargets=!0;const r=this.texture;this.texture=[];for(let o=0;o=0?1:-1,f=1-A*A;if(f>Number.EPSILON){const S=Math.sqrt(f),x=Math.atan2(S,A*b);y=Math.sin(y*x)/S,a=Math.sin(a*x)/S}const B=a*b;if(l=l*y+d*B,c=c*y+h*B,u=u*y+m*B,C=C*y+v*B,y===1-a){const S=1/Math.sqrt(l*l+c*c+u*u+C*C);l*=S,c*=S,u*=S,C*=S}}e[t]=l,e[t+1]=c,e[t+2]=u,e[t+3]=C}static multiplyQuaternionsFlat(e,t,i,s,r,o){const a=i[s],l=i[s+1],c=i[s+2],u=i[s+3],C=r[o],d=r[o+1],h=r[o+2],m=r[o+3];return e[t]=a*m+u*C+l*h-c*d,e[t+1]=l*m+u*d+c*C-a*h,e[t+2]=c*m+u*h+a*d-l*C,e[t+3]=u*m-a*C-l*d-c*h,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,i,s){return this._x=e,this._y=t,this._z=i,this._w=s,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){const i=e._x,s=e._y,r=e._z,o=e._order,a=Math.cos,l=Math.sin,c=a(i/2),u=a(s/2),C=a(r/2),d=l(i/2),h=l(s/2),m=l(r/2);switch(o){case"XYZ":this._x=d*u*C+c*h*m,this._y=c*h*C-d*u*m,this._z=c*u*m+d*h*C,this._w=c*u*C-d*h*m;break;case"YXZ":this._x=d*u*C+c*h*m,this._y=c*h*C-d*u*m,this._z=c*u*m-d*h*C,this._w=c*u*C+d*h*m;break;case"ZXY":this._x=d*u*C-c*h*m,this._y=c*h*C+d*u*m,this._z=c*u*m+d*h*C,this._w=c*u*C-d*h*m;break;case"ZYX":this._x=d*u*C-c*h*m,this._y=c*h*C+d*u*m,this._z=c*u*m-d*h*C,this._w=c*u*C+d*h*m;break;case"YZX":this._x=d*u*C+c*h*m,this._y=c*h*C+d*u*m,this._z=c*u*m-d*h*C,this._w=c*u*C-d*h*m;break;case"XZY":this._x=d*u*C-c*h*m,this._y=c*h*C-d*u*m,this._z=c*u*m+d*h*C,this._w=c*u*C+d*h*m;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t!==!1&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const i=t/2,s=Math.sin(i);return this._x=e.x*s,this._y=e.y*s,this._z=e.z*s,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,i=t[0],s=t[4],r=t[8],o=t[1],a=t[5],l=t[9],c=t[2],u=t[6],C=t[10],d=i+a+C;if(d>0){const h=.5/Math.sqrt(d+1);this._w=.25/h,this._x=(u-l)*h,this._y=(r-c)*h,this._z=(o-s)*h}else if(i>a&&i>C){const h=2*Math.sqrt(1+i-a-C);this._w=(u-l)/h,this._x=.25*h,this._y=(s+o)/h,this._z=(r+c)/h}else if(a>C){const h=2*Math.sqrt(1+a-i-C);this._w=(r-c)/h,this._x=(s+o)/h,this._y=.25*h,this._z=(l+u)/h}else{const h=2*Math.sqrt(1+C-i-a);this._w=(o-s)/h,this._x=(r+c)/h,this._y=(l+u)/h,this._z=.25*h}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let i=e.dot(t)+1;return iMath.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=i):(this._x=0,this._y=-e.z,this._z=e.y,this._w=i)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=i),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Gn(this.dot(e),-1,1)))}rotateTowards(e,t){const i=this.angleTo(e);if(i===0)return this;const s=Math.min(1,t/i);return this.slerp(e,s),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 i=e._x,s=e._y,r=e._z,o=e._w,a=t._x,l=t._y,c=t._z,u=t._w;return this._x=i*u+o*a+s*c-r*l,this._y=s*u+o*l+r*a-i*c,this._z=r*u+o*c+i*l-s*a,this._w=o*u-i*a-s*l-r*c,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const i=this._x,s=this._y,r=this._z,o=this._w;let a=o*e._w+i*e._x+s*e._y+r*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=o,this._x=i,this._y=s,this._z=r,this;const l=1-a*a;if(l<=Number.EPSILON){const h=1-t;return this._w=h*o+t*this._w,this._x=h*i+t*this._x,this._y=h*s+t*this._y,this._z=h*r+t*this._z,this.normalize(),this._onChangeCallback(),this}const c=Math.sqrt(l),u=Math.atan2(c,a),C=Math.sin((1-t)*u)/c,d=Math.sin(t*u)/c;return this._w=o*C+this._w*d,this._x=i*C+this._x*d,this._y=s*C+this._y*d,this._z=r*C+this._z*d,this._onChangeCallback(),this}slerpQuaternions(e,t,i){return this.copy(e).slerp(t,i)}random(){const e=Math.random(),t=Math.sqrt(1-e),i=Math.sqrt(e),s=2*Math.PI*Math.random(),r=2*Math.PI*Math.random();return this.set(t*Math.cos(s),i*Math.sin(r),i*Math.cos(r),t*Math.sin(s))}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}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 H{constructor(e=0,t=0,i=0){H.prototype.isVector3=!0,this.x=e,this.y=t,this.z=i}set(e,t,i){return i===void 0&&(i=this.z),this.x=e,this.y=t,this.z=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(u2.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(u2.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,i=this.y,s=this.z,r=e.elements;return this.x=r[0]*t+r[3]*i+r[6]*s,this.y=r[1]*t+r[4]*i+r[7]*s,this.z=r[2]*t+r[5]*i+r[8]*s,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,i=this.y,s=this.z,r=e.elements,o=1/(r[3]*t+r[7]*i+r[11]*s+r[15]);return this.x=(r[0]*t+r[4]*i+r[8]*s+r[12])*o,this.y=(r[1]*t+r[5]*i+r[9]*s+r[13])*o,this.z=(r[2]*t+r[6]*i+r[10]*s+r[14])*o,this}applyQuaternion(e){const t=this.x,i=this.y,s=this.z,r=e.x,o=e.y,a=e.z,l=e.w,c=l*t+o*s-a*i,u=l*i+a*t-r*s,C=l*s+r*i-o*t,d=-r*t-o*i-a*s;return this.x=c*l+d*-r+u*-a-C*-o,this.y=u*l+d*-o+C*-r-c*-a,this.z=C*l+d*-a+c*-o-u*-r,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,i=this.y,s=this.z,r=e.elements;return this.x=r[0]*t+r[4]*i+r[8]*s,this.y=r[1]*t+r[5]*i+r[9]*s,this.z=r[2]*t+r[6]*i+r[10]*s,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 i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const i=e.x,s=e.y,r=e.z,o=t.x,a=t.y,l=t.z;return this.x=s*l-r*a,this.y=r*o-i*l,this.z=i*a-s*o,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const i=e.dot(this)/t;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return Xm.copy(this).projectOnVector(e),this.sub(Xm)}reflect(e){return this.sub(Xm.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 i=this.dot(e)/t;return Math.acos(Gn(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y,s=this.z-e.z;return t*t+i*i+s*s}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,i){const s=Math.sin(t)*e;return this.x=s*Math.sin(i),this.y=Math.cos(t)*e,this.z=s*Math.cos(i),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,i){return this.x=e*Math.sin(t),this.y=i,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){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(),i=this.setFromMatrixColumn(e,1).length(),s=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=i,this.z=s,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()-.5)*2,t=Math.random()*Math.PI*2,i=Math.sqrt(1-e**2);return this.x=i*Math.cos(t),this.y=i*Math.sin(t),this.z=e,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const Xm=new H,u2=new xn;class Yr{constructor(e=new H(1/0,1/0,1/0),t=new H(-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,i=e.length;tthis.max.x||e.ythis.max.y||e.zthis.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.xthis.max.x||e.max.ythis.max.y||e.max.zthis.max.z)}intersectsSphere(e){return this.clampPoint(e.center,_r),_r.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,i;return e.normal.x>0?(t=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),t<=-e.constant&&i>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Pc),ld.subVectors(this.max,Pc),Dl.subVectors(e.a,Pc),Ul.subVectors(e.b,Pc),Pl.subVectors(e.c,Pc),Mo.subVectors(Ul,Dl),No.subVectors(Pl,Ul),Ra.subVectors(Dl,Pl);let t=[0,-Mo.z,Mo.y,0,-No.z,No.y,0,-Ra.z,Ra.y,Mo.z,0,-Mo.x,No.z,0,-No.x,Ra.z,0,-Ra.x,-Mo.y,Mo.x,0,-No.y,No.x,0,-Ra.y,Ra.x,0];return!Ym(t,Dl,Ul,Pl,ld)||(t=[1,0,0,0,1,0,0,0,1],!Ym(t,Dl,Ul,Pl,ld))?!1:(gd.crossVectors(Mo,No),t=[gd.x,gd.y,gd.z],Ym(t,Dl,Ul,Pl,ld))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,_r).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(_r).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:(Pr[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Pr[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Pr[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Pr[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Pr[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Pr[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Pr[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Pr[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Pr),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 Pr=[new H,new H,new H,new H,new H,new H,new H,new H],_r=new H,kl=new Yr,Dl=new H,Ul=new H,Pl=new H,Mo=new H,No=new H,Ra=new H,Pc=new H,ld=new H,gd=new H,Wa=new H;function Ym(n,e,t,i,s){for(let r=0,o=n.length-3;r<=o;r+=3){Wa.fromArray(n,r);const a=s.x*Math.abs(Wa.x)+s.y*Math.abs(Wa.y)+s.z*Math.abs(Wa.z),l=e.dot(Wa),c=t.dot(Wa),u=i.dot(Wa);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>a)return!1}return!0}const GH=new Yr,_c=new H,Fm=new H;class Fr{constructor(e=new H,t=-1){this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const i=this.center;t!==void 0?i.copy(t):GH.setFromPoints(e).getCenter(i);let s=0;for(let r=0,o=e.length;rthis.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;_c.subVectors(e,this.center);const t=_c.lengthSq();if(t>this.radius*this.radius){const i=Math.sqrt(t),s=(i-this.radius)*.5;this.center.addScaledVector(_c,s/i),this.radius+=s}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):(Fm.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(_c.copy(e.center).add(Fm)),this.expandByPoint(_c.copy(e.center).sub(Fm))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const Jr=new H,Km=new H,cd=new H,Ho=new H,zm=new H,Id=new H,Lm=new H;let Mu=class{constructor(e=new H,t=new H(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,Jr)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const i=t.dot(this.direction);return i<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=Jr.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Jr.copy(this.origin).addScaledVector(this.direction,t),Jr.distanceToSquared(e))}distanceSqToSegment(e,t,i,s){Km.copy(e).add(t).multiplyScalar(.5),cd.copy(t).sub(e).normalize(),Ho.copy(this.origin).sub(Km);const r=e.distanceTo(t)*.5,o=-this.direction.dot(cd),a=Ho.dot(this.direction),l=-Ho.dot(cd),c=Ho.lengthSq(),u=Math.abs(1-o*o);let C,d,h,m;if(u>0)if(C=o*l-a,d=o*a-l,m=r*u,C>=0)if(d>=-m)if(d<=m){const v=1/u;C*=v,d*=v,h=C*(C+o*d+2*a)+d*(o*C+d+2*l)+c}else d=r,C=Math.max(0,-(o*d+a)),h=-C*C+d*(d+2*l)+c;else d=-r,C=Math.max(0,-(o*d+a)),h=-C*C+d*(d+2*l)+c;else d<=-m?(C=Math.max(0,-(-o*r+a)),d=C>0?-r:Math.min(Math.max(-r,-l),r),h=-C*C+d*(d+2*l)+c):d<=m?(C=0,d=Math.min(Math.max(-r,-l),r),h=d*(d+2*l)+c):(C=Math.max(0,-(o*r+a)),d=C>0?r:Math.min(Math.max(-r,-l),r),h=-C*C+d*(d+2*l)+c);else d=o>0?-r:r,C=Math.max(0,-(o*d+a)),h=-C*C+d*(d+2*l)+c;return i&&i.copy(this.origin).addScaledVector(this.direction,C),s&&s.copy(Km).addScaledVector(cd,d),h}intersectSphere(e,t){Jr.subVectors(e.center,this.origin);const i=Jr.dot(this.direction),s=Jr.dot(Jr)-i*i,r=e.radius*e.radius;if(s>r)return null;const o=Math.sqrt(r-s),a=i-o,l=i+o;return l<0?null:a<0?this.at(l,t):this.at(a,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 i=-(this.origin.dot(e.normal)+e.constant)/t;return i>=0?i:null}intersectPlane(e,t){const i=this.distanceToPlane(e);return i===null?null:this.at(i,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let i,s,r,o,a,l;const c=1/this.direction.x,u=1/this.direction.y,C=1/this.direction.z,d=this.origin;return c>=0?(i=(e.min.x-d.x)*c,s=(e.max.x-d.x)*c):(i=(e.max.x-d.x)*c,s=(e.min.x-d.x)*c),u>=0?(r=(e.min.y-d.y)*u,o=(e.max.y-d.y)*u):(r=(e.max.y-d.y)*u,o=(e.min.y-d.y)*u),i>o||r>s||((r>i||isNaN(i))&&(i=r),(o=0?(a=(e.min.z-d.z)*C,l=(e.max.z-d.z)*C):(a=(e.max.z-d.z)*C,l=(e.min.z-d.z)*C),i>l||a>s)||((a>i||i!==i)&&(i=a),(l=0?i:s,t)}intersectsBox(e){return this.intersectBox(e,Jr)!==null}intersectTriangle(e,t,i,s,r){zm.subVectors(t,e),Id.subVectors(i,e),Lm.crossVectors(zm,Id);let o=this.direction.dot(Lm),a;if(o>0){if(s)return null;a=1}else if(o<0)a=-1,o=-o;else return null;Ho.subVectors(this.origin,e);const l=a*this.direction.dot(Id.crossVectors(Ho,Id));if(l<0)return null;const c=a*this.direction.dot(zm.cross(Ho));if(c<0||l+c>o)return null;const u=-a*Ho.dot(Lm);return u<0?null:this.at(u/o,r)}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 Fe{constructor(){Fe.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}set(e,t,i,s,r,o,a,l,c,u,C,d,h,m,v,y){const A=this.elements;return A[0]=e,A[4]=t,A[8]=i,A[12]=s,A[1]=r,A[5]=o,A[9]=a,A[13]=l,A[2]=c,A[6]=u,A[10]=C,A[14]=d,A[3]=h,A[7]=m,A[11]=v,A[15]=y,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 Fe().fromArray(this.elements)}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],this}copyPosition(e){const t=this.elements,i=e.elements;return t[12]=i[12],t[13]=i[13],t[14]=i[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,i){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(e,t,i){return this.set(e.x,t.x,i.x,0,e.y,t.y,i.y,0,e.z,t.z,i.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,i=e.elements,s=1/_l.setFromMatrixColumn(e,0).length(),r=1/_l.setFromMatrixColumn(e,1).length(),o=1/_l.setFromMatrixColumn(e,2).length();return t[0]=i[0]*s,t[1]=i[1]*s,t[2]=i[2]*s,t[3]=0,t[4]=i[4]*r,t[5]=i[5]*r,t[6]=i[6]*r,t[7]=0,t[8]=i[8]*o,t[9]=i[9]*o,t[10]=i[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,i=e.x,s=e.y,r=e.z,o=Math.cos(i),a=Math.sin(i),l=Math.cos(s),c=Math.sin(s),u=Math.cos(r),C=Math.sin(r);if(e.order==="XYZ"){const d=o*u,h=o*C,m=a*u,v=a*C;t[0]=l*u,t[4]=-l*C,t[8]=c,t[1]=h+m*c,t[5]=d-v*c,t[9]=-a*l,t[2]=v-d*c,t[6]=m+h*c,t[10]=o*l}else if(e.order==="YXZ"){const d=l*u,h=l*C,m=c*u,v=c*C;t[0]=d+v*a,t[4]=m*a-h,t[8]=o*c,t[1]=o*C,t[5]=o*u,t[9]=-a,t[2]=h*a-m,t[6]=v+d*a,t[10]=o*l}else if(e.order==="ZXY"){const d=l*u,h=l*C,m=c*u,v=c*C;t[0]=d-v*a,t[4]=-o*C,t[8]=m+h*a,t[1]=h+m*a,t[5]=o*u,t[9]=v-d*a,t[2]=-o*c,t[6]=a,t[10]=o*l}else if(e.order==="ZYX"){const d=o*u,h=o*C,m=a*u,v=a*C;t[0]=l*u,t[4]=m*c-h,t[8]=d*c+v,t[1]=l*C,t[5]=v*c+d,t[9]=h*c-m,t[2]=-c,t[6]=a*l,t[10]=o*l}else if(e.order==="YZX"){const d=o*l,h=o*c,m=a*l,v=a*c;t[0]=l*u,t[4]=v-d*C,t[8]=m*C+h,t[1]=C,t[5]=o*u,t[9]=-a*u,t[2]=-c*u,t[6]=h*C+m,t[10]=d-v*C}else if(e.order==="XZY"){const d=o*l,h=o*c,m=a*l,v=a*c;t[0]=l*u,t[4]=-C,t[8]=c*u,t[1]=d*C+v,t[5]=o*u,t[9]=h*C-m,t[2]=m*C-h,t[6]=a*u,t[10]=v*C+d}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(BH,e,ZH)}lookAt(e,t,i){const s=this.elements;return rs.subVectors(e,t),rs.lengthSq()===0&&(rs.z=1),rs.normalize(),Xo.crossVectors(i,rs),Xo.lengthSq()===0&&(Math.abs(i.z)===1?rs.x+=1e-4:rs.z+=1e-4,rs.normalize(),Xo.crossVectors(i,rs)),Xo.normalize(),ud.crossVectors(rs,Xo),s[0]=Xo.x,s[4]=ud.x,s[8]=rs.x,s[1]=Xo.y,s[5]=ud.y,s[9]=rs.y,s[2]=Xo.z,s[6]=ud.z,s[10]=rs.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,s=t.elements,r=this.elements,o=i[0],a=i[4],l=i[8],c=i[12],u=i[1],C=i[5],d=i[9],h=i[13],m=i[2],v=i[6],y=i[10],A=i[14],b=i[3],f=i[7],B=i[11],S=i[15],x=s[0],R=s[4],M=s[8],Z=s[12],V=s[1],N=s[5],D=s[9],k=s[13],$=s[2],te=s[6],Ce=s[10],le=s[14],L=s[3],J=s[7],P=s[11],ce=s[15];return r[0]=o*x+a*V+l*$+c*L,r[4]=o*R+a*N+l*te+c*J,r[8]=o*M+a*D+l*Ce+c*P,r[12]=o*Z+a*k+l*le+c*ce,r[1]=u*x+C*V+d*$+h*L,r[5]=u*R+C*N+d*te+h*J,r[9]=u*M+C*D+d*Ce+h*P,r[13]=u*Z+C*k+d*le+h*ce,r[2]=m*x+v*V+y*$+A*L,r[6]=m*R+v*N+y*te+A*J,r[10]=m*M+v*D+y*Ce+A*P,r[14]=m*Z+v*k+y*le+A*ce,r[3]=b*x+f*V+B*$+S*L,r[7]=b*R+f*N+B*te+S*J,r[11]=b*M+f*D+B*Ce+S*P,r[15]=b*Z+f*k+B*le+S*ce,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],i=e[4],s=e[8],r=e[12],o=e[1],a=e[5],l=e[9],c=e[13],u=e[2],C=e[6],d=e[10],h=e[14],m=e[3],v=e[7],y=e[11],A=e[15];return m*(+r*l*C-s*c*C-r*a*d+i*c*d+s*a*h-i*l*h)+v*(+t*l*h-t*c*d+r*o*d-s*o*h+s*c*u-r*l*u)+y*(+t*c*C-t*a*h-r*o*C+i*o*h+r*a*u-i*c*u)+A*(-s*a*u-t*l*C+t*a*d+s*o*C-i*o*d+i*l*u)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,i){const s=this.elements;return e.isVector3?(s[12]=e.x,s[13]=e.y,s[14]=e.z):(s[12]=e,s[13]=t,s[14]=i),this}invert(){const e=this.elements,t=e[0],i=e[1],s=e[2],r=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],C=e[9],d=e[10],h=e[11],m=e[12],v=e[13],y=e[14],A=e[15],b=C*y*c-v*d*c+v*l*h-a*y*h-C*l*A+a*d*A,f=m*d*c-u*y*c-m*l*h+o*y*h+u*l*A-o*d*A,B=u*v*c-m*C*c+m*a*h-o*v*h-u*a*A+o*C*A,S=m*C*l-u*v*l-m*a*d+o*v*d+u*a*y-o*C*y,x=t*b+i*f+s*B+r*S;if(x===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const R=1/x;return e[0]=b*R,e[1]=(v*d*r-C*y*r-v*s*h+i*y*h+C*s*A-i*d*A)*R,e[2]=(a*y*r-v*l*r+v*s*c-i*y*c-a*s*A+i*l*A)*R,e[3]=(C*l*r-a*d*r-C*s*c+i*d*c+a*s*h-i*l*h)*R,e[4]=f*R,e[5]=(u*y*r-m*d*r+m*s*h-t*y*h-u*s*A+t*d*A)*R,e[6]=(m*l*r-o*y*r-m*s*c+t*y*c+o*s*A-t*l*A)*R,e[7]=(o*d*r-u*l*r+u*s*c-t*d*c-o*s*h+t*l*h)*R,e[8]=B*R,e[9]=(m*C*r-u*v*r-m*i*h+t*v*h+u*i*A-t*C*A)*R,e[10]=(o*v*r-m*a*r+m*i*c-t*v*c-o*i*A+t*a*A)*R,e[11]=(u*a*r-o*C*r-u*i*c+t*C*c+o*i*h-t*a*h)*R,e[12]=S*R,e[13]=(u*v*s-m*C*s+m*i*d-t*v*d-u*i*y+t*C*y)*R,e[14]=(m*a*s-o*v*s-m*i*l+t*v*l+o*i*y-t*a*y)*R,e[15]=(o*C*s-u*a*s+u*i*l-t*C*l-o*i*d+t*a*d)*R,this}scale(e){const t=this.elements,i=e.x,s=e.y,r=e.z;return t[0]*=i,t[4]*=s,t[8]*=r,t[1]*=i,t[5]*=s,t[9]*=r,t[2]*=i,t[6]*=s,t[10]*=r,t[3]*=i,t[7]*=s,t[11]*=r,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],s=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,i,s))}makeTranslation(e,t,i){return this.set(1,0,0,e,0,1,0,t,0,0,1,i,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,t,-i,0,0,i,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,0,i,0,0,1,0,0,-i,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,0,i,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const i=Math.cos(t),s=Math.sin(t),r=1-i,o=e.x,a=e.y,l=e.z,c=r*o,u=r*a;return this.set(c*o+i,c*a-s*l,c*l+s*a,0,c*a+s*l,u*a+i,u*l-s*o,0,c*l-s*a,u*l+s*o,r*l*l+i,0,0,0,0,1),this}makeScale(e,t,i){return this.set(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1),this}makeShear(e,t,i,s,r,o){return this.set(1,i,r,0,e,1,o,0,t,s,1,0,0,0,0,1),this}compose(e,t,i){const s=this.elements,r=t._x,o=t._y,a=t._z,l=t._w,c=r+r,u=o+o,C=a+a,d=r*c,h=r*u,m=r*C,v=o*u,y=o*C,A=a*C,b=l*c,f=l*u,B=l*C,S=i.x,x=i.y,R=i.z;return s[0]=(1-(v+A))*S,s[1]=(h+B)*S,s[2]=(m-f)*S,s[3]=0,s[4]=(h-B)*x,s[5]=(1-(d+A))*x,s[6]=(y+b)*x,s[7]=0,s[8]=(m+f)*R,s[9]=(y-b)*R,s[10]=(1-(d+v))*R,s[11]=0,s[12]=e.x,s[13]=e.y,s[14]=e.z,s[15]=1,this}decompose(e,t,i){const s=this.elements;let r=_l.set(s[0],s[1],s[2]).length();const o=_l.set(s[4],s[5],s[6]).length(),a=_l.set(s[8],s[9],s[10]).length();this.determinant()<0&&(r=-r),e.x=s[12],e.y=s[13],e.z=s[14],Qs.copy(this);const c=1/r,u=1/o,C=1/a;return Qs.elements[0]*=c,Qs.elements[1]*=c,Qs.elements[2]*=c,Qs.elements[4]*=u,Qs.elements[5]*=u,Qs.elements[6]*=u,Qs.elements[8]*=C,Qs.elements[9]*=C,Qs.elements[10]*=C,t.setFromRotationMatrix(Qs),i.x=r,i.y=o,i.z=a,this}makePerspective(e,t,i,s,r,o){const a=this.elements,l=2*r/(t-e),c=2*r/(i-s),u=(t+e)/(t-e),C=(i+s)/(i-s),d=-(o+r)/(o-r),h=-2*o*r/(o-r);return a[0]=l,a[4]=0,a[8]=u,a[12]=0,a[1]=0,a[5]=c,a[9]=C,a[13]=0,a[2]=0,a[6]=0,a[10]=d,a[14]=h,a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this}makeOrthographic(e,t,i,s,r,o){const a=this.elements,l=1/(t-e),c=1/(i-s),u=1/(o-r),C=(t+e)*l,d=(i+s)*c,h=(o+r)*u;return a[0]=2*l,a[4]=0,a[8]=0,a[12]=-C,a[1]=0,a[5]=2*c,a[9]=0,a[13]=-d,a[2]=0,a[6]=0,a[10]=-2*u,a[14]=-h,a[3]=0,a[7]=0,a[11]=0,a[15]=1,this}equals(e){const t=this.elements,i=e.elements;for(let s=0;s<16;s++)if(t[s]!==i[s])return!1;return!0}fromArray(e,t=0){for(let i=0;i<16;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e[t+9]=i[9],e[t+10]=i[10],e[t+11]=i[11],e[t+12]=i[12],e[t+13]=i[13],e[t+14]=i[14],e[t+15]=i[15],e}}const _l=new H,Qs=new Fe,BH=new H(0,0,0),ZH=new H(1,1,1),Xo=new H,ud=new H,rs=new H,C2=new Fe,d2=new xn;class bl{constructor(e=0,t=0,i=0,s=bl.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=i,this._order=s}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,i,s=this._order){return this._x=e,this._y=t,this._z=i,this._order=s,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,i=!0){const s=e.elements,r=s[0],o=s[4],a=s[8],l=s[1],c=s[5],u=s[9],C=s[2],d=s[6],h=s[10];switch(t){case"XYZ":this._y=Math.asin(Gn(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-u,h),this._z=Math.atan2(-o,r)):(this._x=Math.atan2(d,c),this._z=0);break;case"YXZ":this._x=Math.asin(-Gn(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(a,h),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-C,r),this._z=0);break;case"ZXY":this._x=Math.asin(Gn(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-C,h),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,r));break;case"ZYX":this._y=Math.asin(-Gn(C,-1,1)),Math.abs(C)<.9999999?(this._x=Math.atan2(d,h),this._z=Math.atan2(l,r)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin(Gn(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-C,r)):(this._x=0,this._y=Math.atan2(a,h));break;case"XZY":this._z=Math.asin(-Gn(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(d,c),this._y=Math.atan2(a,r)):(this._x=Math.atan2(-u,h),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,i===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,i){return C2.makeRotationFromQuaternion(e),this.setFromRotationMatrix(C2,t,i)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return d2.setFromEuler(this),this.setFromQuaternion(d2,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}}bl.DEFAULT_ORDER="XYZ";class al{constructor(){this.mask=1}set(e){this.mask=(1<>>0}enable(e){this.mask|=1<1){for(let t=0;t1){for(let i=0;i0&&(i=i.concat(o))}return i}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Jc,e,SH),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Jc,xH,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 i=0,s=t.length;i0&&(s.userData=this.userData),s.layers=this.layers.mask,s.matrix=this.matrix.toArray(),s.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(s.matrixAutoUpdate=!1),this.isInstancedMesh&&(s.type="InstancedMesh",s.count=this.count,s.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(s.instanceColor=this.instanceColor.toJSON()));function r(a,l){return a[l.uuid]===void 0&&(a[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?s.background=this.background.toJSON():this.background.isTexture&&(s.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(s.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){s.geometry=r(e.geometries,this.geometry);const a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){const l=a.shapes;if(Array.isArray(l))for(let c=0,u=l.length;c0){s.children=[];for(let a=0;a0){s.animations=[];for(let a=0;a0&&(i.geometries=a),l.length>0&&(i.materials=l),c.length>0&&(i.textures=c),u.length>0&&(i.images=u),C.length>0&&(i.shapes=C),d.length>0&&(i.skeletons=d),h.length>0&&(i.animations=h),m.length>0&&(i.nodes=m)}return i.object=s,i;function o(a){const l=[];for(const c in a){const u=a[c];delete u.metadata,l.push(u)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations,this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let i=0;i0?s.multiplyScalar(1/Math.sqrt(r)):s.set(0,0,0)}static getBarycoord(e,t,i,s,r){js.subVectors(s,t),Qr.subVectors(i,t),Tm.subVectors(e,t);const o=js.dot(js),a=js.dot(Qr),l=js.dot(Tm),c=Qr.dot(Qr),u=Qr.dot(Tm),C=o*c-a*a;if(C===0)return r.set(-2,-1,-1);const d=1/C,h=(c*l-a*u)*d,m=(o*u-a*l)*d;return r.set(1-h-m,m,h)}static containsPoint(e,t,i,s){return this.getBarycoord(e,t,i,s,jr),jr.x>=0&&jr.y>=0&&jr.x+jr.y<=1}static getUV(e,t,i,s,r,o,a,l){return dd===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),dd=!0),this.getInterpolation(e,t,i,s,r,o,a,l)}static getInterpolation(e,t,i,s,r,o,a,l){return this.getBarycoord(e,t,i,s,jr),l.setScalar(0),l.addScaledVector(r,jr.x),l.addScaledVector(o,jr.y),l.addScaledVector(a,jr.z),l}static isFrontFacing(e,t,i,s){return js.subVectors(i,t),Qr.subVectors(e,t),js.cross(Qr).dot(s)<0}set(e,t,i){return this.a.copy(e),this.b.copy(t),this.c.copy(i),this}setFromPointsAndIndices(e,t,i,s){return this.a.copy(e[t]),this.b.copy(e[i]),this.c.copy(e[s]),this}setFromAttributeAndIndices(e,t,i,s){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,i),this.c.fromBufferAttribute(e,s),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 js.subVectors(this.c,this.b),Qr.subVectors(this.a,this.b),js.cross(Qr).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Ui.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Ui.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,i,s,r){return dd===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),dd=!0),Ui.getInterpolation(e,this.a,this.b,this.c,t,i,s,r)}getInterpolation(e,t,i,s,r){return Ui.getInterpolation(e,this.a,this.b,this.c,t,i,s,r)}containsPoint(e){return Ui.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Ui.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const i=this.a,s=this.b,r=this.c;let o,a;Ol.subVectors(s,i),Ql.subVectors(r,i),Em.subVectors(e,i);const l=Ol.dot(Em),c=Ql.dot(Em);if(l<=0&&c<=0)return t.copy(i);km.subVectors(e,s);const u=Ol.dot(km),C=Ql.dot(km);if(u>=0&&C<=u)return t.copy(s);const d=l*C-u*c;if(d<=0&&l>=0&&u<=0)return o=l/(l-u),t.copy(i).addScaledVector(Ol,o);Dm.subVectors(e,r);const h=Ol.dot(Dm),m=Ql.dot(Dm);if(m>=0&&h<=m)return t.copy(r);const v=h*c-l*m;if(v<=0&&c>=0&&m<=0)return a=c/(c-m),t.copy(i).addScaledVector(Ql,a);const y=u*m-h*C;if(y<=0&&C-u>=0&&h-m>=0)return b2.subVectors(r,s),a=(C-u)/(C-u+(h-m)),t.copy(s).addScaledVector(b2,a);const A=1/(y+v+d);return o=v*A,a=d*A,t.copy(i).addScaledVector(Ol,o).addScaledVector(Ql,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}let WH=0;class _n extends zs{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:WH++}),this.uuid=Cs(),this.name="",this.type="Material",this.blending=sl,this.side=Hr,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=mv,this.blendDst=fv,this.blendEquation=Ea,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=su,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=h1,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=xh,this.stencilZFail=xh,this.stencilZPass=xh,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 i=e[t];if(i===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const s=this[t];if(s===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}s&&s.isColor?s.set(i):s&&s.isVector3&&i&&i.isVector3?s.copy(i):this[t]=i}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const i={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),this.roughness!==void 0&&(i.roughness=this.roughness),this.metalness!==void 0&&(i.metalness=this.metalness),this.sheen!==void 0&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity&&this.emissiveIntensity!==1&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(i.shininess=this.shininess),this.clearcoat!==void 0&&(i.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.iridescence!==void 0&&(i.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(i.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(e).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(e).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(e).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(e).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(e).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(i.combine=this.combine)),this.envMapIntensity!==void 0&&(i.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(i.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(i.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(i.size=this.size),this.shadowSide!==null&&(i.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==sl&&(i.blending=this.blending),this.side!==Hr&&(i.side=this.side),this.vertexColors&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),this.transparent===!0&&(i.transparent=this.transparent),i.depthFunc=this.depthFunc,i.depthTest=this.depthTest,i.depthWrite=this.depthWrite,i.colorWrite=this.colorWrite,i.stencilWrite=this.stencilWrite,i.stencilWriteMask=this.stencilWriteMask,i.stencilFunc=this.stencilFunc,i.stencilRef=this.stencilRef,i.stencilFuncMask=this.stencilFuncMask,i.stencilFail=this.stencilFail,i.stencilZFail=this.stencilZFail,i.stencilZPass=this.stencilZPass,this.rotation!==void 0&&this.rotation!==0&&(i.rotation=this.rotation),this.polygonOffset===!0&&(i.polygonOffset=!0),this.polygonOffsetFactor!==0&&(i.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(i.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(i.linewidth=this.linewidth),this.dashSize!==void 0&&(i.dashSize=this.dashSize),this.gapSize!==void 0&&(i.gapSize=this.gapSize),this.scale!==void 0&&(i.scale=this.scale),this.dithering===!0&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),this.alphaToCoverage===!0&&(i.alphaToCoverage=this.alphaToCoverage),this.premultipliedAlpha===!0&&(i.premultipliedAlpha=this.premultipliedAlpha),this.forceSinglePass===!0&&(i.forceSinglePass=this.forceSinglePass),this.wireframe===!0&&(i.wireframe=this.wireframe),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(i.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(i.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(i.flatShading=this.flatShading),this.visible===!1&&(i.visible=!1),this.toneMapped===!1&&(i.toneMapped=!1),this.fog===!1&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData);function s(r){const o=[];for(const a in r){const l=r[a];delete l.metadata,o.push(l)}return o}if(t){const r=s(e.textures),o=s(e.images);r.length>0&&(i.textures=r),o.length>0&&(i.images=o)}return i}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let i=null;if(t!==null){const s=t.length;i=new Array(s);for(let r=0;r!==s;++r)i[r]=t[r].clone()}return this.clippingPlanes=i,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}const y1={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},qs={h:0,s:0,l:0},hd={h:0,s:0,l:0};function Um(n,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?n+(e-n)*6*t:t<1/2?e:t<2/3?n+(e-n)*6*(2/3-t):n}class Re{constructor(e,t,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,t===void 0&&i===void 0?this.set(e):this.setRGB(e,t,i)}set(e){return e&&e.isColor?this.copy(e):typeof e=="number"?this.setHex(e):typeof e=="string"&&this.setStyle(e),this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=mt){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Ws.toWorkingColorSpace(this,t),this}setRGB(e,t,i,s=Ws.workingColorSpace){return this.r=e,this.g=t,this.b=i,Ws.toWorkingColorSpace(this,s),this}setHSL(e,t,i,s=Ws.workingColorSpace){if(e=Vv(e,1),t=Gn(t,0,1),i=Gn(i,0,1),t===0)this.r=this.g=this.b=i;else{const r=i<=.5?i*(1+t):i+t-i*t,o=2*i-r;this.r=Um(o,r,e+1/3),this.g=Um(o,r,e),this.b=Um(o,r,e-1/3)}return Ws.toWorkingColorSpace(this,s),this}setStyle(e,t=mt){function i(r){r!==void 0&&parseFloat(r)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let s;if(s=/^(\w+)\(([^\)]*)\)/.exec(e)){let r;const o=s[1],a=s[2];switch(o){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,t);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,t);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(s=/^\#([A-Fa-f\d]+)$/.exec(e)){const r=s[1],o=r.length;if(o===3)return this.setRGB(parseInt(r.charAt(0),16)/15,parseInt(r.charAt(1),16)/15,parseInt(r.charAt(2),16)/15,t);if(o===6)return this.setHex(parseInt(r,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=mt){const i=y1[e.toLowerCase()];return i!==void 0?this.setHex(i,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=Lg(e.r),this.g=Lg(e.g),this.b=Lg(e.b),this}copyLinearToSRGB(e){return this.r=Nm(e.r),this.g=Nm(e.g),this.b=Nm(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=mt){return Ws.fromWorkingColorSpace(pi.copy(this),e),Math.round(Gn(pi.r*255,0,255))*65536+Math.round(Gn(pi.g*255,0,255))*256+Math.round(Gn(pi.b*255,0,255))}getHexString(e=mt){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Ws.workingColorSpace){Ws.fromWorkingColorSpace(pi.copy(this),t);const i=pi.r,s=pi.g,r=pi.b,o=Math.max(i,s,r),a=Math.min(i,s,r);let l,c;const u=(a+o)/2;if(a===o)l=0,c=0;else{const C=o-a;switch(c=u<=.5?C/(o+a):C/(2-o-a),o){case i:l=(s-r)/C+(s>-c-14,i[l|256]=1024>>-c-14|32768,s[l]=-c-1,s[l|256]=-c-1):c<=15?(i[l]=c+15<<10,i[l|256]=c+15<<10|32768,s[l]=13,s[l|256]=13):c<128?(i[l]=31744,i[l|256]=64512,s[l]=24,s[l|256]=24):(i[l]=31744,i[l|256]=64512,s[l]=13,s[l|256]=13)}const r=new Uint32Array(2048),o=new Uint32Array(64),a=new Uint32Array(64);for(let l=1;l<1024;++l){let c=l<<13,u=0;for(;!(c&8388608);)c<<=1,u-=8388608;c&=-8388609,u+=947912704,r[l]=c|u}for(let l=1024;l<2048;++l)r[l]=939524096+(l-1024<<13);for(let l=1;l<31;++l)o[l]=l<<23;o[31]=1199570944,o[32]=2147483648;for(let l=33;l<63;++l)o[l]=2147483648+(l-32<<23);o[63]=3347054592;for(let l=1;l<64;++l)l!==32&&(a[l]=1024);return{floatView:e,uint32View:t,baseTable:i,shiftTable:s,mantissaTable:r,exponentTable:o,offsetTable:a}}function Ti(n){Math.abs(n)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),n=Gn(n,-65504,65504),no.floatView[0]=n;const e=no.uint32View[0],t=e>>23&511;return no.baseTable[t]+((e&8388607)>>no.shiftTable[t])}function mI(n){const e=n>>10;return no.uint32View[0]=no.mantissaTable[no.offsetTable[e]+(n&1023)]+no.exponentTable[e],no.floatView[0]}const MH={toHalfFloat:Ti,fromHalfFloat:mI},Hn=new H,Ad=new ne;class kt{constructor(e,t,i=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=i,this.usage=uu,this.updateRange={offset:0,count:-1},this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this}copyAt(e,t,i){e*=this.itemSize,i*=t.itemSize;for(let s=0,r=this.itemSize;s0&&(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 i=this.attributes;for(const l in i){const c=i[l];e.data.attributes[l]=c.toJSON(e.data)}const s={};let r=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],u=[];for(let C=0,d=c.length;C0&&(s[l]=u,r=!0)}r&&(e.data.morphAttributes=s,e.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));const a=this.boundingSphere;return a!==null&&(e.data.boundingSphere={center:a.center.toArray(),radius:a.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 i=e.index;i!==null&&this.setIndex(i.clone(t));const s=e.attributes;for(const c in s){const u=s[c];this.setAttribute(c,u.clone(t))}const r=e.morphAttributes;for(const c in r){const u=[],C=r[c];for(let d=0,h=C.length;d0){const s=t[i[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,o=s.length;r(e.far-e.near)**2))&&(v2.copy(r).invert(),Gr.copy(e.ray).applyMatrix4(v2),!(i.boundingBox!==null&&Gr.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(e,t)))}_computeIntersections(e,t){let i;const s=this.geometry,r=this.material,o=s.index,a=s.attributes.position,l=s.attributes.uv,c=s.attributes.uv1,u=s.attributes.normal,C=s.groups,d=s.drawRange;if(o!==null)if(Array.isArray(r))for(let h=0,m=C.length;ht.far?null:{distance:c,point:Gd.clone(),object:n}}function Bd(n,e,t,i,s,r,o,a,l,c){n.getVertexPosition(a,ql),n.getVertexPosition(l,$l),n.getVertexPosition(c,eg);const u=TH(n,e,t,i,ql,$l,eg,yd);if(u){s&&(fd.fromBufferAttribute(s,a),bd.fromBufferAttribute(s,l),vd.fromBufferAttribute(s,c),u.uv=Ui.getInterpolation(yd,ql,$l,eg,fd,bd,vd,new ne)),r&&(fd.fromBufferAttribute(r,a),bd.fromBufferAttribute(r,l),vd.fromBufferAttribute(r,c),u.uv1=Ui.getInterpolation(yd,ql,$l,eg,fd,bd,vd,new ne),u.uv2=u.uv1),o&&(G2.fromBufferAttribute(o,a),B2.fromBufferAttribute(o,l),Z2.fromBufferAttribute(o,c),u.normal=Ui.getInterpolation(yd,ql,$l,eg,G2,B2,Z2,new H),u.normal.dot(i.direction)>0&&u.normal.multiplyScalar(-1));const C={a,b:l,c,normal:new H,materialIndex:0};Ui.getNormal(ql,$l,eg,C.normal),u.face=C}return u}class Aa extends ft{constructor(e=1,t=1,i=1,s=1,r=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:i,widthSegments:s,heightSegments:r,depthSegments:o};const a=this;s=Math.floor(s),r=Math.floor(r),o=Math.floor(o);const l=[],c=[],u=[],C=[];let d=0,h=0;m("z","y","x",-1,-1,i,t,e,o,r,0),m("z","y","x",1,-1,i,t,-e,o,r,1),m("x","z","y",1,1,e,i,t,s,o,2),m("x","z","y",1,-1,e,i,-t,s,o,3),m("x","y","z",1,-1,e,t,i,s,r,4),m("x","y","z",-1,-1,e,t,-i,s,r,5),this.setIndex(l),this.setAttribute("position",new ke(c,3)),this.setAttribute("normal",new ke(u,3)),this.setAttribute("uv",new ke(C,2));function m(v,y,A,b,f,B,S,x,R,M,Z){const V=B/R,N=S/M,D=B/2,k=S/2,$=x/2,te=R+1,Ce=M+1;let le=0,L=0;const J=new H;for(let P=0;P0?1:-1,u.push(J.x,J.y,J.z),C.push(se/R),C.push(1-P/M),le+=1}}for(let P=0;P0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const i={};for(const s in this.extensions)this.extensions[s]===!0&&(i[s]=!0);return Object.keys(i).length>0&&(t.extensions=i),t}}class ac extends Ht{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Fe,this.projectionMatrix=new Fe,this.projectionMatrixInverse=new Fe}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}class An extends ac{constructor(e=50,t=1,i=.1,s=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=i,this.far=s,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=qg*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(rl*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return qg*2*Math.atan(Math.tan(rl*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(e,t,i,s,r,o){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=s,this.view.width=r,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(rl*.5*this.fov)/this.zoom,i=2*t,s=this.aspect*i,r=-.5*s;const o=this.view;if(this.view!==null&&this.view.enabled){const l=o.fullWidth,c=o.fullHeight;r+=o.offsetX*s/l,t-=o.offsetY*i/c,s*=o.width/l,i*=o.height/c}const a=this.filmOffset;a!==0&&(r+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+s,t,t-i,e,this.far),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 tg=-90,ng=1;class Xv extends Ht{constructor(e,t,i){super(),this.type="CubeCamera",this.renderTarget=i;const s=new An(tg,ng,e,t);s.layers=this.layers,s.up.set(0,1,0),s.lookAt(1,0,0),this.add(s);const r=new An(tg,ng,e,t);r.layers=this.layers,r.up.set(0,1,0),r.lookAt(-1,0,0),this.add(r);const o=new An(tg,ng,e,t);o.layers=this.layers,o.up.set(0,0,-1),o.lookAt(0,1,0),this.add(o);const a=new An(tg,ng,e,t);a.layers=this.layers,a.up.set(0,0,1),a.lookAt(0,-1,0),this.add(a);const l=new An(tg,ng,e,t);l.layers=this.layers,l.up.set(0,1,0),l.lookAt(0,0,1),this.add(l);const c=new An(tg,ng,e,t);c.layers=this.layers,c.up.set(0,1,0),c.lookAt(0,0,-1),this.add(c)}update(e,t){this.parent===null&&this.updateMatrixWorld();const i=this.renderTarget,[s,r,o,a,l,c]=this.children,u=e.getRenderTarget(),C=e.toneMapping,d=e.xr.enabled;e.toneMapping=gr,e.xr.enabled=!1;const h=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,e.setRenderTarget(i,0),e.render(t,s),e.setRenderTarget(i,1),e.render(t,r),e.setRenderTarget(i,2),e.render(t,o),e.setRenderTarget(i,3),e.render(t,a),e.setRenderTarget(i,4),e.render(t,l),i.texture.generateMipmaps=h,e.setRenderTarget(i,5),e.render(t,c),e.setRenderTarget(u),e.toneMapping=C,e.xr.enabled=d,i.texture.needsPMREMUpdate=!0}}class Nu extends qt{constructor(e,t,i,s,r,o,a,l,c,u){e=e!==void 0?e:[],t=t!==void 0?t:oa,super(e,t,i,s,r,o,a,l,c,u),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class NA extends Rt{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const i={width:e,height:e,depth:1},s=[i,i,i,i,i,i];t.encoding!==void 0&&(HI("THREE.WebGLCubeRenderTarget: option.encoding has been replaced by option.colorSpace."),t.colorSpace=t.encoding===Ys?mt:co),this.texture=new Nu(s,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:je}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 i={uniforms:{tEquirect:{value:null}},vertexShader:` +}`;class Zt extends _n{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=kH,this.fragmentShader=DH,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!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=$g(e.uniforms),this.uniformsGroups=EH(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 s in this.uniforms){const o=this.uniforms[s].value;o&&o.isTexture?t.uniforms[s]={type:"t",value:o.toJSON(e).uuid}:o&&o.isColor?t.uniforms[s]={type:"c",value:o.getHex()}:o&&o.isVector2?t.uniforms[s]={type:"v2",value:o.toArray()}:o&&o.isVector3?t.uniforms[s]={type:"v3",value:o.toArray()}:o&&o.isVector4?t.uniforms[s]={type:"v4",value:o.toArray()}:o&&o.isMatrix3?t.uniforms[s]={type:"m3",value:o.toArray()}:o&&o.isMatrix4?t.uniforms[s]={type:"m4",value:o.toArray()}:t.uniforms[s]={value:o}}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 i={};for(const s in this.extensions)this.extensions[s]===!0&&(i[s]=!0);return Object.keys(i).length>0&&(t.extensions=i),t}}class ac extends Xt{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Fe,this.projectionMatrix=new Fe,this.projectionMatrixInverse=new Fe}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}class An extends ac{constructor(e=50,t=1,i=.1,s=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=i,this.far=s,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=qg*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(rl*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return qg*2*Math.atan(Math.tan(rl*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(e,t,i,s,r,o){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=s,this.view.width=r,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(rl*.5*this.fov)/this.zoom,i=2*t,s=this.aspect*i,r=-.5*s;const o=this.view;if(this.view!==null&&this.view.enabled){const l=o.fullWidth,c=o.fullHeight;r+=o.offsetX*s/l,t-=o.offsetY*i/c,s*=o.width/l,i*=o.height/c}const a=this.filmOffset;a!==0&&(r+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+s,t,t-i,e,this.far),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 tg=-90,ng=1;class Xv extends Xt{constructor(e,t,i){super(),this.type="CubeCamera",this.renderTarget=i;const s=new An(tg,ng,e,t);s.layers=this.layers,s.up.set(0,1,0),s.lookAt(1,0,0),this.add(s);const r=new An(tg,ng,e,t);r.layers=this.layers,r.up.set(0,1,0),r.lookAt(-1,0,0),this.add(r);const o=new An(tg,ng,e,t);o.layers=this.layers,o.up.set(0,0,-1),o.lookAt(0,1,0),this.add(o);const a=new An(tg,ng,e,t);a.layers=this.layers,a.up.set(0,0,1),a.lookAt(0,-1,0),this.add(a);const l=new An(tg,ng,e,t);l.layers=this.layers,l.up.set(0,1,0),l.lookAt(0,0,1),this.add(l);const c=new An(tg,ng,e,t);c.layers=this.layers,c.up.set(0,1,0),c.lookAt(0,0,-1),this.add(c)}update(e,t){this.parent===null&&this.updateMatrixWorld();const i=this.renderTarget,[s,r,o,a,l,c]=this.children,u=e.getRenderTarget(),C=e.toneMapping,d=e.xr.enabled;e.toneMapping=gr,e.xr.enabled=!1;const h=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,e.setRenderTarget(i,0),e.render(t,s),e.setRenderTarget(i,1),e.render(t,r),e.setRenderTarget(i,2),e.render(t,o),e.setRenderTarget(i,3),e.render(t,a),e.setRenderTarget(i,4),e.render(t,l),i.texture.generateMipmaps=h,e.setRenderTarget(i,5),e.render(t,c),e.setRenderTarget(u),e.toneMapping=C,e.xr.enabled=d,i.texture.needsPMREMUpdate=!0}}class Nu extends qt{constructor(e,t,i,s,r,o,a,l,c,u){e=e!==void 0?e:[],t=t!==void 0?t:oa,super(e,t,i,s,r,o,a,l,c,u),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class NA extends Rt{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const i={width:e,height:e,depth:1},s=[i,i,i,i,i,i];t.encoding!==void 0&&(HI("THREE.WebGLCubeRenderTarget: option.encoding has been replaced by option.colorSpace."),t.colorSpace=t.encoding===Ys?mt:co),this.texture=new Nu(s,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:je}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 i={uniforms:{tEquirect:{value:null}},vertexShader:` varying vec3 vWorldDirection; @@ -3439,7 +3439,7 @@ void main() { squared_mean = squared_mean / samples; float std_dev = sqrt( squared_mean - mean * mean ); gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) ); -}`;function gK(n,e,t){let i=new HA;const s=new ne,r=new ne,o=new Vt,a=new YA({depthPacking:Xr}),l=new Fv,c={},u=t.maxTextureSize,C={[Hr]:Tn,[Tn]:Hr,[Pi]:Pi},d=new Zt({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new ne},radius:{value:4}},vertexShader:aK,fragmentShader:lK}),h=d.clone();h.defines.HORIZONTAL_PASS=1;const m=new ft;m.setAttribute("position",new kt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const v=new En(m,d),y=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=SA;let A=this.type;this.render=function(S,x,R){if(y.enabled===!1||y.autoUpdate===!1&&y.needsUpdate===!1||S.length===0)return;const M=n.getRenderTarget(),Z=n.getActiveCubeFace(),V=n.getActiveMipmapLevel(),N=n.state;N.setBlending(tn),N.buffers.color.setClear(1,1,1,1),N.buffers.depth.setTest(!0),N.setScissorTest(!1);const D=A!==ir&&this.type===ir,k=A===ir&&this.type!==ir;for(let $=0,te=S.length;$u||s.y>u)&&(s.x>u&&(r.x=Math.floor(u/L.x),s.x=r.x*L.x,le.mapSize.x=r.x),s.y>u&&(r.y=Math.floor(u/L.y),s.y=r.y*L.y,le.mapSize.y=r.y)),le.map===null||D===!0||k===!0){const P=this.type!==ir?{minFilter:pt,magFilter:pt}:{};le.map!==null&&le.map.dispose(),le.map=new Rt(s.x,s.y,P),le.map.texture.name=Ce.name+".shadowMap",le.camera.updateProjectionMatrix()}n.setRenderTarget(le.map),n.clear();const J=le.getViewportCount();for(let P=0;P0||x.map&&x.alphaTest>0){const N=Z.uuid,D=x.uuid;let k=c[N];k===void 0&&(k={},c[N]=k);let $=k[D];$===void 0&&($=Z.clone(),k[D]=$),Z=$}if(Z.visible=x.visible,Z.wireframe=x.wireframe,M===ir?Z.side=x.shadowSide!==null?x.shadowSide:x.side:Z.side=x.shadowSide!==null?x.shadowSide:C[x.side],Z.alphaMap=x.alphaMap,Z.alphaTest=x.alphaTest,Z.map=x.map,Z.clipShadows=x.clipShadows,Z.clippingPlanes=x.clippingPlanes,Z.clipIntersection=x.clipIntersection,Z.displacementMap=x.displacementMap,Z.displacementScale=x.displacementScale,Z.displacementBias=x.displacementBias,Z.wireframeLinewidth=x.wireframeLinewidth,Z.linewidth=x.linewidth,R.isPointLight===!0&&Z.isMeshDistanceMaterial===!0){const N=n.properties.get(Z);N.light=R}return Z}function B(S,x,R,M,Z){if(S.visible===!1)return;if(S.layers.test(x.layers)&&(S.isMesh||S.isLine||S.isPoints)&&(S.castShadow||S.receiveShadow&&Z===ir)&&(!S.frustumCulled||i.intersectsObject(S))){S.modelViewMatrix.multiplyMatrices(R.matrixWorldInverse,S.matrixWorld);const D=e.update(S),k=S.material;if(Array.isArray(k)){const $=D.groups;for(let te=0,Ce=$.length;te=1):L.indexOf("OpenGL ES")!==-1&&(le=parseFloat(/^OpenGL ES (\d)/.exec(L)[1]),Ce=le>=2);let J=null,P={};const ce=n.getParameter(n.SCISSOR_BOX),se=n.getParameter(n.VIEWPORT),ee=new Vt().fromArray(ce),re=new Vt().fromArray(se);function ve(O,he,Be,Ye){const Ue=new Uint8Array(4),Dt=n.createTexture();n.bindTexture(O,Dt),n.texParameteri(O,n.TEXTURE_MIN_FILTER,n.NEAREST),n.texParameteri(O,n.TEXTURE_MAG_FILTER,n.NEAREST);for(let Ut=0;Ut"u"?!1:/OculusBrowser/g.test(navigator.userAgent),m=new WeakMap;let v;const y=new WeakMap;let A=!1;try{A=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function b(T,X){return A?new OffscreenCanvas(T,X):Cu("canvas")}function f(T,X,ge,Ge){let Ze=1;if((T.width>Ge||T.height>Ge)&&(Ze=Ge/Math.max(T.width,T.height)),Ze<1||X===!0)if(typeof HTMLImageElement<"u"&&T instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&T instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&T instanceof ImageBitmap){const Me=X?m1:Math.floor,gt=Me(Ze*T.width),Ke=Me(Ze*T.height);v===void 0&&(v=b(gt,Ke));const pe=ge?b(gt,Ke):v;return pe.width=gt,pe.height=Ke,pe.getContext("2d").drawImage(T,0,0,gt,Ke),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+T.width+"x"+T.height+") to ("+gt+"x"+Ke+")."),pe}else return"data"in T&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+T.width+"x"+T.height+")."),T;return T}function B(T){return $0(T.width)&&$0(T.height)}function S(T){return a?!1:T.wrapS!==zn||T.wrapT!==zn||T.minFilter!==pt&&T.minFilter!==je}function x(T,X){return T.generateMipmaps&&X&&T.minFilter!==pt&&T.minFilter!==je}function R(T){n.generateMipmap(T)}function M(T,X,ge,Ge,Ze=!1){if(a===!1)return X;if(T!==null){if(n[T]!==void 0)return n[T];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+T+"'")}let Me=X;return X===n.RED&&(ge===n.FLOAT&&(Me=n.R32F),ge===n.HALF_FLOAT&&(Me=n.R16F),ge===n.UNSIGNED_BYTE&&(Me=n.R8)),X===n.RG&&(ge===n.FLOAT&&(Me=n.RG32F),ge===n.HALF_FLOAT&&(Me=n.RG16F),ge===n.UNSIGNED_BYTE&&(Me=n.RG8)),X===n.RGBA&&(ge===n.FLOAT&&(Me=n.RGBA32F),ge===n.HALF_FLOAT&&(Me=n.RGBA16F),ge===n.UNSIGNED_BYTE&&(Me=Ge===mt&&Ze===!1?n.SRGB8_ALPHA8:n.RGBA8),ge===n.UNSIGNED_SHORT_4_4_4_4&&(Me=n.RGBA4),ge===n.UNSIGNED_SHORT_5_5_5_1&&(Me=n.RGB5_A1)),(Me===n.R16F||Me===n.R32F||Me===n.RG16F||Me===n.RG32F||Me===n.RGBA16F||Me===n.RGBA32F)&&e.get("EXT_color_buffer_float"),Me}function Z(T,X,ge){return x(T,ge)===!0||T.isFramebufferTexture&&T.minFilter!==pt&&T.minFilter!==je?Math.log2(Math.max(X.width,X.height))+1:T.mipmaps!==void 0&&T.mipmaps.length>0?T.mipmaps.length:T.isCompressedTexture&&Array.isArray(T.image)?X.mipmaps.length:1}function V(T){return T===pt||T===sA||T===MI?n.NEAREST:n.LINEAR}function N(T){const X=T.target;X.removeEventListener("dispose",N),k(X),X.isVideoTexture&&m.delete(X)}function D(T){const X=T.target;X.removeEventListener("dispose",D),te(X)}function k(T){const X=i.get(T);if(X.__webglInit===void 0)return;const ge=T.source,Ge=y.get(ge);if(Ge){const Ze=Ge[X.__cacheKey];Ze.usedTimes--,Ze.usedTimes===0&&$(T),Object.keys(Ge).length===0&&y.delete(ge)}i.remove(T)}function $(T){const X=i.get(T);n.deleteTexture(X.__webglTexture);const ge=T.source,Ge=y.get(ge);delete Ge[X.__cacheKey],o.memory.textures--}function te(T){const X=T.texture,ge=i.get(T),Ge=i.get(X);if(Ge.__webglTexture!==void 0&&(n.deleteTexture(Ge.__webglTexture),o.memory.textures--),T.depthTexture&&T.depthTexture.dispose(),T.isWebGLCubeRenderTarget)for(let Ze=0;Ze<6;Ze++)n.deleteFramebuffer(ge.__webglFramebuffer[Ze]),ge.__webglDepthbuffer&&n.deleteRenderbuffer(ge.__webglDepthbuffer[Ze]);else{if(n.deleteFramebuffer(ge.__webglFramebuffer),ge.__webglDepthbuffer&&n.deleteRenderbuffer(ge.__webglDepthbuffer),ge.__webglMultisampledFramebuffer&&n.deleteFramebuffer(ge.__webglMultisampledFramebuffer),ge.__webglColorRenderbuffer)for(let Ze=0;Ze=l&&console.warn("THREE.WebGLTextures: Trying to use "+T+" texture units while this GPU supports only "+l),Ce+=1,T}function J(T){const X=[];return X.push(T.wrapS),X.push(T.wrapT),X.push(T.wrapR||0),X.push(T.magFilter),X.push(T.minFilter),X.push(T.anisotropy),X.push(T.internalFormat),X.push(T.format),X.push(T.type),X.push(T.generateMipmaps),X.push(T.premultiplyAlpha),X.push(T.flipY),X.push(T.unpackAlignment),X.push(T.colorSpace),X.join()}function P(T,X){const ge=i.get(T);if(T.isVideoTexture&&ut(T),T.isRenderTargetTexture===!1&&T.version>0&&ge.__version!==T.version){const Ge=T.image;if(Ge===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(Ge.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{nt(ge,T,X);return}}t.bindTexture(n.TEXTURE_2D,ge.__webglTexture,n.TEXTURE0+X)}function ce(T,X){const ge=i.get(T);if(T.version>0&&ge.__version!==T.version){nt(ge,T,X);return}t.bindTexture(n.TEXTURE_2D_ARRAY,ge.__webglTexture,n.TEXTURE0+X)}function se(T,X){const ge=i.get(T);if(T.version>0&&ge.__version!==T.version){nt(ge,T,X);return}t.bindTexture(n.TEXTURE_3D,ge.__webglTexture,n.TEXTURE0+X)}function ee(T,X){const ge=i.get(T);if(T.version>0&&ge.__version!==T.version){lt(ge,T,X);return}t.bindTexture(n.TEXTURE_CUBE_MAP,ge.__webglTexture,n.TEXTURE0+X)}const re={[hs]:n.REPEAT,[zn]:n.CLAMP_TO_EDGE,[lu]:n.MIRRORED_REPEAT},ve={[pt]:n.NEAREST,[sA]:n.NEAREST_MIPMAP_NEAREST,[MI]:n.NEAREST_MIPMAP_LINEAR,[je]:n.LINEAR,[Zv]:n.LINEAR_MIPMAP_NEAREST,[la]:n.LINEAR_MIPMAP_LINEAR};function ye(T,X,ge){if(ge?(n.texParameteri(T,n.TEXTURE_WRAP_S,re[X.wrapS]),n.texParameteri(T,n.TEXTURE_WRAP_T,re[X.wrapT]),(T===n.TEXTURE_3D||T===n.TEXTURE_2D_ARRAY)&&n.texParameteri(T,n.TEXTURE_WRAP_R,re[X.wrapR]),n.texParameteri(T,n.TEXTURE_MAG_FILTER,ve[X.magFilter]),n.texParameteri(T,n.TEXTURE_MIN_FILTER,ve[X.minFilter])):(n.texParameteri(T,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(T,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),(T===n.TEXTURE_3D||T===n.TEXTURE_2D_ARRAY)&&n.texParameteri(T,n.TEXTURE_WRAP_R,n.CLAMP_TO_EDGE),(X.wrapS!==zn||X.wrapT!==zn)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),n.texParameteri(T,n.TEXTURE_MAG_FILTER,V(X.magFilter)),n.texParameteri(T,n.TEXTURE_MIN_FILTER,V(X.minFilter)),X.minFilter!==pt&&X.minFilter!==je&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),e.has("EXT_texture_filter_anisotropic")===!0){const Ge=e.get("EXT_texture_filter_anisotropic");if(X.magFilter===pt||X.minFilter!==MI&&X.minFilter!==la||X.type===wn&&e.has("OES_texture_float_linear")===!1||a===!1&&X.type===us&&e.has("OES_texture_half_float_linear")===!1)return;(X.anisotropy>1||i.get(X).__currentAnisotropy)&&(n.texParameterf(T,Ge.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(X.anisotropy,s.getMaxAnisotropy())),i.get(X).__currentAnisotropy=X.anisotropy)}}function _(T,X){let ge=!1;T.__webglInit===void 0&&(T.__webglInit=!0,X.addEventListener("dispose",N));const Ge=X.source;let Ze=y.get(Ge);Ze===void 0&&(Ze={},y.set(Ge,Ze));const Me=J(X);if(Me!==T.__cacheKey){Ze[Me]===void 0&&(Ze[Me]={texture:n.createTexture(),usedTimes:0},o.memory.textures++,ge=!0),Ze[Me].usedTimes++;const gt=Ze[T.__cacheKey];gt!==void 0&&(Ze[T.__cacheKey].usedTimes--,gt.usedTimes===0&&$(X)),T.__cacheKey=Me,T.__webglTexture=Ze[Me].texture}return ge}function nt(T,X,ge){let Ge=n.TEXTURE_2D;(X.isDataArrayTexture||X.isCompressedArrayTexture)&&(Ge=n.TEXTURE_2D_ARRAY),X.isData3DTexture&&(Ge=n.TEXTURE_3D);const Ze=_(T,X),Me=X.source;t.bindTexture(Ge,T.__webglTexture,n.TEXTURE0+ge);const gt=i.get(Me);if(Me.version!==gt.__version||Ze===!0){t.activeTexture(n.TEXTURE0+ge),n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,X.flipY),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,X.premultiplyAlpha),n.pixelStorei(n.UNPACK_ALIGNMENT,X.unpackAlignment),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,n.NONE);const Ke=S(X)&&B(X.image)===!1;let pe=f(X.image,Ke,!1,u);pe=Nt(X,pe);const De=B(pe)||a,$e=r.convert(X.format,X.colorSpace);let ot=r.convert(X.type),Te=M(X.internalFormat,$e,ot,X.colorSpace);ye(Ge,X,De);let Oe;const Wt=X.mipmaps,Et=a&&X.isVideoTexture!==!0,Cn=gt.__version===void 0||Ze===!0,O=Z(X,pe,De);if(X.isDepthTexture)Te=n.DEPTH_COMPONENT,a?X.type===wn?Te=n.DEPTH_COMPONENT32F:X.type===oo?Te=n.DEPTH_COMPONENT24:X.type===ta?Te=n.DEPTH24_STENCIL8:Te=n.DEPTH_COMPONENT16:X.type===wn&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),X.format===na&&Te===n.DEPTH_COMPONENT&&X.type!==wv&&X.type!==oo&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),X.type=oo,ot=r.convert(X.type)),X.format===ga&&Te===n.DEPTH_COMPONENT&&(Te=n.DEPTH_STENCIL,X.type!==ta&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),X.type=ta,ot=r.convert(X.type))),Cn&&(Et?t.texStorage2D(n.TEXTURE_2D,1,Te,pe.width,pe.height):t.texImage2D(n.TEXTURE_2D,0,Te,pe.width,pe.height,0,$e,ot,null));else if(X.isDataTexture)if(Wt.length>0&&De){Et&&Cn&&t.texStorage2D(n.TEXTURE_2D,O,Te,Wt[0].width,Wt[0].height);for(let he=0,Be=Wt.length;he>=1,Be>>=1}}else if(Wt.length>0&&De){Et&&Cn&&t.texStorage2D(n.TEXTURE_2D,O,Te,Wt[0].width,Wt[0].height);for(let he=0,Be=Wt.length;he0&&Cn++,t.texStorage2D(n.TEXTURE_CUBE_MAP,Cn,Oe,pe[0].width,pe[0].height));for(let he=0;he<6;he++)if(Ke){Wt?t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+he,0,0,0,pe[he].width,pe[he].height,ot,Te,pe[he].data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+he,0,Oe,pe[he].width,pe[he].height,0,ot,Te,pe[he].data);for(let Be=0;Be=n.TEXTURE_CUBE_MAP_POSITIVE_X&&Ze<=n.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&n.framebufferTexture2D(n.FRAMEBUFFER,Ge,Ze,i.get(ge).__webglTexture,0),t.bindFramebuffer(n.FRAMEBUFFER,null)}function Xe(T,X,ge){if(n.bindRenderbuffer(n.RENDERBUFFER,T),X.depthBuffer&&!X.stencilBuffer){let Ge=n.DEPTH_COMPONENT16;if(ge||qe(X)){const Ze=X.depthTexture;Ze&&Ze.isDepthTexture&&(Ze.type===wn?Ge=n.DEPTH_COMPONENT32F:Ze.type===oo&&(Ge=n.DEPTH_COMPONENT24));const Me=rt(X);qe(X)?d.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,Me,Ge,X.width,X.height):n.renderbufferStorageMultisample(n.RENDERBUFFER,Me,Ge,X.width,X.height)}else n.renderbufferStorage(n.RENDERBUFFER,Ge,X.width,X.height);n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,T)}else if(X.depthBuffer&&X.stencilBuffer){const Ge=rt(X);ge&&qe(X)===!1?n.renderbufferStorageMultisample(n.RENDERBUFFER,Ge,n.DEPTH24_STENCIL8,X.width,X.height):qe(X)?d.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,Ge,n.DEPTH24_STENCIL8,X.width,X.height):n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_STENCIL,X.width,X.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.RENDERBUFFER,T)}else{const Ge=X.isWebGLMultipleRenderTargets===!0?X.texture:[X.texture];for(let Ze=0;Ze0&&qe(T)===!1){const Ke=Me?X:[X];ge.__webglMultisampledFramebuffer=n.createFramebuffer(),ge.__webglColorRenderbuffer=[],t.bindFramebuffer(n.FRAMEBUFFER,ge.__webglMultisampledFramebuffer);for(let pe=0;pe0&&qe(T)===!1){const X=T.isWebGLMultipleRenderTargets?T.texture:[T.texture],ge=T.width,Ge=T.height;let Ze=n.COLOR_BUFFER_BIT;const Me=[],gt=T.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,Ke=i.get(T),pe=T.isWebGLMultipleRenderTargets===!0;if(pe)for(let De=0;De0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&X.__useRenderToTexture!==!1}function ut(T){const X=o.render.frame;m.get(T)!==X&&(m.set(T,X),T.update())}function Nt(T,X){const ge=T.colorSpace,Ge=T.format,Ze=T.type;return T.isCompressedTexture===!0||T.format===oA||ge!==ur&&ge!==co&&(ge===mt?a===!1?e.has("EXT_sRGB")===!0&&Ge===un?(T.format=oA,T.minFilter=je,T.generateMipmaps=!1):X=Mv.sRGBToLinear(X):(Ge!==un||Ze!==rn)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",ge)),X}this.allocateTextureUnit=L,this.resetTextureUnits=le,this.setTexture2D=P,this.setTexture2DArray=ce,this.setTexture3D=se,this.setTextureCube=ee,this.rebindTextures=be,this.setupRenderTarget=Le,this.updateRenderTargetMipmap=Ve,this.updateMultisampleRenderTarget=st,this.setupDepthRenderbuffer=ue,this.setupFrameBufferTexture=Se,this.useMultisampledRTT=qe}function W1(n,e,t){const i=t.isWebGL2;function s(r,o=co){let a;if(r===rn)return n.UNSIGNED_BYTE;if(r===n1)return n.UNSIGNED_SHORT_4_4_4_4;if(r===i1)return n.UNSIGNED_SHORT_5_5_5_1;if(r===$R)return n.BYTE;if(r===e1)return n.SHORT;if(r===wv)return n.UNSIGNED_SHORT;if(r===t1)return n.INT;if(r===oo)return n.UNSIGNED_INT;if(r===wn)return n.FLOAT;if(r===us)return i?n.HALF_FLOAT:(a=e.get("OES_texture_half_float"),a!==null?a.HALF_FLOAT_OES:null);if(r===s1)return n.ALPHA;if(r===un)return n.RGBA;if(r===WA)return n.LUMINANCE;if(r===r1)return n.LUMINANCE_ALPHA;if(r===na)return n.DEPTH_COMPONENT;if(r===ga)return n.DEPTH_STENCIL;if(r===oA)return a=e.get("EXT_sRGB"),a!==null?a.SRGB_ALPHA_EXT:null;if(r===Sv)return n.RED;if(r===o1)return n.RED_INTEGER;if(r===xv)return n.RG;if(r===a1)return n.RG_INTEGER;if(r===l1)return n.RGBA_INTEGER;if(r===yh||r===Gh||r===Bh||r===Zh)if(o===mt)if(a=e.get("WEBGL_compressed_texture_s3tc_srgb"),a!==null){if(r===yh)return a.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(r===Gh)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(r===Bh)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(r===Zh)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(a=e.get("WEBGL_compressed_texture_s3tc"),a!==null){if(r===yh)return a.COMPRESSED_RGB_S3TC_DXT1_EXT;if(r===Gh)return a.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(r===Bh)return a.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(r===Zh)return a.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(r===W0||r===V0||r===M0||r===N0)if(a=e.get("WEBGL_compressed_texture_pvrtc"),a!==null){if(r===W0)return a.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(r===V0)return a.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(r===M0)return a.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(r===N0)return a.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(r===g1)return a=e.get("WEBGL_compressed_texture_etc1"),a!==null?a.COMPRESSED_RGB_ETC1_WEBGL:null;if(r===H0||r===X0)if(a=e.get("WEBGL_compressed_texture_etc"),a!==null){if(r===H0)return o===mt?a.COMPRESSED_SRGB8_ETC2:a.COMPRESSED_RGB8_ETC2;if(r===X0)return o===mt?a.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:a.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(r===Y0||r===F0||r===K0||r===z0||r===L0||r===T0||r===E0||r===k0||r===D0||r===U0||r===P0||r===_0||r===J0||r===O0)if(a=e.get("WEBGL_compressed_texture_astc"),a!==null){if(r===Y0)return o===mt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:a.COMPRESSED_RGBA_ASTC_4x4_KHR;if(r===F0)return o===mt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:a.COMPRESSED_RGBA_ASTC_5x4_KHR;if(r===K0)return o===mt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:a.COMPRESSED_RGBA_ASTC_5x5_KHR;if(r===z0)return o===mt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:a.COMPRESSED_RGBA_ASTC_6x5_KHR;if(r===L0)return o===mt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:a.COMPRESSED_RGBA_ASTC_6x6_KHR;if(r===T0)return o===mt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:a.COMPRESSED_RGBA_ASTC_8x5_KHR;if(r===E0)return o===mt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:a.COMPRESSED_RGBA_ASTC_8x6_KHR;if(r===k0)return o===mt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:a.COMPRESSED_RGBA_ASTC_8x8_KHR;if(r===D0)return o===mt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:a.COMPRESSED_RGBA_ASTC_10x5_KHR;if(r===U0)return o===mt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:a.COMPRESSED_RGBA_ASTC_10x6_KHR;if(r===P0)return o===mt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:a.COMPRESSED_RGBA_ASTC_10x8_KHR;if(r===_0)return o===mt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:a.COMPRESSED_RGBA_ASTC_10x10_KHR;if(r===J0)return o===mt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:a.COMPRESSED_RGBA_ASTC_12x10_KHR;if(r===O0)return o===mt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:a.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(r===wh)if(a=e.get("EXT_texture_compression_bptc"),a!==null){if(r===wh)return o===mt?a.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:a.COMPRESSED_RGBA_BPTC_UNORM_EXT}else return null;if(r===c1||r===Q0||r===j0||r===q0)if(a=e.get("EXT_texture_compression_rgtc"),a!==null){if(r===wh)return a.COMPRESSED_RED_RGTC1_EXT;if(r===Q0)return a.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(r===j0)return a.COMPRESSED_RED_GREEN_RGTC2_EXT;if(r===q0)return a.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return r===ta?i?n.UNSIGNED_INT_24_8:(a=e.get("WEBGL_depth_texture"),a!==null?a.UNSIGNED_INT_24_8_WEBGL:null):n[r]!==void 0?n[r]:null}return{convert:s}}class V1 extends An{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class Rg extends Ht{constructor(){super(),this.isGroup=!0,this.type="Group"}}const uK={type:"move"};class qm{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Rg,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 Rg,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new H,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new H),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Rg,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new H,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new H),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 i of e.hand.values())this._getHandJoint(t,i)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,i){let s=null,r=null,o=null;const a=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){o=!0;for(const v of e.hand.values()){const y=t.getJointPose(v,i),A=this._getHandJoint(c,v);y!==null&&(A.matrix.fromArray(y.transform.matrix),A.matrix.decompose(A.position,A.rotation,A.scale),A.matrixWorldNeedsUpdate=!0,A.jointRadius=y.radius),A.visible=y!==null}const u=c.joints["index-finger-tip"],C=c.joints["thumb-tip"],d=u.position.distanceTo(C.position),h=.02,m=.005;c.inputState.pinching&&d>h+m?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&d<=h-m&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(r=t.getPose(e.gripSpace,i),r!==null&&(l.matrix.fromArray(r.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,r.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(r.linearVelocity)):l.hasLinearVelocity=!1,r.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(r.angularVelocity)):l.hasAngularVelocity=!1));a!==null&&(s=t.getPose(e.targetRaySpace,i),s===null&&r!==null&&(s=r),s!==null&&(a.matrix.fromArray(s.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,s.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(s.linearVelocity)):a.hasLinearVelocity=!1,s.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(s.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(uK)))}return a!==null&&(a.visible=s!==null),l!==null&&(l.visible=r!==null),c!==null&&(c.visible=o!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const i=new Rg;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[t.jointName]=i,e.add(i)}return e.joints[t.jointName]}}class FA extends qt{constructor(e,t,i,s,r,o,a,l,c,u){if(u=u!==void 0?u:na,u!==na&&u!==ga)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");i===void 0&&u===na&&(i=oo),i===void 0&&u===ga&&(i=ta),super(null,s,r,o,a,l,u,i,c),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=a!==void 0?a:pt,this.minFilter=l!==void 0?l:pt,this.flipY=!1,this.generateMipmaps=!1}}class CK extends zs{constructor(e,t){super();const i=this;let s=null,r=1,o=null,a="local-floor",l=1,c=null,u=null,C=null,d=null,h=null,m=null;const v=t.getContextAttributes();let y=null,A=null;const b=[],f=[],B=new Set,S=new Map,x=new An;x.layers.enable(1),x.viewport=new Vt;const R=new An;R.layers.enable(2),R.viewport=new Vt;const M=[x,R],Z=new V1;Z.layers.enable(1),Z.layers.enable(2);let V=null,N=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(ee){let re=b[ee];return re===void 0&&(re=new qm,b[ee]=re),re.getTargetRaySpace()},this.getControllerGrip=function(ee){let re=b[ee];return re===void 0&&(re=new qm,b[ee]=re),re.getGripSpace()},this.getHand=function(ee){let re=b[ee];return re===void 0&&(re=new qm,b[ee]=re),re.getHandSpace()};function D(ee){const re=f.indexOf(ee.inputSource);if(re===-1)return;const ve=b[re];ve!==void 0&&(ve.update(ee.inputSource,ee.frame,c||o),ve.dispatchEvent({type:ee.type,data:ee.inputSource}))}function k(){s.removeEventListener("select",D),s.removeEventListener("selectstart",D),s.removeEventListener("selectend",D),s.removeEventListener("squeeze",D),s.removeEventListener("squeezestart",D),s.removeEventListener("squeezeend",D),s.removeEventListener("end",k),s.removeEventListener("inputsourceschange",$);for(let ee=0;ee=0&&(f[ye]=null,b[ye].disconnect(ve))}for(let re=0;re=f.length){f.push(ve),ye=nt;break}else if(f[nt]===null){f[nt]=ve,ye=nt;break}if(ye===-1)break}const _=b[ye];_&&_.connect(ve)}}const te=new H,Ce=new H;function le(ee,re,ve){te.setFromMatrixPosition(re.matrixWorld),Ce.setFromMatrixPosition(ve.matrixWorld);const ye=te.distanceTo(Ce),_=re.projectionMatrix.elements,nt=ve.projectionMatrix.elements,lt=_[14]/(_[10]-1),Se=_[14]/(_[10]+1),Xe=(_[9]+1)/_[5],fe=(_[9]-1)/_[5],ue=(_[8]-1)/_[0],be=(nt[8]+1)/nt[0],Le=lt*ue,Ve=lt*be,st=ye/(-ue+be),rt=st*-ue;re.matrixWorld.decompose(ee.position,ee.quaternion,ee.scale),ee.translateX(rt),ee.translateZ(st),ee.matrixWorld.compose(ee.position,ee.quaternion,ee.scale),ee.matrixWorldInverse.copy(ee.matrixWorld).invert();const qe=lt+st,ut=Se+st,Nt=Le-rt,T=Ve+(ye-rt),X=Xe*Se/ut*qe,ge=fe*Se/ut*qe;ee.projectionMatrix.makePerspective(Nt,T,X,ge,qe,ut),ee.projectionMatrixInverse.copy(ee.projectionMatrix).invert()}function L(ee,re){re===null?ee.matrixWorld.copy(ee.matrix):ee.matrixWorld.multiplyMatrices(re.matrixWorld,ee.matrix),ee.matrixWorldInverse.copy(ee.matrixWorld).invert()}this.updateCamera=function(ee){if(s===null)return;Z.near=R.near=x.near=ee.near,Z.far=R.far=x.far=ee.far,(V!==Z.near||N!==Z.far)&&(s.updateRenderState({depthNear:Z.near,depthFar:Z.far}),V=Z.near,N=Z.far);const re=ee.parent,ve=Z.cameras;L(Z,re);for(let ye=0;ye_&&(S.set(ye,ye.lastChangedTime),i.dispatchEvent({type:"planechanged",data:ye}))}}m=null}const se=new Z1;se.setAnimationLoop(ce),this.setAnimationLoop=function(ee){P=ee},this.dispose=function(){}}}function dK(n,e){function t(y,A){y.matrixAutoUpdate===!0&&y.updateMatrix(),A.value.copy(y.matrix)}function i(y,A){A.color.getRGB(y.fogColor.value,G1(n)),A.isFog?(y.fogNear.value=A.near,y.fogFar.value=A.far):A.isFogExp2&&(y.fogDensity.value=A.density)}function s(y,A,b,f,B){A.isMeshBasicMaterial||A.isMeshLambertMaterial?r(y,A):A.isMeshToonMaterial?(r(y,A),C(y,A)):A.isMeshPhongMaterial?(r(y,A),u(y,A)):A.isMeshStandardMaterial?(r(y,A),d(y,A),A.isMeshPhysicalMaterial&&h(y,A,B)):A.isMeshMatcapMaterial?(r(y,A),m(y,A)):A.isMeshDepthMaterial?r(y,A):A.isMeshDistanceMaterial?(r(y,A),v(y,A)):A.isMeshNormalMaterial?r(y,A):A.isLineBasicMaterial?(o(y,A),A.isLineDashedMaterial&&a(y,A)):A.isPointsMaterial?l(y,A,b,f):A.isSpriteMaterial?c(y,A):A.isShadowMaterial?(y.color.value.copy(A.color),y.opacity.value=A.opacity):A.isShaderMaterial&&(A.uniformsNeedUpdate=!1)}function r(y,A){y.opacity.value=A.opacity,A.color&&y.diffuse.value.copy(A.color),A.emissive&&y.emissive.value.copy(A.emissive).multiplyScalar(A.emissiveIntensity),A.map&&(y.map.value=A.map,t(A.map,y.mapTransform)),A.alphaMap&&(y.alphaMap.value=A.alphaMap,t(A.alphaMap,y.alphaMapTransform)),A.bumpMap&&(y.bumpMap.value=A.bumpMap,t(A.bumpMap,y.bumpMapTransform),y.bumpScale.value=A.bumpScale,A.side===Tn&&(y.bumpScale.value*=-1)),A.normalMap&&(y.normalMap.value=A.normalMap,t(A.normalMap,y.normalMapTransform),y.normalScale.value.copy(A.normalScale),A.side===Tn&&y.normalScale.value.negate()),A.displacementMap&&(y.displacementMap.value=A.displacementMap,t(A.displacementMap,y.displacementMapTransform),y.displacementScale.value=A.displacementScale,y.displacementBias.value=A.displacementBias),A.emissiveMap&&(y.emissiveMap.value=A.emissiveMap,t(A.emissiveMap,y.emissiveMapTransform)),A.specularMap&&(y.specularMap.value=A.specularMap,t(A.specularMap,y.specularMapTransform)),A.alphaTest>0&&(y.alphaTest.value=A.alphaTest);const b=e.get(A).envMap;if(b&&(y.envMap.value=b,y.flipEnvMap.value=b.isCubeTexture&&b.isRenderTargetTexture===!1?-1:1,y.reflectivity.value=A.reflectivity,y.ior.value=A.ior,y.refractionRatio.value=A.refractionRatio),A.lightMap){y.lightMap.value=A.lightMap;const f=n.useLegacyLights===!0?Math.PI:1;y.lightMapIntensity.value=A.lightMapIntensity*f,t(A.lightMap,y.lightMapTransform)}A.aoMap&&(y.aoMap.value=A.aoMap,y.aoMapIntensity.value=A.aoMapIntensity,t(A.aoMap,y.aoMapTransform))}function o(y,A){y.diffuse.value.copy(A.color),y.opacity.value=A.opacity,A.map&&(y.map.value=A.map,t(A.map,y.mapTransform))}function a(y,A){y.dashSize.value=A.dashSize,y.totalSize.value=A.dashSize+A.gapSize,y.scale.value=A.scale}function l(y,A,b,f){y.diffuse.value.copy(A.color),y.opacity.value=A.opacity,y.size.value=A.size*b,y.scale.value=f*.5,A.map&&(y.map.value=A.map,t(A.map,y.uvTransform)),A.alphaMap&&(y.alphaMap.value=A.alphaMap),A.alphaTest>0&&(y.alphaTest.value=A.alphaTest)}function c(y,A){y.diffuse.value.copy(A.color),y.opacity.value=A.opacity,y.rotation.value=A.rotation,A.map&&(y.map.value=A.map,t(A.map,y.mapTransform)),A.alphaMap&&(y.alphaMap.value=A.alphaMap),A.alphaTest>0&&(y.alphaTest.value=A.alphaTest)}function u(y,A){y.specular.value.copy(A.specular),y.shininess.value=Math.max(A.shininess,1e-4)}function C(y,A){A.gradientMap&&(y.gradientMap.value=A.gradientMap)}function d(y,A){y.metalness.value=A.metalness,A.metalnessMap&&(y.metalnessMap.value=A.metalnessMap,t(A.metalnessMap,y.metalnessMapTransform)),y.roughness.value=A.roughness,A.roughnessMap&&(y.roughnessMap.value=A.roughnessMap,t(A.roughnessMap,y.roughnessMapTransform)),e.get(A).envMap&&(y.envMapIntensity.value=A.envMapIntensity)}function h(y,A,b){y.ior.value=A.ior,A.sheen>0&&(y.sheenColor.value.copy(A.sheenColor).multiplyScalar(A.sheen),y.sheenRoughness.value=A.sheenRoughness,A.sheenColorMap&&(y.sheenColorMap.value=A.sheenColorMap,t(A.sheenColorMap,y.sheenColorMapTransform)),A.sheenRoughnessMap&&(y.sheenRoughnessMap.value=A.sheenRoughnessMap,t(A.sheenRoughnessMap,y.sheenRoughnessMapTransform))),A.clearcoat>0&&(y.clearcoat.value=A.clearcoat,y.clearcoatRoughness.value=A.clearcoatRoughness,A.clearcoatMap&&(y.clearcoatMap.value=A.clearcoatMap,t(A.clearcoatMap,y.clearcoatMapTransform)),A.clearcoatRoughnessMap&&(y.clearcoatRoughnessMap.value=A.clearcoatRoughnessMap,t(A.clearcoatRoughnessMap,y.clearcoatRoughnessMapTransform)),A.clearcoatNormalMap&&(y.clearcoatNormalMap.value=A.clearcoatNormalMap,t(A.clearcoatNormalMap,y.clearcoatNormalMapTransform),y.clearcoatNormalScale.value.copy(A.clearcoatNormalScale),A.side===Tn&&y.clearcoatNormalScale.value.negate())),A.iridescence>0&&(y.iridescence.value=A.iridescence,y.iridescenceIOR.value=A.iridescenceIOR,y.iridescenceThicknessMinimum.value=A.iridescenceThicknessRange[0],y.iridescenceThicknessMaximum.value=A.iridescenceThicknessRange[1],A.iridescenceMap&&(y.iridescenceMap.value=A.iridescenceMap,t(A.iridescenceMap,y.iridescenceMapTransform)),A.iridescenceThicknessMap&&(y.iridescenceThicknessMap.value=A.iridescenceThicknessMap,t(A.iridescenceThicknessMap,y.iridescenceThicknessMapTransform))),A.transmission>0&&(y.transmission.value=A.transmission,y.transmissionSamplerMap.value=b.texture,y.transmissionSamplerSize.value.set(b.width,b.height),A.transmissionMap&&(y.transmissionMap.value=A.transmissionMap,t(A.transmissionMap,y.transmissionMapTransform)),y.thickness.value=A.thickness,A.thicknessMap&&(y.thicknessMap.value=A.thicknessMap,t(A.thicknessMap,y.thicknessMapTransform)),y.attenuationDistance.value=A.attenuationDistance,y.attenuationColor.value.copy(A.attenuationColor)),y.specularIntensity.value=A.specularIntensity,y.specularColor.value.copy(A.specularColor),A.specularColorMap&&(y.specularColorMap.value=A.specularColorMap,t(A.specularColorMap,y.specularColorMapTransform)),A.specularIntensityMap&&(y.specularIntensityMap.value=A.specularIntensityMap,t(A.specularIntensityMap,y.specularIntensityMapTransform))}function m(y,A){A.matcap&&(y.matcap.value=A.matcap)}function v(y,A){const b=e.get(A).light;y.referencePosition.value.setFromMatrixPosition(b.matrixWorld),y.nearDistance.value=b.shadow.camera.near,y.farDistance.value=b.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:s}}function hK(n,e,t,i){let s={},r={},o=[];const a=t.isWebGL2?n.getParameter(n.MAX_UNIFORM_BUFFER_BINDINGS):0;function l(b,f){const B=f.program;i.uniformBlockBinding(b,B)}function c(b,f){let B=s[b.id];B===void 0&&(m(b),B=u(b),s[b.id]=B,b.addEventListener("dispose",y));const S=f.program;i.updateUBOMapping(b,S);const x=e.render.frame;r[b.id]!==x&&(d(b),r[b.id]=x)}function u(b){const f=C();b.__bindingPointIndex=f;const B=n.createBuffer(),S=b.__size,x=b.usage;return n.bindBuffer(n.UNIFORM_BUFFER,B),n.bufferData(n.UNIFORM_BUFFER,S,x),n.bindBuffer(n.UNIFORM_BUFFER,null),n.bindBufferBase(n.UNIFORM_BUFFER,f,B),B}function C(){for(let b=0;b0){x=B%S;const D=S-x;x!==0&&D-V.boundary<0&&(B+=S-x,Z.__offset=B)}B+=V.storage}return x=B%S,x>0&&(B+=S-x),b.__size=B,b.__cache={},this}function v(b){const f={boundary:0,storage:0};return typeof b=="number"?(f.boundary=4,f.storage=4):b.isVector2?(f.boundary=8,f.storage=8):b.isVector3||b.isColor?(f.boundary=16,f.storage=12):b.isVector4?(f.boundary=16,f.storage=16):b.isMatrix3?(f.boundary=48,f.storage=48):b.isMatrix4?(f.boundary=64,f.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),f}function y(b){const f=b.target;f.removeEventListener("dispose",y);const B=o.indexOf(f.__bindingPointIndex);o.splice(B,1),n.deleteBuffer(s[f.id]),delete s[f.id],delete r[f.id]}function A(){for(const b in s)n.deleteBuffer(s[b]);o=[],s={},r={}}return{bind:l,update:c,dispose:A}}function AK(){const n=Cu("canvas");return n.style.display="block",n}class Kv{constructor(e={}){const{canvas:t=AK(),context:i=null,depth:s=!0,stencil:r=!0,alpha:o=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:C=!1}=e;this.isWebGLRenderer=!0;let d;i!==null?d=i.getContextAttributes().alpha:d=o;let h=null,m=null;const v=[],y=[];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=mt,this.useLegacyLights=!0,this.toneMapping=gr,this.toneMappingExposure=1;const A=this;let b=!1,f=0,B=0,S=null,x=-1,R=null;const M=new Vt,Z=new Vt;let V=null,N=t.width,D=t.height,k=1,$=null,te=null;const Ce=new Vt(0,0,N,D),le=new Vt(0,0,N,D);let L=!1;const J=new HA;let P=!1,ce=!1,se=null;const ee=new Fe,re=new H,ve={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function ye(){return S===null?k:1}let _=i;function nt(Y,ae){for(let Ae=0;Ae0?m=y[y.length-1]:m=null,v.pop(),v.length>0?h=v[v.length-1]:h=null};function Jn(Y,ae,Ae,ie){if(Y.visible===!1)return;if(Y.layers.test(ae.layers)){if(Y.isGroup)Ae=Y.renderOrder;else if(Y.isLOD)Y.autoUpdate===!0&&Y.update(ae);else if(Y.isLight)m.pushLight(Y),Y.castShadow&&m.pushShadow(Y);else if(Y.isSprite){if(!Y.frustumCulled||J.intersectsSprite(Y)){ie&&re.setFromMatrixPosition(Y.matrixWorld).applyMatrix4(ee);const at=qe.update(Y),ct=Y.material;ct.visible&&h.push(Y,at,ct,Ae,re.z,null)}}else if((Y.isMesh||Y.isLine||Y.isPoints)&&(!Y.frustumCulled||J.intersectsObject(Y))){Y.isSkinnedMesh&&Y.skeleton.frame!==fe.render.frame&&(Y.skeleton.update(),Y.skeleton.frame=fe.render.frame);const at=qe.update(Y),ct=Y.material;if(ie&&(at.boundingSphere===null&&at.computeBoundingSphere(),re.copy(at.boundingSphere.center).applyMatrix4(Y.matrixWorld).applyMatrix4(ee)),Array.isArray(ct)){const ht=at.groups;for(let yt=0,Gt=ht.length;yt0&&gn(me,et,ae,Ae),ie&&Xe.viewport(M.copy(ie)),me.length>0&&yi(me,ae,Ae),et.length>0&&yi(et,ae,Ae),at.length>0&&yi(at,ae,Ae),Xe.buffers.depth.setTest(!0),Xe.buffers.depth.setMask(!0),Xe.buffers.color.setMask(!0),Xe.setPolygonOffset(!1)}function gn(Y,ae,Ae,ie){if(se===null){const ct=Se.isWebGL2;se=new Rt(1024,1024,{generateMipmaps:!0,type:lt.has("EXT_color_buffer_half_float")?us:rn,minFilter:la,samples:ct&&a===!0?4:0})}const me=A.getRenderTarget();A.setRenderTarget(se),A.clear();const et=A.toneMapping;A.toneMapping=gr,yi(Y,Ae,ie),be.updateMultisampleRenderTarget(se),be.updateRenderTargetMipmap(se);let at=!1;for(let ct=0,ht=ae.length;ct0&&be.useMultisampledRTT(Y)===!1?me=ue.get(Y).__webglMultisampledFramebuffer:me=Gt,M.copy(Y.viewport),Z.copy(Y.scissor),V=Y.scissorTest}else M.copy(Ce).multiplyScalar(k).floor(),Z.copy(le).multiplyScalar(k).floor(),V=L;if(Xe.bindFramebuffer(_.FRAMEBUFFER,me)&&Se.drawBuffers&&ie&&Xe.drawBuffers(Y,me),Xe.viewport(M),Xe.scissor(Z),Xe.setScissorTest(V),et){const ht=ue.get(Y.texture);_.framebufferTexture2D(_.FRAMEBUFFER,_.COLOR_ATTACHMENT0,_.TEXTURE_CUBE_MAP_POSITIVE_X+ae,ht.__webglTexture,Ae)}else if(at){const ht=ue.get(Y.texture),yt=ae||0;_.framebufferTextureLayer(_.FRAMEBUFFER,_.COLOR_ATTACHMENT0,ht.__webglTexture,Ae||0,yt)}x=-1},this.readRenderTargetPixels=function(Y,ae,Ae,ie,me,et,at){if(!(Y&&Y.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let ct=ue.get(Y).__webglFramebuffer;if(Y.isWebGLCubeRenderTarget&&at!==void 0&&(ct=ct[at]),ct){Xe.bindFramebuffer(_.FRAMEBUFFER,ct);try{const ht=Y.texture,yt=ht.format,Gt=ht.type;if(yt!==un&&pe.convert(yt)!==_.getParameter(_.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const wt=Gt===us&&(lt.has("EXT_color_buffer_half_float")||Se.isWebGL2&<.has("EXT_color_buffer_float"));if(Gt!==rn&&pe.convert(Gt)!==_.getParameter(_.IMPLEMENTATION_COLOR_READ_TYPE)&&!(Gt===wn&&(Se.isWebGL2||lt.has("OES_texture_float")||lt.has("WEBGL_color_buffer_float")))&&!wt){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}ae>=0&&ae<=Y.width-ie&&Ae>=0&&Ae<=Y.height-me&&_.readPixels(ae,Ae,ie,me,pe.convert(yt),pe.convert(Gt),et)}finally{const ht=S!==null?ue.get(S).__webglFramebuffer:null;Xe.bindFramebuffer(_.FRAMEBUFFER,ht)}}},this.copyFramebufferToTexture=function(Y,ae,Ae=0){const ie=Math.pow(2,-Ae),me=Math.floor(ae.image.width*ie),et=Math.floor(ae.image.height*ie);be.setTexture2D(ae,0),_.copyTexSubImage2D(_.TEXTURE_2D,Ae,0,0,Y.x,Y.y,me,et),Xe.unbindTexture()},this.copyTextureToTexture=function(Y,ae,Ae,ie=0){const me=ae.image.width,et=ae.image.height,at=pe.convert(Ae.format),ct=pe.convert(Ae.type);be.setTexture2D(Ae,0),_.pixelStorei(_.UNPACK_FLIP_Y_WEBGL,Ae.flipY),_.pixelStorei(_.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Ae.premultiplyAlpha),_.pixelStorei(_.UNPACK_ALIGNMENT,Ae.unpackAlignment),ae.isDataTexture?_.texSubImage2D(_.TEXTURE_2D,ie,Y.x,Y.y,me,et,at,ct,ae.image.data):ae.isCompressedTexture?_.compressedTexSubImage2D(_.TEXTURE_2D,ie,Y.x,Y.y,ae.mipmaps[0].width,ae.mipmaps[0].height,at,ae.mipmaps[0].data):_.texSubImage2D(_.TEXTURE_2D,ie,Y.x,Y.y,at,ct,ae.image),ie===0&&Ae.generateMipmaps&&_.generateMipmap(_.TEXTURE_2D),Xe.unbindTexture()},this.copyTextureToTexture3D=function(Y,ae,Ae,ie,me=0){if(A.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}const et=Y.max.x-Y.min.x+1,at=Y.max.y-Y.min.y+1,ct=Y.max.z-Y.min.z+1,ht=pe.convert(ie.format),yt=pe.convert(ie.type);let Gt;if(ie.isData3DTexture)be.setTexture3D(ie,0),Gt=_.TEXTURE_3D;else if(ie.isDataArrayTexture)be.setTexture2DArray(ie,0),Gt=_.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}_.pixelStorei(_.UNPACK_FLIP_Y_WEBGL,ie.flipY),_.pixelStorei(_.UNPACK_PREMULTIPLY_ALPHA_WEBGL,ie.premultiplyAlpha),_.pixelStorei(_.UNPACK_ALIGNMENT,ie.unpackAlignment);const wt=_.getParameter(_.UNPACK_ROW_LENGTH),Pt=_.getParameter(_.UNPACK_IMAGE_HEIGHT),ti=_.getParameter(_.UNPACK_SKIP_PIXELS),es=_.getParameter(_.UNPACK_SKIP_ROWS),ks=_.getParameter(_.UNPACK_SKIP_IMAGES),nn=Ae.isCompressedTexture?Ae.mipmaps[0]:Ae.image;_.pixelStorei(_.UNPACK_ROW_LENGTH,nn.width),_.pixelStorei(_.UNPACK_IMAGE_HEIGHT,nn.height),_.pixelStorei(_.UNPACK_SKIP_PIXELS,Y.min.x),_.pixelStorei(_.UNPACK_SKIP_ROWS,Y.min.y),_.pixelStorei(_.UNPACK_SKIP_IMAGES,Y.min.z),Ae.isDataTexture||Ae.isData3DTexture?_.texSubImage3D(Gt,me,ae.x,ae.y,ae.z,et,at,ct,ht,yt,nn.data):Ae.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),_.compressedTexSubImage3D(Gt,me,ae.x,ae.y,ae.z,et,at,ct,ht,nn.data)):_.texSubImage3D(Gt,me,ae.x,ae.y,ae.z,et,at,ct,ht,yt,nn),_.pixelStorei(_.UNPACK_ROW_LENGTH,wt),_.pixelStorei(_.UNPACK_IMAGE_HEIGHT,Pt),_.pixelStorei(_.UNPACK_SKIP_PIXELS,ti),_.pixelStorei(_.UNPACK_SKIP_ROWS,es),_.pixelStorei(_.UNPACK_SKIP_IMAGES,ks),me===0&&ie.generateMipmaps&&_.generateMipmap(Gt),Xe.unbindTexture()},this.initTexture=function(Y){Y.isCubeTexture?be.setTextureCube(Y,0):Y.isData3DTexture?be.setTexture3D(Y,0):Y.isDataArrayTexture||Y.isCompressedArrayTexture?be.setTexture2DArray(Y,0):be.setTexture2D(Y,0),Xe.unbindTexture()},this.resetState=function(){f=0,B=0,S=null,Xe.reset(),De.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get physicallyCorrectLights(){return console.warn("THREE.WebGLRenderer: the property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),!this.useLegacyLights}set physicallyCorrectLights(e){console.warn("THREE.WebGLRenderer: the property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),this.useLegacyLights=!e}get outputEncoding(){return console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace===mt?Ys:Vu}set outputEncoding(e){console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace=e===Ys?mt:ur}}class M1 extends Kv{}M1.prototype.isWebGL1Renderer=!0;class KA{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new Re(e),this.density=t}clone(){return new KA(this.color,this.density)}toJSON(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}class zA{constructor(e,t=1,i=1e3){this.isFog=!0,this.name="",this.color=new Re(e),this.near=t,this.far=i}clone(){return new zA(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}class dl extends Ht{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){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}get autoUpdate(){return console.warn("THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144."),this.matrixWorldAutoUpdate}set autoUpdate(e){console.warn("THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144."),this.matrixWorldAutoUpdate=e}}class LA{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=uu,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=Cs()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,i){e*=this.stride,i*=t.stride;for(let s=0,r=this.stride;se.far||t.push({distance:l,point:Qc.clone(),uv:Ui.getInterpolation(Qc,xd,qc,Rd,_2,$m,J2,new ne),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}function Wd(n,e,t,i,s,r){ag.subVectors(n,t).addScalar(.5).multiply(i),s!==void 0?(jc.x=r*ag.x-s*ag.y,jc.y=s*ag.x+r*ag.y):jc.copy(ag),n.copy(e),n.x+=jc.x,n.y+=jc.y,n.applyMatrix4(N1)}const Vd=new H,O2=new H;class X1 extends Ht{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);const t=e.levels;for(let i=0,s=t.length;i0){let i,s;for(i=1,s=t.length;i0){Vd.setFromMatrixPosition(this.matrixWorld);const s=e.ray.origin.distanceTo(Vd);this.getObjectForDistance(s).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){Vd.setFromMatrixPosition(e.matrixWorld),O2.setFromMatrixPosition(this.matrixWorld);const i=Vd.distanceTo(O2)/e.zoom;t[0].object.visible=!0;let s,r;for(s=1,r=t.length;s=o)t[s-1].object.visible=!1,t[s].object.visible=!0;else break}for(this._currentLevel=s-1;sl)continue;d.applyMatrix4(this.matrixWorld);const M=e.ray.origin.distanceTo(d);Me.far||t.push({distance:M,point:C.clone().applyMatrix4(this.matrixWorld),index:f,face:null,faceIndex:null,object:this})}}else{const A=Math.max(0,o.start),b=Math.min(y.count,o.start+o.count);for(let f=A,B=b-1;fl)continue;d.applyMatrix4(this.matrixWorld);const x=e.ray.origin.distanceTo(d);xe.far||t.push({distance:x,point:C.clone().applyMatrix4(this.matrixWorld),index:f,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){const t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){const s=t[i[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,o=s.length;r0){const s=t[i[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,o=s.length;rs.far)return;r.push({distance:c,distanceToRay:Math.sqrt(a),point:l,index:e,face:null,object:o})}}class z1 extends qt{constructor(e,t,i,s,r,o,a,l,c){super(e,t,i,s,r,o,a,l,c),this.isVideoTexture=!0,this.minFilter=o!==void 0?o:je,this.magFilter=r!==void 0?r:je,this.generateMipmaps=!1;const u=this;function C(){u.needsUpdate=!0,e.requestVideoFrameCallback(C)}"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(C)}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;"requestVideoFrameCallback"in e===!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}class nb extends qt{constructor(e,t,i){super({width:e,height:t}),this.isFramebufferTexture=!0,this.format=i,this.magFilter=pt,this.minFilter=pt,this.generateMipmaps=!1,this.needsUpdate=!0}}class Ev extends qt{constructor(e,t,i,s,r,o,a,l,c,u,C,d){super(null,o,a,l,c,u,s,r,C,d),this.isCompressedTexture=!0,this.image={width:t,height:i},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class bK extends Ev{constructor(e,t,i,s,r,o){super(e,t,i,r,o),this.isCompressedArrayTexture=!0,this.image.depth=s,this.wrapR=zn}}class L1 extends qt{constructor(e,t,i,s,r,o,a,l,c){super(e,t,i,s,r,o,a,l,c),this.isCanvasTexture=!0,this.needsUpdate=!0}}class Cr{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){const i=this.getUtoTmapping(e);return this.getPoint(i,t)}getPoints(e=5){const t=[];for(let i=0;i<=e;i++)t.push(this.getPoint(i/e));return t}getSpacedPoints(e=5){const t=[];for(let i=0;i<=e;i++)t.push(this.getPointAt(i/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 i,s=this.getPoint(0),r=0;t.push(0);for(let o=1;o<=e;o++)i=this.getPoint(o/e),r+=i.distanceTo(s),t.push(r),s=i;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){const i=this.getLengths();let s=0;const r=i.length;let o;t?o=t:o=e*i[r-1];let a=0,l=r-1,c;for(;a<=l;)if(s=Math.floor(a+(l-a)/2),c=i[s]-o,c<0)a=s+1;else if(c>0)l=s-1;else{l=s;break}if(s=l,i[s]===o)return s/(r-1);const u=i[s],d=i[s+1]-u,h=(o-u)/d;return(s+h)/(r-1)}getTangent(e,t){let s=e-1e-4,r=e+1e-4;s<0&&(s=0),r>1&&(r=1);const o=this.getPoint(s),a=this.getPoint(r),l=t||(o.isVector2?new ne:new H);return l.copy(a).sub(o).normalize(),l}getTangentAt(e,t){const i=this.getUtoTmapping(e);return this.getTangent(i,t)}computeFrenetFrames(e,t){const i=new H,s=[],r=[],o=[],a=new H,l=new Fe;for(let h=0;h<=e;h++){const m=h/e;s[h]=this.getTangentAt(m,new H)}r[0]=new H,o[0]=new H;let c=Number.MAX_VALUE;const u=Math.abs(s[0].x),C=Math.abs(s[0].y),d=Math.abs(s[0].z);u<=c&&(c=u,i.set(1,0,0)),C<=c&&(c=C,i.set(0,1,0)),d<=c&&i.set(0,0,1),a.crossVectors(s[0],i).normalize(),r[0].crossVectors(s[0],a),o[0].crossVectors(s[0],r[0]);for(let h=1;h<=e;h++){if(r[h]=r[h-1].clone(),o[h]=o[h-1].clone(),a.crossVectors(s[h-1],s[h]),a.length()>Number.EPSILON){a.normalize();const m=Math.acos(Gn(s[h-1].dot(s[h]),-1,1));r[h].applyMatrix4(l.makeRotationAxis(a,m))}o[h].crossVectors(s[h],r[h])}if(t===!0){let h=Math.acos(Gn(r[0].dot(r[e]),-1,1));h/=e,s[0].dot(a.crossVectors(r[0],r[e]))>0&&(h=-h);for(let m=1;m<=e;m++)r[m].applyMatrix4(l.makeRotationAxis(s[m],h*m)),o[m].crossVectors(s[m],r[m])}return{tangents:s,normals:r,binormals:o}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class EA extends Cr{constructor(e=0,t=0,i=1,s=1,r=0,o=Math.PI*2,a=!1,l=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=i,this.yRadius=s,this.aStartAngle=r,this.aEndAngle=o,this.aClockwise=a,this.aRotation=l}getPoint(e,t){const i=t||new ne,s=Math.PI*2;let r=this.aEndAngle-this.aStartAngle;const o=Math.abs(r)s;)r-=s;r0?0:(Math.floor(Math.abs(a)/r)+1)*r:l===0&&a===r-1&&(a=r-2,l=1);let c,u;this.closed||a>0?c=s[(a-1)%r]:(Yd.subVectors(s[0],s[1]).add(s[0]),c=Yd);const C=s[a%r],d=s[(a+1)%r];if(this.closed||a+2s.length-2?s.length-1:o+1],C=s[o>s.length-3?s.length-1:o+2];return i.set(cZ(a,l.x,c.x,u.x,C.x),cZ(a,l.y,c.y,u.y,C.y)),i}copy(e){super.copy(e),this.points=[];for(let t=0,i=e.points.length;t=i){const o=s[r]-i,a=this.curves[r],l=a.getLength(),c=l===0?0:1-o/l;return a.getPointAt(c,t)}r++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let i=0,s=this.curves.length;i1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,i=e.curves.length;t0){const C=c.getPoint(0);C.equals(this.currentPoint)||this.lineTo(C.x,C.y)}this.curves.push(c);const u=c.getPoint(1);return this.currentPoint.copy(u),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class cc extends ft{constructor(e=[new ne(0,-.5),new ne(.5,0),new ne(0,.5)],t=12,i=0,s=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:i,phiLength:s},t=Math.floor(t),s=Gn(s,0,Math.PI*2);const r=[],o=[],a=[],l=[],c=[],u=1/t,C=new H,d=new ne,h=new H,m=new H,v=new H;let y=0,A=0;for(let b=0;b<=e.length-1;b++)switch(b){case 0:y=e[b+1].x-e[b].x,A=e[b+1].y-e[b].y,h.x=A*1,h.y=-y,h.z=A*0,v.copy(h),h.normalize(),l.push(h.x,h.y,h.z);break;case e.length-1:l.push(v.x,v.y,v.z);break;default:y=e[b+1].x-e[b].x,A=e[b+1].y-e[b].y,h.x=A*1,h.y=-y,h.z=A*0,m.copy(h),h.x+=v.x,h.y+=v.y,h.z+=v.z,h.normalize(),l.push(h.x,h.y,h.z),v.copy(m)}for(let b=0;b<=t;b++){const f=i+b*u*s,B=Math.sin(f),S=Math.cos(f);for(let x=0;x<=e.length-1;x++){C.x=e[x].x*B,C.y=e[x].y,C.z=e[x].x*S,o.push(C.x,C.y,C.z),d.x=b/t,d.y=x/(e.length-1),a.push(d.x,d.y);const R=l[3*x+0]*B,M=l[3*x+1],Z=l[3*x+0]*S;c.push(R,M,Z)}}for(let b=0;b0&&f(!0),t>0&&f(!1)),this.setIndex(u),this.setAttribute("position",new ke(C,3)),this.setAttribute("normal",new ke(d,3)),this.setAttribute("uv",new ke(h,2));function b(){const B=new H,S=new H;let x=0;const R=(t-e)/i;for(let M=0;M<=r;M++){const Z=[],V=M/r,N=V*(t-e)+e;for(let D=0;D<=s;D++){const k=D/s,$=k*l+a,te=Math.sin($),Ce=Math.cos($);S.x=N*te,S.y=-V*i+y,S.z=N*Ce,C.push(S.x,S.y,S.z),B.set(te,R,Ce).normalize(),d.push(B.x,B.y,B.z),h.push(k,1-V),Z.push(m++)}v.push(Z)}for(let M=0;M.9&&R<.1&&(f<.2&&(o[b+0]+=1),B<.2&&(o[b+2]+=1),S<.2&&(o[b+4]+=1))}}function d(b){r.push(b.x,b.y,b.z)}function h(b,f){const B=b*3;f.x=e[B+0],f.y=e[B+1],f.z=e[B+2]}function m(){const b=new H,f=new H,B=new H,S=new H,x=new ne,R=new ne,M=new ne;for(let Z=0,V=0;Z80*t){a=c=n[0],l=u=n[1];for(let m=t;mc&&(c=C),d>u&&(u=d);h=Math.max(c-a,u-l),h=h!==0?32767/h:0}return hu(r,o,t,a,l,h,0),o}};function _1(n,e,t,i,s){let r,o;if(s===DK(n,e,t,i)>0)for(r=e;r=e;r-=i)o=IZ(r,n[r],n[r+1],o);return o&&DA(o,o.next)&&(pu(o),o=o.next),o}function Al(n,e){if(!n)return n;e||(e=n);let t=n,i;do if(i=!1,!t.steiner&&(DA(t,t.next)||pn(t.prev,t,t.next)===0)){if(pu(t),t=e=t.prev,t===t.next)break;i=!0}else t=t.next;while(i||t!==e);return e}function hu(n,e,t,i,s,r,o){if(!n)return;!o&&r&&KK(n,i,s,r);let a=n,l,c;for(;n.prev!==n.next;){if(l=n.prev,c=n.next,r?WK(n,i,s,r):RK(n)){e.push(l.i/t|0),e.push(n.i/t|0),e.push(c.i/t|0),pu(n),n=c.next,a=c.next;continue}if(n=c,n===a){o?o===1?(n=VK(Al(n),e,t),hu(n,e,t,i,s,r,2)):o===2&&MK(n,e,t,i,s,r):hu(Al(n),e,t,i,s,r,1);break}}}function RK(n){const e=n.prev,t=n,i=n.next;if(pn(e,t,i)>=0)return!1;const s=e.x,r=t.x,o=i.x,a=e.y,l=t.y,c=i.y,u=sr?s>o?s:o:r>o?r:o,h=a>l?a>c?a:c:l>c?l:c;let m=i.next;for(;m!==e;){if(m.x>=u&&m.x<=d&&m.y>=C&&m.y<=h&&Wg(s,a,r,l,o,c,m.x,m.y)&&pn(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function WK(n,e,t,i){const s=n.prev,r=n,o=n.next;if(pn(s,r,o)>=0)return!1;const a=s.x,l=r.x,c=o.x,u=s.y,C=r.y,d=o.y,h=al?a>c?a:c:l>c?l:c,y=u>C?u>d?u:d:C>d?C:d,A=ib(h,m,e,t,i),b=ib(v,y,e,t,i);let f=n.prevZ,B=n.nextZ;for(;f&&f.z>=A&&B&&B.z<=b;){if(f.x>=h&&f.x<=v&&f.y>=m&&f.y<=y&&f!==s&&f!==o&&Wg(a,u,l,C,c,d,f.x,f.y)&&pn(f.prev,f,f.next)>=0||(f=f.prevZ,B.x>=h&&B.x<=v&&B.y>=m&&B.y<=y&&B!==s&&B!==o&&Wg(a,u,l,C,c,d,B.x,B.y)&&pn(B.prev,B,B.next)>=0))return!1;B=B.nextZ}for(;f&&f.z>=A;){if(f.x>=h&&f.x<=v&&f.y>=m&&f.y<=y&&f!==s&&f!==o&&Wg(a,u,l,C,c,d,f.x,f.y)&&pn(f.prev,f,f.next)>=0)return!1;f=f.prevZ}for(;B&&B.z<=b;){if(B.x>=h&&B.x<=v&&B.y>=m&&B.y<=y&&B!==s&&B!==o&&Wg(a,u,l,C,c,d,B.x,B.y)&&pn(B.prev,B,B.next)>=0)return!1;B=B.nextZ}return!0}function VK(n,e,t){let i=n;do{const s=i.prev,r=i.next.next;!DA(s,r)&&J1(s,i,i.next,r)&&Au(s,r)&&Au(r,s)&&(e.push(s.i/t|0),e.push(i.i/t|0),e.push(r.i/t|0),pu(i),pu(i.next),i=n=r),i=i.next}while(i!==n);return Al(i)}function MK(n,e,t,i,s,r){let o=n;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&TK(o,a)){let l=O1(o,a);o=Al(o,o.next),l=Al(l,l.next),hu(o,e,t,i,s,r,0),hu(l,e,t,i,s,r,0);return}a=a.next}o=o.next}while(o!==n)}function NK(n,e,t,i){const s=[];let r,o,a,l,c;for(r=0,o=e.length;r=t.next.y&&t.next.y!==t.y){const d=t.x+(o-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(d<=r&&d>i&&(i=d,s=t.x=t.x&&t.x>=l&&r!==t.x&&Wg(os.x||t.x===s.x&&FK(s,t)))&&(s=t,u=C)),t=t.next;while(t!==a);return s}function FK(n,e){return pn(n.prev,n,e.prev)<0&&pn(e.next,n,n.next)<0}function KK(n,e,t,i){let s=n;do s.z===0&&(s.z=ib(s.x,s.y,e,t,i)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==n);s.prevZ.nextZ=null,s.prevZ=null,zK(s)}function zK(n){let e,t,i,s,r,o,a,l,c=1;do{for(t=n,n=null,r=null,o=0;t;){for(o++,i=t,a=0,e=0;e0||l>0&&i;)a!==0&&(l===0||!i||t.z<=i.z)?(s=t,t=t.nextZ,a--):(s=i,i=i.nextZ,l--),r?r.nextZ=s:n=s,s.prevZ=r,r=s;t=i}r.nextZ=null,c*=2}while(o>1);return n}function ib(n,e,t,i,s){return n=(n-t)*s|0,e=(e-i)*s|0,n=(n|n<<8)&16711935,n=(n|n<<4)&252645135,n=(n|n<<2)&858993459,n=(n|n<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,n|e<<1}function LK(n){let e=n,t=n;do(e.x=(n-o)*(r-a)&&(n-o)*(i-a)>=(t-o)*(e-a)&&(t-o)*(r-a)>=(s-o)*(i-a)}function TK(n,e){return n.next.i!==e.i&&n.prev.i!==e.i&&!EK(n,e)&&(Au(n,e)&&Au(e,n)&&kK(n,e)&&(pn(n.prev,n,e.prev)||pn(n,e.prev,e))||DA(n,e)&&pn(n.prev,n,n.next)>0&&pn(e.prev,e,e.next)>0)}function pn(n,e,t){return(e.y-n.y)*(t.x-e.x)-(e.x-n.x)*(t.y-e.y)}function DA(n,e){return n.x===e.x&&n.y===e.y}function J1(n,e,t,i){const s=Td(pn(n,e,t)),r=Td(pn(n,e,i)),o=Td(pn(t,i,n)),a=Td(pn(t,i,e));return!!(s!==r&&o!==a||s===0&&Ld(n,t,e)||r===0&&Ld(n,i,e)||o===0&&Ld(t,n,i)||a===0&&Ld(t,e,i))}function Ld(n,e,t){return e.x<=Math.max(n.x,t.x)&&e.x>=Math.min(n.x,t.x)&&e.y<=Math.max(n.y,t.y)&&e.y>=Math.min(n.y,t.y)}function Td(n){return n>0?1:n<0?-1:0}function EK(n,e){let t=n;do{if(t.i!==n.i&&t.next.i!==n.i&&t.i!==e.i&&t.next.i!==e.i&&J1(t,t.next,n,e))return!0;t=t.next}while(t!==n);return!1}function Au(n,e){return pn(n.prev,n,n.next)<0?pn(n,e,n.next)>=0&&pn(n,n.prev,e)>=0:pn(n,e,n.prev)<0||pn(n,n.next,e)<0}function kK(n,e){let t=n,i=!1;const s=(n.x+e.x)/2,r=(n.y+e.y)/2;do t.y>r!=t.next.y>r&&t.next.y!==t.y&&s<(t.next.x-t.x)*(r-t.y)/(t.next.y-t.y)+t.x&&(i=!i),t=t.next;while(t!==n);return i}function O1(n,e){const t=new sb(n.i,n.x,n.y),i=new sb(e.i,e.x,e.y),s=n.next,r=e.prev;return n.next=e,e.prev=n,t.next=s,s.prev=t,i.next=t,t.prev=i,r.next=i,i.prev=r,i}function IZ(n,e,t,i){const s=new sb(n,e,t);return i?(s.next=i.next,s.prev=i,i.next.prev=s,i.next=s):(s.prev=s,s.next=s),s}function pu(n){n.next.prev=n.prev,n.prev.next=n.next,n.prevZ&&(n.prevZ.nextZ=n.nextZ),n.nextZ&&(n.nextZ.prevZ=n.prevZ)}function sb(n,e,t){this.i=n,this.x=e,this.y=t,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function DK(n,e,t,i){let s=0;for(let r=e,o=t-i;r2&&n[e-1].equals(n[0])&&n.pop()}function CZ(n,e){for(let t=0;tNumber.EPSILON){const ge=Math.sqrt(T),Ge=Math.sqrt(ut*ut+Nt*Nt),Ze=ue.x-qe/ge,Me=ue.y+rt/ge,gt=be.x-Nt/Ge,Ke=be.y+ut/Ge,pe=((gt-Ze)*Nt-(Ke-Me)*ut)/(rt*Nt-qe*ut);Le=Ze+rt*pe-fe.x,Ve=Me+qe*pe-fe.y;const De=Le*Le+Ve*Ve;if(De<=2)return new ne(Le,Ve);st=Math.sqrt(De/2)}else{let ge=!1;rt>Number.EPSILON?ut>Number.EPSILON&&(ge=!0):rt<-Number.EPSILON?ut<-Number.EPSILON&&(ge=!0):Math.sign(qe)===Math.sign(Nt)&&(ge=!0),ge?(Le=-qe,Ve=rt,st=Math.sqrt(T)):(Le=rt,Ve=qe,st=Math.sqrt(T/2))}return new ne(Le/st,Ve/st)}const J=[];for(let fe=0,ue=$.length,be=ue-1,Le=fe+1;fe=0;fe--){const ue=fe/y,be=h*Math.cos(ue*Math.PI/2),Le=m*Math.sin(ue*Math.PI/2)+v;for(let Ve=0,st=$.length;Ve=0;){const Le=be;let Ve=be-1;Ve<0&&(Ve=fe.length-1);for(let st=0,rt=u+y*2;st0)&&h.push(f,B,x),(A!==i-1||l0!=e>0&&this.version++,this._sheen=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class eW extends _n{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Re(16777215),this.specular=new Re(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Re(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=fo,this.normalScale=new ne(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Wu,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class tW extends _n{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Re(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Re(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=fo,this.normalScale=new ne(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,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.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}class Ov extends _n{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=fo,this.normalScale=new ne(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}class nW extends _n{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Re(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Re(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=fo,this.normalScale=new ne(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Wu,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,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.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class iW extends _n{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Re(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=fo,this.normalScale=new ne(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.flatShading=e.flatShading,this.fog=e.fog,this}}class sW extends Ni{constructor(e){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}function Vs(n,e,t){return Qv(n)?new n.constructor(n.subarray(e,t!==void 0?t:n.length)):n.slice(e,t)}function $a(n,e,t){return!n||!t&&n.constructor===e?n:typeof e.BYTES_PER_ELEMENT=="number"?new e(n):Array.prototype.slice.call(n)}function Qv(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}function rW(n){function e(s,r){return n[s]-n[r]}const t=n.length,i=new Array(t);for(let s=0;s!==t;++s)i[s]=s;return i.sort(e),i}function rb(n,e,t){const i=n.length,s=new n.constructor(i);for(let r=0,o=0;o!==i;++r){const a=t[r]*e;for(let l=0;l!==e;++l)s[o++]=n[a+l]}return s}function jv(n,e,t,i){let s=1,r=n[0];for(;r!==void 0&&r[i]===void 0;)r=n[s++];if(r===void 0)return;let o=r[i];if(o!==void 0)if(Array.isArray(o))do o=r[i],o!==void 0&&(e.push(r.time),t.push.apply(t,o)),r=n[s++];while(r!==void 0);else if(o.toArray!==void 0)do o=r[i],o!==void 0&&(e.push(r.time),o.toArray(t,t.length)),r=n[s++];while(r!==void 0);else do o=r[i],o!==void 0&&(e.push(r.time),t.push(o)),r=n[s++];while(r!==void 0)}function JK(n,e,t,i,s=30){const r=n.clone();r.name=e;const o=[];for(let l=0;l=i)){C.push(c.times[h]);for(let v=0;vr.tracks[l].times[0]&&(a=r.tracks[l].times[0]);for(let l=0;l=a.times[m]){const A=m*C+u,b=A+C-u;v=Vs(a.values,A,b)}else{const A=a.createInterpolant(),b=u,f=C-u;A.evaluate(r),v=Vs(A.resultBuffer,b,f)}l==="quaternion"&&new xn().fromArray(v).normalize().conjugate().toArray(v);const y=c.times.length;for(let A=0;A=r)){const a=t[1];e=r)break t}o=i,i=0;break n}break e}for(;i>>1;et;)--o;if(++o,r!==0||o!==s){r>=o&&(o=Math.max(o,1),r=o-1);const a=this.getValueSize();this.times=Vs(i,r,o),this.values=Vs(this.values,r*a,o*a)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const i=this.times,s=this.values,r=i.length;r===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let a=0;a!==r;a++){const l=i[a];if(typeof l=="number"&&isNaN(l)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,l),e=!1;break}if(o!==null&&o>l){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,l,o),e=!1;break}o=l}if(s!==void 0&&Qv(s))for(let a=0,l=s.length;a!==l;++a){const c=s[a];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,c),e=!1;break}}return e}optimize(){const e=Vs(this.times),t=Vs(this.values),i=this.getValueSize(),s=this.getInterpolation()===Sh,r=e.length-1;let o=1;for(let a=1;a0){e[o]=e[r];for(let a=r*i,l=o*i,c=0;c!==i;++c)t[l+c]=t[a+c];++o}return o!==e.length?(this.times=Vs(e,0,o),this.values=Vs(t,0,o*i)):(this.times=e,this.values=t),this}clone(){const e=Vs(this.times,0),t=Vs(this.values,0),i=this.constructor,s=new i(this.name,e,t);return s.createInterpolant=this.createInterpolant,s}}dr.prototype.TimeBufferType=Float32Array;dr.prototype.ValueBufferType=Float32Array;dr.prototype.DefaultInterpolation=cu;class Bl extends dr{}Bl.prototype.ValueTypeName="bool";Bl.prototype.ValueBufferType=Array;Bl.prototype.DefaultInterpolation=gu;Bl.prototype.InterpolantFactoryMethodLinear=void 0;Bl.prototype.InterpolantFactoryMethodSmooth=void 0;class $v extends dr{}$v.prototype.ValueTypeName="color";class mu extends dr{}mu.prototype.ValueTypeName="number";class lW extends Pu{constructor(e,t,i,s){super(e,t,i,s)}interpolate_(e,t,i,s){const r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=(i-t)/(s-t);let c=e*a;for(let u=c+a;c!==u;c+=4)xn.slerpFlat(r,0,o,c-a,o,c,l);return r}}class uc extends dr{InterpolantFactoryMethodLinear(e){return new lW(this.times,this.values,this.getValueSize(),e)}}uc.prototype.ValueTypeName="quaternion";uc.prototype.DefaultInterpolation=cu;uc.prototype.InterpolantFactoryMethodSmooth=void 0;class Zl extends dr{}Zl.prototype.ValueTypeName="string";Zl.prototype.ValueBufferType=Array;Zl.prototype.DefaultInterpolation=gu;Zl.prototype.InterpolantFactoryMethodLinear=void 0;Zl.prototype.InterpolantFactoryMethodSmooth=void 0;class fu extends dr{}fu.prototype.ValueTypeName="vector";class bu{constructor(e,t=-1,i,s=VA){this.name=e,this.tracks=i,this.duration=t,this.blendMode=s,this.uuid=Cs(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],i=e.tracks,s=1/(e.fps||1);for(let o=0,a=i.length;o!==a;++o)t.push(qK(i[o]).scale(s));const r=new this(e.name,e.duration,t,e.blendMode);return r.uuid=e.uuid,r}static toJSON(e){const t=[],i=e.tracks,s={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let r=0,o=i.length;r!==o;++r)t.push(dr.toJSON(i[r]));return s}static CreateFromMorphTargetSequence(e,t,i,s){const r=t.length,o=[];for(let a=0;a1){const C=u[1];let d=s[C];d||(s[C]=d=[]),d.push(c)}}const o=[];for(const a in s)o.push(this.CreateFromMorphTargetSequence(a,s[a],t,i));return o}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const i=function(C,d,h,m,v){if(h.length!==0){const y=[],A=[];jv(h,y,A,m),y.length!==0&&v.push(new C(d,y,A))}},s=[],r=e.name||"default",o=e.fps||30,a=e.blendMode;let l=e.length||-1;const c=e.hierarchy||[];for(let C=0;C{t&&t(r),this.manager.itemEnd(e)},0),r;if(qr[e]!==void 0){qr[e].push({onLoad:t,onProgress:i,onError:s});return}qr[e]=[],qr[e].push({onLoad:t,onProgress:i,onError:s});const o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),a=this.mimeType,l=this.responseType;fetch(o).then(c=>{if(c.status===200||c.status===0){if(c.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||c.body===void 0||c.body.getReader===void 0)return c;const u=qr[e],C=c.body.getReader(),d=c.headers.get("Content-Length")||c.headers.get("X-File-Size"),h=d?parseInt(d):0,m=h!==0;let v=0;const y=new ReadableStream({start(A){b();function b(){C.read().then(({done:f,value:B})=>{if(f)A.close();else{v+=B.byteLength;const S=new ProgressEvent("progress",{lengthComputable:m,loaded:v,total:h});for(let x=0,R=u.length;x{switch(l){case"arraybuffer":return c.arrayBuffer();case"blob":return c.blob();case"document":return c.text().then(u=>new DOMParser().parseFromString(u,a));case"json":return c.json();default:if(a===void 0)return c.text();{const C=/charset="?([^;"\s]*)"?/i.exec(a),d=C&&C[1]?C[1].toLowerCase():void 0,h=new TextDecoder(d);return c.arrayBuffer().then(m=>h.decode(m))}}}).then(c=>{pl.add(e,c);const u=qr[e];delete qr[e];for(let C=0,d=u.length;C{const u=qr[e];if(u===void 0)throw this.manager.itemError(e),c;delete qr[e];for(let C=0,d=u.length;C{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class ez extends ms{constructor(e){super(e)}load(e,t,i,s){const r=this,o=new Ao(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(a){try{t(r.parse(JSON.parse(a)))}catch(l){s?s(l):console.error(l),r.manager.itemError(e)}},i,s)}parse(e){const t=[];for(let i=0;i0:s.vertexColors=e.vertexColors),e.uniforms!==void 0)for(const r in e.uniforms){const o=e.uniforms[r];switch(s.uniforms[r]={},o.type){case"t":s.uniforms[r].value=i(o.value);break;case"c":s.uniforms[r].value=new Re().setHex(o.value);break;case"v2":s.uniforms[r].value=new ne().fromArray(o.value);break;case"v3":s.uniforms[r].value=new H().fromArray(o.value);break;case"v4":s.uniforms[r].value=new Vt().fromArray(o.value);break;case"m3":s.uniforms[r].value=new xt().fromArray(o.value);break;case"m4":s.uniforms[r].value=new Fe().fromArray(o.value);break;default:s.uniforms[r].value=o.value}}if(e.defines!==void 0&&(s.defines=e.defines),e.vertexShader!==void 0&&(s.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(s.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(s.glslVersion=e.glslVersion),e.extensions!==void 0)for(const r in e.extensions)s.extensions[r]=e.extensions[r];if(e.lights!==void 0&&(s.lights=e.lights),e.clipping!==void 0&&(s.clipping=e.clipping),e.size!==void 0&&(s.size=e.size),e.sizeAttenuation!==void 0&&(s.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(s.map=i(e.map)),e.matcap!==void 0&&(s.matcap=i(e.matcap)),e.alphaMap!==void 0&&(s.alphaMap=i(e.alphaMap)),e.bumpMap!==void 0&&(s.bumpMap=i(e.bumpMap)),e.bumpScale!==void 0&&(s.bumpScale=e.bumpScale),e.normalMap!==void 0&&(s.normalMap=i(e.normalMap)),e.normalMapType!==void 0&&(s.normalMapType=e.normalMapType),e.normalScale!==void 0){let r=e.normalScale;Array.isArray(r)===!1&&(r=[r,r]),s.normalScale=new ne().fromArray(r)}return e.displacementMap!==void 0&&(s.displacementMap=i(e.displacementMap)),e.displacementScale!==void 0&&(s.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(s.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(s.roughnessMap=i(e.roughnessMap)),e.metalnessMap!==void 0&&(s.metalnessMap=i(e.metalnessMap)),e.emissiveMap!==void 0&&(s.emissiveMap=i(e.emissiveMap)),e.emissiveIntensity!==void 0&&(s.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(s.specularMap=i(e.specularMap)),e.specularIntensityMap!==void 0&&(s.specularIntensityMap=i(e.specularIntensityMap)),e.specularColorMap!==void 0&&(s.specularColorMap=i(e.specularColorMap)),e.envMap!==void 0&&(s.envMap=i(e.envMap)),e.envMapIntensity!==void 0&&(s.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(s.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(s.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(s.lightMap=i(e.lightMap)),e.lightMapIntensity!==void 0&&(s.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(s.aoMap=i(e.aoMap)),e.aoMapIntensity!==void 0&&(s.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(s.gradientMap=i(e.gradientMap)),e.clearcoatMap!==void 0&&(s.clearcoatMap=i(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(s.clearcoatRoughnessMap=i(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(s.clearcoatNormalMap=i(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(s.clearcoatNormalScale=new ne().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(s.iridescenceMap=i(e.iridescenceMap)),e.iridescenceThicknessMap!==void 0&&(s.iridescenceThicknessMap=i(e.iridescenceThicknessMap)),e.transmissionMap!==void 0&&(s.transmissionMap=i(e.transmissionMap)),e.thicknessMap!==void 0&&(s.thicknessMap=i(e.thicknessMap)),e.sheenColorMap!==void 0&&(s.sheenColorMap=i(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(s.sheenRoughnessMap=i(e.sheenRoughnessMap)),s}setTextures(e){return this.textures=e,this}static createMaterialFromType(e){const t={ShadowMaterial:j1,SpriteMaterial:zv,RawShaderMaterial:q1,ShaderMaterial:Zt,PointsMaterial:Tv,MeshPhysicalMaterial:$1,MeshStandardMaterial:UA,MeshPhongMaterial:eW,MeshToonMaterial:tW,MeshNormalMaterial:Ov,MeshLambertMaterial:nW,MeshDepthMaterial:YA,MeshDistanceMaterial:Fv,MeshBasicMaterial:ha,MeshMatcapMaterial:iW,LineDashedMaterial:sW,LineBasicMaterial:Ni,Material:_n};return new t[e]}}class ob{static decodeText(e){if(typeof TextDecoder<"u")return new TextDecoder().decode(e);let t="";for(let i=0,s=e.length;i0){const l=new PA(t);r=new vu(l),r.setCrossOrigin(this.crossOrigin);for(let c=0,u=e.length;c0){s=new vu(this.manager),s.setCrossOrigin(this.crossOrigin);for(let o=0,a=e.length;o"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,t,i,s){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const r=this,o=pl.get(e);if(o!==void 0)return r.manager.itemStart(e),setTimeout(function(){t&&t(o),r.manager.itemEnd(e)},0),o;const a={};a.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",a.headers=this.requestHeader,fetch(e,a).then(function(l){return l.blob()}).then(function(l){return createImageBitmap(l,Object.assign(r.options,{colorSpaceConversion:"none"}))}).then(function(l){pl.add(e,l),t&&t(l),r.manager.itemEnd(e)}).catch(function(l){s&&s(l),r.manager.itemError(e),r.manager.itemEnd(e)}),r.manager.itemStart(e)}}let Ed;class ty{static getContext(){return Ed===void 0&&(Ed=new(window.AudioContext||window.webkitAudioContext)),Ed}static setContext(e){Ed=e}}class cz extends ms{constructor(e){super(e)}load(e,t,i,s){const r=this,o=new Ao(this.manager);o.setResponseType("arraybuffer"),o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(l){try{const c=l.slice(0);ty.getContext().decodeAudioData(c,function(C){t(C)},a)}catch(c){a(c)}},i,s);function a(l){s?s(l):console.error(l),r.manager.itemError(e)}}}class Iz extends _A{constructor(e,t,i=1){super(void 0,i),this.isHemisphereLightProbe=!0;const s=new Re().set(e),r=new Re().set(t),o=new H(s.r,s.g,s.b),a=new H(r.r,r.g,r.b),l=Math.sqrt(Math.PI),c=l*Math.sqrt(.75);this.sh.coefficients[0].copy(o).add(a).multiplyScalar(l),this.sh.coefficients[1].copy(o).sub(a).multiplyScalar(c)}}class uz extends _A{constructor(e,t=1){super(void 0,t),this.isAmbientLightProbe=!0;const i=new Re().set(e);this.sh.coefficients[0].set(i.r,i.g,i.b).multiplyScalar(2*Math.sqrt(Math.PI))}}const vZ=new Fe,yZ=new Fe,Ma=new Fe;class Cz{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new An,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new An,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(e){const t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep,Ma.copy(e.projectionMatrix);const s=t.eyeSep/2,r=s*t.near/t.focus,o=t.near*Math.tan(rl*t.fov*.5)/t.zoom;let a,l;yZ.elements[12]=-s,vZ.elements[12]=s,a=-o*t.aspect+r,l=o*t.aspect+r,Ma.elements[0]=2*t.near/(l-a),Ma.elements[8]=(l+a)/(l-a),this.cameraL.projectionMatrix.copy(Ma),a=-o*t.aspect-r,l=o*t.aspect-r,Ma.elements[0]=2*t.near/(l-a),Ma.elements[8]=(l+a)/(l-a),this.cameraR.projectionMatrix.copy(Ma)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(yZ),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(vZ)}}class ny{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=GZ(),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=GZ();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function GZ(){return(typeof performance>"u"?Date:performance).now()}const Na=new H,BZ=new xn,dz=new H,Ha=new H;class hz extends Ht{constructor(){super(),this.type="AudioListener",this.context=ty.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new ny}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e);const t=this.context.listener,i=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(Na,BZ,dz),Ha.set(0,0,-1).applyQuaternion(BZ),t.positionX){const s=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(Na.x,s),t.positionY.linearRampToValueAtTime(Na.y,s),t.positionZ.linearRampToValueAtTime(Na.z,s),t.forwardX.linearRampToValueAtTime(Ha.x,s),t.forwardY.linearRampToValueAtTime(Ha.y,s),t.forwardZ.linearRampToValueAtTime(Ha.z,s),t.upX.linearRampToValueAtTime(i.x,s),t.upY.linearRampToValueAtTime(i.y,s),t.upZ.linearRampToValueAtTime(i.z,s)}else t.setPosition(Na.x,Na.y,Na.z),t.setOrientation(Ha.x,Ha.y,Ha.z,i.x,i.y,i.z)}}class bW extends Ht{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(this.isPlaying===!0){console.warn("THREE.Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+e;const t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this._progress=0,this.source!==null&&(this.source.stop(),this.source.onended=null),this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e0&&this._mixBufferRegionAdditive(i,s,this._addIndex*t,1,t);for(let l=t,c=t+t;l!==c;++l)if(i[l]!==i[l+t]){a.setValue(i,s);break}}saveOriginalState(){const e=this.binding,t=this.buffer,i=this.valueSize,s=i*this._origIndex;e.getValue(t,s);for(let r=i,o=s;r!==o;++r)t[r]=t[s+r%i];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let i=e;i=.5)for(let o=0;o!==r;++o)e[t+o]=e[i+o]}_slerp(e,t,i,s){xn.slerpFlat(e,t,e,t,e,i,s)}_slerpAdditive(e,t,i,s,r){const o=this._workIndex*r;xn.multiplyQuaternionsFlat(e,o,e,t,e,i),xn.slerpFlat(e,t,e,t,e,o,s)}_lerp(e,t,i,s,r){const o=1-s;for(let a=0;a!==r;++a){const l=t+a;e[l]=e[l]*o+e[i+a]*s}}_lerpAdditive(e,t,i,s,r){for(let o=0;o!==r;++o){const a=t+o;e[a]=e[a]+e[i+o]*s}}}const iy="\\[\\]\\.:\\/",fz=new RegExp("["+iy+"]","g"),sy="[^"+iy+"]",bz="[^"+iy.replace("\\.","")+"]",vz=/((?:WC+[\/:])*)/.source.replace("WC",sy),yz=/(WCOD+)?/.source.replace("WCOD",bz),Gz=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",sy),Bz=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",sy),Zz=new RegExp("^"+vz+yz+Gz+Bz+"$"),wz=["material","materials","bones","map"];class Sz{constructor(e,t,i){const s=i||Xt.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,s)}getValue(e,t){this.bind();const i=this._targetGroup.nCachedObjects_,s=this._bindings[i];s!==void 0&&s.getValue(e,t)}setValue(e,t){const i=this._bindings;for(let s=this._targetGroup.nCachedObjects_,r=i.length;s!==r;++s)i[s].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].unbind()}}class Xt{constructor(e,t,i){this.path=t,this.parsedPath=i||Xt.parseTrackName(t),this.node=Xt.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,i){return e&&e.isAnimationObjectGroup?new Xt.Composite(e,t,i):new Xt(e,t,i)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(fz,"")}static parseTrackName(e){const t=Zz.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const i={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},s=i.nodeName&&i.nodeName.lastIndexOf(".");if(s!==void 0&&s!==-1){const r=i.nodeName.substring(s+1);wz.indexOf(r)!==-1&&(i.nodeName=i.nodeName.substring(0,s),i.objectName=r)}if(i.propertyName===null||i.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return i}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const i=e.skeleton.getBoneByName(t);if(i!==void 0)return i}if(e.children){const i=function(r){for(let o=0;o=r){const C=r++,d=e[C];t[d.uuid]=u,e[u]=d,t[c]=C,e[C]=l;for(let h=0,m=s;h!==m;++h){const v=i[h],y=v[C],A=v[u];v[u]=y,v[C]=A}}}this.nCachedObjects_=r}uncache(){const e=this._objects,t=this._indicesByUUID,i=this._bindings,s=i.length;let r=this.nCachedObjects_,o=e.length;for(let a=0,l=arguments.length;a!==l;++a){const c=arguments[a],u=c.uuid,C=t[u];if(C!==void 0)if(delete t[u],C0&&(t[h.uuid]=C),e[C]=h,e.pop();for(let m=0,v=s;m!==v;++m){const y=i[m];y[C]=y[d],y.pop()}}}this.nCachedObjects_=r}subscribe_(e,t){const i=this._bindingsIndicesByPath;let s=i[e];const r=this._bindings;if(s!==void 0)return r[s];const o=this._paths,a=this._parsedPaths,l=this._objects,c=l.length,u=this.nCachedObjects_,C=new Array(c);s=r.length,i[e]=s,o.push(e),a.push(t),r.push(C);for(let d=u,h=l.length;d!==h;++d){const m=l[d];C[d]=new Xt(m,e,t)}return C}unsubscribe_(e){const t=this._bindingsIndicesByPath,i=t[e];if(i!==void 0){const s=this._paths,r=this._parsedPaths,o=this._bindings,a=o.length-1,l=o[a],c=e[a];t[c]=i,o[i]=l,o.pop(),r[i]=r[a],r.pop(),s[i]=s[a],s.pop()}}}class yW{constructor(e,t,i=null,s=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=i,this.blendMode=s;const r=t.tracks,o=r.length,a=new Array(o),l={endingStart:Qa,endingEnd:Qa};for(let c=0;c!==o;++c){const u=r[c].createInterpolant(null);a[c]=u,u.settings=l}this._interpolantSettings=l,this._interpolants=a,this._propertyBindings=new Array(o),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=u1,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,i){if(e.fadeOut(t),this.fadeIn(t),i){const s=this._clip.duration,r=e._clip.duration,o=r/s,a=s/r;e.warp(1,o,t),this.warp(a,1,t)}return this}crossFadeTo(e,t,i){return e.crossFadeFrom(this,t,i)}stopFading(){const e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,i){const s=this._mixer,r=s.time,o=this.timeScale;let a=this._timeScaleInterpolant;a===null&&(a=s._lendControlInterpolant(),this._timeScaleInterpolant=a);const l=a.parameterPositions,c=a.sampleValues;return l[0]=r,l[1]=r+i,c[0]=e/o,c[1]=t/o,this}stopWarping(){const e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,i,s){if(!this.enabled){this._updateWeight(e);return}const r=this._startTime;if(r!==null){const l=(e-r)*i;l<0||i===0?t=0:(this._startTime=null,t=i*l)}t*=this._updateTimeScale(e);const o=this._updateTime(t),a=this._updateWeight(e);if(a>0){const l=this._interpolants,c=this._propertyBindings;switch(this.blendMode){case Rv:for(let u=0,C=l.length;u!==C;++u)l[u].evaluate(o),c[u].accumulateAdditive(a);break;case VA:default:for(let u=0,C=l.length;u!==C;++u)l[u].evaluate(o),c[u].accumulate(s,a)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const i=this._weightInterpolant;if(i!==null){const s=i.evaluate(e)[0];t*=s,e>i.parameterPositions[1]&&(this.stopFading(),s===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const i=this._timeScaleInterpolant;if(i!==null){const s=i.evaluate(e)[0];t*=s,e>i.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,i=this.loop;let s=this.time+e,r=this._loopCount;const o=i===C1;if(e===0)return r===-1?s:o&&(r&1)===1?t-s:s;if(i===I1){r===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(s>=t)s=t;else if(s<0)s=0;else{this.time=s;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=s,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(r===-1&&(e>=0?(r=0,this._setEndings(!0,this.repetitions===0,o)):this._setEndings(this.repetitions===0,!0,o)),s>=t||s<0){const a=Math.floor(s/t);s-=t*a,r+=Math.abs(a);const l=this.repetitions-r;if(l<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,s=e>0?t:0,this.time=s,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(l===1){const c=e<0;this._setEndings(c,!c,o)}else this._setEndings(!1,!1,o);this._loopCount=r,this.time=s,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}else this.time=s;if(o&&(r&1)===1)return t-s}return s}_setEndings(e,t,i){const s=this._interpolantSettings;i?(s.endingStart=ja,s.endingEnd=ja):(e?s.endingStart=this.zeroSlopeAtStart?ja:Qa:s.endingStart=Iu,t?s.endingEnd=this.zeroSlopeAtEnd?ja:Qa:s.endingEnd=Iu)}_scheduleFading(e,t,i){const s=this._mixer,r=s.time;let o=this._weightInterpolant;o===null&&(o=s._lendControlInterpolant(),this._weightInterpolant=o);const a=o.parameterPositions,l=o.sampleValues;return a[0]=r,l[0]=t,a[1]=r+e,l[1]=i,this}}const Rz=new Float32Array(1);class Wz extends zs{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const i=e._localRoot||this._root,s=e._clip.tracks,r=s.length,o=e._propertyBindings,a=e._interpolants,l=i.uuid,c=this._bindingsByRootAndName;let u=c[l];u===void 0&&(u={},c[l]=u);for(let C=0;C!==r;++C){const d=s[C],h=d.name;let m=u[h];if(m!==void 0)++m.referenceCount,o[C]=m;else{if(m=o[C],m!==void 0){m._cacheIndex===null&&(++m.referenceCount,this._addInactiveBinding(m,l,h));continue}const v=t&&t._propertyBindings[C].binding.parsedPath;m=new vW(Xt.create(i,h,v),d.ValueTypeName,d.getValueSize()),++m.referenceCount,this._addInactiveBinding(m,l,h),o[C]=m}a[C].resultBuffer=m.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const i=(e._localRoot||this._root).uuid,s=e._clip.uuid,r=this._actionsByClip[s];this._bindAction(e,r&&r.knownActions[0]),this._addInactiveAction(e,s,i)}const t=e._propertyBindings;for(let i=0,s=t.length;i!==s;++i){const r=t[i];r.useCount++===0&&(this._lendBinding(r),r.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let i=0,s=t.length;i!==s;++i){const r=t[i];--r.useCount===0&&(r.restoreOriginalState(),this._takeBackBinding(r))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return t!==null&&t=0;--i)e[i].stop();return this}update(e){e*=this.timeScale;const t=this._actions,i=this._nActiveActions,s=this.time+=e,r=Math.sign(e),o=this._accuIndex^=1;for(let c=0;c!==i;++c)t[c]._update(s,e,r,o);const a=this._bindings,l=this._nActiveBindings;for(let c=0;c!==l;++c)a[c].apply(o);return this}setTime(e){this.time=0;for(let t=0;tthis.max.x||e.ythis.max.y)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return!(e.max.xthis.max.x||e.max.ythis.max.y)}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,SZ).distanceTo(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}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 xZ=new H,kd=new H;class Fz{constructor(e=new H,t=new H){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){xZ.subVectors(e,this.start),kd.subVectors(this.end,this.start);const i=kd.dot(kd);let r=kd.dot(xZ)/i;return t&&(r=Gn(r,0,1)),r}closestPointToPoint(e,t,i){const s=this.closestPointToPointParameter(e,t);return this.delta(i).multiplyScalar(s).add(this.start)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}const RZ=new H;class Kz extends Ht{constructor(e,t){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";const i=new ft,s=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let o=0,a=1,l=32;o1)for(let C=0;C.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{HZ.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(HZ,t)}}setLength(e,t=e*.2,i=t*.2){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(i,t,i),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class jz extends Kr{constructor(e=1){const t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],i=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],s=new ft;s.setAttribute("position",new ke(t,3)),s.setAttribute("color",new ke(i,3));const r=new Ni({vertexColors:!0,toneMapped:!1});super(s,r),this.type="AxesHelper"}setColors(e,t,i){const s=new Re,r=this.geometry.attributes.color.array;return s.set(e),s.toArray(r,0),s.toArray(r,3),s.set(t),s.toArray(r,6),s.toArray(r,9),s.set(i),s.toArray(r,12),s.toArray(r,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class qz{constructor(){this.type="ShapePath",this.color=new Re,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new du,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,i,s){return this.currentPath.quadraticCurveTo(e,t,i,s),this}bezierCurveTo(e,t,i,s,r,o){return this.currentPath.bezierCurveTo(e,t,i,s,r,o),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function t(A){const b=[];for(let f=0,B=A.length;fNumber.EPSILON){if(V<0&&(R=b[x],Z=-Z,M=b[S],V=-V),A.yM.y)continue;if(A.y===R.y){if(A.x===R.x)return!0}else{const N=V*(A.x-R.x)-Z*(A.y-R.y);if(N===0)return!0;if(N<0)continue;B=!B}}else{if(A.y!==R.y)continue;if(M.x<=A.x&&A.x<=R.x||R.x<=A.x&&A.x<=M.x)return!0}}return B}const s=Nr.isClockWise,r=this.subPaths;if(r.length===0)return[];let o,a,l;const c=[];if(r.length===1)return a=r[0],l=new ll,l.curves=a.curves,c.push(l),c;let u=!s(r[0].getPoints());u=e?!u:u;const C=[],d=[];let h=[],m=0,v;d[m]=void 0,h[m]=[];for(let A=0,b=r.length;A1){let A=!1,b=0;for(let f=0,B=d.length;f0&&A===!1&&(h=C)}let y;for(let A=0,b=d.length;Au||s.y>u)&&(s.x>u&&(r.x=Math.floor(u/L.x),s.x=r.x*L.x,le.mapSize.x=r.x),s.y>u&&(r.y=Math.floor(u/L.y),s.y=r.y*L.y,le.mapSize.y=r.y)),le.map===null||D===!0||k===!0){const P=this.type!==ir?{minFilter:pt,magFilter:pt}:{};le.map!==null&&le.map.dispose(),le.map=new Rt(s.x,s.y,P),le.map.texture.name=Ce.name+".shadowMap",le.camera.updateProjectionMatrix()}n.setRenderTarget(le.map),n.clear();const J=le.getViewportCount();for(let P=0;P0||x.map&&x.alphaTest>0){const N=Z.uuid,D=x.uuid;let k=c[N];k===void 0&&(k={},c[N]=k);let $=k[D];$===void 0&&($=Z.clone(),k[D]=$),Z=$}if(Z.visible=x.visible,Z.wireframe=x.wireframe,M===ir?Z.side=x.shadowSide!==null?x.shadowSide:x.side:Z.side=x.shadowSide!==null?x.shadowSide:C[x.side],Z.alphaMap=x.alphaMap,Z.alphaTest=x.alphaTest,Z.map=x.map,Z.clipShadows=x.clipShadows,Z.clippingPlanes=x.clippingPlanes,Z.clipIntersection=x.clipIntersection,Z.displacementMap=x.displacementMap,Z.displacementScale=x.displacementScale,Z.displacementBias=x.displacementBias,Z.wireframeLinewidth=x.wireframeLinewidth,Z.linewidth=x.linewidth,R.isPointLight===!0&&Z.isMeshDistanceMaterial===!0){const N=n.properties.get(Z);N.light=R}return Z}function B(S,x,R,M,Z){if(S.visible===!1)return;if(S.layers.test(x.layers)&&(S.isMesh||S.isLine||S.isPoints)&&(S.castShadow||S.receiveShadow&&Z===ir)&&(!S.frustumCulled||i.intersectsObject(S))){S.modelViewMatrix.multiplyMatrices(R.matrixWorldInverse,S.matrixWorld);const D=e.update(S),k=S.material;if(Array.isArray(k)){const $=D.groups;for(let te=0,Ce=$.length;te=1):L.indexOf("OpenGL ES")!==-1&&(le=parseFloat(/^OpenGL ES (\d)/.exec(L)[1]),Ce=le>=2);let J=null,P={};const ce=n.getParameter(n.SCISSOR_BOX),se=n.getParameter(n.VIEWPORT),ee=new Vt().fromArray(ce),re=new Vt().fromArray(se);function ve(O,he,Be,Ye){const Ue=new Uint8Array(4),Dt=n.createTexture();n.bindTexture(O,Dt),n.texParameteri(O,n.TEXTURE_MIN_FILTER,n.NEAREST),n.texParameteri(O,n.TEXTURE_MAG_FILTER,n.NEAREST);for(let Ut=0;Ut"u"?!1:/OculusBrowser/g.test(navigator.userAgent),m=new WeakMap;let v;const y=new WeakMap;let A=!1;try{A=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function b(T,X){return A?new OffscreenCanvas(T,X):Cu("canvas")}function f(T,X,ge,Ge){let Ze=1;if((T.width>Ge||T.height>Ge)&&(Ze=Ge/Math.max(T.width,T.height)),Ze<1||X===!0)if(typeof HTMLImageElement<"u"&&T instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&T instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&T instanceof ImageBitmap){const Me=X?m1:Math.floor,gt=Me(Ze*T.width),Ke=Me(Ze*T.height);v===void 0&&(v=b(gt,Ke));const pe=ge?b(gt,Ke):v;return pe.width=gt,pe.height=Ke,pe.getContext("2d").drawImage(T,0,0,gt,Ke),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+T.width+"x"+T.height+") to ("+gt+"x"+Ke+")."),pe}else return"data"in T&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+T.width+"x"+T.height+")."),T;return T}function B(T){return $0(T.width)&&$0(T.height)}function S(T){return a?!1:T.wrapS!==zn||T.wrapT!==zn||T.minFilter!==pt&&T.minFilter!==je}function x(T,X){return T.generateMipmaps&&X&&T.minFilter!==pt&&T.minFilter!==je}function R(T){n.generateMipmap(T)}function M(T,X,ge,Ge,Ze=!1){if(a===!1)return X;if(T!==null){if(n[T]!==void 0)return n[T];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+T+"'")}let Me=X;return X===n.RED&&(ge===n.FLOAT&&(Me=n.R32F),ge===n.HALF_FLOAT&&(Me=n.R16F),ge===n.UNSIGNED_BYTE&&(Me=n.R8)),X===n.RG&&(ge===n.FLOAT&&(Me=n.RG32F),ge===n.HALF_FLOAT&&(Me=n.RG16F),ge===n.UNSIGNED_BYTE&&(Me=n.RG8)),X===n.RGBA&&(ge===n.FLOAT&&(Me=n.RGBA32F),ge===n.HALF_FLOAT&&(Me=n.RGBA16F),ge===n.UNSIGNED_BYTE&&(Me=Ge===mt&&Ze===!1?n.SRGB8_ALPHA8:n.RGBA8),ge===n.UNSIGNED_SHORT_4_4_4_4&&(Me=n.RGBA4),ge===n.UNSIGNED_SHORT_5_5_5_1&&(Me=n.RGB5_A1)),(Me===n.R16F||Me===n.R32F||Me===n.RG16F||Me===n.RG32F||Me===n.RGBA16F||Me===n.RGBA32F)&&e.get("EXT_color_buffer_float"),Me}function Z(T,X,ge){return x(T,ge)===!0||T.isFramebufferTexture&&T.minFilter!==pt&&T.minFilter!==je?Math.log2(Math.max(X.width,X.height))+1:T.mipmaps!==void 0&&T.mipmaps.length>0?T.mipmaps.length:T.isCompressedTexture&&Array.isArray(T.image)?X.mipmaps.length:1}function V(T){return T===pt||T===sA||T===MI?n.NEAREST:n.LINEAR}function N(T){const X=T.target;X.removeEventListener("dispose",N),k(X),X.isVideoTexture&&m.delete(X)}function D(T){const X=T.target;X.removeEventListener("dispose",D),te(X)}function k(T){const X=i.get(T);if(X.__webglInit===void 0)return;const ge=T.source,Ge=y.get(ge);if(Ge){const Ze=Ge[X.__cacheKey];Ze.usedTimes--,Ze.usedTimes===0&&$(T),Object.keys(Ge).length===0&&y.delete(ge)}i.remove(T)}function $(T){const X=i.get(T);n.deleteTexture(X.__webglTexture);const ge=T.source,Ge=y.get(ge);delete Ge[X.__cacheKey],o.memory.textures--}function te(T){const X=T.texture,ge=i.get(T),Ge=i.get(X);if(Ge.__webglTexture!==void 0&&(n.deleteTexture(Ge.__webglTexture),o.memory.textures--),T.depthTexture&&T.depthTexture.dispose(),T.isWebGLCubeRenderTarget)for(let Ze=0;Ze<6;Ze++)n.deleteFramebuffer(ge.__webglFramebuffer[Ze]),ge.__webglDepthbuffer&&n.deleteRenderbuffer(ge.__webglDepthbuffer[Ze]);else{if(n.deleteFramebuffer(ge.__webglFramebuffer),ge.__webglDepthbuffer&&n.deleteRenderbuffer(ge.__webglDepthbuffer),ge.__webglMultisampledFramebuffer&&n.deleteFramebuffer(ge.__webglMultisampledFramebuffer),ge.__webglColorRenderbuffer)for(let Ze=0;Ze=l&&console.warn("THREE.WebGLTextures: Trying to use "+T+" texture units while this GPU supports only "+l),Ce+=1,T}function J(T){const X=[];return X.push(T.wrapS),X.push(T.wrapT),X.push(T.wrapR||0),X.push(T.magFilter),X.push(T.minFilter),X.push(T.anisotropy),X.push(T.internalFormat),X.push(T.format),X.push(T.type),X.push(T.generateMipmaps),X.push(T.premultiplyAlpha),X.push(T.flipY),X.push(T.unpackAlignment),X.push(T.colorSpace),X.join()}function P(T,X){const ge=i.get(T);if(T.isVideoTexture&&ut(T),T.isRenderTargetTexture===!1&&T.version>0&&ge.__version!==T.version){const Ge=T.image;if(Ge===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(Ge.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{nt(ge,T,X);return}}t.bindTexture(n.TEXTURE_2D,ge.__webglTexture,n.TEXTURE0+X)}function ce(T,X){const ge=i.get(T);if(T.version>0&&ge.__version!==T.version){nt(ge,T,X);return}t.bindTexture(n.TEXTURE_2D_ARRAY,ge.__webglTexture,n.TEXTURE0+X)}function se(T,X){const ge=i.get(T);if(T.version>0&&ge.__version!==T.version){nt(ge,T,X);return}t.bindTexture(n.TEXTURE_3D,ge.__webglTexture,n.TEXTURE0+X)}function ee(T,X){const ge=i.get(T);if(T.version>0&&ge.__version!==T.version){lt(ge,T,X);return}t.bindTexture(n.TEXTURE_CUBE_MAP,ge.__webglTexture,n.TEXTURE0+X)}const re={[hs]:n.REPEAT,[zn]:n.CLAMP_TO_EDGE,[lu]:n.MIRRORED_REPEAT},ve={[pt]:n.NEAREST,[sA]:n.NEAREST_MIPMAP_NEAREST,[MI]:n.NEAREST_MIPMAP_LINEAR,[je]:n.LINEAR,[Zv]:n.LINEAR_MIPMAP_NEAREST,[la]:n.LINEAR_MIPMAP_LINEAR};function ye(T,X,ge){if(ge?(n.texParameteri(T,n.TEXTURE_WRAP_S,re[X.wrapS]),n.texParameteri(T,n.TEXTURE_WRAP_T,re[X.wrapT]),(T===n.TEXTURE_3D||T===n.TEXTURE_2D_ARRAY)&&n.texParameteri(T,n.TEXTURE_WRAP_R,re[X.wrapR]),n.texParameteri(T,n.TEXTURE_MAG_FILTER,ve[X.magFilter]),n.texParameteri(T,n.TEXTURE_MIN_FILTER,ve[X.minFilter])):(n.texParameteri(T,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(T,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),(T===n.TEXTURE_3D||T===n.TEXTURE_2D_ARRAY)&&n.texParameteri(T,n.TEXTURE_WRAP_R,n.CLAMP_TO_EDGE),(X.wrapS!==zn||X.wrapT!==zn)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),n.texParameteri(T,n.TEXTURE_MAG_FILTER,V(X.magFilter)),n.texParameteri(T,n.TEXTURE_MIN_FILTER,V(X.minFilter)),X.minFilter!==pt&&X.minFilter!==je&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),e.has("EXT_texture_filter_anisotropic")===!0){const Ge=e.get("EXT_texture_filter_anisotropic");if(X.magFilter===pt||X.minFilter!==MI&&X.minFilter!==la||X.type===wn&&e.has("OES_texture_float_linear")===!1||a===!1&&X.type===us&&e.has("OES_texture_half_float_linear")===!1)return;(X.anisotropy>1||i.get(X).__currentAnisotropy)&&(n.texParameterf(T,Ge.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(X.anisotropy,s.getMaxAnisotropy())),i.get(X).__currentAnisotropy=X.anisotropy)}}function _(T,X){let ge=!1;T.__webglInit===void 0&&(T.__webglInit=!0,X.addEventListener("dispose",N));const Ge=X.source;let Ze=y.get(Ge);Ze===void 0&&(Ze={},y.set(Ge,Ze));const Me=J(X);if(Me!==T.__cacheKey){Ze[Me]===void 0&&(Ze[Me]={texture:n.createTexture(),usedTimes:0},o.memory.textures++,ge=!0),Ze[Me].usedTimes++;const gt=Ze[T.__cacheKey];gt!==void 0&&(Ze[T.__cacheKey].usedTimes--,gt.usedTimes===0&&$(X)),T.__cacheKey=Me,T.__webglTexture=Ze[Me].texture}return ge}function nt(T,X,ge){let Ge=n.TEXTURE_2D;(X.isDataArrayTexture||X.isCompressedArrayTexture)&&(Ge=n.TEXTURE_2D_ARRAY),X.isData3DTexture&&(Ge=n.TEXTURE_3D);const Ze=_(T,X),Me=X.source;t.bindTexture(Ge,T.__webglTexture,n.TEXTURE0+ge);const gt=i.get(Me);if(Me.version!==gt.__version||Ze===!0){t.activeTexture(n.TEXTURE0+ge),n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,X.flipY),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,X.premultiplyAlpha),n.pixelStorei(n.UNPACK_ALIGNMENT,X.unpackAlignment),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,n.NONE);const Ke=S(X)&&B(X.image)===!1;let pe=f(X.image,Ke,!1,u);pe=Nt(X,pe);const De=B(pe)||a,$e=r.convert(X.format,X.colorSpace);let ot=r.convert(X.type),Te=M(X.internalFormat,$e,ot,X.colorSpace);ye(Ge,X,De);let Oe;const Wt=X.mipmaps,Et=a&&X.isVideoTexture!==!0,Cn=gt.__version===void 0||Ze===!0,O=Z(X,pe,De);if(X.isDepthTexture)Te=n.DEPTH_COMPONENT,a?X.type===wn?Te=n.DEPTH_COMPONENT32F:X.type===oo?Te=n.DEPTH_COMPONENT24:X.type===ta?Te=n.DEPTH24_STENCIL8:Te=n.DEPTH_COMPONENT16:X.type===wn&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),X.format===na&&Te===n.DEPTH_COMPONENT&&X.type!==wv&&X.type!==oo&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),X.type=oo,ot=r.convert(X.type)),X.format===ga&&Te===n.DEPTH_COMPONENT&&(Te=n.DEPTH_STENCIL,X.type!==ta&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),X.type=ta,ot=r.convert(X.type))),Cn&&(Et?t.texStorage2D(n.TEXTURE_2D,1,Te,pe.width,pe.height):t.texImage2D(n.TEXTURE_2D,0,Te,pe.width,pe.height,0,$e,ot,null));else if(X.isDataTexture)if(Wt.length>0&&De){Et&&Cn&&t.texStorage2D(n.TEXTURE_2D,O,Te,Wt[0].width,Wt[0].height);for(let he=0,Be=Wt.length;he>=1,Be>>=1}}else if(Wt.length>0&&De){Et&&Cn&&t.texStorage2D(n.TEXTURE_2D,O,Te,Wt[0].width,Wt[0].height);for(let he=0,Be=Wt.length;he0&&Cn++,t.texStorage2D(n.TEXTURE_CUBE_MAP,Cn,Oe,pe[0].width,pe[0].height));for(let he=0;he<6;he++)if(Ke){Wt?t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+he,0,0,0,pe[he].width,pe[he].height,ot,Te,pe[he].data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+he,0,Oe,pe[he].width,pe[he].height,0,ot,Te,pe[he].data);for(let Be=0;Be=n.TEXTURE_CUBE_MAP_POSITIVE_X&&Ze<=n.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&n.framebufferTexture2D(n.FRAMEBUFFER,Ge,Ze,i.get(ge).__webglTexture,0),t.bindFramebuffer(n.FRAMEBUFFER,null)}function Xe(T,X,ge){if(n.bindRenderbuffer(n.RENDERBUFFER,T),X.depthBuffer&&!X.stencilBuffer){let Ge=n.DEPTH_COMPONENT16;if(ge||qe(X)){const Ze=X.depthTexture;Ze&&Ze.isDepthTexture&&(Ze.type===wn?Ge=n.DEPTH_COMPONENT32F:Ze.type===oo&&(Ge=n.DEPTH_COMPONENT24));const Me=rt(X);qe(X)?d.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,Me,Ge,X.width,X.height):n.renderbufferStorageMultisample(n.RENDERBUFFER,Me,Ge,X.width,X.height)}else n.renderbufferStorage(n.RENDERBUFFER,Ge,X.width,X.height);n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,T)}else if(X.depthBuffer&&X.stencilBuffer){const Ge=rt(X);ge&&qe(X)===!1?n.renderbufferStorageMultisample(n.RENDERBUFFER,Ge,n.DEPTH24_STENCIL8,X.width,X.height):qe(X)?d.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,Ge,n.DEPTH24_STENCIL8,X.width,X.height):n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_STENCIL,X.width,X.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.RENDERBUFFER,T)}else{const Ge=X.isWebGLMultipleRenderTargets===!0?X.texture:[X.texture];for(let Ze=0;Ze0&&qe(T)===!1){const Ke=Me?X:[X];ge.__webglMultisampledFramebuffer=n.createFramebuffer(),ge.__webglColorRenderbuffer=[],t.bindFramebuffer(n.FRAMEBUFFER,ge.__webglMultisampledFramebuffer);for(let pe=0;pe0&&qe(T)===!1){const X=T.isWebGLMultipleRenderTargets?T.texture:[T.texture],ge=T.width,Ge=T.height;let Ze=n.COLOR_BUFFER_BIT;const Me=[],gt=T.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,Ke=i.get(T),pe=T.isWebGLMultipleRenderTargets===!0;if(pe)for(let De=0;De0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&X.__useRenderToTexture!==!1}function ut(T){const X=o.render.frame;m.get(T)!==X&&(m.set(T,X),T.update())}function Nt(T,X){const ge=T.colorSpace,Ge=T.format,Ze=T.type;return T.isCompressedTexture===!0||T.format===oA||ge!==ur&&ge!==co&&(ge===mt?a===!1?e.has("EXT_sRGB")===!0&&Ge===un?(T.format=oA,T.minFilter=je,T.generateMipmaps=!1):X=Mv.sRGBToLinear(X):(Ge!==un||Ze!==rn)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",ge)),X}this.allocateTextureUnit=L,this.resetTextureUnits=le,this.setTexture2D=P,this.setTexture2DArray=ce,this.setTexture3D=se,this.setTextureCube=ee,this.rebindTextures=be,this.setupRenderTarget=Le,this.updateRenderTargetMipmap=Ve,this.updateMultisampleRenderTarget=st,this.setupDepthRenderbuffer=ue,this.setupFrameBufferTexture=Se,this.useMultisampledRTT=qe}function W1(n,e,t){const i=t.isWebGL2;function s(r,o=co){let a;if(r===rn)return n.UNSIGNED_BYTE;if(r===n1)return n.UNSIGNED_SHORT_4_4_4_4;if(r===i1)return n.UNSIGNED_SHORT_5_5_5_1;if(r===$R)return n.BYTE;if(r===e1)return n.SHORT;if(r===wv)return n.UNSIGNED_SHORT;if(r===t1)return n.INT;if(r===oo)return n.UNSIGNED_INT;if(r===wn)return n.FLOAT;if(r===us)return i?n.HALF_FLOAT:(a=e.get("OES_texture_half_float"),a!==null?a.HALF_FLOAT_OES:null);if(r===s1)return n.ALPHA;if(r===un)return n.RGBA;if(r===WA)return n.LUMINANCE;if(r===r1)return n.LUMINANCE_ALPHA;if(r===na)return n.DEPTH_COMPONENT;if(r===ga)return n.DEPTH_STENCIL;if(r===oA)return a=e.get("EXT_sRGB"),a!==null?a.SRGB_ALPHA_EXT:null;if(r===Sv)return n.RED;if(r===o1)return n.RED_INTEGER;if(r===xv)return n.RG;if(r===a1)return n.RG_INTEGER;if(r===l1)return n.RGBA_INTEGER;if(r===yh||r===Gh||r===Bh||r===Zh)if(o===mt)if(a=e.get("WEBGL_compressed_texture_s3tc_srgb"),a!==null){if(r===yh)return a.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(r===Gh)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(r===Bh)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(r===Zh)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(a=e.get("WEBGL_compressed_texture_s3tc"),a!==null){if(r===yh)return a.COMPRESSED_RGB_S3TC_DXT1_EXT;if(r===Gh)return a.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(r===Bh)return a.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(r===Zh)return a.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(r===W0||r===V0||r===M0||r===N0)if(a=e.get("WEBGL_compressed_texture_pvrtc"),a!==null){if(r===W0)return a.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(r===V0)return a.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(r===M0)return a.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(r===N0)return a.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(r===g1)return a=e.get("WEBGL_compressed_texture_etc1"),a!==null?a.COMPRESSED_RGB_ETC1_WEBGL:null;if(r===H0||r===X0)if(a=e.get("WEBGL_compressed_texture_etc"),a!==null){if(r===H0)return o===mt?a.COMPRESSED_SRGB8_ETC2:a.COMPRESSED_RGB8_ETC2;if(r===X0)return o===mt?a.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:a.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(r===Y0||r===F0||r===K0||r===z0||r===L0||r===T0||r===E0||r===k0||r===D0||r===U0||r===P0||r===_0||r===J0||r===O0)if(a=e.get("WEBGL_compressed_texture_astc"),a!==null){if(r===Y0)return o===mt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:a.COMPRESSED_RGBA_ASTC_4x4_KHR;if(r===F0)return o===mt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:a.COMPRESSED_RGBA_ASTC_5x4_KHR;if(r===K0)return o===mt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:a.COMPRESSED_RGBA_ASTC_5x5_KHR;if(r===z0)return o===mt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:a.COMPRESSED_RGBA_ASTC_6x5_KHR;if(r===L0)return o===mt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:a.COMPRESSED_RGBA_ASTC_6x6_KHR;if(r===T0)return o===mt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:a.COMPRESSED_RGBA_ASTC_8x5_KHR;if(r===E0)return o===mt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:a.COMPRESSED_RGBA_ASTC_8x6_KHR;if(r===k0)return o===mt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:a.COMPRESSED_RGBA_ASTC_8x8_KHR;if(r===D0)return o===mt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:a.COMPRESSED_RGBA_ASTC_10x5_KHR;if(r===U0)return o===mt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:a.COMPRESSED_RGBA_ASTC_10x6_KHR;if(r===P0)return o===mt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:a.COMPRESSED_RGBA_ASTC_10x8_KHR;if(r===_0)return o===mt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:a.COMPRESSED_RGBA_ASTC_10x10_KHR;if(r===J0)return o===mt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:a.COMPRESSED_RGBA_ASTC_12x10_KHR;if(r===O0)return o===mt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:a.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(r===wh)if(a=e.get("EXT_texture_compression_bptc"),a!==null){if(r===wh)return o===mt?a.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:a.COMPRESSED_RGBA_BPTC_UNORM_EXT}else return null;if(r===c1||r===Q0||r===j0||r===q0)if(a=e.get("EXT_texture_compression_rgtc"),a!==null){if(r===wh)return a.COMPRESSED_RED_RGTC1_EXT;if(r===Q0)return a.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(r===j0)return a.COMPRESSED_RED_GREEN_RGTC2_EXT;if(r===q0)return a.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return r===ta?i?n.UNSIGNED_INT_24_8:(a=e.get("WEBGL_depth_texture"),a!==null?a.UNSIGNED_INT_24_8_WEBGL:null):n[r]!==void 0?n[r]:null}return{convert:s}}class V1 extends An{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class Rg extends Xt{constructor(){super(),this.isGroup=!0,this.type="Group"}}const uK={type:"move"};class qm{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Rg,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 Rg,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new H,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new H),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Rg,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new H,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new H),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 i of e.hand.values())this._getHandJoint(t,i)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,i){let s=null,r=null,o=null;const a=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){o=!0;for(const v of e.hand.values()){const y=t.getJointPose(v,i),A=this._getHandJoint(c,v);y!==null&&(A.matrix.fromArray(y.transform.matrix),A.matrix.decompose(A.position,A.rotation,A.scale),A.matrixWorldNeedsUpdate=!0,A.jointRadius=y.radius),A.visible=y!==null}const u=c.joints["index-finger-tip"],C=c.joints["thumb-tip"],d=u.position.distanceTo(C.position),h=.02,m=.005;c.inputState.pinching&&d>h+m?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&d<=h-m&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(r=t.getPose(e.gripSpace,i),r!==null&&(l.matrix.fromArray(r.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,r.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(r.linearVelocity)):l.hasLinearVelocity=!1,r.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(r.angularVelocity)):l.hasAngularVelocity=!1));a!==null&&(s=t.getPose(e.targetRaySpace,i),s===null&&r!==null&&(s=r),s!==null&&(a.matrix.fromArray(s.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,s.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(s.linearVelocity)):a.hasLinearVelocity=!1,s.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(s.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(uK)))}return a!==null&&(a.visible=s!==null),l!==null&&(l.visible=r!==null),c!==null&&(c.visible=o!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const i=new Rg;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[t.jointName]=i,e.add(i)}return e.joints[t.jointName]}}class FA extends qt{constructor(e,t,i,s,r,o,a,l,c,u){if(u=u!==void 0?u:na,u!==na&&u!==ga)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");i===void 0&&u===na&&(i=oo),i===void 0&&u===ga&&(i=ta),super(null,s,r,o,a,l,u,i,c),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=a!==void 0?a:pt,this.minFilter=l!==void 0?l:pt,this.flipY=!1,this.generateMipmaps=!1}}class CK extends zs{constructor(e,t){super();const i=this;let s=null,r=1,o=null,a="local-floor",l=1,c=null,u=null,C=null,d=null,h=null,m=null;const v=t.getContextAttributes();let y=null,A=null;const b=[],f=[],B=new Set,S=new Map,x=new An;x.layers.enable(1),x.viewport=new Vt;const R=new An;R.layers.enable(2),R.viewport=new Vt;const M=[x,R],Z=new V1;Z.layers.enable(1),Z.layers.enable(2);let V=null,N=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(ee){let re=b[ee];return re===void 0&&(re=new qm,b[ee]=re),re.getTargetRaySpace()},this.getControllerGrip=function(ee){let re=b[ee];return re===void 0&&(re=new qm,b[ee]=re),re.getGripSpace()},this.getHand=function(ee){let re=b[ee];return re===void 0&&(re=new qm,b[ee]=re),re.getHandSpace()};function D(ee){const re=f.indexOf(ee.inputSource);if(re===-1)return;const ve=b[re];ve!==void 0&&(ve.update(ee.inputSource,ee.frame,c||o),ve.dispatchEvent({type:ee.type,data:ee.inputSource}))}function k(){s.removeEventListener("select",D),s.removeEventListener("selectstart",D),s.removeEventListener("selectend",D),s.removeEventListener("squeeze",D),s.removeEventListener("squeezestart",D),s.removeEventListener("squeezeend",D),s.removeEventListener("end",k),s.removeEventListener("inputsourceschange",$);for(let ee=0;ee=0&&(f[ye]=null,b[ye].disconnect(ve))}for(let re=0;re=f.length){f.push(ve),ye=nt;break}else if(f[nt]===null){f[nt]=ve,ye=nt;break}if(ye===-1)break}const _=b[ye];_&&_.connect(ve)}}const te=new H,Ce=new H;function le(ee,re,ve){te.setFromMatrixPosition(re.matrixWorld),Ce.setFromMatrixPosition(ve.matrixWorld);const ye=te.distanceTo(Ce),_=re.projectionMatrix.elements,nt=ve.projectionMatrix.elements,lt=_[14]/(_[10]-1),Se=_[14]/(_[10]+1),Xe=(_[9]+1)/_[5],fe=(_[9]-1)/_[5],ue=(_[8]-1)/_[0],be=(nt[8]+1)/nt[0],Le=lt*ue,Ve=lt*be,st=ye/(-ue+be),rt=st*-ue;re.matrixWorld.decompose(ee.position,ee.quaternion,ee.scale),ee.translateX(rt),ee.translateZ(st),ee.matrixWorld.compose(ee.position,ee.quaternion,ee.scale),ee.matrixWorldInverse.copy(ee.matrixWorld).invert();const qe=lt+st,ut=Se+st,Nt=Le-rt,T=Ve+(ye-rt),X=Xe*Se/ut*qe,ge=fe*Se/ut*qe;ee.projectionMatrix.makePerspective(Nt,T,X,ge,qe,ut),ee.projectionMatrixInverse.copy(ee.projectionMatrix).invert()}function L(ee,re){re===null?ee.matrixWorld.copy(ee.matrix):ee.matrixWorld.multiplyMatrices(re.matrixWorld,ee.matrix),ee.matrixWorldInverse.copy(ee.matrixWorld).invert()}this.updateCamera=function(ee){if(s===null)return;Z.near=R.near=x.near=ee.near,Z.far=R.far=x.far=ee.far,(V!==Z.near||N!==Z.far)&&(s.updateRenderState({depthNear:Z.near,depthFar:Z.far}),V=Z.near,N=Z.far);const re=ee.parent,ve=Z.cameras;L(Z,re);for(let ye=0;ye_&&(S.set(ye,ye.lastChangedTime),i.dispatchEvent({type:"planechanged",data:ye}))}}m=null}const se=new Z1;se.setAnimationLoop(ce),this.setAnimationLoop=function(ee){P=ee},this.dispose=function(){}}}function dK(n,e){function t(y,A){y.matrixAutoUpdate===!0&&y.updateMatrix(),A.value.copy(y.matrix)}function i(y,A){A.color.getRGB(y.fogColor.value,G1(n)),A.isFog?(y.fogNear.value=A.near,y.fogFar.value=A.far):A.isFogExp2&&(y.fogDensity.value=A.density)}function s(y,A,b,f,B){A.isMeshBasicMaterial||A.isMeshLambertMaterial?r(y,A):A.isMeshToonMaterial?(r(y,A),C(y,A)):A.isMeshPhongMaterial?(r(y,A),u(y,A)):A.isMeshStandardMaterial?(r(y,A),d(y,A),A.isMeshPhysicalMaterial&&h(y,A,B)):A.isMeshMatcapMaterial?(r(y,A),m(y,A)):A.isMeshDepthMaterial?r(y,A):A.isMeshDistanceMaterial?(r(y,A),v(y,A)):A.isMeshNormalMaterial?r(y,A):A.isLineBasicMaterial?(o(y,A),A.isLineDashedMaterial&&a(y,A)):A.isPointsMaterial?l(y,A,b,f):A.isSpriteMaterial?c(y,A):A.isShadowMaterial?(y.color.value.copy(A.color),y.opacity.value=A.opacity):A.isShaderMaterial&&(A.uniformsNeedUpdate=!1)}function r(y,A){y.opacity.value=A.opacity,A.color&&y.diffuse.value.copy(A.color),A.emissive&&y.emissive.value.copy(A.emissive).multiplyScalar(A.emissiveIntensity),A.map&&(y.map.value=A.map,t(A.map,y.mapTransform)),A.alphaMap&&(y.alphaMap.value=A.alphaMap,t(A.alphaMap,y.alphaMapTransform)),A.bumpMap&&(y.bumpMap.value=A.bumpMap,t(A.bumpMap,y.bumpMapTransform),y.bumpScale.value=A.bumpScale,A.side===Tn&&(y.bumpScale.value*=-1)),A.normalMap&&(y.normalMap.value=A.normalMap,t(A.normalMap,y.normalMapTransform),y.normalScale.value.copy(A.normalScale),A.side===Tn&&y.normalScale.value.negate()),A.displacementMap&&(y.displacementMap.value=A.displacementMap,t(A.displacementMap,y.displacementMapTransform),y.displacementScale.value=A.displacementScale,y.displacementBias.value=A.displacementBias),A.emissiveMap&&(y.emissiveMap.value=A.emissiveMap,t(A.emissiveMap,y.emissiveMapTransform)),A.specularMap&&(y.specularMap.value=A.specularMap,t(A.specularMap,y.specularMapTransform)),A.alphaTest>0&&(y.alphaTest.value=A.alphaTest);const b=e.get(A).envMap;if(b&&(y.envMap.value=b,y.flipEnvMap.value=b.isCubeTexture&&b.isRenderTargetTexture===!1?-1:1,y.reflectivity.value=A.reflectivity,y.ior.value=A.ior,y.refractionRatio.value=A.refractionRatio),A.lightMap){y.lightMap.value=A.lightMap;const f=n.useLegacyLights===!0?Math.PI:1;y.lightMapIntensity.value=A.lightMapIntensity*f,t(A.lightMap,y.lightMapTransform)}A.aoMap&&(y.aoMap.value=A.aoMap,y.aoMapIntensity.value=A.aoMapIntensity,t(A.aoMap,y.aoMapTransform))}function o(y,A){y.diffuse.value.copy(A.color),y.opacity.value=A.opacity,A.map&&(y.map.value=A.map,t(A.map,y.mapTransform))}function a(y,A){y.dashSize.value=A.dashSize,y.totalSize.value=A.dashSize+A.gapSize,y.scale.value=A.scale}function l(y,A,b,f){y.diffuse.value.copy(A.color),y.opacity.value=A.opacity,y.size.value=A.size*b,y.scale.value=f*.5,A.map&&(y.map.value=A.map,t(A.map,y.uvTransform)),A.alphaMap&&(y.alphaMap.value=A.alphaMap),A.alphaTest>0&&(y.alphaTest.value=A.alphaTest)}function c(y,A){y.diffuse.value.copy(A.color),y.opacity.value=A.opacity,y.rotation.value=A.rotation,A.map&&(y.map.value=A.map,t(A.map,y.mapTransform)),A.alphaMap&&(y.alphaMap.value=A.alphaMap),A.alphaTest>0&&(y.alphaTest.value=A.alphaTest)}function u(y,A){y.specular.value.copy(A.specular),y.shininess.value=Math.max(A.shininess,1e-4)}function C(y,A){A.gradientMap&&(y.gradientMap.value=A.gradientMap)}function d(y,A){y.metalness.value=A.metalness,A.metalnessMap&&(y.metalnessMap.value=A.metalnessMap,t(A.metalnessMap,y.metalnessMapTransform)),y.roughness.value=A.roughness,A.roughnessMap&&(y.roughnessMap.value=A.roughnessMap,t(A.roughnessMap,y.roughnessMapTransform)),e.get(A).envMap&&(y.envMapIntensity.value=A.envMapIntensity)}function h(y,A,b){y.ior.value=A.ior,A.sheen>0&&(y.sheenColor.value.copy(A.sheenColor).multiplyScalar(A.sheen),y.sheenRoughness.value=A.sheenRoughness,A.sheenColorMap&&(y.sheenColorMap.value=A.sheenColorMap,t(A.sheenColorMap,y.sheenColorMapTransform)),A.sheenRoughnessMap&&(y.sheenRoughnessMap.value=A.sheenRoughnessMap,t(A.sheenRoughnessMap,y.sheenRoughnessMapTransform))),A.clearcoat>0&&(y.clearcoat.value=A.clearcoat,y.clearcoatRoughness.value=A.clearcoatRoughness,A.clearcoatMap&&(y.clearcoatMap.value=A.clearcoatMap,t(A.clearcoatMap,y.clearcoatMapTransform)),A.clearcoatRoughnessMap&&(y.clearcoatRoughnessMap.value=A.clearcoatRoughnessMap,t(A.clearcoatRoughnessMap,y.clearcoatRoughnessMapTransform)),A.clearcoatNormalMap&&(y.clearcoatNormalMap.value=A.clearcoatNormalMap,t(A.clearcoatNormalMap,y.clearcoatNormalMapTransform),y.clearcoatNormalScale.value.copy(A.clearcoatNormalScale),A.side===Tn&&y.clearcoatNormalScale.value.negate())),A.iridescence>0&&(y.iridescence.value=A.iridescence,y.iridescenceIOR.value=A.iridescenceIOR,y.iridescenceThicknessMinimum.value=A.iridescenceThicknessRange[0],y.iridescenceThicknessMaximum.value=A.iridescenceThicknessRange[1],A.iridescenceMap&&(y.iridescenceMap.value=A.iridescenceMap,t(A.iridescenceMap,y.iridescenceMapTransform)),A.iridescenceThicknessMap&&(y.iridescenceThicknessMap.value=A.iridescenceThicknessMap,t(A.iridescenceThicknessMap,y.iridescenceThicknessMapTransform))),A.transmission>0&&(y.transmission.value=A.transmission,y.transmissionSamplerMap.value=b.texture,y.transmissionSamplerSize.value.set(b.width,b.height),A.transmissionMap&&(y.transmissionMap.value=A.transmissionMap,t(A.transmissionMap,y.transmissionMapTransform)),y.thickness.value=A.thickness,A.thicknessMap&&(y.thicknessMap.value=A.thicknessMap,t(A.thicknessMap,y.thicknessMapTransform)),y.attenuationDistance.value=A.attenuationDistance,y.attenuationColor.value.copy(A.attenuationColor)),y.specularIntensity.value=A.specularIntensity,y.specularColor.value.copy(A.specularColor),A.specularColorMap&&(y.specularColorMap.value=A.specularColorMap,t(A.specularColorMap,y.specularColorMapTransform)),A.specularIntensityMap&&(y.specularIntensityMap.value=A.specularIntensityMap,t(A.specularIntensityMap,y.specularIntensityMapTransform))}function m(y,A){A.matcap&&(y.matcap.value=A.matcap)}function v(y,A){const b=e.get(A).light;y.referencePosition.value.setFromMatrixPosition(b.matrixWorld),y.nearDistance.value=b.shadow.camera.near,y.farDistance.value=b.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:s}}function hK(n,e,t,i){let s={},r={},o=[];const a=t.isWebGL2?n.getParameter(n.MAX_UNIFORM_BUFFER_BINDINGS):0;function l(b,f){const B=f.program;i.uniformBlockBinding(b,B)}function c(b,f){let B=s[b.id];B===void 0&&(m(b),B=u(b),s[b.id]=B,b.addEventListener("dispose",y));const S=f.program;i.updateUBOMapping(b,S);const x=e.render.frame;r[b.id]!==x&&(d(b),r[b.id]=x)}function u(b){const f=C();b.__bindingPointIndex=f;const B=n.createBuffer(),S=b.__size,x=b.usage;return n.bindBuffer(n.UNIFORM_BUFFER,B),n.bufferData(n.UNIFORM_BUFFER,S,x),n.bindBuffer(n.UNIFORM_BUFFER,null),n.bindBufferBase(n.UNIFORM_BUFFER,f,B),B}function C(){for(let b=0;b0){x=B%S;const D=S-x;x!==0&&D-V.boundary<0&&(B+=S-x,Z.__offset=B)}B+=V.storage}return x=B%S,x>0&&(B+=S-x),b.__size=B,b.__cache={},this}function v(b){const f={boundary:0,storage:0};return typeof b=="number"?(f.boundary=4,f.storage=4):b.isVector2?(f.boundary=8,f.storage=8):b.isVector3||b.isColor?(f.boundary=16,f.storage=12):b.isVector4?(f.boundary=16,f.storage=16):b.isMatrix3?(f.boundary=48,f.storage=48):b.isMatrix4?(f.boundary=64,f.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),f}function y(b){const f=b.target;f.removeEventListener("dispose",y);const B=o.indexOf(f.__bindingPointIndex);o.splice(B,1),n.deleteBuffer(s[f.id]),delete s[f.id],delete r[f.id]}function A(){for(const b in s)n.deleteBuffer(s[b]);o=[],s={},r={}}return{bind:l,update:c,dispose:A}}function AK(){const n=Cu("canvas");return n.style.display="block",n}class Kv{constructor(e={}){const{canvas:t=AK(),context:i=null,depth:s=!0,stencil:r=!0,alpha:o=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:C=!1}=e;this.isWebGLRenderer=!0;let d;i!==null?d=i.getContextAttributes().alpha:d=o;let h=null,m=null;const v=[],y=[];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=mt,this.useLegacyLights=!0,this.toneMapping=gr,this.toneMappingExposure=1;const A=this;let b=!1,f=0,B=0,S=null,x=-1,R=null;const M=new Vt,Z=new Vt;let V=null,N=t.width,D=t.height,k=1,$=null,te=null;const Ce=new Vt(0,0,N,D),le=new Vt(0,0,N,D);let L=!1;const J=new HA;let P=!1,ce=!1,se=null;const ee=new Fe,re=new H,ve={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function ye(){return S===null?k:1}let _=i;function nt(Y,ae){for(let Ae=0;Ae0?m=y[y.length-1]:m=null,v.pop(),v.length>0?h=v[v.length-1]:h=null};function Jn(Y,ae,Ae,ie){if(Y.visible===!1)return;if(Y.layers.test(ae.layers)){if(Y.isGroup)Ae=Y.renderOrder;else if(Y.isLOD)Y.autoUpdate===!0&&Y.update(ae);else if(Y.isLight)m.pushLight(Y),Y.castShadow&&m.pushShadow(Y);else if(Y.isSprite){if(!Y.frustumCulled||J.intersectsSprite(Y)){ie&&re.setFromMatrixPosition(Y.matrixWorld).applyMatrix4(ee);const at=qe.update(Y),ct=Y.material;ct.visible&&h.push(Y,at,ct,Ae,re.z,null)}}else if((Y.isMesh||Y.isLine||Y.isPoints)&&(!Y.frustumCulled||J.intersectsObject(Y))){Y.isSkinnedMesh&&Y.skeleton.frame!==fe.render.frame&&(Y.skeleton.update(),Y.skeleton.frame=fe.render.frame);const at=qe.update(Y),ct=Y.material;if(ie&&(at.boundingSphere===null&&at.computeBoundingSphere(),re.copy(at.boundingSphere.center).applyMatrix4(Y.matrixWorld).applyMatrix4(ee)),Array.isArray(ct)){const ht=at.groups;for(let yt=0,Gt=ht.length;yt0&&gn(me,et,ae,Ae),ie&&Xe.viewport(M.copy(ie)),me.length>0&&yi(me,ae,Ae),et.length>0&&yi(et,ae,Ae),at.length>0&&yi(at,ae,Ae),Xe.buffers.depth.setTest(!0),Xe.buffers.depth.setMask(!0),Xe.buffers.color.setMask(!0),Xe.setPolygonOffset(!1)}function gn(Y,ae,Ae,ie){if(se===null){const ct=Se.isWebGL2;se=new Rt(1024,1024,{generateMipmaps:!0,type:lt.has("EXT_color_buffer_half_float")?us:rn,minFilter:la,samples:ct&&a===!0?4:0})}const me=A.getRenderTarget();A.setRenderTarget(se),A.clear();const et=A.toneMapping;A.toneMapping=gr,yi(Y,Ae,ie),be.updateMultisampleRenderTarget(se),be.updateRenderTargetMipmap(se);let at=!1;for(let ct=0,ht=ae.length;ct0&&be.useMultisampledRTT(Y)===!1?me=ue.get(Y).__webglMultisampledFramebuffer:me=Gt,M.copy(Y.viewport),Z.copy(Y.scissor),V=Y.scissorTest}else M.copy(Ce).multiplyScalar(k).floor(),Z.copy(le).multiplyScalar(k).floor(),V=L;if(Xe.bindFramebuffer(_.FRAMEBUFFER,me)&&Se.drawBuffers&&ie&&Xe.drawBuffers(Y,me),Xe.viewport(M),Xe.scissor(Z),Xe.setScissorTest(V),et){const ht=ue.get(Y.texture);_.framebufferTexture2D(_.FRAMEBUFFER,_.COLOR_ATTACHMENT0,_.TEXTURE_CUBE_MAP_POSITIVE_X+ae,ht.__webglTexture,Ae)}else if(at){const ht=ue.get(Y.texture),yt=ae||0;_.framebufferTextureLayer(_.FRAMEBUFFER,_.COLOR_ATTACHMENT0,ht.__webglTexture,Ae||0,yt)}x=-1},this.readRenderTargetPixels=function(Y,ae,Ae,ie,me,et,at){if(!(Y&&Y.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let ct=ue.get(Y).__webglFramebuffer;if(Y.isWebGLCubeRenderTarget&&at!==void 0&&(ct=ct[at]),ct){Xe.bindFramebuffer(_.FRAMEBUFFER,ct);try{const ht=Y.texture,yt=ht.format,Gt=ht.type;if(yt!==un&&pe.convert(yt)!==_.getParameter(_.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const wt=Gt===us&&(lt.has("EXT_color_buffer_half_float")||Se.isWebGL2&<.has("EXT_color_buffer_float"));if(Gt!==rn&&pe.convert(Gt)!==_.getParameter(_.IMPLEMENTATION_COLOR_READ_TYPE)&&!(Gt===wn&&(Se.isWebGL2||lt.has("OES_texture_float")||lt.has("WEBGL_color_buffer_float")))&&!wt){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}ae>=0&&ae<=Y.width-ie&&Ae>=0&&Ae<=Y.height-me&&_.readPixels(ae,Ae,ie,me,pe.convert(yt),pe.convert(Gt),et)}finally{const ht=S!==null?ue.get(S).__webglFramebuffer:null;Xe.bindFramebuffer(_.FRAMEBUFFER,ht)}}},this.copyFramebufferToTexture=function(Y,ae,Ae=0){const ie=Math.pow(2,-Ae),me=Math.floor(ae.image.width*ie),et=Math.floor(ae.image.height*ie);be.setTexture2D(ae,0),_.copyTexSubImage2D(_.TEXTURE_2D,Ae,0,0,Y.x,Y.y,me,et),Xe.unbindTexture()},this.copyTextureToTexture=function(Y,ae,Ae,ie=0){const me=ae.image.width,et=ae.image.height,at=pe.convert(Ae.format),ct=pe.convert(Ae.type);be.setTexture2D(Ae,0),_.pixelStorei(_.UNPACK_FLIP_Y_WEBGL,Ae.flipY),_.pixelStorei(_.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Ae.premultiplyAlpha),_.pixelStorei(_.UNPACK_ALIGNMENT,Ae.unpackAlignment),ae.isDataTexture?_.texSubImage2D(_.TEXTURE_2D,ie,Y.x,Y.y,me,et,at,ct,ae.image.data):ae.isCompressedTexture?_.compressedTexSubImage2D(_.TEXTURE_2D,ie,Y.x,Y.y,ae.mipmaps[0].width,ae.mipmaps[0].height,at,ae.mipmaps[0].data):_.texSubImage2D(_.TEXTURE_2D,ie,Y.x,Y.y,at,ct,ae.image),ie===0&&Ae.generateMipmaps&&_.generateMipmap(_.TEXTURE_2D),Xe.unbindTexture()},this.copyTextureToTexture3D=function(Y,ae,Ae,ie,me=0){if(A.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}const et=Y.max.x-Y.min.x+1,at=Y.max.y-Y.min.y+1,ct=Y.max.z-Y.min.z+1,ht=pe.convert(ie.format),yt=pe.convert(ie.type);let Gt;if(ie.isData3DTexture)be.setTexture3D(ie,0),Gt=_.TEXTURE_3D;else if(ie.isDataArrayTexture)be.setTexture2DArray(ie,0),Gt=_.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}_.pixelStorei(_.UNPACK_FLIP_Y_WEBGL,ie.flipY),_.pixelStorei(_.UNPACK_PREMULTIPLY_ALPHA_WEBGL,ie.premultiplyAlpha),_.pixelStorei(_.UNPACK_ALIGNMENT,ie.unpackAlignment);const wt=_.getParameter(_.UNPACK_ROW_LENGTH),Pt=_.getParameter(_.UNPACK_IMAGE_HEIGHT),ti=_.getParameter(_.UNPACK_SKIP_PIXELS),es=_.getParameter(_.UNPACK_SKIP_ROWS),ks=_.getParameter(_.UNPACK_SKIP_IMAGES),nn=Ae.isCompressedTexture?Ae.mipmaps[0]:Ae.image;_.pixelStorei(_.UNPACK_ROW_LENGTH,nn.width),_.pixelStorei(_.UNPACK_IMAGE_HEIGHT,nn.height),_.pixelStorei(_.UNPACK_SKIP_PIXELS,Y.min.x),_.pixelStorei(_.UNPACK_SKIP_ROWS,Y.min.y),_.pixelStorei(_.UNPACK_SKIP_IMAGES,Y.min.z),Ae.isDataTexture||Ae.isData3DTexture?_.texSubImage3D(Gt,me,ae.x,ae.y,ae.z,et,at,ct,ht,yt,nn.data):Ae.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),_.compressedTexSubImage3D(Gt,me,ae.x,ae.y,ae.z,et,at,ct,ht,nn.data)):_.texSubImage3D(Gt,me,ae.x,ae.y,ae.z,et,at,ct,ht,yt,nn),_.pixelStorei(_.UNPACK_ROW_LENGTH,wt),_.pixelStorei(_.UNPACK_IMAGE_HEIGHT,Pt),_.pixelStorei(_.UNPACK_SKIP_PIXELS,ti),_.pixelStorei(_.UNPACK_SKIP_ROWS,es),_.pixelStorei(_.UNPACK_SKIP_IMAGES,ks),me===0&&ie.generateMipmaps&&_.generateMipmap(Gt),Xe.unbindTexture()},this.initTexture=function(Y){Y.isCubeTexture?be.setTextureCube(Y,0):Y.isData3DTexture?be.setTexture3D(Y,0):Y.isDataArrayTexture||Y.isCompressedArrayTexture?be.setTexture2DArray(Y,0):be.setTexture2D(Y,0),Xe.unbindTexture()},this.resetState=function(){f=0,B=0,S=null,Xe.reset(),De.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get physicallyCorrectLights(){return console.warn("THREE.WebGLRenderer: the property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),!this.useLegacyLights}set physicallyCorrectLights(e){console.warn("THREE.WebGLRenderer: the property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),this.useLegacyLights=!e}get outputEncoding(){return console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace===mt?Ys:Vu}set outputEncoding(e){console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace=e===Ys?mt:ur}}class M1 extends Kv{}M1.prototype.isWebGL1Renderer=!0;class KA{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new Re(e),this.density=t}clone(){return new KA(this.color,this.density)}toJSON(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}class zA{constructor(e,t=1,i=1e3){this.isFog=!0,this.name="",this.color=new Re(e),this.near=t,this.far=i}clone(){return new zA(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}class dl extends Xt{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){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}get autoUpdate(){return console.warn("THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144."),this.matrixWorldAutoUpdate}set autoUpdate(e){console.warn("THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144."),this.matrixWorldAutoUpdate=e}}class LA{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=uu,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=Cs()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,i){e*=this.stride,i*=t.stride;for(let s=0,r=this.stride;se.far||t.push({distance:l,point:Qc.clone(),uv:Ui.getInterpolation(Qc,xd,qc,Rd,_2,$m,J2,new ne),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}function Wd(n,e,t,i,s,r){ag.subVectors(n,t).addScalar(.5).multiply(i),s!==void 0?(jc.x=r*ag.x-s*ag.y,jc.y=s*ag.x+r*ag.y):jc.copy(ag),n.copy(e),n.x+=jc.x,n.y+=jc.y,n.applyMatrix4(N1)}const Vd=new H,O2=new H;class X1 extends Xt{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);const t=e.levels;for(let i=0,s=t.length;i0){let i,s;for(i=1,s=t.length;i0){Vd.setFromMatrixPosition(this.matrixWorld);const s=e.ray.origin.distanceTo(Vd);this.getObjectForDistance(s).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){Vd.setFromMatrixPosition(e.matrixWorld),O2.setFromMatrixPosition(this.matrixWorld);const i=Vd.distanceTo(O2)/e.zoom;t[0].object.visible=!0;let s,r;for(s=1,r=t.length;s=o)t[s-1].object.visible=!1,t[s].object.visible=!0;else break}for(this._currentLevel=s-1;sl)continue;d.applyMatrix4(this.matrixWorld);const M=e.ray.origin.distanceTo(d);Me.far||t.push({distance:M,point:C.clone().applyMatrix4(this.matrixWorld),index:f,face:null,faceIndex:null,object:this})}}else{const A=Math.max(0,o.start),b=Math.min(y.count,o.start+o.count);for(let f=A,B=b-1;fl)continue;d.applyMatrix4(this.matrixWorld);const x=e.ray.origin.distanceTo(d);xe.far||t.push({distance:x,point:C.clone().applyMatrix4(this.matrixWorld),index:f,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){const t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){const s=t[i[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,o=s.length;r0){const s=t[i[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,o=s.length;rs.far)return;r.push({distance:c,distanceToRay:Math.sqrt(a),point:l,index:e,face:null,object:o})}}class z1 extends qt{constructor(e,t,i,s,r,o,a,l,c){super(e,t,i,s,r,o,a,l,c),this.isVideoTexture=!0,this.minFilter=o!==void 0?o:je,this.magFilter=r!==void 0?r:je,this.generateMipmaps=!1;const u=this;function C(){u.needsUpdate=!0,e.requestVideoFrameCallback(C)}"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(C)}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;"requestVideoFrameCallback"in e===!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}class nb extends qt{constructor(e,t,i){super({width:e,height:t}),this.isFramebufferTexture=!0,this.format=i,this.magFilter=pt,this.minFilter=pt,this.generateMipmaps=!1,this.needsUpdate=!0}}class Ev extends qt{constructor(e,t,i,s,r,o,a,l,c,u,C,d){super(null,o,a,l,c,u,s,r,C,d),this.isCompressedTexture=!0,this.image={width:t,height:i},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class bK extends Ev{constructor(e,t,i,s,r,o){super(e,t,i,r,o),this.isCompressedArrayTexture=!0,this.image.depth=s,this.wrapR=zn}}class L1 extends qt{constructor(e,t,i,s,r,o,a,l,c){super(e,t,i,s,r,o,a,l,c),this.isCanvasTexture=!0,this.needsUpdate=!0}}class Cr{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){const i=this.getUtoTmapping(e);return this.getPoint(i,t)}getPoints(e=5){const t=[];for(let i=0;i<=e;i++)t.push(this.getPoint(i/e));return t}getSpacedPoints(e=5){const t=[];for(let i=0;i<=e;i++)t.push(this.getPointAt(i/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 i,s=this.getPoint(0),r=0;t.push(0);for(let o=1;o<=e;o++)i=this.getPoint(o/e),r+=i.distanceTo(s),t.push(r),s=i;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){const i=this.getLengths();let s=0;const r=i.length;let o;t?o=t:o=e*i[r-1];let a=0,l=r-1,c;for(;a<=l;)if(s=Math.floor(a+(l-a)/2),c=i[s]-o,c<0)a=s+1;else if(c>0)l=s-1;else{l=s;break}if(s=l,i[s]===o)return s/(r-1);const u=i[s],d=i[s+1]-u,h=(o-u)/d;return(s+h)/(r-1)}getTangent(e,t){let s=e-1e-4,r=e+1e-4;s<0&&(s=0),r>1&&(r=1);const o=this.getPoint(s),a=this.getPoint(r),l=t||(o.isVector2?new ne:new H);return l.copy(a).sub(o).normalize(),l}getTangentAt(e,t){const i=this.getUtoTmapping(e);return this.getTangent(i,t)}computeFrenetFrames(e,t){const i=new H,s=[],r=[],o=[],a=new H,l=new Fe;for(let h=0;h<=e;h++){const m=h/e;s[h]=this.getTangentAt(m,new H)}r[0]=new H,o[0]=new H;let c=Number.MAX_VALUE;const u=Math.abs(s[0].x),C=Math.abs(s[0].y),d=Math.abs(s[0].z);u<=c&&(c=u,i.set(1,0,0)),C<=c&&(c=C,i.set(0,1,0)),d<=c&&i.set(0,0,1),a.crossVectors(s[0],i).normalize(),r[0].crossVectors(s[0],a),o[0].crossVectors(s[0],r[0]);for(let h=1;h<=e;h++){if(r[h]=r[h-1].clone(),o[h]=o[h-1].clone(),a.crossVectors(s[h-1],s[h]),a.length()>Number.EPSILON){a.normalize();const m=Math.acos(Gn(s[h-1].dot(s[h]),-1,1));r[h].applyMatrix4(l.makeRotationAxis(a,m))}o[h].crossVectors(s[h],r[h])}if(t===!0){let h=Math.acos(Gn(r[0].dot(r[e]),-1,1));h/=e,s[0].dot(a.crossVectors(r[0],r[e]))>0&&(h=-h);for(let m=1;m<=e;m++)r[m].applyMatrix4(l.makeRotationAxis(s[m],h*m)),o[m].crossVectors(s[m],r[m])}return{tangents:s,normals:r,binormals:o}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class EA extends Cr{constructor(e=0,t=0,i=1,s=1,r=0,o=Math.PI*2,a=!1,l=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=i,this.yRadius=s,this.aStartAngle=r,this.aEndAngle=o,this.aClockwise=a,this.aRotation=l}getPoint(e,t){const i=t||new ne,s=Math.PI*2;let r=this.aEndAngle-this.aStartAngle;const o=Math.abs(r)s;)r-=s;r0?0:(Math.floor(Math.abs(a)/r)+1)*r:l===0&&a===r-1&&(a=r-2,l=1);let c,u;this.closed||a>0?c=s[(a-1)%r]:(Yd.subVectors(s[0],s[1]).add(s[0]),c=Yd);const C=s[a%r],d=s[(a+1)%r];if(this.closed||a+2s.length-2?s.length-1:o+1],C=s[o>s.length-3?s.length-1:o+2];return i.set(cZ(a,l.x,c.x,u.x,C.x),cZ(a,l.y,c.y,u.y,C.y)),i}copy(e){super.copy(e),this.points=[];for(let t=0,i=e.points.length;t=i){const o=s[r]-i,a=this.curves[r],l=a.getLength(),c=l===0?0:1-o/l;return a.getPointAt(c,t)}r++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let i=0,s=this.curves.length;i1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,i=e.curves.length;t0){const C=c.getPoint(0);C.equals(this.currentPoint)||this.lineTo(C.x,C.y)}this.curves.push(c);const u=c.getPoint(1);return this.currentPoint.copy(u),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class cc extends ft{constructor(e=[new ne(0,-.5),new ne(.5,0),new ne(0,.5)],t=12,i=0,s=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:i,phiLength:s},t=Math.floor(t),s=Gn(s,0,Math.PI*2);const r=[],o=[],a=[],l=[],c=[],u=1/t,C=new H,d=new ne,h=new H,m=new H,v=new H;let y=0,A=0;for(let b=0;b<=e.length-1;b++)switch(b){case 0:y=e[b+1].x-e[b].x,A=e[b+1].y-e[b].y,h.x=A*1,h.y=-y,h.z=A*0,v.copy(h),h.normalize(),l.push(h.x,h.y,h.z);break;case e.length-1:l.push(v.x,v.y,v.z);break;default:y=e[b+1].x-e[b].x,A=e[b+1].y-e[b].y,h.x=A*1,h.y=-y,h.z=A*0,m.copy(h),h.x+=v.x,h.y+=v.y,h.z+=v.z,h.normalize(),l.push(h.x,h.y,h.z),v.copy(m)}for(let b=0;b<=t;b++){const f=i+b*u*s,B=Math.sin(f),S=Math.cos(f);for(let x=0;x<=e.length-1;x++){C.x=e[x].x*B,C.y=e[x].y,C.z=e[x].x*S,o.push(C.x,C.y,C.z),d.x=b/t,d.y=x/(e.length-1),a.push(d.x,d.y);const R=l[3*x+0]*B,M=l[3*x+1],Z=l[3*x+0]*S;c.push(R,M,Z)}}for(let b=0;b0&&f(!0),t>0&&f(!1)),this.setIndex(u),this.setAttribute("position",new ke(C,3)),this.setAttribute("normal",new ke(d,3)),this.setAttribute("uv",new ke(h,2));function b(){const B=new H,S=new H;let x=0;const R=(t-e)/i;for(let M=0;M<=r;M++){const Z=[],V=M/r,N=V*(t-e)+e;for(let D=0;D<=s;D++){const k=D/s,$=k*l+a,te=Math.sin($),Ce=Math.cos($);S.x=N*te,S.y=-V*i+y,S.z=N*Ce,C.push(S.x,S.y,S.z),B.set(te,R,Ce).normalize(),d.push(B.x,B.y,B.z),h.push(k,1-V),Z.push(m++)}v.push(Z)}for(let M=0;M.9&&R<.1&&(f<.2&&(o[b+0]+=1),B<.2&&(o[b+2]+=1),S<.2&&(o[b+4]+=1))}}function d(b){r.push(b.x,b.y,b.z)}function h(b,f){const B=b*3;f.x=e[B+0],f.y=e[B+1],f.z=e[B+2]}function m(){const b=new H,f=new H,B=new H,S=new H,x=new ne,R=new ne,M=new ne;for(let Z=0,V=0;Z80*t){a=c=n[0],l=u=n[1];for(let m=t;mc&&(c=C),d>u&&(u=d);h=Math.max(c-a,u-l),h=h!==0?32767/h:0}return hu(r,o,t,a,l,h,0),o}};function _1(n,e,t,i,s){let r,o;if(s===DK(n,e,t,i)>0)for(r=e;r=e;r-=i)o=IZ(r,n[r],n[r+1],o);return o&&DA(o,o.next)&&(pu(o),o=o.next),o}function Al(n,e){if(!n)return n;e||(e=n);let t=n,i;do if(i=!1,!t.steiner&&(DA(t,t.next)||pn(t.prev,t,t.next)===0)){if(pu(t),t=e=t.prev,t===t.next)break;i=!0}else t=t.next;while(i||t!==e);return e}function hu(n,e,t,i,s,r,o){if(!n)return;!o&&r&&KK(n,i,s,r);let a=n,l,c;for(;n.prev!==n.next;){if(l=n.prev,c=n.next,r?WK(n,i,s,r):RK(n)){e.push(l.i/t|0),e.push(n.i/t|0),e.push(c.i/t|0),pu(n),n=c.next,a=c.next;continue}if(n=c,n===a){o?o===1?(n=VK(Al(n),e,t),hu(n,e,t,i,s,r,2)):o===2&&MK(n,e,t,i,s,r):hu(Al(n),e,t,i,s,r,1);break}}}function RK(n){const e=n.prev,t=n,i=n.next;if(pn(e,t,i)>=0)return!1;const s=e.x,r=t.x,o=i.x,a=e.y,l=t.y,c=i.y,u=sr?s>o?s:o:r>o?r:o,h=a>l?a>c?a:c:l>c?l:c;let m=i.next;for(;m!==e;){if(m.x>=u&&m.x<=d&&m.y>=C&&m.y<=h&&Wg(s,a,r,l,o,c,m.x,m.y)&&pn(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function WK(n,e,t,i){const s=n.prev,r=n,o=n.next;if(pn(s,r,o)>=0)return!1;const a=s.x,l=r.x,c=o.x,u=s.y,C=r.y,d=o.y,h=al?a>c?a:c:l>c?l:c,y=u>C?u>d?u:d:C>d?C:d,A=ib(h,m,e,t,i),b=ib(v,y,e,t,i);let f=n.prevZ,B=n.nextZ;for(;f&&f.z>=A&&B&&B.z<=b;){if(f.x>=h&&f.x<=v&&f.y>=m&&f.y<=y&&f!==s&&f!==o&&Wg(a,u,l,C,c,d,f.x,f.y)&&pn(f.prev,f,f.next)>=0||(f=f.prevZ,B.x>=h&&B.x<=v&&B.y>=m&&B.y<=y&&B!==s&&B!==o&&Wg(a,u,l,C,c,d,B.x,B.y)&&pn(B.prev,B,B.next)>=0))return!1;B=B.nextZ}for(;f&&f.z>=A;){if(f.x>=h&&f.x<=v&&f.y>=m&&f.y<=y&&f!==s&&f!==o&&Wg(a,u,l,C,c,d,f.x,f.y)&&pn(f.prev,f,f.next)>=0)return!1;f=f.prevZ}for(;B&&B.z<=b;){if(B.x>=h&&B.x<=v&&B.y>=m&&B.y<=y&&B!==s&&B!==o&&Wg(a,u,l,C,c,d,B.x,B.y)&&pn(B.prev,B,B.next)>=0)return!1;B=B.nextZ}return!0}function VK(n,e,t){let i=n;do{const s=i.prev,r=i.next.next;!DA(s,r)&&J1(s,i,i.next,r)&&Au(s,r)&&Au(r,s)&&(e.push(s.i/t|0),e.push(i.i/t|0),e.push(r.i/t|0),pu(i),pu(i.next),i=n=r),i=i.next}while(i!==n);return Al(i)}function MK(n,e,t,i,s,r){let o=n;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&TK(o,a)){let l=O1(o,a);o=Al(o,o.next),l=Al(l,l.next),hu(o,e,t,i,s,r,0),hu(l,e,t,i,s,r,0);return}a=a.next}o=o.next}while(o!==n)}function NK(n,e,t,i){const s=[];let r,o,a,l,c;for(r=0,o=e.length;r=t.next.y&&t.next.y!==t.y){const d=t.x+(o-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(d<=r&&d>i&&(i=d,s=t.x=t.x&&t.x>=l&&r!==t.x&&Wg(os.x||t.x===s.x&&FK(s,t)))&&(s=t,u=C)),t=t.next;while(t!==a);return s}function FK(n,e){return pn(n.prev,n,e.prev)<0&&pn(e.next,n,n.next)<0}function KK(n,e,t,i){let s=n;do s.z===0&&(s.z=ib(s.x,s.y,e,t,i)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==n);s.prevZ.nextZ=null,s.prevZ=null,zK(s)}function zK(n){let e,t,i,s,r,o,a,l,c=1;do{for(t=n,n=null,r=null,o=0;t;){for(o++,i=t,a=0,e=0;e0||l>0&&i;)a!==0&&(l===0||!i||t.z<=i.z)?(s=t,t=t.nextZ,a--):(s=i,i=i.nextZ,l--),r?r.nextZ=s:n=s,s.prevZ=r,r=s;t=i}r.nextZ=null,c*=2}while(o>1);return n}function ib(n,e,t,i,s){return n=(n-t)*s|0,e=(e-i)*s|0,n=(n|n<<8)&16711935,n=(n|n<<4)&252645135,n=(n|n<<2)&858993459,n=(n|n<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,n|e<<1}function LK(n){let e=n,t=n;do(e.x=(n-o)*(r-a)&&(n-o)*(i-a)>=(t-o)*(e-a)&&(t-o)*(r-a)>=(s-o)*(i-a)}function TK(n,e){return n.next.i!==e.i&&n.prev.i!==e.i&&!EK(n,e)&&(Au(n,e)&&Au(e,n)&&kK(n,e)&&(pn(n.prev,n,e.prev)||pn(n,e.prev,e))||DA(n,e)&&pn(n.prev,n,n.next)>0&&pn(e.prev,e,e.next)>0)}function pn(n,e,t){return(e.y-n.y)*(t.x-e.x)-(e.x-n.x)*(t.y-e.y)}function DA(n,e){return n.x===e.x&&n.y===e.y}function J1(n,e,t,i){const s=Td(pn(n,e,t)),r=Td(pn(n,e,i)),o=Td(pn(t,i,n)),a=Td(pn(t,i,e));return!!(s!==r&&o!==a||s===0&&Ld(n,t,e)||r===0&&Ld(n,i,e)||o===0&&Ld(t,n,i)||a===0&&Ld(t,e,i))}function Ld(n,e,t){return e.x<=Math.max(n.x,t.x)&&e.x>=Math.min(n.x,t.x)&&e.y<=Math.max(n.y,t.y)&&e.y>=Math.min(n.y,t.y)}function Td(n){return n>0?1:n<0?-1:0}function EK(n,e){let t=n;do{if(t.i!==n.i&&t.next.i!==n.i&&t.i!==e.i&&t.next.i!==e.i&&J1(t,t.next,n,e))return!0;t=t.next}while(t!==n);return!1}function Au(n,e){return pn(n.prev,n,n.next)<0?pn(n,e,n.next)>=0&&pn(n,n.prev,e)>=0:pn(n,e,n.prev)<0||pn(n,n.next,e)<0}function kK(n,e){let t=n,i=!1;const s=(n.x+e.x)/2,r=(n.y+e.y)/2;do t.y>r!=t.next.y>r&&t.next.y!==t.y&&s<(t.next.x-t.x)*(r-t.y)/(t.next.y-t.y)+t.x&&(i=!i),t=t.next;while(t!==n);return i}function O1(n,e){const t=new sb(n.i,n.x,n.y),i=new sb(e.i,e.x,e.y),s=n.next,r=e.prev;return n.next=e,e.prev=n,t.next=s,s.prev=t,i.next=t,t.prev=i,r.next=i,i.prev=r,i}function IZ(n,e,t,i){const s=new sb(n,e,t);return i?(s.next=i.next,s.prev=i,i.next.prev=s,i.next=s):(s.prev=s,s.next=s),s}function pu(n){n.next.prev=n.prev,n.prev.next=n.next,n.prevZ&&(n.prevZ.nextZ=n.nextZ),n.nextZ&&(n.nextZ.prevZ=n.prevZ)}function sb(n,e,t){this.i=n,this.x=e,this.y=t,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function DK(n,e,t,i){let s=0;for(let r=e,o=t-i;r2&&n[e-1].equals(n[0])&&n.pop()}function CZ(n,e){for(let t=0;tNumber.EPSILON){const ge=Math.sqrt(T),Ge=Math.sqrt(ut*ut+Nt*Nt),Ze=ue.x-qe/ge,Me=ue.y+rt/ge,gt=be.x-Nt/Ge,Ke=be.y+ut/Ge,pe=((gt-Ze)*Nt-(Ke-Me)*ut)/(rt*Nt-qe*ut);Le=Ze+rt*pe-fe.x,Ve=Me+qe*pe-fe.y;const De=Le*Le+Ve*Ve;if(De<=2)return new ne(Le,Ve);st=Math.sqrt(De/2)}else{let ge=!1;rt>Number.EPSILON?ut>Number.EPSILON&&(ge=!0):rt<-Number.EPSILON?ut<-Number.EPSILON&&(ge=!0):Math.sign(qe)===Math.sign(Nt)&&(ge=!0),ge?(Le=-qe,Ve=rt,st=Math.sqrt(T)):(Le=rt,Ve=qe,st=Math.sqrt(T/2))}return new ne(Le/st,Ve/st)}const J=[];for(let fe=0,ue=$.length,be=ue-1,Le=fe+1;fe=0;fe--){const ue=fe/y,be=h*Math.cos(ue*Math.PI/2),Le=m*Math.sin(ue*Math.PI/2)+v;for(let Ve=0,st=$.length;Ve=0;){const Le=be;let Ve=be-1;Ve<0&&(Ve=fe.length-1);for(let st=0,rt=u+y*2;st0)&&h.push(f,B,x),(A!==i-1||l0!=e>0&&this.version++,this._sheen=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class eW extends _n{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Re(16777215),this.specular=new Re(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Re(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=fo,this.normalScale=new ne(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Wu,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class tW extends _n{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Re(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Re(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=fo,this.normalScale=new ne(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,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.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}class Ov extends _n{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=fo,this.normalScale=new ne(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}class nW extends _n{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Re(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Re(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=fo,this.normalScale=new ne(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Wu,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,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.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class iW extends _n{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Re(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=fo,this.normalScale=new ne(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.flatShading=e.flatShading,this.fog=e.fog,this}}class sW extends Ni{constructor(e){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}function Vs(n,e,t){return Qv(n)?new n.constructor(n.subarray(e,t!==void 0?t:n.length)):n.slice(e,t)}function $a(n,e,t){return!n||!t&&n.constructor===e?n:typeof e.BYTES_PER_ELEMENT=="number"?new e(n):Array.prototype.slice.call(n)}function Qv(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}function rW(n){function e(s,r){return n[s]-n[r]}const t=n.length,i=new Array(t);for(let s=0;s!==t;++s)i[s]=s;return i.sort(e),i}function rb(n,e,t){const i=n.length,s=new n.constructor(i);for(let r=0,o=0;o!==i;++r){const a=t[r]*e;for(let l=0;l!==e;++l)s[o++]=n[a+l]}return s}function jv(n,e,t,i){let s=1,r=n[0];for(;r!==void 0&&r[i]===void 0;)r=n[s++];if(r===void 0)return;let o=r[i];if(o!==void 0)if(Array.isArray(o))do o=r[i],o!==void 0&&(e.push(r.time),t.push.apply(t,o)),r=n[s++];while(r!==void 0);else if(o.toArray!==void 0)do o=r[i],o!==void 0&&(e.push(r.time),o.toArray(t,t.length)),r=n[s++];while(r!==void 0);else do o=r[i],o!==void 0&&(e.push(r.time),t.push(o)),r=n[s++];while(r!==void 0)}function JK(n,e,t,i,s=30){const r=n.clone();r.name=e;const o=[];for(let l=0;l=i)){C.push(c.times[h]);for(let v=0;vr.tracks[l].times[0]&&(a=r.tracks[l].times[0]);for(let l=0;l=a.times[m]){const A=m*C+u,b=A+C-u;v=Vs(a.values,A,b)}else{const A=a.createInterpolant(),b=u,f=C-u;A.evaluate(r),v=Vs(A.resultBuffer,b,f)}l==="quaternion"&&new xn().fromArray(v).normalize().conjugate().toArray(v);const y=c.times.length;for(let A=0;A=r)){const a=t[1];e=r)break t}o=i,i=0;break n}break e}for(;i>>1;et;)--o;if(++o,r!==0||o!==s){r>=o&&(o=Math.max(o,1),r=o-1);const a=this.getValueSize();this.times=Vs(i,r,o),this.values=Vs(this.values,r*a,o*a)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const i=this.times,s=this.values,r=i.length;r===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let a=0;a!==r;a++){const l=i[a];if(typeof l=="number"&&isNaN(l)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,l),e=!1;break}if(o!==null&&o>l){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,l,o),e=!1;break}o=l}if(s!==void 0&&Qv(s))for(let a=0,l=s.length;a!==l;++a){const c=s[a];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,c),e=!1;break}}return e}optimize(){const e=Vs(this.times),t=Vs(this.values),i=this.getValueSize(),s=this.getInterpolation()===Sh,r=e.length-1;let o=1;for(let a=1;a0){e[o]=e[r];for(let a=r*i,l=o*i,c=0;c!==i;++c)t[l+c]=t[a+c];++o}return o!==e.length?(this.times=Vs(e,0,o),this.values=Vs(t,0,o*i)):(this.times=e,this.values=t),this}clone(){const e=Vs(this.times,0),t=Vs(this.values,0),i=this.constructor,s=new i(this.name,e,t);return s.createInterpolant=this.createInterpolant,s}}dr.prototype.TimeBufferType=Float32Array;dr.prototype.ValueBufferType=Float32Array;dr.prototype.DefaultInterpolation=cu;class Bl extends dr{}Bl.prototype.ValueTypeName="bool";Bl.prototype.ValueBufferType=Array;Bl.prototype.DefaultInterpolation=gu;Bl.prototype.InterpolantFactoryMethodLinear=void 0;Bl.prototype.InterpolantFactoryMethodSmooth=void 0;class $v extends dr{}$v.prototype.ValueTypeName="color";class mu extends dr{}mu.prototype.ValueTypeName="number";class lW extends Pu{constructor(e,t,i,s){super(e,t,i,s)}interpolate_(e,t,i,s){const r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=(i-t)/(s-t);let c=e*a;for(let u=c+a;c!==u;c+=4)xn.slerpFlat(r,0,o,c-a,o,c,l);return r}}class uc extends dr{InterpolantFactoryMethodLinear(e){return new lW(this.times,this.values,this.getValueSize(),e)}}uc.prototype.ValueTypeName="quaternion";uc.prototype.DefaultInterpolation=cu;uc.prototype.InterpolantFactoryMethodSmooth=void 0;class Zl extends dr{}Zl.prototype.ValueTypeName="string";Zl.prototype.ValueBufferType=Array;Zl.prototype.DefaultInterpolation=gu;Zl.prototype.InterpolantFactoryMethodLinear=void 0;Zl.prototype.InterpolantFactoryMethodSmooth=void 0;class fu extends dr{}fu.prototype.ValueTypeName="vector";class bu{constructor(e,t=-1,i,s=VA){this.name=e,this.tracks=i,this.duration=t,this.blendMode=s,this.uuid=Cs(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],i=e.tracks,s=1/(e.fps||1);for(let o=0,a=i.length;o!==a;++o)t.push(qK(i[o]).scale(s));const r=new this(e.name,e.duration,t,e.blendMode);return r.uuid=e.uuid,r}static toJSON(e){const t=[],i=e.tracks,s={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let r=0,o=i.length;r!==o;++r)t.push(dr.toJSON(i[r]));return s}static CreateFromMorphTargetSequence(e,t,i,s){const r=t.length,o=[];for(let a=0;a1){const C=u[1];let d=s[C];d||(s[C]=d=[]),d.push(c)}}const o=[];for(const a in s)o.push(this.CreateFromMorphTargetSequence(a,s[a],t,i));return o}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const i=function(C,d,h,m,v){if(h.length!==0){const y=[],A=[];jv(h,y,A,m),y.length!==0&&v.push(new C(d,y,A))}},s=[],r=e.name||"default",o=e.fps||30,a=e.blendMode;let l=e.length||-1;const c=e.hierarchy||[];for(let C=0;C{t&&t(r),this.manager.itemEnd(e)},0),r;if(qr[e]!==void 0){qr[e].push({onLoad:t,onProgress:i,onError:s});return}qr[e]=[],qr[e].push({onLoad:t,onProgress:i,onError:s});const o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),a=this.mimeType,l=this.responseType;fetch(o).then(c=>{if(c.status===200||c.status===0){if(c.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||c.body===void 0||c.body.getReader===void 0)return c;const u=qr[e],C=c.body.getReader(),d=c.headers.get("Content-Length")||c.headers.get("X-File-Size"),h=d?parseInt(d):0,m=h!==0;let v=0;const y=new ReadableStream({start(A){b();function b(){C.read().then(({done:f,value:B})=>{if(f)A.close();else{v+=B.byteLength;const S=new ProgressEvent("progress",{lengthComputable:m,loaded:v,total:h});for(let x=0,R=u.length;x{switch(l){case"arraybuffer":return c.arrayBuffer();case"blob":return c.blob();case"document":return c.text().then(u=>new DOMParser().parseFromString(u,a));case"json":return c.json();default:if(a===void 0)return c.text();{const C=/charset="?([^;"\s]*)"?/i.exec(a),d=C&&C[1]?C[1].toLowerCase():void 0,h=new TextDecoder(d);return c.arrayBuffer().then(m=>h.decode(m))}}}).then(c=>{pl.add(e,c);const u=qr[e];delete qr[e];for(let C=0,d=u.length;C{const u=qr[e];if(u===void 0)throw this.manager.itemError(e),c;delete qr[e];for(let C=0,d=u.length;C{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class ez extends ms{constructor(e){super(e)}load(e,t,i,s){const r=this,o=new Ao(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(a){try{t(r.parse(JSON.parse(a)))}catch(l){s?s(l):console.error(l),r.manager.itemError(e)}},i,s)}parse(e){const t=[];for(let i=0;i0:s.vertexColors=e.vertexColors),e.uniforms!==void 0)for(const r in e.uniforms){const o=e.uniforms[r];switch(s.uniforms[r]={},o.type){case"t":s.uniforms[r].value=i(o.value);break;case"c":s.uniforms[r].value=new Re().setHex(o.value);break;case"v2":s.uniforms[r].value=new ne().fromArray(o.value);break;case"v3":s.uniforms[r].value=new H().fromArray(o.value);break;case"v4":s.uniforms[r].value=new Vt().fromArray(o.value);break;case"m3":s.uniforms[r].value=new xt().fromArray(o.value);break;case"m4":s.uniforms[r].value=new Fe().fromArray(o.value);break;default:s.uniforms[r].value=o.value}}if(e.defines!==void 0&&(s.defines=e.defines),e.vertexShader!==void 0&&(s.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(s.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(s.glslVersion=e.glslVersion),e.extensions!==void 0)for(const r in e.extensions)s.extensions[r]=e.extensions[r];if(e.lights!==void 0&&(s.lights=e.lights),e.clipping!==void 0&&(s.clipping=e.clipping),e.size!==void 0&&(s.size=e.size),e.sizeAttenuation!==void 0&&(s.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(s.map=i(e.map)),e.matcap!==void 0&&(s.matcap=i(e.matcap)),e.alphaMap!==void 0&&(s.alphaMap=i(e.alphaMap)),e.bumpMap!==void 0&&(s.bumpMap=i(e.bumpMap)),e.bumpScale!==void 0&&(s.bumpScale=e.bumpScale),e.normalMap!==void 0&&(s.normalMap=i(e.normalMap)),e.normalMapType!==void 0&&(s.normalMapType=e.normalMapType),e.normalScale!==void 0){let r=e.normalScale;Array.isArray(r)===!1&&(r=[r,r]),s.normalScale=new ne().fromArray(r)}return e.displacementMap!==void 0&&(s.displacementMap=i(e.displacementMap)),e.displacementScale!==void 0&&(s.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(s.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(s.roughnessMap=i(e.roughnessMap)),e.metalnessMap!==void 0&&(s.metalnessMap=i(e.metalnessMap)),e.emissiveMap!==void 0&&(s.emissiveMap=i(e.emissiveMap)),e.emissiveIntensity!==void 0&&(s.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(s.specularMap=i(e.specularMap)),e.specularIntensityMap!==void 0&&(s.specularIntensityMap=i(e.specularIntensityMap)),e.specularColorMap!==void 0&&(s.specularColorMap=i(e.specularColorMap)),e.envMap!==void 0&&(s.envMap=i(e.envMap)),e.envMapIntensity!==void 0&&(s.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(s.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(s.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(s.lightMap=i(e.lightMap)),e.lightMapIntensity!==void 0&&(s.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(s.aoMap=i(e.aoMap)),e.aoMapIntensity!==void 0&&(s.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(s.gradientMap=i(e.gradientMap)),e.clearcoatMap!==void 0&&(s.clearcoatMap=i(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(s.clearcoatRoughnessMap=i(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(s.clearcoatNormalMap=i(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(s.clearcoatNormalScale=new ne().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(s.iridescenceMap=i(e.iridescenceMap)),e.iridescenceThicknessMap!==void 0&&(s.iridescenceThicknessMap=i(e.iridescenceThicknessMap)),e.transmissionMap!==void 0&&(s.transmissionMap=i(e.transmissionMap)),e.thicknessMap!==void 0&&(s.thicknessMap=i(e.thicknessMap)),e.sheenColorMap!==void 0&&(s.sheenColorMap=i(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(s.sheenRoughnessMap=i(e.sheenRoughnessMap)),s}setTextures(e){return this.textures=e,this}static createMaterialFromType(e){const t={ShadowMaterial:j1,SpriteMaterial:zv,RawShaderMaterial:q1,ShaderMaterial:Zt,PointsMaterial:Tv,MeshPhysicalMaterial:$1,MeshStandardMaterial:UA,MeshPhongMaterial:eW,MeshToonMaterial:tW,MeshNormalMaterial:Ov,MeshLambertMaterial:nW,MeshDepthMaterial:YA,MeshDistanceMaterial:Fv,MeshBasicMaterial:ha,MeshMatcapMaterial:iW,LineDashedMaterial:sW,LineBasicMaterial:Ni,Material:_n};return new t[e]}}class ob{static decodeText(e){if(typeof TextDecoder<"u")return new TextDecoder().decode(e);let t="";for(let i=0,s=e.length;i0){const l=new PA(t);r=new vu(l),r.setCrossOrigin(this.crossOrigin);for(let c=0,u=e.length;c0){s=new vu(this.manager),s.setCrossOrigin(this.crossOrigin);for(let o=0,a=e.length;o"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,t,i,s){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const r=this,o=pl.get(e);if(o!==void 0)return r.manager.itemStart(e),setTimeout(function(){t&&t(o),r.manager.itemEnd(e)},0),o;const a={};a.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",a.headers=this.requestHeader,fetch(e,a).then(function(l){return l.blob()}).then(function(l){return createImageBitmap(l,Object.assign(r.options,{colorSpaceConversion:"none"}))}).then(function(l){pl.add(e,l),t&&t(l),r.manager.itemEnd(e)}).catch(function(l){s&&s(l),r.manager.itemError(e),r.manager.itemEnd(e)}),r.manager.itemStart(e)}}let Ed;class ty{static getContext(){return Ed===void 0&&(Ed=new(window.AudioContext||window.webkitAudioContext)),Ed}static setContext(e){Ed=e}}class cz extends ms{constructor(e){super(e)}load(e,t,i,s){const r=this,o=new Ao(this.manager);o.setResponseType("arraybuffer"),o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(l){try{const c=l.slice(0);ty.getContext().decodeAudioData(c,function(C){t(C)},a)}catch(c){a(c)}},i,s);function a(l){s?s(l):console.error(l),r.manager.itemError(e)}}}class Iz extends _A{constructor(e,t,i=1){super(void 0,i),this.isHemisphereLightProbe=!0;const s=new Re().set(e),r=new Re().set(t),o=new H(s.r,s.g,s.b),a=new H(r.r,r.g,r.b),l=Math.sqrt(Math.PI),c=l*Math.sqrt(.75);this.sh.coefficients[0].copy(o).add(a).multiplyScalar(l),this.sh.coefficients[1].copy(o).sub(a).multiplyScalar(c)}}class uz extends _A{constructor(e,t=1){super(void 0,t),this.isAmbientLightProbe=!0;const i=new Re().set(e);this.sh.coefficients[0].set(i.r,i.g,i.b).multiplyScalar(2*Math.sqrt(Math.PI))}}const vZ=new Fe,yZ=new Fe,Ma=new Fe;class Cz{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new An,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new An,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(e){const t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep,Ma.copy(e.projectionMatrix);const s=t.eyeSep/2,r=s*t.near/t.focus,o=t.near*Math.tan(rl*t.fov*.5)/t.zoom;let a,l;yZ.elements[12]=-s,vZ.elements[12]=s,a=-o*t.aspect+r,l=o*t.aspect+r,Ma.elements[0]=2*t.near/(l-a),Ma.elements[8]=(l+a)/(l-a),this.cameraL.projectionMatrix.copy(Ma),a=-o*t.aspect-r,l=o*t.aspect-r,Ma.elements[0]=2*t.near/(l-a),Ma.elements[8]=(l+a)/(l-a),this.cameraR.projectionMatrix.copy(Ma)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(yZ),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(vZ)}}class ny{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=GZ(),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=GZ();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function GZ(){return(typeof performance>"u"?Date:performance).now()}const Na=new H,BZ=new xn,dz=new H,Ha=new H;class hz extends Xt{constructor(){super(),this.type="AudioListener",this.context=ty.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new ny}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e);const t=this.context.listener,i=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(Na,BZ,dz),Ha.set(0,0,-1).applyQuaternion(BZ),t.positionX){const s=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(Na.x,s),t.positionY.linearRampToValueAtTime(Na.y,s),t.positionZ.linearRampToValueAtTime(Na.z,s),t.forwardX.linearRampToValueAtTime(Ha.x,s),t.forwardY.linearRampToValueAtTime(Ha.y,s),t.forwardZ.linearRampToValueAtTime(Ha.z,s),t.upX.linearRampToValueAtTime(i.x,s),t.upY.linearRampToValueAtTime(i.y,s),t.upZ.linearRampToValueAtTime(i.z,s)}else t.setPosition(Na.x,Na.y,Na.z),t.setOrientation(Ha.x,Ha.y,Ha.z,i.x,i.y,i.z)}}class bW extends Xt{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(this.isPlaying===!0){console.warn("THREE.Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+e;const t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this._progress=0,this.source!==null&&(this.source.stop(),this.source.onended=null),this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e0&&this._mixBufferRegionAdditive(i,s,this._addIndex*t,1,t);for(let l=t,c=t+t;l!==c;++l)if(i[l]!==i[l+t]){a.setValue(i,s);break}}saveOriginalState(){const e=this.binding,t=this.buffer,i=this.valueSize,s=i*this._origIndex;e.getValue(t,s);for(let r=i,o=s;r!==o;++r)t[r]=t[s+r%i];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let i=e;i=.5)for(let o=0;o!==r;++o)e[t+o]=e[i+o]}_slerp(e,t,i,s){xn.slerpFlat(e,t,e,t,e,i,s)}_slerpAdditive(e,t,i,s,r){const o=this._workIndex*r;xn.multiplyQuaternionsFlat(e,o,e,t,e,i),xn.slerpFlat(e,t,e,t,e,o,s)}_lerp(e,t,i,s,r){const o=1-s;for(let a=0;a!==r;++a){const l=t+a;e[l]=e[l]*o+e[i+a]*s}}_lerpAdditive(e,t,i,s,r){for(let o=0;o!==r;++o){const a=t+o;e[a]=e[a]+e[i+o]*s}}}const iy="\\[\\]\\.:\\/",fz=new RegExp("["+iy+"]","g"),sy="[^"+iy+"]",bz="[^"+iy.replace("\\.","")+"]",vz=/((?:WC+[\/:])*)/.source.replace("WC",sy),yz=/(WCOD+)?/.source.replace("WCOD",bz),Gz=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",sy),Bz=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",sy),Zz=new RegExp("^"+vz+yz+Gz+Bz+"$"),wz=["material","materials","bones","map"];class Sz{constructor(e,t,i){const s=i||Yt.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,s)}getValue(e,t){this.bind();const i=this._targetGroup.nCachedObjects_,s=this._bindings[i];s!==void 0&&s.getValue(e,t)}setValue(e,t){const i=this._bindings;for(let s=this._targetGroup.nCachedObjects_,r=i.length;s!==r;++s)i[s].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].unbind()}}class Yt{constructor(e,t,i){this.path=t,this.parsedPath=i||Yt.parseTrackName(t),this.node=Yt.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,i){return e&&e.isAnimationObjectGroup?new Yt.Composite(e,t,i):new Yt(e,t,i)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(fz,"")}static parseTrackName(e){const t=Zz.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const i={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},s=i.nodeName&&i.nodeName.lastIndexOf(".");if(s!==void 0&&s!==-1){const r=i.nodeName.substring(s+1);wz.indexOf(r)!==-1&&(i.nodeName=i.nodeName.substring(0,s),i.objectName=r)}if(i.propertyName===null||i.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return i}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const i=e.skeleton.getBoneByName(t);if(i!==void 0)return i}if(e.children){const i=function(r){for(let o=0;o=r){const C=r++,d=e[C];t[d.uuid]=u,e[u]=d,t[c]=C,e[C]=l;for(let h=0,m=s;h!==m;++h){const v=i[h],y=v[C],A=v[u];v[u]=y,v[C]=A}}}this.nCachedObjects_=r}uncache(){const e=this._objects,t=this._indicesByUUID,i=this._bindings,s=i.length;let r=this.nCachedObjects_,o=e.length;for(let a=0,l=arguments.length;a!==l;++a){const c=arguments[a],u=c.uuid,C=t[u];if(C!==void 0)if(delete t[u],C0&&(t[h.uuid]=C),e[C]=h,e.pop();for(let m=0,v=s;m!==v;++m){const y=i[m];y[C]=y[d],y.pop()}}}this.nCachedObjects_=r}subscribe_(e,t){const i=this._bindingsIndicesByPath;let s=i[e];const r=this._bindings;if(s!==void 0)return r[s];const o=this._paths,a=this._parsedPaths,l=this._objects,c=l.length,u=this.nCachedObjects_,C=new Array(c);s=r.length,i[e]=s,o.push(e),a.push(t),r.push(C);for(let d=u,h=l.length;d!==h;++d){const m=l[d];C[d]=new Yt(m,e,t)}return C}unsubscribe_(e){const t=this._bindingsIndicesByPath,i=t[e];if(i!==void 0){const s=this._paths,r=this._parsedPaths,o=this._bindings,a=o.length-1,l=o[a],c=e[a];t[c]=i,o[i]=l,o.pop(),r[i]=r[a],r.pop(),s[i]=s[a],s.pop()}}}class yW{constructor(e,t,i=null,s=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=i,this.blendMode=s;const r=t.tracks,o=r.length,a=new Array(o),l={endingStart:Qa,endingEnd:Qa};for(let c=0;c!==o;++c){const u=r[c].createInterpolant(null);a[c]=u,u.settings=l}this._interpolantSettings=l,this._interpolants=a,this._propertyBindings=new Array(o),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=u1,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,i){if(e.fadeOut(t),this.fadeIn(t),i){const s=this._clip.duration,r=e._clip.duration,o=r/s,a=s/r;e.warp(1,o,t),this.warp(a,1,t)}return this}crossFadeTo(e,t,i){return e.crossFadeFrom(this,t,i)}stopFading(){const e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,i){const s=this._mixer,r=s.time,o=this.timeScale;let a=this._timeScaleInterpolant;a===null&&(a=s._lendControlInterpolant(),this._timeScaleInterpolant=a);const l=a.parameterPositions,c=a.sampleValues;return l[0]=r,l[1]=r+i,c[0]=e/o,c[1]=t/o,this}stopWarping(){const e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,i,s){if(!this.enabled){this._updateWeight(e);return}const r=this._startTime;if(r!==null){const l=(e-r)*i;l<0||i===0?t=0:(this._startTime=null,t=i*l)}t*=this._updateTimeScale(e);const o=this._updateTime(t),a=this._updateWeight(e);if(a>0){const l=this._interpolants,c=this._propertyBindings;switch(this.blendMode){case Rv:for(let u=0,C=l.length;u!==C;++u)l[u].evaluate(o),c[u].accumulateAdditive(a);break;case VA:default:for(let u=0,C=l.length;u!==C;++u)l[u].evaluate(o),c[u].accumulate(s,a)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const i=this._weightInterpolant;if(i!==null){const s=i.evaluate(e)[0];t*=s,e>i.parameterPositions[1]&&(this.stopFading(),s===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const i=this._timeScaleInterpolant;if(i!==null){const s=i.evaluate(e)[0];t*=s,e>i.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,i=this.loop;let s=this.time+e,r=this._loopCount;const o=i===C1;if(e===0)return r===-1?s:o&&(r&1)===1?t-s:s;if(i===I1){r===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(s>=t)s=t;else if(s<0)s=0;else{this.time=s;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=s,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(r===-1&&(e>=0?(r=0,this._setEndings(!0,this.repetitions===0,o)):this._setEndings(this.repetitions===0,!0,o)),s>=t||s<0){const a=Math.floor(s/t);s-=t*a,r+=Math.abs(a);const l=this.repetitions-r;if(l<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,s=e>0?t:0,this.time=s,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(l===1){const c=e<0;this._setEndings(c,!c,o)}else this._setEndings(!1,!1,o);this._loopCount=r,this.time=s,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}else this.time=s;if(o&&(r&1)===1)return t-s}return s}_setEndings(e,t,i){const s=this._interpolantSettings;i?(s.endingStart=ja,s.endingEnd=ja):(e?s.endingStart=this.zeroSlopeAtStart?ja:Qa:s.endingStart=Iu,t?s.endingEnd=this.zeroSlopeAtEnd?ja:Qa:s.endingEnd=Iu)}_scheduleFading(e,t,i){const s=this._mixer,r=s.time;let o=this._weightInterpolant;o===null&&(o=s._lendControlInterpolant(),this._weightInterpolant=o);const a=o.parameterPositions,l=o.sampleValues;return a[0]=r,l[0]=t,a[1]=r+e,l[1]=i,this}}const Rz=new Float32Array(1);class Wz extends zs{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const i=e._localRoot||this._root,s=e._clip.tracks,r=s.length,o=e._propertyBindings,a=e._interpolants,l=i.uuid,c=this._bindingsByRootAndName;let u=c[l];u===void 0&&(u={},c[l]=u);for(let C=0;C!==r;++C){const d=s[C],h=d.name;let m=u[h];if(m!==void 0)++m.referenceCount,o[C]=m;else{if(m=o[C],m!==void 0){m._cacheIndex===null&&(++m.referenceCount,this._addInactiveBinding(m,l,h));continue}const v=t&&t._propertyBindings[C].binding.parsedPath;m=new vW(Yt.create(i,h,v),d.ValueTypeName,d.getValueSize()),++m.referenceCount,this._addInactiveBinding(m,l,h),o[C]=m}a[C].resultBuffer=m.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const i=(e._localRoot||this._root).uuid,s=e._clip.uuid,r=this._actionsByClip[s];this._bindAction(e,r&&r.knownActions[0]),this._addInactiveAction(e,s,i)}const t=e._propertyBindings;for(let i=0,s=t.length;i!==s;++i){const r=t[i];r.useCount++===0&&(this._lendBinding(r),r.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let i=0,s=t.length;i!==s;++i){const r=t[i];--r.useCount===0&&(r.restoreOriginalState(),this._takeBackBinding(r))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return t!==null&&t=0;--i)e[i].stop();return this}update(e){e*=this.timeScale;const t=this._actions,i=this._nActiveActions,s=this.time+=e,r=Math.sign(e),o=this._accuIndex^=1;for(let c=0;c!==i;++c)t[c]._update(s,e,r,o);const a=this._bindings,l=this._nActiveBindings;for(let c=0;c!==l;++c)a[c].apply(o);return this}setTime(e){this.time=0;for(let t=0;tthis.max.x||e.ythis.max.y)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return!(e.max.xthis.max.x||e.max.ythis.max.y)}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,SZ).distanceTo(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}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 xZ=new H,kd=new H;class Fz{constructor(e=new H,t=new H){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){xZ.subVectors(e,this.start),kd.subVectors(this.end,this.start);const i=kd.dot(kd);let r=kd.dot(xZ)/i;return t&&(r=Gn(r,0,1)),r}closestPointToPoint(e,t,i){const s=this.closestPointToPointParameter(e,t);return this.delta(i).multiplyScalar(s).add(this.start)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}const RZ=new H;class Kz extends Xt{constructor(e,t){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";const i=new ft,s=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let o=0,a=1,l=32;o1)for(let C=0;C.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{HZ.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(HZ,t)}}setLength(e,t=e*.2,i=t*.2){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(i,t,i),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class jz extends Kr{constructor(e=1){const t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],i=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],s=new ft;s.setAttribute("position",new ke(t,3)),s.setAttribute("color",new ke(i,3));const r=new Ni({vertexColors:!0,toneMapped:!1});super(s,r),this.type="AxesHelper"}setColors(e,t,i){const s=new Re,r=this.geometry.attributes.color.array;return s.set(e),s.toArray(r,0),s.toArray(r,3),s.set(t),s.toArray(r,6),s.toArray(r,9),s.set(i),s.toArray(r,12),s.toArray(r,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class qz{constructor(){this.type="ShapePath",this.color=new Re,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new du,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,i,s){return this.currentPath.quadraticCurveTo(e,t,i,s),this}bezierCurveTo(e,t,i,s,r,o){return this.currentPath.bezierCurveTo(e,t,i,s,r,o),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function t(A){const b=[];for(let f=0,B=A.length;fNumber.EPSILON){if(V<0&&(R=b[x],Z=-Z,M=b[S],V=-V),A.yM.y)continue;if(A.y===R.y){if(A.x===R.x)return!0}else{const N=V*(A.x-R.x)-Z*(A.y-R.y);if(N===0)return!0;if(N<0)continue;B=!B}}else{if(A.y!==R.y)continue;if(M.x<=A.x&&A.x<=R.x||R.x<=A.x&&A.x<=M.x)return!0}}return B}const s=Nr.isClockWise,r=this.subPaths;if(r.length===0)return[];let o,a,l;const c=[];if(r.length===1)return a=r[0],l=new ll,l.curves=a.curves,c.push(l),c;let u=!s(r[0].getPoints());u=e?!u:u;const C=[],d=[];let h=[],m=0,v;d[m]=void 0,h[m]=[];for(let A=0,b=r.length;A1){let A=!1,b=0;for(let f=0,B=d.length;f0&&A===!1&&(h=C)}let y;for(let A=0,b=d.length;AQ||w[z]!==W[Q]){var de=` -`+w[z].replace(" at new "," at ");return g.displayName&&de.includes("")&&(de=de.replace("",g.displayName)),de}while(1<=z&&0<=Q);break}}}finally{St=!1,Error.prepareStackTrace=p}return(g=g?g.displayName||g.name:"")?nn(g):""}var Wn=Object.prototype.hasOwnProperty,Ds=[],zr=-1;function Hi(g){return{current:g}}function Ot(g){0>zr||(g.current=Ds[zr],Ds[zr]=null,zr--)}function At(g,I){zr++,Ds[zr]=g.current,g.current=I}var gi={},Vn=Hi(gi),jt=Hi(!1),Us=gi;function yo(g,I){var p=g.type.contextTypes;if(!p)return gi;var G=g.stateNode;if(G&&G.__reactInternalMemoizedUnmaskedChildContext===I)return G.__reactInternalMemoizedMaskedChildContext;var w={},W;for(W in p)w[W]=I[W];return G&&(g=g.stateNode,g.__reactInternalMemoizedUnmaskedChildContext=I,g.__reactInternalMemoizedMaskedChildContext=w),w}function ni(g){return g=g.childContextTypes,g!=null}function ju(){Ot(jt),Ot(Vn)}function vy(g,I,p){if(Vn.current!==gi)throw Error(o(168));At(Vn,I),At(jt,p)}function yy(g,I,p){var G=g.stateNode;if(I=I.childContextTypes,typeof G.getChildContext!="function")return p;G=G.getChildContext();for(var w in G)if(!(w in I))throw Error(o(108,M(g)||"Unknown",w));return r({},p,G)}function qu(g){return g=(g=g.stateNode)&&g.__reactInternalMemoizedMergedChildContext||gi,Us=Vn.current,At(Vn,g),At(jt,jt.current),!0}function Gy(g,I,p){var G=g.stateNode;if(!G)throw Error(o(169));p?(g=yy(g,I,Us),G.__reactInternalMemoizedMergedChildContext=g,Ot(jt),Ot(Vn),At(Vn,g)):Ot(jt),At(jt,p)}var Ps=Math.clz32?Math.clz32:nM,eM=Math.log,tM=Math.LN2;function nM(g){return g>>>=0,g===0?32:31-(eM(g)/tM|0)|0}var $u=64,eC=4194304;function fc(g){switch(g&-g){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return g&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return g&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return g}}function tC(g,I){var p=g.pendingLanes;if(p===0)return 0;var G=0,w=g.suspendedLanes,W=g.pingedLanes,z=p&268435455;if(z!==0){var Q=z&~w;Q!==0?G=fc(Q):(W&=z,W!==0&&(G=fc(W)))}else z=p&~w,z!==0?G=fc(z):W!==0&&(G=fc(W));if(G===0)return 0;if(I!==0&&I!==G&&!(I&w)&&(w=G&-G,W=I&-I,w>=W||w===16&&(W&4194240)!==0))return I;if(G&4&&(G|=p&16),I=g.entangledLanes,I!==0)for(g=g.entanglements,I&=G;0p;p++)I.push(g);return I}function bc(g,I,p){g.pendingLanes|=I,I!==536870912&&(g.suspendedLanes=0,g.pingedLanes=0),g=g.eventTimes,I=31-Ps(I),g[I]=p}function rM(g,I){var p=g.pendingLanes&~I;g.pendingLanes=I,g.suspendedLanes=0,g.pingedLanes=0,g.expiredLanes&=I,g.mutableReadLanes&=I,g.entangledLanes&=I,I=g.entanglements;var G=g.eventTimes;for(g=g.expirationTimes;0>=z,w-=z,Er=1<<32-Ps(I)+w|p<Kt?(jn=dt,dt=null):jn=dt.sibling;var zt=it(oe,dt,Ie[Kt],He);if(zt===null){dt===null&&(dt=jn);break}g&&dt&&zt.alternate===null&&I(oe,dt),j=W(zt,j,Kt),bt===null?Pe=zt:bt.sibling=zt,bt=zt,dt=jn}if(Kt===Ie.length)return p(oe,dt),cn&&va(oe,Kt),Pe;if(dt===null){for(;KtKt?(jn=dt,dt=null):jn=dt.sibling;var Wo=it(oe,dt,zt.value,He);if(Wo===null){dt===null&&(dt=jn);break}g&&dt&&Wo.alternate===null&&I(oe,dt),j=W(Wo,j,Kt),bt===null?Pe=Wo:bt.sibling=Wo,bt=Wo,dt=jn}if(zt.done)return p(oe,dt),cn&&va(oe,Kt),Pe;if(dt===null){for(;!zt.done;Kt++,zt=Ie.next())zt=Ct(oe,zt.value,He),zt!==null&&(j=W(zt,j,Kt),bt===null?Pe=zt:bt.sibling=zt,bt=zt);return cn&&va(oe,Kt),Pe}for(dt=G(oe,dt);!zt.done;Kt++,zt=Ie.next())zt=en(dt,oe,Kt,zt.value,He),zt!==null&&(g&&zt.alternate!==null&&dt.delete(zt.key===null?Kt:zt.key),j=W(zt,j,Kt),bt===null?Pe=zt:bt.sibling=zt,bt=zt);return g&&dt.forEach(function(DM){return I(oe,DM)}),cn&&va(oe,Kt),Pe}function Ss(oe,j,Ie,He){if(typeof Ie=="object"&&Ie!==null&&Ie.type===u&&Ie.key===null&&(Ie=Ie.props.children),typeof Ie=="object"&&Ie!==null){switch(Ie.$$typeof){case l:e:{for(var Pe=Ie.key,bt=j;bt!==null;){if(bt.key===Pe){if(Pe=Ie.type,Pe===u){if(bt.tag===7){p(oe,bt.sibling),j=w(bt,Ie.props.children),j.return=oe,oe=j;break e}}else if(bt.elementType===Pe||typeof Pe=="object"&&Pe!==null&&Pe.$$typeof===f&&zy(Pe)===bt.type){p(oe,bt.sibling),j=w(bt,Ie.props),j.ref=Gc(oe,bt,Ie),j.return=oe,oe=j;break e}p(oe,bt);break}else I(oe,bt);bt=bt.sibling}Ie.type===u?(j=xa(Ie.props.children,oe.mode,He,Ie.key),j.return=oe,oe=j):(He=kC(Ie.type,Ie.key,Ie.props,null,oe.mode,He),He.ref=Gc(oe,j,Ie),He.return=oe,oe=He)}return z(oe);case c:e:{for(bt=Ie.key;j!==null;){if(j.key===bt)if(j.tag===4&&j.stateNode.containerInfo===Ie.containerInfo&&j.stateNode.implementation===Ie.implementation){p(oe,j.sibling),j=w(j,Ie.children||[]),j.return=oe,oe=j;break e}else{p(oe,j);break}else I(oe,j);j=j.sibling}j=sm(Ie,oe.mode,He),j.return=oe,oe=j}return z(oe);case f:return bt=Ie._init,Ss(oe,j,bt(Ie._payload),He)}if(te(Ie))return Qe(oe,j,Ie,He);if(x(Ie))return Ci(oe,j,Ie,He);uC(oe,Ie)}return typeof Ie=="string"&&Ie!==""||typeof Ie=="number"?(Ie=""+Ie,j!==null&&j.tag===6?(p(oe,j.sibling),j=w(j,Ie),j.return=oe,oe=j):(p(oe,j),j=im(Ie,oe.mode,He),j.return=oe,oe=j),z(oe)):p(oe,j)}return Ss}var Hl=Ly(!0),Ty=Ly(!1),Bc={},Gs=Hi(Bc),Zc=Hi(Bc),Xl=Hi(Bc);function fr(g){if(g===Bc)throw Error(o(174));return g}function vp(g,I){At(Xl,I),At(Zc,g),At(Gs,Bc),g=le(I),Ot(Gs),At(Gs,g)}function Yl(){Ot(Gs),Ot(Zc),Ot(Xl)}function Ey(g){var I=fr(Xl.current),p=fr(Gs.current);I=L(p,g.type,I),p!==I&&(At(Zc,g),At(Gs,I))}function yp(g){Zc.current===g&&(Ot(Gs),Ot(Zc))}var dn=Hi(0);function CC(g){for(var I=g;I!==null;){if(I.tag===13){var p=I.memoizedState;if(p!==null&&(p=p.dehydrated,p===null||Qu(p)||mc(p)))return I}else if(I.tag===19&&I.memoizedProps.revealOrder!==void 0){if(I.flags&128)return I}else if(I.child!==null){I.child.return=I,I=I.child;continue}if(I===g)break;for(;I.sibling===null;){if(I.return===null||I.return===g)return null;I=I.return}I.sibling.return=I.return,I=I.sibling}return null}var Gp=[];function Bp(){for(var g=0;gp?p:4,g(!0);var G=Bs.transition;Bs.transition={};try{g(!1),I()}finally{Ft=p,Bs.transition=G}}function nG(){return br().memoizedState}function pM(g,I,p){var G=So(g);p={lane:G,action:p,hasEagerState:!1,eagerState:null,next:null},iG(g)?sG(I,p):(rG(g,I,p),p=Bi(),g=Zs(g,G,p),g!==null&&oG(g,I,G))}function mM(g,I,p){var G=So(g),w={lane:G,action:p,hasEagerState:!1,eagerState:null,next:null};if(iG(g))sG(I,w);else{rG(g,I,w);var W=g.alternate;if(g.lanes===0&&(W===null||W.lanes===0)&&(W=I.lastRenderedReducer,W!==null))try{var z=I.lastRenderedState,Q=W(z,p);if(w.hasEagerState=!0,w.eagerState=Q,Ar(Q,z))return}catch{}finally{}p=Bi(),g=Zs(g,G,p),g!==null&&oG(g,I,G)}}function iG(g){var I=g.alternate;return g===bn||I!==null&&I===bn}function sG(g,I){wc=hC=!0;var p=g.pending;p===null?I.next=I:(I.next=p.next,p.next=I),g.pending=I}function rG(g,I,p){Mn!==null&&g.mode&1&&!(Bt&2)?(g=I.interleaved,g===null?(p.next=p,mr===null?mr=[I]:mr.push(I)):(p.next=g.next,g.next=p),I.interleaved=p):(g=I.pending,g===null?p.next=p:(p.next=g.next,g.next=p),I.pending=p)}function oG(g,I,p){if(p&4194240){var G=I.lanes;G&=g.pendingLanes,p|=G,I.lanes=p,sp(g,p)}}var bC={readContext:bs,useCallback:Ii,useContext:Ii,useEffect:Ii,useImperativeHandle:Ii,useInsertionEffect:Ii,useLayoutEffect:Ii,useMemo:Ii,useReducer:Ii,useRef:Ii,useState:Ii,useDebugValue:Ii,useDeferredValue:Ii,useTransition:Ii,useMutableSource:Ii,useSyncExternalStore:Ii,useId:Ii,unstable_isNewReconciler:!1},fM={readContext:bs,useCallback:function(g,I){return Dr().memoizedState=[g,I===void 0?null:I],g},useContext:bs,useEffect:Rp,useImperativeHandle:function(g,I,p){return p=p!=null?p.concat([g]):null,mC(4194308,4,qy.bind(null,I,g),p)},useLayoutEffect:function(g,I){return mC(4194308,4,g,I)},useInsertionEffect:function(g,I){return mC(4,2,g,I)},useMemo:function(g,I){var p=Dr();return I=I===void 0?null:I,g=g(),p.memoizedState=[g,I],g},useReducer:function(g,I,p){var G=Dr();return I=p!==void 0?p(I):I,G.memoizedState=G.baseState=I,g={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:g,lastRenderedState:I},G.queue=g,g=g.dispatch=pM.bind(null,bn,g),[G.memoizedState,g]},useRef:function(g){var I=Dr();return g={current:g},I.memoizedState=g},useState:xp,useDebugValue:Wp,useDeferredValue:function(g){var I=xp(g),p=I[0],G=I[1];return Rp(function(){var w=Bs.transition;Bs.transition={};try{G(g)}finally{Bs.transition=w}},[g]),p},useTransition:function(){var g=xp(!1),I=g[0];return g=AM.bind(null,g[1]),Dr().memoizedState=g,[I,g]},useMutableSource:function(){},useSyncExternalStore:function(g,I,p){var G=bn,w=Dr();if(cn){if(p===void 0)throw Error(o(407));p=p()}else{if(p=I(),Mn===null)throw Error(o(349));Fl&30||Uy(G,I,p)}w.memoizedState=p;var W={value:p,getSnapshot:I};return w.queue=W,Rp(_y.bind(null,G,W,g),[g]),G.flags|=2048,xc(9,Py.bind(null,G,W,p,I),void 0,null),p},useId:function(){var g=Dr(),I=Mn.identifierPrefix;if(cn){var p=kr,G=Er;p=(G&~(1<<32-Ps(G)-1)).toString(32)+p,I=":"+I+"R"+p,p=Sc++,0")&&(de=de.replace("",g.displayName)),de}while(1<=z&&0<=Q);break}}}finally{St=!1,Error.prepareStackTrace=p}return(g=g?g.displayName||g.name:"")?nn(g):""}var Wn=Object.prototype.hasOwnProperty,Ds=[],zr=-1;function Hi(g){return{current:g}}function Ot(g){0>zr||(g.current=Ds[zr],Ds[zr]=null,zr--)}function At(g,I){zr++,Ds[zr]=g.current,g.current=I}var gi={},Vn=Hi(gi),jt=Hi(!1),Us=gi;function yo(g,I){var p=g.type.contextTypes;if(!p)return gi;var G=g.stateNode;if(G&&G.__reactInternalMemoizedUnmaskedChildContext===I)return G.__reactInternalMemoizedMaskedChildContext;var w={},W;for(W in p)w[W]=I[W];return G&&(g=g.stateNode,g.__reactInternalMemoizedUnmaskedChildContext=I,g.__reactInternalMemoizedMaskedChildContext=w),w}function ni(g){return g=g.childContextTypes,g!=null}function ju(){Ot(jt),Ot(Vn)}function vy(g,I,p){if(Vn.current!==gi)throw Error(o(168));At(Vn,I),At(jt,p)}function yy(g,I,p){var G=g.stateNode;if(I=I.childContextTypes,typeof G.getChildContext!="function")return p;G=G.getChildContext();for(var w in G)if(!(w in I))throw Error(o(108,M(g)||"Unknown",w));return r({},p,G)}function qu(g){return g=(g=g.stateNode)&&g.__reactInternalMemoizedMergedChildContext||gi,Us=Vn.current,At(Vn,g),At(jt,jt.current),!0}function Gy(g,I,p){var G=g.stateNode;if(!G)throw Error(o(169));p?(g=yy(g,I,Us),G.__reactInternalMemoizedMergedChildContext=g,Ot(jt),Ot(Vn),At(Vn,g)):Ot(jt),At(jt,p)}var Ps=Math.clz32?Math.clz32:nM,eM=Math.log,tM=Math.LN2;function nM(g){return g>>>=0,g===0?32:31-(eM(g)/tM|0)|0}var $u=64,eC=4194304;function fc(g){switch(g&-g){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return g&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return g&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return g}}function tC(g,I){var p=g.pendingLanes;if(p===0)return 0;var G=0,w=g.suspendedLanes,W=g.pingedLanes,z=p&268435455;if(z!==0){var Q=z&~w;Q!==0?G=fc(Q):(W&=z,W!==0&&(G=fc(W)))}else z=p&~w,z!==0?G=fc(z):W!==0&&(G=fc(W));if(G===0)return 0;if(I!==0&&I!==G&&!(I&w)&&(w=G&-G,W=I&-I,w>=W||w===16&&(W&4194240)!==0))return I;if(G&4&&(G|=p&16),I=g.entangledLanes,I!==0)for(g=g.entanglements,I&=G;0p;p++)I.push(g);return I}function bc(g,I,p){g.pendingLanes|=I,I!==536870912&&(g.suspendedLanes=0,g.pingedLanes=0),g=g.eventTimes,I=31-Ps(I),g[I]=p}function rM(g,I){var p=g.pendingLanes&~I;g.pendingLanes=I,g.suspendedLanes=0,g.pingedLanes=0,g.expiredLanes&=I,g.mutableReadLanes&=I,g.entangledLanes&=I,I=g.entanglements;var G=g.eventTimes;for(g=g.expirationTimes;0>=z,w-=z,Er=1<<32-Ps(I)+w|p<zt?(jn=dt,dt=null):jn=dt.sibling;var Lt=it(oe,dt,Ie[zt],He);if(Lt===null){dt===null&&(dt=jn);break}g&&dt&&Lt.alternate===null&&I(oe,dt),j=W(Lt,j,zt),bt===null?Pe=Lt:bt.sibling=Lt,bt=Lt,dt=jn}if(zt===Ie.length)return p(oe,dt),cn&&va(oe,zt),Pe;if(dt===null){for(;ztzt?(jn=dt,dt=null):jn=dt.sibling;var Wo=it(oe,dt,Lt.value,He);if(Wo===null){dt===null&&(dt=jn);break}g&&dt&&Wo.alternate===null&&I(oe,dt),j=W(Wo,j,zt),bt===null?Pe=Wo:bt.sibling=Wo,bt=Wo,dt=jn}if(Lt.done)return p(oe,dt),cn&&va(oe,zt),Pe;if(dt===null){for(;!Lt.done;zt++,Lt=Ie.next())Lt=Ct(oe,Lt.value,He),Lt!==null&&(j=W(Lt,j,zt),bt===null?Pe=Lt:bt.sibling=Lt,bt=Lt);return cn&&va(oe,zt),Pe}for(dt=G(oe,dt);!Lt.done;zt++,Lt=Ie.next())Lt=en(dt,oe,zt,Lt.value,He),Lt!==null&&(g&&Lt.alternate!==null&&dt.delete(Lt.key===null?zt:Lt.key),j=W(Lt,j,zt),bt===null?Pe=Lt:bt.sibling=Lt,bt=Lt);return g&&dt.forEach(function(DM){return I(oe,DM)}),cn&&va(oe,zt),Pe}function Ss(oe,j,Ie,He){if(typeof Ie=="object"&&Ie!==null&&Ie.type===u&&Ie.key===null&&(Ie=Ie.props.children),typeof Ie=="object"&&Ie!==null){switch(Ie.$$typeof){case l:e:{for(var Pe=Ie.key,bt=j;bt!==null;){if(bt.key===Pe){if(Pe=Ie.type,Pe===u){if(bt.tag===7){p(oe,bt.sibling),j=w(bt,Ie.props.children),j.return=oe,oe=j;break e}}else if(bt.elementType===Pe||typeof Pe=="object"&&Pe!==null&&Pe.$$typeof===f&&zy(Pe)===bt.type){p(oe,bt.sibling),j=w(bt,Ie.props),j.ref=Gc(oe,bt,Ie),j.return=oe,oe=j;break e}p(oe,bt);break}else I(oe,bt);bt=bt.sibling}Ie.type===u?(j=xa(Ie.props.children,oe.mode,He,Ie.key),j.return=oe,oe=j):(He=kC(Ie.type,Ie.key,Ie.props,null,oe.mode,He),He.ref=Gc(oe,j,Ie),He.return=oe,oe=He)}return z(oe);case c:e:{for(bt=Ie.key;j!==null;){if(j.key===bt)if(j.tag===4&&j.stateNode.containerInfo===Ie.containerInfo&&j.stateNode.implementation===Ie.implementation){p(oe,j.sibling),j=w(j,Ie.children||[]),j.return=oe,oe=j;break e}else{p(oe,j);break}else I(oe,j);j=j.sibling}j=sm(Ie,oe.mode,He),j.return=oe,oe=j}return z(oe);case f:return bt=Ie._init,Ss(oe,j,bt(Ie._payload),He)}if(te(Ie))return Qe(oe,j,Ie,He);if(x(Ie))return Ci(oe,j,Ie,He);uC(oe,Ie)}return typeof Ie=="string"&&Ie!==""||typeof Ie=="number"?(Ie=""+Ie,j!==null&&j.tag===6?(p(oe,j.sibling),j=w(j,Ie),j.return=oe,oe=j):(p(oe,j),j=im(Ie,oe.mode,He),j.return=oe,oe=j),z(oe)):p(oe,j)}return Ss}var Hl=Ly(!0),Ty=Ly(!1),Bc={},Gs=Hi(Bc),Zc=Hi(Bc),Xl=Hi(Bc);function fr(g){if(g===Bc)throw Error(o(174));return g}function vp(g,I){At(Xl,I),At(Zc,g),At(Gs,Bc),g=le(I),Ot(Gs),At(Gs,g)}function Yl(){Ot(Gs),Ot(Zc),Ot(Xl)}function Ey(g){var I=fr(Xl.current),p=fr(Gs.current);I=L(p,g.type,I),p!==I&&(At(Zc,g),At(Gs,I))}function yp(g){Zc.current===g&&(Ot(Gs),Ot(Zc))}var dn=Hi(0);function CC(g){for(var I=g;I!==null;){if(I.tag===13){var p=I.memoizedState;if(p!==null&&(p=p.dehydrated,p===null||Qu(p)||mc(p)))return I}else if(I.tag===19&&I.memoizedProps.revealOrder!==void 0){if(I.flags&128)return I}else if(I.child!==null){I.child.return=I,I=I.child;continue}if(I===g)break;for(;I.sibling===null;){if(I.return===null||I.return===g)return null;I=I.return}I.sibling.return=I.return,I=I.sibling}return null}var Gp=[];function Bp(){for(var g=0;gp?p:4,g(!0);var G=Bs.transition;Bs.transition={};try{g(!1),I()}finally{Kt=p,Bs.transition=G}}function nG(){return br().memoizedState}function pM(g,I,p){var G=So(g);p={lane:G,action:p,hasEagerState:!1,eagerState:null,next:null},iG(g)?sG(I,p):(rG(g,I,p),p=Bi(),g=Zs(g,G,p),g!==null&&oG(g,I,G))}function mM(g,I,p){var G=So(g),w={lane:G,action:p,hasEagerState:!1,eagerState:null,next:null};if(iG(g))sG(I,w);else{rG(g,I,w);var W=g.alternate;if(g.lanes===0&&(W===null||W.lanes===0)&&(W=I.lastRenderedReducer,W!==null))try{var z=I.lastRenderedState,Q=W(z,p);if(w.hasEagerState=!0,w.eagerState=Q,Ar(Q,z))return}catch{}finally{}p=Bi(),g=Zs(g,G,p),g!==null&&oG(g,I,G)}}function iG(g){var I=g.alternate;return g===bn||I!==null&&I===bn}function sG(g,I){wc=hC=!0;var p=g.pending;p===null?I.next=I:(I.next=p.next,p.next=I),g.pending=I}function rG(g,I,p){Mn!==null&&g.mode&1&&!(Bt&2)?(g=I.interleaved,g===null?(p.next=p,mr===null?mr=[I]:mr.push(I)):(p.next=g.next,g.next=p),I.interleaved=p):(g=I.pending,g===null?p.next=p:(p.next=g.next,g.next=p),I.pending=p)}function oG(g,I,p){if(p&4194240){var G=I.lanes;G&=g.pendingLanes,p|=G,I.lanes=p,sp(g,p)}}var bC={readContext:bs,useCallback:Ii,useContext:Ii,useEffect:Ii,useImperativeHandle:Ii,useInsertionEffect:Ii,useLayoutEffect:Ii,useMemo:Ii,useReducer:Ii,useRef:Ii,useState:Ii,useDebugValue:Ii,useDeferredValue:Ii,useTransition:Ii,useMutableSource:Ii,useSyncExternalStore:Ii,useId:Ii,unstable_isNewReconciler:!1},fM={readContext:bs,useCallback:function(g,I){return Dr().memoizedState=[g,I===void 0?null:I],g},useContext:bs,useEffect:Rp,useImperativeHandle:function(g,I,p){return p=p!=null?p.concat([g]):null,mC(4194308,4,qy.bind(null,I,g),p)},useLayoutEffect:function(g,I){return mC(4194308,4,g,I)},useInsertionEffect:function(g,I){return mC(4,2,g,I)},useMemo:function(g,I){var p=Dr();return I=I===void 0?null:I,g=g(),p.memoizedState=[g,I],g},useReducer:function(g,I,p){var G=Dr();return I=p!==void 0?p(I):I,G.memoizedState=G.baseState=I,g={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:g,lastRenderedState:I},G.queue=g,g=g.dispatch=pM.bind(null,bn,g),[G.memoizedState,g]},useRef:function(g){var I=Dr();return g={current:g},I.memoizedState=g},useState:xp,useDebugValue:Wp,useDeferredValue:function(g){var I=xp(g),p=I[0],G=I[1];return Rp(function(){var w=Bs.transition;Bs.transition={};try{G(g)}finally{Bs.transition=w}},[g]),p},useTransition:function(){var g=xp(!1),I=g[0];return g=AM.bind(null,g[1]),Dr().memoizedState=g,[I,g]},useMutableSource:function(){},useSyncExternalStore:function(g,I,p){var G=bn,w=Dr();if(cn){if(p===void 0)throw Error(o(407));p=p()}else{if(p=I(),Mn===null)throw Error(o(349));Fl&30||Uy(G,I,p)}w.memoizedState=p;var W={value:p,getSnapshot:I};return w.queue=W,Rp(_y.bind(null,G,W,g),[g]),G.flags|=2048,xc(9,Py.bind(null,G,W,p,I),void 0,null),p},useId:function(){var g=Dr(),I=Mn.identifierPrefix;if(cn){var p=kr,G=Er;p=(G&~(1<<32-Ps(G)-1)).toString(32)+p,I=":"+I+"R"+p,p=Sc++,0Op&&(I.flags|=128,G=!0,Mc(w,!1),I.lanes=4194304)}else{if(!G)if(g=CC(W),g!==null){if(I.flags|=128,G=!0,g=g.updateQueue,g!==null&&(I.updateQueue=g,I.flags|=4),Mc(w,!0),w.tail===null&&w.tailMode==="hidden"&&!W.alternate&&!cn)return ui(I),null}else 2*On()-w.renderingStartTime>Op&&p!==1073741824&&(I.flags|=128,G=!0,Mc(w,!1),I.lanes=4194304);w.isBackwards?(W.sibling=I.child,I.child=W):(g=w.last,g!==null?g.sibling=W:I.child=W,w.last=W)}return w.tail!==null?(I=w.tail,w.rendering=I,w.tail=I.sibling,w.renderingStartTime=On(),I.sibling=null,g=dn.current,At(dn,G?g&1|2:g&1),I):(ui(I),null);case 22:case 23:return em(),G=I.memoizedState!==null,g!==null&&g.memoizedState!==null!==G&&(I.flags|=8192),G&&I.mode&1?ss&1073741824&&(ui(I),Xe&&I.subtreeFlags&6&&(I.flags|=8192)):ui(I),null;case 24:return null;case 25:return null}throw Error(o(156,I.tag))}var BM=a.ReactCurrentOwner,is=!1;function Gi(g,I,p,G){I.child=g===null?Ty(I,null,p,G):Hl(I,g.child,p,G)}function dG(g,I,p,G,w){p=p.render;var W=I.ref;return Wl(I,w),G=wp(g,I,p,G,W,w),p=Sp(),g!==null&&!is?(I.updateQueue=g.updateQueue,I.flags&=-2053,g.lanes&=~w,Ur(g,I,w)):(cn&&p&&Ap(I),I.flags|=1,Gi(g,I,G,w),I.child)}function hG(g,I,p,G,w){if(g===null){var W=p.type;return typeof W=="function"&&!nm(W)&&W.defaultProps===void 0&&p.compare===null&&p.defaultProps===void 0?(I.tag=15,I.type=W,AG(g,I,W,G,w)):(g=kC(p.type,null,G,I,I.mode,w),g.ref=I.ref,g.return=I,I.child=g)}if(W=g.child,!(g.lanes&w)){var z=W.memoizedProps;if(p=p.compare,p=p!==null?p:sC,p(z,G)&&g.ref===I.ref)return Ur(g,I,w)}return I.flags|=1,g=Ro(W,G),g.ref=I.ref,g.return=I,I.child=g}function AG(g,I,p,G,w){if(g!==null&&sC(g.memoizedProps,G)&&g.ref===I.ref)if(is=!1,(g.lanes&w)!==0)g.flags&131072&&(is=!0);else return I.lanes=g.lanes,Ur(g,I,w);return Np(g,I,p,G,w)}function pG(g,I,p){var G=I.pendingProps,w=G.children,W=g!==null?g.memoizedState:null;if(G.mode==="hidden")if(!(I.mode&1))I.memoizedState={baseLanes:0,cachePool:null},At(Kl,ss),ss|=p;else if(p&1073741824)I.memoizedState={baseLanes:0,cachePool:null},G=W!==null?W.baseLanes:p,At(Kl,ss),ss|=G;else return g=W!==null?W.baseLanes|p:p,I.lanes=I.childLanes=1073741824,I.memoizedState={baseLanes:g,cachePool:null},I.updateQueue=null,At(Kl,ss),ss|=g,null;else W!==null?(G=W.baseLanes|p,I.memoizedState=null):G=p,At(Kl,ss),ss|=G;return Gi(g,I,w,p),I.child}function mG(g,I){var p=I.ref;(g===null&&p!==null||g!==null&&g.ref!==p)&&(I.flags|=512,I.flags|=2097152)}function Np(g,I,p,G,w){var W=ni(p)?Us:Vn.current;return W=yo(I,W),Wl(I,w),p=wp(g,I,p,G,W,w),G=Sp(),g!==null&&!is?(I.updateQueue=g.updateQueue,I.flags&=-2053,g.lanes&=~w,Ur(g,I,w)):(cn&&G&&Ap(I),I.flags|=1,Gi(g,I,p,w),I.child)}function fG(g,I,p,G,w){if(ni(p)){var W=!0;qu(I)}else W=!1;if(Wl(I,w),I.stateNode===null)g!==null&&(g.alternate=null,I.alternate=null,I.flags|=2),Ny(I,p,G),hp(I,p,G,w),G=!0;else if(g===null){var z=I.stateNode,Q=I.memoizedProps;z.props=Q;var de=z.context,xe=p.contextType;typeof xe=="object"&&xe!==null?xe=bs(xe):(xe=ni(p)?Us:Vn.current,xe=yo(I,xe));var Ee=p.getDerivedStateFromProps,Ct=typeof Ee=="function"||typeof z.getSnapshotBeforeUpdate=="function";Ct||typeof z.UNSAFE_componentWillReceiveProps!="function"&&typeof z.componentWillReceiveProps!="function"||(Q!==G||de!==xe)&&Hy(I,z,G,xe),Go=!1;var it=I.memoizedState;z.state=it,lC(I,G,z,w),de=I.memoizedState,Q!==G||it!==de||jt.current||Go?(typeof Ee=="function"&&(dp(I,p,Ee,G),de=I.memoizedState),(Q=Go||My(I,p,Q,G,it,de,xe))?(Ct||typeof z.UNSAFE_componentWillMount!="function"&&typeof z.componentWillMount!="function"||(typeof z.componentWillMount=="function"&&z.componentWillMount(),typeof z.UNSAFE_componentWillMount=="function"&&z.UNSAFE_componentWillMount()),typeof z.componentDidMount=="function"&&(I.flags|=4194308)):(typeof z.componentDidMount=="function"&&(I.flags|=4194308),I.memoizedProps=G,I.memoizedState=de),z.props=G,z.state=de,z.context=xe,G=Q):(typeof z.componentDidMount=="function"&&(I.flags|=4194308),G=!1)}else{z=I.stateNode,xy(g,I),Q=I.memoizedProps,xe=I.type===I.elementType?Q:_s(I.type,Q),z.props=xe,Ct=I.pendingProps,it=z.context,de=p.contextType,typeof de=="object"&&de!==null?de=bs(de):(de=ni(p)?Us:Vn.current,de=yo(I,de));var en=p.getDerivedStateFromProps;(Ee=typeof en=="function"||typeof z.getSnapshotBeforeUpdate=="function")||typeof z.UNSAFE_componentWillReceiveProps!="function"&&typeof z.componentWillReceiveProps!="function"||(Q!==Ct||it!==de)&&Hy(I,z,G,de),Go=!1,it=I.memoizedState,z.state=it,lC(I,G,z,w);var Qe=I.memoizedState;Q!==Ct||it!==Qe||jt.current||Go?(typeof en=="function"&&(dp(I,p,en,G),Qe=I.memoizedState),(xe=Go||My(I,p,xe,G,it,Qe,de)||!1)?(Ee||typeof z.UNSAFE_componentWillUpdate!="function"&&typeof z.componentWillUpdate!="function"||(typeof z.componentWillUpdate=="function"&&z.componentWillUpdate(G,Qe,de),typeof z.UNSAFE_componentWillUpdate=="function"&&z.UNSAFE_componentWillUpdate(G,Qe,de)),typeof z.componentDidUpdate=="function"&&(I.flags|=4),typeof z.getSnapshotBeforeUpdate=="function"&&(I.flags|=1024)):(typeof z.componentDidUpdate!="function"||Q===g.memoizedProps&&it===g.memoizedState||(I.flags|=4),typeof z.getSnapshotBeforeUpdate!="function"||Q===g.memoizedProps&&it===g.memoizedState||(I.flags|=1024),I.memoizedProps=G,I.memoizedState=Qe),z.props=G,z.state=Qe,z.context=de,G=xe):(typeof z.componentDidUpdate!="function"||Q===g.memoizedProps&&it===g.memoizedState||(I.flags|=4),typeof z.getSnapshotBeforeUpdate!="function"||Q===g.memoizedProps&&it===g.memoizedState||(I.flags|=1024),G=!1)}return Hp(g,I,p,G,W,w)}function Hp(g,I,p,G,w,W){mG(g,I);var z=(I.flags&128)!==0;if(!G&&!z)return w&&Gy(I,p,!1),Ur(g,I,W);G=I.stateNode,BM.current=I;var Q=z&&typeof p.getDerivedStateFromError!="function"?null:G.render();return I.flags|=1,g!==null&&z?(I.child=Hl(I,g.child,null,W),I.child=Hl(I,null,Q,W)):Gi(g,I,Q,W),I.memoizedState=G.state,w&&Gy(I,p,!0),I.child}function bG(g){var I=g.stateNode;I.pendingContext?vy(g,I.pendingContext,I.pendingContext!==I.context):I.context&&vy(g,I.context,!1),vp(g,I.containerInfo)}function vG(g,I,p,G,w){return Nl(),bp(w),I.flags|=256,Gi(g,I,p,G),I.child}var GC={dehydrated:null,treeContext:null,retryLane:0};function BC(g){return{baseLanes:g,cachePool:null}}function yG(g,I,p){var G=I.pendingProps,w=dn.current,W=!1,z=(I.flags&128)!==0,Q;if((Q=z)||(Q=g!==null&&g.memoizedState===null?!1:(w&2)!==0),Q?(W=!0,I.flags&=-129):(g===null||g.memoizedState!==null)&&(w|=1),At(dn,w&1),g===null)return fp(I),g=I.memoizedState,g!==null&&(g=g.dehydrated,g!==null)?(I.mode&1?mc(g)?I.lanes=8:I.lanes=1073741824:I.lanes=1,null):(w=G.children,g=G.fallback,W?(G=I.mode,W=I.child,w={mode:"hidden",children:w},!(G&1)&&W!==null?(W.childLanes=0,W.pendingProps=w):W=DC(w,G,0,null),g=xa(g,G,p,null),W.return=I,g.return=I,W.sibling=g,I.child=W,I.child.memoizedState=BC(p),I.memoizedState=GC,g):Xp(I,w));if(w=g.memoizedState,w!==null){if(Q=w.dehydrated,Q!==null){if(z)return I.flags&256?(I.flags&=-257,ZC(g,I,p,Error(o(422)))):I.memoizedState!==null?(I.child=g.child,I.flags|=128,null):(W=G.fallback,w=I.mode,G=DC({mode:"visible",children:G.children},w,0,null),W=xa(W,w,p,null),W.flags|=2,G.return=I,W.return=I,G.sibling=W,I.child=G,I.mode&1&&Hl(I,g.child,null,p),I.child.memoizedState=BC(p),I.memoizedState=GC,W);if(!(I.mode&1))I=ZC(g,I,p,null);else if(mc(Q))I=ZC(g,I,p,Error(o(419)));else if(G=(p&g.childLanes)!==0,is||G){if(G=Mn,G!==null){switch(p&-p){case 4:W=2;break;case 16:W=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:W=32;break;case 536870912:W=268435456;break;default:W=0}G=W&(G.suspendedLanes|p)?0:W,G!==0&&G!==w.retryLane&&(w.retryLane=G,Zs(g,G,-1))}tm(),I=ZC(g,I,p,Error(o(421)))}else Qu(Q)?(I.flags|=128,I.child=g.child,I=FM.bind(null,g),tp(Q,I),I=null):(p=w.treeContext,ue&&(ns=ie(Q),ts=I,cn=!0,Js=null,vc=!1,p!==null&&(vs[ys++]=Er,vs[ys++]=kr,vs[ys++]=ba,Er=p.id,kr=p.overflow,ba=I)),I=Xp(I,I.pendingProps.children),I.flags|=4096);return I}return W?(G=BG(g,I,G.children,G.fallback,p),W=I.child,w=g.child.memoizedState,W.memoizedState=w===null?BC(p):{baseLanes:w.baseLanes|p,cachePool:null},W.childLanes=g.childLanes&~p,I.memoizedState=GC,G):(p=GG(g,I,G.children,p),I.memoizedState=null,p)}return W?(G=BG(g,I,G.children,G.fallback,p),W=I.child,w=g.child.memoizedState,W.memoizedState=w===null?BC(p):{baseLanes:w.baseLanes|p,cachePool:null},W.childLanes=g.childLanes&~p,I.memoizedState=GC,G):(p=GG(g,I,G.children,p),I.memoizedState=null,p)}function Xp(g,I){return I=DC({mode:"visible",children:I},g.mode,0,null),I.return=g,g.child=I}function GG(g,I,p,G){var w=g.child;return g=w.sibling,p=Ro(w,{mode:"visible",children:p}),!(I.mode&1)&&(p.lanes=G),p.return=I,p.sibling=null,g!==null&&(G=I.deletions,G===null?(I.deletions=[g],I.flags|=16):G.push(g)),I.child=p}function BG(g,I,p,G,w){var W=I.mode;g=g.child;var z=g.sibling,Q={mode:"hidden",children:p};return!(W&1)&&I.child!==g?(p=I.child,p.childLanes=0,p.pendingProps=Q,I.deletions=null):(p=Ro(g,Q),p.subtreeFlags=g.subtreeFlags&14680064),z!==null?G=Ro(z,G):(G=xa(G,W,w,null),G.flags|=2),G.return=I,p.return=I,p.sibling=G,I.child=p,G}function ZC(g,I,p,G){return G!==null&&bp(G),Hl(I,g.child,null,p),g=Xp(I,I.pendingProps.children),g.flags|=2,I.memoizedState=null,g}function ZG(g,I,p){g.lanes|=I;var G=g.alternate;G!==null&&(G.lanes|=I),up(g.return,I,p)}function Yp(g,I,p,G,w){var W=g.memoizedState;W===null?g.memoizedState={isBackwards:I,rendering:null,renderingStartTime:0,last:G,tail:p,tailMode:w}:(W.isBackwards=I,W.rendering=null,W.renderingStartTime=0,W.last=G,W.tail=p,W.tailMode=w)}function wG(g,I,p){var G=I.pendingProps,w=G.revealOrder,W=G.tail;if(Gi(g,I,G.children,p),G=dn.current,G&2)G=G&1|2,I.flags|=128;else{if(g!==null&&g.flags&128)e:for(g=I.child;g!==null;){if(g.tag===13)g.memoizedState!==null&&ZG(g,p,I);else if(g.tag===19)ZG(g,p,I);else if(g.child!==null){g.child.return=g,g=g.child;continue}if(g===I)break e;for(;g.sibling===null;){if(g.return===null||g.return===I)break e;g=g.return}g.sibling.return=g.return,g=g.sibling}G&=1}if(At(dn,G),!(I.mode&1))I.memoizedState=null;else switch(w){case"forwards":for(p=I.child,w=null;p!==null;)g=p.alternate,g!==null&&CC(g)===null&&(w=p),p=p.sibling;p=w,p===null?(w=I.child,I.child=null):(w=p.sibling,p.sibling=null),Yp(I,!1,w,p,W);break;case"backwards":for(p=null,w=I.child,I.child=null;w!==null;){if(g=w.alternate,g!==null&&CC(g)===null){I.child=w;break}g=w.sibling,w.sibling=p,p=w,w=g}Yp(I,!0,p,null,W);break;case"together":Yp(I,!1,null,null,void 0);break;default:I.memoizedState=null}return I.child}function Ur(g,I,p){if(g!==null&&(I.dependencies=g.dependencies),zl|=I.lanes,!(p&I.childLanes))return null;if(g!==null&&I.child!==g.child)throw Error(o(153));if(I.child!==null){for(g=I.child,p=Ro(g,g.pendingProps),I.child=p,p.return=I;g.sibling!==null;)g=g.sibling,p=p.sibling=Ro(g,g.pendingProps),p.return=I;p.sibling=null}return I.child}function ZM(g,I,p){switch(I.tag){case 3:bG(I),Nl();break;case 5:Ey(I);break;case 1:ni(I.type)&&qu(I);break;case 4:vp(I,I.stateNode.containerInfo);break;case 10:Sy(I,I.type._context,I.memoizedProps.value);break;case 13:var G=I.memoizedState;if(G!==null)return G.dehydrated!==null?(At(dn,dn.current&1),I.flags|=128,null):p&I.child.childLanes?yG(g,I,p):(At(dn,dn.current&1),g=Ur(g,I,p),g!==null?g.sibling:null);At(dn,dn.current&1);break;case 19:if(G=(p&I.childLanes)!==0,g.flags&128){if(G)return wG(g,I,p);I.flags|=128}var w=I.memoizedState;if(w!==null&&(w.rendering=null,w.tail=null,w.lastEffect=null),At(dn,dn.current),G)break;return null;case 22:case 23:return I.lanes=0,pG(g,I,p)}return Ur(g,I,p)}function wM(g,I){switch(pp(I),I.tag){case 1:return ni(I.type)&&ju(),g=I.flags,g&65536?(I.flags=g&-65537|128,I):null;case 3:return Yl(),Ot(jt),Ot(Vn),Bp(),g=I.flags,g&65536&&!(g&128)?(I.flags=g&-65537|128,I):null;case 5:return yp(I),null;case 13:if(Ot(dn),g=I.memoizedState,g!==null&&g.dehydrated!==null){if(I.alternate===null)throw Error(o(340));Nl()}return g=I.flags,g&65536?(I.flags=g&-65537|128,I):null;case 19:return Ot(dn),null;case 4:return Yl(),null;case 10:return Ip(I.type._context),null;case 22:case 23:return em(),null;case 24:return null;default:return null}}var wC=!1,Ga=!1,SM=typeof WeakSet=="function"?WeakSet:Set,Ne=null;function SC(g,I){var p=g.ref;if(p!==null)if(typeof p=="function")try{p(null)}catch(G){Fi(g,I,G)}else p.current=null}function Fp(g,I,p){try{p()}catch(G){Fi(g,I,G)}}var SG=!1;function xM(g,I){for(J(g.containerInfo),Ne=I;Ne!==null;)if(g=Ne,I=g.child,(g.subtreeFlags&1028)!==0&&I!==null)I.return=g,Ne=I;else for(;Ne!==null;){g=Ne;try{var p=g.alternate;if(g.flags&1024)switch(g.tag){case 0:case 11:case 15:break;case 1:if(p!==null){var G=p.memoizedProps,w=p.memoizedState,W=g.stateNode,z=W.getSnapshotBeforeUpdate(g.elementType===g.type?G:_s(g.type,G),w);W.__reactInternalSnapshotBeforeUpdate=z}break;case 3:Xe&&Ye(g.stateNode.containerInfo);break;case 5:case 6:case 4:case 17:break;default:throw Error(o(163))}}catch(Q){Fi(g,g.return,Q)}if(I=g.sibling,I!==null){I.return=g.return,Ne=I;break}Ne=g.return}return p=SG,SG=!1,p}function Ba(g,I,p){var G=I.updateQueue;if(G=G!==null?G.lastEffect:null,G!==null){var w=G=G.next;do{if((w.tag&g)===g){var W=w.destroy;w.destroy=void 0,W!==void 0&&Fp(I,p,W)}w=w.next}while(w!==G)}}function Nc(g,I){if(I=I.updateQueue,I=I!==null?I.lastEffect:null,I!==null){var p=I=I.next;do{if((p.tag&g)===g){var G=p.create;p.destroy=G()}p=p.next}while(p!==I)}}function Kp(g){var I=g.ref;if(I!==null){var p=g.stateNode;switch(g.tag){case 5:g=Ce(p);break;default:g=p}typeof I=="function"?I(g):I.current=g}}function xG(g,I,p){if(hr&&typeof hr.onCommitFiberUnmount=="function")try{hr.onCommitFiberUnmount(nC,I)}catch{}switch(I.tag){case 0:case 11:case 14:case 15:if(g=I.updateQueue,g!==null&&(g=g.lastEffect,g!==null)){var G=g=g.next;do{var w=G,W=w.destroy;w=w.tag,W!==void 0&&(w&2||w&4)&&Fp(I,p,W),G=G.next}while(G!==g)}break;case 1:if(SC(I,p),g=I.stateNode,typeof g.componentWillUnmount=="function")try{g.props=I.memoizedProps,g.state=I.memoizedState,g.componentWillUnmount()}catch(z){Fi(I,p,z)}break;case 5:SC(I,p);break;case 4:Xe?HG(g,I,p):fe&&fe&&(I=I.stateNode.containerInfo,p=Dt(I),Es(I,p))}}function RG(g,I,p){for(var G=I;;)if(xG(g,G,p),G.child===null||Xe&&G.tag===4){if(G===I)break;for(;G.sibling===null;){if(G.return===null||G.return===I)return;G=G.return}G.sibling.return=G.return,G=G.sibling}else G.child.return=G,G=G.child}function WG(g){var I=g.alternate;I!==null&&(g.alternate=null,WG(I)),g.child=null,g.deletions=null,g.sibling=null,g.tag===5&&(I=g.stateNode,I!==null&&st(I)),g.stateNode=null,g.return=null,g.dependencies=null,g.memoizedProps=null,g.memoizedState=null,g.pendingProps=null,g.stateNode=null,g.updateQueue=null}function VG(g){return g.tag===5||g.tag===3||g.tag===4}function MG(g){e:for(;;){for(;g.sibling===null;){if(g.return===null||VG(g.return))return null;g=g.return}for(g.sibling.return=g.return,g=g.sibling;g.tag!==5&&g.tag!==6&&g.tag!==18;){if(g.flags&2||g.child===null||g.tag===4)continue e;g.child.return=g,g=g.child}if(!(g.flags&2))return g.stateNode}}function NG(g){if(Xe){e:{for(var I=g.return;I!==null;){if(VG(I))break e;I=I.return}throw Error(o(160))}var p=I;switch(p.tag){case 5:I=p.stateNode,p.flags&32&&(Et(I),p.flags&=-33),p=MG(g),Lp(g,p,I);break;case 3:case 4:I=p.stateNode.containerInfo,p=MG(g),zp(g,p,I);break;default:throw Error(o(161))}}}function zp(g,I,p){var G=g.tag;if(G===5||G===6)g=g.stateNode,I?Te(p,g,I):Ke(p,g);else if(G!==4&&(g=g.child,g!==null))for(zp(g,I,p),g=g.sibling;g!==null;)zp(g,I,p),g=g.sibling}function Lp(g,I,p){var G=g.tag;if(G===5||G===6)g=g.stateNode,I?ot(p,g,I):gt(p,g);else if(G!==4&&(g=g.child,g!==null))for(Lp(g,I,p),g=g.sibling;g!==null;)Lp(g,I,p),g=g.sibling}function HG(g,I,p){for(var G=I,w=!1,W,z;;){if(!w){w=G.return;e:for(;;){if(w===null)throw Error(o(160));switch(W=w.stateNode,w.tag){case 5:z=!1;break e;case 3:W=W.containerInfo,z=!0;break e;case 4:W=W.containerInfo,z=!0;break e}w=w.return}w=!0}if(G.tag===5||G.tag===6)RG(g,G,p),z?Wt(W,G.stateNode):Oe(W,G.stateNode);else if(G.tag===18)z?wt(W,G.stateNode):Gt(W,G.stateNode);else if(G.tag===4){if(G.child!==null){W=G.stateNode.containerInfo,z=!0,G.child.return=G,G=G.child;continue}}else if(xG(g,G,p),G.child!==null){G.child.return=G,G=G.child;continue}if(G===I)break;for(;G.sibling===null;){if(G.return===null||G.return===I)return;G=G.return,G.tag===4&&(w=!1)}G.sibling.return=G.return,G=G.sibling}}function Tp(g,I){if(Xe){switch(I.tag){case 0:case 11:case 14:case 15:Ba(3,I,I.return),Nc(3,I),Ba(5,I,I.return);return;case 1:return;case 5:var p=I.stateNode;if(p!=null){var G=I.memoizedProps;g=g!==null?g.memoizedProps:G;var w=I.type,W=I.updateQueue;I.updateQueue=null,W!==null&&$e(p,W,w,g,G,I)}return;case 6:if(I.stateNode===null)throw Error(o(162));p=I.memoizedProps,pe(I.stateNode,g!==null?g.memoizedProps:p,p);return;case 3:ue&&g!==null&&g.memoizedState.isDehydrated&&ht(I.stateNode.containerInfo);return;case 12:return;case 13:xC(I);return;case 19:xC(I);return;case 17:return}throw Error(o(163))}switch(I.tag){case 0:case 11:case 14:case 15:Ba(3,I,I.return),Nc(3,I),Ba(5,I,I.return);return;case 12:return;case 13:xC(I);return;case 19:xC(I);return;case 3:ue&&g!==null&&g.memoizedState.isDehydrated&&ht(I.stateNode.containerInfo);break;case 22:case 23:return}e:if(fe){switch(I.tag){case 1:case 5:case 6:break e;case 3:case 4:I=I.stateNode,Es(I.containerInfo,I.pendingChildren);break e}throw Error(o(163))}}function xC(g){var I=g.updateQueue;if(I!==null){g.updateQueue=null;var p=g.stateNode;p===null&&(p=g.stateNode=new SM),I.forEach(function(G){var w=KM.bind(null,g,G);p.has(G)||(p.add(G),G.then(w,w))})}}function RM(g,I){for(Ne=I;Ne!==null;){I=Ne;var p=I.deletions;if(p!==null)for(var G=0;G";case WC:return":has("+(Dp(g)||"")+")";case VC:return'[role="'+g.value+'"]';case NC:return'"'+g.value+'"';case MC:return'[data-testname="'+g.value+'"]';default:throw Error(o(365))}}function zG(g,I){var p=[];g=[g,0];for(var G=0;Gw&&(w=z),G&=~W}if(G=w,G=On()-G,G=(120>G?120:480>G?480:1080>G?1080:1920>G?1920:3e3>G?3e3:4320>G?4320:1960*VM(G/1960))-G,10g?16:g,wo===null)var G=!1;else{if(g=wo,wo=null,KC=0,Bt&6)throw Error(o(331));var w=Bt;for(Bt|=4,Ne=g.current;Ne!==null;){var W=Ne,z=W.child;if(Ne.flags&16){var Q=W.deletions;if(Q!==null){for(var de=0;deOn()-Jp?Za(g,0):_p|=p),Yi(g,I)}function JG(g,I){I===0&&(g.mode&1?(I=eC,eC<<=1,!(eC&130023424)&&(eC=4194304)):I=1);var p=Bi();g=TC(g,I),g!==null&&(bc(g,I,p),Yi(g,p))}function FM(g){var I=g.memoizedState,p=0;I!==null&&(p=I.retryLane),JG(g,p)}function KM(g,I){var p=0;switch(g.tag){case 13:var G=g.stateNode,w=g.memoizedState;w!==null&&(p=w.retryLane);break;case 19:G=g.stateNode;break;default:throw Error(o(314))}G!==null&&G.delete(I),JG(g,p)}var OG;OG=function(g,I,p){if(g!==null)if(g.memoizedProps!==I.pendingProps||jt.current)is=!0;else{if(!(g.lanes&p)&&!(I.flags&128))return is=!1,ZM(g,I,p);is=!!(g.flags&131072)}else is=!1,cn&&I.flags&1048576&&Xy(I,IC,I.index);switch(I.lanes=0,I.tag){case 2:var G=I.type;g!==null&&(g.alternate=null,I.alternate=null,I.flags|=2),g=I.pendingProps;var w=yo(I,Vn.current);Wl(I,p),w=wp(null,I,G,g,w,p);var W=Sp();return I.flags|=1,typeof w=="object"&&w!==null&&typeof w.render=="function"&&w.$$typeof===void 0?(I.tag=1,I.memoizedState=null,I.updateQueue=null,ni(G)?(W=!0,qu(I)):W=!1,I.memoizedState=w.state!==null&&w.state!==void 0?w.state:null,Cp(I),w.updater=gC,I.stateNode=w,w._reactInternals=I,hp(I,G,g,p),I=Hp(null,I,G,!0,W,p)):(I.tag=0,cn&&W&&Ap(I),Gi(null,I,w,p),I=I.child),I;case 16:G=I.elementType;e:{switch(g!==null&&(g.alternate=null,I.alternate=null,I.flags|=2),g=I.pendingProps,w=G._init,G=w(G._payload),I.type=G,w=I.tag=LM(G),g=_s(G,g),w){case 0:I=Np(null,I,G,g,p);break e;case 1:I=fG(null,I,G,g,p);break e;case 11:I=dG(null,I,G,g,p);break e;case 14:I=hG(null,I,G,_s(G.type,g),p);break e}throw Error(o(306,G,""))}return I;case 0:return G=I.type,w=I.pendingProps,w=I.elementType===G?w:_s(G,w),Np(g,I,G,w,p);case 1:return G=I.type,w=I.pendingProps,w=I.elementType===G?w:_s(G,w),fG(g,I,G,w,p);case 3:e:{if(bG(I),g===null)throw Error(o(387));G=I.pendingProps,W=I.memoizedState,w=W.element,xy(g,I),lC(I,G,null,p);var z=I.memoizedState;if(G=z.element,ue&&W.isDehydrated)if(W={element:G,isDehydrated:!1,cache:z.cache,transitions:z.transitions},I.updateQueue.baseState=W,I.memoizedState=W,I.flags&256){w=Error(o(423)),I=vG(g,I,G,p,w);break e}else if(G!==w){w=Error(o(424)),I=vG(g,I,G,p,w);break e}else for(ue&&(ns=Ae(I.stateNode.containerInfo),ts=I,cn=!0,Js=null,vc=!1),p=Ty(I,null,G,p),I.child=p;p;)p.flags=p.flags&-3|4096,p=p.sibling;else{if(Nl(),G===w){I=Ur(g,I,p);break e}Gi(g,I,G,p)}I=I.child}return I;case 5:return Ey(I),g===null&&fp(I),G=I.type,w=I.pendingProps,W=g!==null?g.memoizedProps:null,z=w.children,ve(G,w)?z=null:W!==null&&ve(G,W)&&(I.flags|=32),mG(g,I),Gi(g,I,z,p),I.child;case 6:return g===null&&fp(I),null;case 13:return yG(g,I,p);case 4:return vp(I,I.stateNode.containerInfo),G=I.pendingProps,g===null?I.child=Hl(I,null,G,p):Gi(g,I,G,p),I.child;case 11:return G=I.type,w=I.pendingProps,w=I.elementType===G?w:_s(G,w),dG(g,I,G,w,p);case 7:return Gi(g,I,I.pendingProps,p),I.child;case 8:return Gi(g,I,I.pendingProps.children,p),I.child;case 12:return Gi(g,I,I.pendingProps.children,p),I.child;case 10:e:{if(G=I.type._context,w=I.pendingProps,W=I.memoizedProps,z=w.value,Sy(I,G,z),W!==null)if(Ar(W.value,z)){if(W.children===w.children&&!jt.current){I=Ur(g,I,p);break e}}else for(W=I.child,W!==null&&(W.return=I);W!==null;){var Q=W.dependencies;if(Q!==null){z=W.child;for(var de=Q.firstContext;de!==null;){if(de.context===G){if(W.tag===1){de=Tr(-1,p&-p),de.tag=2;var xe=W.updateQueue;if(xe!==null){xe=xe.shared;var Ee=xe.pending;Ee===null?de.next=de:(de.next=Ee.next,Ee.next=de),xe.pending=de}}W.lanes|=p,de=W.alternate,de!==null&&(de.lanes|=p),up(W.return,p,I),Q.lanes|=p;break}de=de.next}}else if(W.tag===10)z=W.type===I.type?null:W.child;else if(W.tag===18){if(z=W.return,z===null)throw Error(o(341));z.lanes|=p,Q=z.alternate,Q!==null&&(Q.lanes|=p),up(z,p,I),z=W.sibling}else z=W.child;if(z!==null)z.return=W;else for(z=W;z!==null;){if(z===I){z=null;break}if(W=z.sibling,W!==null){W.return=z.return,z=W;break}z=z.return}W=z}Gi(g,I,w.children,p),I=I.child}return I;case 9:return w=I.type,G=I.pendingProps.children,Wl(I,p),w=bs(w),G=G(w),I.flags|=1,Gi(g,I,G,p),I.child;case 14:return G=I.type,w=_s(G,I.pendingProps),w=_s(G.type,w),hG(g,I,G,w,p);case 15:return AG(g,I,I.type,I.pendingProps,p);case 17:return G=I.type,w=I.pendingProps,w=I.elementType===G?w:_s(G,w),g!==null&&(g.alternate=null,I.alternate=null,I.flags|=2),I.tag=1,ni(G)?(g=!0,qu(I)):g=!1,Wl(I,p),Ny(I,G,w),hp(I,G,w,p),Hp(null,I,G,!0,g,p);case 19:return wG(g,I,p);case 22:return pG(g,I,p)}throw Error(o(156,I.tag))};function QG(g,I){return rp(g,I)}function zM(g,I,p,G){this.tag=g,this.key=p,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=I,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=G,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ws(g,I,p,G){return new zM(g,I,p,G)}function nm(g){return g=g.prototype,!(!g||!g.isReactComponent)}function LM(g){if(typeof g=="function")return nm(g)?1:0;if(g!=null){if(g=g.$$typeof,g===v)return 11;if(g===b)return 14}return 2}function Ro(g,I){var p=g.alternate;return p===null?(p=ws(g.tag,I,g.key,g.mode),p.elementType=g.elementType,p.type=g.type,p.stateNode=g.stateNode,p.alternate=g,g.alternate=p):(p.pendingProps=I,p.type=g.type,p.flags=0,p.subtreeFlags=0,p.deletions=null),p.flags=g.flags&14680064,p.childLanes=g.childLanes,p.lanes=g.lanes,p.child=g.child,p.memoizedProps=g.memoizedProps,p.memoizedState=g.memoizedState,p.updateQueue=g.updateQueue,I=g.dependencies,p.dependencies=I===null?null:{lanes:I.lanes,firstContext:I.firstContext},p.sibling=g.sibling,p.index=g.index,p.ref=g.ref,p}function kC(g,I,p,G,w,W){var z=2;if(G=g,typeof g=="function")nm(g)&&(z=1);else if(typeof g=="string")z=5;else e:switch(g){case u:return xa(p.children,w,W,I);case C:z=8,w|=8;break;case d:return g=ws(12,p,I,w|2),g.elementType=d,g.lanes=W,g;case y:return g=ws(13,p,I,w),g.elementType=y,g.lanes=W,g;case A:return g=ws(19,p,I,w),g.elementType=A,g.lanes=W,g;case B:return DC(p,w,W,I);default:if(typeof g=="object"&&g!==null)switch(g.$$typeof){case h:z=10;break e;case m:z=9;break e;case v:z=11;break e;case b:z=14;break e;case f:z=16,G=null;break e}throw Error(o(130,g==null?g:typeof g,""))}return I=ws(z,p,I,w),I.elementType=g,I.type=G,I.lanes=W,I}function xa(g,I,p,G){return g=ws(7,g,G,I),g.lanes=p,g}function DC(g,I,p,G){return g=ws(22,g,G,I),g.elementType=B,g.lanes=p,g.stateNode={},g}function im(g,I,p){return g=ws(6,g,null,I),g.lanes=p,g}function sm(g,I,p){return I=ws(4,g.children!==null?g.children:[],g.key,I),I.lanes=p,I.stateNode={containerInfo:g.containerInfo,pendingChildren:null,implementation:g.implementation},I}function TM(g,I,p,G,w){this.tag=I,this.containerInfo=g,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=lt,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=ip(0),this.expirationTimes=ip(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ip(0),this.identifierPrefix=G,this.onRecoverableError=w,ue&&(this.mutableSourceEagerHydrationData=null)}function jG(g,I,p,G,w,W,z,Q,de){return g=new TM(g,I,p,Q,de),I===1?(I=1,W===!0&&(I|=8)):I=0,W=ws(3,null,null,I),g.current=W,W.stateNode=g,W.memoizedState={element:G,isDehydrated:p,cache:null,transitions:null},Cp(W),g}function qG(g){if(!g)return gi;g=g._reactInternals;e:{if(Z(g)!==g||g.tag!==1)throw Error(o(170));var I=g;do{switch(I.tag){case 3:I=I.stateNode.context;break e;case 1:if(ni(I.type)){I=I.stateNode.__reactInternalMemoizedMergedChildContext;break e}}I=I.return}while(I!==null);throw Error(o(171))}if(g.tag===1){var p=g.type;if(ni(p))return yy(g,p,I)}return I}function $G(g){var I=g._reactInternals;if(I===void 0)throw typeof g.render=="function"?Error(o(188)):(g=Object.keys(g).join(","),Error(o(268,g)));return g=D(I),g===null?null:g.stateNode}function eB(g,I){if(g=g.memoizedState,g!==null&&g.dehydrated!==null){var p=g.retryLane;g.retryLane=p!==0&&p=xe&&W>=Ct&&w<=Ee&&z<=it){g.splice(I,1);break}else if(G!==xe||p.width!==de.width||itz){if(!(W!==Ct||p.height!==de.height||Eew)){xe>G&&(de.width+=xe-G,de.x=G),EeW&&(de.height+=Ct-W,de.y=W),itp&&(p=z)),zOp&&(I.flags|=128,G=!0,Mc(w,!1),I.lanes=4194304)}else{if(!G)if(g=CC(W),g!==null){if(I.flags|=128,G=!0,g=g.updateQueue,g!==null&&(I.updateQueue=g,I.flags|=4),Mc(w,!0),w.tail===null&&w.tailMode==="hidden"&&!W.alternate&&!cn)return ui(I),null}else 2*On()-w.renderingStartTime>Op&&p!==1073741824&&(I.flags|=128,G=!0,Mc(w,!1),I.lanes=4194304);w.isBackwards?(W.sibling=I.child,I.child=W):(g=w.last,g!==null?g.sibling=W:I.child=W,w.last=W)}return w.tail!==null?(I=w.tail,w.rendering=I,w.tail=I.sibling,w.renderingStartTime=On(),I.sibling=null,g=dn.current,At(dn,G?g&1|2:g&1),I):(ui(I),null);case 22:case 23:return em(),G=I.memoizedState!==null,g!==null&&g.memoizedState!==null!==G&&(I.flags|=8192),G&&I.mode&1?ss&1073741824&&(ui(I),Xe&&I.subtreeFlags&6&&(I.flags|=8192)):ui(I),null;case 24:return null;case 25:return null}throw Error(o(156,I.tag))}var BM=a.ReactCurrentOwner,is=!1;function Gi(g,I,p,G){I.child=g===null?Ty(I,null,p,G):Hl(I,g.child,p,G)}function dG(g,I,p,G,w){p=p.render;var W=I.ref;return Wl(I,w),G=wp(g,I,p,G,W,w),p=Sp(),g!==null&&!is?(I.updateQueue=g.updateQueue,I.flags&=-2053,g.lanes&=~w,Ur(g,I,w)):(cn&&p&&Ap(I),I.flags|=1,Gi(g,I,G,w),I.child)}function hG(g,I,p,G,w){if(g===null){var W=p.type;return typeof W=="function"&&!nm(W)&&W.defaultProps===void 0&&p.compare===null&&p.defaultProps===void 0?(I.tag=15,I.type=W,AG(g,I,W,G,w)):(g=kC(p.type,null,G,I,I.mode,w),g.ref=I.ref,g.return=I,I.child=g)}if(W=g.child,!(g.lanes&w)){var z=W.memoizedProps;if(p=p.compare,p=p!==null?p:sC,p(z,G)&&g.ref===I.ref)return Ur(g,I,w)}return I.flags|=1,g=Ro(W,G),g.ref=I.ref,g.return=I,I.child=g}function AG(g,I,p,G,w){if(g!==null&&sC(g.memoizedProps,G)&&g.ref===I.ref)if(is=!1,(g.lanes&w)!==0)g.flags&131072&&(is=!0);else return I.lanes=g.lanes,Ur(g,I,w);return Np(g,I,p,G,w)}function pG(g,I,p){var G=I.pendingProps,w=G.children,W=g!==null?g.memoizedState:null;if(G.mode==="hidden")if(!(I.mode&1))I.memoizedState={baseLanes:0,cachePool:null},At(Kl,ss),ss|=p;else if(p&1073741824)I.memoizedState={baseLanes:0,cachePool:null},G=W!==null?W.baseLanes:p,At(Kl,ss),ss|=G;else return g=W!==null?W.baseLanes|p:p,I.lanes=I.childLanes=1073741824,I.memoizedState={baseLanes:g,cachePool:null},I.updateQueue=null,At(Kl,ss),ss|=g,null;else W!==null?(G=W.baseLanes|p,I.memoizedState=null):G=p,At(Kl,ss),ss|=G;return Gi(g,I,w,p),I.child}function mG(g,I){var p=I.ref;(g===null&&p!==null||g!==null&&g.ref!==p)&&(I.flags|=512,I.flags|=2097152)}function Np(g,I,p,G,w){var W=ni(p)?Us:Vn.current;return W=yo(I,W),Wl(I,w),p=wp(g,I,p,G,W,w),G=Sp(),g!==null&&!is?(I.updateQueue=g.updateQueue,I.flags&=-2053,g.lanes&=~w,Ur(g,I,w)):(cn&&G&&Ap(I),I.flags|=1,Gi(g,I,p,w),I.child)}function fG(g,I,p,G,w){if(ni(p)){var W=!0;qu(I)}else W=!1;if(Wl(I,w),I.stateNode===null)g!==null&&(g.alternate=null,I.alternate=null,I.flags|=2),Ny(I,p,G),hp(I,p,G,w),G=!0;else if(g===null){var z=I.stateNode,Q=I.memoizedProps;z.props=Q;var de=z.context,xe=p.contextType;typeof xe=="object"&&xe!==null?xe=bs(xe):(xe=ni(p)?Us:Vn.current,xe=yo(I,xe));var Ee=p.getDerivedStateFromProps,Ct=typeof Ee=="function"||typeof z.getSnapshotBeforeUpdate=="function";Ct||typeof z.UNSAFE_componentWillReceiveProps!="function"&&typeof z.componentWillReceiveProps!="function"||(Q!==G||de!==xe)&&Hy(I,z,G,xe),Go=!1;var it=I.memoizedState;z.state=it,lC(I,G,z,w),de=I.memoizedState,Q!==G||it!==de||jt.current||Go?(typeof Ee=="function"&&(dp(I,p,Ee,G),de=I.memoizedState),(Q=Go||My(I,p,Q,G,it,de,xe))?(Ct||typeof z.UNSAFE_componentWillMount!="function"&&typeof z.componentWillMount!="function"||(typeof z.componentWillMount=="function"&&z.componentWillMount(),typeof z.UNSAFE_componentWillMount=="function"&&z.UNSAFE_componentWillMount()),typeof z.componentDidMount=="function"&&(I.flags|=4194308)):(typeof z.componentDidMount=="function"&&(I.flags|=4194308),I.memoizedProps=G,I.memoizedState=de),z.props=G,z.state=de,z.context=xe,G=Q):(typeof z.componentDidMount=="function"&&(I.flags|=4194308),G=!1)}else{z=I.stateNode,xy(g,I),Q=I.memoizedProps,xe=I.type===I.elementType?Q:_s(I.type,Q),z.props=xe,Ct=I.pendingProps,it=z.context,de=p.contextType,typeof de=="object"&&de!==null?de=bs(de):(de=ni(p)?Us:Vn.current,de=yo(I,de));var en=p.getDerivedStateFromProps;(Ee=typeof en=="function"||typeof z.getSnapshotBeforeUpdate=="function")||typeof z.UNSAFE_componentWillReceiveProps!="function"&&typeof z.componentWillReceiveProps!="function"||(Q!==Ct||it!==de)&&Hy(I,z,G,de),Go=!1,it=I.memoizedState,z.state=it,lC(I,G,z,w);var Qe=I.memoizedState;Q!==Ct||it!==Qe||jt.current||Go?(typeof en=="function"&&(dp(I,p,en,G),Qe=I.memoizedState),(xe=Go||My(I,p,xe,G,it,Qe,de)||!1)?(Ee||typeof z.UNSAFE_componentWillUpdate!="function"&&typeof z.componentWillUpdate!="function"||(typeof z.componentWillUpdate=="function"&&z.componentWillUpdate(G,Qe,de),typeof z.UNSAFE_componentWillUpdate=="function"&&z.UNSAFE_componentWillUpdate(G,Qe,de)),typeof z.componentDidUpdate=="function"&&(I.flags|=4),typeof z.getSnapshotBeforeUpdate=="function"&&(I.flags|=1024)):(typeof z.componentDidUpdate!="function"||Q===g.memoizedProps&&it===g.memoizedState||(I.flags|=4),typeof z.getSnapshotBeforeUpdate!="function"||Q===g.memoizedProps&&it===g.memoizedState||(I.flags|=1024),I.memoizedProps=G,I.memoizedState=Qe),z.props=G,z.state=Qe,z.context=de,G=xe):(typeof z.componentDidUpdate!="function"||Q===g.memoizedProps&&it===g.memoizedState||(I.flags|=4),typeof z.getSnapshotBeforeUpdate!="function"||Q===g.memoizedProps&&it===g.memoizedState||(I.flags|=1024),G=!1)}return Hp(g,I,p,G,W,w)}function Hp(g,I,p,G,w,W){mG(g,I);var z=(I.flags&128)!==0;if(!G&&!z)return w&&Gy(I,p,!1),Ur(g,I,W);G=I.stateNode,BM.current=I;var Q=z&&typeof p.getDerivedStateFromError!="function"?null:G.render();return I.flags|=1,g!==null&&z?(I.child=Hl(I,g.child,null,W),I.child=Hl(I,null,Q,W)):Gi(g,I,Q,W),I.memoizedState=G.state,w&&Gy(I,p,!0),I.child}function bG(g){var I=g.stateNode;I.pendingContext?vy(g,I.pendingContext,I.pendingContext!==I.context):I.context&&vy(g,I.context,!1),vp(g,I.containerInfo)}function vG(g,I,p,G,w){return Nl(),bp(w),I.flags|=256,Gi(g,I,p,G),I.child}var GC={dehydrated:null,treeContext:null,retryLane:0};function BC(g){return{baseLanes:g,cachePool:null}}function yG(g,I,p){var G=I.pendingProps,w=dn.current,W=!1,z=(I.flags&128)!==0,Q;if((Q=z)||(Q=g!==null&&g.memoizedState===null?!1:(w&2)!==0),Q?(W=!0,I.flags&=-129):(g===null||g.memoizedState!==null)&&(w|=1),At(dn,w&1),g===null)return fp(I),g=I.memoizedState,g!==null&&(g=g.dehydrated,g!==null)?(I.mode&1?mc(g)?I.lanes=8:I.lanes=1073741824:I.lanes=1,null):(w=G.children,g=G.fallback,W?(G=I.mode,W=I.child,w={mode:"hidden",children:w},!(G&1)&&W!==null?(W.childLanes=0,W.pendingProps=w):W=DC(w,G,0,null),g=xa(g,G,p,null),W.return=I,g.return=I,W.sibling=g,I.child=W,I.child.memoizedState=BC(p),I.memoizedState=GC,g):Xp(I,w));if(w=g.memoizedState,w!==null){if(Q=w.dehydrated,Q!==null){if(z)return I.flags&256?(I.flags&=-257,ZC(g,I,p,Error(o(422)))):I.memoizedState!==null?(I.child=g.child,I.flags|=128,null):(W=G.fallback,w=I.mode,G=DC({mode:"visible",children:G.children},w,0,null),W=xa(W,w,p,null),W.flags|=2,G.return=I,W.return=I,G.sibling=W,I.child=G,I.mode&1&&Hl(I,g.child,null,p),I.child.memoizedState=BC(p),I.memoizedState=GC,W);if(!(I.mode&1))I=ZC(g,I,p,null);else if(mc(Q))I=ZC(g,I,p,Error(o(419)));else if(G=(p&g.childLanes)!==0,is||G){if(G=Mn,G!==null){switch(p&-p){case 4:W=2;break;case 16:W=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:W=32;break;case 536870912:W=268435456;break;default:W=0}G=W&(G.suspendedLanes|p)?0:W,G!==0&&G!==w.retryLane&&(w.retryLane=G,Zs(g,G,-1))}tm(),I=ZC(g,I,p,Error(o(421)))}else Qu(Q)?(I.flags|=128,I.child=g.child,I=FM.bind(null,g),tp(Q,I),I=null):(p=w.treeContext,ue&&(ns=ie(Q),ts=I,cn=!0,Js=null,vc=!1,p!==null&&(vs[ys++]=Er,vs[ys++]=kr,vs[ys++]=ba,Er=p.id,kr=p.overflow,ba=I)),I=Xp(I,I.pendingProps.children),I.flags|=4096);return I}return W?(G=BG(g,I,G.children,G.fallback,p),W=I.child,w=g.child.memoizedState,W.memoizedState=w===null?BC(p):{baseLanes:w.baseLanes|p,cachePool:null},W.childLanes=g.childLanes&~p,I.memoizedState=GC,G):(p=GG(g,I,G.children,p),I.memoizedState=null,p)}return W?(G=BG(g,I,G.children,G.fallback,p),W=I.child,w=g.child.memoizedState,W.memoizedState=w===null?BC(p):{baseLanes:w.baseLanes|p,cachePool:null},W.childLanes=g.childLanes&~p,I.memoizedState=GC,G):(p=GG(g,I,G.children,p),I.memoizedState=null,p)}function Xp(g,I){return I=DC({mode:"visible",children:I},g.mode,0,null),I.return=g,g.child=I}function GG(g,I,p,G){var w=g.child;return g=w.sibling,p=Ro(w,{mode:"visible",children:p}),!(I.mode&1)&&(p.lanes=G),p.return=I,p.sibling=null,g!==null&&(G=I.deletions,G===null?(I.deletions=[g],I.flags|=16):G.push(g)),I.child=p}function BG(g,I,p,G,w){var W=I.mode;g=g.child;var z=g.sibling,Q={mode:"hidden",children:p};return!(W&1)&&I.child!==g?(p=I.child,p.childLanes=0,p.pendingProps=Q,I.deletions=null):(p=Ro(g,Q),p.subtreeFlags=g.subtreeFlags&14680064),z!==null?G=Ro(z,G):(G=xa(G,W,w,null),G.flags|=2),G.return=I,p.return=I,p.sibling=G,I.child=p,G}function ZC(g,I,p,G){return G!==null&&bp(G),Hl(I,g.child,null,p),g=Xp(I,I.pendingProps.children),g.flags|=2,I.memoizedState=null,g}function ZG(g,I,p){g.lanes|=I;var G=g.alternate;G!==null&&(G.lanes|=I),up(g.return,I,p)}function Yp(g,I,p,G,w){var W=g.memoizedState;W===null?g.memoizedState={isBackwards:I,rendering:null,renderingStartTime:0,last:G,tail:p,tailMode:w}:(W.isBackwards=I,W.rendering=null,W.renderingStartTime=0,W.last=G,W.tail=p,W.tailMode=w)}function wG(g,I,p){var G=I.pendingProps,w=G.revealOrder,W=G.tail;if(Gi(g,I,G.children,p),G=dn.current,G&2)G=G&1|2,I.flags|=128;else{if(g!==null&&g.flags&128)e:for(g=I.child;g!==null;){if(g.tag===13)g.memoizedState!==null&&ZG(g,p,I);else if(g.tag===19)ZG(g,p,I);else if(g.child!==null){g.child.return=g,g=g.child;continue}if(g===I)break e;for(;g.sibling===null;){if(g.return===null||g.return===I)break e;g=g.return}g.sibling.return=g.return,g=g.sibling}G&=1}if(At(dn,G),!(I.mode&1))I.memoizedState=null;else switch(w){case"forwards":for(p=I.child,w=null;p!==null;)g=p.alternate,g!==null&&CC(g)===null&&(w=p),p=p.sibling;p=w,p===null?(w=I.child,I.child=null):(w=p.sibling,p.sibling=null),Yp(I,!1,w,p,W);break;case"backwards":for(p=null,w=I.child,I.child=null;w!==null;){if(g=w.alternate,g!==null&&CC(g)===null){I.child=w;break}g=w.sibling,w.sibling=p,p=w,w=g}Yp(I,!0,p,null,W);break;case"together":Yp(I,!1,null,null,void 0);break;default:I.memoizedState=null}return I.child}function Ur(g,I,p){if(g!==null&&(I.dependencies=g.dependencies),zl|=I.lanes,!(p&I.childLanes))return null;if(g!==null&&I.child!==g.child)throw Error(o(153));if(I.child!==null){for(g=I.child,p=Ro(g,g.pendingProps),I.child=p,p.return=I;g.sibling!==null;)g=g.sibling,p=p.sibling=Ro(g,g.pendingProps),p.return=I;p.sibling=null}return I.child}function ZM(g,I,p){switch(I.tag){case 3:bG(I),Nl();break;case 5:Ey(I);break;case 1:ni(I.type)&&qu(I);break;case 4:vp(I,I.stateNode.containerInfo);break;case 10:Sy(I,I.type._context,I.memoizedProps.value);break;case 13:var G=I.memoizedState;if(G!==null)return G.dehydrated!==null?(At(dn,dn.current&1),I.flags|=128,null):p&I.child.childLanes?yG(g,I,p):(At(dn,dn.current&1),g=Ur(g,I,p),g!==null?g.sibling:null);At(dn,dn.current&1);break;case 19:if(G=(p&I.childLanes)!==0,g.flags&128){if(G)return wG(g,I,p);I.flags|=128}var w=I.memoizedState;if(w!==null&&(w.rendering=null,w.tail=null,w.lastEffect=null),At(dn,dn.current),G)break;return null;case 22:case 23:return I.lanes=0,pG(g,I,p)}return Ur(g,I,p)}function wM(g,I){switch(pp(I),I.tag){case 1:return ni(I.type)&&ju(),g=I.flags,g&65536?(I.flags=g&-65537|128,I):null;case 3:return Yl(),Ot(jt),Ot(Vn),Bp(),g=I.flags,g&65536&&!(g&128)?(I.flags=g&-65537|128,I):null;case 5:return yp(I),null;case 13:if(Ot(dn),g=I.memoizedState,g!==null&&g.dehydrated!==null){if(I.alternate===null)throw Error(o(340));Nl()}return g=I.flags,g&65536?(I.flags=g&-65537|128,I):null;case 19:return Ot(dn),null;case 4:return Yl(),null;case 10:return Ip(I.type._context),null;case 22:case 23:return em(),null;case 24:return null;default:return null}}var wC=!1,Ga=!1,SM=typeof WeakSet=="function"?WeakSet:Set,Ne=null;function SC(g,I){var p=g.ref;if(p!==null)if(typeof p=="function")try{p(null)}catch(G){Fi(g,I,G)}else p.current=null}function Fp(g,I,p){try{p()}catch(G){Fi(g,I,G)}}var SG=!1;function xM(g,I){for(J(g.containerInfo),Ne=I;Ne!==null;)if(g=Ne,I=g.child,(g.subtreeFlags&1028)!==0&&I!==null)I.return=g,Ne=I;else for(;Ne!==null;){g=Ne;try{var p=g.alternate;if(g.flags&1024)switch(g.tag){case 0:case 11:case 15:break;case 1:if(p!==null){var G=p.memoizedProps,w=p.memoizedState,W=g.stateNode,z=W.getSnapshotBeforeUpdate(g.elementType===g.type?G:_s(g.type,G),w);W.__reactInternalSnapshotBeforeUpdate=z}break;case 3:Xe&&Ye(g.stateNode.containerInfo);break;case 5:case 6:case 4:case 17:break;default:throw Error(o(163))}}catch(Q){Fi(g,g.return,Q)}if(I=g.sibling,I!==null){I.return=g.return,Ne=I;break}Ne=g.return}return p=SG,SG=!1,p}function Ba(g,I,p){var G=I.updateQueue;if(G=G!==null?G.lastEffect:null,G!==null){var w=G=G.next;do{if((w.tag&g)===g){var W=w.destroy;w.destroy=void 0,W!==void 0&&Fp(I,p,W)}w=w.next}while(w!==G)}}function Nc(g,I){if(I=I.updateQueue,I=I!==null?I.lastEffect:null,I!==null){var p=I=I.next;do{if((p.tag&g)===g){var G=p.create;p.destroy=G()}p=p.next}while(p!==I)}}function Kp(g){var I=g.ref;if(I!==null){var p=g.stateNode;switch(g.tag){case 5:g=Ce(p);break;default:g=p}typeof I=="function"?I(g):I.current=g}}function xG(g,I,p){if(hr&&typeof hr.onCommitFiberUnmount=="function")try{hr.onCommitFiberUnmount(nC,I)}catch{}switch(I.tag){case 0:case 11:case 14:case 15:if(g=I.updateQueue,g!==null&&(g=g.lastEffect,g!==null)){var G=g=g.next;do{var w=G,W=w.destroy;w=w.tag,W!==void 0&&(w&2||w&4)&&Fp(I,p,W),G=G.next}while(G!==g)}break;case 1:if(SC(I,p),g=I.stateNode,typeof g.componentWillUnmount=="function")try{g.props=I.memoizedProps,g.state=I.memoizedState,g.componentWillUnmount()}catch(z){Fi(I,p,z)}break;case 5:SC(I,p);break;case 4:Xe?HG(g,I,p):fe&&fe&&(I=I.stateNode.containerInfo,p=Dt(I),Es(I,p))}}function RG(g,I,p){for(var G=I;;)if(xG(g,G,p),G.child===null||Xe&&G.tag===4){if(G===I)break;for(;G.sibling===null;){if(G.return===null||G.return===I)return;G=G.return}G.sibling.return=G.return,G=G.sibling}else G.child.return=G,G=G.child}function WG(g){var I=g.alternate;I!==null&&(g.alternate=null,WG(I)),g.child=null,g.deletions=null,g.sibling=null,g.tag===5&&(I=g.stateNode,I!==null&&st(I)),g.stateNode=null,g.return=null,g.dependencies=null,g.memoizedProps=null,g.memoizedState=null,g.pendingProps=null,g.stateNode=null,g.updateQueue=null}function VG(g){return g.tag===5||g.tag===3||g.tag===4}function MG(g){e:for(;;){for(;g.sibling===null;){if(g.return===null||VG(g.return))return null;g=g.return}for(g.sibling.return=g.return,g=g.sibling;g.tag!==5&&g.tag!==6&&g.tag!==18;){if(g.flags&2||g.child===null||g.tag===4)continue e;g.child.return=g,g=g.child}if(!(g.flags&2))return g.stateNode}}function NG(g){if(Xe){e:{for(var I=g.return;I!==null;){if(VG(I))break e;I=I.return}throw Error(o(160))}var p=I;switch(p.tag){case 5:I=p.stateNode,p.flags&32&&(Et(I),p.flags&=-33),p=MG(g),Lp(g,p,I);break;case 3:case 4:I=p.stateNode.containerInfo,p=MG(g),zp(g,p,I);break;default:throw Error(o(161))}}}function zp(g,I,p){var G=g.tag;if(G===5||G===6)g=g.stateNode,I?Te(p,g,I):Ke(p,g);else if(G!==4&&(g=g.child,g!==null))for(zp(g,I,p),g=g.sibling;g!==null;)zp(g,I,p),g=g.sibling}function Lp(g,I,p){var G=g.tag;if(G===5||G===6)g=g.stateNode,I?ot(p,g,I):gt(p,g);else if(G!==4&&(g=g.child,g!==null))for(Lp(g,I,p),g=g.sibling;g!==null;)Lp(g,I,p),g=g.sibling}function HG(g,I,p){for(var G=I,w=!1,W,z;;){if(!w){w=G.return;e:for(;;){if(w===null)throw Error(o(160));switch(W=w.stateNode,w.tag){case 5:z=!1;break e;case 3:W=W.containerInfo,z=!0;break e;case 4:W=W.containerInfo,z=!0;break e}w=w.return}w=!0}if(G.tag===5||G.tag===6)RG(g,G,p),z?Wt(W,G.stateNode):Oe(W,G.stateNode);else if(G.tag===18)z?wt(W,G.stateNode):Gt(W,G.stateNode);else if(G.tag===4){if(G.child!==null){W=G.stateNode.containerInfo,z=!0,G.child.return=G,G=G.child;continue}}else if(xG(g,G,p),G.child!==null){G.child.return=G,G=G.child;continue}if(G===I)break;for(;G.sibling===null;){if(G.return===null||G.return===I)return;G=G.return,G.tag===4&&(w=!1)}G.sibling.return=G.return,G=G.sibling}}function Tp(g,I){if(Xe){switch(I.tag){case 0:case 11:case 14:case 15:Ba(3,I,I.return),Nc(3,I),Ba(5,I,I.return);return;case 1:return;case 5:var p=I.stateNode;if(p!=null){var G=I.memoizedProps;g=g!==null?g.memoizedProps:G;var w=I.type,W=I.updateQueue;I.updateQueue=null,W!==null&&$e(p,W,w,g,G,I)}return;case 6:if(I.stateNode===null)throw Error(o(162));p=I.memoizedProps,pe(I.stateNode,g!==null?g.memoizedProps:p,p);return;case 3:ue&&g!==null&&g.memoizedState.isDehydrated&&ht(I.stateNode.containerInfo);return;case 12:return;case 13:xC(I);return;case 19:xC(I);return;case 17:return}throw Error(o(163))}switch(I.tag){case 0:case 11:case 14:case 15:Ba(3,I,I.return),Nc(3,I),Ba(5,I,I.return);return;case 12:return;case 13:xC(I);return;case 19:xC(I);return;case 3:ue&&g!==null&&g.memoizedState.isDehydrated&&ht(I.stateNode.containerInfo);break;case 22:case 23:return}e:if(fe){switch(I.tag){case 1:case 5:case 6:break e;case 3:case 4:I=I.stateNode,Es(I.containerInfo,I.pendingChildren);break e}throw Error(o(163))}}function xC(g){var I=g.updateQueue;if(I!==null){g.updateQueue=null;var p=g.stateNode;p===null&&(p=g.stateNode=new SM),I.forEach(function(G){var w=KM.bind(null,g,G);p.has(G)||(p.add(G),G.then(w,w))})}}function RM(g,I){for(Ne=I;Ne!==null;){I=Ne;var p=I.deletions;if(p!==null)for(var G=0;G";case WC:return":has("+(Dp(g)||"")+")";case VC:return'[role="'+g.value+'"]';case NC:return'"'+g.value+'"';case MC:return'[data-testname="'+g.value+'"]';default:throw Error(o(365))}}function zG(g,I){var p=[];g=[g,0];for(var G=0;Gw&&(w=z),G&=~W}if(G=w,G=On()-G,G=(120>G?120:480>G?480:1080>G?1080:1920>G?1920:3e3>G?3e3:4320>G?4320:1960*VM(G/1960))-G,10g?16:g,wo===null)var G=!1;else{if(g=wo,wo=null,KC=0,Bt&6)throw Error(o(331));var w=Bt;for(Bt|=4,Ne=g.current;Ne!==null;){var W=Ne,z=W.child;if(Ne.flags&16){var Q=W.deletions;if(Q!==null){for(var de=0;deOn()-Jp?Za(g,0):_p|=p),Yi(g,I)}function JG(g,I){I===0&&(g.mode&1?(I=eC,eC<<=1,!(eC&130023424)&&(eC=4194304)):I=1);var p=Bi();g=TC(g,I),g!==null&&(bc(g,I,p),Yi(g,p))}function FM(g){var I=g.memoizedState,p=0;I!==null&&(p=I.retryLane),JG(g,p)}function KM(g,I){var p=0;switch(g.tag){case 13:var G=g.stateNode,w=g.memoizedState;w!==null&&(p=w.retryLane);break;case 19:G=g.stateNode;break;default:throw Error(o(314))}G!==null&&G.delete(I),JG(g,p)}var OG;OG=function(g,I,p){if(g!==null)if(g.memoizedProps!==I.pendingProps||jt.current)is=!0;else{if(!(g.lanes&p)&&!(I.flags&128))return is=!1,ZM(g,I,p);is=!!(g.flags&131072)}else is=!1,cn&&I.flags&1048576&&Xy(I,IC,I.index);switch(I.lanes=0,I.tag){case 2:var G=I.type;g!==null&&(g.alternate=null,I.alternate=null,I.flags|=2),g=I.pendingProps;var w=yo(I,Vn.current);Wl(I,p),w=wp(null,I,G,g,w,p);var W=Sp();return I.flags|=1,typeof w=="object"&&w!==null&&typeof w.render=="function"&&w.$$typeof===void 0?(I.tag=1,I.memoizedState=null,I.updateQueue=null,ni(G)?(W=!0,qu(I)):W=!1,I.memoizedState=w.state!==null&&w.state!==void 0?w.state:null,Cp(I),w.updater=gC,I.stateNode=w,w._reactInternals=I,hp(I,G,g,p),I=Hp(null,I,G,!0,W,p)):(I.tag=0,cn&&W&&Ap(I),Gi(null,I,w,p),I=I.child),I;case 16:G=I.elementType;e:{switch(g!==null&&(g.alternate=null,I.alternate=null,I.flags|=2),g=I.pendingProps,w=G._init,G=w(G._payload),I.type=G,w=I.tag=LM(G),g=_s(G,g),w){case 0:I=Np(null,I,G,g,p);break e;case 1:I=fG(null,I,G,g,p);break e;case 11:I=dG(null,I,G,g,p);break e;case 14:I=hG(null,I,G,_s(G.type,g),p);break e}throw Error(o(306,G,""))}return I;case 0:return G=I.type,w=I.pendingProps,w=I.elementType===G?w:_s(G,w),Np(g,I,G,w,p);case 1:return G=I.type,w=I.pendingProps,w=I.elementType===G?w:_s(G,w),fG(g,I,G,w,p);case 3:e:{if(bG(I),g===null)throw Error(o(387));G=I.pendingProps,W=I.memoizedState,w=W.element,xy(g,I),lC(I,G,null,p);var z=I.memoizedState;if(G=z.element,ue&&W.isDehydrated)if(W={element:G,isDehydrated:!1,cache:z.cache,transitions:z.transitions},I.updateQueue.baseState=W,I.memoizedState=W,I.flags&256){w=Error(o(423)),I=vG(g,I,G,p,w);break e}else if(G!==w){w=Error(o(424)),I=vG(g,I,G,p,w);break e}else for(ue&&(ns=Ae(I.stateNode.containerInfo),ts=I,cn=!0,Js=null,vc=!1),p=Ty(I,null,G,p),I.child=p;p;)p.flags=p.flags&-3|4096,p=p.sibling;else{if(Nl(),G===w){I=Ur(g,I,p);break e}Gi(g,I,G,p)}I=I.child}return I;case 5:return Ey(I),g===null&&fp(I),G=I.type,w=I.pendingProps,W=g!==null?g.memoizedProps:null,z=w.children,ve(G,w)?z=null:W!==null&&ve(G,W)&&(I.flags|=32),mG(g,I),Gi(g,I,z,p),I.child;case 6:return g===null&&fp(I),null;case 13:return yG(g,I,p);case 4:return vp(I,I.stateNode.containerInfo),G=I.pendingProps,g===null?I.child=Hl(I,null,G,p):Gi(g,I,G,p),I.child;case 11:return G=I.type,w=I.pendingProps,w=I.elementType===G?w:_s(G,w),dG(g,I,G,w,p);case 7:return Gi(g,I,I.pendingProps,p),I.child;case 8:return Gi(g,I,I.pendingProps.children,p),I.child;case 12:return Gi(g,I,I.pendingProps.children,p),I.child;case 10:e:{if(G=I.type._context,w=I.pendingProps,W=I.memoizedProps,z=w.value,Sy(I,G,z),W!==null)if(Ar(W.value,z)){if(W.children===w.children&&!jt.current){I=Ur(g,I,p);break e}}else for(W=I.child,W!==null&&(W.return=I);W!==null;){var Q=W.dependencies;if(Q!==null){z=W.child;for(var de=Q.firstContext;de!==null;){if(de.context===G){if(W.tag===1){de=Tr(-1,p&-p),de.tag=2;var xe=W.updateQueue;if(xe!==null){xe=xe.shared;var Ee=xe.pending;Ee===null?de.next=de:(de.next=Ee.next,Ee.next=de),xe.pending=de}}W.lanes|=p,de=W.alternate,de!==null&&(de.lanes|=p),up(W.return,p,I),Q.lanes|=p;break}de=de.next}}else if(W.tag===10)z=W.type===I.type?null:W.child;else if(W.tag===18){if(z=W.return,z===null)throw Error(o(341));z.lanes|=p,Q=z.alternate,Q!==null&&(Q.lanes|=p),up(z,p,I),z=W.sibling}else z=W.child;if(z!==null)z.return=W;else for(z=W;z!==null;){if(z===I){z=null;break}if(W=z.sibling,W!==null){W.return=z.return,z=W;break}z=z.return}W=z}Gi(g,I,w.children,p),I=I.child}return I;case 9:return w=I.type,G=I.pendingProps.children,Wl(I,p),w=bs(w),G=G(w),I.flags|=1,Gi(g,I,G,p),I.child;case 14:return G=I.type,w=_s(G,I.pendingProps),w=_s(G.type,w),hG(g,I,G,w,p);case 15:return AG(g,I,I.type,I.pendingProps,p);case 17:return G=I.type,w=I.pendingProps,w=I.elementType===G?w:_s(G,w),g!==null&&(g.alternate=null,I.alternate=null,I.flags|=2),I.tag=1,ni(G)?(g=!0,qu(I)):g=!1,Wl(I,p),Ny(I,G,w),hp(I,G,w,p),Hp(null,I,G,!0,g,p);case 19:return wG(g,I,p);case 22:return pG(g,I,p)}throw Error(o(156,I.tag))};function QG(g,I){return rp(g,I)}function zM(g,I,p,G){this.tag=g,this.key=p,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=I,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=G,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ws(g,I,p,G){return new zM(g,I,p,G)}function nm(g){return g=g.prototype,!(!g||!g.isReactComponent)}function LM(g){if(typeof g=="function")return nm(g)?1:0;if(g!=null){if(g=g.$$typeof,g===v)return 11;if(g===b)return 14}return 2}function Ro(g,I){var p=g.alternate;return p===null?(p=ws(g.tag,I,g.key,g.mode),p.elementType=g.elementType,p.type=g.type,p.stateNode=g.stateNode,p.alternate=g,g.alternate=p):(p.pendingProps=I,p.type=g.type,p.flags=0,p.subtreeFlags=0,p.deletions=null),p.flags=g.flags&14680064,p.childLanes=g.childLanes,p.lanes=g.lanes,p.child=g.child,p.memoizedProps=g.memoizedProps,p.memoizedState=g.memoizedState,p.updateQueue=g.updateQueue,I=g.dependencies,p.dependencies=I===null?null:{lanes:I.lanes,firstContext:I.firstContext},p.sibling=g.sibling,p.index=g.index,p.ref=g.ref,p}function kC(g,I,p,G,w,W){var z=2;if(G=g,typeof g=="function")nm(g)&&(z=1);else if(typeof g=="string")z=5;else e:switch(g){case u:return xa(p.children,w,W,I);case C:z=8,w|=8;break;case d:return g=ws(12,p,I,w|2),g.elementType=d,g.lanes=W,g;case y:return g=ws(13,p,I,w),g.elementType=y,g.lanes=W,g;case A:return g=ws(19,p,I,w),g.elementType=A,g.lanes=W,g;case B:return DC(p,w,W,I);default:if(typeof g=="object"&&g!==null)switch(g.$$typeof){case h:z=10;break e;case m:z=9;break e;case v:z=11;break e;case b:z=14;break e;case f:z=16,G=null;break e}throw Error(o(130,g==null?g:typeof g,""))}return I=ws(z,p,I,w),I.elementType=g,I.type=G,I.lanes=W,I}function xa(g,I,p,G){return g=ws(7,g,G,I),g.lanes=p,g}function DC(g,I,p,G){return g=ws(22,g,G,I),g.elementType=B,g.lanes=p,g.stateNode={},g}function im(g,I,p){return g=ws(6,g,null,I),g.lanes=p,g}function sm(g,I,p){return I=ws(4,g.children!==null?g.children:[],g.key,I),I.lanes=p,I.stateNode={containerInfo:g.containerInfo,pendingChildren:null,implementation:g.implementation},I}function TM(g,I,p,G,w){this.tag=I,this.containerInfo=g,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=lt,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=ip(0),this.expirationTimes=ip(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ip(0),this.identifierPrefix=G,this.onRecoverableError=w,ue&&(this.mutableSourceEagerHydrationData=null)}function jG(g,I,p,G,w,W,z,Q,de){return g=new TM(g,I,p,Q,de),I===1?(I=1,W===!0&&(I|=8)):I=0,W=ws(3,null,null,I),g.current=W,W.stateNode=g,W.memoizedState={element:G,isDehydrated:p,cache:null,transitions:null},Cp(W),g}function qG(g){if(!g)return gi;g=g._reactInternals;e:{if(Z(g)!==g||g.tag!==1)throw Error(o(170));var I=g;do{switch(I.tag){case 3:I=I.stateNode.context;break e;case 1:if(ni(I.type)){I=I.stateNode.__reactInternalMemoizedMergedChildContext;break e}}I=I.return}while(I!==null);throw Error(o(171))}if(g.tag===1){var p=g.type;if(ni(p))return yy(g,p,I)}return I}function $G(g){var I=g._reactInternals;if(I===void 0)throw typeof g.render=="function"?Error(o(188)):(g=Object.keys(g).join(","),Error(o(268,g)));return g=D(I),g===null?null:g.stateNode}function eB(g,I){if(g=g.memoizedState,g!==null&&g.dehydrated!==null){var p=g.retryLane;g.retryLane=p!==0&&p=xe&&W>=Ct&&w<=Ee&&z<=it){g.splice(I,1);break}else if(G!==xe||p.width!==de.width||itz){if(!(W!==Ct||p.height!==de.height||Eew)){xe>G&&(de.width+=xe-G,de.x=G),EeW&&(de.height+=Ct-W,de.y=W),itp&&(p=z)),z ")+` No matching component was found for: - `)+g.join(" > ")}return null},t.getPublicRootInstance=function(g){if(g=g.current,!g.child)return null;switch(g.child.tag){case 5:return Ce(g.child.stateNode);default:return g.child.stateNode}},t.injectIntoDevTools=function(g){if(g={bundleType:g.bundleType,version:g.version,rendererPackageName:g.rendererPackageName,rendererConfig:g.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:a.ReactCurrentDispatcher,findHostInstanceByFiber:EM,findFiberByHostInstance:g.findFiberByHostInstance||kM,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.0.0-fc46dba67-20220329"},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")g=!1;else{var I=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(I.isDisabled||!I.supportsFiber)g=!0;else{try{nC=I.inject(g),hr=I}catch{}g=!!I.checkDCE}}return g},t.isAlreadyRendering=function(){return!1},t.observeVisibleRects=function(g,I,p,G){if(!ut)throw Error(o(363));g=Up(g,I);var w=Me(g,p,G).disconnect;return{disconnect:function(){w()}}},t.registerMutableSourceForHydration=function(g,I){var p=I._getVersion;p=p(I._source),g.mutableSourceEagerHydrationData==null?g.mutableSourceEagerHydrationData=[I,p]:g.mutableSourceEagerHydrationData.push(I,p)},t.runWithPriority=function(g,I){var p=Ft;try{return Ft=g,I()}finally{Ft=p}},t.shouldError=function(){return null},t.shouldSuspend=function(){return!1},t.updateContainer=function(g,I,p,G){var w=I.current,W=Bi(),z=So(w);return p=qG(p),I.context===null?I.context=p:I.pendingContext=p,I=Tr(W,z),I.payload={element:g},G=G===void 0?null:G,G!==null&&(I.callback=G),Bo(w,I),g=Zs(w,z,W),g!==null&&aC(g,w,z),z},t};SW.exports=vL;var yL=SW.exports;const GL=Gb(yL);function WW(n,e,t=(i,s)=>i===s){if(n===e)return!0;if(!n||!e)return!1;const i=n.length;if(e.length!==i)return!1;for(let s=0;ss.response=r).then(()=>{i.lifespan&&i.lifespan>0&&setTimeout(()=>{const r=io.indexOf(s);r!==-1&&io.splice(r,1)},i.lifespan)}).catch(r=>s.error=r)};if(io.push(s),!t)throw s.promise}const BL=(n,e,t)=>VW(n,e,!1,t),ZL=(n,e,t)=>void VW(n,e,!0,t),wL=n=>{if(n===void 0||n.length===0)io.splice(0,io.length);else{const e=io.find(t=>WW(n,t.keys,t.equal));if(e){const t=io.indexOf(e);t!==-1&&io.splice(t,1)}}},oy={},MW=n=>void Object.assign(oy,n);function SL(n,e){function t(u,{args:C=[],attach:d,...h},m){let v=`${u[0].toUpperCase()}${u.slice(1)}`,y;if(u==="primitive"){if(h.object===void 0)throw new Error("R3F: Primitives without 'object' are invalid!");const A=h.object;y=Cg(A,{type:u,root:m,attach:d,primitive:!0})}else{const A=oy[v];if(!A)throw new Error(`R3F: ${v} is not part of the THREE namespace! Did you forget to extend? See: https://docs.pmnd.rs/react-three-fiber/api/objects#using-3rd-party-objects-declaratively`);if(!Array.isArray(C))throw new Error("R3F: The args prop must be an array!");y=Cg(new A(...C),{type:u,root:m,attach:d,memoizedProps:{args:C}})}return y.__r3f.attach===void 0&&(y instanceof ft?y.__r3f.attach="geometry":y instanceof _n&&(y.__r3f.attach="material")),v!=="inject"&&uf(y,h),y}function i(u,C){let d=!1;if(C){var h,m;(h=C.__r3f)!=null&&h.attach?If(u,C,C.__r3f.attach):C.isObject3D&&u.isObject3D&&(u.add(C),d=!0),d||(m=u.__r3f)==null||m.objects.push(C),C.__r3f||Cg(C,{}),C.__r3f.parent=u,cb(C),dg(C)}}function s(u,C,d){let h=!1;if(C){var m,v;if((m=C.__r3f)!=null&&m.attach)If(u,C,C.__r3f.attach);else if(C.isObject3D&&u.isObject3D){C.parent=u,C.dispatchEvent({type:"added"});const y=u.children.filter(b=>b!==C),A=y.indexOf(d);u.children=[...y.slice(0,A),C,...y.slice(A)],h=!0}h||(v=u.__r3f)==null||v.objects.push(C),C.__r3f||Cg(C,{}),C.__r3f.parent=u,cb(C),dg(C)}}function r(u,C,d=!1){u&&[...u].forEach(h=>o(C,h,d))}function o(u,C,d){if(C){var h,m,v;if(C.__r3f&&(C.__r3f.parent=null),(h=u.__r3f)!=null&&h.objects&&(u.__r3f.objects=u.__r3f.objects.filter(B=>B!==C)),(m=C.__r3f)!=null&&m.attach)LZ(u,C,C.__r3f.attach);else if(C.isObject3D&&u.isObject3D){var y;u.remove(C),(y=C.__r3f)!=null&&y.root&&HL(C.__r3f.root,C)}const b=(v=C.__r3f)==null?void 0:v.primitive,f=d===void 0?C.dispose!==null&&!b:d;if(!b){var A;r((A=C.__r3f)==null?void 0:A.objects,C,f),r(C.children,C,f)}C.__r3f&&(delete C.__r3f.root,delete C.__r3f.objects,delete C.__r3f.handlers,delete C.__r3f.memoizedProps,b||delete C.__r3f),f&&C.dispose&&C.type!=="Scene"&&lb.unstable_scheduleCallback(lb.unstable_IdlePriority,()=>{try{C.dispose()}catch{}}),dg(u)}}function a(u,C,d,h){var m;const v=(m=u.__r3f)==null?void 0:m.parent;if(!v)return;const y=t(C,d,u.__r3f.root);if(u.children){for(const A of u.children)A.__r3f&&i(y,A);u.children=u.children.filter(A=>!A.__r3f)}u.__r3f.objects.forEach(A=>i(y,A)),u.__r3f.objects=[],u.__r3f.autoRemovedBeforeAppend||o(v,u),y.parent&&(y.__r3f.autoRemovedBeforeAppend=!0),i(v,y),y.raycast&&y.__r3f.eventCount&&y.__r3f.root.getState().internal.interaction.push(y),[h,h.alternate].forEach(A=>{A!==null&&(A.stateNode=y,A.ref&&(typeof A.ref=="function"?A.ref(y):A.ref.current=y))})}const l=()=>console.warn("Text is not allowed in the R3F tree! This could be stray whitespace or characters.");return{reconciler:GL({createInstance:t,removeChild:o,appendChild:i,appendInitialChild:i,insertBefore:s,supportsMutation:!0,isPrimaryRenderer:!1,supportsPersistence:!1,supportsHydration:!1,noTimeout:-1,appendChildToContainer:(u,C)=>{if(!C)return;const d=u.getState().scene;d.__r3f&&(d.__r3f.root=u,i(d,C))},removeChildFromContainer:(u,C)=>{C&&o(u.getState().scene,C)},insertInContainerBefore:(u,C,d)=>{if(!C||!d)return;const h=u.getState().scene;h.__r3f&&s(h,C,d)},getRootHostContext:()=>null,getChildHostContext:u=>u,finalizeInitialChildren(u){var C;return!!((C=u?.__r3f)!=null?C:{}).handlers},prepareUpdate(u,C,d,h){if(u.__r3f.primitive&&h.object&&h.object!==u)return[!0];{const{args:m=[],children:v,...y}=h,{args:A=[],children:b,...f}=d;if(!Array.isArray(m))throw new Error("R3F: the args prop must be an array!");if(m.some((S,x)=>S!==A[x]))return[!0];const B=zW(u,y,f,!0);return B.changes.length?[!1,B]:null}},commitUpdate(u,[C,d],h,m,v,y){C?a(u,h,v,y):uf(u,d)},commitMount(u,C,d,h){var m;const v=(m=u.__r3f)!=null?m:{};u.raycast&&v.handlers&&v.eventCount&&u.__r3f.root.getState().internal.interaction.push(u)},getPublicInstance:u=>u,prepareForCommit:()=>null,preparePortalMount:u=>Cg(u.getState().scene),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance(u){var C;const{attach:d,parent:h}=(C=u.__r3f)!=null?C:{};d&&h&&LZ(h,u,d),u.isObject3D&&(u.visible=!1),dg(u)},unhideInstance(u,C){var d;const{attach:h,parent:m}=(d=u.__r3f)!=null?d:{};h&&m&&If(m,u,h),(u.isObject3D&&C.visible==null||C.visible)&&(u.visible=!0),dg(u)},createTextInstance:l,hideTextInstance:l,unhideTextInstance:l,getCurrentEventPriority:()=>e?e():Vg.DefaultEventPriority,beforeActiveInstanceBlur:()=>{},afterActiveInstanceBlur:()=>{},detachDeletedInstance:()=>{},now:typeof performance<"u"&&an.fun(performance.now)?performance.now:an.fun(Date.now)?Date.now:()=>0,scheduleTimeout:an.fun(setTimeout)?setTimeout:void 0,cancelTimeout:an.fun(clearTimeout)?clearTimeout:void 0}),applyProps:uf}}var YZ,FZ;const cf=n=>"colorSpace"in n||"outputColorSpace"in n,NW=()=>{var n;return(n=oy.ColorManagement)!=null?n:null},HW=n=>n&&n.isOrthographicCamera,xL=n=>n&&n.hasOwnProperty("current"),Cc=typeof window<"u"&&((YZ=window.document)!=null&&YZ.createElement||((FZ=window.navigator)==null?void 0:FZ.product)==="ReactNative")?U.useLayoutEffect:U.useEffect;function XW(n){const e=U.useRef(n);return Cc(()=>void(e.current=n),[n]),e}function RL({set:n}){return Cc(()=>(n(new Promise(()=>null)),()=>n(!1)),[n]),null}class YW extends U.Component{constructor(...e){super(...e),this.state={error:!1}}componentDidCatch(e){this.props.set(e)}render(){return this.state.error?null:this.props.children}}YW.getDerivedStateFromError=()=>({error:!0});const FW="__default",KZ=new Map,WL=n=>n&&!!n.memoized&&!!n.changes;function KW(n){var e;const t=typeof window<"u"?(e=window.devicePixelRatio)!=null?e:2:1;return Array.isArray(n)?Math.min(Math.max(n[0],t),n[1]):n}const nI=n=>{var e;return(e=n.__r3f)==null?void 0:e.root.getState()},an={obj:n=>n===Object(n)&&!an.arr(n)&&typeof n!="function",fun:n=>typeof n=="function",str:n=>typeof n=="string",num:n=>typeof n=="number",boo:n=>typeof n=="boolean",und:n=>n===void 0,arr:n=>Array.isArray(n),equ(n,e,{arrays:t="shallow",objects:i="reference",strict:s=!0}={}){if(typeof n!=typeof e||!!n!=!!e)return!1;if(an.str(n)||an.num(n))return n===e;const r=an.obj(n);if(r&&i==="reference")return n===e;const o=an.arr(n);if(o&&t==="reference")return n===e;if((o||r)&&n===e)return!0;let a;for(a in n)if(!(a in e))return!1;if(r&&t==="shallow"&&i==="shallow"){for(a in s?e:n)if(!an.equ(n[a],e[a],{strict:s,objects:"reference"}))return!1}else for(a in s?e:n)if(n[a]!==e[a])return!1;if(an.und(a)){if(o&&n.length===0&&e.length===0||r&&Object.keys(n).length===0&&Object.keys(e).length===0)return!0;if(n!==e)return!1}return!0}};function VL(n){const e={nodes:{},materials:{}};return n&&n.traverse(t=>{t.name&&(e.nodes[t.name]=t),t.material&&!e.materials[t.material.name]&&(e.materials[t.material.name]=t.material)}),e}function ML(n){n.dispose&&n.type!=="Scene"&&n.dispose();for(const e in n)e.dispose==null||e.dispose(),delete n[e]}function Cg(n,e){const t=n;return(e!=null&&e.primitive||!t.__r3f)&&(t.__r3f={type:"",root:null,previousAttach:null,memoizedProps:{},eventCount:0,handlers:{},objects:[],parent:null,...e}),n}function gb(n,e){let t=n;if(e.includes("-")){const i=e.split("-"),s=i.pop();return t=i.reduce((r,o)=>r[o],n),{target:t,key:s}}else return{target:t,key:e}}const zZ=/-\d+$/;function If(n,e,t){if(an.str(t)){if(zZ.test(t)){const r=t.replace(zZ,""),{target:o,key:a}=gb(n,r);Array.isArray(o[a])||(o[a]=[])}const{target:i,key:s}=gb(n,t);e.__r3f.previousAttach=i[s],i[s]=e}else e.__r3f.previousAttach=t(n,e)}function LZ(n,e,t){var i,s;if(an.str(t)){const{target:r,key:o}=gb(n,t),a=e.__r3f.previousAttach;a===void 0?delete r[o]:r[o]=a}else(i=e.__r3f)==null||i.previousAttach==null||i.previousAttach(n,e);(s=e.__r3f)==null||delete s.previousAttach}function zW(n,{children:e,key:t,ref:i,...s},{children:r,key:o,ref:a,...l}={},c=!1){var u;const C=(u=n?.__r3f)!=null?u:{},d=Object.entries(s),h=[];if(c){const v=Object.keys(l);for(let y=0;y{var A;if((A=n.__r3f)!=null&&A.primitive&&v==="object"||an.equ(y,l[v]))return;if(/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/.test(v))return h.push([v,y,!0,[]]);let b=[];v.includes("-")&&(b=v.split("-")),h.push([v,y,!1,b]);for(const f in s){const B=s[f];f.startsWith(`${v}-`)&&h.push([f,B,!1,f.split("-")])}});const m={...s};return C.memoizedProps&&C.memoizedProps.args&&(m.args=C.memoizedProps.args),C.memoizedProps&&C.memoizedProps.attach&&(m.attach=C.memoizedProps.attach),{memoized:m,changes:h}}function uf(n,e){var t,i,s;const r=(t=n.__r3f)!=null?t:{},o=r.root,a=(i=o==null||o.getState==null?void 0:o.getState())!=null?i:{},{memoized:l,changes:c}=WL(e)?e:zW(n,e),u=r.eventCount;n.__r3f&&(n.__r3f.memoizedProps=l);for(let d=0;df[B],n),!(b&&b.set))){const[f,...B]=y.reverse();A=B.reverse().reduce((S,x)=>S[x],n),h=f}if(m===FW+"remove")if(A.constructor){let f=KZ.get(A.constructor);f||(f=new A.constructor,KZ.set(A.constructor,f)),m=f[h]}else m=0;if(v)m?r.handlers[h]=m:delete r.handlers[h],r.eventCount=Object.keys(r.handlers).length;else if(b&&b.set&&(b.copy||b instanceof al)){if(Array.isArray(m))b.fromArray?b.fromArray(m):b.set(...m);else if(b.copy&&m&&m.constructor&&b.constructor===m.constructor)b.copy(m);else if(m!==void 0){const f=b instanceof Re;!f&&b.setScalar?b.setScalar(m):b instanceof al&&m instanceof al?b.mask=m.mask:b.set(m),!NW()&&!a.linear&&f&&b.convertSRGBToLinear()}}else if(A[h]=m,A[h]instanceof qt&&A[h].format===un&&A[h].type===rn){const f=A[h];cf(f)&&cf(a.gl)?f.colorSpace=a.gl.outputColorSpace:f.encoding=a.gl.outputEncoding}dg(n)}if(r.parent&&a.internal&&n.raycast&&u!==r.eventCount){const d=a.internal.interaction.indexOf(n);d>-1&&a.internal.interaction.splice(d,1),r.eventCount&&a.internal.interaction.push(n)}return!(c.length===1&&c[0][0]==="onUpdate")&&c.length&&(s=n.__r3f)!=null&&s.parent&&cb(n),n}function dg(n){var e,t;const i=(e=n.__r3f)==null||(t=e.root)==null||t.getState==null?void 0:t.getState();i&&i.internal.frames===0&&i.invalidate()}function cb(n){n.onUpdate==null||n.onUpdate(n)}function LW(n,e){n.manual||(HW(n)?(n.left=e.width/-2,n.right=e.width/2,n.top=e.height/2,n.bottom=e.height/-2):n.aspect=e.width/e.height,n.updateProjectionMatrix(),n.updateMatrixWorld())}function Od(n){return(n.eventObject||n.object).uuid+"/"+n.index+n.instanceId}function NL(){var n;const e=typeof self<"u"&&self||typeof window<"u"&&window;if(!e)return Vg.DefaultEventPriority;switch((n=e.event)==null?void 0:n.type){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return Vg.DiscreteEventPriority;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return Vg.ContinuousEventPriority;default:return Vg.DefaultEventPriority}}function TW(n,e,t,i){const s=t.get(e);s&&(t.delete(e),t.size===0&&(n.delete(i),s.target.releasePointerCapture(i)))}function HL(n,e){const{internal:t}=n.getState();t.interaction=t.interaction.filter(i=>i!==e),t.initialHits=t.initialHits.filter(i=>i!==e),t.hovered.forEach((i,s)=>{(i.eventObject===e||i.object===e)&&t.hovered.delete(s)}),t.capturedMap.forEach((i,s)=>{TW(t.capturedMap,e,i,s)})}function XL(n){function e(l){const{internal:c}=n.getState(),u=l.offsetX-c.initialClick[0],C=l.offsetY-c.initialClick[1];return Math.round(Math.sqrt(u*u+C*C))}function t(l){return l.filter(c=>["Move","Over","Enter","Out","Leave"].some(u=>{var C;return(C=c.__r3f)==null?void 0:C.handlers["onPointer"+u]}))}function i(l,c){const u=n.getState(),C=new Set,d=[],h=c?c(u.internal.interaction):u.internal.interaction;for(let A=0;A{const f=nI(A.object),B=nI(b.object);return!f||!B?A.distance-b.distance:B.events.priority-f.events.priority||A.distance-b.distance}).filter(A=>{const b=Od(A);return C.has(b)?!1:(C.add(b),!0)});u.events.filter&&(v=u.events.filter(v,u));for(const A of v){let b=A.object;for(;b;){var y;(y=b.__r3f)!=null&&y.eventCount&&d.push({...A,eventObject:b}),b=b.parent}}if("pointerId"in l&&u.internal.capturedMap.has(l.pointerId))for(let A of u.internal.capturedMap.get(l.pointerId).values())C.has(Od(A.intersection))||d.push(A.intersection);return d}function s(l,c,u,C){const d=n.getState();if(l.length){const h={stopped:!1};for(const m of l){const v=nI(m.object)||d,{raycaster:y,pointer:A,camera:b,internal:f}=v,B=new H(A.x,A.y,0).unproject(b),S=V=>{var N,D;return(N=(D=f.capturedMap.get(V))==null?void 0:D.has(m.eventObject))!=null?N:!1},x=V=>{const N={intersection:m,target:c.target};f.capturedMap.has(V)?f.capturedMap.get(V).set(m.eventObject,N):f.capturedMap.set(V,new Map([[m.eventObject,N]])),c.target.setPointerCapture(V)},R=V=>{const N=f.capturedMap.get(V);N&&TW(f.capturedMap,m.eventObject,N,V)};let M={};for(let V in c){let N=c[V];typeof N!="function"&&(M[V]=N)}let Z={...m,...M,pointer:A,intersections:l,stopped:h.stopped,delta:u,unprojectedPoint:B,ray:y.ray,camera:b,stopPropagation(){const V="pointerId"in c&&f.capturedMap.get(c.pointerId);if((!V||V.has(m.eventObject))&&(Z.stopped=h.stopped=!0,f.hovered.size&&Array.from(f.hovered.values()).find(N=>N.eventObject===m.eventObject))){const N=l.slice(0,l.indexOf(m));r([...N,m])}},target:{hasPointerCapture:S,setPointerCapture:x,releasePointerCapture:R},currentTarget:{hasPointerCapture:S,setPointerCapture:x,releasePointerCapture:R},nativeEvent:c};if(C(Z),h.stopped===!0)break}}return l}function r(l){const{internal:c}=n.getState();for(const u of c.hovered.values())if(!l.length||!l.find(C=>C.object===u.object&&C.index===u.index&&C.instanceId===u.instanceId)){const d=u.eventObject.__r3f,h=d?.handlers;if(c.hovered.delete(Od(u)),d!=null&&d.eventCount){const m={...u,intersections:l};h.onPointerOut==null||h.onPointerOut(m),h.onPointerLeave==null||h.onPointerLeave(m)}}}function o(l,c){for(let u=0;ur([]);case"onLostPointerCapture":return c=>{const{internal:u}=n.getState();"pointerId"in c&&u.capturedMap.has(c.pointerId)&&requestAnimationFrame(()=>{u.capturedMap.has(c.pointerId)&&(u.capturedMap.delete(c.pointerId),r([]))})}}return function(u){const{onPointerMissed:C,internal:d}=n.getState();d.lastEvent.current=u;const h=l==="onPointerMove",m=l==="onClick"||l==="onContextMenu"||l==="onDoubleClick",y=i(u,h?t:void 0),A=m?e(u):0;l==="onPointerDown"&&(d.initialClick=[u.offsetX,u.offsetY],d.initialHits=y.map(f=>f.eventObject)),m&&!y.length&&A<=2&&(o(u,d.interaction),C&&C(u)),h&&r(y);function b(f){const B=f.eventObject,S=B.__r3f,x=S?.handlers;if(S!=null&&S.eventCount)if(h){if(x.onPointerOver||x.onPointerEnter||x.onPointerOut||x.onPointerLeave){const R=Od(f),M=d.hovered.get(R);M?M.stopped&&f.stopPropagation():(d.hovered.set(R,f),x.onPointerOver==null||x.onPointerOver(f),x.onPointerEnter==null||x.onPointerEnter(f))}x.onPointerMove==null||x.onPointerMove(f)}else{const R=x[l];R?(!m||d.initialHits.includes(B))&&(o(u,d.interaction.filter(M=>!d.initialHits.includes(M))),R(f)):m&&d.initialHits.includes(B)&&o(u,d.interaction.filter(M=>!d.initialHits.includes(M)))}}s(y,u,A,b)}}return{handlePointer:a}}const YL=["set","get","setSize","setFrameloop","setDpr","events","invalidate","advance","size","viewport"],EW=n=>!!(n!=null&&n.render),ay=U.createContext(null),FL=(n,e)=>{const t=wW((a,l)=>{const c=new H,u=new H,C=new H;function d(A=l().camera,b=u,f=l().size){const{width:B,height:S,top:x,left:R}=f,M=B/S;b instanceof H?C.copy(b):C.set(...b);const Z=A.getWorldPosition(c).distanceTo(C);if(HW(A))return{width:B/A.zoom,height:S/A.zoom,top:x,left:R,factor:1,distance:Z,aspect:M};{const V=A.fov*Math.PI/180,N=2*Math.tan(V/2)*Z,D=N*(B/S);return{width:D,height:N,top:x,left:R,factor:B/D,distance:Z,aspect:M}}}let h;const m=A=>a(b=>({performance:{...b.performance,current:A}})),v=new ne;return{set:a,get:l,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},xr:null,scene:null,invalidate:(A=1)=>n(l(),A),advance:(A,b)=>e(A,b,l()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new ny,pointer:v,mouse:v,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{const A=l();h&&clearTimeout(h),A.performance.current!==A.performance.min&&m(A.performance.min),h=setTimeout(()=>m(l().performance.max),A.performance.debounce)}},size:{width:0,height:0,top:0,left:0,updateStyle:!1},viewport:{initialDpr:0,dpr:0,width:0,height:0,top:0,left:0,aspect:0,distance:0,factor:0,getCurrentViewport:d},setEvents:A=>a(b=>({...b,events:{...b.events,...A}})),setSize:(A,b,f,B,S)=>{const x=l().camera,R={width:A,height:b,top:B||0,left:S||0,updateStyle:f};a(M=>({size:R,viewport:{...M.viewport,...d(x,u,R)}}))},setDpr:A=>a(b=>{const f=KW(A);return{viewport:{...b.viewport,dpr:f,initialDpr:b.viewport.initialDpr||f}}}),setFrameloop:(A="always")=>{const b=l().clock;b.stop(),b.elapsedTime=0,A!=="never"&&(b.start(),b.elapsedTime=0),a(()=>({frameloop:A}))},previousRoot:void 0,internal:{active:!1,priority:0,frames:0,lastEvent:U.createRef(),interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,subscribe:(A,b,f)=>{const B=l().internal;return B.priority=B.priority+(b>0?1:0),B.subscribers.push({ref:A,priority:b,store:f}),B.subscribers=B.subscribers.sort((S,x)=>S.priority-x.priority),()=>{const S=l().internal;S!=null&&S.subscribers&&(S.priority=S.priority-(b>0?1:0),S.subscribers=S.subscribers.filter(x=>x.ref!==A))}}}}}),i=t.getState();let s=i.size,r=i.viewport.dpr,o=i.camera;return t.subscribe(()=>{const{camera:a,size:l,viewport:c,gl:u,set:C}=t.getState();if(l!==s||c.dpr!==r){var d;s=l,r=c.dpr,LW(a,l),u.setPixelRatio(c.dpr);const h=(d=l.updateStyle)!=null?d:typeof HTMLCanvasElement<"u"&&u.domElement instanceof HTMLCanvasElement;u.setSize(l.width,l.height,h)}a!==o&&(o=a,C(h=>({viewport:{...h.viewport,...h.viewport.getCurrentViewport(a)}})))}),t.subscribe(a=>n(a)),t};let Qd,KL=new Set,zL=new Set,LL=new Set;function Cf(n,e){if(n.size)for(const{callback:t}of n.values())t(e)}function iI(n,e){switch(n){case"before":return Cf(KL,e);case"after":return Cf(zL,e);case"tail":return Cf(LL,e)}}let df,hf;function Af(n,e,t){let i=e.clock.getDelta();for(e.frameloop==="never"&&typeof n=="number"&&(i=n-e.clock.elapsedTime,e.clock.oldTime=e.clock.elapsedTime,e.clock.elapsedTime=n),df=e.internal.subscribers,Qd=0;Qd0)&&!((c=s.gl.xr)!=null&&c.isPresenting)&&(t+=Af(l,s))}if(iI("after",l),t===0)return iI("tail",l),e=!1,cancelAnimationFrame(i)}function o(l,c=1){var u;if(!l)return n.forEach(C=>o(C.store.getState()),c);(u=l.gl.xr)!=null&&u.isPresenting||!l.internal.active||l.frameloop==="never"||(l.internal.frames=Math.min(60,l.internal.frames+c),e||(e=!0,requestAnimationFrame(r)))}function a(l,c=!0,u,C){if(c&&iI("before",l),u)Af(l,u,C);else for(const d of n.values())Af(l,d.store.getState());c&&iI("after",l)}return{loop:r,invalidate:o,advance:a}}function EL(n){const e=U.useRef(null);return Cc(()=>void(e.current=n.current.__r3f),[n]),e}function ly(){const n=U.useContext(ay);if(!n)throw new Error("R3F: Hooks can only be used within the Canvas component!");return n}function $i(n=t=>t,e){return ly()(n,e)}function _u(n,e=0){const t=ly(),i=t.getState().internal.subscribe,s=XW(n);return Cc(()=>i(s,e,t),[e,i,t]),null}function kW(n,e){return function(t,...i){const s=new t;return n&&n(s),Promise.all(i.map(r=>new Promise((o,a)=>s.load(r,l=>{l.scene&&Object.assign(l,VL(l.scene)),o(l)},e,l=>a(new Error(`Could not load ${r}: ${l.message})`))))))}}function gy(n,e,t,i){const s=Array.isArray(e)?e:[e],r=BL(kW(t,i),[n,...s],{equal:an.equ});return Array.isArray(e)?r:r[0]}gy.preload=function(n,e,t){const i=Array.isArray(e)?e:[e];return ZL(kW(t),[n,...i])};gy.clear=function(n,e){const t=Array.isArray(e)?e:[e];return wL([n,...t])};const tc=new Map,{invalidate:TZ,advance:EZ}=TL(tc),{reconciler:yu,applyProps:Ta}=SL(tc,NL),cg={objects:"shallow",strict:!1},kL=(n,e)=>{const t=typeof n=="function"?n(e):n;return EW(t)?t:new Kv({powerPreference:"high-performance",canvas:e,antialias:!0,alpha:!0,...n})};function DL(n,e){if(e)return e;if(typeof HTMLCanvasElement<"u"&&n instanceof HTMLCanvasElement&&n.parentElement){const{width:t,height:i,top:s,left:r}=n.parentElement.getBoundingClientRect();return{width:t,height:i,top:s,left:r}}else if(typeof OffscreenCanvas<"u"&&n instanceof OffscreenCanvas)return{width:n.width,height:n.height,top:0,left:0};return{width:0,height:0,top:0,left:0}}function UL(n){const e=tc.get(n),t=e?.fiber,i=e?.store;e&&console.warn("R3F.createRoot should only be called once!");const s=typeof reportError=="function"?reportError:console.error,r=i||FL(TZ,EZ),o=t||yu.createContainer(r,Vg.ConcurrentRoot,null,!1,null,"",s,null);e||tc.set(n,{fiber:o,store:r});let a,l=!1,c;return{configure(u={}){let{gl:C,size:d,scene:h,events:m,onCreated:v,shadows:y=!1,linear:A=!1,flat:b=!1,legacy:f=!1,orthographic:B=!1,frameloop:S="always",dpr:x=[1,2],performance:R,raycaster:M,camera:Z,onPointerMissed:V}=u,N=r.getState(),D=N.gl;N.gl||N.set({gl:D=kL(C,n)});let k=N.raycaster;k||N.set({raycaster:k=new ry});const{params:$,...te}=M||{};if(an.equ(te,k,cg)||Ta(k,{...te}),an.equ($,k.params,cg)||Ta(k,{params:{...k.params,...$}}),!N.camera||N.camera===c&&!an.equ(c,Z,cg)){c=Z;const ce=Z instanceof ac,se=ce?Z:B?new lc(0,0,0,0,.1,1e3):new An(75,0,.1,1e3);ce||(se.position.z=5,Z&&Ta(se,Z),!N.camera&&!(Z!=null&&Z.rotation)&&se.lookAt(0,0,0)),N.set({camera:se})}if(!N.scene){let ce;h instanceof dl?ce=h:(ce=new dl,h&&Ta(ce,h)),N.set({scene:Cg(ce)})}if(!N.xr){const ce=(re,ve)=>{const ye=r.getState();ye.frameloop!=="never"&&EZ(re,!0,ye,ve)},se=()=>{const re=r.getState();re.gl.xr.enabled=re.gl.xr.isPresenting,re.gl.xr.setAnimationLoop(re.gl.xr.isPresenting?ce:null),re.gl.xr.isPresenting||TZ(re)},ee={connect(){const re=r.getState().gl;re.xr.addEventListener("sessionstart",se),re.xr.addEventListener("sessionend",se)},disconnect(){const re=r.getState().gl;re.xr.removeEventListener("sessionstart",se),re.xr.removeEventListener("sessionend",se)}};D.xr&&ee.connect(),N.set({xr:ee})}if(D.shadowMap){const ce=D.shadowMap.enabled,se=D.shadowMap.type;if(D.shadowMap.enabled=!!y,an.boo(y))D.shadowMap.type=VI;else if(an.str(y)){var Ce;const ee={basic:HR,percentage:SA,soft:VI,variance:ir};D.shadowMap.type=(Ce=ee[y])!=null?Ce:VI}else an.obj(y)&&Object.assign(D.shadowMap,y);(ce!==D.shadowMap.enabled||se!==D.shadowMap.type)&&(D.shadowMap.needsUpdate=!0)}const le=NW();le&&("enabled"in le?le.enabled=!f:"legacyMode"in le&&(le.legacyMode=f)),Ta(D,{outputEncoding:A?3e3:3001,toneMapping:b?gr:Bv}),N.legacy!==f&&N.set(()=>({legacy:f})),N.linear!==A&&N.set(()=>({linear:A})),N.flat!==b&&N.set(()=>({flat:b})),C&&!an.fun(C)&&!EW(C)&&!an.equ(C,D,cg)&&Ta(D,C),m&&!N.events.handlers&&N.set({events:m(r)});const P=DL(n,d);return an.equ(P,N.size,cg)||N.setSize(P.width,P.height,P.updateStyle,P.top,P.left),x&&N.viewport.dpr!==KW(x)&&N.setDpr(x),N.frameloop!==S&&N.setFrameloop(S),N.onPointerMissed||N.set({onPointerMissed:V}),R&&!an.equ(R,N.performance,cg)&&N.set(ce=>({performance:{...ce.performance,...R}})),a=v,l=!0,this},render(u){return l||this.configure(),yu.updateContainer(U.createElement(PL,{store:r,children:u,onCreated:a,rootElement:n}),o,null,()=>{}),r},unmount(){DW(n)}}}function PL({store:n,children:e,onCreated:t,rootElement:i}){return Cc(()=>{const s=n.getState();s.set(r=>({internal:{...r.internal,active:!0}})),t&&t(s),n.getState().events.connected||s.events.connect==null||s.events.connect(i)},[]),U.createElement(ay.Provider,{value:n},e)}function DW(n,e){const t=tc.get(n),i=t?.fiber;if(i){const s=t?.store.getState();s&&(s.internal.active=!1),yu.updateContainer(null,i,null,()=>{s&&setTimeout(()=>{try{var r,o,a,l;s.events.disconnect==null||s.events.disconnect(),(r=s.gl)==null||(o=r.renderLists)==null||o.dispose==null||o.dispose(),(a=s.gl)==null||a.forceContextLoss==null||a.forceContextLoss(),(l=s.gl)!=null&&l.xr&&s.xr.disconnect(),ML(s),tc.delete(n),e&&e(n)}catch{}},500)})}}function _L(n,e,t){return U.createElement(JL,{key:e.uuid,children:n,container:e,state:t})}function JL({state:n={},children:e,container:t}){const{events:i,size:s,...r}=n,o=ly(),[a]=U.useState(()=>new ry),[l]=U.useState(()=>new ne),c=U.useCallback((C,d)=>{const h={...C};Object.keys(C).forEach(v=>{(YL.includes(v)||C[v]!==d[v]&&d[v])&&delete h[v]});let m;if(d&&s){const v=d.camera;m=C.viewport.getCurrentViewport(v,new H,s),v!==C.camera&&LW(v,s)}return{...h,scene:t,raycaster:a,pointer:l,mouse:l,previousRoot:o,events:{...C.events,...d?.events,...i},size:{...C.size,...s},viewport:{...C.viewport,...m},...r}},[n]),[u]=U.useState(()=>{const C=o.getState();return wW((h,m)=>({...C,scene:t,raycaster:a,pointer:l,mouse:l,previousRoot:o,events:{...C.events,...i},size:{...C.size,...s},...r,set:h,get:m,setEvents:v=>h(y=>({...y,events:{...y.events,...v}}))}))});return U.useEffect(()=>{const C=o.subscribe(d=>u.setState(h=>c(d,h)));return()=>{C(),u.destroy()}},[]),U.useEffect(()=>{u.setState(C=>c(o.getState(),C))},[c]),U.createElement(U.Fragment,null,yu.createPortal(U.createElement(ay.Provider,{value:u},e),u,null))}yu.injectIntoDevTools({bundleType:0,rendererPackageName:"@react-three/fiber",version:U.version});function lA(){return lA=Object.assign?Object.assign.bind():function(n){for(var e=1;e=0?i=setTimeout(l,e-u):(i=null,t||(a=n.apply(r,s),r=s=null))}var c=function(){r=this,s=arguments,o=Date.now();var u=t&&!i;return i||(i=setTimeout(l,e)),u&&(a=n.apply(r,s),r=s=null),a};return c.clear=function(){i&&(clearTimeout(i),i=null)},c.flush=function(){i&&(a=n.apply(r,s),r=s=null,clearTimeout(i),i=null)},c}Ib.debounce=Ib;var OL=Ib;const kZ=Gb(OL);function QL(n){let{debounce:e,scroll:t,polyfill:i,offsetSize:s}=n===void 0?{debounce:0,scroll:!1,offsetSize:!1}:n;const r=i||(typeof window>"u"?class{}:window.ResizeObserver);if(!r)throw new Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");const[o,a]=U.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),l=U.useRef({element:null,scrollContainers:null,resizeObserver:null,lastBounds:o}),c=e?typeof e=="number"?e:e.scroll:null,u=e?typeof e=="number"?e:e.resize:null,C=U.useRef(!1);U.useEffect(()=>(C.current=!0,()=>void(C.current=!1)));const[d,h,m]=U.useMemo(()=>{const b=()=>{if(!l.current.element)return;const{left:f,top:B,width:S,height:x,bottom:R,right:M,x:Z,y:V}=l.current.element.getBoundingClientRect(),N={left:f,top:B,width:S,height:x,bottom:R,right:M,x:Z,y:V};l.current.element instanceof HTMLElement&&s&&(N.height=l.current.element.offsetHeight,N.width=l.current.element.offsetWidth),Object.freeze(N),C.current&&!eT(l.current.lastBounds,N)&&a(l.current.lastBounds=N)};return[b,u?kZ(b,u):b,c?kZ(b,c):b]},[a,s,c,u]);function v(){l.current.scrollContainers&&(l.current.scrollContainers.forEach(b=>b.removeEventListener("scroll",m,!0)),l.current.scrollContainers=null),l.current.resizeObserver&&(l.current.resizeObserver.disconnect(),l.current.resizeObserver=null)}function y(){l.current.element&&(l.current.resizeObserver=new r(m),l.current.resizeObserver.observe(l.current.element),t&&l.current.scrollContainers&&l.current.scrollContainers.forEach(b=>b.addEventListener("scroll",m,{capture:!0,passive:!0})))}const A=b=>{!b||b===l.current.element||(v(),l.current.element=b,l.current.scrollContainers=UW(b),y())};return qL(m,!!t),jL(h),U.useEffect(()=>{v(),y()},[t,m,h]),U.useEffect(()=>v,[]),[A,o,d]}function jL(n){U.useEffect(()=>{const e=n;return window.addEventListener("resize",e),()=>void window.removeEventListener("resize",e)},[n])}function qL(n,e){U.useEffect(()=>{if(e){const t=n;return window.addEventListener("scroll",t,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",t,!0)}},[n,e])}function UW(n){const e=[];if(!n||n===document.body)return e;const{overflow:t,overflowX:i,overflowY:s}=window.getComputedStyle(n);return[t,i,s].some(r=>r==="auto"||r==="scroll")&&e.push(n),[...e,...UW(n.parentElement)]}const $L=["x","y","top","bottom","left","right","width","height"],eT=(n,e)=>$L.every(t=>n[t]===e[t]);var tT=Object.defineProperty,nT=Object.defineProperties,iT=Object.getOwnPropertyDescriptors,DZ=Object.getOwnPropertySymbols,sT=Object.prototype.hasOwnProperty,rT=Object.prototype.propertyIsEnumerable,UZ=(n,e,t)=>e in n?tT(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,PZ=(n,e)=>{for(var t in e||(e={}))sT.call(e,t)&&UZ(n,t,e[t]);if(DZ)for(var t of DZ(e))rT.call(e,t)&&UZ(n,t,e[t]);return n},oT=(n,e)=>nT(n,iT(e));function PW(n,e,t){if(!n)return;if(t(n)===!0)return n;let i=e?n.return:n.child;for(;i;){const s=PW(i,e,t);if(s)return s;i=e?null:i.sibling}}function _W(n){try{return Object.defineProperties(n,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return n}}const cy=_W(U.createContext(null));class JW extends U.Component{render(){return U.createElement(cy.Provider,{value:this._reactInternals},this.props.children)}}const{ReactCurrentOwner:_Z,ReactCurrentDispatcher:JZ}=U.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function aT(){const n=U.useContext(cy);if(n===null)throw new Error("its-fine: useFiber must be called within a !");const e=U.useId();return U.useMemo(()=>{for(const i of[_Z?.current,n,n?.alternate]){if(!i)continue;const s=PW(i,!1,r=>{let o=r.memoizedState;for(;o;){if(o.memoizedState===e)return!0;o=o.next}});if(s)return s}},[n,e])}function lT(){var n,e;const t=aT(),[i]=U.useState(()=>new Map);i.clear();let s=t;for(;s;){const r=(n=s.type)==null?void 0:n._context;r&&r!==cy&&!i.has(r)&&i.set(r,(e=JZ?.current)==null?void 0:e.readContext(_W(r))),s=s.return}return i}function gT(){const n=lT();return U.useMemo(()=>Array.from(n.keys()).reduce((e,t)=>i=>U.createElement(e,null,U.createElement(t.Provider,oT(PZ({},i),{value:n.get(t)}))),e=>U.createElement(JW,PZ({},e))),[n])}const pf={onClick:["click",!1],onContextMenu:["contextmenu",!1],onDoubleClick:["dblclick",!1],onWheel:["wheel",!0],onPointerDown:["pointerdown",!0],onPointerUp:["pointerup",!0],onPointerLeave:["pointerleave",!0],onPointerMove:["pointermove",!0],onPointerCancel:["pointercancel",!0],onLostPointerCapture:["lostpointercapture",!0]};function cT(n){const{handlePointer:e}=XL(n);return{priority:1,enabled:!0,compute(t,i,s){i.pointer.set(t.offsetX/i.size.width*2-1,-(t.offsetY/i.size.height)*2+1),i.raycaster.setFromCamera(i.pointer,i.camera)},connected:void 0,handlers:Object.keys(pf).reduce((t,i)=>({...t,[i]:e(i)}),{}),update:()=>{var t;const{events:i,internal:s}=n.getState();(t=s.lastEvent)!=null&&t.current&&i.handlers&&i.handlers.onPointerMove(s.lastEvent.current)},connect:t=>{var i;const{set:s,events:r}=n.getState();r.disconnect==null||r.disconnect(),s(o=>({events:{...o.events,connected:t}})),Object.entries((i=r.handlers)!=null?i:[]).forEach(([o,a])=>{const[l,c]=pf[o];t.addEventListener(l,a,{passive:c})})},disconnect:()=>{const{set:t,events:i}=n.getState();if(i.connected){var s;Object.entries((s=i.handlers)!=null?s:[]).forEach(([r,o])=>{if(i&&i.connected instanceof HTMLElement){const[a]=pf[r];i.connected.removeEventListener(a,o)}}),t(r=>({events:{...r.events,connected:void 0}}))}}}}const IT=U.forwardRef(function({children:e,fallback:t,resize:i,style:s,gl:r,events:o=cT,eventSource:a,eventPrefix:l,shadows:c,linear:u,flat:C,legacy:d,orthographic:h,frameloop:m,dpr:v,performance:y,raycaster:A,camera:b,onPointerMissed:f,onCreated:B,...S},x){U.useMemo(()=>MW(mL),[]);const R=gT(),[M,Z]=QL({scroll:!0,debounce:{scroll:50,resize:0},...i}),V=U.useRef(null),N=U.useRef(null);U.useImperativeHandle(x,()=>V.current);const D=XW(f),[k,$]=U.useState(!1),[te,Ce]=U.useState(!1);if(k)throw k;if(te)throw te;const le=U.useRef(null);Cc(()=>{const J=V.current;Z.width>0&&Z.height>0&&J&&(le.current||(le.current=UL(J)),le.current.configure({gl:r,events:o,shadows:c,linear:u,flat:C,legacy:d,orthographic:h,frameloop:m,dpr:v,performance:y,raycaster:A,camera:b,size:Z,onPointerMissed:(...P)=>D.current==null?void 0:D.current(...P),onCreated:P=>{P.events.connect==null||P.events.connect(a?xL(a)?a.current:a:N.current),l&&P.setEvents({compute:(ce,se)=>{const ee=ce[l+"X"],re=ce[l+"Y"];se.pointer.set(ee/se.size.width*2-1,-(re/se.size.height)*2+1),se.raycaster.setFromCamera(se.pointer,se.camera)}}),B?.(P)}}),le.current.render(U.createElement(R,null,U.createElement(YW,{set:Ce},U.createElement(U.Suspense,{fallback:U.createElement(RL,{set:$})},e)))))}),U.useEffect(()=>{const J=V.current;if(J)return()=>DW(J)},[]);const L=a?"none":"auto";return U.createElement("div",lA({ref:N,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:L,...s}},S),U.createElement("div",{ref:M,style:{width:"100%",height:"100%"}},U.createElement("canvas",{ref:V,style:{display:"block"}},t)))}),uT=U.forwardRef(function(e,t){return U.createElement(JW,null,U.createElement(IT,lA({},e,{ref:t})))});var Iy={exports:{}},Eg=typeof Reflect=="object"?Reflect:null,OZ=Eg&&typeof Eg.apply=="function"?Eg.apply:function(e,t,i){return Function.prototype.apply.call(e,t,i)},Wh;Eg&&typeof Eg.ownKeys=="function"?Wh=Eg.ownKeys:Object.getOwnPropertySymbols?Wh=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Wh=function(e){return Object.getOwnPropertyNames(e)};function CT(n){console&&console.warn&&console.warn(n)}var OW=Number.isNaN||function(e){return e!==e};function $t(){$t.init.call(this)}Iy.exports=$t;Iy.exports.once=pT;$t.EventEmitter=$t;$t.prototype._events=void 0;$t.prototype._eventsCount=0;$t.prototype._maxListeners=void 0;var QZ=10;function OA(n){if(typeof n!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof n)}Object.defineProperty($t,"defaultMaxListeners",{enumerable:!0,get:function(){return QZ},set:function(n){if(typeof n!="number"||n<0||OW(n))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+n+".");QZ=n}});$t.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};$t.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||OW(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function QW(n){return n._maxListeners===void 0?$t.defaultMaxListeners:n._maxListeners}$t.prototype.getMaxListeners=function(){return QW(this)};$t.prototype.emit=function(e){for(var t=[],i=1;i0&&(o=t[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var l=r[e];if(l===void 0)return!1;if(typeof l=="function")OZ(l,this,t);else for(var c=l.length,u=tV(l,c),i=0;i0&&o.length>s&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=n,a.type=e,a.count=o.length,CT(a)}return n}$t.prototype.addListener=function(e,t){return jW(this,e,t,!1)};$t.prototype.on=$t.prototype.addListener;$t.prototype.prependListener=function(e,t){return jW(this,e,t,!0)};function dT(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function qW(n,e,t){var i={fired:!1,wrapFn:void 0,target:n,type:e,listener:t},s=dT.bind(i);return s.listener=t,i.wrapFn=s,s}$t.prototype.once=function(e,t){return OA(t),this.on(e,qW(this,e,t)),this};$t.prototype.prependOnceListener=function(e,t){return OA(t),this.prependListener(e,qW(this,e,t)),this};$t.prototype.removeListener=function(e,t){var i,s,r,o,a;if(OA(t),s=this._events,s===void 0)return this;if(i=s[e],i===void 0)return this;if(i===t||i.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete s[e],s.removeListener&&this.emit("removeListener",e,i.listener||t));else if(typeof i!="function"){for(r=-1,o=i.length-1;o>=0;o--)if(i[o]===t||i[o].listener===t){a=i[o].listener,r=o;break}if(r<0)return this;r===0?i.shift():hT(i,r),i.length===1&&(s[e]=i[0]),s.removeListener!==void 0&&this.emit("removeListener",e,a||t)}return this};$t.prototype.off=$t.prototype.removeListener;$t.prototype.removeAllListeners=function(e){var t,i,s;if(i=this._events,i===void 0)return this;if(i.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):i[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete i[e]),this;if(arguments.length===0){var r=Object.keys(i),o;for(s=0;s=0;s--)this.removeListener(e,t[s]);return this};function $W(n,e,t){var i=n._events;if(i===void 0)return[];var s=i[e];return s===void 0?[]:typeof s=="function"?t?[s.listener||s]:[s]:t?AT(s):tV(s,s.length)}$t.prototype.listeners=function(e){return $W(this,e,!0)};$t.prototype.rawListeners=function(e){return $W(this,e,!1)};$t.listenerCount=function(n,e){return typeof n.listenerCount=="function"?n.listenerCount(e):eV.call(n,e)};$t.prototype.listenerCount=eV;function eV(n){var e=this._events;if(e!==void 0){var t=e[n];if(typeof t=="function")return 1;if(t!==void 0)return t.length}return 0}$t.prototype.eventNames=function(){return this._eventsCount>0?Wh(this._events):[]};function tV(n,e){for(var t=new Array(e),i=0;i{if(e.data.op==="frame"){this.buffers.positions=e.data.positions,this.buffers.quaternions=e.data.quaternions,this.emit(e.data.op,e.data);return}this.emit(e.data.type,e.data)};for(const e of this.messageQueue)this.worker.postMessage(e);this.messageQueue.length=0}disableConstraint(e){let{uuid:t}=e;this.postMessage({op:"disableConstraint",uuid:t})}disableConstraintMotor(e){let{uuid:t}=e;this.postMessage({op:"disableConstraintMotor",uuid:t})}disconnect(){this.worker&&(this.worker.onmessage=null)}enableConstraint(e){let{uuid:t}=e;this.postMessage({op:"enableConstraint",uuid:t})}enableConstraintMotor(e){let{uuid:t}=e;this.postMessage({op:"enableConstraintMotor",uuid:t})}init(){const{allowSleep:e,axisIndex:t,broadphase:i,defaultContactMaterial:s,frictionGravity:r,gravity:o,iterations:a,quatNormalizeFast:l,quatNormalizeSkip:c,solver:u,tolerance:C}=this.config;this.postMessage({op:"init",props:{allowSleep:e,axisIndex:t,broadphase:i,defaultContactMaterial:s,frictionGravity:r,gravity:o,iterations:a,quatNormalizeFast:l,quatNormalizeSkip:c,solver:u,tolerance:C}})}removeBodies(e){let{uuid:t}=e;this.postMessage({op:"removeBodies",uuid:t})}removeConstraint(e){let{uuid:t}=e;this.postMessage({op:"removeConstraint",uuid:t})}removeContactMaterial(e){let{uuid:t}=e;this.postMessage({op:"removeContactMaterial",uuid:t})}removeRay(e){let{uuid:t}=e;this.postMessage({op:"removeRay",uuid:t})}removeRaycastVehicle(e){let{uuid:t}=e;this.postMessage({op:"removeRaycastVehicle",uuid:t})}removeSpring(e){let{uuid:t}=e;this.postMessage({op:"removeSpring",uuid:t})}setAllowSleep(e){let{props:t,uuid:i}=e;this.postMessage({op:"setAllowSleep",props:t,uuid:i})}setAngularDamping(e){let{props:t,uuid:i}=e;this.postMessage({op:"setAngularDamping",props:t,uuid:i})}setAngularFactor(e){let{props:t,uuid:i}=e;this.postMessage({op:"setAngularFactor",props:t,uuid:i})}setAngularVelocity(e){let{props:t,uuid:i}=e;this.postMessage({op:"setAngularVelocity",props:t,uuid:i})}setCollisionFilterGroup(e){let{props:t,uuid:i}=e;this.postMessage({op:"setCollisionFilterGroup",props:t,uuid:i})}setCollisionFilterMask(e){let{props:t,uuid:i}=e;this.postMessage({op:"setCollisionFilterMask",props:t,uuid:i})}setCollisionResponse(e){let{props:t,uuid:i}=e;this.postMessage({op:"setCollisionResponse",props:t,uuid:i})}setConstraintMotorMaxForce(e){let{props:t,uuid:i}=e;this.postMessage({op:"setConstraintMotorMaxForce",props:t,uuid:i})}setConstraintMotorSpeed(e){let{props:t,uuid:i}=e;this.postMessage({op:"setConstraintMotorSpeed",props:t,uuid:i})}setFixedRotation(e){let{props:t,uuid:i}=e;this.postMessage({op:"setFixedRotation",props:t,uuid:i})}setIsTrigger(e){let{props:t,uuid:i}=e;this.postMessage({op:"setIsTrigger",props:t,uuid:i})}setLinearDamping(e){let{props:t,uuid:i}=e;this.postMessage({op:"setLinearDamping",props:t,uuid:i})}setLinearFactor(e){let{props:t,uuid:i}=e;this.postMessage({op:"setLinearFactor",props:t,uuid:i})}setMass(e){let{props:t,uuid:i}=e;this.postMessage({op:"setMass",props:t,uuid:i})}setMaterial(e){let{props:t,uuid:i}=e;this.postMessage({op:"setMaterial",props:t,uuid:i})}setPosition(e){let{props:t,uuid:i}=e;this.postMessage({op:"setPosition",props:t,uuid:i})}setQuaternion(e){let{props:[t,i,s,r],uuid:o}=e;this.postMessage({op:"setQuaternion",props:[t,i,s,r],uuid:o})}setRaycastVehicleBrake(e){let{props:t,uuid:i}=e;this.postMessage({op:"setRaycastVehicleBrake",props:t,uuid:i})}setRaycastVehicleSteeringValue(e){let{props:t,uuid:i}=e;this.postMessage({op:"setRaycastVehicleSteeringValue",props:t,uuid:i})}setRotation(e){let{props:t,uuid:i}=e;this.postMessage({op:"setRotation",props:t,uuid:i})}setSleepSpeedLimit(e){let{props:t,uuid:i}=e;this.postMessage({op:"setSleepSpeedLimit",props:t,uuid:i})}setSleepTimeLimit(e){let{props:t,uuid:i}=e;this.postMessage({op:"setSleepTimeLimit",props:t,uuid:i})}setSpringDamping(e){let{props:t,uuid:i}=e;this.postMessage({op:"setSpringDamping",props:t,uuid:i})}setSpringRestLength(e){let{props:t,uuid:i}=e;this.postMessage({op:"setSpringRestLength",props:t,uuid:i})}setSpringStiffness(e){let{props:t,uuid:i}=e;this.postMessage({op:"setSpringStiffness",props:t,uuid:i})}setUserData(e){let{props:t,uuid:i}=e;this.postMessage({op:"setUserData",props:t,uuid:i})}setVelocity(e){let{props:t,uuid:i}=e;this.postMessage({op:"setVelocity",props:t,uuid:i})}sleep(e){let{uuid:t}=e;this.postMessage({op:"sleep",uuid:t})}step(e){var t;const{buffers:{positions:i,quaternions:s}}=this;!i.byteLength&&!s.byteLength||(t=this.worker)==null||t.postMessage({op:"step",positions:i,props:e,quaternions:s},[i.buffer,s.buffer])}subscribe(e){let{props:{id:t,target:i,type:s},uuid:r}=e;this.postMessage({op:"subscribe",props:{id:t,target:i,type:s},uuid:r})}terminate(){var e;(e=this.worker)==null||e.terminate(),this.worker=null}unsubscribe(e){let{props:t}=e;this.postMessage({op:"unsubscribe",props:t})}wakeUp(e){let{uuid:t}=e;this.postMessage({op:"wakeUp",uuid:t})}postMessage(e){if(this.worker)return this.worker.postMessage(e);this.messageQueue.push(e)}}class ao{constructor(e){e===void 0&&(e=[0,0,0,0,0,0,0,0,0]),this.elements=e}identity(){const e=this.elements;e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1}setZero(){const e=this.elements;e[0]=0,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=0,e[6]=0,e[7]=0,e[8]=0}setTrace(e){const t=this.elements;t[0]=e.x,t[4]=e.y,t[8]=e.z}getTrace(e){e===void 0&&(e=new F);const t=this.elements;return e.x=t[0],e.y=t[4],e.z=t[8],e}vmult(e,t){t===void 0&&(t=new F);const i=this.elements,s=e.x,r=e.y,o=e.z;return t.x=i[0]*s+i[1]*r+i[2]*o,t.y=i[3]*s+i[4]*r+i[5]*o,t.z=i[6]*s+i[7]*r+i[8]*o,t}smult(e){for(let t=0;t0){const r=1/s;this.x*=r,this.y*=r,this.z*=r}else this.x=0,this.y=0,this.z=0;return s}unit(e){e===void 0&&(e=new F);const t=this.x,i=this.y,s=this.z;let r=Math.sqrt(t*t+i*i+s*s);return r>0?(r=1/r,e.x=t*r,e.y=i*r,e.z=s*r):(e.x=1,e.y=0,e.z=0),e}length(){const e=this.x,t=this.y,i=this.z;return Math.sqrt(e*e+t*t+i*i)}lengthSquared(){return this.dot(this)}distanceTo(e){const t=this.x,i=this.y,s=this.z,r=e.x,o=e.y,a=e.z;return Math.sqrt((r-t)*(r-t)+(o-i)*(o-i)+(a-s)*(a-s))}distanceSquared(e){const t=this.x,i=this.y,s=this.z,r=e.x,o=e.y,a=e.z;return(r-t)*(r-t)+(o-i)*(o-i)+(a-s)*(a-s)}scale(e,t){t===void 0&&(t=new F);const i=this.x,s=this.y,r=this.z;return t.x=e*i,t.y=e*s,t.z=e*r,t}vmul(e,t){return t===void 0&&(t=new F),t.x=e.x*this.x,t.y=e.y*this.y,t.z=e.z*this.z,t}addScaledVector(e,t,i){return i===void 0&&(i=new F),i.x=this.x+e*t.x,i.y=this.y+e*t.y,i.z=this.z+e*t.z,i}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}isZero(){return this.x===0&&this.y===0&&this.z===0}negate(e){return e===void 0&&(e=new F),e.x=-this.x,e.y=-this.y,e.z=-this.z,e}tangents(e,t){const i=this.length();if(i>0){const s=wT,r=1/i;s.set(this.x*r,this.y*r,this.z*r);const o=ST;Math.abs(s.x)<.9?(o.set(1,0,0),s.cross(o,e)):(o.set(0,1,0),s.cross(o,e)),s.cross(e,t)}else e.set(1,0,0),t.set(0,1,0)}toString(){return`${this.x},${this.y},${this.z}`}toArray(){return[this.x,this.y,this.z]}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}lerp(e,t,i){const s=this.x,r=this.y,o=this.z;i.x=s+(e.x-s)*t,i.y=r+(e.y-r)*t,i.z=o+(e.z-o)*t}almostEquals(e,t){return t===void 0&&(t=1e-6),!(Math.abs(this.x-e.x)>t||Math.abs(this.y-e.y)>t||Math.abs(this.z-e.z)>t)}almostZero(e){return e===void 0&&(e=1e-6),!(Math.abs(this.x)>e||Math.abs(this.y)>e||Math.abs(this.z)>e)}isAntiparallelTo(e,t){return this.negate(jZ),jZ.almostEquals(e,t)}clone(){return new F(this.x,this.y,this.z)}}F.ZERO=new F(0,0,0);F.UNIT_X=new F(1,0,0);F.UNIT_Y=new F(0,1,0);F.UNIT_Z=new F(0,0,1);const wT=new F,ST=new F,jZ=new F;class Ls{constructor(e){e===void 0&&(e={}),this.lowerBound=new F,this.upperBound=new F,e.lowerBound&&this.lowerBound.copy(e.lowerBound),e.upperBound&&this.upperBound.copy(e.upperBound)}setFromPoints(e,t,i,s){const r=this.lowerBound,o=this.upperBound,a=i;r.copy(e[0]),a&&a.vmult(r,r),o.copy(r);for(let l=1;lo.x&&(o.x=c.x),c.xo.y&&(o.y=c.y),c.yo.z&&(o.z=c.z),c.z=r.x&&t.y<=s.y&&i.y>=r.y&&t.z<=s.z&&i.z>=r.z}getCorners(e,t,i,s,r,o,a,l){const c=this.lowerBound,u=this.upperBound;e.copy(c),t.set(u.x,c.y,c.z),i.set(u.x,u.y,c.z),s.set(c.x,u.y,u.z),r.set(u.x,c.y,u.z),o.set(c.x,u.y,c.z),a.set(c.x,c.y,u.z),l.copy(u)}toLocalFrame(e,t){const i=$Z,s=i[0],r=i[1],o=i[2],a=i[3],l=i[4],c=i[5],u=i[6],C=i[7];this.getCorners(s,r,o,a,l,c,u,C);for(let d=0;d!==8;d++){const h=i[d];e.pointToLocal(h,h)}return t.setFromPoints(i)}toWorldFrame(e,t){const i=$Z,s=i[0],r=i[1],o=i[2],a=i[3],l=i[4],c=i[5],u=i[6],C=i[7];this.getCorners(s,r,o,a,l,c,u,C);for(let d=0;d!==8;d++){const h=i[d];e.pointToWorld(h,h)}return t.setFromPoints(i)}overlapsRay(e){const{direction:t,from:i}=e,s=1/t.x,r=1/t.y,o=1/t.z,a=(this.lowerBound.x-i.x)*s,l=(this.upperBound.x-i.x)*s,c=(this.lowerBound.y-i.y)*r,u=(this.upperBound.y-i.y)*r,C=(this.lowerBound.z-i.z)*o,d=(this.upperBound.z-i.z)*o,h=Math.max(Math.max(Math.min(a,l),Math.min(c,u)),Math.min(C,d)),m=Math.min(Math.min(Math.max(a,l),Math.max(c,u)),Math.max(C,d));return!(m<0||h>m)}}const qZ=new F,$Z=[new F,new F,new F,new F,new F,new F,new F,new F];class xi{constructor(e,t,i,s){e===void 0&&(e=0),t===void 0&&(t=0),i===void 0&&(i=0),s===void 0&&(s=1),this.x=e,this.y=t,this.z=i,this.w=s}set(e,t,i,s){return this.x=e,this.y=t,this.z=i,this.w=s,this}toString(){return`${this.x},${this.y},${this.z},${this.w}`}toArray(){return[this.x,this.y,this.z,this.w]}setFromAxisAngle(e,t){const i=Math.sin(t*.5);return this.x=e.x*i,this.y=e.y*i,this.z=e.z*i,this.w=Math.cos(t*.5),this}toAxisAngle(e){e===void 0&&(e=new F),this.normalize();const t=2*Math.acos(this.w),i=Math.sqrt(1-this.w*this.w);return i<.001?(e.x=this.x,e.y=this.y,e.z=this.z):(e.x=this.x/i,e.y=this.y/i,e.z=this.z/i),[e,t]}setFromVectors(e,t){if(e.isAntiparallelTo(t)){const i=xT,s=RT;e.tangents(i,s),this.setFromAxisAngle(i,Math.PI)}else{const i=e.cross(t);this.x=i.x,this.y=i.y,this.z=i.z,this.w=Math.sqrt(e.length()**2*t.length()**2)+e.dot(t),this.normalize()}return this}mult(e,t){t===void 0&&(t=new xi);const i=this.x,s=this.y,r=this.z,o=this.w,a=e.x,l=e.y,c=e.z,u=e.w;return t.x=i*u+o*a+s*c-r*l,t.y=s*u+o*l+r*a-i*c,t.z=r*u+o*c+i*l-s*a,t.w=o*u-i*a-s*l-r*c,t}inverse(e){e===void 0&&(e=new xi);const t=this.x,i=this.y,s=this.z,r=this.w;this.conjugate(e);const o=1/(t*t+i*i+s*s+r*r);return e.x*=o,e.y*=o,e.z*=o,e.w*=o,e}conjugate(e){return e===void 0&&(e=new xi),e.x=-this.x,e.y=-this.y,e.z=-this.z,e.w=this.w,e}normalize(){let e=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);return e===0?(this.x=0,this.y=0,this.z=0,this.w=0):(e=1/e,this.x*=e,this.y*=e,this.z*=e,this.w*=e),this}normalizeFast(){const e=(3-(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w))/2;return e===0?(this.x=0,this.y=0,this.z=0,this.w=0):(this.x*=e,this.y*=e,this.z*=e,this.w*=e),this}vmult(e,t){t===void 0&&(t=new F);const i=e.x,s=e.y,r=e.z,o=this.x,a=this.y,l=this.z,c=this.w,u=c*i+a*r-l*s,C=c*s+l*i-o*r,d=c*r+o*s-a*i,h=-o*i-a*s-l*r;return t.x=u*c+h*-o+C*-l-d*-a,t.y=C*c+h*-a+d*-o-u*-l,t.z=d*c+h*-l+u*-a-C*-o,t}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w,this}toEuler(e,t){t===void 0&&(t="YZX");let i,s,r;const o=this.x,a=this.y,l=this.z,c=this.w;switch(t){case"YZX":const u=o*a+l*c;if(u>.499&&(i=2*Math.atan2(o,c),s=Math.PI/2,r=0),u<-.499&&(i=-2*Math.atan2(o,c),s=-Math.PI/2,r=0),i===void 0){const C=o*o,d=a*a,h=l*l;i=Math.atan2(2*a*c-2*o*l,1-2*d-2*h),s=Math.asin(2*u),r=Math.atan2(2*o*c-2*a*l,1-2*C-2*h)}break;default:throw new Error(`Euler order ${t} not supported yet.`)}e.y=i,e.z=s,e.x=r}setFromEuler(e,t,i,s){s===void 0&&(s="XYZ");const r=Math.cos(e/2),o=Math.cos(t/2),a=Math.cos(i/2),l=Math.sin(e/2),c=Math.sin(t/2),u=Math.sin(i/2);return s==="XYZ"?(this.x=l*o*a+r*c*u,this.y=r*c*a-l*o*u,this.z=r*o*u+l*c*a,this.w=r*o*a-l*c*u):s==="YXZ"?(this.x=l*o*a+r*c*u,this.y=r*c*a-l*o*u,this.z=r*o*u-l*c*a,this.w=r*o*a+l*c*u):s==="ZXY"?(this.x=l*o*a-r*c*u,this.y=r*c*a+l*o*u,this.z=r*o*u+l*c*a,this.w=r*o*a-l*c*u):s==="ZYX"?(this.x=l*o*a-r*c*u,this.y=r*c*a+l*o*u,this.z=r*o*u-l*c*a,this.w=r*o*a+l*c*u):s==="YZX"?(this.x=l*o*a+r*c*u,this.y=r*c*a+l*o*u,this.z=r*o*u-l*c*a,this.w=r*o*a-l*c*u):s==="XZY"&&(this.x=l*o*a-r*c*u,this.y=r*c*a-l*o*u,this.z=r*o*u+l*c*a,this.w=r*o*a+l*c*u),this}clone(){return new xi(this.x,this.y,this.z,this.w)}slerp(e,t,i){i===void 0&&(i=new xi);const s=this.x,r=this.y,o=this.z,a=this.w;let l=e.x,c=e.y,u=e.z,C=e.w,d,h,m,v,y;return h=s*l+r*c+o*u+a*C,h<0&&(h=-h,l=-l,c=-c,u=-u,C=-C),1-h>1e-6?(d=Math.acos(h),m=Math.sin(d),v=Math.sin((1-t)*d)/m,y=Math.sin(t*d)/m):(v=1-t,y=t),i.x=v*s+y*l,i.y=v*r+y*c,i.z=v*o+y*u,i.w=v*a+y*C,i}integrate(e,t,i,s){s===void 0&&(s=new xi);const r=e.x*i.x,o=e.y*i.y,a=e.z*i.z,l=this.x,c=this.y,u=this.z,C=this.w,d=t*.5;return s.x+=d*(r*C+o*u-a*c),s.y+=d*(o*C+a*l-r*u),s.z+=d*(a*C+r*c-o*l),s.w+=d*(-r*l-o*c-a*u),s}}const xT=new F,RT=new F,WT={SPHERE:1,PLANE:2,BOX:4,COMPOUND:8,CONVEXPOLYHEDRON:16,HEIGHTFIELD:32,PARTICLE:64,CYLINDER:128,TRIMESH:256};class _e{constructor(e){e===void 0&&(e={}),this.id=_e.idCounter++,this.type=e.type||0,this.boundingSphereRadius=0,this.collisionResponse=e.collisionResponse?e.collisionResponse:!0,this.collisionFilterGroup=e.collisionFilterGroup!==void 0?e.collisionFilterGroup:1,this.collisionFilterMask=e.collisionFilterMask!==void 0?e.collisionFilterMask:-1,this.material=e.material?e.material:null,this.body=null}updateBoundingSphereRadius(){throw`computeBoundingSphereRadius() not implemented for shape type ${this.type}`}volume(){throw`volume() not implemented for shape type ${this.type}`}calculateLocalInertia(e,t){throw`calculateLocalInertia() not implemented for shape type ${this.type}`}calculateWorldAABB(e,t,i,s){throw`calculateWorldAABB() not implemented for shape type ${this.type}`}}_e.idCounter=0;_e.types=WT;class Ei{constructor(e){e===void 0&&(e={}),this.position=new F,this.quaternion=new xi,e.position&&this.position.copy(e.position),e.quaternion&&this.quaternion.copy(e.quaternion)}pointToLocal(e,t){return Ei.pointToLocalFrame(this.position,this.quaternion,e,t)}pointToWorld(e,t){return Ei.pointToWorldFrame(this.position,this.quaternion,e,t)}vectorToWorldFrame(e,t){return t===void 0&&(t=new F),this.quaternion.vmult(e,t),t}static pointToLocalFrame(e,t,i,s){return s===void 0&&(s=new F),i.vsub(e,s),t.conjugate(ew),ew.vmult(s,s),s}static pointToWorldFrame(e,t,i,s){return s===void 0&&(s=new F),t.vmult(i,s),s.vadd(e,s),s}static vectorToWorldFrame(e,t,i){return i===void 0&&(i=new F),e.vmult(t,i),i}static vectorToLocalFrame(e,t,i,s){return s===void 0&&(s=new F),t.w*=-1,t.vmult(i,s),t.w*=-1,s}}const ew=new xi;new F;new F;new F;new F;new F,new F,new F,new F,new F,new F,new F,new F;new F;new xi;new Ls;new ao;new ao;new ao;new F;new F;new F;new F;new F;new F;new F;new F;new F;new F;new xi;new F;new F;new F;new F;class ub{constructor(){this.rayFromWorld=new F,this.rayToWorld=new F,this.hitNormalWorld=new F,this.hitPointWorld=new F,this.hasHit=!1,this.shape=null,this.body=null,this.hitFaceIndex=-1,this.distance=-1,this.shouldStop=!1}reset(){this.rayFromWorld.setZero(),this.rayToWorld.setZero(),this.hitNormalWorld.setZero(),this.hitPointWorld.setZero(),this.hasHit=!1,this.shape=null,this.body=null,this.hitFaceIndex=-1,this.distance=-1,this.shouldStop=!1}abort(){this.shouldStop=!0}set(e,t,i,s,r,o,a){this.rayFromWorld.copy(e),this.rayToWorld.copy(t),this.hitNormalWorld.copy(i),this.hitPointWorld.copy(s),this.shape=r,this.body=o,this.distance=a}}let iV,sV,rV,oV,aV,lV,gV;const uy={CLOSEST:1,ANY:2,ALL:4};iV=_e.types.SPHERE;sV=_e.types.PLANE;rV=_e.types.BOX;oV=_e.types.CYLINDER;aV=_e.types.CONVEXPOLYHEDRON;lV=_e.types.HEIGHTFIELD;gV=_e.types.TRIMESH;class mi{get[iV](){return this._intersectSphere}get[sV](){return this._intersectPlane}get[rV](){return this._intersectBox}get[oV](){return this._intersectConvex}get[aV](){return this._intersectConvex}get[lV](){return this._intersectHeightfield}get[gV](){return this._intersectTrimesh}constructor(e,t){e===void 0&&(e=new F),t===void 0&&(t=new F),this.from=e.clone(),this.to=t.clone(),this.direction=new F,this.precision=1e-4,this.checkCollisionResponse=!0,this.skipBackfaces=!1,this.collisionFilterMask=-1,this.collisionFilterGroup=-1,this.mode=mi.ANY,this.result=new ub,this.hasHit=!1,this.callback=i=>{}}intersectWorld(e,t){return this.mode=t.mode||mi.ANY,this.result=t.result||new ub,this.skipBackfaces=!!t.skipBackfaces,this.collisionFilterMask=typeof t.collisionFilterMask<"u"?t.collisionFilterMask:-1,this.collisionFilterGroup=typeof t.collisionFilterGroup<"u"?t.collisionFilterGroup:-1,this.checkCollisionResponse=typeof t.checkCollisionResponse<"u"?t.checkCollisionResponse:!0,t.from&&this.from.copy(t.from),t.to&&this.to.copy(t.to),this.callback=t.callback||(()=>{}),this.hasHit=!1,this.result.reset(),this.updateDirection(),this.getAABB(tw),mf.length=0,e.broadphase.aabbQuery(e,tw,mf),this.intersectBodies(mf),this.hasHit}intersectBody(e,t){t&&(this.result=t,this.updateDirection());const i=this.checkCollisionResponse;if(i&&!e.collisionResponse||!(this.collisionFilterGroup&e.collisionFilterMask)||!(e.collisionFilterGroup&this.collisionFilterMask))return;const s=VT,r=MT;for(let o=0,a=e.shapes.length;oe.boundingSphereRadius)return;const a=this[e.type];a&&a.call(this,e,t,i,s,e)}_intersectBox(e,t,i,s,r){return this._intersectConvex(e.convexPolyhedronRepresentation,t,i,s,r)}_intersectPlane(e,t,i,s,r){const o=this.from,a=this.to,l=this.direction,c=new F(0,0,1);t.vmult(c,c);const u=new F;o.vsub(i,u);const C=u.dot(c);a.vsub(i,u);const d=u.dot(c);if(C*d>0||o.distanceTo(a)=0&&v<=1&&(o.lerp(a,v,h),h.vsub(i,m),m.normalize(),this.reportIntersection(m,h,r,s,-1)),this.result.shouldStop)return;y>=0&&y<=1&&(o.lerp(a,y,h),h.vsub(i,m),m.normalize(),this.reportIntersection(m,h,r,s,-1))}}_intersectConvex(e,t,i,s,r,o){const a=FT,l=iw,c=o&&o.faceList||null,u=e.faces,C=e.vertices,d=e.faceNormals,h=this.direction,m=this.from,v=this.to,y=m.distanceTo(v),A=c?c.length:u.length,b=this.result;for(let f=0;!b.shouldStop&&fy||this.reportIntersection(a,Ki,r,s,B)}}}}_intersectTrimesh(e,t,i,s,r,o){const a=KT,l=DT,c=UT,u=iw,C=zT,d=LT,h=TT,m=kT,v=ET,y=e.indices;e.vertices;const A=this.from,b=this.to,f=this.direction;c.position.copy(i),c.quaternion.copy(t),Ei.vectorToLocalFrame(i,t,f,C),Ei.pointToLocalFrame(i,t,A,d),Ei.pointToLocalFrame(i,t,b,h),h.x*=e.scale.x,h.y*=e.scale.y,h.z*=e.scale.z,d.x*=e.scale.x,d.y*=e.scale.y,d.z*=e.scale.z,h.vsub(d,C),C.normalize();const B=d.distanceSquared(h);e.tree.rayQuery(this,c,l);for(let S=0,x=l.length;!this.result.shouldStop&&S!==x;S++){const R=l[S];e.getNormal(R,a),e.getVertex(y[R*3],$s),$s.vsub(d,u);const M=C.dot(a),Z=a.dot(u)/M;if(Z<0)continue;C.scale(Z,Ki),Ki.vadd(d,Ki),e.getVertex(y[R*3+1],Br),e.getVertex(y[R*3+2],Zr);const V=Ki.distanceSquared(d);!(mi.pointInTriangle(Ki,Br,$s,Zr)||mi.pointInTriangle(Ki,$s,Br,Zr))||V>B||(Ei.vectorToWorldFrame(t,a,v),Ei.pointToWorldFrame(i,t,Ki,m),this.reportIntersection(v,m,r,s,R))}l.length=0}reportIntersection(e,t,i,s,r){const o=this.from,a=this.to,l=o.distanceTo(t),c=this.result;if(!(this.skipBackfaces&&e.dot(this.direction)>0))switch(c.hitFaceIndex=typeof r<"u"?r:-1,this.mode){case mi.ALL:this.hasHit=!0,c.set(o,a,e,t,i,s,l),c.hasHit=!0,this.callback(c);break;case mi.CLOSEST:(l=0&&(C=r*c-o*a)>=0&&u+CDate.now()-n}new F;class lo{constructor(e){e===void 0&&(e=[0,0,0,0,0,0,0,0,0]),this.elements=e}identity(){const e=this.elements;e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1}setZero(){const e=this.elements;e[0]=0,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=0,e[6]=0,e[7]=0,e[8]=0}setTrace(e){const t=this.elements;t[0]=e.x,t[4]=e.y,t[8]=e.z}getTrace(e){e===void 0&&(e=new K);const t=this.elements;return e.x=t[0],e.y=t[4],e.z=t[8],e}vmult(e,t){t===void 0&&(t=new K);const i=this.elements,s=e.x,r=e.y,o=e.z;return t.x=i[0]*s+i[1]*r+i[2]*o,t.y=i[3]*s+i[4]*r+i[5]*o,t.z=i[6]*s+i[7]*r+i[8]*o,t}smult(e){for(let t=0;t0){const r=1/s;this.x*=r,this.y*=r,this.z*=r}else this.x=0,this.y=0,this.z=0;return s}unit(e){e===void 0&&(e=new K);const t=this.x,i=this.y,s=this.z;let r=Math.sqrt(t*t+i*i+s*s);return r>0?(r=1/r,e.x=t*r,e.y=i*r,e.z=s*r):(e.x=1,e.y=0,e.z=0),e}length(){const e=this.x,t=this.y,i=this.z;return Math.sqrt(e*e+t*t+i*i)}lengthSquared(){return this.dot(this)}distanceTo(e){const t=this.x,i=this.y,s=this.z,r=e.x,o=e.y,a=e.z;return Math.sqrt((r-t)*(r-t)+(o-i)*(o-i)+(a-s)*(a-s))}distanceSquared(e){const t=this.x,i=this.y,s=this.z,r=e.x,o=e.y,a=e.z;return(r-t)*(r-t)+(o-i)*(o-i)+(a-s)*(a-s)}scale(e,t){t===void 0&&(t=new K);const i=this.x,s=this.y,r=this.z;return t.x=e*i,t.y=e*s,t.z=e*r,t}vmul(e,t){return t===void 0&&(t=new K),t.x=e.x*this.x,t.y=e.y*this.y,t.z=e.z*this.z,t}addScaledVector(e,t,i){return i===void 0&&(i=new K),i.x=this.x+e*t.x,i.y=this.y+e*t.y,i.z=this.z+e*t.z,i}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}isZero(){return this.x===0&&this.y===0&&this.z===0}negate(e){return e===void 0&&(e=new K),e.x=-this.x,e.y=-this.y,e.z=-this.z,e}tangents(e,t){const i=this.length();if(i>0){const s=JT,r=1/i;s.set(this.x*r,this.y*r,this.z*r);const o=OT;Math.abs(s.x)<.9?(o.set(1,0,0),s.cross(o,e)):(o.set(0,1,0),s.cross(o,e)),s.cross(e,t)}else e.set(1,0,0),t.set(0,1,0)}toString(){return`${this.x},${this.y},${this.z}`}toArray(){return[this.x,this.y,this.z]}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}lerp(e,t,i){const s=this.x,r=this.y,o=this.z;i.x=s+(e.x-s)*t,i.y=r+(e.y-r)*t,i.z=o+(e.z-o)*t}almostEquals(e,t){return t===void 0&&(t=1e-6),!(Math.abs(this.x-e.x)>t||Math.abs(this.y-e.y)>t||Math.abs(this.z-e.z)>t)}almostZero(e){return e===void 0&&(e=1e-6),!(Math.abs(this.x)>e||Math.abs(this.y)>e||Math.abs(this.z)>e)}isAntiparallelTo(e,t){return this.negate(sw),sw.almostEquals(e,t)}clone(){return new K(this.x,this.y,this.z)}}K.ZERO=new K(0,0,0);K.UNIT_X=new K(1,0,0);K.UNIT_Y=new K(0,1,0);K.UNIT_Z=new K(0,0,1);const JT=new K,OT=new K,sw=new K;class Ts{constructor(e){e===void 0&&(e={}),this.lowerBound=new K,this.upperBound=new K,e.lowerBound&&this.lowerBound.copy(e.lowerBound),e.upperBound&&this.upperBound.copy(e.upperBound)}setFromPoints(e,t,i,s){const r=this.lowerBound,o=this.upperBound,a=i;r.copy(e[0]),a&&a.vmult(r,r),o.copy(r);for(let l=1;lo.x&&(o.x=c.x),c.xo.y&&(o.y=c.y),c.yo.z&&(o.z=c.z),c.z=r.x&&t.y<=s.y&&i.y>=r.y&&t.z<=s.z&&i.z>=r.z}getCorners(e,t,i,s,r,o,a,l){const c=this.lowerBound,u=this.upperBound;e.copy(c),t.set(u.x,c.y,c.z),i.set(u.x,u.y,c.z),s.set(c.x,u.y,u.z),r.set(u.x,c.y,u.z),o.set(c.x,u.y,c.z),a.set(c.x,c.y,u.z),l.copy(u)}toLocalFrame(e,t){const i=ow,s=i[0],r=i[1],o=i[2],a=i[3],l=i[4],c=i[5],u=i[6],C=i[7];this.getCorners(s,r,o,a,l,c,u,C);for(let d=0;d!==8;d++){const h=i[d];e.pointToLocal(h,h)}return t.setFromPoints(i)}toWorldFrame(e,t){const i=ow,s=i[0],r=i[1],o=i[2],a=i[3],l=i[4],c=i[5],u=i[6],C=i[7];this.getCorners(s,r,o,a,l,c,u,C);for(let d=0;d!==8;d++){const h=i[d];e.pointToWorld(h,h)}return t.setFromPoints(i)}overlapsRay(e){const{direction:t,from:i}=e,s=1/t.x,r=1/t.y,o=1/t.z,a=(this.lowerBound.x-i.x)*s,l=(this.upperBound.x-i.x)*s,c=(this.lowerBound.y-i.y)*r,u=(this.upperBound.y-i.y)*r,C=(this.lowerBound.z-i.z)*o,d=(this.upperBound.z-i.z)*o,h=Math.max(Math.max(Math.min(a,l),Math.min(c,u)),Math.min(C,d)),m=Math.min(Math.min(Math.max(a,l),Math.max(c,u)),Math.max(C,d));return!(m<0||h>m)}}const rw=new K,ow=[new K,new K,new K,new K,new K,new K,new K,new K];class Ri{constructor(e,t,i,s){e===void 0&&(e=0),t===void 0&&(t=0),i===void 0&&(i=0),s===void 0&&(s=1),this.x=e,this.y=t,this.z=i,this.w=s}set(e,t,i,s){return this.x=e,this.y=t,this.z=i,this.w=s,this}toString(){return`${this.x},${this.y},${this.z},${this.w}`}toArray(){return[this.x,this.y,this.z,this.w]}setFromAxisAngle(e,t){const i=Math.sin(t*.5);return this.x=e.x*i,this.y=e.y*i,this.z=e.z*i,this.w=Math.cos(t*.5),this}toAxisAngle(e){e===void 0&&(e=new K),this.normalize();const t=2*Math.acos(this.w),i=Math.sqrt(1-this.w*this.w);return i<.001?(e.x=this.x,e.y=this.y,e.z=this.z):(e.x=this.x/i,e.y=this.y/i,e.z=this.z/i),[e,t]}setFromVectors(e,t){if(e.isAntiparallelTo(t)){const i=QT,s=jT;e.tangents(i,s),this.setFromAxisAngle(i,Math.PI)}else{const i=e.cross(t);this.x=i.x,this.y=i.y,this.z=i.z,this.w=Math.sqrt(e.length()**2*t.length()**2)+e.dot(t),this.normalize()}return this}mult(e,t){t===void 0&&(t=new Ri);const i=this.x,s=this.y,r=this.z,o=this.w,a=e.x,l=e.y,c=e.z,u=e.w;return t.x=i*u+o*a+s*c-r*l,t.y=s*u+o*l+r*a-i*c,t.z=r*u+o*c+i*l-s*a,t.w=o*u-i*a-s*l-r*c,t}inverse(e){e===void 0&&(e=new Ri);const t=this.x,i=this.y,s=this.z,r=this.w;this.conjugate(e);const o=1/(t*t+i*i+s*s+r*r);return e.x*=o,e.y*=o,e.z*=o,e.w*=o,e}conjugate(e){return e===void 0&&(e=new Ri),e.x=-this.x,e.y=-this.y,e.z=-this.z,e.w=this.w,e}normalize(){let e=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);return e===0?(this.x=0,this.y=0,this.z=0,this.w=0):(e=1/e,this.x*=e,this.y*=e,this.z*=e,this.w*=e),this}normalizeFast(){const e=(3-(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w))/2;return e===0?(this.x=0,this.y=0,this.z=0,this.w=0):(this.x*=e,this.y*=e,this.z*=e,this.w*=e),this}vmult(e,t){t===void 0&&(t=new K);const i=e.x,s=e.y,r=e.z,o=this.x,a=this.y,l=this.z,c=this.w,u=c*i+a*r-l*s,C=c*s+l*i-o*r,d=c*r+o*s-a*i,h=-o*i-a*s-l*r;return t.x=u*c+h*-o+C*-l-d*-a,t.y=C*c+h*-a+d*-o-u*-l,t.z=d*c+h*-l+u*-a-C*-o,t}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w,this}toEuler(e,t){t===void 0&&(t="YZX");let i,s,r;const o=this.x,a=this.y,l=this.z,c=this.w;switch(t){case"YZX":const u=o*a+l*c;if(u>.499&&(i=2*Math.atan2(o,c),s=Math.PI/2,r=0),u<-.499&&(i=-2*Math.atan2(o,c),s=-Math.PI/2,r=0),i===void 0){const C=o*o,d=a*a,h=l*l;i=Math.atan2(2*a*c-2*o*l,1-2*d-2*h),s=Math.asin(2*u),r=Math.atan2(2*o*c-2*a*l,1-2*C-2*h)}break;default:throw new Error(`Euler order ${t} not supported yet.`)}e.y=i,e.z=s,e.x=r}setFromEuler(e,t,i,s){s===void 0&&(s="XYZ");const r=Math.cos(e/2),o=Math.cos(t/2),a=Math.cos(i/2),l=Math.sin(e/2),c=Math.sin(t/2),u=Math.sin(i/2);return s==="XYZ"?(this.x=l*o*a+r*c*u,this.y=r*c*a-l*o*u,this.z=r*o*u+l*c*a,this.w=r*o*a-l*c*u):s==="YXZ"?(this.x=l*o*a+r*c*u,this.y=r*c*a-l*o*u,this.z=r*o*u-l*c*a,this.w=r*o*a+l*c*u):s==="ZXY"?(this.x=l*o*a-r*c*u,this.y=r*c*a+l*o*u,this.z=r*o*u+l*c*a,this.w=r*o*a-l*c*u):s==="ZYX"?(this.x=l*o*a-r*c*u,this.y=r*c*a+l*o*u,this.z=r*o*u-l*c*a,this.w=r*o*a+l*c*u):s==="YZX"?(this.x=l*o*a+r*c*u,this.y=r*c*a+l*o*u,this.z=r*o*u-l*c*a,this.w=r*o*a-l*c*u):s==="XZY"&&(this.x=l*o*a-r*c*u,this.y=r*c*a-l*o*u,this.z=r*o*u+l*c*a,this.w=r*o*a+l*c*u),this}clone(){return new Ri(this.x,this.y,this.z,this.w)}slerp(e,t,i){i===void 0&&(i=new Ri);const s=this.x,r=this.y,o=this.z,a=this.w;let l=e.x,c=e.y,u=e.z,C=e.w,d,h,m,v,y;return h=s*l+r*c+o*u+a*C,h<0&&(h=-h,l=-l,c=-c,u=-u,C=-C),1-h>1e-6?(d=Math.acos(h),m=Math.sin(d),v=Math.sin((1-t)*d)/m,y=Math.sin(t*d)/m):(v=1-t,y=t),i.x=v*s+y*l,i.y=v*r+y*c,i.z=v*o+y*u,i.w=v*a+y*C,i}integrate(e,t,i,s){s===void 0&&(s=new Ri);const r=e.x*i.x,o=e.y*i.y,a=e.z*i.z,l=this.x,c=this.y,u=this.z,C=this.w,d=t*.5;return s.x+=d*(r*C+o*u-a*c),s.y+=d*(o*C+a*l-r*u),s.z+=d*(a*C+r*c-o*l),s.w+=d*(-r*l-o*c-a*u),s}}const QT=new K,jT=new K,qT={SPHERE:1,PLANE:2,BOX:4,COMPOUND:8,CONVEXPOLYHEDRON:16,HEIGHTFIELD:32,PARTICLE:64,CYLINDER:128,TRIMESH:256};class Je{constructor(e){e===void 0&&(e={}),this.id=Je.idCounter++,this.type=e.type||0,this.boundingSphereRadius=0,this.collisionResponse=e.collisionResponse?e.collisionResponse:!0,this.collisionFilterGroup=e.collisionFilterGroup!==void 0?e.collisionFilterGroup:1,this.collisionFilterMask=e.collisionFilterMask!==void 0?e.collisionFilterMask:-1,this.material=e.material?e.material:null,this.body=null}updateBoundingSphereRadius(){throw`computeBoundingSphereRadius() not implemented for shape type ${this.type}`}volume(){throw`volume() not implemented for shape type ${this.type}`}calculateLocalInertia(e,t){throw`calculateLocalInertia() not implemented for shape type ${this.type}`}calculateWorldAABB(e,t,i,s){throw`calculateWorldAABB() not implemented for shape type ${this.type}`}}Je.idCounter=0;Je.types=qT;class ki{constructor(e){e===void 0&&(e={}),this.position=new K,this.quaternion=new Ri,e.position&&this.position.copy(e.position),e.quaternion&&this.quaternion.copy(e.quaternion)}pointToLocal(e,t){return ki.pointToLocalFrame(this.position,this.quaternion,e,t)}pointToWorld(e,t){return ki.pointToWorldFrame(this.position,this.quaternion,e,t)}vectorToWorldFrame(e,t){return t===void 0&&(t=new K),this.quaternion.vmult(e,t),t}static pointToLocalFrame(e,t,i,s){return s===void 0&&(s=new K),i.vsub(e,s),t.conjugate(aw),aw.vmult(s,s),s}static pointToWorldFrame(e,t,i,s){return s===void 0&&(s=new K),t.vmult(i,s),s.vadd(e,s),s}static vectorToWorldFrame(e,t,i){return i===void 0&&(i=new K),e.vmult(t,i),i}static vectorToLocalFrame(e,t,i,s){return s===void 0&&(s=new K),t.w*=-1,t.vmult(i,s),t.w*=-1,s}}const aw=new Ri;new K;new K;new K;new K;new K,new K,new K,new K,new K,new K,new K,new K;new K;new Ri;new Ts;new lo;new lo;new lo;new K;new K;new K;new K;new K;new K;new K;new K;new K;new K;new Ri;new K;new K;new K;new K;class Cb{constructor(){this.rayFromWorld=new K,this.rayToWorld=new K,this.hitNormalWorld=new K,this.hitPointWorld=new K,this.hasHit=!1,this.shape=null,this.body=null,this.hitFaceIndex=-1,this.distance=-1,this.shouldStop=!1}reset(){this.rayFromWorld.setZero(),this.rayToWorld.setZero(),this.hitNormalWorld.setZero(),this.hitPointWorld.setZero(),this.hasHit=!1,this.shape=null,this.body=null,this.hitFaceIndex=-1,this.distance=-1,this.shouldStop=!1}abort(){this.shouldStop=!0}set(e,t,i,s,r,o,a){this.rayFromWorld.copy(e),this.rayToWorld.copy(t),this.hitNormalWorld.copy(i),this.hitPointWorld.copy(s),this.shape=r,this.body=o,this.distance=a}}let cV,IV,uV,CV,dV,hV,AV;const Cy={CLOSEST:1,ANY:2,ALL:4};cV=Je.types.SPHERE;IV=Je.types.PLANE;uV=Je.types.BOX;CV=Je.types.CYLINDER;dV=Je.types.CONVEXPOLYHEDRON;hV=Je.types.HEIGHTFIELD;AV=Je.types.TRIMESH;class fi{get[cV](){return this._intersectSphere}get[IV](){return this._intersectPlane}get[uV](){return this._intersectBox}get[CV](){return this._intersectConvex}get[dV](){return this._intersectConvex}get[hV](){return this._intersectHeightfield}get[AV](){return this._intersectTrimesh}constructor(e,t){e===void 0&&(e=new K),t===void 0&&(t=new K),this.from=e.clone(),this.to=t.clone(),this.direction=new K,this.precision=1e-4,this.checkCollisionResponse=!0,this.skipBackfaces=!1,this.collisionFilterMask=-1,this.collisionFilterGroup=-1,this.mode=fi.ANY,this.result=new Cb,this.hasHit=!1,this.callback=i=>{}}intersectWorld(e,t){return this.mode=t.mode||fi.ANY,this.result=t.result||new Cb,this.skipBackfaces=!!t.skipBackfaces,this.collisionFilterMask=typeof t.collisionFilterMask<"u"?t.collisionFilterMask:-1,this.collisionFilterGroup=typeof t.collisionFilterGroup<"u"?t.collisionFilterGroup:-1,this.checkCollisionResponse=typeof t.checkCollisionResponse<"u"?t.checkCollisionResponse:!0,t.from&&this.from.copy(t.from),t.to&&this.to.copy(t.to),this.callback=t.callback||(()=>{}),this.hasHit=!1,this.result.reset(),this.updateDirection(),this.getAABB(lw),bf.length=0,e.broadphase.aabbQuery(e,lw,bf),this.intersectBodies(bf),this.hasHit}intersectBody(e,t){t&&(this.result=t,this.updateDirection());const i=this.checkCollisionResponse;if(i&&!e.collisionResponse||!(this.collisionFilterGroup&e.collisionFilterMask)||!(e.collisionFilterGroup&this.collisionFilterMask))return;const s=$T,r=eE;for(let o=0,a=e.shapes.length;oe.boundingSphereRadius)return;const a=this[e.type];a&&a.call(this,e,t,i,s,e)}_intersectBox(e,t,i,s,r){return this._intersectConvex(e.convexPolyhedronRepresentation,t,i,s,r)}_intersectPlane(e,t,i,s,r){const o=this.from,a=this.to,l=this.direction,c=new K(0,0,1);t.vmult(c,c);const u=new K;o.vsub(i,u);const C=u.dot(c);a.vsub(i,u);const d=u.dot(c);if(C*d>0||o.distanceTo(a)=0&&v<=1&&(o.lerp(a,v,h),h.vsub(i,m),m.normalize(),this.reportIntersection(m,h,r,s,-1)),this.result.shouldStop)return;y>=0&&y<=1&&(o.lerp(a,y,h),h.vsub(i,m),m.normalize(),this.reportIntersection(m,h,r,s,-1))}}_intersectConvex(e,t,i,s,r,o){const a=rE,l=cw,c=o&&o.faceList||null,u=e.faces,C=e.vertices,d=e.faceNormals,h=this.direction,m=this.from,v=this.to,y=m.distanceTo(v),A=c?c.length:u.length,b=this.result;for(let f=0;!b.shouldStop&&fy||this.reportIntersection(a,zi,r,s,B)}}}}_intersectTrimesh(e,t,i,s,r,o){const a=oE,l=uE,c=CE,u=cw,C=aE,d=lE,h=gE,m=IE,v=cE,y=e.indices;e.vertices;const A=this.from,b=this.to,f=this.direction;c.position.copy(i),c.quaternion.copy(t),ki.vectorToLocalFrame(i,t,f,C),ki.pointToLocalFrame(i,t,A,d),ki.pointToLocalFrame(i,t,b,h),h.x*=e.scale.x,h.y*=e.scale.y,h.z*=e.scale.z,d.x*=e.scale.x,d.y*=e.scale.y,d.z*=e.scale.z,h.vsub(d,C),C.normalize();const B=d.distanceSquared(h);e.tree.rayQuery(this,c,l);for(let S=0,x=l.length;!this.result.shouldStop&&S!==x;S++){const R=l[S];e.getNormal(R,a),e.getVertex(y[R*3],er),er.vsub(d,u);const M=C.dot(a),Z=a.dot(u)/M;if(Z<0)continue;C.scale(Z,zi),zi.vadd(d,zi),e.getVertex(y[R*3+1],wr),e.getVertex(y[R*3+2],Sr);const V=zi.distanceSquared(d);!(fi.pointInTriangle(zi,wr,er,Sr)||fi.pointInTriangle(zi,er,wr,Sr))||V>B||(ki.vectorToWorldFrame(t,a,v),ki.pointToWorldFrame(i,t,zi,m),this.reportIntersection(v,m,r,s,R))}l.length=0}reportIntersection(e,t,i,s,r){const o=this.from,a=this.to,l=o.distanceTo(t),c=this.result;if(!(this.skipBackfaces&&e.dot(this.direction)>0))switch(c.hitFaceIndex=typeof r<"u"?r:-1,this.mode){case fi.ALL:this.hasHit=!0,c.set(o,a,e,t,i,s,l),c.hasHit=!0,this.callback(c);break;case fi.CLOSEST:(l=0&&(C=r*c-o*a)>=0&&u+CDate.now()-n}new K;const hE=U.createContext(null),AE=()=>U.useContext(hE),pV=U.createContext(null),pE=()=>{const n=U.useContext(pV);if(!n)throw new Error("Physics context not found. @react-three/cannon & components can only be used within a Physics provider");return n};new H(1,1,1);new H;new Fe;const Iw=new Ht;function mE(n){const e=U.useRef(null);return n&&typeof n!="function"?n:e}function uw(n){return n.charAt(0).toUpperCase()+n.slice(1)}function si(n,e){const t=e===void 0?"":`/${e}`;return typeof n=="function"?null:n&&n.current&&`${n.current.uuid}${t}`}const fE=new bl,bE=new xn,vE=n=>e=>n(fE.setFromQuaternion(bE.fromArray(e)).toArray());let mV=0;function yf(n,e,t,i,s,r){return r===void 0&&(r="bodies"),o=>{const a=mV++;t[a]={[i]:o};const l=si(n,s);return l&&e.subscribe({props:{id:a,target:r,type:i},uuid:l}),()=>{delete t[a],e.unsubscribe({props:a})}}}function Cw(n,e){let{position:t=[0,0,0],rotation:i=[0,0,0],userData:s={}}=e;n.userData=s,n.position.set(...t),n.rotation.set(...i),n.updateMatrix()}function dw(n,e,t){let{onCollide:i,onCollideBegin:s,onCollideEnd:r}=e;n[t]={collide:i,collideBegin:s,collideEnd:r}}function yE(n,e,t,i,s){i===void 0&&(i=null),s===void 0&&(s=[]);const r=mE(i),{events:o,refs:a,scaleOverrides:l,subscriptions:c,worker:u}=pE(),C=AE();U.useLayoutEffect(()=>{r.current||(r.current=new Ht);const h=r.current,m=u,v=h instanceof Tg?(h.instanceMatrix.setUsage(A1),h.count):1,y=h instanceof Tg?new Array(v).fill(0).map((b,f)=>`${h.uuid}/${f}`):[h.uuid],A=h instanceof Tg?y.map((b,f)=>{const B=e(f);return Cw(Iw,B),h.setMatrixAt(f,Iw.matrix),h.instanceMatrix.needsUpdate=!0,a[b]=h,C?.add(b,B,n),dw(o,B,b),{...B,args:t(B.args)}}):y.map((b,f)=>{const B=e(f);return Cw(h,B),a[b]=h,C?.add(b,B,n),dw(o,B,b),{...B,args:t(B.args)}});return m.addBodies({props:A.map(b=>{let{onCollide:f,onCollideBegin:B,onCollideEnd:S,...x}=b;return{onCollide:!!f,...x}}),type:n,uuid:y}),()=>{y.forEach(b=>{delete a[b],C?.remove(b),delete o[b]}),m.removeBodies({uuid:y})}},s);const d=U.useMemo(()=>{const h=(f,B)=>{const S=`set${uw(f)}`;return{set:x=>{const R=si(r,B);R&&u[S]({props:x,uuid:R})},subscribe:yf(r,u,c,f,B)}},m=f=>({copy:S=>{let{w:x,x:R,y:M,z:Z}=S;const V=si(r,f);V&&u.setQuaternion({props:[R,M,Z,x],uuid:V})},set:(S,x,R,M)=>{const Z=si(r,f);Z&&u.setQuaternion({props:[S,x,R,M],uuid:Z})},subscribe:yf(r,u,c,"quaternion",f)}),v=f=>({copy:B=>{let{x:S,y:x,z:R}=B;const M=si(r,f);M&&u.setRotation({props:[S,x,R],uuid:M})},set:(B,S,x)=>{const R=si(r,f);R&&u.setRotation({props:[B,S,x],uuid:R})},subscribe:B=>{const S=mV++,x="bodies",R="quaternion",M=si(r,f);return c[S]={[R]:vE(B)},M&&u.subscribe({props:{id:S,target:x,type:R},uuid:M}),()=>{delete c[S],u.unsubscribe({props:S})}}}),y=(f,B)=>{const S=`set${uw(f)}`;return{copy:x=>{let{x:R,y:M,z:Z}=x;const V=si(r,B);V&&u[S]({props:[R,M,Z],uuid:V})},set:(x,R,M)=>{const Z=si(r,B);Z&&u[S]({props:[x,R,M],uuid:Z})},subscribe:yf(r,u,c,f,B)}};function A(f){return{allowSleep:h("allowSleep",f),angularDamping:h("angularDamping",f),angularFactor:y("angularFactor",f),angularVelocity:y("angularVelocity",f),applyForce(B,S){const x=si(r,f);x&&u.applyForce({props:[B,S],uuid:x})},applyImpulse(B,S){const x=si(r,f);x&&u.applyImpulse({props:[B,S],uuid:x})},applyLocalForce(B,S){const x=si(r,f);x&&u.applyLocalForce({props:[B,S],uuid:x})},applyLocalImpulse(B,S){const x=si(r,f);x&&u.applyLocalImpulse({props:[B,S],uuid:x})},applyTorque(B){const S=si(r,f);S&&u.applyTorque({props:[B],uuid:S})},collisionFilterGroup:h("collisionFilterGroup",f),collisionFilterMask:h("collisionFilterMask",f),collisionResponse:h("collisionResponse",f),fixedRotation:h("fixedRotation",f),isTrigger:h("isTrigger",f),linearDamping:h("linearDamping",f),linearFactor:y("linearFactor",f),mass:h("mass",f),material:h("material",f),position:y("position",f),quaternion:m(f),rotation:v(f),scaleOverride(B){const S=si(r,f);S&&(l[S]=new H(...B))},sleep(){const B=si(r,f);B&&u.sleep({uuid:B})},sleepSpeedLimit:h("sleepSpeedLimit",f),sleepTimeLimit:h("sleepTimeLimit",f),userData:h("userData",f),velocity:y("velocity",f),wakeUp(){const B=si(r,f);B&&u.wakeUp({uuid:B})}}}const b={};return{...A(void 0),at:f=>b[f]||(b[f]=A(f))}},[]);return[r,d]}function fV(n,e,t){return yE("Sphere",n,function(i){if(i===void 0&&(i=[1]),!Array.isArray(i))throw new Error("useSphere args must be an array");return[i[0]]},e,t)}const GE=new H,BE=new H(1,1,1),ZE=new xn,th=new Fe;function hw(n,e,t,i,s){return i===void 0&&(i=BE),n!==void 0?(th.compose(GE.fromArray(e,n*3),ZE.fromArray(t,n*4),i),s&&(s.matrixAutoUpdate=!1,s.matrix.copy(th)),th):th.identity()}const wE=()=>{const n=[];return e=>n.includes(e)?!1:!!n.push(e)};function SE(n){let{allowSleep:e=!1,axisIndex:t=0,broadphase:i="Naive",children:s,defaultContactMaterial:r={contactEquationStiffness:1e6},frictionGravity:o=null,gravity:a=[0,-9.81,0],isPaused:l=!1,iterations:c=5,maxSubSteps:u=10,quatNormalizeFast:C=!1,quatNormalizeSkip:d=0,shouldInvalidate:h=!0,size:m=1e3,solver:v="GS",stepSize:y=1/60,tolerance:A=.001}=n;const{invalidate:b}=$i(),[{bodies:f,events:B,refs:S,scaleOverrides:x,subscriptions:R,worker:M}]=U.useState(()=>({bodies:{},events:{},refs:{},scaleOverrides:{},subscriptions:{},worker:new BT({allowSleep:e,axisIndex:t,broadphase:i,defaultContactMaterial:r,frictionGravity:o,gravity:a,iterations:c,quatNormalizeFast:C,quatNormalizeSkip:d,size:m,solver:v,tolerance:A})}));let Z=0;const V=U.useCallback((le,L)=>{l||(Z+=L,M.step({maxSubSteps:u,stepSize:y,timeSinceLastCalled:Z}),Z=0)},[l,u,y]),N=le=>{var L;let{body:J,contact:{bi:P,bj:ce,...se},target:ee,...re}=le;const ve=(L=B[ee])==null?void 0:L.collide;ve&&ve({body:S[J],contact:{bi:S[P],bj:S[ce],...se},target:S[ee],...re})},D=le=>{var L,J;let{bodyA:P,bodyB:ce}=le;const se=(L=B[P])==null?void 0:L.collideBegin;se&&se({body:S[ce],op:"event",target:S[P],type:"collideBegin"});const ee=(J=B[ce])==null?void 0:J.collideBegin;ee&&ee({body:S[P],op:"event",target:S[ce],type:"collideBegin"})},k=le=>{var L,J;let{bodyA:P,bodyB:ce}=le;const se=(L=B[P])==null?void 0:L.collideEnd;se&&se({body:S[ce],op:"event",target:S[P],type:"collideEnd"});const ee=(J=B[ce])==null?void 0:J.collideEnd;ee&&ee({body:S[P],op:"event",target:S[ce],type:"collideEnd"})},$=le=>{let{active:L,bodies:J=[],observations:P,positions:ce,quaternions:se}=le;for(let ee=0;ee{let[re,ve,ye]=ee;const nt=(R[re]||{})[ye];nt&&nt(ve)}),!!L){for(const ee of Object.values(S).filter(wE()))if(ee instanceof Tg)for(let re=0;re{var L;let{body:J,ray:{uuid:P,...ce},...se}=le;const ee=(L=B[P])==null?void 0:L.rayhit;ee&&ee({body:J?S[J]:null,ray:{uuid:P,...ce},...se})};_u(V),U.useEffect(()=>(M.connect(),M.init(),M.on("collide",N),M.on("collideBegin",D),M.on("collideEnd",k),M.on("frame",$),M.on("rayhit",te),()=>{M.terminate(),M.removeAllListeners()}),[]),U.useEffect(()=>{M.axisIndex=t},[t]),U.useEffect(()=>{M.broadphase=i},[i]),U.useEffect(()=>{M.gravity=a},[a]),U.useEffect(()=>{M.iterations=c},[c]),U.useEffect(()=>{M.tolerance=A},[A]);const Ce=U.useMemo(()=>({bodies:f,events:B,refs:S,scaleOverrides:x,subscriptions:R,worker:M}),[f,B,S,R,M]);return E.jsx(pV.Provider,{value:Ce,children:s})}/** + `)+g.join(" > ")}return null},t.getPublicRootInstance=function(g){if(g=g.current,!g.child)return null;switch(g.child.tag){case 5:return Ce(g.child.stateNode);default:return g.child.stateNode}},t.injectIntoDevTools=function(g){if(g={bundleType:g.bundleType,version:g.version,rendererPackageName:g.rendererPackageName,rendererConfig:g.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:a.ReactCurrentDispatcher,findHostInstanceByFiber:EM,findFiberByHostInstance:g.findFiberByHostInstance||kM,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.0.0-fc46dba67-20220329"},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")g=!1;else{var I=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(I.isDisabled||!I.supportsFiber)g=!0;else{try{nC=I.inject(g),hr=I}catch{}g=!!I.checkDCE}}return g},t.isAlreadyRendering=function(){return!1},t.observeVisibleRects=function(g,I,p,G){if(!ut)throw Error(o(363));g=Up(g,I);var w=Me(g,p,G).disconnect;return{disconnect:function(){w()}}},t.registerMutableSourceForHydration=function(g,I){var p=I._getVersion;p=p(I._source),g.mutableSourceEagerHydrationData==null?g.mutableSourceEagerHydrationData=[I,p]:g.mutableSourceEagerHydrationData.push(I,p)},t.runWithPriority=function(g,I){var p=Kt;try{return Kt=g,I()}finally{Kt=p}},t.shouldError=function(){return null},t.shouldSuspend=function(){return!1},t.updateContainer=function(g,I,p,G){var w=I.current,W=Bi(),z=So(w);return p=qG(p),I.context===null?I.context=p:I.pendingContext=p,I=Tr(W,z),I.payload={element:g},G=G===void 0?null:G,G!==null&&(I.callback=G),Bo(w,I),g=Zs(w,z,W),g!==null&&aC(g,w,z),z},t};SW.exports=vL;var yL=SW.exports;const GL=Gb(yL);function WW(n,e,t=(i,s)=>i===s){if(n===e)return!0;if(!n||!e)return!1;const i=n.length;if(e.length!==i)return!1;for(let s=0;ss.response=r).then(()=>{i.lifespan&&i.lifespan>0&&setTimeout(()=>{const r=io.indexOf(s);r!==-1&&io.splice(r,1)},i.lifespan)}).catch(r=>s.error=r)};if(io.push(s),!t)throw s.promise}const BL=(n,e,t)=>VW(n,e,!1,t),ZL=(n,e,t)=>void VW(n,e,!0,t),wL=n=>{if(n===void 0||n.length===0)io.splice(0,io.length);else{const e=io.find(t=>WW(n,t.keys,t.equal));if(e){const t=io.indexOf(e);t!==-1&&io.splice(t,1)}}},oy={},MW=n=>void Object.assign(oy,n);function SL(n,e){function t(u,{args:C=[],attach:d,...h},m){let v=`${u[0].toUpperCase()}${u.slice(1)}`,y;if(u==="primitive"){if(h.object===void 0)throw new Error("R3F: Primitives without 'object' are invalid!");const A=h.object;y=Cg(A,{type:u,root:m,attach:d,primitive:!0})}else{const A=oy[v];if(!A)throw new Error(`R3F: ${v} is not part of the THREE namespace! Did you forget to extend? See: https://docs.pmnd.rs/react-three-fiber/api/objects#using-3rd-party-objects-declaratively`);if(!Array.isArray(C))throw new Error("R3F: The args prop must be an array!");y=Cg(new A(...C),{type:u,root:m,attach:d,memoizedProps:{args:C}})}return y.__r3f.attach===void 0&&(y instanceof ft?y.__r3f.attach="geometry":y instanceof _n&&(y.__r3f.attach="material")),v!=="inject"&&uf(y,h),y}function i(u,C){let d=!1;if(C){var h,m;(h=C.__r3f)!=null&&h.attach?If(u,C,C.__r3f.attach):C.isObject3D&&u.isObject3D&&(u.add(C),d=!0),d||(m=u.__r3f)==null||m.objects.push(C),C.__r3f||Cg(C,{}),C.__r3f.parent=u,cb(C),dg(C)}}function s(u,C,d){let h=!1;if(C){var m,v;if((m=C.__r3f)!=null&&m.attach)If(u,C,C.__r3f.attach);else if(C.isObject3D&&u.isObject3D){C.parent=u,C.dispatchEvent({type:"added"});const y=u.children.filter(b=>b!==C),A=y.indexOf(d);u.children=[...y.slice(0,A),C,...y.slice(A)],h=!0}h||(v=u.__r3f)==null||v.objects.push(C),C.__r3f||Cg(C,{}),C.__r3f.parent=u,cb(C),dg(C)}}function r(u,C,d=!1){u&&[...u].forEach(h=>o(C,h,d))}function o(u,C,d){if(C){var h,m,v;if(C.__r3f&&(C.__r3f.parent=null),(h=u.__r3f)!=null&&h.objects&&(u.__r3f.objects=u.__r3f.objects.filter(B=>B!==C)),(m=C.__r3f)!=null&&m.attach)LZ(u,C,C.__r3f.attach);else if(C.isObject3D&&u.isObject3D){var y;u.remove(C),(y=C.__r3f)!=null&&y.root&&HL(C.__r3f.root,C)}const b=(v=C.__r3f)==null?void 0:v.primitive,f=d===void 0?C.dispose!==null&&!b:d;if(!b){var A;r((A=C.__r3f)==null?void 0:A.objects,C,f),r(C.children,C,f)}C.__r3f&&(delete C.__r3f.root,delete C.__r3f.objects,delete C.__r3f.handlers,delete C.__r3f.memoizedProps,b||delete C.__r3f),f&&C.dispose&&C.type!=="Scene"&&lb.unstable_scheduleCallback(lb.unstable_IdlePriority,()=>{try{C.dispose()}catch{}}),dg(u)}}function a(u,C,d,h){var m;const v=(m=u.__r3f)==null?void 0:m.parent;if(!v)return;const y=t(C,d,u.__r3f.root);if(u.children){for(const A of u.children)A.__r3f&&i(y,A);u.children=u.children.filter(A=>!A.__r3f)}u.__r3f.objects.forEach(A=>i(y,A)),u.__r3f.objects=[],u.__r3f.autoRemovedBeforeAppend||o(v,u),y.parent&&(y.__r3f.autoRemovedBeforeAppend=!0),i(v,y),y.raycast&&y.__r3f.eventCount&&y.__r3f.root.getState().internal.interaction.push(y),[h,h.alternate].forEach(A=>{A!==null&&(A.stateNode=y,A.ref&&(typeof A.ref=="function"?A.ref(y):A.ref.current=y))})}const l=()=>console.warn("Text is not allowed in the R3F tree! This could be stray whitespace or characters.");return{reconciler:GL({createInstance:t,removeChild:o,appendChild:i,appendInitialChild:i,insertBefore:s,supportsMutation:!0,isPrimaryRenderer:!1,supportsPersistence:!1,supportsHydration:!1,noTimeout:-1,appendChildToContainer:(u,C)=>{if(!C)return;const d=u.getState().scene;d.__r3f&&(d.__r3f.root=u,i(d,C))},removeChildFromContainer:(u,C)=>{C&&o(u.getState().scene,C)},insertInContainerBefore:(u,C,d)=>{if(!C||!d)return;const h=u.getState().scene;h.__r3f&&s(h,C,d)},getRootHostContext:()=>null,getChildHostContext:u=>u,finalizeInitialChildren(u){var C;return!!((C=u?.__r3f)!=null?C:{}).handlers},prepareUpdate(u,C,d,h){if(u.__r3f.primitive&&h.object&&h.object!==u)return[!0];{const{args:m=[],children:v,...y}=h,{args:A=[],children:b,...f}=d;if(!Array.isArray(m))throw new Error("R3F: the args prop must be an array!");if(m.some((S,x)=>S!==A[x]))return[!0];const B=zW(u,y,f,!0);return B.changes.length?[!1,B]:null}},commitUpdate(u,[C,d],h,m,v,y){C?a(u,h,v,y):uf(u,d)},commitMount(u,C,d,h){var m;const v=(m=u.__r3f)!=null?m:{};u.raycast&&v.handlers&&v.eventCount&&u.__r3f.root.getState().internal.interaction.push(u)},getPublicInstance:u=>u,prepareForCommit:()=>null,preparePortalMount:u=>Cg(u.getState().scene),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance(u){var C;const{attach:d,parent:h}=(C=u.__r3f)!=null?C:{};d&&h&&LZ(h,u,d),u.isObject3D&&(u.visible=!1),dg(u)},unhideInstance(u,C){var d;const{attach:h,parent:m}=(d=u.__r3f)!=null?d:{};h&&m&&If(m,u,h),(u.isObject3D&&C.visible==null||C.visible)&&(u.visible=!0),dg(u)},createTextInstance:l,hideTextInstance:l,unhideTextInstance:l,getCurrentEventPriority:()=>e?e():Vg.DefaultEventPriority,beforeActiveInstanceBlur:()=>{},afterActiveInstanceBlur:()=>{},detachDeletedInstance:()=>{},now:typeof performance<"u"&&an.fun(performance.now)?performance.now:an.fun(Date.now)?Date.now:()=>0,scheduleTimeout:an.fun(setTimeout)?setTimeout:void 0,cancelTimeout:an.fun(clearTimeout)?clearTimeout:void 0}),applyProps:uf}}var YZ,FZ;const cf=n=>"colorSpace"in n||"outputColorSpace"in n,NW=()=>{var n;return(n=oy.ColorManagement)!=null?n:null},HW=n=>n&&n.isOrthographicCamera,xL=n=>n&&n.hasOwnProperty("current"),Cc=typeof window<"u"&&((YZ=window.document)!=null&&YZ.createElement||((FZ=window.navigator)==null?void 0:FZ.product)==="ReactNative")?U.useLayoutEffect:U.useEffect;function XW(n){const e=U.useRef(n);return Cc(()=>void(e.current=n),[n]),e}function RL({set:n}){return Cc(()=>(n(new Promise(()=>null)),()=>n(!1)),[n]),null}class YW extends U.Component{constructor(...e){super(...e),this.state={error:!1}}componentDidCatch(e){this.props.set(e)}render(){return this.state.error?null:this.props.children}}YW.getDerivedStateFromError=()=>({error:!0});const FW="__default",KZ=new Map,WL=n=>n&&!!n.memoized&&!!n.changes;function KW(n){var e;const t=typeof window<"u"?(e=window.devicePixelRatio)!=null?e:2:1;return Array.isArray(n)?Math.min(Math.max(n[0],t),n[1]):n}const nI=n=>{var e;return(e=n.__r3f)==null?void 0:e.root.getState()},an={obj:n=>n===Object(n)&&!an.arr(n)&&typeof n!="function",fun:n=>typeof n=="function",str:n=>typeof n=="string",num:n=>typeof n=="number",boo:n=>typeof n=="boolean",und:n=>n===void 0,arr:n=>Array.isArray(n),equ(n,e,{arrays:t="shallow",objects:i="reference",strict:s=!0}={}){if(typeof n!=typeof e||!!n!=!!e)return!1;if(an.str(n)||an.num(n))return n===e;const r=an.obj(n);if(r&&i==="reference")return n===e;const o=an.arr(n);if(o&&t==="reference")return n===e;if((o||r)&&n===e)return!0;let a;for(a in n)if(!(a in e))return!1;if(r&&t==="shallow"&&i==="shallow"){for(a in s?e:n)if(!an.equ(n[a],e[a],{strict:s,objects:"reference"}))return!1}else for(a in s?e:n)if(n[a]!==e[a])return!1;if(an.und(a)){if(o&&n.length===0&&e.length===0||r&&Object.keys(n).length===0&&Object.keys(e).length===0)return!0;if(n!==e)return!1}return!0}};function VL(n){const e={nodes:{},materials:{}};return n&&n.traverse(t=>{t.name&&(e.nodes[t.name]=t),t.material&&!e.materials[t.material.name]&&(e.materials[t.material.name]=t.material)}),e}function ML(n){n.dispose&&n.type!=="Scene"&&n.dispose();for(const e in n)e.dispose==null||e.dispose(),delete n[e]}function Cg(n,e){const t=n;return(e!=null&&e.primitive||!t.__r3f)&&(t.__r3f={type:"",root:null,previousAttach:null,memoizedProps:{},eventCount:0,handlers:{},objects:[],parent:null,...e}),n}function gb(n,e){let t=n;if(e.includes("-")){const i=e.split("-"),s=i.pop();return t=i.reduce((r,o)=>r[o],n),{target:t,key:s}}else return{target:t,key:e}}const zZ=/-\d+$/;function If(n,e,t){if(an.str(t)){if(zZ.test(t)){const r=t.replace(zZ,""),{target:o,key:a}=gb(n,r);Array.isArray(o[a])||(o[a]=[])}const{target:i,key:s}=gb(n,t);e.__r3f.previousAttach=i[s],i[s]=e}else e.__r3f.previousAttach=t(n,e)}function LZ(n,e,t){var i,s;if(an.str(t)){const{target:r,key:o}=gb(n,t),a=e.__r3f.previousAttach;a===void 0?delete r[o]:r[o]=a}else(i=e.__r3f)==null||i.previousAttach==null||i.previousAttach(n,e);(s=e.__r3f)==null||delete s.previousAttach}function zW(n,{children:e,key:t,ref:i,...s},{children:r,key:o,ref:a,...l}={},c=!1){var u;const C=(u=n?.__r3f)!=null?u:{},d=Object.entries(s),h=[];if(c){const v=Object.keys(l);for(let y=0;y{var A;if((A=n.__r3f)!=null&&A.primitive&&v==="object"||an.equ(y,l[v]))return;if(/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/.test(v))return h.push([v,y,!0,[]]);let b=[];v.includes("-")&&(b=v.split("-")),h.push([v,y,!1,b]);for(const f in s){const B=s[f];f.startsWith(`${v}-`)&&h.push([f,B,!1,f.split("-")])}});const m={...s};return C.memoizedProps&&C.memoizedProps.args&&(m.args=C.memoizedProps.args),C.memoizedProps&&C.memoizedProps.attach&&(m.attach=C.memoizedProps.attach),{memoized:m,changes:h}}function uf(n,e){var t,i,s;const r=(t=n.__r3f)!=null?t:{},o=r.root,a=(i=o==null||o.getState==null?void 0:o.getState())!=null?i:{},{memoized:l,changes:c}=WL(e)?e:zW(n,e),u=r.eventCount;n.__r3f&&(n.__r3f.memoizedProps=l);for(let d=0;df[B],n),!(b&&b.set))){const[f,...B]=y.reverse();A=B.reverse().reduce((S,x)=>S[x],n),h=f}if(m===FW+"remove")if(A.constructor){let f=KZ.get(A.constructor);f||(f=new A.constructor,KZ.set(A.constructor,f)),m=f[h]}else m=0;if(v)m?r.handlers[h]=m:delete r.handlers[h],r.eventCount=Object.keys(r.handlers).length;else if(b&&b.set&&(b.copy||b instanceof al)){if(Array.isArray(m))b.fromArray?b.fromArray(m):b.set(...m);else if(b.copy&&m&&m.constructor&&b.constructor===m.constructor)b.copy(m);else if(m!==void 0){const f=b instanceof Re;!f&&b.setScalar?b.setScalar(m):b instanceof al&&m instanceof al?b.mask=m.mask:b.set(m),!NW()&&!a.linear&&f&&b.convertSRGBToLinear()}}else if(A[h]=m,A[h]instanceof qt&&A[h].format===un&&A[h].type===rn){const f=A[h];cf(f)&&cf(a.gl)?f.colorSpace=a.gl.outputColorSpace:f.encoding=a.gl.outputEncoding}dg(n)}if(r.parent&&a.internal&&n.raycast&&u!==r.eventCount){const d=a.internal.interaction.indexOf(n);d>-1&&a.internal.interaction.splice(d,1),r.eventCount&&a.internal.interaction.push(n)}return!(c.length===1&&c[0][0]==="onUpdate")&&c.length&&(s=n.__r3f)!=null&&s.parent&&cb(n),n}function dg(n){var e,t;const i=(e=n.__r3f)==null||(t=e.root)==null||t.getState==null?void 0:t.getState();i&&i.internal.frames===0&&i.invalidate()}function cb(n){n.onUpdate==null||n.onUpdate(n)}function LW(n,e){n.manual||(HW(n)?(n.left=e.width/-2,n.right=e.width/2,n.top=e.height/2,n.bottom=e.height/-2):n.aspect=e.width/e.height,n.updateProjectionMatrix(),n.updateMatrixWorld())}function Od(n){return(n.eventObject||n.object).uuid+"/"+n.index+n.instanceId}function NL(){var n;const e=typeof self<"u"&&self||typeof window<"u"&&window;if(!e)return Vg.DefaultEventPriority;switch((n=e.event)==null?void 0:n.type){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return Vg.DiscreteEventPriority;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return Vg.ContinuousEventPriority;default:return Vg.DefaultEventPriority}}function TW(n,e,t,i){const s=t.get(e);s&&(t.delete(e),t.size===0&&(n.delete(i),s.target.releasePointerCapture(i)))}function HL(n,e){const{internal:t}=n.getState();t.interaction=t.interaction.filter(i=>i!==e),t.initialHits=t.initialHits.filter(i=>i!==e),t.hovered.forEach((i,s)=>{(i.eventObject===e||i.object===e)&&t.hovered.delete(s)}),t.capturedMap.forEach((i,s)=>{TW(t.capturedMap,e,i,s)})}function XL(n){function e(l){const{internal:c}=n.getState(),u=l.offsetX-c.initialClick[0],C=l.offsetY-c.initialClick[1];return Math.round(Math.sqrt(u*u+C*C))}function t(l){return l.filter(c=>["Move","Over","Enter","Out","Leave"].some(u=>{var C;return(C=c.__r3f)==null?void 0:C.handlers["onPointer"+u]}))}function i(l,c){const u=n.getState(),C=new Set,d=[],h=c?c(u.internal.interaction):u.internal.interaction;for(let A=0;A{const f=nI(A.object),B=nI(b.object);return!f||!B?A.distance-b.distance:B.events.priority-f.events.priority||A.distance-b.distance}).filter(A=>{const b=Od(A);return C.has(b)?!1:(C.add(b),!0)});u.events.filter&&(v=u.events.filter(v,u));for(const A of v){let b=A.object;for(;b;){var y;(y=b.__r3f)!=null&&y.eventCount&&d.push({...A,eventObject:b}),b=b.parent}}if("pointerId"in l&&u.internal.capturedMap.has(l.pointerId))for(let A of u.internal.capturedMap.get(l.pointerId).values())C.has(Od(A.intersection))||d.push(A.intersection);return d}function s(l,c,u,C){const d=n.getState();if(l.length){const h={stopped:!1};for(const m of l){const v=nI(m.object)||d,{raycaster:y,pointer:A,camera:b,internal:f}=v,B=new H(A.x,A.y,0).unproject(b),S=V=>{var N,D;return(N=(D=f.capturedMap.get(V))==null?void 0:D.has(m.eventObject))!=null?N:!1},x=V=>{const N={intersection:m,target:c.target};f.capturedMap.has(V)?f.capturedMap.get(V).set(m.eventObject,N):f.capturedMap.set(V,new Map([[m.eventObject,N]])),c.target.setPointerCapture(V)},R=V=>{const N=f.capturedMap.get(V);N&&TW(f.capturedMap,m.eventObject,N,V)};let M={};for(let V in c){let N=c[V];typeof N!="function"&&(M[V]=N)}let Z={...m,...M,pointer:A,intersections:l,stopped:h.stopped,delta:u,unprojectedPoint:B,ray:y.ray,camera:b,stopPropagation(){const V="pointerId"in c&&f.capturedMap.get(c.pointerId);if((!V||V.has(m.eventObject))&&(Z.stopped=h.stopped=!0,f.hovered.size&&Array.from(f.hovered.values()).find(N=>N.eventObject===m.eventObject))){const N=l.slice(0,l.indexOf(m));r([...N,m])}},target:{hasPointerCapture:S,setPointerCapture:x,releasePointerCapture:R},currentTarget:{hasPointerCapture:S,setPointerCapture:x,releasePointerCapture:R},nativeEvent:c};if(C(Z),h.stopped===!0)break}}return l}function r(l){const{internal:c}=n.getState();for(const u of c.hovered.values())if(!l.length||!l.find(C=>C.object===u.object&&C.index===u.index&&C.instanceId===u.instanceId)){const d=u.eventObject.__r3f,h=d?.handlers;if(c.hovered.delete(Od(u)),d!=null&&d.eventCount){const m={...u,intersections:l};h.onPointerOut==null||h.onPointerOut(m),h.onPointerLeave==null||h.onPointerLeave(m)}}}function o(l,c){for(let u=0;ur([]);case"onLostPointerCapture":return c=>{const{internal:u}=n.getState();"pointerId"in c&&u.capturedMap.has(c.pointerId)&&requestAnimationFrame(()=>{u.capturedMap.has(c.pointerId)&&(u.capturedMap.delete(c.pointerId),r([]))})}}return function(u){const{onPointerMissed:C,internal:d}=n.getState();d.lastEvent.current=u;const h=l==="onPointerMove",m=l==="onClick"||l==="onContextMenu"||l==="onDoubleClick",y=i(u,h?t:void 0),A=m?e(u):0;l==="onPointerDown"&&(d.initialClick=[u.offsetX,u.offsetY],d.initialHits=y.map(f=>f.eventObject)),m&&!y.length&&A<=2&&(o(u,d.interaction),C&&C(u)),h&&r(y);function b(f){const B=f.eventObject,S=B.__r3f,x=S?.handlers;if(S!=null&&S.eventCount)if(h){if(x.onPointerOver||x.onPointerEnter||x.onPointerOut||x.onPointerLeave){const R=Od(f),M=d.hovered.get(R);M?M.stopped&&f.stopPropagation():(d.hovered.set(R,f),x.onPointerOver==null||x.onPointerOver(f),x.onPointerEnter==null||x.onPointerEnter(f))}x.onPointerMove==null||x.onPointerMove(f)}else{const R=x[l];R?(!m||d.initialHits.includes(B))&&(o(u,d.interaction.filter(M=>!d.initialHits.includes(M))),R(f)):m&&d.initialHits.includes(B)&&o(u,d.interaction.filter(M=>!d.initialHits.includes(M)))}}s(y,u,A,b)}}return{handlePointer:a}}const YL=["set","get","setSize","setFrameloop","setDpr","events","invalidate","advance","size","viewport"],EW=n=>!!(n!=null&&n.render),ay=U.createContext(null),FL=(n,e)=>{const t=wW((a,l)=>{const c=new H,u=new H,C=new H;function d(A=l().camera,b=u,f=l().size){const{width:B,height:S,top:x,left:R}=f,M=B/S;b instanceof H?C.copy(b):C.set(...b);const Z=A.getWorldPosition(c).distanceTo(C);if(HW(A))return{width:B/A.zoom,height:S/A.zoom,top:x,left:R,factor:1,distance:Z,aspect:M};{const V=A.fov*Math.PI/180,N=2*Math.tan(V/2)*Z,D=N*(B/S);return{width:D,height:N,top:x,left:R,factor:B/D,distance:Z,aspect:M}}}let h;const m=A=>a(b=>({performance:{...b.performance,current:A}})),v=new ne;return{set:a,get:l,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},xr:null,scene:null,invalidate:(A=1)=>n(l(),A),advance:(A,b)=>e(A,b,l()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new ny,pointer:v,mouse:v,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{const A=l();h&&clearTimeout(h),A.performance.current!==A.performance.min&&m(A.performance.min),h=setTimeout(()=>m(l().performance.max),A.performance.debounce)}},size:{width:0,height:0,top:0,left:0,updateStyle:!1},viewport:{initialDpr:0,dpr:0,width:0,height:0,top:0,left:0,aspect:0,distance:0,factor:0,getCurrentViewport:d},setEvents:A=>a(b=>({...b,events:{...b.events,...A}})),setSize:(A,b,f,B,S)=>{const x=l().camera,R={width:A,height:b,top:B||0,left:S||0,updateStyle:f};a(M=>({size:R,viewport:{...M.viewport,...d(x,u,R)}}))},setDpr:A=>a(b=>{const f=KW(A);return{viewport:{...b.viewport,dpr:f,initialDpr:b.viewport.initialDpr||f}}}),setFrameloop:(A="always")=>{const b=l().clock;b.stop(),b.elapsedTime=0,A!=="never"&&(b.start(),b.elapsedTime=0),a(()=>({frameloop:A}))},previousRoot:void 0,internal:{active:!1,priority:0,frames:0,lastEvent:U.createRef(),interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,subscribe:(A,b,f)=>{const B=l().internal;return B.priority=B.priority+(b>0?1:0),B.subscribers.push({ref:A,priority:b,store:f}),B.subscribers=B.subscribers.sort((S,x)=>S.priority-x.priority),()=>{const S=l().internal;S!=null&&S.subscribers&&(S.priority=S.priority-(b>0?1:0),S.subscribers=S.subscribers.filter(x=>x.ref!==A))}}}}}),i=t.getState();let s=i.size,r=i.viewport.dpr,o=i.camera;return t.subscribe(()=>{const{camera:a,size:l,viewport:c,gl:u,set:C}=t.getState();if(l!==s||c.dpr!==r){var d;s=l,r=c.dpr,LW(a,l),u.setPixelRatio(c.dpr);const h=(d=l.updateStyle)!=null?d:typeof HTMLCanvasElement<"u"&&u.domElement instanceof HTMLCanvasElement;u.setSize(l.width,l.height,h)}a!==o&&(o=a,C(h=>({viewport:{...h.viewport,...h.viewport.getCurrentViewport(a)}})))}),t.subscribe(a=>n(a)),t};let Qd,KL=new Set,zL=new Set,LL=new Set;function Cf(n,e){if(n.size)for(const{callback:t}of n.values())t(e)}function iI(n,e){switch(n){case"before":return Cf(KL,e);case"after":return Cf(zL,e);case"tail":return Cf(LL,e)}}let df,hf;function Af(n,e,t){let i=e.clock.getDelta();for(e.frameloop==="never"&&typeof n=="number"&&(i=n-e.clock.elapsedTime,e.clock.oldTime=e.clock.elapsedTime,e.clock.elapsedTime=n),df=e.internal.subscribers,Qd=0;Qd0)&&!((c=s.gl.xr)!=null&&c.isPresenting)&&(t+=Af(l,s))}if(iI("after",l),t===0)return iI("tail",l),e=!1,cancelAnimationFrame(i)}function o(l,c=1){var u;if(!l)return n.forEach(C=>o(C.store.getState()),c);(u=l.gl.xr)!=null&&u.isPresenting||!l.internal.active||l.frameloop==="never"||(l.internal.frames=Math.min(60,l.internal.frames+c),e||(e=!0,requestAnimationFrame(r)))}function a(l,c=!0,u,C){if(c&&iI("before",l),u)Af(l,u,C);else for(const d of n.values())Af(l,d.store.getState());c&&iI("after",l)}return{loop:r,invalidate:o,advance:a}}function EL(n){const e=U.useRef(null);return Cc(()=>void(e.current=n.current.__r3f),[n]),e}function ly(){const n=U.useContext(ay);if(!n)throw new Error("R3F: Hooks can only be used within the Canvas component!");return n}function $i(n=t=>t,e){return ly()(n,e)}function _u(n,e=0){const t=ly(),i=t.getState().internal.subscribe,s=XW(n);return Cc(()=>i(s,e,t),[e,i,t]),null}function kW(n,e){return function(t,...i){const s=new t;return n&&n(s),Promise.all(i.map(r=>new Promise((o,a)=>s.load(r,l=>{l.scene&&Object.assign(l,VL(l.scene)),o(l)},e,l=>a(new Error(`Could not load ${r}: ${l.message})`))))))}}function gy(n,e,t,i){const s=Array.isArray(e)?e:[e],r=BL(kW(t,i),[n,...s],{equal:an.equ});return Array.isArray(e)?r:r[0]}gy.preload=function(n,e,t){const i=Array.isArray(e)?e:[e];return ZL(kW(t),[n,...i])};gy.clear=function(n,e){const t=Array.isArray(e)?e:[e];return wL([n,...t])};const tc=new Map,{invalidate:TZ,advance:EZ}=TL(tc),{reconciler:yu,applyProps:Ta}=SL(tc,NL),cg={objects:"shallow",strict:!1},kL=(n,e)=>{const t=typeof n=="function"?n(e):n;return EW(t)?t:new Kv({powerPreference:"high-performance",canvas:e,antialias:!0,alpha:!0,...n})};function DL(n,e){if(e)return e;if(typeof HTMLCanvasElement<"u"&&n instanceof HTMLCanvasElement&&n.parentElement){const{width:t,height:i,top:s,left:r}=n.parentElement.getBoundingClientRect();return{width:t,height:i,top:s,left:r}}else if(typeof OffscreenCanvas<"u"&&n instanceof OffscreenCanvas)return{width:n.width,height:n.height,top:0,left:0};return{width:0,height:0,top:0,left:0}}function UL(n){const e=tc.get(n),t=e?.fiber,i=e?.store;e&&console.warn("R3F.createRoot should only be called once!");const s=typeof reportError=="function"?reportError:console.error,r=i||FL(TZ,EZ),o=t||yu.createContainer(r,Vg.ConcurrentRoot,null,!1,null,"",s,null);e||tc.set(n,{fiber:o,store:r});let a,l=!1,c;return{configure(u={}){let{gl:C,size:d,scene:h,events:m,onCreated:v,shadows:y=!1,linear:A=!1,flat:b=!1,legacy:f=!1,orthographic:B=!1,frameloop:S="always",dpr:x=[1,2],performance:R,raycaster:M,camera:Z,onPointerMissed:V}=u,N=r.getState(),D=N.gl;N.gl||N.set({gl:D=kL(C,n)});let k=N.raycaster;k||N.set({raycaster:k=new ry});const{params:$,...te}=M||{};if(an.equ(te,k,cg)||Ta(k,{...te}),an.equ($,k.params,cg)||Ta(k,{params:{...k.params,...$}}),!N.camera||N.camera===c&&!an.equ(c,Z,cg)){c=Z;const ce=Z instanceof ac,se=ce?Z:B?new lc(0,0,0,0,.1,1e3):new An(75,0,.1,1e3);ce||(se.position.z=5,Z&&Ta(se,Z),!N.camera&&!(Z!=null&&Z.rotation)&&se.lookAt(0,0,0)),N.set({camera:se})}if(!N.scene){let ce;h instanceof dl?ce=h:(ce=new dl,h&&Ta(ce,h)),N.set({scene:Cg(ce)})}if(!N.xr){const ce=(re,ve)=>{const ye=r.getState();ye.frameloop!=="never"&&EZ(re,!0,ye,ve)},se=()=>{const re=r.getState();re.gl.xr.enabled=re.gl.xr.isPresenting,re.gl.xr.setAnimationLoop(re.gl.xr.isPresenting?ce:null),re.gl.xr.isPresenting||TZ(re)},ee={connect(){const re=r.getState().gl;re.xr.addEventListener("sessionstart",se),re.xr.addEventListener("sessionend",se)},disconnect(){const re=r.getState().gl;re.xr.removeEventListener("sessionstart",se),re.xr.removeEventListener("sessionend",se)}};D.xr&&ee.connect(),N.set({xr:ee})}if(D.shadowMap){const ce=D.shadowMap.enabled,se=D.shadowMap.type;if(D.shadowMap.enabled=!!y,an.boo(y))D.shadowMap.type=VI;else if(an.str(y)){var Ce;const ee={basic:HR,percentage:SA,soft:VI,variance:ir};D.shadowMap.type=(Ce=ee[y])!=null?Ce:VI}else an.obj(y)&&Object.assign(D.shadowMap,y);(ce!==D.shadowMap.enabled||se!==D.shadowMap.type)&&(D.shadowMap.needsUpdate=!0)}const le=NW();le&&("enabled"in le?le.enabled=!f:"legacyMode"in le&&(le.legacyMode=f)),Ta(D,{outputEncoding:A?3e3:3001,toneMapping:b?gr:Bv}),N.legacy!==f&&N.set(()=>({legacy:f})),N.linear!==A&&N.set(()=>({linear:A})),N.flat!==b&&N.set(()=>({flat:b})),C&&!an.fun(C)&&!EW(C)&&!an.equ(C,D,cg)&&Ta(D,C),m&&!N.events.handlers&&N.set({events:m(r)});const P=DL(n,d);return an.equ(P,N.size,cg)||N.setSize(P.width,P.height,P.updateStyle,P.top,P.left),x&&N.viewport.dpr!==KW(x)&&N.setDpr(x),N.frameloop!==S&&N.setFrameloop(S),N.onPointerMissed||N.set({onPointerMissed:V}),R&&!an.equ(R,N.performance,cg)&&N.set(ce=>({performance:{...ce.performance,...R}})),a=v,l=!0,this},render(u){return l||this.configure(),yu.updateContainer(U.createElement(PL,{store:r,children:u,onCreated:a,rootElement:n}),o,null,()=>{}),r},unmount(){DW(n)}}}function PL({store:n,children:e,onCreated:t,rootElement:i}){return Cc(()=>{const s=n.getState();s.set(r=>({internal:{...r.internal,active:!0}})),t&&t(s),n.getState().events.connected||s.events.connect==null||s.events.connect(i)},[]),U.createElement(ay.Provider,{value:n},e)}function DW(n,e){const t=tc.get(n),i=t?.fiber;if(i){const s=t?.store.getState();s&&(s.internal.active=!1),yu.updateContainer(null,i,null,()=>{s&&setTimeout(()=>{try{var r,o,a,l;s.events.disconnect==null||s.events.disconnect(),(r=s.gl)==null||(o=r.renderLists)==null||o.dispose==null||o.dispose(),(a=s.gl)==null||a.forceContextLoss==null||a.forceContextLoss(),(l=s.gl)!=null&&l.xr&&s.xr.disconnect(),ML(s),tc.delete(n),e&&e(n)}catch{}},500)})}}function _L(n,e,t){return U.createElement(JL,{key:e.uuid,children:n,container:e,state:t})}function JL({state:n={},children:e,container:t}){const{events:i,size:s,...r}=n,o=ly(),[a]=U.useState(()=>new ry),[l]=U.useState(()=>new ne),c=U.useCallback((C,d)=>{const h={...C};Object.keys(C).forEach(v=>{(YL.includes(v)||C[v]!==d[v]&&d[v])&&delete h[v]});let m;if(d&&s){const v=d.camera;m=C.viewport.getCurrentViewport(v,new H,s),v!==C.camera&&LW(v,s)}return{...h,scene:t,raycaster:a,pointer:l,mouse:l,previousRoot:o,events:{...C.events,...d?.events,...i},size:{...C.size,...s},viewport:{...C.viewport,...m},...r}},[n]),[u]=U.useState(()=>{const C=o.getState();return wW((h,m)=>({...C,scene:t,raycaster:a,pointer:l,mouse:l,previousRoot:o,events:{...C.events,...i},size:{...C.size,...s},...r,set:h,get:m,setEvents:v=>h(y=>({...y,events:{...y.events,...v}}))}))});return U.useEffect(()=>{const C=o.subscribe(d=>u.setState(h=>c(d,h)));return()=>{C(),u.destroy()}},[]),U.useEffect(()=>{u.setState(C=>c(o.getState(),C))},[c]),U.createElement(U.Fragment,null,yu.createPortal(U.createElement(ay.Provider,{value:u},e),u,null))}yu.injectIntoDevTools({bundleType:0,rendererPackageName:"@react-three/fiber",version:U.version});function lA(){return lA=Object.assign?Object.assign.bind():function(n){for(var e=1;e=0?i=setTimeout(l,e-u):(i=null,t||(a=n.apply(r,s),r=s=null))}var c=function(){r=this,s=arguments,o=Date.now();var u=t&&!i;return i||(i=setTimeout(l,e)),u&&(a=n.apply(r,s),r=s=null),a};return c.clear=function(){i&&(clearTimeout(i),i=null)},c.flush=function(){i&&(a=n.apply(r,s),r=s=null,clearTimeout(i),i=null)},c}Ib.debounce=Ib;var OL=Ib;const kZ=Gb(OL);function QL(n){let{debounce:e,scroll:t,polyfill:i,offsetSize:s}=n===void 0?{debounce:0,scroll:!1,offsetSize:!1}:n;const r=i||(typeof window>"u"?class{}:window.ResizeObserver);if(!r)throw new Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");const[o,a]=U.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),l=U.useRef({element:null,scrollContainers:null,resizeObserver:null,lastBounds:o}),c=e?typeof e=="number"?e:e.scroll:null,u=e?typeof e=="number"?e:e.resize:null,C=U.useRef(!1);U.useEffect(()=>(C.current=!0,()=>void(C.current=!1)));const[d,h,m]=U.useMemo(()=>{const b=()=>{if(!l.current.element)return;const{left:f,top:B,width:S,height:x,bottom:R,right:M,x:Z,y:V}=l.current.element.getBoundingClientRect(),N={left:f,top:B,width:S,height:x,bottom:R,right:M,x:Z,y:V};l.current.element instanceof HTMLElement&&s&&(N.height=l.current.element.offsetHeight,N.width=l.current.element.offsetWidth),Object.freeze(N),C.current&&!eT(l.current.lastBounds,N)&&a(l.current.lastBounds=N)};return[b,u?kZ(b,u):b,c?kZ(b,c):b]},[a,s,c,u]);function v(){l.current.scrollContainers&&(l.current.scrollContainers.forEach(b=>b.removeEventListener("scroll",m,!0)),l.current.scrollContainers=null),l.current.resizeObserver&&(l.current.resizeObserver.disconnect(),l.current.resizeObserver=null)}function y(){l.current.element&&(l.current.resizeObserver=new r(m),l.current.resizeObserver.observe(l.current.element),t&&l.current.scrollContainers&&l.current.scrollContainers.forEach(b=>b.addEventListener("scroll",m,{capture:!0,passive:!0})))}const A=b=>{!b||b===l.current.element||(v(),l.current.element=b,l.current.scrollContainers=UW(b),y())};return qL(m,!!t),jL(h),U.useEffect(()=>{v(),y()},[t,m,h]),U.useEffect(()=>v,[]),[A,o,d]}function jL(n){U.useEffect(()=>{const e=n;return window.addEventListener("resize",e),()=>void window.removeEventListener("resize",e)},[n])}function qL(n,e){U.useEffect(()=>{if(e){const t=n;return window.addEventListener("scroll",t,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",t,!0)}},[n,e])}function UW(n){const e=[];if(!n||n===document.body)return e;const{overflow:t,overflowX:i,overflowY:s}=window.getComputedStyle(n);return[t,i,s].some(r=>r==="auto"||r==="scroll")&&e.push(n),[...e,...UW(n.parentElement)]}const $L=["x","y","top","bottom","left","right","width","height"],eT=(n,e)=>$L.every(t=>n[t]===e[t]);var tT=Object.defineProperty,nT=Object.defineProperties,iT=Object.getOwnPropertyDescriptors,DZ=Object.getOwnPropertySymbols,sT=Object.prototype.hasOwnProperty,rT=Object.prototype.propertyIsEnumerable,UZ=(n,e,t)=>e in n?tT(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,PZ=(n,e)=>{for(var t in e||(e={}))sT.call(e,t)&&UZ(n,t,e[t]);if(DZ)for(var t of DZ(e))rT.call(e,t)&&UZ(n,t,e[t]);return n},oT=(n,e)=>nT(n,iT(e));function PW(n,e,t){if(!n)return;if(t(n)===!0)return n;let i=e?n.return:n.child;for(;i;){const s=PW(i,e,t);if(s)return s;i=e?null:i.sibling}}function _W(n){try{return Object.defineProperties(n,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return n}}const cy=_W(U.createContext(null));class JW extends U.Component{render(){return U.createElement(cy.Provider,{value:this._reactInternals},this.props.children)}}const{ReactCurrentOwner:_Z,ReactCurrentDispatcher:JZ}=U.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function aT(){const n=U.useContext(cy);if(n===null)throw new Error("its-fine: useFiber must be called within a !");const e=U.useId();return U.useMemo(()=>{for(const i of[_Z?.current,n,n?.alternate]){if(!i)continue;const s=PW(i,!1,r=>{let o=r.memoizedState;for(;o;){if(o.memoizedState===e)return!0;o=o.next}});if(s)return s}},[n,e])}function lT(){var n,e;const t=aT(),[i]=U.useState(()=>new Map);i.clear();let s=t;for(;s;){const r=(n=s.type)==null?void 0:n._context;r&&r!==cy&&!i.has(r)&&i.set(r,(e=JZ?.current)==null?void 0:e.readContext(_W(r))),s=s.return}return i}function gT(){const n=lT();return U.useMemo(()=>Array.from(n.keys()).reduce((e,t)=>i=>U.createElement(e,null,U.createElement(t.Provider,oT(PZ({},i),{value:n.get(t)}))),e=>U.createElement(JW,PZ({},e))),[n])}const pf={onClick:["click",!1],onContextMenu:["contextmenu",!1],onDoubleClick:["dblclick",!1],onWheel:["wheel",!0],onPointerDown:["pointerdown",!0],onPointerUp:["pointerup",!0],onPointerLeave:["pointerleave",!0],onPointerMove:["pointermove",!0],onPointerCancel:["pointercancel",!0],onLostPointerCapture:["lostpointercapture",!0]};function cT(n){const{handlePointer:e}=XL(n);return{priority:1,enabled:!0,compute(t,i,s){i.pointer.set(t.offsetX/i.size.width*2-1,-(t.offsetY/i.size.height)*2+1),i.raycaster.setFromCamera(i.pointer,i.camera)},connected:void 0,handlers:Object.keys(pf).reduce((t,i)=>({...t,[i]:e(i)}),{}),update:()=>{var t;const{events:i,internal:s}=n.getState();(t=s.lastEvent)!=null&&t.current&&i.handlers&&i.handlers.onPointerMove(s.lastEvent.current)},connect:t=>{var i;const{set:s,events:r}=n.getState();r.disconnect==null||r.disconnect(),s(o=>({events:{...o.events,connected:t}})),Object.entries((i=r.handlers)!=null?i:[]).forEach(([o,a])=>{const[l,c]=pf[o];t.addEventListener(l,a,{passive:c})})},disconnect:()=>{const{set:t,events:i}=n.getState();if(i.connected){var s;Object.entries((s=i.handlers)!=null?s:[]).forEach(([r,o])=>{if(i&&i.connected instanceof HTMLElement){const[a]=pf[r];i.connected.removeEventListener(a,o)}}),t(r=>({events:{...r.events,connected:void 0}}))}}}}const IT=U.forwardRef(function({children:e,fallback:t,resize:i,style:s,gl:r,events:o=cT,eventSource:a,eventPrefix:l,shadows:c,linear:u,flat:C,legacy:d,orthographic:h,frameloop:m,dpr:v,performance:y,raycaster:A,camera:b,onPointerMissed:f,onCreated:B,...S},x){U.useMemo(()=>MW(mL),[]);const R=gT(),[M,Z]=QL({scroll:!0,debounce:{scroll:50,resize:0},...i}),V=U.useRef(null),N=U.useRef(null);U.useImperativeHandle(x,()=>V.current);const D=XW(f),[k,$]=U.useState(!1),[te,Ce]=U.useState(!1);if(k)throw k;if(te)throw te;const le=U.useRef(null);Cc(()=>{const J=V.current;Z.width>0&&Z.height>0&&J&&(le.current||(le.current=UL(J)),le.current.configure({gl:r,events:o,shadows:c,linear:u,flat:C,legacy:d,orthographic:h,frameloop:m,dpr:v,performance:y,raycaster:A,camera:b,size:Z,onPointerMissed:(...P)=>D.current==null?void 0:D.current(...P),onCreated:P=>{P.events.connect==null||P.events.connect(a?xL(a)?a.current:a:N.current),l&&P.setEvents({compute:(ce,se)=>{const ee=ce[l+"X"],re=ce[l+"Y"];se.pointer.set(ee/se.size.width*2-1,-(re/se.size.height)*2+1),se.raycaster.setFromCamera(se.pointer,se.camera)}}),B?.(P)}}),le.current.render(U.createElement(R,null,U.createElement(YW,{set:Ce},U.createElement(U.Suspense,{fallback:U.createElement(RL,{set:$})},e)))))}),U.useEffect(()=>{const J=V.current;if(J)return()=>DW(J)},[]);const L=a?"none":"auto";return U.createElement("div",lA({ref:N,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:L,...s}},S),U.createElement("div",{ref:M,style:{width:"100%",height:"100%"}},U.createElement("canvas",{ref:V,style:{display:"block"}},t)))}),uT=U.forwardRef(function(e,t){return U.createElement(JW,null,U.createElement(IT,lA({},e,{ref:t})))});var Iy={exports:{}},Eg=typeof Reflect=="object"?Reflect:null,OZ=Eg&&typeof Eg.apply=="function"?Eg.apply:function(e,t,i){return Function.prototype.apply.call(e,t,i)},Wh;Eg&&typeof Eg.ownKeys=="function"?Wh=Eg.ownKeys:Object.getOwnPropertySymbols?Wh=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Wh=function(e){return Object.getOwnPropertyNames(e)};function CT(n){console&&console.warn&&console.warn(n)}var OW=Number.isNaN||function(e){return e!==e};function $t(){$t.init.call(this)}Iy.exports=$t;Iy.exports.once=pT;$t.EventEmitter=$t;$t.prototype._events=void 0;$t.prototype._eventsCount=0;$t.prototype._maxListeners=void 0;var QZ=10;function OA(n){if(typeof n!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof n)}Object.defineProperty($t,"defaultMaxListeners",{enumerable:!0,get:function(){return QZ},set:function(n){if(typeof n!="number"||n<0||OW(n))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+n+".");QZ=n}});$t.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};$t.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||OW(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function QW(n){return n._maxListeners===void 0?$t.defaultMaxListeners:n._maxListeners}$t.prototype.getMaxListeners=function(){return QW(this)};$t.prototype.emit=function(e){for(var t=[],i=1;i0&&(o=t[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var l=r[e];if(l===void 0)return!1;if(typeof l=="function")OZ(l,this,t);else for(var c=l.length,u=tV(l,c),i=0;i0&&o.length>s&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=n,a.type=e,a.count=o.length,CT(a)}return n}$t.prototype.addListener=function(e,t){return jW(this,e,t,!1)};$t.prototype.on=$t.prototype.addListener;$t.prototype.prependListener=function(e,t){return jW(this,e,t,!0)};function dT(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function qW(n,e,t){var i={fired:!1,wrapFn:void 0,target:n,type:e,listener:t},s=dT.bind(i);return s.listener=t,i.wrapFn=s,s}$t.prototype.once=function(e,t){return OA(t),this.on(e,qW(this,e,t)),this};$t.prototype.prependOnceListener=function(e,t){return OA(t),this.prependListener(e,qW(this,e,t)),this};$t.prototype.removeListener=function(e,t){var i,s,r,o,a;if(OA(t),s=this._events,s===void 0)return this;if(i=s[e],i===void 0)return this;if(i===t||i.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete s[e],s.removeListener&&this.emit("removeListener",e,i.listener||t));else if(typeof i!="function"){for(r=-1,o=i.length-1;o>=0;o--)if(i[o]===t||i[o].listener===t){a=i[o].listener,r=o;break}if(r<0)return this;r===0?i.shift():hT(i,r),i.length===1&&(s[e]=i[0]),s.removeListener!==void 0&&this.emit("removeListener",e,a||t)}return this};$t.prototype.off=$t.prototype.removeListener;$t.prototype.removeAllListeners=function(e){var t,i,s;if(i=this._events,i===void 0)return this;if(i.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):i[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete i[e]),this;if(arguments.length===0){var r=Object.keys(i),o;for(s=0;s=0;s--)this.removeListener(e,t[s]);return this};function $W(n,e,t){var i=n._events;if(i===void 0)return[];var s=i[e];return s===void 0?[]:typeof s=="function"?t?[s.listener||s]:[s]:t?AT(s):tV(s,s.length)}$t.prototype.listeners=function(e){return $W(this,e,!0)};$t.prototype.rawListeners=function(e){return $W(this,e,!1)};$t.listenerCount=function(n,e){return typeof n.listenerCount=="function"?n.listenerCount(e):eV.call(n,e)};$t.prototype.listenerCount=eV;function eV(n){var e=this._events;if(e!==void 0){var t=e[n];if(typeof t=="function")return 1;if(t!==void 0)return t.length}return 0}$t.prototype.eventNames=function(){return this._eventsCount>0?Wh(this._events):[]};function tV(n,e){for(var t=new Array(e),i=0;i{if(e.data.op==="frame"){this.buffers.positions=e.data.positions,this.buffers.quaternions=e.data.quaternions,this.emit(e.data.op,e.data);return}this.emit(e.data.type,e.data)};for(const e of this.messageQueue)this.worker.postMessage(e);this.messageQueue.length=0}disableConstraint(e){let{uuid:t}=e;this.postMessage({op:"disableConstraint",uuid:t})}disableConstraintMotor(e){let{uuid:t}=e;this.postMessage({op:"disableConstraintMotor",uuid:t})}disconnect(){this.worker&&(this.worker.onmessage=null)}enableConstraint(e){let{uuid:t}=e;this.postMessage({op:"enableConstraint",uuid:t})}enableConstraintMotor(e){let{uuid:t}=e;this.postMessage({op:"enableConstraintMotor",uuid:t})}init(){const{allowSleep:e,axisIndex:t,broadphase:i,defaultContactMaterial:s,frictionGravity:r,gravity:o,iterations:a,quatNormalizeFast:l,quatNormalizeSkip:c,solver:u,tolerance:C}=this.config;this.postMessage({op:"init",props:{allowSleep:e,axisIndex:t,broadphase:i,defaultContactMaterial:s,frictionGravity:r,gravity:o,iterations:a,quatNormalizeFast:l,quatNormalizeSkip:c,solver:u,tolerance:C}})}removeBodies(e){let{uuid:t}=e;this.postMessage({op:"removeBodies",uuid:t})}removeConstraint(e){let{uuid:t}=e;this.postMessage({op:"removeConstraint",uuid:t})}removeContactMaterial(e){let{uuid:t}=e;this.postMessage({op:"removeContactMaterial",uuid:t})}removeRay(e){let{uuid:t}=e;this.postMessage({op:"removeRay",uuid:t})}removeRaycastVehicle(e){let{uuid:t}=e;this.postMessage({op:"removeRaycastVehicle",uuid:t})}removeSpring(e){let{uuid:t}=e;this.postMessage({op:"removeSpring",uuid:t})}setAllowSleep(e){let{props:t,uuid:i}=e;this.postMessage({op:"setAllowSleep",props:t,uuid:i})}setAngularDamping(e){let{props:t,uuid:i}=e;this.postMessage({op:"setAngularDamping",props:t,uuid:i})}setAngularFactor(e){let{props:t,uuid:i}=e;this.postMessage({op:"setAngularFactor",props:t,uuid:i})}setAngularVelocity(e){let{props:t,uuid:i}=e;this.postMessage({op:"setAngularVelocity",props:t,uuid:i})}setCollisionFilterGroup(e){let{props:t,uuid:i}=e;this.postMessage({op:"setCollisionFilterGroup",props:t,uuid:i})}setCollisionFilterMask(e){let{props:t,uuid:i}=e;this.postMessage({op:"setCollisionFilterMask",props:t,uuid:i})}setCollisionResponse(e){let{props:t,uuid:i}=e;this.postMessage({op:"setCollisionResponse",props:t,uuid:i})}setConstraintMotorMaxForce(e){let{props:t,uuid:i}=e;this.postMessage({op:"setConstraintMotorMaxForce",props:t,uuid:i})}setConstraintMotorSpeed(e){let{props:t,uuid:i}=e;this.postMessage({op:"setConstraintMotorSpeed",props:t,uuid:i})}setFixedRotation(e){let{props:t,uuid:i}=e;this.postMessage({op:"setFixedRotation",props:t,uuid:i})}setIsTrigger(e){let{props:t,uuid:i}=e;this.postMessage({op:"setIsTrigger",props:t,uuid:i})}setLinearDamping(e){let{props:t,uuid:i}=e;this.postMessage({op:"setLinearDamping",props:t,uuid:i})}setLinearFactor(e){let{props:t,uuid:i}=e;this.postMessage({op:"setLinearFactor",props:t,uuid:i})}setMass(e){let{props:t,uuid:i}=e;this.postMessage({op:"setMass",props:t,uuid:i})}setMaterial(e){let{props:t,uuid:i}=e;this.postMessage({op:"setMaterial",props:t,uuid:i})}setPosition(e){let{props:t,uuid:i}=e;this.postMessage({op:"setPosition",props:t,uuid:i})}setQuaternion(e){let{props:[t,i,s,r],uuid:o}=e;this.postMessage({op:"setQuaternion",props:[t,i,s,r],uuid:o})}setRaycastVehicleBrake(e){let{props:t,uuid:i}=e;this.postMessage({op:"setRaycastVehicleBrake",props:t,uuid:i})}setRaycastVehicleSteeringValue(e){let{props:t,uuid:i}=e;this.postMessage({op:"setRaycastVehicleSteeringValue",props:t,uuid:i})}setRotation(e){let{props:t,uuid:i}=e;this.postMessage({op:"setRotation",props:t,uuid:i})}setSleepSpeedLimit(e){let{props:t,uuid:i}=e;this.postMessage({op:"setSleepSpeedLimit",props:t,uuid:i})}setSleepTimeLimit(e){let{props:t,uuid:i}=e;this.postMessage({op:"setSleepTimeLimit",props:t,uuid:i})}setSpringDamping(e){let{props:t,uuid:i}=e;this.postMessage({op:"setSpringDamping",props:t,uuid:i})}setSpringRestLength(e){let{props:t,uuid:i}=e;this.postMessage({op:"setSpringRestLength",props:t,uuid:i})}setSpringStiffness(e){let{props:t,uuid:i}=e;this.postMessage({op:"setSpringStiffness",props:t,uuid:i})}setUserData(e){let{props:t,uuid:i}=e;this.postMessage({op:"setUserData",props:t,uuid:i})}setVelocity(e){let{props:t,uuid:i}=e;this.postMessage({op:"setVelocity",props:t,uuid:i})}sleep(e){let{uuid:t}=e;this.postMessage({op:"sleep",uuid:t})}step(e){var t;const{buffers:{positions:i,quaternions:s}}=this;!i.byteLength&&!s.byteLength||(t=this.worker)==null||t.postMessage({op:"step",positions:i,props:e,quaternions:s},[i.buffer,s.buffer])}subscribe(e){let{props:{id:t,target:i,type:s},uuid:r}=e;this.postMessage({op:"subscribe",props:{id:t,target:i,type:s},uuid:r})}terminate(){var e;(e=this.worker)==null||e.terminate(),this.worker=null}unsubscribe(e){let{props:t}=e;this.postMessage({op:"unsubscribe",props:t})}wakeUp(e){let{uuid:t}=e;this.postMessage({op:"wakeUp",uuid:t})}postMessage(e){if(this.worker)return this.worker.postMessage(e);this.messageQueue.push(e)}}class ao{constructor(e){e===void 0&&(e=[0,0,0,0,0,0,0,0,0]),this.elements=e}identity(){const e=this.elements;e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1}setZero(){const e=this.elements;e[0]=0,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=0,e[6]=0,e[7]=0,e[8]=0}setTrace(e){const t=this.elements;t[0]=e.x,t[4]=e.y,t[8]=e.z}getTrace(e){e===void 0&&(e=new F);const t=this.elements;return e.x=t[0],e.y=t[4],e.z=t[8],e}vmult(e,t){t===void 0&&(t=new F);const i=this.elements,s=e.x,r=e.y,o=e.z;return t.x=i[0]*s+i[1]*r+i[2]*o,t.y=i[3]*s+i[4]*r+i[5]*o,t.z=i[6]*s+i[7]*r+i[8]*o,t}smult(e){for(let t=0;t0){const r=1/s;this.x*=r,this.y*=r,this.z*=r}else this.x=0,this.y=0,this.z=0;return s}unit(e){e===void 0&&(e=new F);const t=this.x,i=this.y,s=this.z;let r=Math.sqrt(t*t+i*i+s*s);return r>0?(r=1/r,e.x=t*r,e.y=i*r,e.z=s*r):(e.x=1,e.y=0,e.z=0),e}length(){const e=this.x,t=this.y,i=this.z;return Math.sqrt(e*e+t*t+i*i)}lengthSquared(){return this.dot(this)}distanceTo(e){const t=this.x,i=this.y,s=this.z,r=e.x,o=e.y,a=e.z;return Math.sqrt((r-t)*(r-t)+(o-i)*(o-i)+(a-s)*(a-s))}distanceSquared(e){const t=this.x,i=this.y,s=this.z,r=e.x,o=e.y,a=e.z;return(r-t)*(r-t)+(o-i)*(o-i)+(a-s)*(a-s)}scale(e,t){t===void 0&&(t=new F);const i=this.x,s=this.y,r=this.z;return t.x=e*i,t.y=e*s,t.z=e*r,t}vmul(e,t){return t===void 0&&(t=new F),t.x=e.x*this.x,t.y=e.y*this.y,t.z=e.z*this.z,t}addScaledVector(e,t,i){return i===void 0&&(i=new F),i.x=this.x+e*t.x,i.y=this.y+e*t.y,i.z=this.z+e*t.z,i}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}isZero(){return this.x===0&&this.y===0&&this.z===0}negate(e){return e===void 0&&(e=new F),e.x=-this.x,e.y=-this.y,e.z=-this.z,e}tangents(e,t){const i=this.length();if(i>0){const s=wT,r=1/i;s.set(this.x*r,this.y*r,this.z*r);const o=ST;Math.abs(s.x)<.9?(o.set(1,0,0),s.cross(o,e)):(o.set(0,1,0),s.cross(o,e)),s.cross(e,t)}else e.set(1,0,0),t.set(0,1,0)}toString(){return`${this.x},${this.y},${this.z}`}toArray(){return[this.x,this.y,this.z]}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}lerp(e,t,i){const s=this.x,r=this.y,o=this.z;i.x=s+(e.x-s)*t,i.y=r+(e.y-r)*t,i.z=o+(e.z-o)*t}almostEquals(e,t){return t===void 0&&(t=1e-6),!(Math.abs(this.x-e.x)>t||Math.abs(this.y-e.y)>t||Math.abs(this.z-e.z)>t)}almostZero(e){return e===void 0&&(e=1e-6),!(Math.abs(this.x)>e||Math.abs(this.y)>e||Math.abs(this.z)>e)}isAntiparallelTo(e,t){return this.negate(jZ),jZ.almostEquals(e,t)}clone(){return new F(this.x,this.y,this.z)}}F.ZERO=new F(0,0,0);F.UNIT_X=new F(1,0,0);F.UNIT_Y=new F(0,1,0);F.UNIT_Z=new F(0,0,1);const wT=new F,ST=new F,jZ=new F;class Ls{constructor(e){e===void 0&&(e={}),this.lowerBound=new F,this.upperBound=new F,e.lowerBound&&this.lowerBound.copy(e.lowerBound),e.upperBound&&this.upperBound.copy(e.upperBound)}setFromPoints(e,t,i,s){const r=this.lowerBound,o=this.upperBound,a=i;r.copy(e[0]),a&&a.vmult(r,r),o.copy(r);for(let l=1;lo.x&&(o.x=c.x),c.xo.y&&(o.y=c.y),c.yo.z&&(o.z=c.z),c.z=r.x&&t.y<=s.y&&i.y>=r.y&&t.z<=s.z&&i.z>=r.z}getCorners(e,t,i,s,r,o,a,l){const c=this.lowerBound,u=this.upperBound;e.copy(c),t.set(u.x,c.y,c.z),i.set(u.x,u.y,c.z),s.set(c.x,u.y,u.z),r.set(u.x,c.y,u.z),o.set(c.x,u.y,c.z),a.set(c.x,c.y,u.z),l.copy(u)}toLocalFrame(e,t){const i=$Z,s=i[0],r=i[1],o=i[2],a=i[3],l=i[4],c=i[5],u=i[6],C=i[7];this.getCorners(s,r,o,a,l,c,u,C);for(let d=0;d!==8;d++){const h=i[d];e.pointToLocal(h,h)}return t.setFromPoints(i)}toWorldFrame(e,t){const i=$Z,s=i[0],r=i[1],o=i[2],a=i[3],l=i[4],c=i[5],u=i[6],C=i[7];this.getCorners(s,r,o,a,l,c,u,C);for(let d=0;d!==8;d++){const h=i[d];e.pointToWorld(h,h)}return t.setFromPoints(i)}overlapsRay(e){const{direction:t,from:i}=e,s=1/t.x,r=1/t.y,o=1/t.z,a=(this.lowerBound.x-i.x)*s,l=(this.upperBound.x-i.x)*s,c=(this.lowerBound.y-i.y)*r,u=(this.upperBound.y-i.y)*r,C=(this.lowerBound.z-i.z)*o,d=(this.upperBound.z-i.z)*o,h=Math.max(Math.max(Math.min(a,l),Math.min(c,u)),Math.min(C,d)),m=Math.min(Math.min(Math.max(a,l),Math.max(c,u)),Math.max(C,d));return!(m<0||h>m)}}const qZ=new F,$Z=[new F,new F,new F,new F,new F,new F,new F,new F];class xi{constructor(e,t,i,s){e===void 0&&(e=0),t===void 0&&(t=0),i===void 0&&(i=0),s===void 0&&(s=1),this.x=e,this.y=t,this.z=i,this.w=s}set(e,t,i,s){return this.x=e,this.y=t,this.z=i,this.w=s,this}toString(){return`${this.x},${this.y},${this.z},${this.w}`}toArray(){return[this.x,this.y,this.z,this.w]}setFromAxisAngle(e,t){const i=Math.sin(t*.5);return this.x=e.x*i,this.y=e.y*i,this.z=e.z*i,this.w=Math.cos(t*.5),this}toAxisAngle(e){e===void 0&&(e=new F),this.normalize();const t=2*Math.acos(this.w),i=Math.sqrt(1-this.w*this.w);return i<.001?(e.x=this.x,e.y=this.y,e.z=this.z):(e.x=this.x/i,e.y=this.y/i,e.z=this.z/i),[e,t]}setFromVectors(e,t){if(e.isAntiparallelTo(t)){const i=xT,s=RT;e.tangents(i,s),this.setFromAxisAngle(i,Math.PI)}else{const i=e.cross(t);this.x=i.x,this.y=i.y,this.z=i.z,this.w=Math.sqrt(e.length()**2*t.length()**2)+e.dot(t),this.normalize()}return this}mult(e,t){t===void 0&&(t=new xi);const i=this.x,s=this.y,r=this.z,o=this.w,a=e.x,l=e.y,c=e.z,u=e.w;return t.x=i*u+o*a+s*c-r*l,t.y=s*u+o*l+r*a-i*c,t.z=r*u+o*c+i*l-s*a,t.w=o*u-i*a-s*l-r*c,t}inverse(e){e===void 0&&(e=new xi);const t=this.x,i=this.y,s=this.z,r=this.w;this.conjugate(e);const o=1/(t*t+i*i+s*s+r*r);return e.x*=o,e.y*=o,e.z*=o,e.w*=o,e}conjugate(e){return e===void 0&&(e=new xi),e.x=-this.x,e.y=-this.y,e.z=-this.z,e.w=this.w,e}normalize(){let e=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);return e===0?(this.x=0,this.y=0,this.z=0,this.w=0):(e=1/e,this.x*=e,this.y*=e,this.z*=e,this.w*=e),this}normalizeFast(){const e=(3-(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w))/2;return e===0?(this.x=0,this.y=0,this.z=0,this.w=0):(this.x*=e,this.y*=e,this.z*=e,this.w*=e),this}vmult(e,t){t===void 0&&(t=new F);const i=e.x,s=e.y,r=e.z,o=this.x,a=this.y,l=this.z,c=this.w,u=c*i+a*r-l*s,C=c*s+l*i-o*r,d=c*r+o*s-a*i,h=-o*i-a*s-l*r;return t.x=u*c+h*-o+C*-l-d*-a,t.y=C*c+h*-a+d*-o-u*-l,t.z=d*c+h*-l+u*-a-C*-o,t}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w,this}toEuler(e,t){t===void 0&&(t="YZX");let i,s,r;const o=this.x,a=this.y,l=this.z,c=this.w;switch(t){case"YZX":const u=o*a+l*c;if(u>.499&&(i=2*Math.atan2(o,c),s=Math.PI/2,r=0),u<-.499&&(i=-2*Math.atan2(o,c),s=-Math.PI/2,r=0),i===void 0){const C=o*o,d=a*a,h=l*l;i=Math.atan2(2*a*c-2*o*l,1-2*d-2*h),s=Math.asin(2*u),r=Math.atan2(2*o*c-2*a*l,1-2*C-2*h)}break;default:throw new Error(`Euler order ${t} not supported yet.`)}e.y=i,e.z=s,e.x=r}setFromEuler(e,t,i,s){s===void 0&&(s="XYZ");const r=Math.cos(e/2),o=Math.cos(t/2),a=Math.cos(i/2),l=Math.sin(e/2),c=Math.sin(t/2),u=Math.sin(i/2);return s==="XYZ"?(this.x=l*o*a+r*c*u,this.y=r*c*a-l*o*u,this.z=r*o*u+l*c*a,this.w=r*o*a-l*c*u):s==="YXZ"?(this.x=l*o*a+r*c*u,this.y=r*c*a-l*o*u,this.z=r*o*u-l*c*a,this.w=r*o*a+l*c*u):s==="ZXY"?(this.x=l*o*a-r*c*u,this.y=r*c*a+l*o*u,this.z=r*o*u+l*c*a,this.w=r*o*a-l*c*u):s==="ZYX"?(this.x=l*o*a-r*c*u,this.y=r*c*a+l*o*u,this.z=r*o*u-l*c*a,this.w=r*o*a+l*c*u):s==="YZX"?(this.x=l*o*a+r*c*u,this.y=r*c*a+l*o*u,this.z=r*o*u-l*c*a,this.w=r*o*a-l*c*u):s==="XZY"&&(this.x=l*o*a-r*c*u,this.y=r*c*a-l*o*u,this.z=r*o*u+l*c*a,this.w=r*o*a+l*c*u),this}clone(){return new xi(this.x,this.y,this.z,this.w)}slerp(e,t,i){i===void 0&&(i=new xi);const s=this.x,r=this.y,o=this.z,a=this.w;let l=e.x,c=e.y,u=e.z,C=e.w,d,h,m,v,y;return h=s*l+r*c+o*u+a*C,h<0&&(h=-h,l=-l,c=-c,u=-u,C=-C),1-h>1e-6?(d=Math.acos(h),m=Math.sin(d),v=Math.sin((1-t)*d)/m,y=Math.sin(t*d)/m):(v=1-t,y=t),i.x=v*s+y*l,i.y=v*r+y*c,i.z=v*o+y*u,i.w=v*a+y*C,i}integrate(e,t,i,s){s===void 0&&(s=new xi);const r=e.x*i.x,o=e.y*i.y,a=e.z*i.z,l=this.x,c=this.y,u=this.z,C=this.w,d=t*.5;return s.x+=d*(r*C+o*u-a*c),s.y+=d*(o*C+a*l-r*u),s.z+=d*(a*C+r*c-o*l),s.w+=d*(-r*l-o*c-a*u),s}}const xT=new F,RT=new F,WT={SPHERE:1,PLANE:2,BOX:4,COMPOUND:8,CONVEXPOLYHEDRON:16,HEIGHTFIELD:32,PARTICLE:64,CYLINDER:128,TRIMESH:256};class _e{constructor(e){e===void 0&&(e={}),this.id=_e.idCounter++,this.type=e.type||0,this.boundingSphereRadius=0,this.collisionResponse=e.collisionResponse?e.collisionResponse:!0,this.collisionFilterGroup=e.collisionFilterGroup!==void 0?e.collisionFilterGroup:1,this.collisionFilterMask=e.collisionFilterMask!==void 0?e.collisionFilterMask:-1,this.material=e.material?e.material:null,this.body=null}updateBoundingSphereRadius(){throw`computeBoundingSphereRadius() not implemented for shape type ${this.type}`}volume(){throw`volume() not implemented for shape type ${this.type}`}calculateLocalInertia(e,t){throw`calculateLocalInertia() not implemented for shape type ${this.type}`}calculateWorldAABB(e,t,i,s){throw`calculateWorldAABB() not implemented for shape type ${this.type}`}}_e.idCounter=0;_e.types=WT;class Ei{constructor(e){e===void 0&&(e={}),this.position=new F,this.quaternion=new xi,e.position&&this.position.copy(e.position),e.quaternion&&this.quaternion.copy(e.quaternion)}pointToLocal(e,t){return Ei.pointToLocalFrame(this.position,this.quaternion,e,t)}pointToWorld(e,t){return Ei.pointToWorldFrame(this.position,this.quaternion,e,t)}vectorToWorldFrame(e,t){return t===void 0&&(t=new F),this.quaternion.vmult(e,t),t}static pointToLocalFrame(e,t,i,s){return s===void 0&&(s=new F),i.vsub(e,s),t.conjugate(ew),ew.vmult(s,s),s}static pointToWorldFrame(e,t,i,s){return s===void 0&&(s=new F),t.vmult(i,s),s.vadd(e,s),s}static vectorToWorldFrame(e,t,i){return i===void 0&&(i=new F),e.vmult(t,i),i}static vectorToLocalFrame(e,t,i,s){return s===void 0&&(s=new F),t.w*=-1,t.vmult(i,s),t.w*=-1,s}}const ew=new xi;new F;new F;new F;new F;new F,new F,new F,new F,new F,new F,new F,new F;new F;new xi;new Ls;new ao;new ao;new ao;new F;new F;new F;new F;new F;new F;new F;new F;new F;new F;new xi;new F;new F;new F;new F;class ub{constructor(){this.rayFromWorld=new F,this.rayToWorld=new F,this.hitNormalWorld=new F,this.hitPointWorld=new F,this.hasHit=!1,this.shape=null,this.body=null,this.hitFaceIndex=-1,this.distance=-1,this.shouldStop=!1}reset(){this.rayFromWorld.setZero(),this.rayToWorld.setZero(),this.hitNormalWorld.setZero(),this.hitPointWorld.setZero(),this.hasHit=!1,this.shape=null,this.body=null,this.hitFaceIndex=-1,this.distance=-1,this.shouldStop=!1}abort(){this.shouldStop=!0}set(e,t,i,s,r,o,a){this.rayFromWorld.copy(e),this.rayToWorld.copy(t),this.hitNormalWorld.copy(i),this.hitPointWorld.copy(s),this.shape=r,this.body=o,this.distance=a}}let iV,sV,rV,oV,aV,lV,gV;const uy={CLOSEST:1,ANY:2,ALL:4};iV=_e.types.SPHERE;sV=_e.types.PLANE;rV=_e.types.BOX;oV=_e.types.CYLINDER;aV=_e.types.CONVEXPOLYHEDRON;lV=_e.types.HEIGHTFIELD;gV=_e.types.TRIMESH;class mi{get[iV](){return this._intersectSphere}get[sV](){return this._intersectPlane}get[rV](){return this._intersectBox}get[oV](){return this._intersectConvex}get[aV](){return this._intersectConvex}get[lV](){return this._intersectHeightfield}get[gV](){return this._intersectTrimesh}constructor(e,t){e===void 0&&(e=new F),t===void 0&&(t=new F),this.from=e.clone(),this.to=t.clone(),this.direction=new F,this.precision=1e-4,this.checkCollisionResponse=!0,this.skipBackfaces=!1,this.collisionFilterMask=-1,this.collisionFilterGroup=-1,this.mode=mi.ANY,this.result=new ub,this.hasHit=!1,this.callback=i=>{}}intersectWorld(e,t){return this.mode=t.mode||mi.ANY,this.result=t.result||new ub,this.skipBackfaces=!!t.skipBackfaces,this.collisionFilterMask=typeof t.collisionFilterMask<"u"?t.collisionFilterMask:-1,this.collisionFilterGroup=typeof t.collisionFilterGroup<"u"?t.collisionFilterGroup:-1,this.checkCollisionResponse=typeof t.checkCollisionResponse<"u"?t.checkCollisionResponse:!0,t.from&&this.from.copy(t.from),t.to&&this.to.copy(t.to),this.callback=t.callback||(()=>{}),this.hasHit=!1,this.result.reset(),this.updateDirection(),this.getAABB(tw),mf.length=0,e.broadphase.aabbQuery(e,tw,mf),this.intersectBodies(mf),this.hasHit}intersectBody(e,t){t&&(this.result=t,this.updateDirection());const i=this.checkCollisionResponse;if(i&&!e.collisionResponse||!(this.collisionFilterGroup&e.collisionFilterMask)||!(e.collisionFilterGroup&this.collisionFilterMask))return;const s=VT,r=MT;for(let o=0,a=e.shapes.length;oe.boundingSphereRadius)return;const a=this[e.type];a&&a.call(this,e,t,i,s,e)}_intersectBox(e,t,i,s,r){return this._intersectConvex(e.convexPolyhedronRepresentation,t,i,s,r)}_intersectPlane(e,t,i,s,r){const o=this.from,a=this.to,l=this.direction,c=new F(0,0,1);t.vmult(c,c);const u=new F;o.vsub(i,u);const C=u.dot(c);a.vsub(i,u);const d=u.dot(c);if(C*d>0||o.distanceTo(a)=0&&v<=1&&(o.lerp(a,v,h),h.vsub(i,m),m.normalize(),this.reportIntersection(m,h,r,s,-1)),this.result.shouldStop)return;y>=0&&y<=1&&(o.lerp(a,y,h),h.vsub(i,m),m.normalize(),this.reportIntersection(m,h,r,s,-1))}}_intersectConvex(e,t,i,s,r,o){const a=FT,l=iw,c=o&&o.faceList||null,u=e.faces,C=e.vertices,d=e.faceNormals,h=this.direction,m=this.from,v=this.to,y=m.distanceTo(v),A=c?c.length:u.length,b=this.result;for(let f=0;!b.shouldStop&&fy||this.reportIntersection(a,Ki,r,s,B)}}}}_intersectTrimesh(e,t,i,s,r,o){const a=KT,l=DT,c=UT,u=iw,C=zT,d=LT,h=TT,m=kT,v=ET,y=e.indices;e.vertices;const A=this.from,b=this.to,f=this.direction;c.position.copy(i),c.quaternion.copy(t),Ei.vectorToLocalFrame(i,t,f,C),Ei.pointToLocalFrame(i,t,A,d),Ei.pointToLocalFrame(i,t,b,h),h.x*=e.scale.x,h.y*=e.scale.y,h.z*=e.scale.z,d.x*=e.scale.x,d.y*=e.scale.y,d.z*=e.scale.z,h.vsub(d,C),C.normalize();const B=d.distanceSquared(h);e.tree.rayQuery(this,c,l);for(let S=0,x=l.length;!this.result.shouldStop&&S!==x;S++){const R=l[S];e.getNormal(R,a),e.getVertex(y[R*3],$s),$s.vsub(d,u);const M=C.dot(a),Z=a.dot(u)/M;if(Z<0)continue;C.scale(Z,Ki),Ki.vadd(d,Ki),e.getVertex(y[R*3+1],Br),e.getVertex(y[R*3+2],Zr);const V=Ki.distanceSquared(d);!(mi.pointInTriangle(Ki,Br,$s,Zr)||mi.pointInTriangle(Ki,$s,Br,Zr))||V>B||(Ei.vectorToWorldFrame(t,a,v),Ei.pointToWorldFrame(i,t,Ki,m),this.reportIntersection(v,m,r,s,R))}l.length=0}reportIntersection(e,t,i,s,r){const o=this.from,a=this.to,l=o.distanceTo(t),c=this.result;if(!(this.skipBackfaces&&e.dot(this.direction)>0))switch(c.hitFaceIndex=typeof r<"u"?r:-1,this.mode){case mi.ALL:this.hasHit=!0,c.set(o,a,e,t,i,s,l),c.hasHit=!0,this.callback(c);break;case mi.CLOSEST:(l=0&&(C=r*c-o*a)>=0&&u+CDate.now()-n}new F;class lo{constructor(e){e===void 0&&(e=[0,0,0,0,0,0,0,0,0]),this.elements=e}identity(){const e=this.elements;e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1}setZero(){const e=this.elements;e[0]=0,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=0,e[6]=0,e[7]=0,e[8]=0}setTrace(e){const t=this.elements;t[0]=e.x,t[4]=e.y,t[8]=e.z}getTrace(e){e===void 0&&(e=new K);const t=this.elements;return e.x=t[0],e.y=t[4],e.z=t[8],e}vmult(e,t){t===void 0&&(t=new K);const i=this.elements,s=e.x,r=e.y,o=e.z;return t.x=i[0]*s+i[1]*r+i[2]*o,t.y=i[3]*s+i[4]*r+i[5]*o,t.z=i[6]*s+i[7]*r+i[8]*o,t}smult(e){for(let t=0;t0){const r=1/s;this.x*=r,this.y*=r,this.z*=r}else this.x=0,this.y=0,this.z=0;return s}unit(e){e===void 0&&(e=new K);const t=this.x,i=this.y,s=this.z;let r=Math.sqrt(t*t+i*i+s*s);return r>0?(r=1/r,e.x=t*r,e.y=i*r,e.z=s*r):(e.x=1,e.y=0,e.z=0),e}length(){const e=this.x,t=this.y,i=this.z;return Math.sqrt(e*e+t*t+i*i)}lengthSquared(){return this.dot(this)}distanceTo(e){const t=this.x,i=this.y,s=this.z,r=e.x,o=e.y,a=e.z;return Math.sqrt((r-t)*(r-t)+(o-i)*(o-i)+(a-s)*(a-s))}distanceSquared(e){const t=this.x,i=this.y,s=this.z,r=e.x,o=e.y,a=e.z;return(r-t)*(r-t)+(o-i)*(o-i)+(a-s)*(a-s)}scale(e,t){t===void 0&&(t=new K);const i=this.x,s=this.y,r=this.z;return t.x=e*i,t.y=e*s,t.z=e*r,t}vmul(e,t){return t===void 0&&(t=new K),t.x=e.x*this.x,t.y=e.y*this.y,t.z=e.z*this.z,t}addScaledVector(e,t,i){return i===void 0&&(i=new K),i.x=this.x+e*t.x,i.y=this.y+e*t.y,i.z=this.z+e*t.z,i}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}isZero(){return this.x===0&&this.y===0&&this.z===0}negate(e){return e===void 0&&(e=new K),e.x=-this.x,e.y=-this.y,e.z=-this.z,e}tangents(e,t){const i=this.length();if(i>0){const s=JT,r=1/i;s.set(this.x*r,this.y*r,this.z*r);const o=OT;Math.abs(s.x)<.9?(o.set(1,0,0),s.cross(o,e)):(o.set(0,1,0),s.cross(o,e)),s.cross(e,t)}else e.set(1,0,0),t.set(0,1,0)}toString(){return`${this.x},${this.y},${this.z}`}toArray(){return[this.x,this.y,this.z]}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}lerp(e,t,i){const s=this.x,r=this.y,o=this.z;i.x=s+(e.x-s)*t,i.y=r+(e.y-r)*t,i.z=o+(e.z-o)*t}almostEquals(e,t){return t===void 0&&(t=1e-6),!(Math.abs(this.x-e.x)>t||Math.abs(this.y-e.y)>t||Math.abs(this.z-e.z)>t)}almostZero(e){return e===void 0&&(e=1e-6),!(Math.abs(this.x)>e||Math.abs(this.y)>e||Math.abs(this.z)>e)}isAntiparallelTo(e,t){return this.negate(sw),sw.almostEquals(e,t)}clone(){return new K(this.x,this.y,this.z)}}K.ZERO=new K(0,0,0);K.UNIT_X=new K(1,0,0);K.UNIT_Y=new K(0,1,0);K.UNIT_Z=new K(0,0,1);const JT=new K,OT=new K,sw=new K;class Ts{constructor(e){e===void 0&&(e={}),this.lowerBound=new K,this.upperBound=new K,e.lowerBound&&this.lowerBound.copy(e.lowerBound),e.upperBound&&this.upperBound.copy(e.upperBound)}setFromPoints(e,t,i,s){const r=this.lowerBound,o=this.upperBound,a=i;r.copy(e[0]),a&&a.vmult(r,r),o.copy(r);for(let l=1;lo.x&&(o.x=c.x),c.xo.y&&(o.y=c.y),c.yo.z&&(o.z=c.z),c.z=r.x&&t.y<=s.y&&i.y>=r.y&&t.z<=s.z&&i.z>=r.z}getCorners(e,t,i,s,r,o,a,l){const c=this.lowerBound,u=this.upperBound;e.copy(c),t.set(u.x,c.y,c.z),i.set(u.x,u.y,c.z),s.set(c.x,u.y,u.z),r.set(u.x,c.y,u.z),o.set(c.x,u.y,c.z),a.set(c.x,c.y,u.z),l.copy(u)}toLocalFrame(e,t){const i=ow,s=i[0],r=i[1],o=i[2],a=i[3],l=i[4],c=i[5],u=i[6],C=i[7];this.getCorners(s,r,o,a,l,c,u,C);for(let d=0;d!==8;d++){const h=i[d];e.pointToLocal(h,h)}return t.setFromPoints(i)}toWorldFrame(e,t){const i=ow,s=i[0],r=i[1],o=i[2],a=i[3],l=i[4],c=i[5],u=i[6],C=i[7];this.getCorners(s,r,o,a,l,c,u,C);for(let d=0;d!==8;d++){const h=i[d];e.pointToWorld(h,h)}return t.setFromPoints(i)}overlapsRay(e){const{direction:t,from:i}=e,s=1/t.x,r=1/t.y,o=1/t.z,a=(this.lowerBound.x-i.x)*s,l=(this.upperBound.x-i.x)*s,c=(this.lowerBound.y-i.y)*r,u=(this.upperBound.y-i.y)*r,C=(this.lowerBound.z-i.z)*o,d=(this.upperBound.z-i.z)*o,h=Math.max(Math.max(Math.min(a,l),Math.min(c,u)),Math.min(C,d)),m=Math.min(Math.min(Math.max(a,l),Math.max(c,u)),Math.max(C,d));return!(m<0||h>m)}}const rw=new K,ow=[new K,new K,new K,new K,new K,new K,new K,new K];class Ri{constructor(e,t,i,s){e===void 0&&(e=0),t===void 0&&(t=0),i===void 0&&(i=0),s===void 0&&(s=1),this.x=e,this.y=t,this.z=i,this.w=s}set(e,t,i,s){return this.x=e,this.y=t,this.z=i,this.w=s,this}toString(){return`${this.x},${this.y},${this.z},${this.w}`}toArray(){return[this.x,this.y,this.z,this.w]}setFromAxisAngle(e,t){const i=Math.sin(t*.5);return this.x=e.x*i,this.y=e.y*i,this.z=e.z*i,this.w=Math.cos(t*.5),this}toAxisAngle(e){e===void 0&&(e=new K),this.normalize();const t=2*Math.acos(this.w),i=Math.sqrt(1-this.w*this.w);return i<.001?(e.x=this.x,e.y=this.y,e.z=this.z):(e.x=this.x/i,e.y=this.y/i,e.z=this.z/i),[e,t]}setFromVectors(e,t){if(e.isAntiparallelTo(t)){const i=QT,s=jT;e.tangents(i,s),this.setFromAxisAngle(i,Math.PI)}else{const i=e.cross(t);this.x=i.x,this.y=i.y,this.z=i.z,this.w=Math.sqrt(e.length()**2*t.length()**2)+e.dot(t),this.normalize()}return this}mult(e,t){t===void 0&&(t=new Ri);const i=this.x,s=this.y,r=this.z,o=this.w,a=e.x,l=e.y,c=e.z,u=e.w;return t.x=i*u+o*a+s*c-r*l,t.y=s*u+o*l+r*a-i*c,t.z=r*u+o*c+i*l-s*a,t.w=o*u-i*a-s*l-r*c,t}inverse(e){e===void 0&&(e=new Ri);const t=this.x,i=this.y,s=this.z,r=this.w;this.conjugate(e);const o=1/(t*t+i*i+s*s+r*r);return e.x*=o,e.y*=o,e.z*=o,e.w*=o,e}conjugate(e){return e===void 0&&(e=new Ri),e.x=-this.x,e.y=-this.y,e.z=-this.z,e.w=this.w,e}normalize(){let e=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);return e===0?(this.x=0,this.y=0,this.z=0,this.w=0):(e=1/e,this.x*=e,this.y*=e,this.z*=e,this.w*=e),this}normalizeFast(){const e=(3-(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w))/2;return e===0?(this.x=0,this.y=0,this.z=0,this.w=0):(this.x*=e,this.y*=e,this.z*=e,this.w*=e),this}vmult(e,t){t===void 0&&(t=new K);const i=e.x,s=e.y,r=e.z,o=this.x,a=this.y,l=this.z,c=this.w,u=c*i+a*r-l*s,C=c*s+l*i-o*r,d=c*r+o*s-a*i,h=-o*i-a*s-l*r;return t.x=u*c+h*-o+C*-l-d*-a,t.y=C*c+h*-a+d*-o-u*-l,t.z=d*c+h*-l+u*-a-C*-o,t}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w,this}toEuler(e,t){t===void 0&&(t="YZX");let i,s,r;const o=this.x,a=this.y,l=this.z,c=this.w;switch(t){case"YZX":const u=o*a+l*c;if(u>.499&&(i=2*Math.atan2(o,c),s=Math.PI/2,r=0),u<-.499&&(i=-2*Math.atan2(o,c),s=-Math.PI/2,r=0),i===void 0){const C=o*o,d=a*a,h=l*l;i=Math.atan2(2*a*c-2*o*l,1-2*d-2*h),s=Math.asin(2*u),r=Math.atan2(2*o*c-2*a*l,1-2*C-2*h)}break;default:throw new Error(`Euler order ${t} not supported yet.`)}e.y=i,e.z=s,e.x=r}setFromEuler(e,t,i,s){s===void 0&&(s="XYZ");const r=Math.cos(e/2),o=Math.cos(t/2),a=Math.cos(i/2),l=Math.sin(e/2),c=Math.sin(t/2),u=Math.sin(i/2);return s==="XYZ"?(this.x=l*o*a+r*c*u,this.y=r*c*a-l*o*u,this.z=r*o*u+l*c*a,this.w=r*o*a-l*c*u):s==="YXZ"?(this.x=l*o*a+r*c*u,this.y=r*c*a-l*o*u,this.z=r*o*u-l*c*a,this.w=r*o*a+l*c*u):s==="ZXY"?(this.x=l*o*a-r*c*u,this.y=r*c*a+l*o*u,this.z=r*o*u+l*c*a,this.w=r*o*a-l*c*u):s==="ZYX"?(this.x=l*o*a-r*c*u,this.y=r*c*a+l*o*u,this.z=r*o*u-l*c*a,this.w=r*o*a+l*c*u):s==="YZX"?(this.x=l*o*a+r*c*u,this.y=r*c*a+l*o*u,this.z=r*o*u-l*c*a,this.w=r*o*a-l*c*u):s==="XZY"&&(this.x=l*o*a-r*c*u,this.y=r*c*a-l*o*u,this.z=r*o*u+l*c*a,this.w=r*o*a+l*c*u),this}clone(){return new Ri(this.x,this.y,this.z,this.w)}slerp(e,t,i){i===void 0&&(i=new Ri);const s=this.x,r=this.y,o=this.z,a=this.w;let l=e.x,c=e.y,u=e.z,C=e.w,d,h,m,v,y;return h=s*l+r*c+o*u+a*C,h<0&&(h=-h,l=-l,c=-c,u=-u,C=-C),1-h>1e-6?(d=Math.acos(h),m=Math.sin(d),v=Math.sin((1-t)*d)/m,y=Math.sin(t*d)/m):(v=1-t,y=t),i.x=v*s+y*l,i.y=v*r+y*c,i.z=v*o+y*u,i.w=v*a+y*C,i}integrate(e,t,i,s){s===void 0&&(s=new Ri);const r=e.x*i.x,o=e.y*i.y,a=e.z*i.z,l=this.x,c=this.y,u=this.z,C=this.w,d=t*.5;return s.x+=d*(r*C+o*u-a*c),s.y+=d*(o*C+a*l-r*u),s.z+=d*(a*C+r*c-o*l),s.w+=d*(-r*l-o*c-a*u),s}}const QT=new K,jT=new K,qT={SPHERE:1,PLANE:2,BOX:4,COMPOUND:8,CONVEXPOLYHEDRON:16,HEIGHTFIELD:32,PARTICLE:64,CYLINDER:128,TRIMESH:256};class Je{constructor(e){e===void 0&&(e={}),this.id=Je.idCounter++,this.type=e.type||0,this.boundingSphereRadius=0,this.collisionResponse=e.collisionResponse?e.collisionResponse:!0,this.collisionFilterGroup=e.collisionFilterGroup!==void 0?e.collisionFilterGroup:1,this.collisionFilterMask=e.collisionFilterMask!==void 0?e.collisionFilterMask:-1,this.material=e.material?e.material:null,this.body=null}updateBoundingSphereRadius(){throw`computeBoundingSphereRadius() not implemented for shape type ${this.type}`}volume(){throw`volume() not implemented for shape type ${this.type}`}calculateLocalInertia(e,t){throw`calculateLocalInertia() not implemented for shape type ${this.type}`}calculateWorldAABB(e,t,i,s){throw`calculateWorldAABB() not implemented for shape type ${this.type}`}}Je.idCounter=0;Je.types=qT;class ki{constructor(e){e===void 0&&(e={}),this.position=new K,this.quaternion=new Ri,e.position&&this.position.copy(e.position),e.quaternion&&this.quaternion.copy(e.quaternion)}pointToLocal(e,t){return ki.pointToLocalFrame(this.position,this.quaternion,e,t)}pointToWorld(e,t){return ki.pointToWorldFrame(this.position,this.quaternion,e,t)}vectorToWorldFrame(e,t){return t===void 0&&(t=new K),this.quaternion.vmult(e,t),t}static pointToLocalFrame(e,t,i,s){return s===void 0&&(s=new K),i.vsub(e,s),t.conjugate(aw),aw.vmult(s,s),s}static pointToWorldFrame(e,t,i,s){return s===void 0&&(s=new K),t.vmult(i,s),s.vadd(e,s),s}static vectorToWorldFrame(e,t,i){return i===void 0&&(i=new K),e.vmult(t,i),i}static vectorToLocalFrame(e,t,i,s){return s===void 0&&(s=new K),t.w*=-1,t.vmult(i,s),t.w*=-1,s}}const aw=new Ri;new K;new K;new K;new K;new K,new K,new K,new K,new K,new K,new K,new K;new K;new Ri;new Ts;new lo;new lo;new lo;new K;new K;new K;new K;new K;new K;new K;new K;new K;new K;new Ri;new K;new K;new K;new K;class Cb{constructor(){this.rayFromWorld=new K,this.rayToWorld=new K,this.hitNormalWorld=new K,this.hitPointWorld=new K,this.hasHit=!1,this.shape=null,this.body=null,this.hitFaceIndex=-1,this.distance=-1,this.shouldStop=!1}reset(){this.rayFromWorld.setZero(),this.rayToWorld.setZero(),this.hitNormalWorld.setZero(),this.hitPointWorld.setZero(),this.hasHit=!1,this.shape=null,this.body=null,this.hitFaceIndex=-1,this.distance=-1,this.shouldStop=!1}abort(){this.shouldStop=!0}set(e,t,i,s,r,o,a){this.rayFromWorld.copy(e),this.rayToWorld.copy(t),this.hitNormalWorld.copy(i),this.hitPointWorld.copy(s),this.shape=r,this.body=o,this.distance=a}}let cV,IV,uV,CV,dV,hV,AV;const Cy={CLOSEST:1,ANY:2,ALL:4};cV=Je.types.SPHERE;IV=Je.types.PLANE;uV=Je.types.BOX;CV=Je.types.CYLINDER;dV=Je.types.CONVEXPOLYHEDRON;hV=Je.types.HEIGHTFIELD;AV=Je.types.TRIMESH;class fi{get[cV](){return this._intersectSphere}get[IV](){return this._intersectPlane}get[uV](){return this._intersectBox}get[CV](){return this._intersectConvex}get[dV](){return this._intersectConvex}get[hV](){return this._intersectHeightfield}get[AV](){return this._intersectTrimesh}constructor(e,t){e===void 0&&(e=new K),t===void 0&&(t=new K),this.from=e.clone(),this.to=t.clone(),this.direction=new K,this.precision=1e-4,this.checkCollisionResponse=!0,this.skipBackfaces=!1,this.collisionFilterMask=-1,this.collisionFilterGroup=-1,this.mode=fi.ANY,this.result=new Cb,this.hasHit=!1,this.callback=i=>{}}intersectWorld(e,t){return this.mode=t.mode||fi.ANY,this.result=t.result||new Cb,this.skipBackfaces=!!t.skipBackfaces,this.collisionFilterMask=typeof t.collisionFilterMask<"u"?t.collisionFilterMask:-1,this.collisionFilterGroup=typeof t.collisionFilterGroup<"u"?t.collisionFilterGroup:-1,this.checkCollisionResponse=typeof t.checkCollisionResponse<"u"?t.checkCollisionResponse:!0,t.from&&this.from.copy(t.from),t.to&&this.to.copy(t.to),this.callback=t.callback||(()=>{}),this.hasHit=!1,this.result.reset(),this.updateDirection(),this.getAABB(lw),bf.length=0,e.broadphase.aabbQuery(e,lw,bf),this.intersectBodies(bf),this.hasHit}intersectBody(e,t){t&&(this.result=t,this.updateDirection());const i=this.checkCollisionResponse;if(i&&!e.collisionResponse||!(this.collisionFilterGroup&e.collisionFilterMask)||!(e.collisionFilterGroup&this.collisionFilterMask))return;const s=$T,r=eE;for(let o=0,a=e.shapes.length;oe.boundingSphereRadius)return;const a=this[e.type];a&&a.call(this,e,t,i,s,e)}_intersectBox(e,t,i,s,r){return this._intersectConvex(e.convexPolyhedronRepresentation,t,i,s,r)}_intersectPlane(e,t,i,s,r){const o=this.from,a=this.to,l=this.direction,c=new K(0,0,1);t.vmult(c,c);const u=new K;o.vsub(i,u);const C=u.dot(c);a.vsub(i,u);const d=u.dot(c);if(C*d>0||o.distanceTo(a)=0&&v<=1&&(o.lerp(a,v,h),h.vsub(i,m),m.normalize(),this.reportIntersection(m,h,r,s,-1)),this.result.shouldStop)return;y>=0&&y<=1&&(o.lerp(a,y,h),h.vsub(i,m),m.normalize(),this.reportIntersection(m,h,r,s,-1))}}_intersectConvex(e,t,i,s,r,o){const a=rE,l=cw,c=o&&o.faceList||null,u=e.faces,C=e.vertices,d=e.faceNormals,h=this.direction,m=this.from,v=this.to,y=m.distanceTo(v),A=c?c.length:u.length,b=this.result;for(let f=0;!b.shouldStop&&fy||this.reportIntersection(a,zi,r,s,B)}}}}_intersectTrimesh(e,t,i,s,r,o){const a=oE,l=uE,c=CE,u=cw,C=aE,d=lE,h=gE,m=IE,v=cE,y=e.indices;e.vertices;const A=this.from,b=this.to,f=this.direction;c.position.copy(i),c.quaternion.copy(t),ki.vectorToLocalFrame(i,t,f,C),ki.pointToLocalFrame(i,t,A,d),ki.pointToLocalFrame(i,t,b,h),h.x*=e.scale.x,h.y*=e.scale.y,h.z*=e.scale.z,d.x*=e.scale.x,d.y*=e.scale.y,d.z*=e.scale.z,h.vsub(d,C),C.normalize();const B=d.distanceSquared(h);e.tree.rayQuery(this,c,l);for(let S=0,x=l.length;!this.result.shouldStop&&S!==x;S++){const R=l[S];e.getNormal(R,a),e.getVertex(y[R*3],er),er.vsub(d,u);const M=C.dot(a),Z=a.dot(u)/M;if(Z<0)continue;C.scale(Z,zi),zi.vadd(d,zi),e.getVertex(y[R*3+1],wr),e.getVertex(y[R*3+2],Sr);const V=zi.distanceSquared(d);!(fi.pointInTriangle(zi,wr,er,Sr)||fi.pointInTriangle(zi,er,wr,Sr))||V>B||(ki.vectorToWorldFrame(t,a,v),ki.pointToWorldFrame(i,t,zi,m),this.reportIntersection(v,m,r,s,R))}l.length=0}reportIntersection(e,t,i,s,r){const o=this.from,a=this.to,l=o.distanceTo(t),c=this.result;if(!(this.skipBackfaces&&e.dot(this.direction)>0))switch(c.hitFaceIndex=typeof r<"u"?r:-1,this.mode){case fi.ALL:this.hasHit=!0,c.set(o,a,e,t,i,s,l),c.hasHit=!0,this.callback(c);break;case fi.CLOSEST:(l=0&&(C=r*c-o*a)>=0&&u+CDate.now()-n}new K;const hE=U.createContext(null),AE=()=>U.useContext(hE),pV=U.createContext(null),pE=()=>{const n=U.useContext(pV);if(!n)throw new Error("Physics context not found. @react-three/cannon & components can only be used within a Physics provider");return n};new H(1,1,1);new H;new Fe;const Iw=new Xt;function mE(n){const e=U.useRef(null);return n&&typeof n!="function"?n:e}function uw(n){return n.charAt(0).toUpperCase()+n.slice(1)}function si(n,e){const t=e===void 0?"":`/${e}`;return typeof n=="function"?null:n&&n.current&&`${n.current.uuid}${t}`}const fE=new bl,bE=new xn,vE=n=>e=>n(fE.setFromQuaternion(bE.fromArray(e)).toArray());let mV=0;function yf(n,e,t,i,s,r){return r===void 0&&(r="bodies"),o=>{const a=mV++;t[a]={[i]:o};const l=si(n,s);return l&&e.subscribe({props:{id:a,target:r,type:i},uuid:l}),()=>{delete t[a],e.unsubscribe({props:a})}}}function Cw(n,e){let{position:t=[0,0,0],rotation:i=[0,0,0],userData:s={}}=e;n.userData=s,n.position.set(...t),n.rotation.set(...i),n.updateMatrix()}function dw(n,e,t){let{onCollide:i,onCollideBegin:s,onCollideEnd:r}=e;n[t]={collide:i,collideBegin:s,collideEnd:r}}function yE(n,e,t,i,s){i===void 0&&(i=null),s===void 0&&(s=[]);const r=mE(i),{events:o,refs:a,scaleOverrides:l,subscriptions:c,worker:u}=pE(),C=AE();U.useLayoutEffect(()=>{r.current||(r.current=new Xt);const h=r.current,m=u,v=h instanceof Tg?(h.instanceMatrix.setUsage(A1),h.count):1,y=h instanceof Tg?new Array(v).fill(0).map((b,f)=>`${h.uuid}/${f}`):[h.uuid],A=h instanceof Tg?y.map((b,f)=>{const B=e(f);return Cw(Iw,B),h.setMatrixAt(f,Iw.matrix),h.instanceMatrix.needsUpdate=!0,a[b]=h,C?.add(b,B,n),dw(o,B,b),{...B,args:t(B.args)}}):y.map((b,f)=>{const B=e(f);return Cw(h,B),a[b]=h,C?.add(b,B,n),dw(o,B,b),{...B,args:t(B.args)}});return m.addBodies({props:A.map(b=>{let{onCollide:f,onCollideBegin:B,onCollideEnd:S,...x}=b;return{onCollide:!!f,...x}}),type:n,uuid:y}),()=>{y.forEach(b=>{delete a[b],C?.remove(b),delete o[b]}),m.removeBodies({uuid:y})}},s);const d=U.useMemo(()=>{const h=(f,B)=>{const S=`set${uw(f)}`;return{set:x=>{const R=si(r,B);R&&u[S]({props:x,uuid:R})},subscribe:yf(r,u,c,f,B)}},m=f=>({copy:S=>{let{w:x,x:R,y:M,z:Z}=S;const V=si(r,f);V&&u.setQuaternion({props:[R,M,Z,x],uuid:V})},set:(S,x,R,M)=>{const Z=si(r,f);Z&&u.setQuaternion({props:[S,x,R,M],uuid:Z})},subscribe:yf(r,u,c,"quaternion",f)}),v=f=>({copy:B=>{let{x:S,y:x,z:R}=B;const M=si(r,f);M&&u.setRotation({props:[S,x,R],uuid:M})},set:(B,S,x)=>{const R=si(r,f);R&&u.setRotation({props:[B,S,x],uuid:R})},subscribe:B=>{const S=mV++,x="bodies",R="quaternion",M=si(r,f);return c[S]={[R]:vE(B)},M&&u.subscribe({props:{id:S,target:x,type:R},uuid:M}),()=>{delete c[S],u.unsubscribe({props:S})}}}),y=(f,B)=>{const S=`set${uw(f)}`;return{copy:x=>{let{x:R,y:M,z:Z}=x;const V=si(r,B);V&&u[S]({props:[R,M,Z],uuid:V})},set:(x,R,M)=>{const Z=si(r,B);Z&&u[S]({props:[x,R,M],uuid:Z})},subscribe:yf(r,u,c,f,B)}};function A(f){return{allowSleep:h("allowSleep",f),angularDamping:h("angularDamping",f),angularFactor:y("angularFactor",f),angularVelocity:y("angularVelocity",f),applyForce(B,S){const x=si(r,f);x&&u.applyForce({props:[B,S],uuid:x})},applyImpulse(B,S){const x=si(r,f);x&&u.applyImpulse({props:[B,S],uuid:x})},applyLocalForce(B,S){const x=si(r,f);x&&u.applyLocalForce({props:[B,S],uuid:x})},applyLocalImpulse(B,S){const x=si(r,f);x&&u.applyLocalImpulse({props:[B,S],uuid:x})},applyTorque(B){const S=si(r,f);S&&u.applyTorque({props:[B],uuid:S})},collisionFilterGroup:h("collisionFilterGroup",f),collisionFilterMask:h("collisionFilterMask",f),collisionResponse:h("collisionResponse",f),fixedRotation:h("fixedRotation",f),isTrigger:h("isTrigger",f),linearDamping:h("linearDamping",f),linearFactor:y("linearFactor",f),mass:h("mass",f),material:h("material",f),position:y("position",f),quaternion:m(f),rotation:v(f),scaleOverride(B){const S=si(r,f);S&&(l[S]=new H(...B))},sleep(){const B=si(r,f);B&&u.sleep({uuid:B})},sleepSpeedLimit:h("sleepSpeedLimit",f),sleepTimeLimit:h("sleepTimeLimit",f),userData:h("userData",f),velocity:y("velocity",f),wakeUp(){const B=si(r,f);B&&u.wakeUp({uuid:B})}}}const b={};return{...A(void 0),at:f=>b[f]||(b[f]=A(f))}},[]);return[r,d]}function fV(n,e,t){return yE("Sphere",n,function(i){if(i===void 0&&(i=[1]),!Array.isArray(i))throw new Error("useSphere args must be an array");return[i[0]]},e,t)}const GE=new H,BE=new H(1,1,1),ZE=new xn,th=new Fe;function hw(n,e,t,i,s){return i===void 0&&(i=BE),n!==void 0?(th.compose(GE.fromArray(e,n*3),ZE.fromArray(t,n*4),i),s&&(s.matrixAutoUpdate=!1,s.matrix.copy(th)),th):th.identity()}const wE=()=>{const n=[];return e=>n.includes(e)?!1:!!n.push(e)};function SE(n){let{allowSleep:e=!1,axisIndex:t=0,broadphase:i="Naive",children:s,defaultContactMaterial:r={contactEquationStiffness:1e6},frictionGravity:o=null,gravity:a=[0,-9.81,0],isPaused:l=!1,iterations:c=5,maxSubSteps:u=10,quatNormalizeFast:C=!1,quatNormalizeSkip:d=0,shouldInvalidate:h=!0,size:m=1e3,solver:v="GS",stepSize:y=1/60,tolerance:A=.001}=n;const{invalidate:b}=$i(),[{bodies:f,events:B,refs:S,scaleOverrides:x,subscriptions:R,worker:M}]=U.useState(()=>({bodies:{},events:{},refs:{},scaleOverrides:{},subscriptions:{},worker:new BT({allowSleep:e,axisIndex:t,broadphase:i,defaultContactMaterial:r,frictionGravity:o,gravity:a,iterations:c,quatNormalizeFast:C,quatNormalizeSkip:d,size:m,solver:v,tolerance:A})}));let Z=0;const V=U.useCallback((le,L)=>{l||(Z+=L,M.step({maxSubSteps:u,stepSize:y,timeSinceLastCalled:Z}),Z=0)},[l,u,y]),N=le=>{var L;let{body:J,contact:{bi:P,bj:ce,...se},target:ee,...re}=le;const ve=(L=B[ee])==null?void 0:L.collide;ve&&ve({body:S[J],contact:{bi:S[P],bj:S[ce],...se},target:S[ee],...re})},D=le=>{var L,J;let{bodyA:P,bodyB:ce}=le;const se=(L=B[P])==null?void 0:L.collideBegin;se&&se({body:S[ce],op:"event",target:S[P],type:"collideBegin"});const ee=(J=B[ce])==null?void 0:J.collideBegin;ee&&ee({body:S[P],op:"event",target:S[ce],type:"collideBegin"})},k=le=>{var L,J;let{bodyA:P,bodyB:ce}=le;const se=(L=B[P])==null?void 0:L.collideEnd;se&&se({body:S[ce],op:"event",target:S[P],type:"collideEnd"});const ee=(J=B[ce])==null?void 0:J.collideEnd;ee&&ee({body:S[P],op:"event",target:S[ce],type:"collideEnd"})},$=le=>{let{active:L,bodies:J=[],observations:P,positions:ce,quaternions:se}=le;for(let ee=0;ee{let[re,ve,ye]=ee;const nt=(R[re]||{})[ye];nt&&nt(ve)}),!!L){for(const ee of Object.values(S).filter(wE()))if(ee instanceof Tg)for(let re=0;re{var L;let{body:J,ray:{uuid:P,...ce},...se}=le;const ee=(L=B[P])==null?void 0:L.rayhit;ee&&ee({body:J?S[J]:null,ray:{uuid:P,...ce},...se})};_u(V),U.useEffect(()=>(M.connect(),M.init(),M.on("collide",N),M.on("collideBegin",D),M.on("collideEnd",k),M.on("frame",$),M.on("rayhit",te),()=>{M.terminate(),M.removeAllListeners()}),[]),U.useEffect(()=>{M.axisIndex=t},[t]),U.useEffect(()=>{M.broadphase=i},[i]),U.useEffect(()=>{M.gravity=a},[a]),U.useEffect(()=>{M.iterations=c},[c]),U.useEffect(()=>{M.tolerance=A},[A]);const Ce=U.useMemo(()=>({bodies:f,events:B,refs:S,scaleOverrides:x,subscriptions:R,worker:M}),[f,B,S,R,M]);return E.jsx(pV.Provider,{value:Ce,children:s})}/** * postprocessing v6.31.0 build Sun May 07 2023 * https://github.com/pmndrs/postprocessing * Copyright 2015-2023 Raoul van Rüschen @@ -4988,7 +4988,7 @@ void main() { `,C+=" "+m+` `,C+=" "+Array(v).join(" ")+"^"}return C+" at index "+(this.index-1)},c.fail={},c.prototype.feed=function(u){var C=this.lexer;C.reset(u,this.lexerState);for(var d;d=C.next();){var h=this.table[this.current];this.options.keepHistory||delete this.table[this.current-1];var m=this.current+1,v=new o(this.grammar,m);this.table.push(v);for(var y=d.value,A=C.constructor===l?d.value:d,b=h.scannable,f=b.length;f--;){var B=b[f],S=B.rule.symbols[B.dot];if(S.test?S.test(A):S.type?S.type===d.type:S.literal===y){var x=B.nextState({data:A,token:d,isToken:!0,reference:m-1});v.states.push(x)}}if(v.process(),v.states.length===0){var R=this.lexer.formatError(d,"invalid syntax")+` `;R+="Unexpected "+(d.type?d.type+" token: ":""),R+=JSON.stringify(d.value!==void 0?d.value:d)+` -`;var M=new Error(R);throw M.offset=this.current,M.token=d,M}this.options.keepHistory&&(h.lexerState=C.save()),this.current++}return h&&(this.lexerState=C.save()),this.results=this.finish(),this},c.prototype.save=function(){var u=this.table[this.current];return u.lexerState=this.lexerState,u},c.prototype.restore=function(u){var C=u.index;this.current=C,this.table[C]=u,this.table.splice(C+1),this.lexerState=u.lexerState,this.results=this.finish()},c.prototype.rewind=function(u){if(!this.options.keepHistory)throw new Error("set option `keepHistory` to enable rewinding");this.restore(this.table[u])},c.prototype.finish=function(){var u=[],C=this.grammar.start;return this.table[this.table.length-1].states.forEach(function(d){d.rule.name===C&&d.dot===d.rule.symbols.length&&d.reference===0&&d.data!==c.fail&&u.push(d)}),u.map(function(d){return d.data})},{Parser:c,Grammar:a,Rule:s}})},function(t,i,s){function r(Z){return Z[0]}function o(Z,V){if(V.type!=="keyval")throw new Error("Expected a keyval object");var N=V.key.toLowerCase();return Z.fields[N]?void 0:(Z.fields[N]=V.value,Z)}function a(Z){for(var V=[],N=0;N=this.str.length)){var d=this.str.charAt(this.pos);return o.isSingleWhiteSpaceCharacter(d)?this.eatWhiteSpace():r.isSpecialChar(d)?this.eatSpecialChars(d):a.isNum(d)?this.eatNumericString(d):this.eatIdString()}},C.prototype.eatIdString=function(){for(var d=[],h=this.pos,m=h;m{switch(n){case"workshop":case"conference":return Gu.normalizeFieldValue(e.getField("booktitle"));case"journal":return Gu.normalizeFieldValue(e.getField("journal"));case"preprint":throw new Error("cannot get venue for preprint")}},bP=n=>` +`;var M=new Error(R);throw M.offset=this.current,M.token=d,M}this.options.keepHistory&&(h.lexerState=C.save()),this.current++}return h&&(this.lexerState=C.save()),this.results=this.finish(),this},c.prototype.save=function(){var u=this.table[this.current];return u.lexerState=this.lexerState,u},c.prototype.restore=function(u){var C=u.index;this.current=C,this.table[C]=u,this.table.splice(C+1),this.lexerState=u.lexerState,this.results=this.finish()},c.prototype.rewind=function(u){if(!this.options.keepHistory)throw new Error("set option `keepHistory` to enable rewinding");this.restore(this.table[u])},c.prototype.finish=function(){var u=[],C=this.grammar.start;return this.table[this.table.length-1].states.forEach(function(d){d.rule.name===C&&d.dot===d.rule.symbols.length&&d.reference===0&&d.data!==c.fail&&u.push(d)}),u.map(function(d){return d.data})},{Parser:c,Grammar:a,Rule:s}})},function(t,i,s){function r(Z){return Z[0]}function o(Z,V){if(V.type!=="keyval")throw new Error("Expected a keyval object");var N=V.key.toLowerCase();return Z.fields[N]?void 0:(Z.fields[N]=V.value,Z)}function a(Z){for(var V=[],N=0;N=this.str.length)){var d=this.str.charAt(this.pos);return o.isSingleWhiteSpaceCharacter(d)?this.eatWhiteSpace():r.isSpecialChar(d)?this.eatSpecialChars(d):a.isNum(d)?this.eatNumericString(d):this.eatIdString()}},C.prototype.eatIdString=function(){for(var d=[],h=this.pos,m=h;m{switch(n){case"workshop":case"conference":return Gu.normalizeFieldValue(e.getField("booktitle"));case"journal":return Gu.normalizeFieldValue(e.getField("journal"));case"preprint":throw new Error("cannot get venue for preprint")}},bP=n=>` @${n.type} { ${Object.entries(n.fields).map(([e,t])=>` ${e} = {${n.getFieldAsString(e)}}`).join(`, `)} @@ -5033,5 +5033,5 @@ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */var yb=function(){return yb=Object.assign||function(e){for(var t,i=1,s=arguments.length;iE.jsx("a",{className:"underline decoration-primary/50 dark:decoration-primary/70 decoration-2 cursor-pointer hover:decoration-primary hover:decoration-3 ease-in-out duration-100",href:n,children:e}),$P=[{time:new Date("2024-06-24"),msg:E.jsxs(E.Fragment,{children:["Always meant to submit something to"," ",E.jsx(Lt,{href:"https://diagrams-2024.diagrams-conference.org/",children:"a conference with DIAGRAM in its name"}),". Well, done"," ",E.jsx(Lt,{href:new URL("/assets/diagrams-24-penrose.pdf",self.location).href,children:"that"}),"."]})},{time:new Date("2024-06-24"),msg:E.jsxs(E.Fragment,{children:["The ",E.jsx(Lt,{href:"https://rosejs.dev/",children:"Rose"})," paper was accepted at ECOOP 2024!"]})},{time:new Date("2024-05-10"),msg:E.jsxs(E.Fragment,{children:["Excited to welcome summer interns"," ",E.jsx(Lt,{href:"https://github.com/kyleleesea",children:"Kyle"})," and"," ",E.jsx(Lt,{href:"https://griffinteller.com/",children:"Griffin"})," to the Penrose team!"]})},{time:new Date("2024-04-10"),msg:E.jsxs(E.Fragment,{children:[E.jsx("i",{children:'"Edgeworth: Efficient and Scalable Authoring of Visual Thinking Activities"'})," ","was accepted at Learning @ Scale 2024!"]})},{time:new Date("2024-04-10"),msg:E.jsxs(E.Fragment,{children:[E.jsx("i",{children:'"Minkowski Penalties: Robust Differentiable Constraint Enforcement for Vector Graphics"'})," ","was accepted at SIGGRAPH 2024!"]})},{time:new Date("2024-02-28"),msg:E.jsxs(E.Fragment,{children:["Paper accepted at PLDI 2024:"," ",E.jsx("i",{children:"Syntactic Code Search with Sequence-to-Tree Matching"}),"!"]})},{time:new Date("2024-01-02"),msg:"New year, new round of rewriting this site. Used Tailwind this time and we have dark mode now!"},{time:new Date("2023-12-08"),msg:E.jsxs(E.Fragment,{children:["Invited to attend an"," ",E.jsx(Lt,{href:"https://aimath.org/pastworkshops/cyberinfrastructure.html",children:"AIM workshop"})," ","on"," ",E.jsx(Lt,{href:"https://code4math.org/",children:"Digital Ecosystems for Mathematics"})," ","and started ",E.jsx(Lt,{href:"https://mathdiagrams.com",children:"mathdiagrams.com"}),"!"]})},{time:new Date("2023-07-14"),msg:E.jsxs(E.Fragment,{children:["Released ",E.jsx(Lt,{href:"https://penrose.cs.cmu.edu/blog/v3",children:"Penrose 3.0"}),"!"]})},{time:new Date("2023-06-01"),msg:E.jsxs(E.Fragment,{children:[E.jsx(Lt,{href:"https://www.cmu.edu/scs/s3d/reuse/",children:"REUSE"})," students"," ",E.jsx(Lt,{href:"https://www.linkedin.com/in/rijul-jain-585a62191",children:"Rijul Jain"})," ","and ",E.jsx(Lt,{href:"https://ravenrothkopf.github.io/",children:"Raven Rothkopf"})," joined Penrose this summer. Welcome!"]})},{time:new Date("2022-08-30"),msg:"Spent the summer as an intern in Machine Intelligence at Apple. Stay tuned for more updates on our work!"},{time:new Date("2022-04-30"),msg:E.jsxs(E.Fragment,{children:["I proposed (",E.jsx(Lt,{href:new URL("/assets/thesis-proposal-talk.pdf",self.location).href,children:"talk"}),", (",E.jsx(Lt,{href:new URL("/assets/thesis-proposal.pdf",self.location).href,children:"text"}),")) my dissertation. Officially a PhD candidate now!"]})},{time:new Date("2021-07-01"),msg:E.jsxs(E.Fragment,{children:["My work at Microsoft,"," ",E.jsx("i",{children:'"reCode: A Lightweight Find-and-Replace Interaction in the IDE for Transforming Code by Example,"'})," ","was conditionally accepted by"," ",E.jsx(Lt,{href:"https://uist.acm.org/uist2021/",children:"UIST 2021"}),"!"]})},{time:new Date("2020-05-01"),msg:E.jsxs(E.Fragment,{children:["I'll join ",E.jsx(Lt,{href:"https://microsoft.github.io/prose/",children:"PROSE"})," @ Microsoft Research as a Research Intern this summer!"]})},{time:new Date("2020-04-01"),msg:E.jsxs(E.Fragment,{children:["The first conference paper on"," ",E.jsx(Lt,{href:"https://penrose.cs.cm",children:"Penrose"}),","," ",E.jsx("i",{children:'"Penrose: From Mathematical Notation to Beautiful Diagrams,"'})," was accepted by ",E.jsx(Lt,{href:"https://s2020.siggraph.org/",children:"SIGGRAPH 2020"}),"!"]})},{time:new Date("2020-03-01"),msg:E.jsxs(E.Fragment,{children:["The CHI paper won a ",E.jsx("b",{children:"Best Paper Honourable Mention award"})," 🏆!"]})},{time:new Date("2020-01-01"),msg:E.jsxs(E.Fragment,{children:["Our paper"," ",E.jsx("i",{children:'"How Domain Experts Create Conceptual Diagrams and Implications for Tool Design"'})," ","was accepted by ",E.jsx(Lt,{href:"http://chi2020.acm.org/",children:"CHI 2020"})," 🏖️!"]})},{time:new Date("2019-10-01"),msg:E.jsxs(E.Fragment,{children:["I presented our papers at"," ",E.jsx(Lt,{href:"http://plateau-workshop.org/",children:"PLATEAU 2019"})," with Max and Anael!"]})},{time:new Date("2019-05-01"),msg:E.jsxs(E.Fragment,{children:["I finished 7th at the 2019"," ",E.jsx(Lt,{href:"https://en.wikipedia.org/wiki/ACUI_Collegiate_Pocket_Billiards_National_Championship",children:"ACUI Collegiate Nine-ball National Championship"})," ","🎱!"]})},{time:new Date("2019-05-01"),msg:E.jsxs(E.Fragment,{children:["Anael Kuperwajs,"," ",E.jsx(Lt,{href:"https://www.linkedin.com/in/courtney-e-miller/",children:"Courtney Miller"}),", ",E.jsx(Lt,{href:"https://a9.io/",children:"Max Krieger"})," will join us as"," ",E.jsx(Lt,{href:"https://www.cmu.edu/scs/isr/reuse/",children:"REUSE"})," students this summer. Welcome!"]})},{time:new Date("2018-04-01"),msg:E.jsx(E.Fragment,{children:"I will join CMU as a Ph.D. student!"})},{time:new Date("2018-01-01"),msg:E.jsx(E.Fragment,{children:"I will be one of the TAs for COMS 4115 again in Spring 2018."})},{time:new Date("2017-10-01"),msg:E.jsxs(E.Fragment,{children:["Gave a talk at"," ",E.jsx(Lt,{href:"https://2017.splashcon.org/event/dsldi-2017-substance-and-style-domain-specific-languages-for-mathematical-diagrams",children:"DSLDI 2017"})," ","in Vancouver, Canada."]})},{time:new Date("2017-05-01"),msg:E.jsxs(E.Fragment,{children:["Joined ",E.jsx(Lt,{href:"http://isri.cmu.edu/education/reu-se/",children:"REU-SE"}),", a summer research program, at Carnegie Mellon University."]})}];var JV={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},mS=Ji.createContext&&Ji.createContext(JV),ia=globalThis&&globalThis.__assign||function(){return ia=Object.assign||function(n){for(var e,t=1,i=arguments.length;tE.jsx("a",{href:t,children:E.jsxs("div",{className:`rounded shadow-md hover:shadow-xl w-full h-36 lg:h-48 bg-white dark:shadow-none dark:bg-zinc-700 dark:rounded-lg dark:border-primary bg-contain bg-left-top dark:drop-shadow-none dark:hover:drop-shadow-none dark:transition-none transition-all ease-in-out duration-100 dark:hover:shadow-md dark:hover:scale-105 overflow-hidden scale-100 - `,children:[E.jsxs("svg",{className:"absolute z-[-50]",width:"100%",viewBox:"0 0 100 100",children:[E.jsxs("defs",{children:[E.jsx("filter",{id:"grayscale-filter",children:E.jsx("feColorMatrix",{type:"saturate",values:"0"})}),E.jsxs("filter",{id:"color-tint-filter",children:[E.jsx("feColorMatrix",{type:"matrix",values:"0.7725 0 0 0 0 0 0.3490 0 0 0 0 0 0.9569 0 0 0 0 0 1 0"}),E.jsxs("feComponentTransfer",{children:[E.jsx("feFuncR",{type:"table",tableValues:"0 0.7725"}),E.jsx("feFuncG",{type:"table",tableValues:"0 0.3490"}),E.jsx("feFuncB",{type:"table",tableValues:"0 0.9569"})]})]}),E.jsxs("linearGradient",{id:"gradient-overlay",x1:"0%",y1:"50%",x2:"100%",y2:"50%",children:[E.jsx("stop",{offset:"0%",style:{stopColor:s?"#333":"#fff",stopOpacity:.3}}),E.jsx("stop",{offset:"50%",style:{stopColor:s?"#111":"#fff",stopOpacity:s?.35:.7}}),E.jsx("stop",{offset:"100%",style:{stopColor:s?"#333":"#fff",stopOpacity:.95}})]})]}),E.jsx("image",{href:i,x:50,y:-8,width:80,filter:s?"url(#grayscale-filter) ":""}),E.jsx("rect",{width:"100",height:"100",style:{fill:"url(#gradient-overlay)"}})]}),E.jsx("div",{className:"text-3xl -font-medium w-7/10 px-6 pt-4 lg:py-6 text-primary/70 dark:text-primary",children:n}),E.jsx("div",{className:"text-lg font-extralight w-7/10 px-6 py-4 lg:py-6",children:e})]})}),I_={colors:{primary:"#C559F4"}},u_=()=>{const[n,e]=U.useState(!1),t=U.useRef(null);return U.useEffect(()=>{const i=()=>{if(t.current!==null){const s=t.current.scrollTop===0;e(!s)}};if(t.current!==null){const s=t.current;return s.addEventListener("scroll",i),()=>{s.removeEventListener("scroll",i)}}},[]),E.jsxs("div",{className:"my-2 relative",children:[n&&E.jsx("div",{className:"invisible md:visible absolute top-0 left-0 right-0 h-10 bg-gradient-to-b from-white dark:from-zinc-800 to-transparent"}),E.jsx("div",{ref:t,className:"overflow-auto max-h-[50vh]",children:$P.map(({time:i,msg:s},r)=>E.jsxs("div",{className:"py-2 text-gray-500 md:text-sm dark:text-neutral-300 ",children:[E.jsx("div",{className:"w-fit bg-gray-100 text-gray-400 rounded py-px px-1 dark:text-neutral-400 dark:bg-zinc-700",children:i.toLocaleString("default",{month:"long",year:"numeric"})}),s]},`news-${r}`))}),E.jsx("div",{className:"invisible md:visible absolute bottom-0 left-0 right-0 h-12 bg-gradient-to-t from-white dark:from-zinc-800 to-transparent"})]})},C_=({data:n,children:e})=>{const[t,i]=U.useState(!1),s=()=>{navigator.clipboard.writeText(n),i(!0),setTimeout(()=>{i(!1)},5e3)};return E.jsxs("div",{children:[E.jsx("span",{className:"underline decoration-primary/50 dark:decoration-primary/70 decoration-2 cursor-pointer hover:decoration-primary hover:decoration-3 ease-in-out duration-100",onClick:s,children:e}),t&&E.jsx("span",{children:" (Copied to clipboard)"})]})},d_=()=>E.jsx("div",{children:BP.map(({pdf:n,title:e,venue:t,authors:i,talk:s,coauthors:r,authorDisplayNames:o,series:a,slides:l,id:c,bibtex:u})=>E.jsxs("div",{className:"my-4",children:[E.jsx("a",{href:n,children:E.jsx("span",{className:"text-lg font-semibold dark:font-normal cursor-pointer",children:e})}),E.jsx("br",{}),E.jsx("span",{className:"text-base font-light",children:i.map((C,d)=>o?.get(d)??C).map(C=>r?.includes(C)?`${C}*`:C).map(C=>C==="Wode Ni"||C==="Wode Ni*"?E.jsx("strong",{children:C}):C).map((C,d)=>E.jsxs("span",{children:[E.jsx("li",{className:"inline dark:font-thin",children:C}),d!==i.length-1&&E.jsx("span",{children:", "})]},`${c}-author-${d}`))}),". ",E.jsx("span",{className:"text-base font-light italic",children:a}),".",E.jsxs("div",{className:"flex gap-2",children:[u&&E.jsxs("div",{className:"flex items-center gap-0.5",children:[E.jsx(c_,{}),E.jsx(C_,{data:u,children:"bib"})]}),n&&E.jsxs("div",{className:"flex items-center gap-0.5",children:[E.jsx(a_,{}),E.jsx(Lt,{href:n,children:"pdf"})]}),s&&E.jsxs("div",{className:"flex items-center gap-0.5",children:[E.jsx(l_,{}),E.jsx(Lt,{href:s,children:"talk"})]}),l&&E.jsxs("div",{className:"flex items-center gap-0.5",children:[E.jsx(g_,{}),E.jsx(Lt,{href:l,children:"slides"})]})]})]},c))}),h_=({className:n})=>E.jsx("div",{className:n,children:E.jsxs("div",{className:"flex h-44",children:[E.jsx("div",{className:"w-48 h-48",children:E.jsx(hP,{color:I_.colors.primary})}),E.jsx(p3,{className:"w-44 ml-4 mt-8"})]})}),A_=({toggleDark:n})=>E.jsx(QV,{onClick:n,children:E.jsx(i_,{className:"fill-icon dark:fill-icon-dark"})}),p_=({className:n,toggleDark:e})=>E.jsxs("div",{className:`${n} flex items-start md:items-top md:ml-auto mb-0 color-primary`,children:[E.jsx(f_,{}),E.jsx(jV,{}),E.jsx(qV,{}),E.jsx($V,{}),E.jsx(m_,{}),E.jsx(A_,{toggleDark:e})]}),QV=({children:n,...e})=>E.jsx("div",{className:"mx-1 w-6 h-6 text-xl flex cursor-pointer justify-center hover:opacity-50 ease-in-out duration-200",...e,children:n}),Ju=({url:n,icon:e})=>E.jsx(QV,{children:E.jsx("a",{href:n,children:e})}),m_=()=>E.jsx(Ju,{url:"https://goo.gl/maps/Zp92ofs6ze3y8hc19",icon:E.jsx(s_,{className:"fill-icon dark:fill-icon-dark "})}),jV=()=>E.jsx(Ju,{url:"https://twitter.com/wodenimoni",icon:E.jsx(o_,{className:"fill-icon dark:fill-icon-dark"})}),qV=()=>E.jsx(Ju,{url:"https://github.com/wodeni",icon:E.jsx(r_,{className:"fill-icon dark:fill-icon-dark"})}),f_=()=>E.jsx(Ju,{url:"http://wodenimoni.com/nimo-markdown-cv/",icon:E.jsx("span",{className:"font-extralight leading-5 text-icon top-[-4px] left-[-3px] relative",children:"CV"})}),$V=()=>E.jsx(Ju,{url:"mailto:nimo@cmu.edu",icon:E.jsx(n_,{className:"fill-icon dark:fill-icon-dark grow"})}),lh=({className:n,children:e})=>E.jsx("p",{className:`${n} font-sans font-extralight text-lg my-2 dark:text-neutral-100`,children:e}),gh=({header:n,children:e})=>{const t=n.toLowerCase();return E.jsxs("div",{id:t,className:"my-4 md:my-8",children:[E.jsxs("span",{className:"group font-bold text-3xl tracking-tight curosr-pointer relative ",children:[E.jsxs("svg",{height:30,className:"w-full translate-y-1 absolute top-0 left-0",children:[E.jsx("rect",{x:0,y:0,width:5,height:50,className:"group-hover:opacity-30 group-hover:scale-x-400 transition-transform transform fill-primary"}),E.jsx("rect",{x:0,y:0,width:5,height:50,className:"fill-primary"})]}),E.jsx(qP,{className:"ml-[10px] w-full dark:text-neutral-100",smooth:!0,to:`/#${t}`,children:n})]}),e]})},b_=()=>E.jsxs("div",{className:"md:col-span-3 mt-8 w-full flex flex-col text-sm justify-center items-center text-gray-500 dark:text-neutral-400",children:[E.jsxs("span",{className:"mb-2",children:["© ",new Date().getUTCFullYear(),' Wode "Nimo" Ni.']}),E.jsxs("div",{className:"flex items-start color-primary text-sm",children:[E.jsx(jV,{}),E.jsx(qV,{}),E.jsx($V,{})]})]}),v_=()=>{const[n,e]=U.useState(window.matchMedia("(prefers-color-scheme: dark)").matches),t=()=>{e(!n)};function i(){window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?e(!0):e(!1)}return U.useEffect(()=>{window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",i)}),U.useEffect(()=>{document.documentElement.classList.toggle("dark",n)},[n]),E.jsxs("div",{className:"font-sans md:grid md:grid-cols-3 p-4 md:p-10 max-w-screen-xl dark:text-neutral-100",children:[E.jsx(h_,{className:"md:col-span-2"}),E.jsx(p_,{className:"mt-8",toggleDark:t}),E.jsx(lh,{className:"md:col-span-2 mt-8",children:"I'm Nimo. I build ergonomic digital tools to make difficult things feel simple."}),E.jsxs("div",{className:"max-w-screen-md md:col-span-2",children:[E.jsxs(gh,{header:"Research",children:[E.jsxs(lh,{className:"",children:["I am a Ph.D. candidate at Carnegie Mellon University, School of Computer Science, advised by"," ",E.jsx(Lt,{href:"http://pact.cs.cmu.edu/koedinger.html",children:"Ken Koedinger"})," ","and ",E.jsx(Lt,{href:"https://www.cs.cmu.edu/~jssunshi/",children:"Josh Sunshine"}),". Here are some selected papers. Refer to the"," ",E.jsx(Lt,{href:"http://wodenimoni.com/nimo-markdown-cv/",children:"CV"})," for more."]}),E.jsx(d_,{})]}),E.jsx(gh,{header:"Tools",children:E.jsxs("div",{className:"grid lg:grid-cols-2 gap-2 md:gap-4 lg:gap-8 my-4",children:[E.jsx(Wf,{name:"Penrose",desc:"Create beautiful diagrams just by typing math notation in plain text.",link:"https://penrose.cs.cmu.edu/",logo:m3,dark:n}),E.jsx(Wf,{name:"Edgeworth",desc:"Diagrammatic problem generation by program mutation.",link:"https://penrose.github.io/penrose/edgeworth/develop/",logo:f3,dark:n}),E.jsx(Wf,{name:"Math Diagrams",desc:"A growing collection of open-source math visualizations.",link:"https://mathdiagrams.com/",dark:n,logo:b3})]})}),E.jsxs(gh,{header:"About",children:[E.jsx(lh,{children:'My name is 倪沃德 (ní wò dé) in Chinese. “Nimo” has been my alias since my street dancing days. If you find "Wo-de" hard to pronounce, default to “Nimo”.'}),E.jsx(lh,{children:"I am an avid pool player. I play in local leagues and national tournaments."})]})]}),E.jsx("div",{className:"md:ml-10 md:max-w-60",children:E.jsx(gh,{header:"News",children:E.jsx(u_,{})})}),E.jsx(b_,{})]})};Vf.createRoot(document.getElementById("root")).render(E.jsx(Ji.StrictMode,{children:E.jsx(PP,{children:E.jsx(v_,{})})})); +***************************************************************************** */var yb=function(){return yb=Object.assign||function(e){for(var t,i=1,s=arguments.length;iE.jsx("a",{className:"underline decoration-primary/50 dark:decoration-primary/70 decoration-2 cursor-pointer hover:decoration-primary hover:decoration-3 ease-in-out duration-100",href:n,children:e}),$P=[{time:new Date("2024-07-18"),msg:E.jsxs(E.Fragment,{children:["Attending ",E.jsx(Ht,{href:"",children:"L@S'24"})," for the first time in Atlanta. Check out the"," ",E.jsxs(Ht,{href:new URL("/assets/las-24-edgeworth-talk.key",self.location).href,children:["slides"," "]}),"of my talk!"]})},{time:new Date("2024-06-24"),msg:E.jsxs(E.Fragment,{children:["Always meant to submit something to"," ",E.jsx(Ht,{href:"https://diagrams-2024.diagrams-conference.org/",children:"a conference with DIAGRAM in its name"}),". Well, done"," ",E.jsx(Ht,{href:new URL("/assets/diagrams-24-penrose.pdf",self.location).href,children:"that"}),"."]})},{time:new Date("2024-06-24"),msg:E.jsxs(E.Fragment,{children:["The ",E.jsx(Ht,{href:"https://rosejs.dev/",children:"Rose"})," paper was accepted at ECOOP 2024!"]})},{time:new Date("2024-05-10"),msg:E.jsxs(E.Fragment,{children:["Excited to welcome summer interns"," ",E.jsx(Ht,{href:"https://github.com/kyleleesea",children:"Kyle"})," and"," ",E.jsx(Ht,{href:"https://griffinteller.com/",children:"Griffin"})," to the Penrose team!"]})},{time:new Date("2024-04-10"),msg:E.jsxs(E.Fragment,{children:[E.jsx("i",{children:'"Edgeworth: Efficient and Scalable Authoring of Visual Thinking Activities"'})," ","was accepted at Learning @ Scale 2024!"]})},{time:new Date("2024-04-10"),msg:E.jsxs(E.Fragment,{children:[E.jsx("i",{children:'"Minkowski Penalties: Robust Differentiable Constraint Enforcement for Vector Graphics"'})," ","was accepted at SIGGRAPH 2024!"]})},{time:new Date("2024-02-28"),msg:E.jsxs(E.Fragment,{children:["Paper accepted at PLDI 2024:"," ",E.jsx("i",{children:"Syntactic Code Search with Sequence-to-Tree Matching"}),"!"]})},{time:new Date("2024-01-02"),msg:"New year, new round of rewriting this site. Used Tailwind this time and we have dark mode now!"},{time:new Date("2023-12-08"),msg:E.jsxs(E.Fragment,{children:["Invited to attend an"," ",E.jsx(Ht,{href:"https://aimath.org/pastworkshops/cyberinfrastructure.html",children:"AIM workshop"})," ","on"," ",E.jsx(Ht,{href:"https://code4math.org/",children:"Digital Ecosystems for Mathematics"})," ","and started ",E.jsx(Ht,{href:"https://mathdiagrams.com",children:"mathdiagrams.com"}),"!"]})},{time:new Date("2023-07-14"),msg:E.jsxs(E.Fragment,{children:["Released ",E.jsx(Ht,{href:"https://penrose.cs.cmu.edu/blog/v3",children:"Penrose 3.0"}),"!"]})},{time:new Date("2023-06-01"),msg:E.jsxs(E.Fragment,{children:[E.jsx(Ht,{href:"https://www.cmu.edu/scs/s3d/reuse/",children:"REUSE"})," students"," ",E.jsx(Ht,{href:"https://www.linkedin.com/in/rijul-jain-585a62191",children:"Rijul Jain"})," ","and ",E.jsx(Ht,{href:"https://ravenrothkopf.github.io/",children:"Raven Rothkopf"})," joined Penrose this summer. Welcome!"]})},{time:new Date("2022-08-30"),msg:"Spent the summer as an intern in Machine Intelligence at Apple. Stay tuned for more updates on our work!"},{time:new Date("2022-04-30"),msg:E.jsxs(E.Fragment,{children:["I proposed (",E.jsx(Ht,{href:new URL("/assets/thesis-proposal-talk.pdf",self.location).href,children:"talk"}),", (",E.jsx(Ht,{href:new URL("/assets/thesis-proposal.pdf",self.location).href,children:"text"}),")) my dissertation. Officially a PhD candidate now!"]})},{time:new Date("2021-07-01"),msg:E.jsxs(E.Fragment,{children:["My work at Microsoft,"," ",E.jsx("i",{children:'"reCode: A Lightweight Find-and-Replace Interaction in the IDE for Transforming Code by Example,"'})," ","was conditionally accepted by"," ",E.jsx(Ht,{href:"https://uist.acm.org/uist2021/",children:"UIST 2021"}),"!"]})},{time:new Date("2020-05-01"),msg:E.jsxs(E.Fragment,{children:["I'll join ",E.jsx(Ht,{href:"https://microsoft.github.io/prose/",children:"PROSE"})," @ Microsoft Research as a Research Intern this summer!"]})},{time:new Date("2020-04-01"),msg:E.jsxs(E.Fragment,{children:["The first conference paper on"," ",E.jsx(Ht,{href:"https://penrose.cs.cm",children:"Penrose"}),","," ",E.jsx("i",{children:'"Penrose: From Mathematical Notation to Beautiful Diagrams,"'})," was accepted by ",E.jsx(Ht,{href:"https://s2020.siggraph.org/",children:"SIGGRAPH 2020"}),"!"]})},{time:new Date("2020-03-01"),msg:E.jsxs(E.Fragment,{children:["The CHI paper won a ",E.jsx("b",{children:"Best Paper Honourable Mention award"})," 🏆!"]})},{time:new Date("2020-01-01"),msg:E.jsxs(E.Fragment,{children:["Our paper"," ",E.jsx("i",{children:'"How Domain Experts Create Conceptual Diagrams and Implications for Tool Design"'})," ","was accepted by ",E.jsx(Ht,{href:"http://chi2020.acm.org/",children:"CHI 2020"})," 🏖️!"]})},{time:new Date("2019-10-01"),msg:E.jsxs(E.Fragment,{children:["I presented our papers at"," ",E.jsx(Ht,{href:"http://plateau-workshop.org/",children:"PLATEAU 2019"})," with Max and Anael!"]})},{time:new Date("2019-05-01"),msg:E.jsxs(E.Fragment,{children:["I finished 7th at the 2019"," ",E.jsx(Ht,{href:"https://en.wikipedia.org/wiki/ACUI_Collegiate_Pocket_Billiards_National_Championship",children:"ACUI Collegiate Nine-ball National Championship"})," ","🎱!"]})},{time:new Date("2019-05-01"),msg:E.jsxs(E.Fragment,{children:["Anael Kuperwajs,"," ",E.jsx(Ht,{href:"https://www.linkedin.com/in/courtney-e-miller/",children:"Courtney Miller"}),", ",E.jsx(Ht,{href:"https://a9.io/",children:"Max Krieger"})," will join us as"," ",E.jsx(Ht,{href:"https://www.cmu.edu/scs/isr/reuse/",children:"REUSE"})," students this summer. Welcome!"]})},{time:new Date("2018-04-01"),msg:E.jsx(E.Fragment,{children:"I will join CMU as a Ph.D. student!"})},{time:new Date("2018-01-01"),msg:E.jsx(E.Fragment,{children:"I will be one of the TAs for COMS 4115 again in Spring 2018."})},{time:new Date("2017-10-01"),msg:E.jsxs(E.Fragment,{children:["Gave a talk at"," ",E.jsx(Ht,{href:"https://2017.splashcon.org/event/dsldi-2017-substance-and-style-domain-specific-languages-for-mathematical-diagrams",children:"DSLDI 2017"})," ","in Vancouver, Canada."]})},{time:new Date("2017-05-01"),msg:E.jsxs(E.Fragment,{children:["Joined ",E.jsx(Ht,{href:"http://isri.cmu.edu/education/reu-se/",children:"REU-SE"}),", a summer research program, at Carnegie Mellon University."]})}];var JV={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},mS=Ji.createContext&&Ji.createContext(JV),ia=globalThis&&globalThis.__assign||function(){return ia=Object.assign||function(n){for(var e,t=1,i=arguments.length;tE.jsx("a",{href:t,children:E.jsxs("div",{className:`rounded shadow-md hover:shadow-xl w-full h-36 lg:h-48 bg-white dark:shadow-none dark:bg-zinc-700 dark:rounded-lg dark:border-primary bg-contain bg-left-top dark:drop-shadow-none dark:hover:drop-shadow-none dark:transition-none transition-all ease-in-out duration-100 dark:hover:shadow-md dark:hover:scale-105 overflow-hidden scale-100 + `,children:[E.jsxs("svg",{className:"absolute z-[-50]",width:"100%",viewBox:"0 0 100 100",children:[E.jsxs("defs",{children:[E.jsx("filter",{id:"grayscale-filter",children:E.jsx("feColorMatrix",{type:"saturate",values:"0"})}),E.jsxs("filter",{id:"color-tint-filter",children:[E.jsx("feColorMatrix",{type:"matrix",values:"0.7725 0 0 0 0 0 0.3490 0 0 0 0 0 0.9569 0 0 0 0 0 1 0"}),E.jsxs("feComponentTransfer",{children:[E.jsx("feFuncR",{type:"table",tableValues:"0 0.7725"}),E.jsx("feFuncG",{type:"table",tableValues:"0 0.3490"}),E.jsx("feFuncB",{type:"table",tableValues:"0 0.9569"})]})]}),E.jsxs("linearGradient",{id:"gradient-overlay",x1:"0%",y1:"50%",x2:"100%",y2:"50%",children:[E.jsx("stop",{offset:"0%",style:{stopColor:s?"#333":"#fff",stopOpacity:.3}}),E.jsx("stop",{offset:"50%",style:{stopColor:s?"#111":"#fff",stopOpacity:s?.35:.7}}),E.jsx("stop",{offset:"100%",style:{stopColor:s?"#333":"#fff",stopOpacity:.95}})]})]}),E.jsx("image",{href:i,x:50,y:-8,width:80,filter:s?"url(#grayscale-filter) ":""}),E.jsx("rect",{width:"100",height:"100",style:{fill:"url(#gradient-overlay)"}})]}),E.jsx("div",{className:"text-3xl -font-medium w-7/10 px-6 pt-4 lg:py-6 text-primary/70 dark:text-primary",children:n}),E.jsx("div",{className:"text-lg font-extralight w-7/10 px-6 py-4 lg:py-6",children:e})]})}),I_={colors:{primary:"#C559F4"}},u_=()=>{const[n,e]=U.useState(!1),t=U.useRef(null);return U.useEffect(()=>{const i=()=>{if(t.current!==null){const s=t.current.scrollTop===0;e(!s)}};if(t.current!==null){const s=t.current;return s.addEventListener("scroll",i),()=>{s.removeEventListener("scroll",i)}}},[]),E.jsxs("div",{className:"my-2 relative",children:[n&&E.jsx("div",{className:"invisible md:visible absolute top-0 left-0 right-0 h-10 bg-gradient-to-b from-white dark:from-zinc-800 to-transparent"}),E.jsx("div",{ref:t,className:"overflow-auto max-h-[50vh]",children:$P.map(({time:i,msg:s},r)=>E.jsxs("div",{className:"py-2 text-gray-500 md:text-sm dark:text-neutral-300 ",children:[E.jsx("div",{className:"w-fit bg-gray-100 text-gray-400 rounded py-px px-1 dark:text-neutral-400 dark:bg-zinc-700",children:i.toLocaleString("default",{month:"long",year:"numeric"})}),s]},`news-${r}`))}),E.jsx("div",{className:"invisible md:visible absolute bottom-0 left-0 right-0 h-12 bg-gradient-to-t from-white dark:from-zinc-800 to-transparent"})]})},C_=({data:n,children:e})=>{const[t,i]=U.useState(!1),s=()=>{navigator.clipboard.writeText(n),i(!0),setTimeout(()=>{i(!1)},5e3)};return E.jsxs("div",{children:[E.jsx("span",{className:"underline decoration-primary/50 dark:decoration-primary/70 decoration-2 cursor-pointer hover:decoration-primary hover:decoration-3 ease-in-out duration-100",onClick:s,children:e}),t&&E.jsx("span",{children:" (Copied to clipboard)"})]})},d_=()=>E.jsx("div",{children:BP.map(({pdf:n,title:e,venue:t,authors:i,talk:s,coauthors:r,authorDisplayNames:o,series:a,slides:l,id:c,bibtex:u})=>E.jsxs("div",{className:"my-4",children:[E.jsx("a",{href:n,children:E.jsx("span",{className:"text-lg font-semibold dark:font-normal cursor-pointer",children:e})}),E.jsx("br",{}),E.jsx("span",{className:"text-base font-light",children:i.map((C,d)=>o?.get(d)??C).map(C=>r?.includes(C)?`${C}*`:C).map(C=>C==="Wode Ni"||C==="Wode Ni*"?E.jsx("strong",{children:C}):C).map((C,d)=>E.jsxs("span",{children:[E.jsx("li",{className:"inline dark:font-thin",children:C}),d!==i.length-1&&E.jsx("span",{children:", "})]},`${c}-author-${d}`))}),". ",E.jsx("span",{className:"text-base font-light italic",children:a}),".",E.jsxs("div",{className:"flex gap-2",children:[u&&E.jsxs("div",{className:"flex items-center gap-0.5",children:[E.jsx(c_,{}),E.jsx(C_,{data:u,children:"bib"})]}),n&&E.jsxs("div",{className:"flex items-center gap-0.5",children:[E.jsx(a_,{}),E.jsx(Ht,{href:n,children:"pdf"})]}),s&&E.jsxs("div",{className:"flex items-center gap-0.5",children:[E.jsx(l_,{}),E.jsx(Ht,{href:s,children:"talk"})]}),l&&E.jsxs("div",{className:"flex items-center gap-0.5",children:[E.jsx(g_,{}),E.jsx(Ht,{href:l,children:"slides"})]})]})]},c))}),h_=({className:n})=>E.jsx("div",{className:n,children:E.jsxs("div",{className:"flex h-44",children:[E.jsx("div",{className:"w-48 h-48",children:E.jsx(hP,{color:I_.colors.primary})}),E.jsx(p3,{className:"w-44 ml-4 mt-8"})]})}),A_=({toggleDark:n})=>E.jsx(QV,{onClick:n,children:E.jsx(i_,{className:"fill-icon dark:fill-icon-dark"})}),p_=({className:n,toggleDark:e})=>E.jsxs("div",{className:`${n} flex items-start md:items-top md:ml-auto mb-0 color-primary`,children:[E.jsx(f_,{}),E.jsx(jV,{}),E.jsx(qV,{}),E.jsx($V,{}),E.jsx(m_,{}),E.jsx(A_,{toggleDark:e})]}),QV=({children:n,...e})=>E.jsx("div",{className:"mx-1 w-6 h-6 text-xl flex cursor-pointer justify-center hover:opacity-50 ease-in-out duration-200",...e,children:n}),Ju=({url:n,icon:e})=>E.jsx(QV,{children:E.jsx("a",{href:n,children:e})}),m_=()=>E.jsx(Ju,{url:"https://goo.gl/maps/Zp92ofs6ze3y8hc19",icon:E.jsx(s_,{className:"fill-icon dark:fill-icon-dark "})}),jV=()=>E.jsx(Ju,{url:"https://twitter.com/wodenimoni",icon:E.jsx(o_,{className:"fill-icon dark:fill-icon-dark"})}),qV=()=>E.jsx(Ju,{url:"https://github.com/wodeni",icon:E.jsx(r_,{className:"fill-icon dark:fill-icon-dark"})}),f_=()=>E.jsx(Ju,{url:"http://wodenimoni.com/nimo-markdown-cv/",icon:E.jsx("span",{className:"font-extralight leading-5 text-icon top-[-4px] left-[-3px] relative",children:"CV"})}),$V=()=>E.jsx(Ju,{url:"mailto:nimo@cmu.edu",icon:E.jsx(n_,{className:"fill-icon dark:fill-icon-dark grow"})}),lh=({className:n,children:e})=>E.jsx("p",{className:`${n} font-sans font-extralight text-lg my-2 dark:text-neutral-100`,children:e}),gh=({header:n,children:e})=>{const t=n.toLowerCase();return E.jsxs("div",{id:t,className:"my-4 md:my-8",children:[E.jsxs("span",{className:"group font-bold text-3xl tracking-tight curosr-pointer relative ",children:[E.jsxs("svg",{height:30,className:"w-full translate-y-1 absolute top-0 left-0",children:[E.jsx("rect",{x:0,y:0,width:5,height:50,className:"group-hover:opacity-30 group-hover:scale-x-400 transition-transform transform fill-primary"}),E.jsx("rect",{x:0,y:0,width:5,height:50,className:"fill-primary"})]}),E.jsx(qP,{className:"ml-[10px] w-full dark:text-neutral-100",smooth:!0,to:`/#${t}`,children:n})]}),e]})},b_=()=>E.jsxs("div",{className:"md:col-span-3 mt-8 w-full flex flex-col text-sm justify-center items-center text-gray-500 dark:text-neutral-400",children:[E.jsxs("span",{className:"mb-2",children:["© ",new Date().getUTCFullYear(),' Wode "Nimo" Ni.']}),E.jsxs("div",{className:"flex items-start color-primary text-sm",children:[E.jsx(jV,{}),E.jsx(qV,{}),E.jsx($V,{})]})]}),v_=()=>{const[n,e]=U.useState(window.matchMedia("(prefers-color-scheme: dark)").matches),t=()=>{e(!n)};function i(){window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?e(!0):e(!1)}return U.useEffect(()=>{window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",i)}),U.useEffect(()=>{document.documentElement.classList.toggle("dark",n)},[n]),E.jsxs("div",{className:"font-sans md:grid md:grid-cols-3 p-4 md:p-10 max-w-screen-xl dark:text-neutral-100",children:[E.jsx(h_,{className:"md:col-span-2"}),E.jsx(p_,{className:"mt-8",toggleDark:t}),E.jsx(lh,{className:"md:col-span-2 mt-8",children:"I'm Nimo. I build ergonomic digital tools to make difficult things feel simple."}),E.jsxs("div",{className:"max-w-screen-md md:col-span-2",children:[E.jsxs(gh,{header:"Research",children:[E.jsxs(lh,{className:"",children:["I am a Ph.D. candidate at Carnegie Mellon University, School of Computer Science, advised by"," ",E.jsx(Ht,{href:"http://pact.cs.cmu.edu/koedinger.html",children:"Ken Koedinger"})," ","and ",E.jsx(Ht,{href:"https://www.cs.cmu.edu/~jssunshi/",children:"Josh Sunshine"}),". Here are some selected papers. Refer to the"," ",E.jsx(Ht,{href:"http://wodenimoni.com/nimo-markdown-cv/",children:"CV"})," for more."]}),E.jsx(d_,{})]}),E.jsx(gh,{header:"Tools",children:E.jsxs("div",{className:"grid lg:grid-cols-2 gap-2 md:gap-4 lg:gap-8 my-4",children:[E.jsx(Wf,{name:"Penrose",desc:"Create beautiful diagrams just by typing math notation in plain text.",link:"https://penrose.cs.cmu.edu/",logo:m3,dark:n}),E.jsx(Wf,{name:"Edgeworth",desc:"Diagrammatic problem generation by program mutation.",link:"https://penrose.github.io/penrose/edgeworth/develop/",logo:f3,dark:n}),E.jsx(Wf,{name:"Math Diagrams",desc:"A growing collection of open-source math visualizations.",link:"https://mathdiagrams.com/",dark:n,logo:b3})]})}),E.jsxs(gh,{header:"About",children:[E.jsx(lh,{children:'My name is 倪沃德 (ní wò dé) in Chinese. “Nimo” has been my alias since my street dancing days. If you find "Wo-de" hard to pronounce, default to “Nimo”.'}),E.jsx(lh,{children:"I am an avid pool player. I play in local leagues and national tournaments."})]})]}),E.jsx("div",{className:"md:ml-10 md:max-w-60",children:E.jsx(gh,{header:"News",children:E.jsx(u_,{})})}),E.jsx(b_,{})]})};Vf.createRoot(document.getElementById("root")).render(E.jsx(Ji.StrictMode,{children:E.jsx(PP,{children:E.jsx(v_,{})})})); diff --git a/assets/las-24-edgeworth-talk.key b/assets/las-24-edgeworth-talk.key new file mode 100644 index 0000000..7ea74ad Binary files /dev/null and b/assets/las-24-edgeworth-talk.key differ diff --git a/index.html b/index.html index add8d78..7b05830 100644 --- a/index.html +++ b/index.html @@ -73,7 +73,7 @@ data-utcoffset="-4" > Wode "Nimo" Ni - +